@shipfox/api-integration-linear 5.0.0 → 7.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
1
  $ shipfox-swc
2
- Successfully compiled: 23 files with swc (245.18ms)
2
+ Successfully compiled: 24 files with swc (322.47ms)
package/CHANGELOG.md CHANGED
@@ -1,5 +1,52 @@
1
1
  # @shipfox/api-integration-linear
2
2
 
3
+ ## 7.0.1
4
+
5
+ ### Patch Changes
6
+
7
+ - ffc7fc9: Republishes the affected release set after recovering package publication.
8
+ - Updated dependencies [ffc7fc9]
9
+ - @shipfox/api-workspaces@7.0.1
10
+
11
+ ## 7.0.0
12
+
13
+ ### Patch Changes
14
+
15
+ - @shipfox/api-workspaces@7.0.0
16
+
17
+ ## 6.0.0
18
+
19
+ ### Minor Changes
20
+
21
+ - f262539: Adds a composed webhook processor and optional provider-neutral delivery source for hosted API runtimes.
22
+ - a42b575: Exposes Secrets through its inter-module contract and migrates Agent, integrations, and Workflows consumers.
23
+ - 8aa7cd3: Adds a shared Linear webhook processor that preserves raw-body signatures and receipt-time replay validation.
24
+
25
+ ### Patch Changes
26
+
27
+ - f73da5d: Enforces bounded API context imports and routes inter-module consumers through producer contracts.
28
+ - 326f4c0: Exposes Workspaces inter-module operations and moves Auth and OAuth providers onto injected clients.
29
+ - Updated dependencies [0bb82a4]
30
+ - Updated dependencies [7366f04]
31
+ - Updated dependencies [7ac43a4]
32
+ - Updated dependencies [f262539]
33
+ - Updated dependencies [3bb4e26]
34
+ - Updated dependencies [c2db8c3]
35
+ - Updated dependencies [8bdc149]
36
+ - Updated dependencies [f73da5d]
37
+ - Updated dependencies [6bdf24b]
38
+ - Updated dependencies [b00ed29]
39
+ - Updated dependencies [8aa7cd3]
40
+ - Updated dependencies [326f4c0]
41
+ - Updated dependencies [1820feb]
42
+ - Updated dependencies [4604a06]
43
+ - @shipfox/api-integration-core-dto@6.0.0
44
+ - @shipfox/api-workspaces@6.0.0
45
+ - @shipfox/node-drizzle@0.3.2
46
+ - @shipfox/api-auth-context@6.0.0
47
+ - @shipfox/node-fastify@0.2.4
48
+ - @shipfox/api-integration-linear-dto@6.0.0
49
+
3
50
  ## 5.0.0
4
51
 
5
52
  ### Minor Changes
