/** * Mastra `apiRoutes` for the Linear intake feature. * * Registered alongside the other `/web/*` routes, behind the WorkOS auth gate. * Mirrors the GitHub module: every route re-resolves the authenticated user * from the request cookie and scopes all rows by the caller's WorkOS org, so an * org can only ever see its own Linear connection and issues. * * When the feature is disabled (`isLinearFeatureEnabled()` false), * `buildLinearRoutes` returns only `GET /web/linear/status`, which reports * `enabled:false` so the SPA can cleanly hide all Linear UI. */ import type { ApiRoute } from '@mastra/core/server'; import type { RouteAuth } from '../../routes/route.js'; import type { StateSigner } from '../../state-signing.js'; import type { IntakeStorage } from '../../storage/domains/intake/base.js'; import type { LinearIntegration } from './integration.js'; import type { LinearRulesIngress } from './rules.js'; /** * Non-secret diagnostic snapshot of every Linear feature gate, mirroring the * GitHub diagnostics shape. Only booleans — never values. */ export interface LinearFeatureDiagnostics { linearAppConfigured: boolean; factoryAuthEnabled: boolean; appDbConfigured: boolean; } export interface MountLinearRoutesOptions { /** * The integration instance providing OAuth + GraphQL access. Required for * everything beyond the disabled `status` route. */ linear?: LinearIntegration; /** Host auth seam. Linear connections are org-owned, so the feature is inert without it. */ auth: RouteAuth; /** * Absolute base URL of the web server (e.g. `http://localhost:4111`), used to * build the OAuth redirect URI when one isn't explicitly configured. */ baseUrl?: string; /** Explicit OAuth callback URI; defaults to `/auth/linear/callback`. */ redirectUri?: string; /** * Shared OAuth `state` signer (created once per boot by the factory). * Required for the connect/callback flow; when absent, only the disabled * `status` route is served. */ stateSigner?: StateSigner; /** * Cross-integration intake selection domain. Required for the issues route's * project filter; when absent, only the disabled `status` route is served. */ intake?: IntakeStorage; /** * Factory project domain, used to keep single-project installs working * without any source binding. When absent, unbound sources are treated as * belonging to no project. */ projects?: { list(input: { orgId: string; }): Promise; }; ingestFactoryIssues?: (input: LinearRulesIngress) => Promise; } /** * Build the Linear routes as Mastra `apiRoutes`. When the feature is disabled, * returns only the `status` route so the SPA can detect the disabled state. */ export declare function buildLinearRoutes(options: MountLinearRoutesOptions): ApiRoute[]; //# sourceMappingURL=routes.d.ts.map