@corsair-dev/linear 0.1.5 → 0.1.7
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.
- package/README.md +48 -0
- package/dist/client.d.ts +0 -13
- package/dist/client.d.ts.map +1 -1
- package/dist/endpoints/index.d.ts +12 -12
- package/dist/index.d.ts +24 -24
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +20 -20
- package/dist/webhooks/index.d.ts +16 -16
- package/dist/webhooks/types.test.d.ts +2 -0
- package/dist/webhooks/types.test.d.ts.map +1 -0
- package/package.json +10 -4
package/README.md
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# @corsair-dev/linear
|
|
2
|
+
|
|
3
|
+
Linear plugin for Corsair.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pnpm add @corsair-dev/linear
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Endpoints
|
|
12
|
+
|
|
13
|
+
| Operation | Operation ID | Risk | Description |
|
|
14
|
+
|-----------|--------------|------|-------------|
|
|
15
|
+
| `comments.create` | `linear.api.comments.create` | `write` | Post a comment on an issue |
|
|
16
|
+
| `comments.delete` | `linear.api.comments.delete` | `destructive` | Delete a comment [DESTRUCTIVE] |
|
|
17
|
+
| `comments.list` | `linear.api.comments.list` | `read` | List comments on an issue |
|
|
18
|
+
| `comments.update` | `linear.api.comments.update` | `write` | Update a comment |
|
|
19
|
+
| `issues.create` | `linear.api.issues.create` | `write` | Create a new issue |
|
|
20
|
+
| `issues.delete` | `linear.api.issues.delete` | `destructive` | Permanently delete an issue [DESTRUCTIVE · IRREVERSIBLE] |
|
|
21
|
+
| `issues.get` | `linear.api.issues.get` | `read` | Get a specific issue |
|
|
22
|
+
| `issues.list` | `linear.api.issues.list` | `read` | List issues in a team |
|
|
23
|
+
| `issues.update` | `linear.api.issues.update` | `write` | Update an existing issue |
|
|
24
|
+
| `projects.create` | `linear.api.projects.create` | `write` | Create a new project |
|
|
25
|
+
| `projects.delete` | `linear.api.projects.delete` | `destructive` | Permanently delete a project [DESTRUCTIVE · IRREVERSIBLE] |
|
|
26
|
+
| `projects.get` | `linear.api.projects.get` | `read` | Get a specific project |
|
|
27
|
+
| `projects.list` | `linear.api.projects.list` | `read` | List projects in a team |
|
|
28
|
+
| `projects.update` | `linear.api.projects.update` | `write` | Update an existing project |
|
|
29
|
+
| `teams.get` | `linear.api.teams.get` | `read` | Get a specific team |
|
|
30
|
+
| `teams.list` | `linear.api.teams.list` | `read` | List teams in the workspace |
|
|
31
|
+
| `users.get` | `linear.api.users.get` | `read` | Get a specific user |
|
|
32
|
+
| `users.list` | `linear.api.users.list` | `read` | List users in the workspace |
|
|
33
|
+
|
|
34
|
+
## Auth
|
|
35
|
+
|
|
36
|
+
Auth: API key, OAuth 2.0, Managed OAuth (default API key). Set `authType` on the plugin factory to pick one.
|
|
37
|
+
|
|
38
|
+
## Webhooks
|
|
39
|
+
|
|
40
|
+
Handles 9 webhook events. See the reference for payloads and `webhookHooks`.
|
|
41
|
+
|
|
42
|
+
## Reference
|
|
43
|
+
|
|
44
|
+
Full docs, types, and examples: https://docs.corsair.dev/plugins/linear
|
|
45
|
+
|
|
46
|
+
## License
|
|
47
|
+
|
|
48
|
+
Apache-2.0
|
package/dist/client.d.ts
CHANGED
|
@@ -4,19 +4,6 @@ export declare class LinearAPIError extends Error {
|
|
|
4
4
|
readonly code?: string | number | undefined;
|
|
5
5
|
constructor(message: string, code?: string | number | undefined);
|
|
6
6
|
}
|
|
7
|
-
export declare function getValidLinearAccessToken({ accessToken, expiresAt, clientId, clientSecret, refreshToken, forceRefresh, }: {
|
|
8
|
-
clientId: string;
|
|
9
|
-
clientSecret: string;
|
|
10
|
-
accessToken?: string | null;
|
|
11
|
-
expiresAt?: string | null;
|
|
12
|
-
refreshToken: string;
|
|
13
|
-
forceRefresh?: boolean;
|
|
14
|
-
}): Promise<{
|
|
15
|
-
accessToken: string;
|
|
16
|
-
refreshToken: string;
|
|
17
|
-
expiresAt: number;
|
|
18
|
-
refreshed: boolean;
|
|
19
|
-
}>;
|
|
20
7
|
export declare function makeLinearRequest<T>(query: string, token: string, variables?: Record<string, unknown>): Promise<T>;
|
|
21
8
|
export type LinearEventHandler<T extends LinearEventName> = (event: LinearEventMap[T]) => void | Promise<void>;
|
|
22
9
|
export interface LinearWebhookHeaders {
|
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../client.ts"],"names":[],"mappings":"AACA,OAAO,EAEN,kBAAkB,EAGlB,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EACX,cAAc,EACd,eAAe,EACf,kBAAkB,EAClB,MAAM,kBAAkB,CAAC;AAE1B,qBAAa,cAAe,SAAQ,KAAK;aAGvB,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM;gBADtC,OAAO,EAAE,MAAM,EACC,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,YAAA;CAKvC;
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../client.ts"],"names":[],"mappings":"AACA,OAAO,EAEN,kBAAkB,EAGlB,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EACX,cAAc,EACd,eAAe,EACf,kBAAkB,EAClB,MAAM,kBAAkB,CAAC;AAE1B,qBAAa,cAAe,SAAQ,KAAK;aAGvB,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM;gBADtC,OAAO,EAAE,MAAM,EACC,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,YAAA;CAKvC;AAID,wBAAsB,iBAAiB,CAAC,CAAC,EACxC,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,EACb,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACjC,OAAO,CAAC,CAAC,CAAC,CAuDZ;AAED,MAAM,MAAM,kBAAkB,CAAC,CAAC,SAAS,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|
11
11
|
id: string;
|
|
12
12
|
title: string;
|
|
13
|
-
priority: 0 |
|
|
13
|
+
priority: 0 | 1 | 3 | 2 | 4;
|
|
14
14
|
sortOrder: number;
|
|
15
15
|
number: number;
|
|
16
16
|
identifier: string;
|
|
@@ -202,7 +202,7 @@ export declare const Comments: {
|
|
|
202
202
|
parent?: ({
|
|
203
203
|
id: string;
|
|
204
204
|
title: string;
|
|
205
|
-
priority: 0 |
|
|
205
|
+
priority: 0 | 1 | 3 | 2 | 4;
|
|
206
206
|
sortOrder: number;
|
|
207
207
|
number: number;
|
|
208
208
|
identifier: string;
|
|
@@ -414,7 +414,7 @@ export declare const Comments: {
|
|
|
414
414
|
issue: {
|
|
415
415
|
id: string;
|
|
416
416
|
title: string;
|
|
417
|
-
priority: 0 |
|
|
417
|
+
priority: 0 | 1 | 3 | 2 | 4;
|
|
418
418
|
sortOrder: number;
|
|
419
419
|
number: number;
|
|
420
420
|
identifier: string;
|
|
@@ -606,7 +606,7 @@ export declare const Comments: {
|
|
|
606
606
|
parent?: ({
|
|
607
607
|
id: string;
|
|
608
608
|
title: string;
|
|
609
|
-
priority: 0 |
|
|
609
|
+
priority: 0 | 1 | 3 | 2 | 4;
|
|
610
610
|
sortOrder: number;
|
|
611
611
|
number: number;
|
|
612
612
|
identifier: string;
|
|
@@ -882,7 +882,7 @@ export declare const Issues: {
|
|
|
882
882
|
nodes: ({
|
|
883
883
|
id: string;
|
|
884
884
|
title: string;
|
|
885
|
-
priority: 0 |
|
|
885
|
+
priority: 0 | 1 | 3 | 2 | 4;
|
|
886
886
|
sortOrder: number;
|
|
887
887
|
number: number;
|
|
888
888
|
identifier: string;
|
|
@@ -951,7 +951,7 @@ export declare const Issues: {
|
|
|
951
951
|
parent?: ({
|
|
952
952
|
id: string;
|
|
953
953
|
title: string;
|
|
954
|
-
priority: 0 |
|
|
954
|
+
priority: 0 | 1 | 3 | 2 | 4;
|
|
955
955
|
sortOrder: number;
|
|
956
956
|
number: number;
|
|
957
957
|
identifier: string;
|
|
@@ -1030,7 +1030,7 @@ export declare const Issues: {
|
|
|
1030
1030
|
}) => Promise<{
|
|
1031
1031
|
id: string;
|
|
1032
1032
|
title: string;
|
|
1033
|
-
priority: 0 |
|
|
1033
|
+
priority: 0 | 1 | 3 | 2 | 4;
|
|
1034
1034
|
sortOrder: number;
|
|
1035
1035
|
number: number;
|
|
1036
1036
|
identifier: string;
|
|
@@ -1099,7 +1099,7 @@ export declare const Issues: {
|
|
|
1099
1099
|
parent?: ({
|
|
1100
1100
|
id: string;
|
|
1101
1101
|
title: string;
|
|
1102
|
-
priority: 0 |
|
|
1102
|
+
priority: 0 | 1 | 3 | 2 | 4;
|
|
1103
1103
|
sortOrder: number;
|
|
1104
1104
|
number: number;
|
|
1105
1105
|
identifier: string;
|
|
@@ -1171,7 +1171,7 @@ export declare const Issues: {
|
|
|
1171
1171
|
teamId: string;
|
|
1172
1172
|
description?: string | undefined;
|
|
1173
1173
|
assigneeId?: string | undefined;
|
|
1174
|
-
priority?: 0 |
|
|
1174
|
+
priority?: 0 | 1 | 3 | 2 | 4 | undefined;
|
|
1175
1175
|
estimate?: number | undefined;
|
|
1176
1176
|
stateId?: string | undefined;
|
|
1177
1177
|
projectId?: string | undefined;
|
|
@@ -1184,7 +1184,7 @@ export declare const Issues: {
|
|
|
1184
1184
|
id: string;
|
|
1185
1185
|
title?: string | undefined;
|
|
1186
1186
|
description?: string | null | undefined;
|
|
1187
|
-
priority?: 0 |
|
|
1187
|
+
priority?: 0 | 1 | 3 | 2 | 4 | undefined;
|
|
1188
1188
|
estimate?: number | null | undefined;
|
|
1189
1189
|
sortOrder?: number | undefined;
|
|
1190
1190
|
number?: number | undefined;
|
|
@@ -1223,7 +1223,7 @@ export declare const Issues: {
|
|
|
1223
1223
|
title?: string | undefined;
|
|
1224
1224
|
description?: string | undefined;
|
|
1225
1225
|
assigneeId?: string | undefined;
|
|
1226
|
-
priority?: 0 |
|
|
1226
|
+
priority?: 0 | 1 | 3 | 2 | 4 | undefined;
|
|
1227
1227
|
estimate?: number | undefined;
|
|
1228
1228
|
stateId?: string | undefined;
|
|
1229
1229
|
projectId?: string | undefined;
|
|
@@ -1237,7 +1237,7 @@ export declare const Issues: {
|
|
|
1237
1237
|
id: string;
|
|
1238
1238
|
title?: string | undefined;
|
|
1239
1239
|
description?: string | null | undefined;
|
|
1240
|
-
priority?: 0 |
|
|
1240
|
+
priority?: 0 | 1 | 3 | 2 | 4 | undefined;
|
|
1241
1241
|
estimate?: number | null | undefined;
|
|
1242
1242
|
sortOrder?: number | undefined;
|
|
1243
1243
|
number?: number | undefined;
|
package/dist/index.d.ts
CHANGED
|
@@ -63,7 +63,7 @@ declare const linearWebhooksNested: {
|
|
|
63
63
|
id: string;
|
|
64
64
|
identifier: string;
|
|
65
65
|
title: string;
|
|
66
|
-
priority: 0 |
|
|
66
|
+
priority: 0 | 1 | 3 | 2 | 4;
|
|
67
67
|
sortOrder: number;
|
|
68
68
|
previousIdentifiers: string[];
|
|
69
69
|
createdAt: string;
|
|
@@ -97,7 +97,7 @@ declare const linearWebhooksNested: {
|
|
|
97
97
|
id: string;
|
|
98
98
|
identifier: string;
|
|
99
99
|
title: string;
|
|
100
|
-
priority: 0 |
|
|
100
|
+
priority: 0 | 1 | 3 | 2 | 4;
|
|
101
101
|
sortOrder: number;
|
|
102
102
|
previousIdentifiers: string[];
|
|
103
103
|
createdAt: string;
|
|
@@ -128,7 +128,7 @@ declare const linearWebhooksNested: {
|
|
|
128
128
|
identifier?: string | undefined;
|
|
129
129
|
title?: string | undefined;
|
|
130
130
|
description?: string | undefined;
|
|
131
|
-
priority?: 0 |
|
|
131
|
+
priority?: 0 | 1 | 3 | 2 | 4 | undefined;
|
|
132
132
|
estimate?: number | undefined;
|
|
133
133
|
sortOrder?: number | undefined;
|
|
134
134
|
startedAt?: string | undefined;
|
|
@@ -157,7 +157,7 @@ declare const linearWebhooksNested: {
|
|
|
157
157
|
id: string;
|
|
158
158
|
identifier: string;
|
|
159
159
|
title: string;
|
|
160
|
-
priority: 0 |
|
|
160
|
+
priority: 0 | 1 | 3 | 2 | 4;
|
|
161
161
|
sortOrder: number;
|
|
162
162
|
previousIdentifiers: string[];
|
|
163
163
|
createdAt: string;
|
|
@@ -258,7 +258,7 @@ declare const linearWebhooksNested: {
|
|
|
258
258
|
[x: string]: any;
|
|
259
259
|
id: string;
|
|
260
260
|
name: string;
|
|
261
|
-
priority: 0 |
|
|
261
|
+
priority: 0 | 1 | 3 | 2 | 4;
|
|
262
262
|
sortOrder: number;
|
|
263
263
|
state: "completed" | "canceled" | "planned" | "started" | "paused";
|
|
264
264
|
progress: number;
|
|
@@ -289,7 +289,7 @@ declare const linearWebhooksNested: {
|
|
|
289
289
|
[x: string]: any;
|
|
290
290
|
id: string;
|
|
291
291
|
name: string;
|
|
292
|
-
priority: 0 |
|
|
292
|
+
priority: 0 | 1 | 3 | 2 | 4;
|
|
293
293
|
sortOrder: number;
|
|
294
294
|
state: "completed" | "canceled" | "planned" | "started" | "paused";
|
|
295
295
|
progress: number;
|
|
@@ -319,7 +319,7 @@ declare const linearWebhooksNested: {
|
|
|
319
319
|
description?: string | undefined;
|
|
320
320
|
icon?: string | undefined;
|
|
321
321
|
color?: string | undefined;
|
|
322
|
-
priority?: 0 |
|
|
322
|
+
priority?: 0 | 1 | 3 | 2 | 4 | undefined;
|
|
323
323
|
sortOrder?: number | undefined;
|
|
324
324
|
state?: "completed" | "canceled" | "planned" | "started" | "paused" | undefined;
|
|
325
325
|
progress?: number | undefined;
|
|
@@ -343,7 +343,7 @@ declare const linearWebhooksNested: {
|
|
|
343
343
|
[x: string]: any;
|
|
344
344
|
id: string;
|
|
345
345
|
name: string;
|
|
346
|
-
priority: 0 |
|
|
346
|
+
priority: 0 | 1 | 3 | 2 | 4;
|
|
347
347
|
sortOrder: number;
|
|
348
348
|
state: "completed" | "canceled" | "planned" | "started" | "paused";
|
|
349
349
|
progress: number;
|
|
@@ -410,7 +410,7 @@ export declare const linearEndpointSchemas: {
|
|
|
410
410
|
nodes: import("zod").ZodArray<import("zod").ZodType<{
|
|
411
411
|
id: string;
|
|
412
412
|
title: string;
|
|
413
|
-
priority: 0 |
|
|
413
|
+
priority: 0 | 1 | 3 | 2 | 4;
|
|
414
414
|
sortOrder: number;
|
|
415
415
|
number: number;
|
|
416
416
|
identifier: string;
|
|
@@ -479,7 +479,7 @@ export declare const linearEndpointSchemas: {
|
|
|
479
479
|
parent?: ({
|
|
480
480
|
id: string;
|
|
481
481
|
title: string;
|
|
482
|
-
priority: 0 |
|
|
482
|
+
priority: 0 | 1 | 3 | 2 | 4;
|
|
483
483
|
sortOrder: number;
|
|
484
484
|
number: number;
|
|
485
485
|
identifier: string;
|
|
@@ -548,7 +548,7 @@ export declare const linearEndpointSchemas: {
|
|
|
548
548
|
}, unknown, import("zod/v4/core").$ZodTypeInternals<{
|
|
549
549
|
id: string;
|
|
550
550
|
title: string;
|
|
551
|
-
priority: 0 |
|
|
551
|
+
priority: 0 | 1 | 3 | 2 | 4;
|
|
552
552
|
sortOrder: number;
|
|
553
553
|
number: number;
|
|
554
554
|
identifier: string;
|
|
@@ -617,7 +617,7 @@ export declare const linearEndpointSchemas: {
|
|
|
617
617
|
parent?: ({
|
|
618
618
|
id: string;
|
|
619
619
|
title: string;
|
|
620
|
-
priority: 0 |
|
|
620
|
+
priority: 0 | 1 | 3 | 2 | 4;
|
|
621
621
|
sortOrder: number;
|
|
622
622
|
number: number;
|
|
623
623
|
identifier: string;
|
|
@@ -699,7 +699,7 @@ export declare const linearEndpointSchemas: {
|
|
|
699
699
|
readonly output: import("zod").ZodType<{
|
|
700
700
|
id: string;
|
|
701
701
|
title: string;
|
|
702
|
-
priority: 0 |
|
|
702
|
+
priority: 0 | 1 | 3 | 2 | 4;
|
|
703
703
|
sortOrder: number;
|
|
704
704
|
number: number;
|
|
705
705
|
identifier: string;
|
|
@@ -768,7 +768,7 @@ export declare const linearEndpointSchemas: {
|
|
|
768
768
|
parent?: ({
|
|
769
769
|
id: string;
|
|
770
770
|
title: string;
|
|
771
|
-
priority: 0 |
|
|
771
|
+
priority: 0 | 1 | 3 | 2 | 4;
|
|
772
772
|
sortOrder: number;
|
|
773
773
|
number: number;
|
|
774
774
|
identifier: string;
|
|
@@ -837,7 +837,7 @@ export declare const linearEndpointSchemas: {
|
|
|
837
837
|
}, unknown, import("zod/v4/core").$ZodTypeInternals<{
|
|
838
838
|
id: string;
|
|
839
839
|
title: string;
|
|
840
|
-
priority: 0 |
|
|
840
|
+
priority: 0 | 1 | 3 | 2 | 4;
|
|
841
841
|
sortOrder: number;
|
|
842
842
|
number: number;
|
|
843
843
|
identifier: string;
|
|
@@ -906,7 +906,7 @@ export declare const linearEndpointSchemas: {
|
|
|
906
906
|
parent?: ({
|
|
907
907
|
id: string;
|
|
908
908
|
title: string;
|
|
909
|
-
priority: 0 |
|
|
909
|
+
priority: 0 | 1 | 3 | 2 | 4;
|
|
910
910
|
sortOrder: number;
|
|
911
911
|
number: number;
|
|
912
912
|
identifier: string;
|
|
@@ -1115,7 +1115,7 @@ export declare const linearEndpointSchemas: {
|
|
|
1115
1115
|
issue: {
|
|
1116
1116
|
id: string;
|
|
1117
1117
|
title: string;
|
|
1118
|
-
priority: 0 |
|
|
1118
|
+
priority: 0 | 1 | 3 | 2 | 4;
|
|
1119
1119
|
sortOrder: number;
|
|
1120
1120
|
number: number;
|
|
1121
1121
|
identifier: string;
|
|
@@ -1307,7 +1307,7 @@ export declare const linearEndpointSchemas: {
|
|
|
1307
1307
|
parent?: ({
|
|
1308
1308
|
id: string;
|
|
1309
1309
|
title: string;
|
|
1310
|
-
priority: 0 |
|
|
1310
|
+
priority: 0 | 1 | 3 | 2 | 4;
|
|
1311
1311
|
sortOrder: number;
|
|
1312
1312
|
number: number;
|
|
1313
1313
|
identifier: string;
|
|
@@ -1519,7 +1519,7 @@ export declare const linearEndpointSchemas: {
|
|
|
1519
1519
|
issue: {
|
|
1520
1520
|
id: string;
|
|
1521
1521
|
title: string;
|
|
1522
|
-
priority: 0 |
|
|
1522
|
+
priority: 0 | 1 | 3 | 2 | 4;
|
|
1523
1523
|
sortOrder: number;
|
|
1524
1524
|
number: number;
|
|
1525
1525
|
identifier: string;
|
|
@@ -1711,7 +1711,7 @@ export declare const linearEndpointSchemas: {
|
|
|
1711
1711
|
parent?: ({
|
|
1712
1712
|
id: string;
|
|
1713
1713
|
title: string;
|
|
1714
|
-
priority: 0 |
|
|
1714
|
+
priority: 0 | 1 | 3 | 2 | 4;
|
|
1715
1715
|
sortOrder: number;
|
|
1716
1716
|
number: number;
|
|
1717
1717
|
identifier: string;
|
|
@@ -1923,7 +1923,7 @@ export declare const linearEndpointSchemas: {
|
|
|
1923
1923
|
issue: {
|
|
1924
1924
|
id: string;
|
|
1925
1925
|
title: string;
|
|
1926
|
-
priority: 0 |
|
|
1926
|
+
priority: 0 | 1 | 3 | 2 | 4;
|
|
1927
1927
|
sortOrder: number;
|
|
1928
1928
|
number: number;
|
|
1929
1929
|
identifier: string;
|
|
@@ -2115,7 +2115,7 @@ export declare const linearEndpointSchemas: {
|
|
|
2115
2115
|
parent?: ({
|
|
2116
2116
|
id: string;
|
|
2117
2117
|
title: string;
|
|
2118
|
-
priority: 0 |
|
|
2118
|
+
priority: 0 | 1 | 3 | 2 | 4;
|
|
2119
2119
|
sortOrder: number;
|
|
2120
2120
|
number: number;
|
|
2121
2121
|
identifier: string;
|
|
@@ -2327,7 +2327,7 @@ export declare const linearEndpointSchemas: {
|
|
|
2327
2327
|
issue: {
|
|
2328
2328
|
id: string;
|
|
2329
2329
|
title: string;
|
|
2330
|
-
priority: 0 |
|
|
2330
|
+
priority: 0 | 1 | 3 | 2 | 4;
|
|
2331
2331
|
sortOrder: number;
|
|
2332
2332
|
number: number;
|
|
2333
2333
|
identifier: string;
|
|
@@ -2519,7 +2519,7 @@ export declare const linearEndpointSchemas: {
|
|
|
2519
2519
|
parent?: ({
|
|
2520
2520
|
id: string;
|
|
2521
2521
|
title: string;
|
|
2522
|
-
priority: 0 |
|
|
2522
|
+
priority: 0 | 1 | 3 | 2 | 4;
|
|
2523
2523
|
sortOrder: number;
|
|
2524
2524
|
number: number;
|
|
2525
2525
|
identifier: string;
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,aAAa,EACb,YAAY,EACZ,eAAe,EACf,mBAAmB,EACnB,aAAa,EACb,oBAAoB,EACpB,cAAc,EACd,iBAAiB,EACjB,QAAQ,EAER,uBAAuB,EAEvB,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,aAAa,EACb,YAAY,EACZ,eAAe,EACf,mBAAmB,EACnB,aAAa,EACb,oBAAoB,EACpB,cAAc,EACd,iBAAiB,EACjB,QAAQ,EAER,uBAAuB,EAEvB,MAAM,cAAc,CAAC;AAGtB,OAAO,KAAK,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAO/E,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,KAAK,EACX,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,iBAAiB,EACjB,iBAAiB,EACjB,iBAAiB,EACjB,oBAAoB,EACpB,oBAAoB,EACpB,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,MAAM,YAAY,CAAC;AAgBpB,MAAM,MAAM,mBAAmB,GAAG;IACjC,QAAQ,CAAC,EAAE,QAAQ,CAAC,SAAS,GAAG,SAAS,GAAG,SAAS,CAAC,CAAC;IACvD,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,KAAK,CAAC,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC;IACtC,YAAY,CAAC,EAAE,oBAAoB,C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,cAAc,EACd,eAAe,EACf,iBAAiB,EACjB,kBAAkB,EAClB,gBAAgB,EAChB,kBAAkB,EAClB,IAAI,EACJ,aAAa,EACb,iBAAiB,GACjB,MAAM,mBAAmB,CAAC;AAC3B,cAAc,kBAAkB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{AuthMissingError as
|
|
1
|
+
import{AuthMissingError as et,getOAuthAccessToken as oo}from"corsair/core";import{attachManagedRefreshAuth as no,getManagedAccessToken as ao}from"corsair/hub";import{logEventFromContext as U}from"corsair/core";import{ApiError as tt,BaseWebhookHandler as bo,request as ot,verifyHmacSignature as yo}from"corsair/http";var I=class extends Error{constructor(i,r){super(i);this.code=r;this.name="LinearAPIError"}},nt="https://api.linear.app/graphql";async function p(t,n,i){let r={BASE:nt,VERSION:"1.0.0",WITH_CREDENTIALS:!1,CREDENTIALS:"omit",HEADERS:{"Content-Type":"application/json",Authorization:n}},o={method:"POST",url:"",body:{query:t,variables:i||{}},mediaType:"application/json"};try{let c=await ot(r,o);if(c.errors&&c.errors.length>0){let s=c.errors.map(h=>h.message).join(", ");throw new I(s)}if(!c.data)throw new I("No data returned from Linear API");return c.data}catch(c){if(c instanceof I)throw c;if(c instanceof tt){let s=typeof c.body=="object"?JSON.stringify(c.body):String(c.body??"");throw new I(`${c.message} (status=${c.status}, body=${s})`)}throw new I(c instanceof Error?c.message:"Unknown error")}}var at=`
|
|
2
2
|
query Comments($issueId: String!, $first: Int!, $after: String) {
|
|
3
3
|
issue(id: $issueId) {
|
|
4
4
|
comments(first: $first, after: $after) {
|
|
@@ -30,7 +30,7 @@ import{AuthMissingError as se}from"corsair/core";import{attachManagedRefreshAuth
|
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
|
-
`,
|
|
33
|
+
`,rt=`
|
|
34
34
|
mutation CreateComment($input: CommentCreateInput!) {
|
|
35
35
|
commentCreate(input: $input) {
|
|
36
36
|
success
|
|
@@ -54,7 +54,7 @@ import{AuthMissingError as se}from"corsair/core";import{attachManagedRefreshAuth
|
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
|
-
`,
|
|
57
|
+
`,st=`
|
|
58
58
|
mutation UpdateComment($id: String!, $input: CommentUpdateInput!) {
|
|
59
59
|
commentUpdate(id: $id, input: $input) {
|
|
60
60
|
success
|
|
@@ -79,13 +79,13 @@ import{AuthMissingError as se}from"corsair/core";import{attachManagedRefreshAuth
|
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
|
-
`,
|
|
82
|
+
`,it=`
|
|
83
83
|
mutation DeleteComment($id: String!) {
|
|
84
84
|
commentDelete(id: $id) {
|
|
85
85
|
success
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
|
-
`,
|
|
88
|
+
`,oe=async(t,n)=>{let i=t.key,o=(await p(at,i,{issueId:n.issueId,first:n.first||50,after:n.after})).issue.comments;if(o.nodes&&t.db.comments)try{for(let c of o.nodes)await t.db.comments.upsertByEntityId(c.id,{...c,issueId:c.issue.id,userId:c.user.id,parentId:c.parent?.id,createdAt:new Date(c.createdAt??""),updatedAt:new Date(c.updatedAt??"")})}catch(c){console.warn("Failed to save comments to database:",c)}return await U(t,"linear.comments.list",{...n},"completed"),o},ne=async(t,n)=>{let i=t.key,o=(await p(rt,i,{input:n})).commentCreate.comment;if(o&&t.db.comments)try{await t.db.comments.upsertByEntityId(o.id,{...o,issueId:o.issue.id,userId:o.user.id,parentId:o.parent?.id,createdAt:new Date(o.createdAt??""),updatedAt:new Date(o.updatedAt??"")})}catch(c){console.warn("Failed to save comment to database:",c)}return await U(t,"linear.comments.create",{...n},"completed"),o},ae=async(t,n)=>{let i=t.key,o=(await p(st,i,{id:n.id,input:n.input})).commentUpdate.comment;if(o&&t.db.comments)try{await t.db.comments.upsertByEntityId(o.id,{...o,issueId:o.issue.id,userId:o.user.id,parentId:o.parent?.id,createdAt:new Date(o.createdAt??""),updatedAt:new Date(o.updatedAt??"")})}catch(c){console.warn("Failed to update comment in database:",c)}return await U(t,"linear.comments.update",{...n},"completed"),o},re=async(t,n)=>{let i=t.key,o=(await p(it,i,{id:n.id})).commentDelete.success;if(o&&t.db.comments)try{await t.db.comments.deleteByEntityId(n.id)}catch(c){console.warn("Failed to delete comment from database:",c)}return await U(t,"linear.comments.delete",{...n},"completed"),o};import{logEventFromContext as S}from"corsair/core";var dt=`
|
|
89
89
|
query Issues($teamId: ID!, $first: Int!, $after: String) {
|
|
90
90
|
issues(filter: { team: { id: { eq: $teamId } } }, first: $first, after: $after) {
|
|
91
91
|
nodes {
|
|
@@ -142,7 +142,7 @@ import{AuthMissingError as se}from"corsair/core";import{attachManagedRefreshAuth
|
|
|
142
142
|
}
|
|
143
143
|
}
|
|
144
144
|
}
|
|
145
|
-
`,
|
|
145
|
+
`,ct=`
|
|
146
146
|
query Issues($first: Int!, $after: String) {
|
|
147
147
|
issues(first: $first, after: $after) {
|
|
148
148
|
nodes {
|
|
@@ -199,7 +199,7 @@ import{AuthMissingError as se}from"corsair/core";import{attachManagedRefreshAuth
|
|
|
199
199
|
}
|
|
200
200
|
}
|
|
201
201
|
}
|
|
202
|
-
`,
|
|
202
|
+
`,pt=`
|
|
203
203
|
query Issue($id: String!) {
|
|
204
204
|
issue(id: $id) {
|
|
205
205
|
id
|
|
@@ -269,7 +269,7 @@ import{AuthMissingError as se}from"corsair/core";import{attachManagedRefreshAuth
|
|
|
269
269
|
updatedAt
|
|
270
270
|
}
|
|
271
271
|
}
|
|
272
|
-
`,
|
|
272
|
+
`,lt=`
|
|
273
273
|
mutation CreateIssue($input: IssueCreateInput!) {
|
|
274
274
|
issueCreate(input: $input) {
|
|
275
275
|
success
|
|
@@ -308,7 +308,7 @@ import{AuthMissingError as se}from"corsair/core";import{attachManagedRefreshAuth
|
|
|
308
308
|
}
|
|
309
309
|
}
|
|
310
310
|
}
|
|
311
|
-
`,
|
|
311
|
+
`,ut=`
|
|
312
312
|
mutation UpdateIssue($id: String!, $input: IssueUpdateInput!) {
|
|
313
313
|
issueUpdate(id: $id, input: $input) {
|
|
314
314
|
success
|
|
@@ -341,13 +341,13 @@ import{AuthMissingError as se}from"corsair/core";import{attachManagedRefreshAuth
|
|
|
341
341
|
}
|
|
342
342
|
}
|
|
343
343
|
}
|
|
344
|
-
`,
|
|
344
|
+
`,mt=`
|
|
345
345
|
mutation DeleteIssue($id: String!) {
|
|
346
346
|
issueDelete(id: $id) {
|
|
347
347
|
success
|
|
348
348
|
}
|
|
349
349
|
}
|
|
350
|
-
`,
|
|
350
|
+
`,se=async(t,n)=>{let i=n.teamId?dt:ct,r={first:n.first||50};n.teamId&&(r.teamId=n.teamId),n.after&&(r.after=n.after);let c=(await p(i,t.key,r)).issues;if(c.nodes&&t.db.issues)try{for(let s of c.nodes)await t.db.issues.upsertByEntityId(s.id,{...s,stateId:s.state?.id,teamId:s.team?.id,assigneeId:s.assignee?.id,creatorId:s.creator?.id,createdAt:new Date(s.createdAt??""),updatedAt:new Date(s.updatedAt??"")})}catch(s){console.warn("Failed to save issues to database:",s)}return await S(t,"linear.issues.list",{...n},"completed"),c},ie=async(t,n)=>{let r=(await p(pt,t.key,{id:n.id})).issue;if(r&&t.db.issues)try{await t.db.issues.upsertByEntityId(r.id,{...r,stateId:r.state?.id,teamId:r.team?.id,assigneeId:r.assignee?.id,creatorId:r.creator?.id,projectId:r.project?.id,cycleId:r.cycle?.id,createdAt:new Date(r.createdAt??""),updatedAt:new Date(r.updatedAt??"")})}catch(o){console.warn("Failed to save issue to database:",o)}return await S(t,"linear.issues.get",{...n},"completed"),r},de=async(t,n)=>{let r=(await p(lt,t.key,{input:n})).issueCreate.issue;return r&&await t.endpoints.issues.get({id:r.id}),await S(t,"linear.issues.create",{...n},"completed"),r},ce=async(t,n)=>{let r=(await p(ut,t.key,{id:n.id,input:n.input})).issueUpdate.issue;return r&&await t.endpoints.issues.get({id:r.id}),await S(t,"linear.issues.update",{...n},"completed"),r},pe=async(t,n)=>{let r=(await p(mt,t.key,{id:n.id})).issueDelete.success;if(r&&t.db.issues)try{await t.db.issues.deleteByEntityId(n.id)}catch(o){console.warn("Failed to delete issue from database:",o)}return await S(t,"linear.issues.delete",{...n},"completed"),r};import{logEventFromContext as w}from"corsair/core";var bt=`
|
|
351
351
|
query Projects($first: Int!, $after: String) {
|
|
352
352
|
projects(first: $first, after: $after) {
|
|
353
353
|
nodes {
|
|
@@ -386,7 +386,7 @@ import{AuthMissingError as se}from"corsair/core";import{attachManagedRefreshAuth
|
|
|
386
386
|
}
|
|
387
387
|
}
|
|
388
388
|
}
|
|
389
|
-
`,
|
|
389
|
+
`,yt=`
|
|
390
390
|
query Project($id: String!) {
|
|
391
391
|
project(id: $id) {
|
|
392
392
|
id
|
|
@@ -418,7 +418,7 @@ import{AuthMissingError as se}from"corsair/core";import{attachManagedRefreshAuth
|
|
|
418
418
|
updatedAt
|
|
419
419
|
}
|
|
420
420
|
}
|
|
421
|
-
`,
|
|
421
|
+
`,gt=`
|
|
422
422
|
mutation CreateProject($input: ProjectCreateInput!) {
|
|
423
423
|
projectCreate(input: $input) {
|
|
424
424
|
success
|
|
@@ -449,7 +449,7 @@ import{AuthMissingError as se}from"corsair/core";import{attachManagedRefreshAuth
|
|
|
449
449
|
}
|
|
450
450
|
}
|
|
451
451
|
}
|
|
452
|
-
`,
|
|
452
|
+
`,ft=`
|
|
453
453
|
mutation UpdateProject($id: String!, $input: ProjectUpdateInput!) {
|
|
454
454
|
projectUpdate(id: $id, input: $input) {
|
|
455
455
|
success
|
|
@@ -467,13 +467,13 @@ import{AuthMissingError as se}from"corsair/core";import{attachManagedRefreshAuth
|
|
|
467
467
|
}
|
|
468
468
|
}
|
|
469
469
|
}
|
|
470
|
-
`,
|
|
470
|
+
`,ht=`
|
|
471
471
|
mutation DeleteProject($id: String!) {
|
|
472
472
|
projectDelete(id: $id) {
|
|
473
473
|
success
|
|
474
474
|
}
|
|
475
475
|
}
|
|
476
|
-
`,
|
|
476
|
+
`,le=async(t,n)=>{let r=(await p(bt,t.key,{first:n.first||50,after:n.after})).projects;if(r.nodes&&t.db.projects)try{for(let o of r.nodes)await t.db.projects.upsertByEntityId(o.id,{...o,leadId:o.lead?.id,createdAt:new Date(o.createdAt??""),updatedAt:new Date(o.updatedAt??"")})}catch(o){console.warn("Failed to save projects to database:",o)}return await w(t,"linear.projects.list",{...n},"completed"),r},ue=async(t,n)=>{let r=(await p(yt,t.key,{id:n.id})).project;if(r&&t.db.projects)try{await t.db.projects.upsertByEntityId(r.id,{...r,leadId:r.lead?.id,createdAt:new Date(r.createdAt??""),updatedAt:new Date(r.updatedAt??"")})}catch(o){console.warn("Failed to save project to database:",o)}return await w(t,"linear.projects.get",{...n},"completed"),r},me=async(t,n)=>{let r=(await p(gt,t.key,{input:n})).projectCreate.project;return r&&await t.endpoints.projects.get({id:r.id}),await w(t,"linear.projects.create",{...n},"completed"),r},be=async(t,n)=>{let r=(await p(ft,t.key,{id:n.id,input:n.input})).projectUpdate.project;return r&&await t.endpoints.projects.get({id:r.id}),await w(t,"linear.projects.update",{...n},"completed"),r},ye=async(t,n)=>{let r=(await p(ht,t.key,{id:n.id})).projectDelete.success;if(r&&t.db.projects)try{await t.db.projects.deleteByEntityId(n.id)}catch(o){console.warn("Failed to delete project from database:",o)}return await w(t,"linear.projects.delete",{...n},"completed"),r};import{logEventFromContext as ge}from"corsair/core";var It=`
|
|
477
477
|
query Teams($first: Int!, $after: String) {
|
|
478
478
|
teams(first: $first, after: $after) {
|
|
479
479
|
nodes {
|
|
@@ -495,7 +495,7 @@ import{AuthMissingError as se}from"corsair/core";import{attachManagedRefreshAuth
|
|
|
495
495
|
}
|
|
496
496
|
}
|
|
497
497
|
}
|
|
498
|
-
`,
|
|
498
|
+
`,jt=`
|
|
499
499
|
query Team($id: String!) {
|
|
500
500
|
team(id: $id) {
|
|
501
501
|
id
|
|
@@ -509,7 +509,7 @@ import{AuthMissingError as se}from"corsair/core";import{attachManagedRefreshAuth
|
|
|
509
509
|
updatedAt
|
|
510
510
|
}
|
|
511
511
|
}
|
|
512
|
-
`,
|
|
512
|
+
`,fe=async(t,n)=>{let r=(await p(It,t.key,{first:n.first||50,after:n.after})).teams;if(r.nodes&&t.db.teams)try{for(let o of r.nodes)await t.db.teams.upsertByEntityId(o.id,{...o,createdAt:new Date(o.createdAt??""),updatedAt:new Date(o.updatedAt??"")})}catch(o){console.warn("Failed to save teams to database:",o)}return await ge(t,"linear.teams.list",{...n},"completed"),r},he=async(t,n)=>{let r=(await p(jt,t.key,{id:n.id})).team;if(r&&t.db.teams)try{await t.db.teams.upsertByEntityId(r.id,{...r,createdAt:new Date(r.createdAt??""),updatedAt:new Date(r.updatedAt??"")})}catch(o){console.warn("Failed to save team to database:",o)}return await ge(t,"linear.teams.get",{...n},"completed"),r};import{logEventFromContext as Ie}from"corsair/core";var Ct=`
|
|
513
513
|
query Users($first: Int!, $after: String) {
|
|
514
514
|
users(first: $first, after: $after) {
|
|
515
515
|
nodes {
|
|
@@ -531,7 +531,7 @@ import{AuthMissingError as se}from"corsair/core";import{attachManagedRefreshAuth
|
|
|
531
531
|
}
|
|
532
532
|
}
|
|
533
533
|
}
|
|
534
|
-
`,
|
|
534
|
+
`,Lt=`
|
|
535
535
|
query User($id: String!) {
|
|
536
536
|
user(id: $id) {
|
|
537
537
|
id
|
|
@@ -545,4 +545,4 @@ import{AuthMissingError as se}from"corsair/core";import{attachManagedRefreshAuth
|
|
|
545
545
|
updatedAt
|
|
546
546
|
}
|
|
547
547
|
}
|
|
548
|
-
`,ve=async(t,n)=>{let s=(await p(wt,t.key,{first:n.first||50,after:n.after})).users;if(s.nodes&&t.db.users)try{for(let o of s.nodes)await t.db.users.upsertByEntityId(o.id,{...o,createdAt:new Date(o.createdAt??""),updatedAt:new Date(o.updatedAt??"")})}catch(o){console.warn("Failed to save users to database:",o)}return await Ae(t,"linear.users.list",{...n},"completed"),s},ke=async(t,n)=>{let s=(await p(St,t.key,{id:n.id})).user;if(s&&t.db.users)try{await t.db.users.upsertByEntityId(s.id,{...s,createdAt:new Date(s.createdAt??""),updatedAt:new Date(s.updatedAt??"")})}catch(o){console.warn("Failed to save user to database:",o)}return await Ae(t,"linear.users.get",{...n},"completed"),s};import{z as e}from"zod";var L=e.union([e.literal(0),e.literal(1),e.literal(2),e.literal(3),e.literal(4)]),Rt=e.object({teamId:e.string().optional(),first:e.number().optional(),after:e.string().optional()}),Pt=e.object({id:e.string()}),Ut=e.object({title:e.string(),description:e.string().optional(),teamId:e.string(),assigneeId:e.string().optional(),priority:L.optional(),estimate:e.number().optional(),stateId:e.string().optional(),projectId:e.string().optional(),cycleId:e.string().optional(),parentId:e.string().optional(),labelIds:e.array(e.string()).optional(),subscriberIds:e.array(e.string()).optional(),dueDate:e.string().optional()}),Dt=e.object({id:e.string(),input:e.object({title:e.string().optional(),description:e.string().optional(),assigneeId:e.string().optional(),priority:L.optional(),estimate:e.number().optional(),stateId:e.string().optional(),projectId:e.string().optional(),cycleId:e.string().optional(),parentId:e.string().optional(),labelIds:e.array(e.string()).optional(),subscriberIds:e.array(e.string()).optional(),dueDate:e.string().optional()})}),Tt=e.object({id:e.string()}),xt=e.object({first:e.number().optional(),after:e.string().optional()}),_t=e.object({id:e.string()}),zt=e.object({first:e.number().optional(),after:e.string().optional()}),Wt=e.object({id:e.string()}),Ot=e.object({first:e.number().optional(),after:e.string().optional()}),Nt=e.object({id:e.string()}),$t=e.object({name:e.string(),description:e.string().optional(),icon:e.string().optional(),color:e.string().optional(),teamIds:e.array(e.string()),leadId:e.string().optional(),state:e.enum(["planned","started","paused","completed","canceled"]).optional(),priority:e.number().optional(),startDate:e.string().optional(),targetDate:e.string().optional()}),Gt=e.object({id:e.string(),input:e.object({name:e.string().optional(),description:e.string().optional(),icon:e.string().optional(),color:e.string().optional(),teamIds:e.array(e.string()).optional(),leadId:e.string().optional(),state:e.enum(["planned","started","paused","completed","canceled"]).optional(),priority:e.number().optional(),startDate:e.string().optional(),targetDate:e.string().optional()})}),Mt=e.object({id:e.string()}),Bt=e.object({issueId:e.string(),first:e.number().optional(),after:e.string().optional()}),Ft=e.object({issueId:e.string(),body:e.string(),parentId:e.string().optional()}),Ht=e.object({id:e.string(),input:e.object({body:e.string().optional()})}),qt=e.object({id:e.string()}),l={issuesList:Rt,issuesGet:Pt,issuesCreate:Ut,issuesUpdate:Dt,issuesDelete:Tt,teamsList:xt,teamsGet:_t,usersList:zt,usersGet:Wt,projectsList:Ot,projectsGet:Nt,projectsCreate:$t,projectsUpdate:Gt,projectsDelete:Mt,commentsList:Bt,commentsCreate:Ft,commentsUpdate:Ht,commentsDelete:qt},j=e.object({id:e.string(),name:e.string(),email:e.string().optional().nullable(),displayName:e.string(),avatarUrl:e.string().optional().nullable(),active:e.boolean(),admin:e.boolean(),createdAt:e.coerce.date().nullable().optional(),updatedAt:e.coerce.date().nullable().optional()}),C=e.object({id:e.string(),name:e.string(),key:e.string(),description:e.string().optional().nullable(),icon:e.string().optional().nullable(),color:e.string().optional().nullable(),private:e.boolean(),createdAt:e.coerce.date().nullable().optional(),updatedAt:e.coerce.date().nullable().optional(),archivedAt:e.coerce.date().nullable().optional()}),Re=e.enum(["backlog","unstarted","started","completed","canceled"]),Kt=e.object({id:e.string(),name:e.string(),type:Re,color:e.string(),position:e.number(),description:e.string().optional().nullable(),team:C,createdAt:e.coerce.date().nullable().optional(),updatedAt:e.coerce.date().nullable().optional()}),Vt=e.object({id:e.string(),name:e.string(),description:e.string().optional().nullable(),color:e.string(),team:C.optional().nullable(),createdAt:e.coerce.date().nullable().optional(),updatedAt:e.coerce.date().nullable().optional()}),Pe=Vt.extend({parent:e.lazy(()=>Pe.optional().nullable())}),E=e.enum(["backlog","planned","started","paused","completed","canceled"]),Ue=e.object({id:e.string(),name:e.string(),description:e.string().optional().nullable(),icon:e.string().optional().nullable(),color:e.string().optional().nullable(),state:E,priority:e.number(),sortOrder:e.number(),startDate:e.coerce.date().nullable().optional(),targetDate:e.coerce.date().nullable().optional(),completedAt:e.coerce.date().nullable().optional(),canceledAt:e.coerce.date().nullable().optional(),lead:j.optional().nullable(),teams:e.array(C),createdAt:e.coerce.date().nullable().optional(),updatedAt:e.coerce.date().nullable().optional(),archivedAt:e.coerce.date().nullable().optional()}),Jt=e.object({id:e.string(),number:e.number(),name:e.string().optional().nullable(),description:e.string().optional().nullable(),startsAt:e.coerce.date().nullable().optional(),endsAt:e.coerce.date().nullable().optional(),completedAt:e.coerce.date().nullable().optional(),team:C,createdAt:e.coerce.date().nullable().optional(),updatedAt:e.coerce.date().nullable().optional(),archivedAt:e.coerce.date().nullable().optional()}),Qt=e.object({id:e.string(),title:e.string(),description:e.string().optional().nullable(),priority:L,estimate:e.number().optional().nullable(),sortOrder:e.number(),number:e.number(),identifier:e.string(),url:e.string(),state:Kt,team:C,assignee:j.optional().nullable(),creator:j,project:Ue.optional().nullable(),cycle:Jt.optional().nullable(),labels:e.array(Pe),subscribers:e.array(j),dueDate:e.coerce.date().nullable().optional(),startedAt:e.coerce.date().nullable().optional(),completedAt:e.coerce.date().nullable().optional(),canceledAt:e.coerce.date().nullable().optional(),triagedAt:e.coerce.date().nullable().optional(),snoozedUntilAt:e.coerce.date().nullable().optional(),createdAt:e.coerce.date().nullable().optional(),updatedAt:e.coerce.date().nullable().optional(),archivedAt:e.coerce.date().nullable().optional()}),U=Qt.extend({parent:e.lazy(()=>U.optional().nullable())}),Yt=e.object({id:e.string(),body:e.string(),issue:U,user:j,editedAt:e.coerce.date().nullable().optional(),createdAt:e.coerce.date().nullable().optional(),updatedAt:e.coerce.date().nullable().optional(),archivedAt:e.coerce.date().nullable().optional()}),x=Yt.extend({parent:e.lazy(()=>x.optional().nullable())}),A=e.object({hasNextPage:e.boolean(),hasPreviousPage:e.boolean(),startCursor:e.string().optional().nullable(),endCursor:e.string().optional().nullable()}),h=e.object({id:e.string(),name:e.string(),displayName:e.string(),email:e.string().optional().nullable()}),Z=e.object({id:e.string(),name:e.string(),key:e.string()}),De=e.object({id:e.string(),name:e.string(),type:Re,color:e.string().optional(),position:e.number().optional()}),Zt=e.object({id:e.string(),name:e.string(),color:e.string()}),Xt=e.object({nodes:e.array(Zt)}),eo=e.object({nodes:e.array(h)}),to=e.object({id:e.string()}),X=e.object({nodes:e.array(Z)}),oo=e.object({id:e.string(),title:e.string(),description:e.string().optional().nullable(),priority:L,estimate:e.number().optional().nullable(),sortOrder:e.number(),number:e.number(),identifier:e.string(),url:e.string(),state:De,team:Z,assignee:h.optional().nullable(),creator:h,project:e.object({id:e.string(),name:e.string(),state:E}).optional().nullable(),cycle:e.object({id:e.string(),number:e.number(),name:e.string().optional().nullable()}).optional().nullable(),labels:Xt.optional().nullable(),subscribers:eo.nullish(),dueDate:e.coerce.date().nullable().optional(),startedAt:e.coerce.date().nullable().optional(),completedAt:e.coerce.date().nullable().optional(),canceledAt:e.coerce.date().nullable().optional(),triagedAt:e.coerce.date().nullable().optional(),snoozedUntilAt:e.coerce.date().nullable().optional(),createdAt:e.coerce.date().nullable().optional(),updatedAt:e.coerce.date().nullable().optional(),archivedAt:e.coerce.date().nullable().optional()}),_=oo.extend({parent:e.lazy(()=>_.optional().nullable())}),Te=e.object({nodes:e.array(_),pageInfo:A}),Oo=e.object({nodes:e.array(U),pageInfo:A}),xe=e.object({nodes:e.array(C),pageInfo:A}),_e=e.object({nodes:e.array(j),pageInfo:A}),No=e.object({nodes:e.array(Ue),pageInfo:A}),ze=e.object({nodes:e.array(x),pageInfo:A}),$o=e.object({title:e.string(),description:e.string().optional(),teamId:e.string(),assigneeId:e.string().optional(),priority:L.optional(),estimate:e.number().optional(),stateId:e.string().optional(),projectId:e.string().optional(),cycleId:e.string().optional(),parentId:e.string().optional(),labelIds:e.array(e.string()).optional(),subscriberIds:e.array(e.string()).optional(),dueDate:e.coerce.date().nullable().optional()}),Go=e.object({title:e.string().optional(),description:e.string().optional(),assigneeId:e.string().optional(),priority:L.optional(),estimate:e.number().optional(),stateId:e.string().optional(),projectId:e.string().optional(),cycleId:e.string().optional(),parentId:e.string().optional(),labelIds:e.array(e.string()).optional(),subscriberIds:e.array(e.string()).optional(),dueDate:e.coerce.date().nullable().optional()}),Mo=e.object({name:e.string(),description:e.string().optional(),icon:e.string().optional(),color:e.string().optional(),teamIds:e.array(e.string()),leadId:e.string().optional(),state:E.optional(),priority:e.number().optional(),startDate:e.coerce.date().nullable().optional(),targetDate:e.coerce.date().nullable().optional()}),Bo=e.object({name:e.string().optional(),description:e.string().optional(),icon:e.string().optional(),color:e.string().optional(),teamIds:e.array(e.string()).optional(),leadId:e.string().optional(),state:E.optional(),priority:e.number().optional(),startDate:e.coerce.date().nullable().optional(),targetDate:e.coerce.date().nullable().optional()}),Fo=e.object({issueId:e.string(),body:e.string(),parentId:e.string().optional()}),Ho=e.object({body:e.string().optional()}),We=e.object({id:e.string(),name:e.string(),description:e.string().optional().nullable(),icon:e.string().optional().nullable(),color:e.string().optional().nullable(),state:E,priority:e.number(),sortOrder:e.number().optional(),startDate:e.coerce.date().nullable().optional(),targetDate:e.coerce.date().nullable().optional(),completedAt:e.coerce.date().nullable().optional(),canceledAt:e.coerce.date().nullable().optional(),lead:h.optional().nullable(),teams:X,createdAt:e.coerce.date().nullable().optional(),updatedAt:e.coerce.date().nullable().optional(),archivedAt:e.coerce.date().nullable().optional()}),Oe=e.object({id:e.string(),name:e.string(),description:e.string().optional().nullable(),icon:e.string().optional().nullable(),color:e.string().optional().nullable(),state:E,priority:e.number(),sortOrder:e.number().optional(),startDate:e.coerce.date().nullable().optional(),targetDate:e.coerce.date().nullable().optional(),completedAt:e.coerce.date().nullable().optional(),canceledAt:e.coerce.date().nullable().optional(),lead:h.optional().nullable(),teams:X.optional(),createdAt:e.coerce.date().nullable().optional(),updatedAt:e.coerce.date().nullable().optional(),archivedAt:e.coerce.date().nullable().optional()}),ee=e.object({id:e.string(),name:e.string(),description:e.string().optional().nullable(),icon:e.string().optional().nullable(),color:e.string().optional().nullable(),state:E,priority:e.number(),sortOrder:e.number(),startDate:e.coerce.date().nullable().optional(),targetDate:e.coerce.date().nullable().optional(),completedAt:e.coerce.date().nullable().optional(),canceledAt:e.coerce.date().nullable().optional(),lead:h.optional().nullable(),teams:X,createdAt:e.coerce.date().nullable().optional(),updatedAt:e.coerce.date().nullable().optional()}),Ne=e.object({nodes:e.array(ee),pageInfo:A}),qo=e.object({issues:Te}),Ko=e.object({issue:_}),Vo=e.object({issueCreate:e.object({success:e.boolean(),issue:U})}),Jo=e.object({issueUpdate:e.object({success:e.boolean(),issue:U})}),Qo=e.object({issueDelete:e.object({success:e.boolean()})}),Yo=e.object({teams:xe}),Zo=e.object({team:C}),Xo=e.object({users:_e}),en=e.object({user:j}),tn=e.object({projects:Ne}),on=e.object({project:ee}),nn=e.object({projectCreate:e.object({success:e.boolean(),project:We})}),an=e.object({projectUpdate:e.object({success:e.boolean(),project:Oe})}),rn=e.object({projectDelete:e.object({success:e.boolean()})}),sn=e.object({issue:e.object({comments:ze})}),cn=e.object({commentCreate:e.object({success:e.boolean(),comment:x})}),dn=e.object({commentUpdate:e.object({success:e.boolean(),comment:x})}),pn=e.object({commentDelete:e.object({success:e.boolean()})}),we=e.object({id:e.string(),title:e.string().optional(),description:e.string().optional().nullable(),priority:L.optional(),estimate:e.number().optional().nullable(),sortOrder:e.number().optional(),number:e.number().optional(),identifier:e.string().optional(),url:e.string().optional(),state:De.optional(),team:Z.optional(),assignee:h.optional().nullable(),creator:h.optional(),createdAt:e.coerce.date().nullable().optional(),updatedAt:e.coerce.date().nullable().optional()}),Se=e.object({id:e.string(),body:e.string(),issue:to,user:h,parent:e.object({id:e.string()}).optional().nullable(),editedAt:e.coerce.date().nullable().optional(),createdAt:e.coerce.date().nullable().optional(),updatedAt:e.coerce.date().nullable().optional(),archivedAt:e.coerce.date().nullable().optional()}),u={issuesList:Te,issuesGet:_,issuesCreate:we,issuesUpdate:we,issuesDelete:e.boolean(),teamsList:xe,teamsGet:C,usersList:_e,usersGet:j,projectsList:Ne,projectsGet:ee,projectsCreate:We,projectsUpdate:Oe,projectsDelete:e.boolean(),commentsList:ze,commentsCreate:Se,commentsUpdate:Se,commentsDelete:e.boolean()};var D={list:ie,create:ce,update:de,delete:pe},k={list:le,get:ue,create:me,update:ye,delete:be},w={list:ge,get:fe,create:he,update:Ie,delete:je},te={list:Le,get:Ee},oe={list:ve,get:ke};import{ApiError as S}from"corsair/http";var $e={RATE_LIMIT_ERROR:{match:(t,n)=>{if(t instanceof S&&t.status===429)return!0;let r=t.message.toLowerCase();return r.includes("rate_limited")||r.includes("ratelimited")||r.includes("rate limit")||r.includes("too many requests")||t.message.includes("429")},handler:async(t,n)=>{console.log(`[LINEAR:${n.operation}] Rate limit exceeded`);let r;return t instanceof S&&t.retryAfter&&(r=t.retryAfter),{maxRetries:5,headersRetryAfterMs:r}}},AUTH_ERROR:{match:(t,n)=>{if(t instanceof S&&t.status===401)return!0;let r=t.message.toLowerCase();return r.includes("unauthorized")||r.includes("authentication")||r.includes("invalid token")||r.includes("token expired")||r.includes("token revoked")||r.includes("invalid api key")||r.includes("forbidden")||r.includes("access denied")},handler:async(t,n)=>(console.log(`[LINEAR:${n.operation}] Authentication failed - check your API key`),{maxRetries:0})},NOT_FOUND_ERROR:{match:(t,n)=>{if(t instanceof S&&t.status===404)return!0;let r=t.message.toLowerCase();return r.includes("not found")||r.includes("does not exist")||r.includes("could not find")||r.includes("issue not found")||r.includes("team not found")||r.includes("project not found")||r.includes("comment not found")||r.includes("user not found")},handler:async(t,n)=>(console.warn(`[LINEAR:${n.operation}] Resource not found: ${t.message}`),{maxRetries:0})},PERMISSION_ERROR:{match:(t,n)=>{if(t instanceof S&&t.status===403)return!0;let r=t.message.toLowerCase();return r.includes("permission denied")||r.includes("forbidden")||r.includes("access denied")||r.includes("insufficient permissions")||r.includes("unauthorized access")||r.includes("not authorized")},handler:async(t,n)=>(console.warn(`[LINEAR:${n.operation}] Permission denied: ${t.message}`),{maxRetries:0})},NETWORK_ERROR:{match:(t,n)=>{let r=t.message.toLowerCase();return r.includes("network")||r.includes("connection")||r.includes("econnrefused")||r.includes("enotfound")||r.includes("etimedout")||r.includes("fetch failed")||r.includes("network error")},handler:async(t,n)=>(console.warn(`[LINEAR:${n.operation}] Network error: ${t.message}`),{maxRetries:3})},VALIDATION_ERROR:{match:(t,n)=>{if(t instanceof S&&t.status===400)return!0;let r=t.message.toLowerCase();return r.includes("validation")||r.includes("invalid input")||r.includes("bad request")||r.includes("malformed")||r.includes("required field")||r.includes("graphql validation")},handler:async(t,n)=>(console.warn(`[LINEAR:${n.operation}] Validation error: ${t.message}`),{maxRetries:0})},DEFAULT:{match:(t,n)=>!0,handler:async(t,n)=>(console.error(`[LINEAR:${n.operation}] Unhandled error: ${t.message}`),{maxRetries:0})}};import{z as d}from"zod";var Ge=d.object({id:d.string(),title:d.string(),description:d.string().nullable().optional(),priority:d.union([d.literal(0),d.literal(1),d.literal(2),d.literal(3),d.literal(4)]),estimate:d.number().nullable().optional(),sortOrder:d.number().optional(),number:d.number(),identifier:d.string(),url:d.string(),stateId:d.string(),teamId:d.string(),assigneeId:d.string().nullable().optional(),creatorId:d.string(),projectId:d.string().nullable().optional(),cycleId:d.string().nullable().optional(),parentId:d.string().nullable().optional(),dueDate:d.coerce.date().nullable().optional(),startedAt:d.coerce.date().nullable().optional(),completedAt:d.coerce.date().nullable().optional(),canceledAt:d.coerce.date().nullable().optional(),triagedAt:d.coerce.date().nullable().optional(),snoozedUntilAt:d.coerce.date().nullable().optional(),createdAt:d.coerce.date().nullable().optional(),updatedAt:d.coerce.date().nullable().optional(),archivedAt:d.coerce.date().nullable().optional()}),Me=d.object({id:d.string(),name:d.string(),key:d.string(),description:d.string().nullable().optional(),icon:d.string().nullable().optional(),color:d.string().nullable().optional(),private:d.boolean(),createdAt:d.coerce.date().nullable().optional(),updatedAt:d.coerce.date().nullable().optional(),archivedAt:d.coerce.date().nullable().optional()}),Be=d.object({id:d.string(),name:d.string(),description:d.string().nullable().optional(),icon:d.string().nullable().optional(),color:d.string().nullable().optional(),state:d.enum(["planned","started","paused","completed","canceled","backlog"]),priority:d.number(),sortOrder:d.number().optional(),startDate:d.coerce.date().nullable().optional(),targetDate:d.coerce.date().nullable().optional(),completedAt:d.coerce.date().nullable().optional(),canceledAt:d.coerce.date().nullable().optional(),leadId:d.string().nullable().optional(),createdAt:d.coerce.date().nullable().optional(),updatedAt:d.coerce.date().nullable().optional(),archivedAt:d.coerce.date().nullable().optional()}),Fe=d.object({id:d.string(),body:d.string(),issueId:d.string(),userId:d.string(),parentId:d.string().nullable().optional(),editedAt:d.coerce.date().nullable().optional(),createdAt:d.coerce.date().nullable().optional(),updatedAt:d.coerce.date().nullable().optional(),archivedAt:d.coerce.date().nullable().optional()}),He=d.object({id:d.string(),name:d.string(),email:d.string().optional().nullable(),displayName:d.string(),avatarUrl:d.string().optional().nullable(),active:d.boolean(),admin:d.boolean(),createdAt:d.coerce.date().nullable().optional(),updatedAt:d.coerce.date().nullable().optional()});var qe={version:"1.0.0",entities:{issues:Ge,teams:Me,projects:Be,comments:Fe,users:He}};import{logEventFromContext as ne}from"corsair/core";import{verifyHmacSignature as no}from"corsair/http";import{z as a}from"zod";var wn=a.object({id:a.string(),createdAt:a.string(),updatedAt:a.string(),archivedAt:a.string().optional()}).catchall(a.any()),z=a.object({id:a.string(),identifier:a.string(),title:a.string(),description:a.string().optional(),priority:a.union([a.literal(0),a.literal(1),a.literal(2),a.literal(3),a.literal(4)]),estimate:a.number().optional(),sortOrder:a.number(),startedAt:a.string().optional(),completedAt:a.string().optional(),canceledAt:a.string().optional(),autoArchivedAt:a.string().optional(),autoClosedAt:a.string().optional(),dueDate:a.string().optional(),trashed:a.boolean().optional(),snoozedUntilAt:a.string().optional(),previousIdentifiers:a.array(a.string()),createdAt:a.string(),updatedAt:a.string(),branchName:a.string(),customerTicketCount:a.number(),stateId:a.string(),teamId:a.string(),creatorId:a.string()}).catchall(a.any()),W=a.object({id:a.string(),body:a.string(),editedAt:a.string().optional(),createdAt:a.string(),updatedAt:a.string(),issueId:a.string(),userId:a.string()}).catchall(a.any()),O=a.object({id:a.string(),name:a.string(),description:a.string().optional(),icon:a.string().optional(),color:a.string().optional(),priority:a.union([a.literal(0),a.literal(1),a.literal(2),a.literal(3),a.literal(4)]),sortOrder:a.number(),state:a.enum(["planned","started","paused","completed","canceled"]),progress:a.number(),url:a.string(),startDate:a.string().optional(),targetDate:a.string().optional(),completedAt:a.string().optional(),canceledAt:a.string().optional(),startedAt:a.string().optional(),completedScopeHistory:a.array(a.number()),inProgressScopeHistory:a.array(a.number()),scope:a.number(),createdAt:a.string(),updatedAt:a.string()}).catchall(a.any()),N=a.object({action:a.literal("create"),type:a.literal("Issue"),data:z,url:a.string(),createdAt:a.string(),organizationId:a.string(),webhookId:a.string()}),$=a.object({action:a.literal("update"),type:a.literal("Issue"),data:z,updatedFrom:z.partial().optional(),url:a.string(),createdAt:a.string(),organizationId:a.string(),webhookId:a.string()}),G=a.object({action:a.literal("remove"),type:a.literal("Issue"),data:z,url:a.string(),createdAt:a.string(),organizationId:a.string(),webhookId:a.string()}),M=a.object({action:a.literal("create"),type:a.literal("Comment"),data:W,url:a.string(),createdAt:a.string(),organizationId:a.string(),webhookId:a.string()}),B=a.object({action:a.literal("update"),type:a.literal("Comment"),data:W,updatedFrom:W.partial().optional(),url:a.string(),createdAt:a.string(),organizationId:a.string(),webhookId:a.string()}),F=a.object({action:a.literal("remove"),type:a.literal("Comment"),data:W,url:a.string(),createdAt:a.string(),organizationId:a.string(),webhookId:a.string()}),H=a.object({action:a.literal("create"),type:a.literal("Project"),data:O,url:a.string(),createdAt:a.string(),organizationId:a.string(),webhookId:a.string()}),q=a.object({action:a.literal("update"),type:a.literal("Project"),data:O,updatedFrom:O.partial().optional(),url:a.string(),createdAt:a.string(),organizationId:a.string(),webhookId:a.string()}),K=a.object({action:a.literal("remove"),type:a.literal("Project"),data:O,url:a.string(),createdAt:a.string(),organizationId:a.string(),webhookId:a.string()}),Sn=a.union([N,$,G,M,B,F,H,q,K]);function ao(t){return typeof t=="string"?JSON.parse(t):t}function m(t,n){if(!n)return{valid:!1};let r=t.rawBody;if(!r)return{valid:!1,error:"Missing raw body for signature verification"};let s=t.headers,o=Array.isArray(s["linear-signature"])?s["linear-signature"][0]:s["linear-signature"];return o?no(r,n,o)?{valid:!0}:{valid:!1,error:"Invalid signature"}:{valid:!1,error:"Missing linear-signature header"}}function Ke(t,n){return r=>{let s=ao(r.body);return typeof s.type=="string"&&s.type===t&&typeof s.action=="string"&&s.action===n}}var g=Ke;var Ve={match:g("Comment","create"),handler:async(t,n)=>{let r=t.key,s=m(n,r);if(!s.valid)return{success:!1,statusCode:401,error:s.error||"Signature verification failed"};let o=n.payload;if(o.type!=="Comment"||o.action!=="create")return{success:!0,data:void 0};console.log("\u{1F4AC} Linear Comment Created Event:",{id:o.data.id,body:o.data.body?.substring(0,100)});let c="";if(t.db.comments&&o.data.id)try{let i=o.data;c=(await t.db.comments.upsertByEntityId(i.id,{...i,editedAt:i.editedAt?new Date(i.editedAt??""):null,createdAt:new Date(i.createdAt??""),updatedAt:new Date(i.updatedAt??"")}))?.id||""}catch(i){console.warn("Failed to save comment to database:",i)}return await ne(t,"linear.webhook.commentCreate",{...o},"completed"),{success:!0,corsairEntityId:c,data:o}}},Je={match:g("Comment","update"),handler:async(t,n)=>{let r=t.key,s=m(n,r);if(!s.valid)return{success:!1,statusCode:401,error:s.error||"Signature verification failed"};let o=n.payload;if(o.type!=="Comment"||o.action!=="update")return{success:!0,data:void 0};console.log("\u270F\uFE0F Linear Comment Updated Event:",{id:o.data.id,updatedFields:o.updatedFrom?Object.keys(o.updatedFrom):[]});let c="";if(t.db.comments&&o.data.id)try{let i=o.data;c=(await t.db.comments.upsertByEntityId(i.id,{...i,editedAt:i.editedAt?new Date(i.editedAt??""):null,createdAt:new Date(i.createdAt??""),updatedAt:new Date(i.updatedAt??"")}))?.id||""}catch(i){console.warn("Failed to update comment in database:",i)}return await ne(t,"linear.webhook.commentUpdate",{...o},"completed"),{success:!0,corsairEntityId:c,data:o}}},Qe={match:g("Comment","remove"),handler:async(t,n)=>{let r=t.key,s=m(n,r);if(!s.valid)return{success:!1,statusCode:401,error:s.error||"Signature verification failed"};let o=n.payload;if(o.type!=="Comment"||o.action!=="remove")return{success:!0,data:void 0};console.log("\u{1F5D1}\uFE0F Linear Comment Deleted Event:",{id:o.data.id});let c="";if(t.db.comments&&o.data.id)try{let i=await t.db.comments.findByEntityId(o.data.id);i&&(c=i.id),await t.db.comments.deleteByEntityId(o.data.id)}catch(i){console.warn("Failed to delete comment from database:",i)}return await ne(t,"linear.webhook.commentRemove",{...o},"completed"),{success:!0,corsairEntityId:c,data:o}}};import{logEventFromContext as ae}from"corsair/core";var Ye={match:g("Issue","create"),handler:async(t,n)=>{let r=t.key,s=m(n,r);if(!s.valid)return{success:!1,statusCode:401,error:s.error||"Signature verification failed"};let o=n.payload;if(o.type!=="Issue"||o.action!=="create")return{success:!0,data:void 0};console.log("\u{1F4CB} Linear Issue Created Event:",{id:o.data.id,identifier:o.data.identifier,title:o.data.title});let c="";if(t.db.issues&&o.data.id)try{let i=o.data;c=(await t.db.issues.upsertByEntityId(i.id,{...i,number:parseInt(i.identifier.split("-")[1]||"0",10),url:o.url,dueDate:i.dueDate?new Date(i.dueDate??""):null,startedAt:i.startedAt?new Date(i.startedAt??""):null,completedAt:i.completedAt?new Date(i.completedAt??""):null,canceledAt:i.canceledAt?new Date(i.canceledAt??""):null,triagedAt:i.triagedAt?new Date(i.triagedAt??""):null,snoozedUntilAt:i.snoozedUntilAt?new Date(i.snoozedUntilAt??""):null,archivedAt:i.archivedAt?new Date(i.archivedAt??""):null,createdAt:new Date(i.createdAt??""),updatedAt:new Date(i.updatedAt??"")}))?.id||""}catch(i){console.warn("Failed to save issue to database:",i)}return await ae(t,"linear.webhook.issueCreate",{...o},"completed"),{success:!0,corsairEntityId:c,data:o}}},Ze={match:g("Issue","update"),handler:async(t,n)=>{let r=t.key,s=m(n,r);if(!s.valid)return{success:!1,statusCode:401,error:s.error||"Signature verification failed"};let o=n.payload;if(o.type!=="Issue"||o.action!=="update")return{success:!0,data:void 0};console.log("\u{1F4DD} Linear Issue Updated Event:",{id:o.data.id,identifier:o.data.identifier,title:o.data.title,updatedFields:o.updatedFrom?Object.keys(o.updatedFrom):[]});let c="";if(t.db.issues&&o.data.id)try{let i=o.data;c=(await t.db.issues.upsertByEntityId(i.id,{...i,number:parseInt(i.identifier.split("-")[1]||"0",10),url:o.url,dueDate:i.dueDate?new Date(i.dueDate??""):null,startedAt:i.startedAt?new Date(i.startedAt??""):null,completedAt:i.completedAt?new Date(i.completedAt??""):null,canceledAt:i.canceledAt?new Date(i.canceledAt??""):null,triagedAt:i.triagedAt?new Date(i.triagedAt??""):null,snoozedUntilAt:i.snoozedUntilAt?new Date(i.snoozedUntilAt??""):null,archivedAt:i.archivedAt?new Date(i.archivedAt??""):null,createdAt:new Date(i.createdAt??""),updatedAt:new Date(i.updatedAt??"")}))?.id||""}catch(i){console.warn("Failed to update issue in database:",i)}return await ae(t,"linear.webhook.issueUpdate",{...o},"completed"),{success:!0,corsairEntityId:c,data:o}}},Xe={match:g("Issue","remove"),handler:async(t,n)=>{let r=t.key,s=m(n,r);if(!s.valid)return{success:!1,statusCode:401,error:s.error||"Signature verification failed"};let o=n.payload;if(o.type!=="Issue"||o.action!=="remove")return{success:!0,data:void 0};console.log("\u{1F5D1}\uFE0F Linear Issue Deleted Event:",{id:o.data.id,identifier:o.data.identifier});let c="";if(t.db.issues&&o.data.id)try{let i=await t.db.issues.findByEntityId(o.data.id);i&&(c=i.id),await t.db.issues.deleteByEntityId(o.data.id)}catch(i){console.warn("Failed to delete issue from database:",i)}return await ae(t,"linear.webhook.issueRemove",{...o},"completed"),{success:!0,corsairEntityId:c,data:o}}};import{logEventFromContext as re}from"corsair/core";var et={match:g("Project","create"),handler:async(t,n)=>{let r=t.key,s=m(n,r);if(!s.valid)return{success:!1,statusCode:401,error:s.error||"Signature verification failed"};let o=n.payload;if(o.type!=="Project"||o.action!=="create")return{success:!0,data:void 0};console.log("\u{1F4CA} Linear Project Created Event:",{id:o.data.id,name:o.data.name,state:o.data.state});let c="";if(t.db.projects&&o.data.id)try{let i=o.data;c=(await t.db.projects.upsertByEntityId(i.id,{...i,completedAt:i.completedAt?new Date(i.completedAt):null,canceledAt:i.canceledAt?new Date(i.canceledAt):null,createdAt:new Date(i.createdAt??""),updatedAt:new Date(i.updatedAt??""),startDate:i.startDate?new Date(i.startDate):null,targetDate:i.targetDate?new Date(i.targetDate):null}))?.id||""}catch(i){console.warn("Failed to save project to database:",i)}return await re(t,"linear.webhook.projectCreate",{...o},"completed"),{success:!0,corsairEntityId:c,data:o}}},tt={match:g("Project","update"),handler:async(t,n)=>{let r=t.key,s=m(n,r);if(!s.valid)return{success:!1,statusCode:401,error:s.error||"Signature verification failed"};let o=n.payload;if(o.type!=="Project"||o.action!=="update")return{success:!0,data:void 0};console.log("\u{1F4DD} Linear Project Updated Event:",{id:o.data.id,name:o.data.name,updatedFields:o.updatedFrom?Object.keys(o.updatedFrom):[]});let c="";if(t.db.projects&&o.data.id)try{let i=o.data;c=(await t.db.projects.upsertByEntityId(i.id,{...i,completedAt:i.completedAt?new Date(i.completedAt):null,canceledAt:i.canceledAt?new Date(i.canceledAt):null,createdAt:new Date(i.createdAt??""),startDate:i.startDate?new Date(i.startDate):null,targetDate:i.targetDate?new Date(i.targetDate):null,updatedAt:new Date(i.updatedAt??"")}))?.id||""}catch(i){console.warn("Failed to update project in database:",i)}return await re(t,"linear.webhook.projectUpdate",{...o},"completed"),{success:!0,corsairEntityId:c,data:o}}},ot={match:g("Project","remove"),handler:async(t,n)=>{let r=t.key,s=m(n,r);if(!s.valid)return{success:!1,statusCode:401,error:s.error||"Signature verification failed"};let o=n.payload;if(o.type!=="Project"||o.action!=="remove")return{success:!0,data:void 0};console.log("\u{1F5D1}\uFE0F Linear Project Deleted Event:",{id:o.data.id,name:o.data.name});let c="";if(t.db.projects&&o.data.id)try{let i=await t.db.projects.findByEntityId(o.data.id);i&&(c=i.id),await t.db.projects.deleteByEntityId(o.data.id)}catch(i){console.warn("Failed to delete project from database:",i)}return await re(t,"linear.webhook.projectRemove",{...o},"completed"),{success:!0,corsairEntityId:c,data:o}}};var V={create:Ve,update:Je,remove:Qe},J={create:Ye,update:Ze,remove:Xe},Q={create:et,update:tt,remove:ot};import{toExternalId as ro}from"corsair/core";async function nt(t){let n=t.access_token;if(!n)return null;let r=await fetch("https://api.linear.app/graphql",{method:"POST",headers:{Authorization:n,"Content-Type":"application/json"},body:JSON.stringify({query:"query { viewer { organization { id } } }"})});if(!r.ok)return null;let s=await r.json(),o=ro(s.data?.viewer?.organization?.id);return o?{linkType:"organization_id",externalId:o}:null}import{firstString as so,readBodyRecord as io}from"corsair/core";function at(t){let n=io(t);if(!n)return null;let r=so([n.organizationId]);return r?{linkType:"organization_id",externalId:r}:null}var lo={issues:{create:J.create,update:J.update,remove:J.remove},comments:{create:V.create,update:V.update,remove:V.remove},projects:{create:Q.create,update:Q.update,remove:Q.remove}},uo={issues:{list:k.list,get:k.get,create:k.create,update:k.update,delete:k.delete},comments:{list:D.list,create:D.create,update:D.update,delete:D.delete},projects:{list:w.list,get:w.get,create:w.create,update:w.update,delete:w.delete},teams:{list:te.list,get:te.get},users:{list:oe.list,get:oe.get}},mo={"issues.list":{input:l.issuesList,output:u.issuesList},"issues.get":{input:l.issuesGet,output:u.issuesGet},"issues.create":{input:l.issuesCreate,output:u.issuesCreate},"issues.update":{input:l.issuesUpdate,output:u.issuesUpdate},"issues.delete":{input:l.issuesDelete,output:u.issuesDelete},"comments.list":{input:l.commentsList,output:u.commentsList},"comments.create":{input:l.commentsCreate,output:u.commentsCreate},"comments.update":{input:l.commentsUpdate,output:u.commentsUpdate},"comments.delete":{input:l.commentsDelete,output:u.commentsDelete},"projects.list":{input:l.projectsList,output:u.projectsList},"projects.get":{input:l.projectsGet,output:u.projectsGet},"projects.create":{input:l.projectsCreate,output:u.projectsCreate},"projects.update":{input:l.projectsUpdate,output:u.projectsUpdate},"projects.delete":{input:l.projectsDelete,output:u.projectsDelete},"teams.list":{input:l.teamsList,output:u.teamsList},"teams.get":{input:l.teamsGet,output:u.teamsGet},"users.list":{input:l.usersList,output:u.usersList},"users.get":{input:l.usersGet,output:u.usersGet}},yo={"issues.create":{description:"A new issue was created",payload:N,response:N},"issues.update":{description:"An issue was updated",payload:$,response:$},"issues.remove":{description:"An issue was deleted",payload:G,response:G},"comments.create":{description:"A comment was added to an issue",payload:M,response:M},"comments.update":{description:"A comment was updated",payload:B,response:B},"comments.remove":{description:"A comment was deleted",payload:F,response:F},"projects.create":{description:"A new project was created",payload:H,response:H},"projects.update":{description:"A project was updated",payload:q,response:q},"projects.remove":{description:"A project was deleted",payload:K,response:K}},bo="api_key",go={api_key:{account:["organization_id"]},oauth_2:{account:["organization_id"]},managed:{account:["organization_id"]}},fo={"issues.list":{riskLevel:"read",description:"List issues in a team"},"issues.get":{riskLevel:"read",description:"Get a specific issue"},"issues.create":{riskLevel:"write",description:"Create a new issue"},"issues.update":{riskLevel:"write",description:"Update an existing issue"},"issues.delete":{riskLevel:"destructive",irreversible:!0,description:"Permanently delete an issue [DESTRUCTIVE \xB7 IRREVERSIBLE]"},"comments.list":{riskLevel:"read",description:"List comments on an issue"},"comments.create":{riskLevel:"write",description:"Post a comment on an issue"},"comments.update":{riskLevel:"write",description:"Update a comment"},"comments.delete":{riskLevel:"destructive",irreversible:!0,description:"Delete a comment [DESTRUCTIVE]"},"projects.list":{riskLevel:"read",description:"List projects in a team"},"projects.get":{riskLevel:"read",description:"Get a specific project"},"projects.create":{riskLevel:"write",description:"Create a new project"},"projects.update":{riskLevel:"write",description:"Update an existing project"},"projects.delete":{riskLevel:"destructive",irreversible:!0,description:"Permanently delete a project [DESTRUCTIVE \xB7 IRREVERSIBLE]"},"teams.list":{riskLevel:"read",description:"List teams in the workspace"},"teams.get":{riskLevel:"read",description:"Get a specific team"},"users.list":{riskLevel:"read",description:"List users in the workspace"},"users.get":{riskLevel:"read",description:"Get a specific user"}};function ra(t={}){let n={...t,authType:t.authType??bo};return{id:"linear",authConfig:go,oauthConfig:{providerName:"Linear",authUrl:"https://linear.app/oauth/authorize",tokenUrl:"https://api.linear.app/oauth/token",scopes:["read","write"],authParams:{prompt:"consent"}},schema:qe,options:n,hooks:n.hooks,webhookHooks:n.webhookHooks,endpoints:uo,webhooks:lo,endpointMeta:fo,endpointSchemas:mo,webhookSchemas:yo,pluginWebhookMatcher:r=>"linear-signature"in r.headers,pluginTenantWebhookMatcher:at,oauthWebhookTenantLinkResolver:nt,errorHandlers:{...$e,...n.errorHandlers},keyBuilder:async(r,s)=>{let o=r.authType;if(s==="webhook"&&n.webhookSecret)return n.webhookSecret;if(s==="webhook"){let c=await r.keys.get_webhook_signature();if(!c)throw new Error("[auth-missing:linear:webhook_signature]: Linear webhook signature is missing");return c}if(s==="endpoint"&&n.key)return n.key;if(s==="endpoint"&&r.authType==="api_key"){let c=await r.keys.get_api_key();if(!c)throw new se("linear","api_key");return c}if(s==="endpoint"&&r.authType==="oauth_2"){let[c,i,y]=await Promise.all([r.keys.get_access_token(),r.keys.get_expires_at(),r.keys.get_refresh_token()]);if(!y)throw new se("linear","oauth_2");let f=await r.keys.get_integration_credentials();if(!f.client_id||!f.client_secret)throw new Error("[auth-missing:linear:client_credentials]: Linear client credentials are missing");let v;try{v=await Y({accessToken:c,expiresAt:i,refreshToken:y,clientId:f.client_id,clientSecret:f.client_secret})}catch(b){throw new Error(`[corsair:linear] Failed to obtain valid access token: ${b instanceof Error?b.message:String(b)}`)}if(v.refreshed)try{await r.keys.set_access_token(v.accessToken),await r.keys.set_expires_at(String(v.expiresAt)),await r.keys.set_refresh_token(v.refreshToken)}catch(b){throw new Error(`[corsair:linear] Token was refreshed but failed to persist new credentials: ${b instanceof Error?b.message:String(b)}`)}return r._refreshAuth=async()=>{let b=await Y({accessToken:null,expiresAt:null,refreshToken:y,clientId:f.client_id,clientSecret:f.client_secret,forceRefresh:!0});return await r.keys.set_access_token(b.accessToken),await r.keys.set_expires_at(String(b.expiresAt)),await r.keys.set_refresh_token(b.refreshToken),b.accessToken},`Bearer ${v.accessToken}`}if(r.authType==="managed"){if(!r.hub)throw new Error("[auth-missing:linear:managed]: Hub config is required for managed auth. Pass hub: { ... } to createCorsair().");let c={keys:r.keys,hub:r.hub,plugin:"linear",tenantId:r.tenantId},i=await po(c);return await co(r,c),`Bearer ${i.accessToken}`}throw new se("linear","oauth_2")}}}export{Ke as createLinearEventMatch,$e as errorHandlers,ra as linear,go as linearAuthConfig,mo as linearEndpointSchemas,m as verifyLinearWebhookSignature};
|
|
548
|
+
`,je=async(t,n)=>{let r=(await p(Ct,t.key,{first:n.first||50,after:n.after})).users;if(r.nodes&&t.db.users)try{for(let o of r.nodes)await t.db.users.upsertByEntityId(o.id,{...o,createdAt:new Date(o.createdAt??""),updatedAt:new Date(o.updatedAt??"")})}catch(o){console.warn("Failed to save users to database:",o)}return await Ie(t,"linear.users.list",{...n},"completed"),r},Ce=async(t,n)=>{let r=(await p(Lt,t.key,{id:n.id})).user;if(r&&t.db.users)try{await t.db.users.upsertByEntityId(r.id,{...r,createdAt:new Date(r.createdAt??""),updatedAt:new Date(r.updatedAt??"")})}catch(o){console.warn("Failed to save user to database:",o)}return await Ie(t,"linear.users.get",{...n},"completed"),r};import{z as e}from"zod";var j=e.union([e.literal(0),e.literal(1),e.literal(2),e.literal(3),e.literal(4)]),Et=e.object({teamId:e.string().optional(),first:e.number().optional(),after:e.string().optional()}),vt=e.object({id:e.string()}),At=e.object({title:e.string(),description:e.string().optional(),teamId:e.string(),assigneeId:e.string().optional(),priority:j.optional(),estimate:e.number().optional(),stateId:e.string().optional(),projectId:e.string().optional(),cycleId:e.string().optional(),parentId:e.string().optional(),labelIds:e.array(e.string()).optional(),subscriberIds:e.array(e.string()).optional(),dueDate:e.string().optional()}),St=e.object({id:e.string(),input:e.object({title:e.string().optional(),description:e.string().optional(),assigneeId:e.string().optional(),priority:j.optional(),estimate:e.number().optional(),stateId:e.string().optional(),projectId:e.string().optional(),cycleId:e.string().optional(),parentId:e.string().optional(),labelIds:e.array(e.string()).optional(),subscriberIds:e.array(e.string()).optional(),dueDate:e.string().optional()})}),wt=e.object({id:e.string()}),kt=e.object({first:e.number().optional(),after:e.string().optional()}),Rt=e.object({id:e.string()}),Ut=e.object({first:e.number().optional(),after:e.string().optional()}),Pt=e.object({id:e.string()}),Dt=e.object({first:e.number().optional(),after:e.string().optional()}),xt=e.object({id:e.string()}),Tt=e.object({name:e.string(),description:e.string().optional(),icon:e.string().optional(),color:e.string().optional(),teamIds:e.array(e.string()),leadId:e.string().optional(),state:e.enum(["planned","started","paused","completed","canceled"]).optional(),priority:e.number().optional(),startDate:e.string().optional(),targetDate:e.string().optional()}),zt=e.object({id:e.string(),input:e.object({name:e.string().optional(),description:e.string().optional(),icon:e.string().optional(),color:e.string().optional(),teamIds:e.array(e.string()).optional(),leadId:e.string().optional(),state:e.enum(["planned","started","paused","completed","canceled"]).optional(),priority:e.number().optional(),startDate:e.string().optional(),targetDate:e.string().optional()})}),Wt=e.object({id:e.string()}),Ot=e.object({issueId:e.string(),first:e.number().optional(),after:e.string().optional()}),Nt=e.object({issueId:e.string(),body:e.string(),parentId:e.string().optional()}),$t=e.object({id:e.string(),input:e.object({body:e.string().optional()})}),Gt=e.object({id:e.string()}),l={issuesList:Et,issuesGet:vt,issuesCreate:At,issuesUpdate:St,issuesDelete:wt,teamsList:kt,teamsGet:Rt,usersList:Ut,usersGet:Pt,projectsList:Dt,projectsGet:xt,projectsCreate:Tt,projectsUpdate:zt,projectsDelete:Wt,commentsList:Ot,commentsCreate:Nt,commentsUpdate:$t,commentsDelete:Gt},g=e.object({id:e.string(),name:e.string(),email:e.string().optional().nullable(),displayName:e.string(),avatarUrl:e.string().optional().nullable(),active:e.boolean(),admin:e.boolean(),createdAt:e.coerce.date().nullable().optional(),updatedAt:e.coerce.date().nullable().optional()}),f=e.object({id:e.string(),name:e.string(),key:e.string(),description:e.string().optional().nullable(),icon:e.string().optional().nullable(),color:e.string().optional().nullable(),private:e.boolean(),createdAt:e.coerce.date().nullable().optional(),updatedAt:e.coerce.date().nullable().optional(),archivedAt:e.coerce.date().nullable().optional()}),ve=e.enum(["backlog","unstarted","started","completed","canceled"]),_t=e.object({id:e.string(),name:e.string(),type:ve,color:e.string(),position:e.number(),description:e.string().optional().nullable(),team:f,createdAt:e.coerce.date().nullable().optional(),updatedAt:e.coerce.date().nullable().optional()}),Mt=e.object({id:e.string(),name:e.string(),description:e.string().optional().nullable(),color:e.string(),team:f.optional().nullable(),createdAt:e.coerce.date().nullable().optional(),updatedAt:e.coerce.date().nullable().optional()}),Ae=Mt.extend({parent:e.lazy(()=>Ae.optional().nullable())}),C=e.enum(["backlog","planned","started","paused","completed","canceled"]),Se=e.object({id:e.string(),name:e.string(),description:e.string().optional().nullable(),icon:e.string().optional().nullable(),color:e.string().optional().nullable(),state:C,priority:e.number(),sortOrder:e.number(),startDate:e.coerce.date().nullable().optional(),targetDate:e.coerce.date().nullable().optional(),completedAt:e.coerce.date().nullable().optional(),canceledAt:e.coerce.date().nullable().optional(),lead:g.optional().nullable(),teams:e.array(f),createdAt:e.coerce.date().nullable().optional(),updatedAt:e.coerce.date().nullable().optional(),archivedAt:e.coerce.date().nullable().optional()}),Bt=e.object({id:e.string(),number:e.number(),name:e.string().optional().nullable(),description:e.string().optional().nullable(),startsAt:e.coerce.date().nullable().optional(),endsAt:e.coerce.date().nullable().optional(),completedAt:e.coerce.date().nullable().optional(),team:f,createdAt:e.coerce.date().nullable().optional(),updatedAt:e.coerce.date().nullable().optional(),archivedAt:e.coerce.date().nullable().optional()}),Ft=e.object({id:e.string(),title:e.string(),description:e.string().optional().nullable(),priority:j,estimate:e.number().optional().nullable(),sortOrder:e.number(),number:e.number(),identifier:e.string(),url:e.string(),state:_t,team:f,assignee:g.optional().nullable(),creator:g,project:Se.optional().nullable(),cycle:Bt.optional().nullable(),labels:e.array(Ae),subscribers:e.array(g),dueDate:e.coerce.date().nullable().optional(),startedAt:e.coerce.date().nullable().optional(),completedAt:e.coerce.date().nullable().optional(),canceledAt:e.coerce.date().nullable().optional(),triagedAt:e.coerce.date().nullable().optional(),snoozedUntilAt:e.coerce.date().nullable().optional(),createdAt:e.coerce.date().nullable().optional(),updatedAt:e.coerce.date().nullable().optional(),archivedAt:e.coerce.date().nullable().optional()}),k=Ft.extend({parent:e.lazy(()=>k.optional().nullable())}),Ht=e.object({id:e.string(),body:e.string(),issue:k,user:g,editedAt:e.coerce.date().nullable().optional(),createdAt:e.coerce.date().nullable().optional(),updatedAt:e.coerce.date().nullable().optional(),archivedAt:e.coerce.date().nullable().optional()}),P=Ht.extend({parent:e.lazy(()=>P.optional().nullable())}),L=e.object({hasNextPage:e.boolean(),hasPreviousPage:e.boolean(),startCursor:e.string().optional().nullable(),endCursor:e.string().optional().nullable()}),y=e.object({id:e.string(),name:e.string(),displayName:e.string(),email:e.string().optional().nullable()}),V=e.object({id:e.string(),name:e.string(),key:e.string()}),we=e.object({id:e.string(),name:e.string(),type:ve,color:e.string().optional(),position:e.number().optional()}),qt=e.object({id:e.string(),name:e.string(),color:e.string()}),Kt=e.object({nodes:e.array(qt)}),Vt=e.object({nodes:e.array(y)}),Jt=e.object({id:e.string()}),J=e.object({nodes:e.array(V)}),Qt=e.object({id:e.string(),title:e.string(),description:e.string().optional().nullable(),priority:j,estimate:e.number().optional().nullable(),sortOrder:e.number(),number:e.number(),identifier:e.string(),url:e.string(),state:we,team:V,assignee:y.optional().nullable(),creator:y,project:e.object({id:e.string(),name:e.string(),state:C}).optional().nullable(),cycle:e.object({id:e.string(),number:e.number(),name:e.string().optional().nullable()}).optional().nullable(),labels:Kt.optional().nullable(),subscribers:Vt.nullish(),dueDate:e.coerce.date().nullable().optional(),startedAt:e.coerce.date().nullable().optional(),completedAt:e.coerce.date().nullable().optional(),canceledAt:e.coerce.date().nullable().optional(),triagedAt:e.coerce.date().nullable().optional(),snoozedUntilAt:e.coerce.date().nullable().optional(),createdAt:e.coerce.date().nullable().optional(),updatedAt:e.coerce.date().nullable().optional(),archivedAt:e.coerce.date().nullable().optional()}),D=Qt.extend({parent:e.lazy(()=>D.optional().nullable())}),ke=e.object({nodes:e.array(D),pageInfo:L}),xo=e.object({nodes:e.array(k),pageInfo:L}),Re=e.object({nodes:e.array(f),pageInfo:L}),Ue=e.object({nodes:e.array(g),pageInfo:L}),To=e.object({nodes:e.array(Se),pageInfo:L}),Pe=e.object({nodes:e.array(P),pageInfo:L}),zo=e.object({title:e.string(),description:e.string().optional(),teamId:e.string(),assigneeId:e.string().optional(),priority:j.optional(),estimate:e.number().optional(),stateId:e.string().optional(),projectId:e.string().optional(),cycleId:e.string().optional(),parentId:e.string().optional(),labelIds:e.array(e.string()).optional(),subscriberIds:e.array(e.string()).optional(),dueDate:e.coerce.date().nullable().optional()}),Wo=e.object({title:e.string().optional(),description:e.string().optional(),assigneeId:e.string().optional(),priority:j.optional(),estimate:e.number().optional(),stateId:e.string().optional(),projectId:e.string().optional(),cycleId:e.string().optional(),parentId:e.string().optional(),labelIds:e.array(e.string()).optional(),subscriberIds:e.array(e.string()).optional(),dueDate:e.coerce.date().nullable().optional()}),Oo=e.object({name:e.string(),description:e.string().optional(),icon:e.string().optional(),color:e.string().optional(),teamIds:e.array(e.string()),leadId:e.string().optional(),state:C.optional(),priority:e.number().optional(),startDate:e.coerce.date().nullable().optional(),targetDate:e.coerce.date().nullable().optional()}),No=e.object({name:e.string().optional(),description:e.string().optional(),icon:e.string().optional(),color:e.string().optional(),teamIds:e.array(e.string()).optional(),leadId:e.string().optional(),state:C.optional(),priority:e.number().optional(),startDate:e.coerce.date().nullable().optional(),targetDate:e.coerce.date().nullable().optional()}),$o=e.object({issueId:e.string(),body:e.string(),parentId:e.string().optional()}),Go=e.object({body:e.string().optional()}),De=e.object({id:e.string(),name:e.string(),description:e.string().optional().nullable(),icon:e.string().optional().nullable(),color:e.string().optional().nullable(),state:C,priority:e.number(),sortOrder:e.number().optional(),startDate:e.coerce.date().nullable().optional(),targetDate:e.coerce.date().nullable().optional(),completedAt:e.coerce.date().nullable().optional(),canceledAt:e.coerce.date().nullable().optional(),lead:y.optional().nullable(),teams:J,createdAt:e.coerce.date().nullable().optional(),updatedAt:e.coerce.date().nullable().optional(),archivedAt:e.coerce.date().nullable().optional()}),xe=e.object({id:e.string(),name:e.string(),description:e.string().optional().nullable(),icon:e.string().optional().nullable(),color:e.string().optional().nullable(),state:C,priority:e.number(),sortOrder:e.number().optional(),startDate:e.coerce.date().nullable().optional(),targetDate:e.coerce.date().nullable().optional(),completedAt:e.coerce.date().nullable().optional(),canceledAt:e.coerce.date().nullable().optional(),lead:y.optional().nullable(),teams:J.optional(),createdAt:e.coerce.date().nullable().optional(),updatedAt:e.coerce.date().nullable().optional(),archivedAt:e.coerce.date().nullable().optional()}),Q=e.object({id:e.string(),name:e.string(),description:e.string().optional().nullable(),icon:e.string().optional().nullable(),color:e.string().optional().nullable(),state:C,priority:e.number(),sortOrder:e.number(),startDate:e.coerce.date().nullable().optional(),targetDate:e.coerce.date().nullable().optional(),completedAt:e.coerce.date().nullable().optional(),canceledAt:e.coerce.date().nullable().optional(),lead:y.optional().nullable(),teams:J,createdAt:e.coerce.date().nullable().optional(),updatedAt:e.coerce.date().nullable().optional()}),Te=e.object({nodes:e.array(Q),pageInfo:L}),_o=e.object({issues:ke}),Mo=e.object({issue:D}),Bo=e.object({issueCreate:e.object({success:e.boolean(),issue:k})}),Fo=e.object({issueUpdate:e.object({success:e.boolean(),issue:k})}),Ho=e.object({issueDelete:e.object({success:e.boolean()})}),qo=e.object({teams:Re}),Ko=e.object({team:f}),Vo=e.object({users:Ue}),Jo=e.object({user:g}),Qo=e.object({projects:Te}),Yo=e.object({project:Q}),Zo=e.object({projectCreate:e.object({success:e.boolean(),project:De})}),Xo=e.object({projectUpdate:e.object({success:e.boolean(),project:xe})}),en=e.object({projectDelete:e.object({success:e.boolean()})}),tn=e.object({issue:e.object({comments:Pe})}),on=e.object({commentCreate:e.object({success:e.boolean(),comment:P})}),nn=e.object({commentUpdate:e.object({success:e.boolean(),comment:P})}),an=e.object({commentDelete:e.object({success:e.boolean()})}),Le=e.object({id:e.string(),title:e.string().optional(),description:e.string().optional().nullable(),priority:j.optional(),estimate:e.number().optional().nullable(),sortOrder:e.number().optional(),number:e.number().optional(),identifier:e.string().optional(),url:e.string().optional(),state:we.optional(),team:V.optional(),assignee:y.optional().nullable(),creator:y.optional(),createdAt:e.coerce.date().nullable().optional(),updatedAt:e.coerce.date().nullable().optional()}),Ee=e.object({id:e.string(),body:e.string(),issue:Jt,user:y,parent:e.object({id:e.string()}).optional().nullable(),editedAt:e.coerce.date().nullable().optional(),createdAt:e.coerce.date().nullable().optional(),updatedAt:e.coerce.date().nullable().optional(),archivedAt:e.coerce.date().nullable().optional()}),u={issuesList:ke,issuesGet:D,issuesCreate:Le,issuesUpdate:Le,issuesDelete:e.boolean(),teamsList:Re,teamsGet:f,usersList:Ue,usersGet:g,projectsList:Te,projectsGet:Q,projectsCreate:De,projectsUpdate:xe,projectsDelete:e.boolean(),commentsList:Pe,commentsCreate:Ee,commentsUpdate:Ee,commentsDelete:e.boolean()};var R={list:oe,create:ne,update:ae,delete:re},E={list:se,get:ie,create:de,update:ce,delete:pe},v={list:le,get:ue,create:me,update:be,delete:ye},Y={list:fe,get:he},Z={list:je,get:Ce};import{ApiError as A}from"corsair/http";var ze={RATE_LIMIT_ERROR:{match:(t,n)=>{if(t instanceof A&&t.status===429)return!0;let i=t.message.toLowerCase();return i.includes("rate_limited")||i.includes("ratelimited")||i.includes("rate limit")||i.includes("too many requests")||t.message.includes("429")},handler:async(t,n)=>{console.log(`[LINEAR:${n.operation}] Rate limit exceeded`);let i;return t instanceof A&&t.retryAfter&&(i=t.retryAfter),{maxRetries:5,headersRetryAfterMs:i}}},AUTH_ERROR:{match:(t,n)=>{if(t instanceof A&&t.status===401)return!0;let i=t.message.toLowerCase();return i.includes("unauthorized")||i.includes("authentication")||i.includes("invalid token")||i.includes("token expired")||i.includes("token revoked")||i.includes("invalid api key")||i.includes("forbidden")||i.includes("access denied")},handler:async(t,n)=>(console.log(`[LINEAR:${n.operation}] Authentication failed - check your API key`),{maxRetries:0})},NOT_FOUND_ERROR:{match:(t,n)=>{if(t instanceof A&&t.status===404)return!0;let i=t.message.toLowerCase();return i.includes("not found")||i.includes("does not exist")||i.includes("could not find")||i.includes("issue not found")||i.includes("team not found")||i.includes("project not found")||i.includes("comment not found")||i.includes("user not found")},handler:async(t,n)=>(console.warn(`[LINEAR:${n.operation}] Resource not found: ${t.message}`),{maxRetries:0})},PERMISSION_ERROR:{match:(t,n)=>{if(t instanceof A&&t.status===403)return!0;let i=t.message.toLowerCase();return i.includes("permission denied")||i.includes("forbidden")||i.includes("access denied")||i.includes("insufficient permissions")||i.includes("unauthorized access")||i.includes("not authorized")},handler:async(t,n)=>(console.warn(`[LINEAR:${n.operation}] Permission denied: ${t.message}`),{maxRetries:0})},NETWORK_ERROR:{match:(t,n)=>{let i=t.message.toLowerCase();return i.includes("network")||i.includes("connection")||i.includes("econnrefused")||i.includes("enotfound")||i.includes("etimedout")||i.includes("fetch failed")||i.includes("network error")},handler:async(t,n)=>(console.warn(`[LINEAR:${n.operation}] Network error: ${t.message}`),{maxRetries:3})},VALIDATION_ERROR:{match:(t,n)=>{if(t instanceof A&&t.status===400)return!0;let i=t.message.toLowerCase();return i.includes("validation")||i.includes("invalid input")||i.includes("bad request")||i.includes("malformed")||i.includes("required field")||i.includes("graphql validation")},handler:async(t,n)=>(console.warn(`[LINEAR:${n.operation}] Validation error: ${t.message}`),{maxRetries:0})},DEFAULT:{match:(t,n)=>!0,handler:async(t,n)=>(console.error(`[LINEAR:${n.operation}] Unhandled error: ${t.message}`),{maxRetries:0})}};import{z as d}from"zod";var We=d.object({id:d.string(),title:d.string(),description:d.string().nullable().optional(),priority:d.union([d.literal(0),d.literal(1),d.literal(2),d.literal(3),d.literal(4)]),estimate:d.number().nullable().optional(),sortOrder:d.number().optional(),number:d.number(),identifier:d.string(),url:d.string(),stateId:d.string(),teamId:d.string(),assigneeId:d.string().nullable().optional(),creatorId:d.string(),projectId:d.string().nullable().optional(),cycleId:d.string().nullable().optional(),parentId:d.string().nullable().optional(),dueDate:d.coerce.date().nullable().optional(),startedAt:d.coerce.date().nullable().optional(),completedAt:d.coerce.date().nullable().optional(),canceledAt:d.coerce.date().nullable().optional(),triagedAt:d.coerce.date().nullable().optional(),snoozedUntilAt:d.coerce.date().nullable().optional(),createdAt:d.coerce.date().nullable().optional(),updatedAt:d.coerce.date().nullable().optional(),archivedAt:d.coerce.date().nullable().optional()}),Oe=d.object({id:d.string(),name:d.string(),key:d.string(),description:d.string().nullable().optional(),icon:d.string().nullable().optional(),color:d.string().nullable().optional(),private:d.boolean(),createdAt:d.coerce.date().nullable().optional(),updatedAt:d.coerce.date().nullable().optional(),archivedAt:d.coerce.date().nullable().optional()}),Ne=d.object({id:d.string(),name:d.string(),description:d.string().nullable().optional(),icon:d.string().nullable().optional(),color:d.string().nullable().optional(),state:d.enum(["planned","started","paused","completed","canceled","backlog"]),priority:d.number(),sortOrder:d.number().optional(),startDate:d.coerce.date().nullable().optional(),targetDate:d.coerce.date().nullable().optional(),completedAt:d.coerce.date().nullable().optional(),canceledAt:d.coerce.date().nullable().optional(),leadId:d.string().nullable().optional(),createdAt:d.coerce.date().nullable().optional(),updatedAt:d.coerce.date().nullable().optional(),archivedAt:d.coerce.date().nullable().optional()}),$e=d.object({id:d.string(),body:d.string(),issueId:d.string(),userId:d.string(),parentId:d.string().nullable().optional(),editedAt:d.coerce.date().nullable().optional(),createdAt:d.coerce.date().nullable().optional(),updatedAt:d.coerce.date().nullable().optional(),archivedAt:d.coerce.date().nullable().optional()}),Ge=d.object({id:d.string(),name:d.string(),email:d.string().optional().nullable(),displayName:d.string(),avatarUrl:d.string().optional().nullable(),active:d.boolean(),admin:d.boolean(),createdAt:d.coerce.date().nullable().optional(),updatedAt:d.coerce.date().nullable().optional()});var _e={version:"1.0.0",entities:{issues:We,teams:Oe,projects:Ne,comments:$e,users:Ge}};import{logEventFromContext as X}from"corsair/core";import{verifyHmacSignature as Yt}from"corsair/http";import{z as a}from"zod";var Ln=a.object({id:a.string(),createdAt:a.string(),updatedAt:a.string(),archivedAt:a.string().optional()}).catchall(a.any()),x=a.object({id:a.string(),identifier:a.string(),title:a.string(),description:a.string().optional(),priority:a.union([a.literal(0),a.literal(1),a.literal(2),a.literal(3),a.literal(4)]),estimate:a.number().optional(),sortOrder:a.number(),startedAt:a.string().optional(),completedAt:a.string().optional(),canceledAt:a.string().optional(),autoArchivedAt:a.string().optional(),autoClosedAt:a.string().optional(),dueDate:a.string().optional(),trashed:a.boolean().optional(),snoozedUntilAt:a.string().optional(),previousIdentifiers:a.array(a.string()),createdAt:a.string(),updatedAt:a.string(),branchName:a.string(),customerTicketCount:a.number(),stateId:a.string(),teamId:a.string(),creatorId:a.string()}).catchall(a.any()),T=a.object({id:a.string(),body:a.string(),editedAt:a.string().optional(),createdAt:a.string(),updatedAt:a.string(),issueId:a.string(),userId:a.string()}).catchall(a.any()),z=a.object({id:a.string(),name:a.string(),description:a.string().optional(),icon:a.string().optional(),color:a.string().optional(),priority:a.union([a.literal(0),a.literal(1),a.literal(2),a.literal(3),a.literal(4)]),sortOrder:a.number(),state:a.enum(["planned","started","paused","completed","canceled"]),progress:a.number(),url:a.string(),startDate:a.string().optional(),targetDate:a.string().optional(),completedAt:a.string().optional(),canceledAt:a.string().optional(),startedAt:a.string().optional(),completedScopeHistory:a.array(a.number()),inProgressScopeHistory:a.array(a.number()),scope:a.number(),createdAt:a.string(),updatedAt:a.string()}).catchall(a.any()),W=a.object({action:a.literal("create"),type:a.literal("Issue"),data:x,url:a.string(),createdAt:a.string(),organizationId:a.string(),webhookId:a.string()}),O=a.object({action:a.literal("update"),type:a.literal("Issue"),data:x,updatedFrom:x.partial().optional(),url:a.string(),createdAt:a.string(),organizationId:a.string(),webhookId:a.string()}),N=a.object({action:a.literal("remove"),type:a.literal("Issue"),data:x,url:a.string(),createdAt:a.string(),organizationId:a.string(),webhookId:a.string()}),$=a.object({action:a.literal("create"),type:a.literal("Comment"),data:T,url:a.string(),createdAt:a.string(),organizationId:a.string(),webhookId:a.string()}),G=a.object({action:a.literal("update"),type:a.literal("Comment"),data:T,updatedFrom:T.partial().optional(),url:a.string(),createdAt:a.string(),organizationId:a.string(),webhookId:a.string()}),_=a.object({action:a.literal("remove"),type:a.literal("Comment"),data:T,url:a.string(),createdAt:a.string(),organizationId:a.string(),webhookId:a.string()}),M=a.object({action:a.literal("create"),type:a.literal("Project"),data:z,url:a.string(),createdAt:a.string(),organizationId:a.string(),webhookId:a.string()}),B=a.object({action:a.literal("update"),type:a.literal("Project"),data:z,updatedFrom:z.partial().optional(),url:a.string(),createdAt:a.string(),organizationId:a.string(),webhookId:a.string()}),F=a.object({action:a.literal("remove"),type:a.literal("Project"),data:z,url:a.string(),createdAt:a.string(),organizationId:a.string(),webhookId:a.string()}),En=a.union([W,O,N,$,G,_,M,B,F]);function Zt(t){return typeof t=="string"?JSON.parse(t):t}function m(t,n){if(!n)return{valid:!1,error:"Missing webhook secret"};let i=t.rawBody;if(!i)return{valid:!1,error:"Missing raw body for signature verification"};let r=t.headers,o=Array.isArray(r["linear-signature"])?r["linear-signature"][0]:r["linear-signature"];return o?Yt(i,n,o)?{valid:!0}:{valid:!1,error:"Invalid signature"}:{valid:!1,error:"Missing linear-signature header"}}function Me(t,n){return i=>{let r=Zt(i.body);return typeof r.type=="string"&&r.type===t&&typeof r.action=="string"&&r.action===n}}var b=Me;var Be={match:b("Comment","create"),handler:async(t,n)=>{let i=t.key,r=m(n,i);if(!r.valid)return{success:!1,statusCode:401,error:r.error||"Signature verification failed"};let o=n.payload;if(o.type!=="Comment"||o.action!=="create")return{success:!0,data:void 0};console.log("\u{1F4AC} Linear Comment Created Event:",{id:o.data.id,body:o.data.body?.substring(0,100)});let c="";if(t.db.comments&&o.data.id)try{let s=o.data;c=(await t.db.comments.upsertByEntityId(s.id,{...s,editedAt:s.editedAt?new Date(s.editedAt??""):null,createdAt:new Date(s.createdAt??""),updatedAt:new Date(s.updatedAt??"")}))?.id||""}catch(s){console.warn("Failed to save comment to database:",s)}return await X(t,"linear.webhook.commentCreate",{...o},"completed"),{success:!0,corsairEntityId:c,data:o}}},Fe={match:b("Comment","update"),handler:async(t,n)=>{let i=t.key,r=m(n,i);if(!r.valid)return{success:!1,statusCode:401,error:r.error||"Signature verification failed"};let o=n.payload;if(o.type!=="Comment"||o.action!=="update")return{success:!0,data:void 0};console.log("\u270F\uFE0F Linear Comment Updated Event:",{id:o.data.id,updatedFields:o.updatedFrom?Object.keys(o.updatedFrom):[]});let c="";if(t.db.comments&&o.data.id)try{let s=o.data;c=(await t.db.comments.upsertByEntityId(s.id,{...s,editedAt:s.editedAt?new Date(s.editedAt??""):null,createdAt:new Date(s.createdAt??""),updatedAt:new Date(s.updatedAt??"")}))?.id||""}catch(s){console.warn("Failed to update comment in database:",s)}return await X(t,"linear.webhook.commentUpdate",{...o},"completed"),{success:!0,corsairEntityId:c,data:o}}},He={match:b("Comment","remove"),handler:async(t,n)=>{let i=t.key,r=m(n,i);if(!r.valid)return{success:!1,statusCode:401,error:r.error||"Signature verification failed"};let o=n.payload;if(o.type!=="Comment"||o.action!=="remove")return{success:!0,data:void 0};console.log("\u{1F5D1}\uFE0F Linear Comment Deleted Event:",{id:o.data.id});let c="";if(t.db.comments&&o.data.id)try{let s=await t.db.comments.findByEntityId(o.data.id);s&&(c=s.id),await t.db.comments.deleteByEntityId(o.data.id)}catch(s){console.warn("Failed to delete comment from database:",s)}return await X(t,"linear.webhook.commentRemove",{...o},"completed"),{success:!0,corsairEntityId:c,data:o}}};import{logEventFromContext as ee}from"corsair/core";var qe={match:b("Issue","create"),handler:async(t,n)=>{let i=t.key,r=m(n,i);if(!r.valid)return{success:!1,statusCode:401,error:r.error||"Signature verification failed"};let o=n.payload;if(o.type!=="Issue"||o.action!=="create")return{success:!0,data:void 0};console.log("\u{1F4CB} Linear Issue Created Event:",{id:o.data.id,identifier:o.data.identifier,title:o.data.title});let c="";if(t.db.issues&&o.data.id)try{let s=o.data;c=(await t.db.issues.upsertByEntityId(s.id,{...s,number:parseInt(s.identifier.split("-")[1]||"0",10),url:o.url,dueDate:s.dueDate?new Date(s.dueDate??""):null,startedAt:s.startedAt?new Date(s.startedAt??""):null,completedAt:s.completedAt?new Date(s.completedAt??""):null,canceledAt:s.canceledAt?new Date(s.canceledAt??""):null,triagedAt:s.triagedAt?new Date(s.triagedAt??""):null,snoozedUntilAt:s.snoozedUntilAt?new Date(s.snoozedUntilAt??""):null,archivedAt:s.archivedAt?new Date(s.archivedAt??""):null,createdAt:new Date(s.createdAt??""),updatedAt:new Date(s.updatedAt??"")}))?.id||""}catch(s){console.warn("Failed to save issue to database:",s)}return await ee(t,"linear.webhook.issueCreate",{...o},"completed"),{success:!0,corsairEntityId:c,data:o}}},Ke={match:b("Issue","update"),handler:async(t,n)=>{let i=t.key,r=m(n,i);if(!r.valid)return{success:!1,statusCode:401,error:r.error||"Signature verification failed"};let o=n.payload;if(o.type!=="Issue"||o.action!=="update")return{success:!0,data:void 0};console.log("\u{1F4DD} Linear Issue Updated Event:",{id:o.data.id,identifier:o.data.identifier,title:o.data.title,updatedFields:o.updatedFrom?Object.keys(o.updatedFrom):[]});let c="";if(t.db.issues&&o.data.id)try{let s=o.data;c=(await t.db.issues.upsertByEntityId(s.id,{...s,number:parseInt(s.identifier.split("-")[1]||"0",10),url:o.url,dueDate:s.dueDate?new Date(s.dueDate??""):null,startedAt:s.startedAt?new Date(s.startedAt??""):null,completedAt:s.completedAt?new Date(s.completedAt??""):null,canceledAt:s.canceledAt?new Date(s.canceledAt??""):null,triagedAt:s.triagedAt?new Date(s.triagedAt??""):null,snoozedUntilAt:s.snoozedUntilAt?new Date(s.snoozedUntilAt??""):null,archivedAt:s.archivedAt?new Date(s.archivedAt??""):null,createdAt:new Date(s.createdAt??""),updatedAt:new Date(s.updatedAt??"")}))?.id||""}catch(s){console.warn("Failed to update issue in database:",s)}return await ee(t,"linear.webhook.issueUpdate",{...o},"completed"),{success:!0,corsairEntityId:c,data:o}}},Ve={match:b("Issue","remove"),handler:async(t,n)=>{let i=t.key,r=m(n,i);if(!r.valid)return{success:!1,statusCode:401,error:r.error||"Signature verification failed"};let o=n.payload;if(o.type!=="Issue"||o.action!=="remove")return{success:!0,data:void 0};console.log("\u{1F5D1}\uFE0F Linear Issue Deleted Event:",{id:o.data.id,identifier:o.data.identifier});let c="";if(t.db.issues&&o.data.id)try{let s=await t.db.issues.findByEntityId(o.data.id);s&&(c=s.id),await t.db.issues.deleteByEntityId(o.data.id)}catch(s){console.warn("Failed to delete issue from database:",s)}return await ee(t,"linear.webhook.issueRemove",{...o},"completed"),{success:!0,corsairEntityId:c,data:o}}};import{logEventFromContext as te}from"corsair/core";var Je={match:b("Project","create"),handler:async(t,n)=>{let i=t.key,r=m(n,i);if(!r.valid)return{success:!1,statusCode:401,error:r.error||"Signature verification failed"};let o=n.payload;if(o.type!=="Project"||o.action!=="create")return{success:!0,data:void 0};console.log("\u{1F4CA} Linear Project Created Event:",{id:o.data.id,name:o.data.name,state:o.data.state});let c="";if(t.db.projects&&o.data.id)try{let s=o.data;c=(await t.db.projects.upsertByEntityId(s.id,{...s,completedAt:s.completedAt?new Date(s.completedAt):null,canceledAt:s.canceledAt?new Date(s.canceledAt):null,createdAt:new Date(s.createdAt??""),updatedAt:new Date(s.updatedAt??""),startDate:s.startDate?new Date(s.startDate):null,targetDate:s.targetDate?new Date(s.targetDate):null}))?.id||""}catch(s){console.warn("Failed to save project to database:",s)}return await te(t,"linear.webhook.projectCreate",{...o},"completed"),{success:!0,corsairEntityId:c,data:o}}},Qe={match:b("Project","update"),handler:async(t,n)=>{let i=t.key,r=m(n,i);if(!r.valid)return{success:!1,statusCode:401,error:r.error||"Signature verification failed"};let o=n.payload;if(o.type!=="Project"||o.action!=="update")return{success:!0,data:void 0};console.log("\u{1F4DD} Linear Project Updated Event:",{id:o.data.id,name:o.data.name,updatedFields:o.updatedFrom?Object.keys(o.updatedFrom):[]});let c="";if(t.db.projects&&o.data.id)try{let s=o.data;c=(await t.db.projects.upsertByEntityId(s.id,{...s,completedAt:s.completedAt?new Date(s.completedAt):null,canceledAt:s.canceledAt?new Date(s.canceledAt):null,createdAt:new Date(s.createdAt??""),startDate:s.startDate?new Date(s.startDate):null,targetDate:s.targetDate?new Date(s.targetDate):null,updatedAt:new Date(s.updatedAt??"")}))?.id||""}catch(s){console.warn("Failed to update project in database:",s)}return await te(t,"linear.webhook.projectUpdate",{...o},"completed"),{success:!0,corsairEntityId:c,data:o}}},Ye={match:b("Project","remove"),handler:async(t,n)=>{let i=t.key,r=m(n,i);if(!r.valid)return{success:!1,statusCode:401,error:r.error||"Signature verification failed"};let o=n.payload;if(o.type!=="Project"||o.action!=="remove")return{success:!0,data:void 0};console.log("\u{1F5D1}\uFE0F Linear Project Deleted Event:",{id:o.data.id,name:o.data.name});let c="";if(t.db.projects&&o.data.id)try{let s=await t.db.projects.findByEntityId(o.data.id);s&&(c=s.id),await t.db.projects.deleteByEntityId(o.data.id)}catch(s){console.warn("Failed to delete project from database:",s)}return await te(t,"linear.webhook.projectRemove",{...o},"completed"),{success:!0,corsairEntityId:c,data:o}}};var H={create:Be,update:Fe,remove:He},q={create:qe,update:Ke,remove:Ve},K={create:Je,update:Qe,remove:Ye};import{toExternalId as Xt}from"corsair/core";async function Ze(t){let n=t.access_token;if(!n)return null;let i=await fetch("https://api.linear.app/graphql",{method:"POST",headers:{Authorization:n,"Content-Type":"application/json"},body:JSON.stringify({query:"query { viewer { organization { id } } }"})});if(!i.ok)return null;let r=await i.json(),o=Xt(r.data?.viewer?.organization?.id);return o?{linkType:"organization_id",externalId:o}:null}import{firstString as eo,readBodyRecord as to}from"corsair/core";function Xe(t){let n=to(t);if(!n)return null;let i=eo([n.organizationId]);return i?{linkType:"organization_id",externalId:i}:null}var ro={issues:{create:q.create,update:q.update,remove:q.remove},comments:{create:H.create,update:H.update,remove:H.remove},projects:{create:K.create,update:K.update,remove:K.remove}},so={issues:{list:E.list,get:E.get,create:E.create,update:E.update,delete:E.delete},comments:{list:R.list,create:R.create,update:R.update,delete:R.delete},projects:{list:v.list,get:v.get,create:v.create,update:v.update,delete:v.delete},teams:{list:Y.list,get:Y.get},users:{list:Z.list,get:Z.get}},io={"issues.list":{input:l.issuesList,output:u.issuesList},"issues.get":{input:l.issuesGet,output:u.issuesGet},"issues.create":{input:l.issuesCreate,output:u.issuesCreate},"issues.update":{input:l.issuesUpdate,output:u.issuesUpdate},"issues.delete":{input:l.issuesDelete,output:u.issuesDelete},"comments.list":{input:l.commentsList,output:u.commentsList},"comments.create":{input:l.commentsCreate,output:u.commentsCreate},"comments.update":{input:l.commentsUpdate,output:u.commentsUpdate},"comments.delete":{input:l.commentsDelete,output:u.commentsDelete},"projects.list":{input:l.projectsList,output:u.projectsList},"projects.get":{input:l.projectsGet,output:u.projectsGet},"projects.create":{input:l.projectsCreate,output:u.projectsCreate},"projects.update":{input:l.projectsUpdate,output:u.projectsUpdate},"projects.delete":{input:l.projectsDelete,output:u.projectsDelete},"teams.list":{input:l.teamsList,output:u.teamsList},"teams.get":{input:l.teamsGet,output:u.teamsGet},"users.list":{input:l.usersList,output:u.usersList},"users.get":{input:l.usersGet,output:u.usersGet}},co={"issues.create":{description:"A new issue was created",payload:W,response:W},"issues.update":{description:"An issue was updated",payload:O,response:O},"issues.remove":{description:"An issue was deleted",payload:N,response:N},"comments.create":{description:"A comment was added to an issue",payload:$,response:$},"comments.update":{description:"A comment was updated",payload:G,response:G},"comments.remove":{description:"A comment was deleted",payload:_,response:_},"projects.create":{description:"A new project was created",payload:M,response:M},"projects.update":{description:"A project was updated",payload:B,response:B},"projects.remove":{description:"A project was deleted",payload:F,response:F}},po="api_key",lo={api_key:{account:["organization_id"]},oauth_2:{account:["organization_id"]},managed:{account:["organization_id"]}},uo={"issues.list":{riskLevel:"read",description:"List issues in a team"},"issues.get":{riskLevel:"read",description:"Get a specific issue"},"issues.create":{riskLevel:"write",description:"Create a new issue"},"issues.update":{riskLevel:"write",description:"Update an existing issue"},"issues.delete":{riskLevel:"destructive",irreversible:!0,description:"Permanently delete an issue [DESTRUCTIVE \xB7 IRREVERSIBLE]"},"comments.list":{riskLevel:"read",description:"List comments on an issue"},"comments.create":{riskLevel:"write",description:"Post a comment on an issue"},"comments.update":{riskLevel:"write",description:"Update a comment"},"comments.delete":{riskLevel:"destructive",irreversible:!0,description:"Delete a comment"},"projects.list":{riskLevel:"read",description:"List projects in a team"},"projects.get":{riskLevel:"read",description:"Get a specific project"},"projects.create":{riskLevel:"write",description:"Create a new project"},"projects.update":{riskLevel:"write",description:"Update an existing project"},"projects.delete":{riskLevel:"destructive",irreversible:!0,description:"Permanently delete a project [DESTRUCTIVE \xB7 IRREVERSIBLE]"},"teams.list":{riskLevel:"read",description:"List teams in the workspace"},"teams.get":{riskLevel:"read",description:"Get a specific team"},"users.list":{riskLevel:"read",description:"List users in the workspace"},"users.get":{riskLevel:"read",description:"Get a specific user"}};function Xn(t={}){let n={...t,authType:t.authType??po};return{id:"linear",authConfig:lo,oauthConfig:{providerName:"Linear",authUrl:"https://linear.app/oauth/authorize",tokenUrl:"https://api.linear.app/oauth/token",scopes:["read","write"],authParams:{prompt:"consent"}},schema:_e,options:n,hooks:n.hooks,webhookHooks:n.webhookHooks,endpoints:so,webhooks:ro,endpointMeta:uo,endpointSchemas:io,webhookSchemas:co,pluginWebhookMatcher:i=>"linear-signature"in i.headers,pluginTenantWebhookMatcher:Xe,oauthWebhookTenantLinkResolver:Ze,errorHandlers:{...ze,...n.errorHandlers},keyBuilder:async(i,r)=>{let o=i.authType;if(r==="webhook"&&n.webhookSecret)return n.webhookSecret;if(r==="webhook"){let c=await i.keys.get_webhook_signature();if(!c)throw new Error("[auth-missing:linear:webhook_signature]: Linear webhook signature is missing");return c}if(r==="endpoint"&&n.key)return n.key;if(r==="endpoint"&&i.authType==="api_key"){let c=await i.keys.get_api_key();if(!c)throw new et("linear","api_key");return c}if(r==="endpoint"&&i.authType==="oauth_2")return`Bearer ${await oo(i,{plugin:"linear",tokenUrl:"https://api.linear.app/oauth/token"})}`;if(i.authType==="managed"){if(!i.hub)throw new Error("[auth-missing:linear:managed]: Hub config is required for managed auth. Pass hub: { ... } to createCorsair().");let c={keys:i.keys,hub:i.hub,plugin:"linear",tenantId:i.tenantId},s=await ao(c);return await no(i,c),`Bearer ${s.accessToken}`}throw new et("linear","oauth_2")}}}export{Me as createLinearEventMatch,ze as errorHandlers,Xn as linear,lo as linearAuthConfig,io as linearEndpointSchemas,m as verifyLinearWebhookSignature};
|
package/dist/webhooks/index.d.ts
CHANGED
|
@@ -145,7 +145,7 @@ export declare const IssueWebhooks: {
|
|
|
145
145
|
id: string;
|
|
146
146
|
identifier: string;
|
|
147
147
|
title: string;
|
|
148
|
-
priority: 0 |
|
|
148
|
+
priority: 0 | 1 | 3 | 2 | 4;
|
|
149
149
|
sortOrder: number;
|
|
150
150
|
previousIdentifiers: string[];
|
|
151
151
|
createdAt: string;
|
|
@@ -178,7 +178,7 @@ export declare const IssueWebhooks: {
|
|
|
178
178
|
id: string;
|
|
179
179
|
identifier: string;
|
|
180
180
|
title: string;
|
|
181
|
-
priority: 0 |
|
|
181
|
+
priority: 0 | 1 | 3 | 2 | 4;
|
|
182
182
|
sortOrder: number;
|
|
183
183
|
previousIdentifiers: string[];
|
|
184
184
|
createdAt: string;
|
|
@@ -215,7 +215,7 @@ export declare const IssueWebhooks: {
|
|
|
215
215
|
id: string;
|
|
216
216
|
identifier: string;
|
|
217
217
|
title: string;
|
|
218
|
-
priority: 0 |
|
|
218
|
+
priority: 0 | 1 | 3 | 2 | 4;
|
|
219
219
|
sortOrder: number;
|
|
220
220
|
previousIdentifiers: string[];
|
|
221
221
|
createdAt: string;
|
|
@@ -246,7 +246,7 @@ export declare const IssueWebhooks: {
|
|
|
246
246
|
identifier?: string | undefined;
|
|
247
247
|
title?: string | undefined;
|
|
248
248
|
description?: string | undefined;
|
|
249
|
-
priority?: 0 |
|
|
249
|
+
priority?: 0 | 1 | 3 | 2 | 4 | undefined;
|
|
250
250
|
estimate?: number | undefined;
|
|
251
251
|
sortOrder?: number | undefined;
|
|
252
252
|
startedAt?: string | undefined;
|
|
@@ -274,7 +274,7 @@ export declare const IssueWebhooks: {
|
|
|
274
274
|
id: string;
|
|
275
275
|
identifier: string;
|
|
276
276
|
title: string;
|
|
277
|
-
priority: 0 |
|
|
277
|
+
priority: 0 | 1 | 3 | 2 | 4;
|
|
278
278
|
sortOrder: number;
|
|
279
279
|
previousIdentifiers: string[];
|
|
280
280
|
createdAt: string;
|
|
@@ -305,7 +305,7 @@ export declare const IssueWebhooks: {
|
|
|
305
305
|
identifier?: string | undefined;
|
|
306
306
|
title?: string | undefined;
|
|
307
307
|
description?: string | undefined;
|
|
308
|
-
priority?: 0 |
|
|
308
|
+
priority?: 0 | 1 | 3 | 2 | 4 | undefined;
|
|
309
309
|
estimate?: number | undefined;
|
|
310
310
|
sortOrder?: number | undefined;
|
|
311
311
|
startedAt?: string | undefined;
|
|
@@ -337,7 +337,7 @@ export declare const IssueWebhooks: {
|
|
|
337
337
|
id: string;
|
|
338
338
|
identifier: string;
|
|
339
339
|
title: string;
|
|
340
|
-
priority: 0 |
|
|
340
|
+
priority: 0 | 1 | 3 | 2 | 4;
|
|
341
341
|
sortOrder: number;
|
|
342
342
|
previousIdentifiers: string[];
|
|
343
343
|
createdAt: string;
|
|
@@ -370,7 +370,7 @@ export declare const IssueWebhooks: {
|
|
|
370
370
|
id: string;
|
|
371
371
|
identifier: string;
|
|
372
372
|
title: string;
|
|
373
|
-
priority: 0 |
|
|
373
|
+
priority: 0 | 1 | 3 | 2 | 4;
|
|
374
374
|
sortOrder: number;
|
|
375
375
|
previousIdentifiers: string[];
|
|
376
376
|
createdAt: string;
|
|
@@ -408,7 +408,7 @@ export declare const ProjectWebhooks: {
|
|
|
408
408
|
[x: string]: any;
|
|
409
409
|
id: string;
|
|
410
410
|
name: string;
|
|
411
|
-
priority: 0 |
|
|
411
|
+
priority: 0 | 1 | 3 | 2 | 4;
|
|
412
412
|
sortOrder: number;
|
|
413
413
|
state: "completed" | "canceled" | "planned" | "started" | "paused";
|
|
414
414
|
progress: number;
|
|
@@ -438,7 +438,7 @@ export declare const ProjectWebhooks: {
|
|
|
438
438
|
[x: string]: any;
|
|
439
439
|
id: string;
|
|
440
440
|
name: string;
|
|
441
|
-
priority: 0 |
|
|
441
|
+
priority: 0 | 1 | 3 | 2 | 4;
|
|
442
442
|
sortOrder: number;
|
|
443
443
|
state: "completed" | "canceled" | "planned" | "started" | "paused";
|
|
444
444
|
progress: number;
|
|
@@ -472,7 +472,7 @@ export declare const ProjectWebhooks: {
|
|
|
472
472
|
[x: string]: any;
|
|
473
473
|
id: string;
|
|
474
474
|
name: string;
|
|
475
|
-
priority: 0 |
|
|
475
|
+
priority: 0 | 1 | 3 | 2 | 4;
|
|
476
476
|
sortOrder: number;
|
|
477
477
|
state: "completed" | "canceled" | "planned" | "started" | "paused";
|
|
478
478
|
progress: number;
|
|
@@ -502,7 +502,7 @@ export declare const ProjectWebhooks: {
|
|
|
502
502
|
description?: string | undefined;
|
|
503
503
|
icon?: string | undefined;
|
|
504
504
|
color?: string | undefined;
|
|
505
|
-
priority?: 0 |
|
|
505
|
+
priority?: 0 | 1 | 3 | 2 | 4 | undefined;
|
|
506
506
|
sortOrder?: number | undefined;
|
|
507
507
|
state?: "completed" | "canceled" | "planned" | "started" | "paused" | undefined;
|
|
508
508
|
progress?: number | undefined;
|
|
@@ -525,7 +525,7 @@ export declare const ProjectWebhooks: {
|
|
|
525
525
|
[x: string]: any;
|
|
526
526
|
id: string;
|
|
527
527
|
name: string;
|
|
528
|
-
priority: 0 |
|
|
528
|
+
priority: 0 | 1 | 3 | 2 | 4;
|
|
529
529
|
sortOrder: number;
|
|
530
530
|
state: "completed" | "canceled" | "planned" | "started" | "paused";
|
|
531
531
|
progress: number;
|
|
@@ -555,7 +555,7 @@ export declare const ProjectWebhooks: {
|
|
|
555
555
|
description?: string | undefined;
|
|
556
556
|
icon?: string | undefined;
|
|
557
557
|
color?: string | undefined;
|
|
558
|
-
priority?: 0 |
|
|
558
|
+
priority?: 0 | 1 | 3 | 2 | 4 | undefined;
|
|
559
559
|
sortOrder?: number | undefined;
|
|
560
560
|
state?: "completed" | "canceled" | "planned" | "started" | "paused" | undefined;
|
|
561
561
|
progress?: number | undefined;
|
|
@@ -582,7 +582,7 @@ export declare const ProjectWebhooks: {
|
|
|
582
582
|
[x: string]: any;
|
|
583
583
|
id: string;
|
|
584
584
|
name: string;
|
|
585
|
-
priority: 0 |
|
|
585
|
+
priority: 0 | 1 | 3 | 2 | 4;
|
|
586
586
|
sortOrder: number;
|
|
587
587
|
state: "completed" | "canceled" | "planned" | "started" | "paused";
|
|
588
588
|
progress: number;
|
|
@@ -612,7 +612,7 @@ export declare const ProjectWebhooks: {
|
|
|
612
612
|
[x: string]: any;
|
|
613
613
|
id: string;
|
|
614
614
|
name: string;
|
|
615
|
-
priority: 0 |
|
|
615
|
+
priority: 0 | 1 | 3 | 2 | 4;
|
|
616
616
|
sortOrder: number;
|
|
617
617
|
state: "completed" | "canceled" | "planned" | "started" | "paused";
|
|
618
618
|
progress: number;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.test.d.ts","sourceRoot":"","sources":["../../webhooks/types.test.ts"],"names":[],"mappings":""}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@corsair-dev/linear",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.7",
|
|
4
4
|
"description": "Linear plugin for Corsair",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
}
|
|
15
15
|
},
|
|
16
16
|
"peerDependencies": {
|
|
17
|
-
"corsair": ">=0.1.
|
|
17
|
+
"corsair": ">=0.1.120",
|
|
18
18
|
"zod": "^4.1.13"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
@@ -24,18 +24,24 @@
|
|
|
24
24
|
"typescript": "^5.9.3",
|
|
25
25
|
"zod": "^4.1.13",
|
|
26
26
|
"jest": "^29.7.0",
|
|
27
|
-
"corsair": "0.1.
|
|
27
|
+
"corsair": "0.1.129"
|
|
28
28
|
},
|
|
29
29
|
"keywords": [
|
|
30
30
|
"corsair",
|
|
31
31
|
"linear",
|
|
32
32
|
"plugin"
|
|
33
33
|
],
|
|
34
|
-
"author": "",
|
|
34
|
+
"author": "Corsair (https://corsair.dev)",
|
|
35
35
|
"license": "Apache-2.0",
|
|
36
36
|
"files": [
|
|
37
37
|
"dist"
|
|
38
38
|
],
|
|
39
|
+
"repository": {
|
|
40
|
+
"type": "git",
|
|
41
|
+
"url": "git+https://github.com/corsairdev/corsair.git",
|
|
42
|
+
"directory": "packages/linear"
|
|
43
|
+
},
|
|
44
|
+
"homepage": "https://docs.corsair.dev/plugins/linear",
|
|
39
45
|
"scripts": {
|
|
40
46
|
"build": "rm -rf dist && tsc --build --force && tsup",
|
|
41
47
|
"typecheck": "tsc --noEmit",
|