@@ -0,0 +1,13 @@
1
+ import { type GetIntegrationConnectionByIdFn, type PublishIntegrationEventReceivedFn, type RecordDeliveryOnlyFn, type StoredWebhookRequest, type WebhookProcessingResult } from '@shipfox/api-integration-core-dto';
2
+ import type { NodePgDatabase } from 'drizzle-orm/node-postgres';
3
+ export interface CreateLinearWebhookProcessorOptions {
4
+ coreDb: () => NodePgDatabase<Record<string, unknown>>;
5
+ publishIntegrationEventReceived: PublishIntegrationEventReceivedFn;
6
+ recordDeliveryOnly: RecordDeliveryOnlyFn;
7
+ getIntegrationConnectionById: GetIntegrationConnectionByIdFn;
8
+ }
9
+ export interface LinearWebhookProcessor {
10
+ process(request: StoredWebhookRequest): Promise<WebhookProcessingResult>;
11
+ }
12
+ export declare function createLinearWebhookProcessor(options: CreateLinearWebhookProcessorOptions): LinearWebhookProcessor;
13
+ //# sourceMappingURL=webhook-processor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webhook-processor.d.ts","sourceRoot":"","sources":["../../src/core/webhook-processor.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,8BAA8B,EACnC,KAAK,iCAAiC,EACtC,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EACzB,KAAK,uBAAuB,EAC7B,MAAM,mCAAmC,CAAC;AAO3C,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,2BAA2B,CAAC;AAS9D,MAAM,WAAW,mCAAmC;IAClD,MAAM,EAAE,MAAM,cAAc,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IACtD,+BAA+B,EAAE,iCAAiC,CAAC;IACnE,kBAAkB,EAAE,oBAAoB,CAAC;IACzC,4BAA4B,EAAE,8BAA8B,CAAC;CAC9D;AAED,MAAM,WAAW,sBAAsB;IACrC,OAAO,CAAC,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAAC;CAC1E;AAED,wBAAgB,4BAA4B,CAC1C,OAAO,EAAE,mCAAmC,GAC3C,sBAAsB,CAExB"}
@@ -0,0 +1,130 @@
1
+ import { Buffer } from 'node:buffer';
2
+ import { decodeWebhookBody } from '@shipfox/api-integration-core-dto';
3
+ import { LINEAR_PROVIDER, linearWebhookBaseEnvelopeSchema } from '@shipfox/api-integration-linear-dto';
4
+ import { verifyHexHmacSignature } from '@shipfox/node-fastify';
5
+ import { logger } from '@shipfox/node-opentelemetry';
6
+ import { config } from '#config.js';
7
+ import { handleLinearWebhook } from '#core/webhook.js';
8
+ const DELIVERY_HEADER = 'linear-delivery';
9
+ const EVENT_HEADER = 'linear-event';
10
+ const SIGNATURE_HEADER = 'linear-signature';
11
+ const WEBHOOK_REPLAY_WINDOW_MS = 60_000;
12
+ export function createLinearWebhookProcessor(options) {
13
+ return {
14
+ process: (request)=>processLinearWebhookRequest(options, request)
15
+ };
16
+ }
17
+ async function processLinearWebhookRequest(options, request) {
18
+ if (request.route_id !== 'linear') {
19
+ throw new Error(`Linear processor cannot process ${request.route_id} requests`);
20
+ }
21
+ const deliveryId = request.headers[DELIVERY_HEADER];
22
+ const event = request.headers[EVENT_HEADER];
23
+ const signature = request.headers[SIGNATURE_HEADER];
24
+ if (!deliveryId || !event || !signature) {
25
+ return {
26
+ outcome: 'discarded',
27
+ reason: 'missing_required_input'
28
+ };
29
+ }
30
+ const rawBody = Buffer.from(decodeWebhookBody(request.body));
31
+ if (!verifyHexHmacSignature({
32
+ rawBody,
33
+ signature,
34
+ secret: config.LINEAR_WEBHOOK_SIGNING_SECRET
35
+ })) {
36
+ return {
37
+ outcome: 'discarded',
38
+ reason: 'invalid_signature',
39
+ deliveryId
40
+ };
41
+ }
42
+ let rawPayload;
43
+ try {
44
+ rawPayload = JSON.parse(rawBody.toString('utf8'));
45
+ } catch (error) {
46
+ logger().warn({
47
+ deliveryId,
48
+ err: error
49
+ }, 'linear webhook payload JSON parse failed');
50
+ return {
51
+ outcome: 'discarded',
52
+ reason: 'malformed_payload',
53
+ deliveryId
54
+ };
55
+ }
56
+ const payload = linearWebhookBaseEnvelopeSchema.safeParse(rawPayload);
57
+ if (!payload.success) {
58
+ logger().warn({
59
+ deliveryId,
60
+ issues: payload.error.issues
61
+ }, 'linear webhook envelope failed schema validation');
62
+ await recordSignedDeliveryOnly(options, deliveryId);
63
+ return {
64
+ outcome: 'discarded',
65
+ reason: 'unsupported_event',
66
+ deliveryId
67
+ };
68
+ }
69
+ const receivedAt = new Date(request.received_at).getTime();
70
+ if (Math.abs(receivedAt - payload.data.webhookTimestamp) > WEBHOOK_REPLAY_WINDOW_MS) {
71
+ return {
72
+ outcome: 'discarded',
73
+ reason: 'stale_at_receipt',
74
+ deliveryId
75
+ };
76
+ }
77
+ if (event !== payload.data.type) {
78
+ logger().warn({
79
+ deliveryId,
80
+ event,
81
+ type: payload.data.type
82
+ }, 'linear webhook event header did not match payload type');
83
+ await recordSignedDeliveryOnly(options, deliveryId);
84
+ return {
85
+ outcome: 'discarded',
86
+ reason: 'unsupported_event',
87
+ deliveryId
88
+ };
89
+ }
90
+ const result = await options.coreDb().transaction(async (tx)=>handleLinearWebhook({
91
+ tx,
92
+ deliveryId,
93
+ payload: payload.data,
94
+ rawPayload,
95
+ publishIntegrationEventReceived: options.publishIntegrationEventReceived,
96
+ recordDeliveryOnly: options.recordDeliveryOnly,
97
+ getIntegrationConnectionById: options.getIntegrationConnectionById
98
+ }));
99
+ if (result.outcome === 'published') return {
100
+ outcome: 'processed',
101
+ deliveryId
102
+ };
103
+ if (result.outcome === 'duplicate') return {
104
+ outcome: 'duplicate',
105
+ deliveryId
106
+ };
107
+ if (result.outcome === 'unsupported-event') {
108
+ return {
109
+ outcome: 'discarded',
110
+ reason: 'unsupported_event',
111
+ deliveryId
112
+ };
113
+ }
114
+ return {
115
+ outcome: 'discarded',
116
+ reason: 'connection_unavailable',
117
+ deliveryId
118
+ };
119
+ }
120
+ async function recordSignedDeliveryOnly(options, deliveryId) {
121
+ await options.coreDb().transaction(async (tx)=>{
122
+ await options.recordDeliveryOnly({
123
+ tx,
124
+ provider: LINEAR_PROVIDER,
125
+ deliveryId
126
+ });
127
+ });
128
+ }
129
+
130
+ //# sourceMappingURL=webhook-processor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/core/webhook-processor.ts"],"sourcesContent":["import {Buffer} from 'node:buffer';\nimport {\n decodeWebhookBody,\n type GetIntegrationConnectionByIdFn,\n type PublishIntegrationEventReceivedFn,\n type RecordDeliveryOnlyFn,\n type StoredWebhookRequest,\n type WebhookProcessingResult,\n} from '@shipfox/api-integration-core-dto';\nimport {\n LINEAR_PROVIDER,\n linearWebhookBaseEnvelopeSchema,\n} from '@shipfox/api-integration-linear-dto';\nimport {verifyHexHmacSignature} from '@shipfox/node-fastify';\nimport {logger} from '@shipfox/node-opentelemetry';\nimport type {NodePgDatabase} from 'drizzle-orm/node-postgres';\nimport {config} from '#config.js';\nimport {handleLinearWebhook} from '#core/webhook.js';\n\nconst DELIVERY_HEADER = 'linear-delivery';\nconst EVENT_HEADER = 'linear-event';\nconst SIGNATURE_HEADER = 'linear-signature';\nconst WEBHOOK_REPLAY_WINDOW_MS = 60_000;\n\nexport interface CreateLinearWebhookProcessorOptions {\n coreDb: () => NodePgDatabase<Record<string, unknown>>;\n publishIntegrationEventReceived: PublishIntegrationEventReceivedFn;\n recordDeliveryOnly: RecordDeliveryOnlyFn;\n getIntegrationConnectionById: GetIntegrationConnectionByIdFn;\n}\n\nexport interface LinearWebhookProcessor {\n process(request: StoredWebhookRequest): Promise<WebhookProcessingResult>;\n}\n\nexport function createLinearWebhookProcessor(\n options: CreateLinearWebhookProcessorOptions,\n): LinearWebhookProcessor {\n return {process: (request) => processLinearWebhookRequest(options, request)};\n}\n\nasync function processLinearWebhookRequest(\n options: CreateLinearWebhookProcessorOptions,\n request: StoredWebhookRequest,\n): Promise<WebhookProcessingResult> {\n if (request.route_id !== 'linear') {\n throw new Error(`Linear processor cannot process ${request.route_id} requests`);\n }\n\n const deliveryId = request.headers[DELIVERY_HEADER];\n const event = request.headers[EVENT_HEADER];\n const signature = request.headers[SIGNATURE_HEADER];\n if (!deliveryId || !event || !signature) {\n return {outcome: 'discarded', reason: 'missing_required_input'};\n }\n\n const rawBody = Buffer.from(decodeWebhookBody(request.body));\n if (\n !verifyHexHmacSignature({\n rawBody,\n signature,\n secret: config.LINEAR_WEBHOOK_SIGNING_SECRET,\n })\n ) {\n return {outcome: 'discarded', reason: 'invalid_signature', deliveryId};\n }\n\n let rawPayload: unknown;\n try {\n rawPayload = JSON.parse(rawBody.toString('utf8'));\n } catch (error) {\n logger().warn({deliveryId, err: error}, 'linear webhook payload JSON parse failed');\n return {outcome: 'discarded', reason: 'malformed_payload', deliveryId};\n }\n\n const payload = linearWebhookBaseEnvelopeSchema.safeParse(rawPayload);\n if (!payload.success) {\n logger().warn(\n {deliveryId, issues: payload.error.issues},\n 'linear webhook envelope failed schema validation',\n );\n await recordSignedDeliveryOnly(options, deliveryId);\n return {outcome: 'discarded', reason: 'unsupported_event', deliveryId};\n }\n\n const receivedAt = new Date(request.received_at).getTime();\n if (Math.abs(receivedAt - payload.data.webhookTimestamp) > WEBHOOK_REPLAY_WINDOW_MS) {\n return {outcome: 'discarded', reason: 'stale_at_receipt', deliveryId};\n }\n\n if (event !== payload.data.type) {\n logger().warn(\n {deliveryId, event, type: payload.data.type},\n 'linear webhook event header did not match payload type',\n );\n await recordSignedDeliveryOnly(options, deliveryId);\n return {outcome: 'discarded', reason: 'unsupported_event', deliveryId};\n }\n\n const result = await options.coreDb().transaction(async (tx) =>\n handleLinearWebhook({\n tx,\n deliveryId,\n payload: payload.data,\n rawPayload,\n publishIntegrationEventReceived: options.publishIntegrationEventReceived,\n recordDeliveryOnly: options.recordDeliveryOnly,\n getIntegrationConnectionById: options.getIntegrationConnectionById,\n }),\n );\n\n if (result.outcome === 'published') return {outcome: 'processed', deliveryId};\n if (result.outcome === 'duplicate') return {outcome: 'duplicate', deliveryId};\n if (result.outcome === 'unsupported-event') {\n return {outcome: 'discarded', reason: 'unsupported_event', deliveryId};\n }\n return {outcome: 'discarded', reason: 'connection_unavailable', deliveryId};\n}\n\nasync function recordSignedDeliveryOnly(\n options: Pick<CreateLinearWebhookProcessorOptions, 'coreDb' | 'recordDeliveryOnly'>,\n deliveryId: string,\n): Promise<void> {\n await options.coreDb().transaction(async (tx) => {\n await options.recordDeliveryOnly({tx, provider: LINEAR_PROVIDER, deliveryId});\n });\n}\n"],"names":["Buffer","decodeWebhookBody","LINEAR_PROVIDER","linearWebhookBaseEnvelopeSchema","verifyHexHmacSignature","logger","config","handleLinearWebhook","DELIVERY_HEADER","EVENT_HEADER","SIGNATURE_HEADER","WEBHOOK_REPLAY_WINDOW_MS","createLinearWebhookProcessor","options","process","request","processLinearWebhookRequest","route_id","Error","deliveryId","headers","event","signature","outcome","reason","rawBody","from","body","secret","LINEAR_WEBHOOK_SIGNING_SECRET","rawPayload","JSON","parse","toString","error","warn","err","payload","safeParse","success","issues","recordSignedDeliveryOnly","receivedAt","Date","received_at","getTime","Math","abs","data","webhookTimestamp","type","result","coreDb","transaction","tx","publishIntegrationEventReceived","recordDeliveryOnly","getIntegrationConnectionById","provider"],"mappings":"AAAA,SAAQA,MAAM,QAAO,cAAc;AACnC,SACEC,iBAAiB,QAMZ,oCAAoC;AAC3C,SACEC,eAAe,EACfC,+BAA+B,QAC1B,sCAAsC;AAC7C,SAAQC,sBAAsB,QAAO,wBAAwB;AAC7D,SAAQC,MAAM,QAAO,8BAA8B;AAEnD,SAAQC,MAAM,QAAO,aAAa;AAClC,SAAQC,mBAAmB,QAAO,mBAAmB;AAErD,MAAMC,kBAAkB;AACxB,MAAMC,eAAe;AACrB,MAAMC,mBAAmB;AACzB,MAAMC,2BAA2B;A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reParams, GetLinearAccessTokenParams, LinearCo
23
23
  export { createLinearTokenStore, linearSecretsNamespace, } from '#core/tokens.js';
24
24
  export type { HandleLinearWebhookOutcome, HandleLinearWebhookParams } from '#core/webhook.js';
25
25
  export { handleLinearWebhook } from '#core/webhook.js';
26
+ export type { CreateLinearWebhookProcessorOptions, LinearWebhookProcessor, } from '#core/webhook-processor.js';
27
+ export { createLinearWebhookProcessor } from '#core/webhook-processor.js';
26
28
  export type { LinearInstallation, LinearInstallationStatus, UpdateLinearInstallationTokenExpiryParams, UpsertLinearInstallationParams, } from '#db/installations.js';
27
29
  export { deleteLinearInstallationByConnectionId, getLinearInstallationByConnectionId, getLinearInstallationByOrganizationId, markLinearInstallationRevoked, updateLinearInstallationTokenExpiry, upsertLinearInstallation, withLinearRefreshLock, } from '#db/installations.js';
28
30
  export { type CreateLinearE2eRoutesOptions, createLinearE2eRoutes, } from '#presentation/e2eRoutes/index.js';
@@ -50,6 +52,10 @@ export interface CreateLinearIntegrationProviderOptions {
50
52
  }
