npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@apollo-deploy/adapter-linear

v2.0.0

Published

Linear adapter for Apollo Deploy integration hub

Downloads

251

Readme

@apollo-deploy/adapter-linear

Linear adapter for the Apollo Deploy integration hub — issue tracking with OAuth 2.0 and HMAC-SHA256 webhook verification.

Note: This adapter was originally built for the Apollo Deploy platform. We are converting the SDK into a fully generalized, provider-agnostic integration framework that any team can use — independent of Apollo Deploy. The adapter API is designed to be portable and usable standalone or with any hub implementation.

⚠️ Linear rotates refresh tokens. You must use a distributed lock when refreshing tokens. See Token lifecycle.

Installation

bun add @apollo-deploy/adapter-linear

Prerequisites

  1. Go to linear.appSettings → API → OAuth Applications → Create new application
  2. Set Application name, Description, and Redirect URI (e.g. https://yourapp.com/oauth/callback/linear)
  3. Copy the Client ID and Client Secret
  4. For webhooks: go to Settings → API → Webhooks → New Webhook, add your URL and set a Signing secret

Configuration

import { createLinearAdapter } from '@apollo-deploy/adapter-linear';

const linear = createLinearAdapter({
  clientId: process.env.LINEAR_CLIENT_ID!,
  clientSecret: process.env.LINEAR_CLIENT_SECRET!,
  webhookSecret: process.env.LINEAR_WEBHOOK_SECRET!,
  // redirectUri: 'https://yourapp.com/oauth/callback/linear',
});

Options

| Option | Type | Required | Description | |--------|------|----------|-------------| | clientId | string | ✅ | Linear OAuth Application Client ID | | clientSecret | string | ✅ | Linear OAuth Application Client Secret | | webhookSecret | string | ✅ | Signing secret from Linear webhook settings — used to verify linear-signature | | redirectUri | string | No | OAuth redirect URI |

Environment variables

LINEAR_CLIENT_ID=abc123def456ghi789
LINEAR_CLIENT_SECRET=lin_api_your_secret_here
LINEAR_WEBHOOK_SECRET=whsec_at_least_32_chars

Registering with the hub

import { IntegrationHub } from '@apollo-deploy/integrations';
import { createLinearAdapter } from '@apollo-deploy/adapter-linear';

const hub = new IntegrationHub();

hub.register('linear', createLinearAdapter({
  clientId: process.env.LINEAR_CLIENT_ID!,
  clientSecret: process.env.LINEAR_CLIENT_SECRET!,
  webhookSecret: process.env.LINEAR_WEBHOOK_SECRET!,
}));

await hub.initialize();

Webhook handler

export async function POST(req: Request) {
  const rawBody = Buffer.from(await req.arrayBuffer());
  const headers = Object.fromEntries(req.headers.entries());

  const result = await hub.webhooks.linear({ rawBody, headers });
  return Response.json({ ok: true }, { status: result.statusCode ?? 200 });
}

Signature: linear-signature: <hmac-sha256>

Supported events: Issue.create, Issue.update, Issue.remove, Comment.create, Comment.update, Comment.remove, Project.update, ProjectUpdate.create, Cycle.update, Reaction.create

Token lifecycle

| Field | Value | |-------|-------| | Expiry | 24 hours | | Refreshable | Yes | | Rotates refresh token | Yes ⚠️ | | Requires distributed lock | Yes ⚠️ |

Linear issues a new refresh token on every refresh call (RFC 6749 token rotation). You must:

  1. Acquire a distributed lock before calling refreshToken
  2. Atomically write both accessToken and refreshToken to your database
  3. Release the lock
async function refreshLinearTokens(userId: string) {
  const lock = await acquireLock(`linear:refresh:${userId}`);
  try {
    const stored = await db.tokens.findOne({ userId, provider: 'linear' });
    const refreshed = await linearAdapter.oauth.refreshToken(stored.refreshToken);
    await db.tokens.update({ userId, provider: 'linear' }, {
      accessToken: refreshed.accessToken,
      refreshToken: refreshed.refreshToken,
      expiresAt: refreshed.expiresAt,
    });
    return refreshed;
  } finally {
    await lock.release();
  }
}

Capability: issue-tracking

const it = hub.getAdapter('linear').issueTracking!;

// List issues
const issues = await it.listIssues(tokens, { teamId: 'TEAM-ID', limit: 25 });

// Get a single issue
const issue = await it.getIssue(tokens, { issueId: 'ISSUE-ID' });

// Create an issue
const created = await it.createIssue(tokens, {
  teamId: 'TEAM-ID',
  title: 'Bug: checkout fails on mobile',
  description: 'Steps to reproduce...',
  priority: 2,
});

// Update an issue
await it.updateIssue(tokens, {
  issueId: 'ISSUE-ID',
  stateId: 'STATE-ID',
  assigneeId: 'USER-ID',
});

// Add a comment
await it.addComment(tokens, {
  issueId: 'ISSUE-ID',
  body: 'Fixed in v1.2.3',
});

Development

bun run build
bun run typecheck
bun run test
bun run dev
bun run clean