51
53
  export declare function createLinearIntegrationProvider(options?: CreateLinearIntegrationProviderOptions): {
52
54
  routes: import("@shipfox/node-fastify").RouteGroup[];
55
+ webhookProcessors: {
56
+ routeIds: readonly ["linear"];
57
+ processor: import("#core/webhook-processor.js").LinearWebhookProcessor;
58
+ }[] | undefined;
53
59
  deleteConnectionRecords?: (connection: {
54
60
  id: string;
55
61
  }, options: {
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAwB,KAAK,eAAe,EAAC,MAAM,gBAAgB,CAAC;AAC3E,OAAO,EAAC,MAAM,EAAC,MAAM,YAAY,CAAC;AAClC,OAAO,EAAC,wBAAwB,EAAC,MAAM,+BAA+B,CAAC;AACvE,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,iBAAiB,CAAC;AACtD,OAAO,EAAC,OAAO,EAAE,EAAE,EAAC,MAAM,WAAW,CAAC;AACt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AAI,CAAC,CAAC;KAC5F,GACD,SAAS,CAAC;IACd,MAAM,CAAC,EACH,CAAC,IAAI,CAAC,oCAAoC,EAAE,QAAQ,GAAG,wBAAwB,CAAC,GAC9E,OAAO,CAAC,gCAAgC,CAAC,CAAC,GAC5C,SAAS,CAAC;CACf;AAED,wBAAgB,+BAA+B,CAC7C,OAAO,GAAE,sCAA2C;;;;;;8BAdpB,CACxB,UAAU,EAAE;QAAC,EAAE,EAAE,MAAM,CAAA;KAAC,EACxB,OAAO,EAAE;QAAC,EAAE,EAAE,OAAO,CAAA;KAAC,KACnB,OAAO,CAAC,IAAI,CAAC;8BACQ,CAAC,UAAU,EAAE;QAAC,EAAE,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAC,KAAK,OAAO,CAAC,IAAI,CAAC;;;;;;;;sCA0CtD;QAAC,EAAE,EAAE,MAAM,CAAA;KAAC,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;EAWrF"}
package/dist/index.js CHANGED
@@ -2,6 +2,7 @@ import { LINEAR_PROVIDER } from '@shipfox/api-integration-linear-dto';
2
2
  import { createLinearApiClient } from '#api/client.js';
3
3
  import { config } from '#config.js';
4
4
  import { LinearAgentToolsProvider } from '#core/agent-tools-provider.js';
5
+ import { createLinearWebhookProcessor } from '#core/webhook-processor.js';
5
6
  import { closeDb, db } from '#db/db.js';
6
7
  import { getLinearInstallationByConnectionId } from '#db/installations.js';
7
8
  import { migrationsPath } from '#db/migrations.js';
@@ -16,6 +17,7 @@ export { assertLinearAuthorizationScopes, formatLinearOAuthScopes, LINEAR_OAUTH_
16
17
  export { signLinearInstallState, verifyLinearInstallState } from '#core/state.js';
17
18
  export { createLinearTokenStore, linearSecretsNamespace } from '#core/tokens.js';
18
19
  export { handleLinearWebhook } from '#core/webhook.js';
20
+ export { createLinearWebhookProcessor } from '#core/webhook-processor.js';
19
21
  export { deleteLinearInstallationByConnectionId, getLinearInstallationByConnectionId, getLinearInstallationByOrganizationId, markLinearInstallationRevoked, updateLinearInstallationTokenExpiry, upsertLinearInstallation, withLinearRefreshLock } from '#db/installations.js';
20
22
  export { createLinearE2eRoutes } from '#presentation/e2eRoutes/index.js';
21
23
  export { closeDb, config, db, migrationsPath };
@@ -25,6 +27,7 @@ export function createLinearIntegrationProvider(options = {}) {
25
27
  const adapters = options.agentTools ? {
26
28
  agent_tools: new LinearAgentToolsProvider(options.agentTools)
27
29
  } : {};
30
+ const webhookProcessor = options.routes && hasLinearWebhookRoutesOptions(options.routes) ? createLinearWebhookProcessor(options.routes) : undefined;
28
31
  const routes = options.routes ? [
29
32
  createLinearIntegrationRoutes({
30
33
  linear,
@@ -34,8 +37,11 @@ export function createLinearIntegrationProvider(options = {}) {
34
37
  ...options.routes
35
38
  })
36
39
  ] : [];
37
- if (options.routes && hasLinearWebhookRoutesOptions(options.routes)) {
38
- routes.push(createLinearWebhookRoutes(options.routes));
40
+ if (options.routes && hasLinearWebhookRoutesOptions(options.routes) && webhookProcessor) {
41
+ routes.push(createLinearWebhookRoutes({
42
+ ...options.routes,
43
+ processor: webhookProcessor
44
+ }));
39
45
  }
40
46
  return {
41
47
  provider: LINEAR_PROVIDER,
@@ -47,7 +53,15 @@ export function createLinearIntegrationProvider(options = {}) {
47
53
  return `https://linear.app/${encodeURIComponent(installation.organizationUrlKey)}/settings`;
48
54
  },
49
55
  ...options.cleanup,
50
- routes
56
+ routes,
57
+ webhookProcessors: webhookProcessor ? [
58
+ {
59
+ routeIds: [
60
+ 'linear'
61
+ ],
62
+ processor: webhookProcessor
63
+ }
64
+ ] : undefined
51
65
  };
52
66
  }
53
67
  function hasLinearWebhookRoutesOptions(routes) {
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import {LINEAR_PROVIDER} from '@shipfox/api-integration-linear-dto';\nimport {createLinearApiClient, type LinearApiClient} from '#api/client.js';\nimport {config} from '#config.js';\nimport {LinearAgentToolsProvider} from '#core/agent-tools-provider.js';\nimport type {LinearTokenStore} from '#core/tokens.js';\nimport {closeDb, db} from '#db/db.js';\nimport {getLinearInstallationByConnectionId} from '#db/installations.js';\nimport {migrationsPath} from '#db/migrations.js';\nimport {\n type CreateLinearIntegrationRoutesOptions,\n createLinearIntegrationRoutes,\n} from '#presentation/routes/install.js';\nimport {\n type CreateLinearWebhookRoutesOptions,\n createLinearWebhookRoutes,\n} from '#presentation/routes/webhooks.js';\n\nexport type {LinearProvider} from '@shipfox/api-integration-linear-dto';\nexport type {LinearApiClient, LinearAuthorization, LinearIdentity} from '#api/client.js';\nexport {createLinearApiClient} from '#api/client.js';\nexport type {\n LinearAgentToolCatalogEntry,\n LinearAgentToolCategory,\n LinearAgentToolId,\n LinearAgentToolRequiredScope,\n} from '#core/agent-tools.js';\nexport {\n linearAgentToolCatalog,\n linearAgentToolSelectionCatalog,\n} from '#core/agent-tools.js';\nexport {\n type DisconnectLinearInstallationParams,\n disconnectLinearInstallation,\n} from '#core/disconnect.js';\nexport {\n LinearAccessTokenMissingError,\n LinearAuthorizationScopeMismatchError,\n LinearConnectionAlreadyLinkedError,\n LinearConnectionNotFoundError,\n LinearInstallationAlreadyLinkedError,\n LinearInstallStateActorMismatchError,\n LinearInstallStateError,\n LinearIntegrationProviderError,\n LinearOAuthCallbackError,\n LinearTokenUnrefreshableError,\n} from '#core/errors.js';\nexport type {ConnectLinearInstallationInput, HandleLinearCallbackParams} from '#core/install.js';\nexport {handleLinearCallback, handleLinearOAuthCallbackError} from '#core/install.js';\nexport {\n assertLinearAuthorizationScopes,\n formatLinearOAuthScopes,\n LINEAR_OAUTH_SCOPES,\n} from '#core/scopes.js';\nexport type {LinearInstallStateClaims} from '#core/state.js';\nexport {signLinearInstallState, verifyLinearInstallState} from '#core/state.js';\nexport type {\n CreateLinearTokenStoreParams,\n GetLinearAccessTokenParams,\n LinearConnectionResolverResult,\n LinearSecretsStore,\n LinearTokenStore,\n StoreLinearTokensParams,\n} from '#core/tokens.js';\nexport {\n createLinearTokenStore,\n linearSecretsNamespace,\n} from '#core/tokens.js';\nexport type {HandleLinearWebhookOutcome, HandleLinearWebhookParams} from '#core/webhook.js';\nexport {handleLinearWebhook} from '#core/webhook.js';\nexport type {\n LinearInstallation,\n LinearInstallationStatus,\n UpdateLinearInstallationTokenExpiryParams,\n UpsertLinearInstallationParams,\n} from '#db/installations.js';\nexport {\n deleteLinearInstallationByConnectionId,\n getLinearInstallationByConnectionId,\n getLinearInstallationByOrganizationId,\n markLinearInstallationRevoked,\n updateLinearInstallationTokenExpiry,\n upsertLinearInstallation,\n withLinearRefreshLock,\n} from '#db/installations.js';\nexport {\n type CreateLinearE2eRoutesOptions,\n createLinearE2eRoutes,\n} from '#presentation/e2eRoutes/index.js';\nexport {closeDb, config, db, migrationsPath};\n\nexport interface CreateLinearIntegrationProviderOptions {\n linear?: LinearApiClient | undefined;\n agentTools?:\n | {\n tokenStore: Pick<LinearTokenStore, 'getAccessToken'>;\n endpoint?: string | URL | undefined;\n callTimeoutMs?: number | undefined;\n }\n | undefined;\n getLinearInstallationByConnectionId?: typeof getLinearInstallationByConnectionId | undefined;\n cleanup?:\n | {\n deleteConnectionRecords?: (\n connection: {id: string},\n options: {tx: unknown},\n ) => Promise<void>;\n deleteConnectionSecrets?: (connection: {id: string; workspaceId: string}) => Promise<void>;\n }\n | undefined;\n routes?:\n | (Omit<CreateLinearIntegrationRoutesOptions, 'linear' | 'connectionCapabilities'> &\n Partial<CreateLinearWebhookRoutesOptions>)\n | undefined;\n}\n\nexport function createLinearIntegrationProvider(\n options: CreateLinearIntegrationProviderOptions = {},\n) {\n const linear = options.linear ?? createLinearApiClient();\n const getInstallationByConnectionId =\n options.getLinearInstallationByConnectionId ?? getLinearInstallationByConnectionId;\n const adapters = options.agentTools\n ? {\n agent_tools: new LinearAgentToolsProvider(options.agentTools),\n }\n : {};\n\n const routes = options.routes\n ? [\n createLinearIntegrationRoutes({\n linear,\n connectionCapabilities: adapters.agent_tools ? ['agent_tools'] : [],\n ...options.routes,\n }),\n ]\n : [];\n if (options.routes && hasLinearWebhookRoutesOptions(options.routes)) {\n routes.push(createLinearWebhookRoutes(options.routes));\n }\n\n return {\n provider: LINEAR_PROVIDER,\n displayName: 'Linear',\n adapters,\n async connectionExternalUrl(connection: {id: string}): Promise<string | undefined> {\n const installation = await getInstallationByConnectionId(connection.id);\n if (!installation?.organizationUrlKey) return undefined;\n return `https://linear.app/${encodeURIComponent(installation.organizationUrlKey)}/settings`;\n },\n ...options.cleanup,\n routes,\n };\n}\n\nfunction hasLinearWebhookRoutesOptions(\n routes: Partial<CreateLinearWebhookRoutesOptions>,\n): routes is CreateLinearWebhookRoutesOptions {\n return (\n routes.coreDb !== undefined &&\n routes.publishIntegrationEventReceived !== undefined &&\n routes.recordDeliveryOnly !== undefined &&\n routes.getIntegrationConnectionById !== undefined\n );\n}\n"],"names":["LINEAR_PROVIDER","createLinearApiClient","config","LinearAgentToolsProvider","closeDb","db","getLinearInstallationByConnectionId","migrationsPath","createLinearIntegrationRoutes","createLinearWebhookRoutes","linearAgentToolCatalog","linearAgentToolSelectionCatalog","disconnectLinearInstallation","LinearAccessTokenMissingError","LinearAuthorizationScopeMismatchError","LinearConnectionAlreadyLinkedError","LinearConnectionNotFoundError","LinearInstallationAlreadyLinkedError","LinearInstallStateActorMismatchError","LinearInstallStateError","LinearIntegrationProviderError","LinearOAuthCallbackError","LinearTokenUnrefreshableError","handleLinearCallback","handleLinearOAuthCallbackError","assertLinearAuthorizationScopes","formatLinearOAuthScopes","LINEAR_OAUTH_SCOPES","signLinearInstallState","verifyLinearInstallState","createLinearTokenStore","linearSecretsNamespace","handleLinearWebhook","deleteLinearInstallationByConnectionId","getLinearInstallationByOrganizationId","markLinearInstallationRevoked","updateLinearInstallationTokenExpiry","upsertLinearInstallation","withLinearRefreshLock","createLinearE2eRoutes","createLinearIntegrationProvider","options","linear","getInstallationByConnectionId","adapters","agentTools","agent_tools","routes","connectionCapabilities","hasLinearWebhookRoutesOptions","push","provider","displayName","connectionExternalUrl","connection","installation","id","organizationUrlKey","undefined","encodeURIComponent","cleanup","coreDb","publishIntegrationEventReceived","recordDeliveryOnly","getIntegrationConnectionById"],"mappings":"AAAA,SAAQA,eAAe,QAAO,sCAAsC;AACpE,SAAQC,qBAAqB,QAA6B,iBAAiB;AAC3E,SAAQC,MAAM,QAAO,aAAa;AAClC,SAAQC,wBAAwB,QAAO,gCAAgC;AAEvE,SAAQC,OAAO,EAAEC,EAAE,QAAO,YAAY;AACtC,SAAQC,mCAAmC,QAAO,uBAAuB;AACzE,SAAQC,cAAc,QAAO,oBAAoB;AACjD,SAEEC,6BAA6B,QACxB,kCAAkC;AACzC,SAEEC,yBAAyB,QACpB,mCAAmC;AAI1C,SAAQR,qBAAqB,QAAO,iBAAiB;AAOrD,SACES,sBAAsB,EACtBC,+BAA+B,QAC1B,uBAAuB;AAC9B,SAEEC,4BAA4B,QACvB,sBAAsB;AAC7B,SACEC,6BAA6B,EAC7BC,qCAAqC,EACrCC,kCAAkC,EAClCC,6BAA6B,EAC7BC,oCAAoC,EACpCC,oCAAoC,EACpCC,uBAAuB,EACvBC,8BAA8B,EAC9BC,wBAAwB,EACxBC,6BAA6B,QACxB,kBAAkB;AAEzB,SAAQC,oBAAoB,EAAEC,8BAA8B,QAAO,mBAAmB;AACtF,SACEC,+BAA+B,EAC/BC,uBAAuB,EACvBC,mBAAmB,QACd,kBAAkB;AAEzB,SAAQC,sBAAsB,EAAEC,wBAAwB,QAAO,iBAAiB;AAShF,SACEC,sBAAsB,EACtBC,sBAAsB,QACjB,kBAAkB;AAEzB,SAAQC,mBAAmB,QAAO,mBAAmB;AAOrD,SACEC,sCAAsC,EACtC3B,mCAAmC,EACnC4B,qCAAqC,EACrCC,6BAA6B,EAC7BC,mCAAmC,EACnCC,wBAAwB,EACxBC,qBAAqB,QAChB,uBAAuB;AAC9B,SAEEC,qBAAqB,QAChB,mCAAmC;AAC1C,SAAQnC,OAAO,EAAEF,MAAM,EAAEG,EAAE,EAAEE,cAAc,GAAE;AA2B7C,OAAO,SAASiC,gCACdC,UAAkD,CAAC,CAAC;IAEpD,MAAMC,SAASD,QAAQC,MAAM,IAAIzC;IACjC,MAAM0C,gCACJF,QAAQnC,mCAAmC,IAAIA;IACjD,MAAMsC,WAAWH,QAAQI,UAAU,GAC/B;QACEC,aAAa,IAAI3C,yBAAyBsC,QAAQI,UAAU;IAC9D,IACA,CAAC;IAEL,MAAME,SAASN,QAAQM,MAAM,GACzB;QACEvC,8BAA8B;YAC5BkC;YACAM,wBAAwBJ,SAASE,WAAW,GAAG;gBAAC;aAAc,GAAG,EAAE;YACnE,GAAGL,QAAQM,MAAM;QACnB;KACD,GACD,EAAE;IACN,IAAIN,QAAQM,MAAM,IAAIE,8BAA8BR,QAAQM,MAAM,GAAG;QACnEA,OAAOG,IAAI,CAACzC,0BAA0BgC,QAAQM,MAAM;IACtD;IAEA,OAAO;QACLI,UAAUnD;QACVoD,aAAa;QACbR;QACA,MAAMS,uBAAsBC,UAAwB;YAClD,MAAMC,eAAe,MAAMZ,8BAA8BW,WAAWE,EAAE;YACtE,IAAI,CAACD,cAAcE,oBAAoB,OAAOC;YAC9C,OAAO,CAAC,mBAAmB,EAAEC,mBAAmBJ,aAAaE,kBAAkB,EAAE,SAAS,CAAC;QAC7F;QACA,GAAGhB,QAAQmB,OAAO;QAClBb;IACF;AACF;AAEA,SAASE,8BACPF,MAAiD;IAEjD,OACEA,OAAOc,MAAM,KAAKH,aAClBX,OAAOe,+BAA+B,KAAKJ,aAC3CX,OAAOgB,kBAAkB,KAAKL,aAC9BX,OAAOiB,4BAA4B,KAAKN;AAE5C"}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import {LINEAR_PROVIDER} from '@shipfox/api-integration-linear-dto';\nimport {createLinearApiClient, type LinearApiClient} from '#api/client.js';\nimport {config} from '#config.js';\nimport {LinearAgentToolsProvider} from '#core/agent-tools-provider.js';\nimport type {LinearTokenStore} from '#core/tokens.js';\nimport {createLinearWebhookProcessor} from '#core/webhook-processor.js';\nimport {closeDb, db} from '#db/db.js';\nimport {getLinearInstallationByConnectionId} from '#db/installations.js';\nimport {migrationsPath} from '#db/migrations.js';\nimport {\n type CreateLinearIntegrationRoutesOptions,\n createLinearIntegrationRoutes,\n} from '#presentation/routes/install.js';\nimport {\n type CreateLinearWebhookRoutesOptions,\n createLinearWebhookRoutes,\n} from '#presentation/routes/webhooks.js';\n\nexport type {LinearProvider} from '@shipfox/api-integration-linear-dto';\nexport type {LinearApiClient, LinearAuthorization, LinearIdentity} from '#api/client.js';\nexport {createLinearApiClient} from '#api/client.js';\nexport type {\n LinearAgentToolCatalogEntry,\n LinearAgentToolCategory,\n LinearAgentToolId,\n LinearAgentToolRequiredScope,\n} from '#core/agent-tools.js';\nexport {\n linearAgentToolCatalog,\n linearAgentToolSelectionCatalog,\n} from '#core/agent-tools.js';\nexport {\n type DisconnectLinearInstallationParams,\n disconnectLinearInstallation,\n} from '#core/disconnect.js';\nexport {\n LinearAccessTokenMissingError,\n LinearAuthorizationScopeMismatchError,\n LinearConnectionAlreadyLinkedError,\n LinearConnectionNotFoundError,\n LinearInstallationAlreadyLinkedError,\n LinearInstallStateActorMismatchError,\n LinearInstallStateError,\n LinearIntegrationProviderError,\n LinearOAuthCallbackError,\n LinearTokenUnrefreshableError,\n} from '#core/errors.js';\nexport type {ConnectLinearInstallationInput, HandleLinearCallbackParams} from '#core/install.js';\nexport {handleLinearCallback, handleLinearOAuthCallbackError} from '#core/install.js';\nexport {\n assertLinearAuthorizationScopes,\n formatLinearOAuthScopes,\n LINEAR_OAUTH_SCOPES,\n} from '#core/scopes.js';\nexport type {LinearInstallStateClaims} from '#core/state.js';\nexport {signLinearInstallState, verifyLinearInstallState} from '#core/state.js';\nexport type {\n CreateLinearTokenStoreParams,\n GetLinearAccessTokenParams,\n LinearConnectionResolverResult,\n LinearSecretsStore,\n LinearTokenStore,\n StoreLinearTokensParams,\n} from '#core/tokens.js';\nexport {\n createLinearTokenStore,\n linearSecretsNamespace,\n} from '#core/tokens.js';\nexport type {HandleLinearWebhookOutcome, HandleLinearWebhookParams} from '#core/webhook.js';\nexport {handleLinearWebhook} from '#core/webhook.js';\nexport type {\n CreateLinearWebhookProcessorOptions,\n LinearWebhookProcessor,\n} from '#core/webhook-processor.js';\nexport {createLinearWebhookProcessor} from '#core/webhook-processor.js';\nexport type {\n LinearInstallation,\n LinearInstallationStatus,\n UpdateLinearInstallationTokenExpiryParams,\n UpsertLinearInstallationParams,\n} from '#db/installations.js';\nexport {\n deleteLinearInstallationByConnectionId,\n getLinearInstallationByConnectionId,\n getLinearInstallationByOrganizationId,\n markLinearInstallationRevoked,\n updateLinearInstallationTokenExpiry,\n upsertLinearInstallation,\n withLinearRefreshLock,\n} from '#db/installations.js';\nexport {\n type CreateLinearE2eRoutesOptions,\n createLinearE2eRoutes,\n} from '#presentation/e2eRoutes/index.js';\nexport {closeDb, config, db, migrationsPath};\n\nexport interface CreateLinearIntegrationProviderOptions {\n linear?: LinearApiClient | undefined;\n agentTools?:\n | {\n tokenStore: Pick<LinearTokenStore, 'getAccessToken'>;\n endpoint?: string | URL | undefined;\n callTimeoutMs?: number | undefined;\n }\n | undefined;\n getLinearInstallationByConnectionId?: typeof getLinearInstallationByConnectionId | undefined;\n cleanup?:\n | {\n deleteConnectionRecords?: (\n connection: {id: string},\n options: {tx: unknown},\n ) => Promise<void>;\n deleteConnectionSecrets?: (connection: {id: string; workspaceId: string}) => Promise<void>;\n }\n | undefined;\n routes?:\n | (Omit<CreateLinearIntegrationRoutesOptions, 'linear' | 'connectionCapabilities'> &\n Partial<CreateLinearWebhookRoutesOptions>)\n | undefined;\n}\n\nexport function createLinearIntegrationProvider(\n options: CreateLinearIntegrationProviderOptions = {},\n) {\n const linear = options.linear ?? createLinearApiClient();\n const getInstallationByConnectionId =\n options.getLinearInstallationByConnectionId ?? getLinearInstallationByConnectionId;\n const adapters = options.agentTools\n ? {\n agent_tools: new LinearAgentToolsProvider(options.agentTools),\n }\n : {};\n const webhookProcessor =\n options.routes && hasLinearWebhookRoutesOptions(options.routes)\n ? createLinearWebhookProcessor(options.routes)\n : undefined;\n\n const routes = options.routes\n ? [\n createLinearIntegrationRoutes({\n linear,\n connectionCapabilities: adapters.agent_tools ? ['agent_tools'] : [],\n ...options.routes,\n }),\n ]\n : [];\n if (options.routes && hasLinearWebhookRoutesOptions(options.routes) && webhookProcessor) {\n routes.push(createLinearWebhookRoutes({...options.routes, processor: webhookProcessor}));\n }\n\n return {\n provider: LINEAR_PROVIDER,\n displayName: 'Linear',\n adapters,\n async connectionExternalUrl(connection: {id: string}): Promise<string | undefined> {\n const installation = await getInstallationByConnectionId(connection.id);\n if (!installation?.organizationUrlKey) return undefined;\n return `https://linear.app/${encodeURIComponent(installation.organizationUrlKey)}/settings`;\n },\n ...options.cleanup,\n routes,\n webhookProcessors: webhookProcessor\n ? [{routeIds: ['linear'] as const, processor: webhookProcessor}]\n : undefined,\n };\n}\n\nfunction hasLinearWebhookRoutesOptions(\n routes: Partial<CreateLinearWebhookRoutesOptions>,\n): routes is CreateLinearWebhookRoutesOptions {\n return (\n routes.coreDb !== undefined &&\n routes.publishIntegrationEventReceived !== undefined &&\n routes.recordDeliveryOnly !== undefined &&\n routes.getIntegrationConnectionById !== undefined\n );\n}\n"],"names":["LINEAR_PROVIDER","createLinearApiClient","config","LinearAgentToolsProvider","createLinearWebhookProcessor","closeDb","db","getLinearInstallationByConnectionId","migrationsPath","createLinearIntegrationRoutes","createLinearWebhookRoutes","linearAgentToolCatalog","linearAgentToolSelectionCatalog","disconnectLinearInstallation","LinearAccessTokenMissingError","LinearAuthorizationScopeMismatchError","LinearConnectionAlreadyLinkedError","LinearConnectionNotFoundError","LinearInstallationAlreadyLinkedError","LinearInstallStateActorMismatchError","LinearInstallStateError","LinearIntegrationProviderError","LinearOAuthCallbackError","LinearTokenUnrefreshableError","handleLinearCallback","handleLinearOAuthCallbackError","assertLinearAuthorizationScopes","formatLinearOAuthScopes","LINEAR_OAUTH_SCOPES","signLinearInstallState","verifyLinearInstallState","createLinearTokenStore","linearSecretsNamespace","handleLinearWebhook","deleteLinearInstallationByConnectionId","getLinearInstallationByOrganizationId","markLinearInstallationRevoked","updateLinearInstallationTokenExpiry","upsertLinearInstallation","withLinearRefreshLock","createLinearE2eRoutes","createLinearIntegrationProvider","options","linear","getInstallationByConnectionId","adapters","agentTools","agent_tools","webhookProcessor","routes","hasLinearWebhookRoutesOptions","undefined","connectionCapabilities","push","processor","provider","displayName","connectionExternalUrl","connection","installation","id","organizationUrlKey","encodeURIComponent","cleanup","webhookProcessors","routeIds","coreDb","publishIntegrationEventReceived","recordDeliveryOnly","getIntegrationConnectionById"],"mappings":"AAAA,SAAQA,eAAe,QAAO,sCAAsC;AACpE,SAAQC,qBAAqB,QAA6B,iBAAiB;AAC3E,SAAQC,MAAM,QAAO,aAAa;AAClC,SAAQC,wBAAwB,QAAO,gCAAgC;AAEvE,SAAQC,4BAA4B,QAAO,6BAA6B;AACxE,SAAQC,OAAO,EAAEC,EAAE,QAAO,YAAY;AACtC,SAAQC,mCAAmC,QAAO,uBAAuB;AACzE,SAAQC,cAAc,QAAO,oBAAoB;AACjD,SAEEC,6BAA6B,QACxB,kCAAkC;AACzC,SAEEC,yBAAyB,QACpB,mCAAmC;AAI1C,SAAQT,qBAAqB,QAAO,iBAAiB;AAOrD,SACEU,sBAAsB,EACtBC,+BAA+B,QAC1B,uBAAuB;AAC9B,SAEEC,4BAA4B,QACvB,sBAAsB;AAC7B,SACEC,6BAA6B,EAC7BC,qCAAqC,EACrCC,kCAAkC,EAClCC,6BAA6B,EAC7BC,oCAAoC,EACpCC,oCAAoC,EACpCC,uBAAuB,EACvBC,8BAA8B,EAC9BC,wBAAwB,EACxBC,6BAA6B,QACxB,kBAAkB;AAEzB,SAAQC,oBAAoB,EAAEC,8BAA8B,QAAO,mBAAmB;AACtF,SACEC,+BAA+B,EAC/BC,uBAAuB,EACvBC,mBAAmB,QACd,kBAAkB;AAEzB,SA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AAcE,oBAAoB,OAAOV;YAC9C,OAAO,CAAC,mBAAmB,EAAEW,mBAAmBH,aAAaE,kBAAkB,EAAE,SAAS,CAAC;QAC7F;QACA,GAAGnB,QAAQqB,OAAO;QAClBd;QACAe,mBAAmBhB,mBACf;YAAC;gBAACiB,UAAU;oBAAC;iBAAS;gBAAWX,WAAWN;YAAgB;SAAE,GAC9DG;IACN;AACF;AAEA,SAASD,8BACPD,MAAiD;IAEjD,OACEA,OAAOiB,MAAM,KAAKf,aAClBF,OAAOkB,+BAA+B,KAAKhB,aAC3CF,OAAOmB,kBAAkB,KAAKjB,aAC9BF,OAAOoB,4BAA4B,KAAKlB;AAE5C"}
@@ -14,6 +14,11 @@ export interface CreateLinearIntegrationRoutesOptions {
14
14
  connectionId: string;
15
15
  }) => Promise<void>;
16
16
  connectionCapabilities: IntegrationCapability[];
17
+ requireActiveWorkspaceMembership?: (input: {
18
+ workspaceId: string;
19
+ userId: string;
20
+ memberships: ReadonlyArray<import('@shipfox/api-auth-context').UserContextMembership>;
21
+ }) => Promise<unknown>;
17
22
  }
18
- export declare function createLinearIntegrationRoutes({ linear, tokenStore, getExistingLinearConnection, connectLinearInstallation, disconnectLinearInstallation, connectionCapabilities, }: CreateLinearIntegrationRoutesOptions): RouteGroup;
23
+ export declare function createLinearIntegrationRoutes({ linear, tokenStore, getExistingLinearConnection, connectLinearInstallation, disconnectLinearInstallation, connectionCapabilities, requireActiveWorkspaceMembership, }: CreateLinearIntegrationRoutesOptions): RouteGroup;
19
24
  //# sourceMappingURL=install.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../../../src/presentation/routes/install.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,qBAAqB,EAAE,qBAAqB,EAAC,MAAM,mCAAmC,CAAC;AASpG,OAAO,EAAc,KAAK,UAAU,EAAC,MAAM,uBAAuB,CAAC;AACnE,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,gBAAgB,CA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E,eAAe,CAAC;IACxB,UAAU,EAAE,IAAI,CAAC,gBAAgB,EAAE,aAAa,CAAC,CAAC;IAClD,2BAA2B,EAAE,CAAC,KAAK,EAAE;QACnC,cAAc,EAAE,MAAM,CAAC;KACxB,KAAK,OAAO,CAAC,qBAAqB,CAAC,QAAQ,CAAC,GAAG,SAAS,CAAC,CAAC;IAC3D,yBAAyB,EAAE,CACzB,KAAK,EAAE,8BAA8B,KAClC,OAAO,CAAC,qBAAqB,CAAC,QAAQ,CAAC,CAAC,CAAC;IAC9C,4BAA4B,EAAE,CAAC,KAAK,EAAE;QAAC,YAAY,EAAE,MAAM,CAAA;KAAC,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/E,sBAAsB,EAAE,qBAAqB,EAAE,CAAC;IAChD,gCAAgC,CAAC,EAAE,CAAC,KAAK,EAAE;QACzC,WAAW,EAAE,MAAM,CAAC;QACpB,MAAM,EAAE,MAAM,CAAC;QACf,WAAW,EAAE,aAAa,CAAC,OAAO,2BAA2B,EAAE,qBAAqB,CAAC,CAAC;KACvF,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;CACxB;AAED,wBAAgB,6BAA6B,CAAC,EAC5C,MAAM,EACN,UAAU,EACV,2BAA2B,EAC3B,yBAAyB,EACzB,4BAA4B,EAC5B,sBAAsB,EACtB,gCAAgC,GACjC,EAAE,oCAAoC,GAAG,UAAU,CA+EnD"}
@@ -1,6 +1,5 @@
1
1
  import { AUTH_USER, requireUserContext, requireWorkspaceAccess } from '@shipfox/api-auth-context';
2
2
  import { createLinearInstallBodySchema, createLinearInstallResponseSchema, linearCallbackQuerySchema, linearCallbackResponseSchema } from '@shipfox/api-integration-linear-dto';
3
- import { requireWorkspaceMembership } from '@shipfox/api-workspaces';
4
3
  import { defineRoute } from '@shipfox/node-fastify';
5
4
  import { config } from '#config.js';
6
5
  import { handleLinearCallback, handleLinearOAuthCallbackError } from '#core/install.js';
@@ -8,7 +7,7 @@ import { formatLinearOAuthScopes } from '#core/scopes.js';
8
7
  import { signLinearInstallState } from '#core/state.js';
9
8
  import { toIntegrationConnectionDto } from '#presentation/dto/integrations.js';
10
9
  import { linearRouteErrorHandler } from './errors.js';
11
- export function createLinearIntegrationRoutes({ linear, tokenStore, getExistingLinearConnection, connectLinearInstallation, disconnectLinearInstallation, connectionCapabilities }) {
10
+ export function createLinearIntegrationRoutes({ linear, tokenStore, getExistingLinearConnection, connectLinearInstallation, disconnectLinearInstallation, connectionCapabilities, requireActiveWorkspaceMembership }) {
12
11
  const createInstallRoute = defineRoute({
13
12
  method: 'POST',
14
13
  path: '/install',
@@ -65,7 +64,7 @@ export function createLinearIntegrationRoutes({ linear, tokenStore, getExistingL
65
64
  errorDescription: query.error_description,
66
65
  sessionUserId: actor.userId,
67
66
  sessionMemberships: actor.memberships,
68
- requireWorkspaceMembership
67
+ requireWorkspaceMembership: requireActiveWorkspaceMembership ?? unavailableWorkspaceMembershipCheck
69
68
  });
70
69
  }
71
70
  const connection = await handleLinearCallback({
@@ -75,7 +74,7 @@ export function createLinearIntegrationRoutes({ linear, tokenStore, getExistingL
75
74
  state: query.state,
76
75
  sessionUserId: actor.userId,
77
76
  sessionMemberships: actor.memberships,
78
- requireWorkspaceMembership,
77
+ requireWorkspaceMembership: requireActiveWorkspaceMembership ?? unavailableWorkspaceMembershipCheck,
79
78
  getExistingLinearConnection,
80
79
  connectLinearInstallation,
81
80
  disconnectLinearInstallation
@@ -93,6 +92,9 @@ export function createLinearIntegrationRoutes({ linear, tokenStore, getExistingL
93
92
  ]
94
93
  };
95
94
  }
95
+ function unavailableWorkspaceMembershipCheck(_input) {
96
+ return Promise.reject(new Error('Workspaces inter-module client is not configured'));
97
+ }
96
98
  function isLinearOAuthErrorCallback(query) {
97
99
  return 'error' in query && typeof query.error === 'string';
98
100
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/presentation/routes/install.ts"],"sourcesContent":["import {AUTH_USER, requireUserContext, requireWorkspaceAccess} from '@shipfox/api-auth-context';\nimport type {IntegrationCapability, IntegrationConnection} from '@shipfox/api-integration-core-dto';\nimport {\n createLinearInstallBodySchema,\n createLinearInstallResponseSchema,\n type LinearCallbackQueryDto,\n linearCallbackQuerySchema,\n linearCallbackResponseSchema,\n} from '@shipfox/api-integration-linear-dto';\nimport {requireWorkspaceMembership} from '@shipfox/api-workspaces';\nimport {defineRoute, type RouteGroup} from '@shipfox/node-fastify';\nimport type {LinearApiClient} from '#api/client.js';\nimport {config} from '#config.js';\nimport {\n type ConnectLinearInstallationInput,\n handleLinearCallback,\n handleLinearOAuthCallbackError,\n} from '#core/install.js';\nimport {formatLinearOAuthScopes} from '#core/scopes.js';\nimport {signLinearInstallState} from '#core/state.js';\nimport type {LinearTokenStore} from '#core/tokens.js';\nimport {toIntegrationConnectionDto} from '#presentation/dto/integrations.js';\nimport {linearRouteErrorHandler} from './errors.js';\n\nexport interface CreateLinearIntegrationRoutesOptions {\n linear: LinearApiClient;\n tokenStore: Pick<LinearTokenStore, 'storeTokens'>;\n getExistingLinearConnection: (input: {\n organizationId: string;\n }) => Promise<IntegrationConnection<'linear'> | undefined>;\n connectLinearInstallation: (\n input: ConnectLinearInstallationInput,\n ) => Promise<IntegrationConnection<'linear'>>;\n disconnectLinearInstallation: (input: {connectionId: string}) => Promise<void>;\n connectionCapabilities: IntegrationCapability[];\n}\n\nexport function createLinearIntegrationRoutes({\n linear,\n tokenStore,\n getExistingLinearConnection,\n connectLinearInstallation,\n disconnectLinearInstallation,\n connectionCapabilities,\n}: CreateLinearIntegrationRoutesOptions): RouteGroup {\n const createInstallRoute = defineRoute({\n method: 'POST',\n path: '/install',\n auth: AUTH_USER,\n description: 'Create a Linear OAuth authorization URL for a workspace.',\n schema: {\n body: createLinearInstallBodySchema,\n response: {\n 200: createLinearInstallResponseSchema,\n },\n },\n handler: (request) => {\n const {workspace_id: workspaceId} = request.body;\n const actor = requireUserContext(request);\n\n requireWorkspaceAccess({request, workspaceId});\n\n const state = signLinearInstallState({workspaceId, userId: actor.userId});\n const installUrl = new URL('https://linear.app/oauth/authorize');\n installUrl.searchParams.set('client_id', config.LINEAR_OAUTH_CLIENT_ID);\n installUrl.searchParams.set('redirect_uri', config.LINEAR_OAUTH_REDIRECT_URL);\n installUrl.searchParams.set('response_type', 'code');\n installUrl.searchParams.set('state', state);\n installUrl.searchParams.set('actor', 'app');\n installUrl.searchParams.set('scope', formatLinearOAuthScopes());\n\n return {install_url: installUrl.toString()};\n },\n });\n\n const callbackApiRoute = defineRoute({\n method: 'GET',\n path: '/callback/api',\n auth: AUTH_USER,\n description: 'Handle the Linear OAuth callback.',\n schema: {\n querystring: linearCallbackQuerySchema,\n response: {\n 200: linearCallbackResponseSchema,\n },\n },\n errorHandler: linearRouteErrorHandler,\n handler: async (request) => {\n const actor = requireUserContext(request);\n const query = request.query;\n if (isLinearOAuthErrorCallback(query)) {\n return await handleLinearOAuthCallbackError({\n state: query.state,\n error: query.error,\n errorDescription: query.error_description,\n sessionUserId: actor.userId,\n sessionMemberships: actor.memberships,\n requireWorkspaceMembership,\n });\n }\n const connection = await handleLinearCallback({\n linear,\n tokenStore,\n code: query.code,\n state: query.state,\n sessionUserId: actor.userId,\n sessionMemberships: actor.memberships,\n requireWorkspaceMembership,\n getExistingLinearConnection,\n connectLinearInstallation,\n disconnectLinearInstallation,\n });\n\n return toIntegrationConnectionDto(connection, {capabilities: connectionCapabilities});\n },\n });\n\n return {\n prefix: '/integrations/linear',\n routes: [createInstallRoute, callbackApiRoute],\n };\n}\n\nfunction isLinearOAuthErrorCallback(\n query: LinearCallbackQueryDto,\n): query is LinearCallbackQueryDto & {\n error: string;\n error_description?: string | undefined;\n state: string;\n} {\n return 'error' in query && typeof query.error === 'string';\n}\n"],"names":["AUTH_USER","requireUserContext","requireWorkspaceAccess","createLinearInstallBodySchema","createLinearInstallResponseSchema","linearCallbackQuerySchema","linearCallbackResponseSchema","requireWorkspaceMembership","defineRoute","config","handleLinearCallback","handleLinearOAuthCallbackError","formatLinearOAuthScopes","signLinearInstallState","toIntegrationConnectionDto","linearRouteErrorHandler","createLinearIntegrationRoutes","linear","tokenStore","getExistingLinearConnection","connectLinearInstallation","disconnectLinearInstallation","connectionCapabilities","createInstallRoute","method","path","auth","description","schema","body","response","handler","request","workspace_id","workspaceId","actor","state","userId","installUrl","URL","searchParams","set","LINEAR_OAUTH_CLIENT_ID","LINEAR_OAUTH_REDIRECT_URL","install_url","toString","callbackApiRoute","querystring","errorHandler","query","isLinearOAuthErrorCallback","error","errorDescription","error_description","sessionUserId","sessionMemberships","memberships","connection","code","capabilities","prefix","routes"],"mappings":"AAAA,SAAQA,SAAS,EAAEC,kBAAkB,EAAEC,sBAAsB,QAAO,4BAA4B;AAEhG,SACEC,6BAA6B,EAC7BC,iCAAiC,EAEjCC,yBAAyB,EACzBC,4BAA4B,QACvB,sCAAsC;AAC7C,SAAQC,0BAA0B,QAAO,0BAA0B;AACnE,SAAQC,WAAW,QAAwB,wBAAwB;AAEnE,SAAQC,MAAM,QAAO,aAAa;AAClC,SAEEC,oBAAoB,EACpBC,8BAA8B,QACzB,mBAAmB;AAC1B,SAAQC,uBAAuB,QAAO,kBAAkB;AACxD,SAAQC,sBAAsB,QAAO,iBAAiB;AAEtD,SAAQC,0BAA0B,QAAO,oCAAoC;AAC7E,SAAQC,uBAAuB,QAAO,cAAc;AAepD,OAAO,SAASC,8BAA8B,EAC5CC,MAAM,EACNC,UAAU,EACVC,2BAA2B,EAC3BC,yBAAyB,EACzBC,4BAA4B,EAC5BC,sBAAsB,EACe;IACrC,MAAMC,qBAAqBf,YAAY;QACrCgB,QAAQ;QACRC,MAAM;QACNC,MAAM1B;QACN2B,aAAa;QACbC,QAAQ;YACNC,MAAM1B;YACN2B,UAAU;gBACR,KAAK1B;YACP;QACF;QACA2B,SAAS,CAACC;YACR,MAAM,EAACC,cAAcC,WAAW,EAAC,GAAGF,QAAQH,IAAI;YAChD,MAAMM,QAAQlC,mBAAmB+B;YAEjC9B,uBAAuB;gBAAC8B;gBAASE;YA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AcrC;YAAsB;QACrF;IACF;IAEA,OAAO;QACLsC,QAAQ;QACRC,QAAQ;YAACtC;YAAoBuB;SAAiB;IAChD;AACF;AAEA,SAASI,2BACPD,KAA6B;IAM7B,OAAO,WAAWA,SAAS,OAAOA,MAAME,KAAK,KAAK;AACpD"}
1
+ {"version":3,"sources":["../../../src/presentation/routes/install.ts"],"sourcesContent":["import {AUTH_USER, requireUserContext, requireWorkspaceAccess} from '@shipfox/api-auth-context';\nimport type {IntegrationCapability, IntegrationConnection} from '@shipfox/api-integration-core-dto';\nimport {\n createLinearInstallBodySchema,\n createLinearInstallResponseSchema,\n type LinearCallbackQueryDto,\n linearCallbackQuerySchema,\n linearCallbackResponseSchema,\n} from '@shipfox/api-integration-linear-dto';\nimport {defineRoute, type RouteGroup} from '@shipfox/node-fastify';\nimport type {LinearApiClient} from '#api/client.js';\nimport {config} from '#config.js';\nimport {\n type ConnectLinearInstallationInput,\n handleLinearCallback,\n handleLinearOAuthCallbackError,\n} from '#core/install.js';\nimport {formatLinearOAuthScopes} from '#core/scopes.js';\nimport {signLinearInstallState} from '#core/state.js';\nimport type {LinearTokenStore} from '#core/tokens.js';\nimport {toIntegrationConnectionDto} from '#presentation/dto/integrations.js';\nimport {linearRouteErrorHandler} from './errors.js';\n\nexport interface CreateLinearIntegrationRoutesOptions {\n linear: LinearApiClient;\n tokenStore: Pick<LinearTokenStore, 'storeTokens'>;\n getExistingLinearConnection: (input: {\n organizationId: string;\n }) => Promise<IntegrationConnection<'linear'> | undefined>;\n connectLinearInstallation: (\n input: ConnectLinearInstallationInput,\n ) => Promise<IntegrationConnection<'linear'>>;\n disconnectLinearInstallation: (input: {connectionId: string}) => Promise<void>;\n connectionCapabilities: IntegrationCapability[];\n requireActiveWorkspaceMembership?: (input: {\n workspaceId: string;\n userId: string;\n memberships: ReadonlyArray<import('@shipfox/api-auth-context').UserContextMembership>;\n }) => Promise<unknown>;\n}\n\nexport function createLinearIntegrationRoutes({\n linear,\n tokenStore,\n getExistingLinearConnection,\n connectLinearInstallation,\n disconnectLinearInstallation,\n connectionCapabilities,\n requireActiveWorkspaceMembership,\n}: CreateLinearIntegrationRoutesOptions): RouteGroup {\n const createInstallRoute = defineRoute({\n method: 'POST',\n path: '/install',\n auth: AUTH_USER,\n description: 'Create a Linear OAuth authorization URL for a workspace.',\n schema: {\n body: createLinearInstallBodySchema,\n response: {\n 200: createLinearInstallResponseSchema,\n },\n },\n handler: (request) => {\n const {workspace_id: workspaceId} = request.body;\n const actor = requireUserContext(request);\n\n requireWorkspaceAccess({request, workspaceId});\n\n const state = signLinearInstallState({workspaceId, userId: actor.userId});\n const installUrl = new URL('https://linear.app/oauth/authorize');\n installUrl.searchParams.set('client_id', config.LINEAR_OAUTH_CLIENT_ID);\n installUrl.searchParams.set('redirect_uri', config.LINEAR_OAUTH_REDIRECT_URL);\n installUrl.searchParams.set('response_type', 'code');\n installUrl.searchParams.set('state', state);\n installUrl.searchParams.set('actor', 'app');\n installUrl.searchParams.set('scope', formatLinearOAuthScopes());\n\n return {install_url: installUrl.toString()};\n },\n });\n\n const callbackApiRoute = defineRoute({\n method: 'GET',\n path: '/callback/api',\n auth: AUTH_USER,\n description: 'Handle the Linear OAuth callback.',\n schema: {\n querystring: linearCallbackQuerySchema,\n response: {\n 200: linearCallbackResponseSchema,\n },\n },\n errorHandler: linearRouteErrorHandler,\n handler: async (request) => {\n const actor = requireUserContext(request);\n const query = request.query;\n if (isLinearOAuthErrorCallback(query)) {\n return await handleLinearOAuthCallbackError({\n state: query.state,\n error: query.error,\n errorDescription: query.error_description,\n sessionUserId: actor.userId,\n sessionMemberships: actor.memberships,\n requireWorkspaceMembership:\n requireActiveWorkspaceMembership ?? unavailableWorkspaceMembershipCheck,\n });\n }\n const connection = await handleLinearCallback({\n linear,\n tokenStore,\n code: query.code,\n state: query.state,\n sessionUserId: actor.userId,\n sessionMemberships: actor.memberships,\n requireWorkspaceMembership:\n requireActiveWorkspaceMembership ?? unavailableWorkspaceMembershipCheck,\n getExistingLinearConnection,\n connectLinearInstallation,\n disconnectLinearInstallation,\n });\n\n return toIntegrationConnectionDto(connection, {capabilities: connectionCapabilities});\n },\n });\n\n return {\n prefix: '/integrations/linear',\n routes: [createInstallRoute, callbackApiRoute],\n };\n}\n\nfunction unavailableWorkspaceMembershipCheck(_input: {\n workspaceId: string;\n userId: string;\n memberships: ReadonlyArray<import('@shipfox/api-auth-context').UserContextMembership>;\n}): Promise<never> {\n return Promise.reject(new Error('Workspaces inter-module client is not configured'));\n}\n\nfunction isLinearOAuthErrorCallback(\n query: LinearCallbackQueryDto,\n): query is LinearCallbackQueryDto & {\n error: string;\n error_description?: string | undefined;\n state: string;\n} {\n return 'error' in query && typeof query.error === 'string';\n}\n"],"names":["AUTH_USER","requireUserContext","requireWorkspaceAccess","createLinearInstallBodySchema","createLinearInstallResponseSchema","linearCallbackQuerySchema","linearCallbackResponseSchema","defineRoute","config","handleLinearCallback","handleLinearOAuthCallbackError","formatLinearOAuthScopes","signLinearInstallState","toIntegrationConnectionDto","linearRouteErrorHandler","createLinearIntegrationRoutes","linear","tokenStore","getExistingLinearConnection","connectLinearInstallation","disconnectLinearInstallation","connectionCapabilities","requireActiveWorkspaceMembership","createInstallRoute","method","path","auth","description","schema","body","response","handler","request","workspace_id","workspaceId","actor","state","userId","installUrl","URL","searchParams","set","LINEAR_OAUTH_CLIENT_ID","LINEAR_OAUTH_REDIRECT_URL","install_url","toString","callbackApiRoute","querystring","errorHandler","query","isLinearOAuthErrorCallback","error","errorDescription","error_description","sessionUserId","sessionMemberships","memberships","requireWorkspaceMembership","unavailableWorkspaceMembershipCheck","connection","code","capabilities","prefix","routes","_input","Promise","reject","Error"],"mappings":"AAAA,SAAQA,SAAS,EAAEC,kBAAkB,EAAEC,sBAAsB,QAAO,4BAA4B;AAEhG,SACEC,6BAA6B,EAC7BC,iCAAiC,EAEjCC,yBAAyB,EACzBC,4BAA4B,QACvB,sCAAsC;AAC7C,SAAQC,WAAW,QAAwB,wBAAwB;A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a;QACbC,QAAQ;YACNmB,aAAa1C;YACbyB,UAAU;gBACR,KAAKxB;YACP;QACF;QACA0C,cAAclC;QACdiB,SAAS,OAAOC;YACd,MAAMG,QAAQlC,mBAAmB+B;YACjC,MAAMiB,QAAQjB,QAAQiB,KAAK;YAC3B,IAAIC,2BAA2BD,QAAQ;gBACrC,OAAO,MAAMvC,+BAA+B;oBAC1C0B,OAAOa,MAAMb,KAAK;oBAClBe,OAAOF,MAAME,KAAK;oBAClBC,kBAAkBH,MAAMI,iBAAiB;oBACzCC,eAAenB,MAAME,MAAM;oBAC3BkB,oBAAoBpB,MAAMqB,WAAW;oBACrCC,4BACEnC,oCAAoCoC;gBACxC;YACF;YACA,MAAMC,aAAa,MAAMlD,qBAAqB;gBAC5CO;gBACAC;gBACA2C,MAAMX,MAAMW,IAAI;gBAChBxB,OAAOa,MAAMb,KAAK;gBAClBkB,eAAenB,MAAME,MAAM;gBAC3BkB,oBAAoBpB,MAAMqB,WAAW;gBACrCC,4BACEnC,oCAAoCoC;gBACtCxC;gBACAC;gBACAC;YACF;YAEA,OAAOP,2BAA2B8C,YAAY;gBAACE,cAAcxC;YAAsB;QACrF;IACF;IAEA,OAAO;QACLyC,QAAQ;QACRC,QAAQ;YAACxC;YAAoBuB;SAAiB;IAChD;AACF;AAEA,SAASY,oCAAoCM,MAI5C;IACC,OAAOC,QAAQC,MAAM,CAAC,IAAIC,MAAM;AAClC;AAEA,SAASjB,2BACPD,KAA6B;IAM7B,OAAO,WAAWA,SAAS,OAAOA,MAAME,KAAK,KAAK;AACpD"}
@@ -1,11 +1,13 @@
1
1
  import type { GetIntegrationConnectionByIdFn, PublishIntegrationEventReceivedFn, RecordDeliveryOnlyFn } from '@shipfox/api-integration-core-dto';
2
2
  import { type RouteGroup } from '@shipfox/node-fastify';
3
3
  import type { NodePgDatabase } from 'drizzle-orm/node-postgres';
4
+ import { type LinearWebhookProcessor } from '#core/webhook-processor.js';
4
5
  export interface CreateLinearWebhookRoutesOptions {
5
6
  coreDb: () => NodePgDatabase<Record<string, unknown>>;
6
7
  publishIntegrationEventReceived: PublishIntegrationEventReceivedFn;
7
8
  recordDeliveryOnly: RecordDeliveryOnlyFn;
8
9
  getIntegrationConnectionById: GetIntegrationConnectionByIdFn;
10
+ processor?: LinearWebhookProcessor | undefined;
9
11
  }
10
12
  export declare function createLinearWebhookRoutes(options: CreateLinearWebhookRoutesOptions): RouteGroup;
11
13
  //# sourceMappingURL=webhooks.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"webhooks.d.ts","sourceRoot":"","sources":["../../../src/presentation/routes/webhooks.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,8BAA8B,EAE9B,iCAAiC,EACjC,oBAAoB,EACrB,MAAM,mCAAmC,CAAC;AAK3C,OAAO,EAEL,KAAK,UAAU,EAIhB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,2BAA2B,CAAC;AAS9D,MAAM,WAAW,gCAAgC;IAC/C,MAAM,EAAE,MAAM,cAAc,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IACtD,+BAA+B,EAAE,iCAAiC,CAAC;IACnE,kBAAkB,EAAE,oBAAoB,CAAC;IACzC,4BAA4B,EAAE,8BAA8B,CAAC;CAC9D;AAED,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,gCAAgC,GAAG,UAAU,CAyG/F"}
1
+ {"version":3,"file":"webhooks.d.ts","sourceRoot":"","sources":["../../../src/presentation/routes/webhooks.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,8BAA8B,EAC9B,iCAAiC,EACjC,oBAAoB,EAGrB,MAAM,mCAAmC,CAAC;AAK3C,OAAO,EAGL,KAAK,UAAU,EAGhB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAEL,KAAK,sBAAsB,EAC5B,MAAM,4BAA4B,CAAC;AAMpC,MAAM,WAAW,gCAAgC;IAC/C,MAAM,EAAE,MAAM,cAAc,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IACtD,+BAA+B,EAAE,iCAAiC,CAAC;IACnE,kBAAkB,EAAE,oBAAoB,CAAC;IACzC,4BAA4B,EAAE,8BAA8B,CAAC;IAC7D,SAAS,CAAC,EAAE,sBAAsB,GAAG,SAAS,CAAC;CAChD;AAED,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,gCAAgC,GAAG,UAAU,CAqD/F"}