@trigger.dev/linear 0.0.0-cross-runtime-20231204115010 → 0.0.0-cross-runtime-20231204122122

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/dist/index.mjs ADDED
@@ -0,0 +1,4044 @@
1
+ import { ExternalSourceTrigger, ExternalSource, retry } from '@trigger.dev/sdk';
2
+ import { LinearDocument, LinearError, RatelimitedLinearError, LINEAR_WEBHOOK_SIGNATURE_HEADER, LinearWebhooks, LINEAR_WEBHOOK_TS_FIELD, LinearClient } from '@linear/sdk';
3
+ import { z } from 'zod';
4
+
5
+ var __defProp = Object.defineProperty;
6
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __accessCheck = (obj, member, msg) => {
12
+ if (!member.has(obj))
13
+ throw TypeError("Cannot " + msg);
14
+ };
15
+ var __privateGet = (obj, member, getter) => {
16
+ __accessCheck(obj, member, "read from private field");
17
+ return getter ? getter.call(obj) : member.get(obj);
18
+ };
19
+ var __privateAdd = (obj, member, value) => {
20
+ if (member.has(obj))
21
+ throw TypeError("Cannot add the same private member more than once");
22
+ member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
23
+ };
24
+
25
+ // src/events.ts
26
+ var events_exports = {};
27
+ __export(events_exports, {
28
+ onAttachment: () => onAttachment,
29
+ onAttachmentCreated: () => onAttachmentCreated,
30
+ onAttachmentRemoved: () => onAttachmentRemoved,
31
+ onAttachmentUpdated: () => onAttachmentUpdated,
32
+ onComment: () => onComment,
33
+ onCommentCreated: () => onCommentCreated,
34
+ onCommentRemoved: () => onCommentRemoved,
35
+ onCommentUpdated: () => onCommentUpdated,
36
+ onCycle: () => onCycle,
37
+ onCycleCreated: () => onCycleCreated,
38
+ onCycleRemoved: () => onCycleRemoved,
39
+ onCycleUpdated: () => onCycleUpdated,
40
+ onIssue: () => onIssue,
41
+ onIssueCreated: () => onIssueCreated,
42
+ onIssueLabel: () => onIssueLabel,
43
+ onIssueLabelCreated: () => onIssueLabelCreated,
44
+ onIssueLabelRemoved: () => onIssueLabelRemoved,
45
+ onIssueLabelUpdated: () => onIssueLabelUpdated,
46
+ onIssueRemoved: () => onIssueRemoved,
47
+ onIssueSLA: () => onIssueSLA,
48
+ onIssueSLABreached: () => onIssueSLABreached,
49
+ onIssueSLAHighRisk: () => onIssueSLAHighRisk,
50
+ onIssueSLASet: () => onIssueSLASet,
51
+ onIssueUpdated: () => onIssueUpdated,
52
+ onProject: () => onProject,
53
+ onProjectCreated: () => onProjectCreated,
54
+ onProjectRemoved: () => onProjectRemoved,
55
+ onProjectUpdate: () => onProjectUpdate,
56
+ onProjectUpdateCreated: () => onProjectUpdateCreated,
57
+ onProjectUpdateRemoved: () => onProjectUpdateRemoved,
58
+ onProjectUpdateUpdated: () => onProjectUpdateUpdated,
59
+ onProjectUpdated: () => onProjectUpdated,
60
+ onReaction: () => onReaction,
61
+ onReactionCreated: () => onReactionCreated,
62
+ onReactionRemoved: () => onReactionRemoved,
63
+ onReactionUpdated: () => onReactionUpdated
64
+ });
65
+
66
+ // src/payload-examples/AttachmentCreated.json
67
+ var AttachmentCreated_default = {
68
+ data: {
69
+ id: "8a4c109b-3288-4bef-8a80-8c1618e0f4ad",
70
+ url: "https://www.rickastley.co.uk/",
71
+ title: "My Personal Website",
72
+ source: {
73
+ type: "api",
74
+ imageUrl: "https://uploads.linear.app/attachment-icons/6fca65e5bca9d4ac8eb9d9442c5e3170081f0aa3eb820eebd58766b53fe7236c"
75
+ },
76
+ issueId: "ee4d5612-0752-441a-95cd-2a0de56689d3",
77
+ metadata: {},
78
+ subtitle: "Rick Astley Official Site",
79
+ createdAt: "2023-09-17T10:51:34.932Z",
80
+ creatorId: "b552c442-62c9-40da-9932-ed8cb6e15a3f",
81
+ updatedAt: "2023-09-17T10:51:34.932Z",
82
+ sourceType: "api",
83
+ groupBySource: false
84
+ },
85
+ type: "Attachment",
86
+ action: "create",
87
+ createdAt: "2023-09-17T10:51:34.932Z",
88
+ webhookId: "d617c08b-47b6-4b09-a611-2e2f6d8fb99f",
89
+ organizationId: "7c0221e0-76d2-45eb-b803-6163c046c534",
90
+ webhookTimestamp: "2023-09-17T10:51:37.795Z"
91
+ };
92
+
93
+ // src/payload-examples/AttachmentRemoved.json
94
+ var AttachmentRemoved_default = {
95
+ data: {
96
+ id: "8a4c109b-3288-4bef-8a80-8c1618e0f4ad",
97
+ url: "https://www.rickastley.co.uk/",
98
+ title: "Will Never Give You Up",
99
+ source: {
100
+ type: "api",
101
+ imageUrl: "https://uploads.linear.app/attachment-icons/6fca65e5bca9d4ac8eb9d9442c5e3170081f0aa3eb820eebd58766b53fe7236c"
102
+ },
103
+ issueId: "ee4d5612-0752-441a-95cd-2a0de56689d3",
104
+ metadata: {},
105
+ subtitle: "Rick Astley Official Site",
106
+ createdAt: "2023-09-17T10:51:34.932Z",
107
+ creatorId: "b552c442-62c9-40da-9932-ed8cb6e15a3f",
108
+ updatedAt: "2023-09-17T10:51:55.751Z",
109
+ sourceType: "api",
110
+ groupBySource: false
111
+ },
112
+ type: "Attachment",
113
+ action: "remove",
114
+ createdAt: "2023-09-17T10:52:15.457Z",
115
+ webhookId: "d617c08b-47b6-4b09-a611-2e2f6d8fb99f",
116
+ organizationId: "7c0221e0-76d2-45eb-b803-6163c046c534",
117
+ webhookTimestamp: "2023-09-17T10:52:15.938Z"
118
+ };
119
+
120
+ // src/payload-examples/AttachmentUpdated.json
121
+ var AttachmentUpdated_default = {
122
+ data: {
123
+ id: "8a4c109b-3288-4bef-8a80-8c1618e0f4ad",
124
+ url: "https://www.rickastley.co.uk/",
125
+ title: "Will Never Give You Up",
126
+ source: {
127
+ type: "api",
128
+ imageUrl: "https://uploads.linear.app/attachment-icons/6fca65e5bca9d4ac8eb9d9442c5e3170081f0aa3eb820eebd58766b53fe7236c"
129
+ },
130
+ issueId: "ee4d5612-0752-441a-95cd-2a0de56689d3",
131
+ metadata: {},
132
+ subtitle: "Rick Astley Official Site",
133
+ createdAt: "2023-09-17T10:51:34.932Z",
134
+ creatorId: "b552c442-62c9-40da-9932-ed8cb6e15a3f",
135
+ updatedAt: "2023-09-17T10:51:55.751Z",
136
+ sourceType: "api",
137
+ groupBySource: false
138
+ },
139
+ type: "Attachment",
140
+ action: "update",
141
+ createdAt: "2023-09-17T10:51:55.751Z",
142
+ webhookId: "d617c08b-47b6-4b09-a611-2e2f6d8fb99f",
143
+ updatedFrom: {
144
+ title: "My Personal Website",
145
+ updatedAt: "2023-09-17T10:51:34.932Z"
146
+ },
147
+ organizationId: "7c0221e0-76d2-45eb-b803-6163c046c534",
148
+ webhookTimestamp: "2023-09-17T10:51:55.809Z"
149
+ };
150
+
151
+ // src/payload-examples/CommentCreated.json
152
+ var CommentCreated_default = {
153
+ url: "https://linear.app/triggerdotdev/issue/TRI-1/welcome-to-linear-\u{1F44B}#comment-a4083fcd",
154
+ data: {
155
+ id: "a4083fcd-2513-4a9b-9a73-bab21cd56a95",
156
+ body: "I just wanna tell you how I'm feeling",
157
+ issue: {
158
+ id: "ee4d5612-0752-441a-95cd-2a0de56689d3",
159
+ title: "Welcome to Rick's World \u2764\uFE0F\u200D\u{1F525}"
160
+ },
161
+ userId: "b552c442-62c9-40da-9932-ed8cb6e15a3f",
162
+ issueId: "ee4d5612-0752-441a-95cd-2a0de56689d3",
163
+ createdAt: "2023-09-17T10:57:11.751Z",
164
+ updatedAt: "2023-09-17T10:57:11.751Z",
165
+ reactionData: []
166
+ },
167
+ type: "Comment",
168
+ action: "create",
169
+ createdAt: "2023-09-17T10:57:11.751Z",
170
+ webhookId: "d617c08b-47b6-4b09-a611-2e2f6d8fb99f",
171
+ organizationId: "7c0221e0-76d2-45eb-b803-6163c046c534",
172
+ webhookTimestamp: "2023-09-17T10:57:11.842Z"
173
+ };
174
+
175
+ // src/payload-examples/CommentRemoved.json
176
+ var CommentRemoved_default = {
177
+ data: {
178
+ id: "a4083fcd-2513-4a9b-9a73-bab21cd56a95",
179
+ body: "Gotta make you understand",
180
+ issue: {
181
+ id: "ee4d5612-0752-441a-95cd-2a0de56689d3",
182
+ title: "Welcome to Rick's World \u2764\uFE0F\u200D\u{1F525}"
183
+ },
184
+ userId: "b552c442-62c9-40da-9932-ed8cb6e15a3f",
185
+ issueId: "ee4d5612-0752-441a-95cd-2a0de56689d3",
186
+ editedAt: "2023-09-17T10:57:24.386Z",
187
+ createdAt: "2023-09-17T10:57:11.751Z",
188
+ updatedAt: "2023-09-17T10:57:24.387Z",
189
+ reactionData: []
190
+ },
191
+ type: "Comment",
192
+ action: "remove",
193
+ createdAt: "2023-09-17T10:57:37.324Z",
194
+ webhookId: "d617c08b-47b6-4b09-a611-2e2f6d8fb99f",
195
+ organizationId: "7c0221e0-76d2-45eb-b803-6163c046c534",
196
+ webhookTimestamp: "2023-09-17T10:57:37.376Z"
197
+ };
198
+
199
+ // src/payload-examples/CommentUpdated.json
200
+ var CommentUpdated_default = {
201
+ url: "https://linear.app/triggerdotdev/issue/TRI-1/welcome-to-linear-\u{1F44B}#comment-a4083fcd",
202
+ data: {
203
+ id: "a4083fcd-2513-4a9b-9a73-bab21cd56a95",
204
+ body: "Gotta make you understand",
205
+ issue: {
206
+ id: "ee4d5612-0752-441a-95cd-2a0de56689d3",
207
+ title: "Welcome to Rick's World \u2764\uFE0F\u200D\u{1F525}"
208
+ },
209
+ userId: "b552c442-62c9-40da-9932-ed8cb6e15a3f",
210
+ issueId: "ee4d5612-0752-441a-95cd-2a0de56689d3",
211
+ editedAt: "2023-09-17T10:57:24.386Z",
212
+ createdAt: "2023-09-17T10:57:11.751Z",
213
+ updatedAt: "2023-09-17T10:57:24.387Z",
214
+ reactionData: []
215
+ },
216
+ type: "Comment",
217
+ action: "update",
218
+ createdAt: "2023-09-17T10:57:24.387Z",
219
+ webhookId: "d617c08b-47b6-4b09-a611-2e2f6d8fb99f",
220
+ updatedFrom: {
221
+ body: "I just wanna tell you how I'm feeling",
222
+ editedAt: null,
223
+ updatedAt: "2023-09-17T10:57:11.751Z"
224
+ },
225
+ organizationId: "7c0221e0-76d2-45eb-b803-6163c046c534",
226
+ webhookTimestamp: "2023-09-17T10:57:24.446Z"
227
+ };
228
+
229
+ // src/payload-examples/CycleCreated.json
230
+ var CycleCreated_default = {
231
+ data: {
232
+ id: "cf1f0ba0-a769-402c-a5a4-308bca3ff53c",
233
+ endsAt: "2023-10-08T23:00:00.000Z",
234
+ number: 1,
235
+ teamId: "0d9e46fb-bf4a-4d7b-9bb0-d5928d8b1c9f",
236
+ startsAt: "2023-09-24T23:00:00.000Z",
237
+ createdAt: "2023-09-17T11:00:19.616Z",
238
+ updatedAt: "2023-09-17T11:00:19.616Z",
239
+ scopeHistory: [],
240
+ issueCountHistory: [],
241
+ completedScopeHistory: [],
242
+ inProgressScopeHistory: [],
243
+ completedIssueCountHistory: [],
244
+ uncompletedIssuesUponCloseIds: []
245
+ },
246
+ type: "Cycle",
247
+ action: "create",
248
+ createdAt: "2023-09-17T11:00:19.616Z",
249
+ webhookId: "d617c08b-47b6-4b09-a611-2e2f6d8fb99f",
250
+ organizationId: "7c0221e0-76d2-45eb-b803-6163c046c534",
251
+ webhookTimestamp: "2023-09-17T11:00:19.696Z"
252
+ };
253
+
254
+ // src/payload-examples/CycleRemoved.json
255
+ var CycleRemoved_default = {
256
+ data: {
257
+ id: "fe7092dd-8a68-4a07-9477-b7c0a6f2136d",
258
+ endsAt: "2023-11-13T00:00:00.000Z",
259
+ number: 2,
260
+ teamId: "0d9e46fb-bf4a-4d7b-9bb0-d5928d8b1c9f",
261
+ startsAt: "2023-10-15T23:00:00.000Z",
262
+ createdAt: "2023-09-17T11:00:19.616Z",
263
+ updatedAt: "2023-09-17T11:00:47.427Z",
264
+ scopeHistory: [],
265
+ issueCountHistory: [],
266
+ completedScopeHistory: [],
267
+ inProgressScopeHistory: [],
268
+ completedIssueCountHistory: [],
269
+ uncompletedIssuesUponCloseIds: []
270
+ },
271
+ type: "Cycle",
272
+ action: "remove",
273
+ createdAt: "2023-09-17T11:01:08.772Z",
274
+ webhookId: "d617c08b-47b6-4b09-a611-2e2f6d8fb99f",
275
+ organizationId: "7c0221e0-76d2-45eb-b803-6163c046c534",
276
+ webhookTimestamp: "2023-09-17T11:01:08.807Z"
277
+ };
278
+
279
+ // src/payload-examples/CycleUpdated.json
280
+ var CycleUpdated_default = {
281
+ data: {
282
+ id: "fe7092dd-8a68-4a07-9477-b7c0a6f2136d",
283
+ endsAt: "2023-11-13T00:00:00.000Z",
284
+ number: 2,
285
+ teamId: "0d9e46fb-bf4a-4d7b-9bb0-d5928d8b1c9f",
286
+ startsAt: "2023-10-15T23:00:00.000Z",
287
+ createdAt: "2023-09-17T11:00:19.616Z",
288
+ updatedAt: "2023-09-17T11:00:47.427Z",
289
+ scopeHistory: [],
290
+ issueCountHistory: [],
291
+ completedScopeHistory: [],
292
+ inProgressScopeHistory: [],
293
+ completedIssueCountHistory: [],
294
+ uncompletedIssuesUponCloseIds: []
295
+ },
296
+ type: "Cycle",
297
+ action: "update",
298
+ createdAt: "2023-09-17T11:00:47.427Z",
299
+ webhookId: "d617c08b-47b6-4b09-a611-2e2f6d8fb99f",
300
+ updatedFrom: {
301
+ endsAt: "2023-11-12T23:00:00.000Z",
302
+ updatedAt: "2023-09-17T11:00:47.414Z"
303
+ },
304
+ organizationId: "7c0221e0-76d2-45eb-b803-6163c046c534",
305
+ webhookTimestamp: "2023-09-17T11:00:47.463Z"
306
+ };
307
+
308
+ // src/payload-examples/IssueCreated.json
309
+ var IssueCreated_default = {
310
+ url: "https://linear.app/triggerdotdev/issue/TRI-10/you-know-the-rules",
311
+ data: {
312
+ id: "4ceeeecb-3442-4972-b27a-4ac7198d4eac",
313
+ team: {
314
+ id: "0d9e46fb-bf4a-4d7b-9bb0-d5928d8b1c9f",
315
+ key: "TRI",
316
+ name: "Trigger.dev"
317
+ },
318
+ state: {
319
+ id: "6b6fd762-cc10-4da8-9775-dfc0784d2a3b",
320
+ name: "Backlog",
321
+ type: "backlog",
322
+ color: "#bec2c8"
323
+ },
324
+ title: "You know the rules",
325
+ labels: [],
326
+ number: 10,
327
+ teamId: "0d9e46fb-bf4a-4d7b-9bb0-d5928d8b1c9f",
328
+ stateId: "6b6fd762-cc10-4da8-9775-dfc0784d2a3b",
329
+ labelIds: [],
330
+ priority: 0,
331
+ createdAt: "2023-09-17T11:02:48.688Z",
332
+ creatorId: "b552c442-62c9-40da-9932-ed8cb6e15a3f",
333
+ sortOrder: -81,
334
+ updatedAt: "2023-09-17T11:02:48.688Z",
335
+ boardOrder: 0,
336
+ description: "And so do I",
337
+ priorityLabel: "No priority",
338
+ subscriberIds: [
339
+ "b552c442-62c9-40da-9932-ed8cb6e15a3f"
340
+ ],
341
+ previousIdentifiers: []
342
+ },
343
+ type: "Issue",
344
+ action: "create",
345
+ createdAt: "2023-09-17T11:02:48.688Z",
346
+ webhookId: "d617c08b-47b6-4b09-a611-2e2f6d8fb99f",
347
+ organizationId: "7c0221e0-76d2-45eb-b803-6163c046c534",
348
+ webhookTimestamp: "2023-09-17T11:02:48.800Z"
349
+ };
350
+
351
+ // src/payload-examples/IssueRemoved.json
352
+ var IssueRemoved_default = {
353
+ data: {
354
+ id: "4ceeeecb-3442-4972-b27a-4ac7198d4eac",
355
+ team: {
356
+ id: "0d9e46fb-bf4a-4d7b-9bb0-d5928d8b1c9f",
357
+ key: "TRI",
358
+ name: "Trigger.dev"
359
+ },
360
+ state: {
361
+ id: "6b6fd762-cc10-4da8-9775-dfc0784d2a3b",
362
+ name: "Backlog",
363
+ type: "backlog",
364
+ color: "#bec2c8"
365
+ },
366
+ title: "You know the rules",
367
+ labels: [],
368
+ number: 10,
369
+ teamId: "0d9e46fb-bf4a-4d7b-9bb0-d5928d8b1c9f",
370
+ stateId: "6b6fd762-cc10-4da8-9775-dfc0784d2a3b",
371
+ trashed: true,
372
+ labelIds: [],
373
+ priority: 0,
374
+ createdAt: "2023-09-17T11:02:48.688Z",
375
+ creatorId: "b552c442-62c9-40da-9932-ed8cb6e15a3f",
376
+ sortOrder: -81,
377
+ updatedAt: "2023-09-17T11:02:48.689Z",
378
+ archivedAt: "2023-09-17T11:02:58.487Z",
379
+ boardOrder: 0,
380
+ description: "And so do I",
381
+ priorityLabel: "No priority",
382
+ subscriberIds: [
383
+ "b552c442-62c9-40da-9932-ed8cb6e15a3f"
384
+ ],
385
+ previousIdentifiers: []
386
+ },
387
+ type: "Issue",
388
+ action: "remove",
389
+ createdAt: "2023-09-17T11:02:58.487Z",
390
+ webhookId: "d617c08b-47b6-4b09-a611-2e2f6d8fb99f",
391
+ organizationId: "7c0221e0-76d2-45eb-b803-6163c046c534",
392
+ webhookTimestamp: "2023-09-17T11:02:58.564Z"
393
+ };
394
+
395
+ // src/payload-examples/IssueUpdated.json
396
+ var IssueUpdated_default = {
397
+ url: "https://linear.app/triggerdotdev/issue/TRI-1/welcome-to-ricks-world-\u{1F44B}",
398
+ data: {
399
+ id: "ee4d5612-0752-441a-95cd-2a0de56689d3",
400
+ team: {
401
+ id: "0d9e46fb-bf4a-4d7b-9bb0-d5928d8b1c9f",
402
+ key: "TRI",
403
+ name: "Trigger.dev"
404
+ },
405
+ state: {
406
+ id: "8b77cd9c-f0cc-4be0-bd9b-52326d5c62a2",
407
+ name: "Todo",
408
+ type: "unstarted",
409
+ color: "#e2e2e2"
410
+ },
411
+ title: "Welcome to Rick's World \u2764\uFE0F\u200D\u{1F525}",
412
+ labels: [],
413
+ number: 1,
414
+ teamId: "0d9e46fb-bf4a-4d7b-9bb0-d5928d8b1c9f",
415
+ stateId: "8b77cd9c-f0cc-4be0-bd9b-52326d5c62a2",
416
+ labelIds: [],
417
+ priority: 2,
418
+ createdAt: "2023-09-17T10:43:20.862Z",
419
+ sortOrder: -13701.52,
420
+ updatedAt: "2023-09-17T10:52:49.321Z",
421
+ boardOrder: 0,
422
+ description: "Hi there. Complete these issues to learn how to use Linear and discover \u2728**ProTips.** When you're done, delete them or move them to another team for others to view.\n\n### **To start, type** `C` to **create your first issue.**\n\nCreate issues from any view using `C` or by clicking the `New issue` button.\n\n \n\n[1189b618-97f2-4e2c-ae25-4f25467679e7](https://uploads.linear.app/fe63b3e2-bf87-46c0-8784-cd7d639287c8/532d146d-bcd6-4602-bf1f-83f674b70fff/1189b618-97f2-4e2c-ae25-4f25467679e7)\n\nOur issue editor and comments support Markdown. You can also: \n\n* @mention a teammate\n* Drag & drop images or video (Loom & Youtube embed automatically)\n* Use emoji \u2705",
423
+ priorityLabel: "High",
424
+ subscriberIds: [],
425
+ previousIdentifiers: []
426
+ },
427
+ type: "Issue",
428
+ action: "update",
429
+ createdAt: "2023-09-17T10:52:49.321Z",
430
+ webhookId: "d617c08b-47b6-4b09-a611-2e2f6d8fb99f",
431
+ updatedFrom: {
432
+ title: "Welcome to Linear \u{1F44B}",
433
+ updatedAt: "2023-09-17T10:52:16.952Z"
434
+ },
435
+ organizationId: "7c0221e0-76d2-45eb-b803-6163c046c534",
436
+ webhookTimestamp: "2023-09-17T10:52:49.762Z"
437
+ };
438
+
439
+ // src/payload-examples/IssueLabelCreated.json
440
+ var IssueLabelCreated_default = {
441
+ data: {
442
+ id: "ef8d9e0d-7286-460f-b398-7aaf7d182c16",
443
+ name: "Give You Up",
444
+ color: "#26b5ce",
445
+ createdAt: "2023-09-17T11:08:22.426Z",
446
+ creatorId: "b552c442-62c9-40da-9932-ed8cb6e15a3f",
447
+ updatedAt: "2023-09-17T11:08:22.426Z",
448
+ organizationId: "7c0221e0-76d2-45eb-b803-6163c046c534"
449
+ },
450
+ type: "IssueLabel",
451
+ action: "create",
452
+ createdAt: "2023-09-17T11:08:22.426Z",
453
+ webhookId: "d617c08b-47b6-4b09-a611-2e2f6d8fb99f",
454
+ organizationId: "7c0221e0-76d2-45eb-b803-6163c046c534",
455
+ webhookTimestamp: "2023-09-17T11:08:22.463Z"
456
+ };
457
+
458
+ // src/payload-examples/IssueLabelRemoved.json
459
+ var IssueLabelRemoved_default = {
460
+ data: {
461
+ id: "ef8d9e0d-7286-460f-b398-7aaf7d182c16",
462
+ name: "Let You Down",
463
+ color: "#f2994a",
464
+ createdAt: "2023-09-17T11:08:22.426Z",
465
+ creatorId: "b552c442-62c9-40da-9932-ed8cb6e15a3f",
466
+ updatedAt: "2023-09-17T11:08:31.484Z",
467
+ organizationId: "7c0221e0-76d2-45eb-b803-6163c046c534"
468
+ },
469
+ type: "IssueLabel",
470
+ action: "remove",
471
+ createdAt: "2023-09-17T11:08:35.517Z",
472
+ webhookId: "d617c08b-47b6-4b09-a611-2e2f6d8fb99f",
473
+ organizationId: "7c0221e0-76d2-45eb-b803-6163c046c534",
474
+ webhookTimestamp: "2023-09-17T11:08:35.556Z"
475
+ };
476
+
477
+ // src/payload-examples/IssueLabelUpdated.json
478
+ var IssueLabelUpdated_default = {
479
+ data: {
480
+ id: "ef8d9e0d-7286-460f-b398-7aaf7d182c16",
481
+ name: "Let You Down",
482
+ color: "#f2994a",
483
+ createdAt: "2023-09-17T11:08:22.426Z",
484
+ creatorId: "b552c442-62c9-40da-9932-ed8cb6e15a3f",
485
+ updatedAt: "2023-09-17T11:08:31.484Z",
486
+ organizationId: "7c0221e0-76d2-45eb-b803-6163c046c534"
487
+ },
488
+ type: "IssueLabel",
489
+ action: "update",
490
+ createdAt: "2023-09-17T11:08:31.484Z",
491
+ webhookId: "d617c08b-47b6-4b09-a611-2e2f6d8fb99f",
492
+ updatedFrom: {
493
+ name: "Give You Up",
494
+ color: "#26b5ce",
495
+ updatedAt: "2023-09-17T11:08:22.426Z"
496
+ },
497
+ organizationId: "7c0221e0-76d2-45eb-b803-6163c046c534",
498
+ webhookTimestamp: "2023-09-17T11:08:31.527Z"
499
+ };
500
+
501
+ // src/payload-examples/ProjectCreated.json
502
+ var ProjectCreated_default = {
503
+ url: "https://linear.app/triggerdotdev/project/ricks-world-1e55e5e64512",
504
+ data: {
505
+ id: "708440e6-648c-40f9-be87-9e00bbd8d1ec",
506
+ name: "Rick's World",
507
+ color: "#bec2c8",
508
+ state: "backlog",
509
+ leadId: "b552c442-62c9-40da-9932-ed8cb6e15a3f",
510
+ slugId: "1e55e5e64512",
511
+ teamIds: [
512
+ "0d9e46fb-bf4a-4d7b-9bb0-d5928d8b1c9f"
513
+ ],
514
+ roadmaps: [],
515
+ createdAt: "2023-09-17T11:24:43.171Z",
516
+ creatorId: "b552c442-62c9-40da-9932-ed8cb6e15a3f",
517
+ memberIds: [
518
+ "b552c442-62c9-40da-9932-ed8cb6e15a3f"
519
+ ],
520
+ sortOrder: 8161.55,
521
+ updatedAt: "2023-09-17T11:24:43.171Z",
522
+ milestones: [],
523
+ description: "We know the game and we're gonna play it",
524
+ scopeHistory: [],
525
+ slackNewIssue: true,
526
+ issueCountHistory: [],
527
+ slackIssueComments: true,
528
+ slackIssueStatuses: true,
529
+ completedScopeHistory: [],
530
+ inProgressScopeHistory: [],
531
+ completedIssueCountHistory: []
532
+ },
533
+ type: "Project",
534
+ action: "create",
535
+ createdAt: "2023-09-17T11:24:43.171Z",
536
+ webhookId: "d617c08b-47b6-4b09-a611-2e2f6d8fb99f",
537
+ organizationId: "7c0221e0-76d2-45eb-b803-6163c046c534",
538
+ webhookTimestamp: "2023-09-17T11:24:43.228Z"
539
+ };
540
+
541
+ // src/payload-examples/ProjectRemoved.json
542
+ var ProjectRemoved_default = {
543
+ data: {
544
+ id: "708440e6-648c-40f9-be87-9e00bbd8d1ec",
545
+ name: "Rick's World",
546
+ color: "#bec2c8",
547
+ state: "backlog",
548
+ leadId: "b552c442-62c9-40da-9932-ed8cb6e15a3f",
549
+ slugId: "1e55e5e64512",
550
+ teamIds: [
551
+ "0d9e46fb-bf4a-4d7b-9bb0-d5928d8b1c9f"
552
+ ],
553
+ trashed: true,
554
+ roadmaps: [],
555
+ createdAt: "2023-09-17T11:24:43.171Z",
556
+ creatorId: "b552c442-62c9-40da-9932-ed8cb6e15a3f",
557
+ memberIds: [
558
+ "b552c442-62c9-40da-9932-ed8cb6e15a3f"
559
+ ],
560
+ sortOrder: 8161.55,
561
+ updatedAt: "2023-09-17T11:25:09.384Z",
562
+ archivedAt: "2023-09-17T11:25:16.188Z",
563
+ milestones: [],
564
+ targetDate: "2024-02-14T00:00:00.000Z",
565
+ description: "We know the game and we're gonna play it",
566
+ scopeHistory: [],
567
+ slackNewIssue: true,
568
+ issueCountHistory: [],
569
+ slackIssueComments: true,
570
+ slackIssueStatuses: true,
571
+ completedScopeHistory: [],
572
+ inProgressScopeHistory: [],
573
+ completedIssueCountHistory: []
574
+ },
575
+ type: "Project",
576
+ action: "remove",
577
+ createdAt: "2023-09-17T11:25:16.188Z",
578
+ webhookId: "d617c08b-47b6-4b09-a611-2e2f6d8fb99f",
579
+ organizationId: "7c0221e0-76d2-45eb-b803-6163c046c534",
580
+ webhookTimestamp: "2023-09-17T11:25:16.358Z"
581
+ };
582
+
583
+ // src/payload-examples/ProjectUpdated.json
584
+ var ProjectUpdated_default = {
585
+ url: "https://linear.app/triggerdotdev/project/ricks-world-1e55e5e64512",
586
+ data: {
587
+ id: "708440e6-648c-40f9-be87-9e00bbd8d1ec",
588
+ name: "Rick's World",
589
+ color: "#bec2c8",
590
+ state: "backlog",
591
+ leadId: "b552c442-62c9-40da-9932-ed8cb6e15a3f",
592
+ slugId: "1e55e5e64512",
593
+ teamIds: [
594
+ "0d9e46fb-bf4a-4d7b-9bb0-d5928d8b1c9f"
595
+ ],
596
+ roadmaps: [],
597
+ createdAt: "2023-09-17T11:24:43.171Z",
598
+ creatorId: "b552c442-62c9-40da-9932-ed8cb6e15a3f",
599
+ memberIds: [
600
+ "b552c442-62c9-40da-9932-ed8cb6e15a3f"
601
+ ],
602
+ sortOrder: 8161.55,
603
+ updatedAt: "2023-09-17T11:25:09.383Z",
604
+ milestones: [],
605
+ targetDate: "2024-02-14T00:00:00.000Z",
606
+ description: "We know the game and we're gonna play it",
607
+ scopeHistory: [],
608
+ slackNewIssue: true,
609
+ issueCountHistory: [],
610
+ slackIssueComments: true,
611
+ slackIssueStatuses: true,
612
+ completedScopeHistory: [],
613
+ inProgressScopeHistory: [],
614
+ completedIssueCountHistory: []
615
+ },
616
+ type: "Project",
617
+ action: "update",
618
+ createdAt: "2023-09-17T11:25:09.383Z",
619
+ webhookId: "d617c08b-47b6-4b09-a611-2e2f6d8fb99f",
620
+ updatedFrom: {
621
+ updatedAt: "2023-09-17T11:24:43.171Z",
622
+ targetDate: null
623
+ },
624
+ organizationId: "7c0221e0-76d2-45eb-b803-6163c046c534",
625
+ webhookTimestamp: "2023-09-17T11:25:09.419Z"
626
+ };
627
+
628
+ // src/payload-examples/ProjectUpdateCreated.json
629
+ var ProjectUpdateCreated_default = {
630
+ data: {
631
+ id: "e5b2ae4e-acb5-4c6c-a22a-56c883e353b4",
632
+ body: "We're no strangers to love",
633
+ user: {
634
+ id: "b552c442-62c9-40da-9932-ed8cb6e15a3f",
635
+ name: "Rick Astley"
636
+ },
637
+ health: "onTrack",
638
+ userId: "b552c442-62c9-40da-9932-ed8cb6e15a3f",
639
+ project: {
640
+ id: "54dac280-389f-4339-8d5d-de347a56eb79",
641
+ name: "Rick's World"
642
+ },
643
+ roadmaps: [],
644
+ createdAt: "2023-09-17T11:28:23.406Z",
645
+ projectId: "54dac280-389f-4339-8d5d-de347a56eb79",
646
+ updatedAt: "2023-09-17T11:28:23.406Z",
647
+ infoSnapshot: {
648
+ state: "backlog",
649
+ leadId: "b552c442-62c9-40da-9932-ed8cb6e15a3f",
650
+ memberIds: [
651
+ "b552c442-62c9-40da-9932-ed8cb6e15a3f"
652
+ ],
653
+ teamsInfo: [
654
+ {
655
+ id: "0d9e46fb-bf4a-4d7b-9bb0-d5928d8b1c9f",
656
+ issueInfo: {
657
+ triageCount: 0,
658
+ backlogCount: 0,
659
+ startedCount: 0,
660
+ canceledCount: 0,
661
+ completedCount: 0,
662
+ unstartedCount: 0
663
+ }
664
+ }
665
+ ],
666
+ milestonesInfo: []
667
+ }
668
+ },
669
+ type: "ProjectUpdate",
670
+ action: "create",
671
+ createdAt: "2023-09-17T11:28:23.406Z",
672
+ webhookId: "d617c08b-47b6-4b09-a611-2e2f6d8fb99f",
673
+ organizationId: "7c0221e0-76d2-45eb-b803-6163c046c534",
674
+ webhookTimestamp: "2023-09-17T11:28:23.479Z"
675
+ };
676
+
677
+ // src/payload-examples/ProjectUpdateRemoved.json
678
+ var ProjectUpdateRemoved_default = {
679
+ data: {
680
+ id: "e5b2ae4e-acb5-4c6c-a22a-56c883e353b4",
681
+ body: "You know the rules and so do I",
682
+ user: {
683
+ id: "b552c442-62c9-40da-9932-ed8cb6e15a3f",
684
+ name: "Rick Astley"
685
+ },
686
+ health: "onTrack",
687
+ userId: "b552c442-62c9-40da-9932-ed8cb6e15a3f",
688
+ project: {
689
+ id: "54dac280-389f-4339-8d5d-de347a56eb79",
690
+ name: "Rick's World"
691
+ },
692
+ editedAt: "2023-09-17T11:28:39.142Z",
693
+ roadmaps: [],
694
+ createdAt: "2023-09-17T11:28:23.406Z",
695
+ projectId: "54dac280-389f-4339-8d5d-de347a56eb79",
696
+ updatedAt: "2023-09-17T11:28:39.142Z",
697
+ infoSnapshot: {
698
+ state: "backlog",
699
+ leadId: "b552c442-62c9-40da-9932-ed8cb6e15a3f",
700
+ memberIds: [
701
+ "b552c442-62c9-40da-9932-ed8cb6e15a3f"
702
+ ],
703
+ teamsInfo: [
704
+ {
705
+ id: "0d9e46fb-bf4a-4d7b-9bb0-d5928d8b1c9f",
706
+ issueInfo: {
707
+ triageCount: 0,
708
+ backlogCount: 0,
709
+ startedCount: 0,
710
+ canceledCount: 0,
711
+ completedCount: 0,
712
+ unstartedCount: 0
713
+ }
714
+ }
715
+ ],
716
+ milestonesInfo: []
717
+ }
718
+ },
719
+ type: "ProjectUpdate",
720
+ action: "remove",
721
+ createdAt: "2023-09-17T11:28:45.146Z",
722
+ webhookId: "d617c08b-47b6-4b09-a611-2e2f6d8fb99f",
723
+ organizationId: "7c0221e0-76d2-45eb-b803-6163c046c534",
724
+ webhookTimestamp: "2023-09-17T11:28:45.213Z"
725
+ };
726
+
727
+ // src/payload-examples/ProjectUpdateUpdated.json
728
+ var ProjectUpdateUpdated_default = {
729
+ data: {
730
+ id: "e5b2ae4e-acb5-4c6c-a22a-56c883e353b4",
731
+ body: "You know the rules and so do I",
732
+ user: {
733
+ id: "b552c442-62c9-40da-9932-ed8cb6e15a3f",
734
+ name: "Rick Astley"
735
+ },
736
+ health: "onTrack",
737
+ userId: "b552c442-62c9-40da-9932-ed8cb6e15a3f",
738
+ project: {
739
+ id: "54dac280-389f-4339-8d5d-de347a56eb79",
740
+ name: "Rick's World"
741
+ },
742
+ editedAt: "2023-09-17T11:28:39.142Z",
743
+ roadmaps: [],
744
+ createdAt: "2023-09-17T11:28:23.406Z",
745
+ projectId: "54dac280-389f-4339-8d5d-de347a56eb79",
746
+ updatedAt: "2023-09-17T11:28:39.142Z",
747
+ infoSnapshot: {
748
+ state: "backlog",
749
+ leadId: "b552c442-62c9-40da-9932-ed8cb6e15a3f",
750
+ memberIds: [
751
+ "b552c442-62c9-40da-9932-ed8cb6e15a3f"
752
+ ],
753
+ teamsInfo: [
754
+ {
755
+ id: "0d9e46fb-bf4a-4d7b-9bb0-d5928d8b1c9f",
756
+ issueInfo: {
757
+ triageCount: 0,
758
+ backlogCount: 0,
759
+ startedCount: 0,
760
+ canceledCount: 0,
761
+ completedCount: 0,
762
+ unstartedCount: 0
763
+ }
764
+ }
765
+ ],
766
+ milestonesInfo: []
767
+ }
768
+ },
769
+ type: "ProjectUpdate",
770
+ action: "update",
771
+ createdAt: "2023-09-17T11:28:39.142Z",
772
+ webhookId: "d617c08b-47b6-4b09-a611-2e2f6d8fb99f",
773
+ updatedFrom: {
774
+ body: "We're no strangers to love",
775
+ editedAt: null,
776
+ updatedAt: "2023-09-17T11:28:23.406Z"
777
+ },
778
+ organizationId: "7c0221e0-76d2-45eb-b803-6163c046c534",
779
+ webhookTimestamp: "2023-09-17T11:28:39.181Z"
780
+ };
781
+
782
+ // src/payload-examples/ReactionCreated.json
783
+ var ReactionCreated_default = {
784
+ data: {
785
+ id: "a22b3a1f-109f-427f-aa59-78b4ab1d2944",
786
+ user: {
787
+ id: "b552c442-62c9-40da-9932-ed8cb6e15a3f",
788
+ name: "Rick Astley"
789
+ },
790
+ emoji: "heart",
791
+ userId: "b552c442-62c9-40da-9932-ed8cb6e15a3f",
792
+ comment: {
793
+ id: "3f44c353-a3a1-45a4-b5da-259818ae21dd",
794
+ body: "Never gonna!",
795
+ userId: "b552c442-62c9-40da-9932-ed8cb6e15a3f"
796
+ },
797
+ createdAt: "2023-09-17T11:31:27.394Z",
798
+ updatedAt: "2023-09-17T11:31:27.394Z"
799
+ },
800
+ type: "Reaction",
801
+ action: "create",
802
+ createdAt: "2023-09-17T11:31:27.394Z",
803
+ webhookId: "d617c08b-47b6-4b09-a611-2e2f6d8fb99f",
804
+ organizationId: "7c0221e0-76d2-45eb-b803-6163c046c534",
805
+ webhookTimestamp: "2023-09-17T11:31:27.477Z"
806
+ };
807
+
808
+ // src/payload-examples/ReactionRemoved.json
809
+ var ReactionRemoved_default = {
810
+ data: {
811
+ id: "a22b3a1f-109f-427f-aa59-78b4ab1d2944",
812
+ user: {
813
+ id: "b552c442-62c9-40da-9932-ed8cb6e15a3f",
814
+ name: "Rick Astley"
815
+ },
816
+ emoji: "heart",
817
+ userId: "b552c442-62c9-40da-9932-ed8cb6e15a3f",
818
+ comment: {
819
+ id: "3f44c353-a3a1-45a4-b5da-259818ae21dd",
820
+ body: "Never gonna!",
821
+ userId: "b552c442-62c9-40da-9932-ed8cb6e15a3f"
822
+ },
823
+ createdAt: "2023-09-17T11:31:27.394Z",
824
+ updatedAt: "2023-09-17T11:31:27.394Z"
825
+ },
826
+ type: "Reaction",
827
+ action: "remove",
828
+ createdAt: "2023-09-17T11:32:07.003Z",
829
+ webhookId: "d617c08b-47b6-4b09-a611-2e2f6d8fb99f",
830
+ organizationId: "7c0221e0-76d2-45eb-b803-6163c046c534",
831
+ webhookTimestamp: "2023-09-17T11:32:07.088Z"
832
+ };
833
+
834
+ // src/payload-examples/ReactionUpdated.json
835
+ var ReactionUpdated_default = {
836
+ data: {
837
+ id: "a22b3a1f-109f-427f-aa59-78b4ab1d2944",
838
+ user: {
839
+ id: "b552c442-62c9-40da-9932-ed8cb6e15a3f",
840
+ name: "Rick Astley"
841
+ },
842
+ emoji: "heart_on_fire",
843
+ userId: "b552c442-62c9-40da-9932-ed8cb6e15a3f",
844
+ comment: {
845
+ id: "3f44c353-a3a1-45a4-b5da-259818ae21dd",
846
+ body: "Never gonna!",
847
+ userId: "b552c442-62c9-40da-9932-ed8cb6e15a3f"
848
+ },
849
+ createdAt: "2023-09-17T12:31:27.394Z",
850
+ updatedAt: "2023-09-17T12:32:14.394Z"
851
+ },
852
+ type: "Reaction",
853
+ action: "update",
854
+ createdAt: "2023-09-17T12:31:27.394Z",
855
+ webhookId: "d617c08b-47b6-4b09-a611-2e2f6d8fb99f",
856
+ updatedFrom: {
857
+ emoji: "heart",
858
+ updatedAt: "2023-09-17T12:31:27.394Z"
859
+ },
860
+ organizationId: "7c0221e0-76d2-45eb-b803-6163c046c534",
861
+ webhookTimestamp: "2023-09-17T12:31:27.477Z"
862
+ };
863
+
864
+ // src/payload-examples/index.ts
865
+ var attachmentCreated = {
866
+ id: "AttachmentCreated",
867
+ name: "Attachment created",
868
+ payload: AttachmentCreated_default
869
+ };
870
+ var attachmentRemoved = {
871
+ id: "AttachmentRemoved",
872
+ name: "Attachment removed",
873
+ payload: AttachmentRemoved_default
874
+ };
875
+ var attachmentUpdated = {
876
+ id: "AttachmentUpdated",
877
+ name: "Attachment updated",
878
+ payload: AttachmentUpdated_default
879
+ };
880
+ var commentCreated = {
881
+ id: "CommentCreated",
882
+ name: "Comment created",
883
+ payload: CommentCreated_default
884
+ };
885
+ var commentRemoved = {
886
+ id: "CommentRemoved",
887
+ name: "Comment removed",
888
+ payload: CommentRemoved_default
889
+ };
890
+ var commentUpdated = {
891
+ id: "CommentUpdated",
892
+ name: "Comment updated",
893
+ payload: CommentUpdated_default
894
+ };
895
+ var cycleCreated = {
896
+ id: "CycleCreated",
897
+ name: "Cycle created",
898
+ payload: CycleCreated_default
899
+ };
900
+ var cycleRemoved = {
901
+ id: "CycleRemoved",
902
+ name: "Cycle removed",
903
+ payload: CycleRemoved_default
904
+ };
905
+ var cycleUpdated = {
906
+ id: "CycleUpdated",
907
+ name: "Cycle updated",
908
+ payload: CycleUpdated_default
909
+ };
910
+ var issueCreated = {
911
+ id: "IssueCreated",
912
+ name: "Issue created",
913
+ payload: IssueCreated_default
914
+ };
915
+ var issueRemoved = {
916
+ id: "IssueRemoved",
917
+ name: "Issue removed",
918
+ payload: IssueRemoved_default
919
+ };
920
+ var issueUpdated = {
921
+ id: "IssueUpdated",
922
+ name: "Issue updated",
923
+ payload: IssueUpdated_default
924
+ };
925
+ var issueLabelCreated = {
926
+ id: "IssueLabelCreated",
927
+ name: "IssueLabel created",
928
+ payload: IssueLabelCreated_default
929
+ };
930
+ var issueLabelRemoved = {
931
+ id: "IssueLabelRemoved",
932
+ name: "IssueLabel removed",
933
+ payload: IssueLabelRemoved_default
934
+ };
935
+ var issueLabelUpdated = {
936
+ id: "IssueLabelUpdated",
937
+ name: "IssueLabel updated",
938
+ payload: IssueLabelUpdated_default
939
+ };
940
+ var projectCreated = {
941
+ id: "ProjectCreated",
942
+ name: "Project created",
943
+ payload: ProjectCreated_default
944
+ };
945
+ var projectRemoved = {
946
+ id: "ProjectRemoved",
947
+ name: "Project removed",
948
+ payload: ProjectRemoved_default
949
+ };
950
+ var projectUpdated = {
951
+ id: "ProjectUpdated",
952
+ name: "Project updated",
953
+ payload: ProjectUpdated_default
954
+ };
955
+ var projectUpdateCreated = {
956
+ id: "ProjectUpdateCreated",
957
+ name: "ProjectUpdate created",
958
+ payload: ProjectUpdateCreated_default
959
+ };
960
+ var projectUpdateRemoved = {
961
+ id: "ProjectUpdateRemoved",
962
+ name: "ProjectUpdate removed",
963
+ payload: ProjectUpdateRemoved_default
964
+ };
965
+ var projectUpdateUpdated = {
966
+ id: "ProjectUpdateUpdated",
967
+ name: "ProjectUpdate updated",
968
+ payload: ProjectUpdateUpdated_default
969
+ };
970
+ var reactionCreated = {
971
+ id: "ReactionCreated",
972
+ name: "Reaction created",
973
+ payload: ReactionCreated_default
974
+ };
975
+ var reactionRemoved = {
976
+ id: "ReactionRemoved",
977
+ name: "Reaction removed",
978
+ payload: ReactionRemoved_default
979
+ };
980
+ var reactionUpdated = {
981
+ id: "ReactionUpdated",
982
+ name: "Reaction updated",
983
+ payload: ReactionUpdated_default
984
+ };
985
+
986
+ // src/utils.ts
987
+ var onCommentProperties = /* @__PURE__ */ __name((payload) => {
988
+ return [
989
+ {
990
+ label: "Comment ID",
991
+ text: payload.data.id
992
+ },
993
+ {
994
+ label: "Issue ID",
995
+ text: payload.data.issueId
996
+ },
997
+ {
998
+ label: "Issue Title",
999
+ text: payload.data.issue.title,
1000
+ url: payload.url ?? void 0
1001
+ }
1002
+ ];
1003
+ }, "onCommentProperties");
1004
+ var onIssueProperties = /* @__PURE__ */ __name((payload) => {
1005
+ return [
1006
+ {
1007
+ label: "Issue ID",
1008
+ text: payload.data.id
1009
+ },
1010
+ {
1011
+ label: "Issue",
1012
+ text: `[${payload.data.team.key}-${payload.data.number}] ${payload.data.title}`,
1013
+ url: payload.url ?? void 0
1014
+ }
1015
+ ];
1016
+ }, "onIssueProperties");
1017
+ var queryProperties = /* @__PURE__ */ __name((query) => {
1018
+ return [
1019
+ ...query.after ? [
1020
+ {
1021
+ label: "After",
1022
+ text: query.after
1023
+ }
1024
+ ] : [],
1025
+ ...query.before ? [
1026
+ {
1027
+ label: "Before",
1028
+ text: query.before
1029
+ }
1030
+ ] : [],
1031
+ ...query.first ? [
1032
+ {
1033
+ label: "First",
1034
+ text: String(query.first)
1035
+ }
1036
+ ] : [],
1037
+ ...query.last ? [
1038
+ {
1039
+ label: "Last",
1040
+ text: String(query.last)
1041
+ }
1042
+ ] : [],
1043
+ ...query.orderBy ? [
1044
+ {
1045
+ label: "Order by",
1046
+ text: query.orderBy
1047
+ }
1048
+ ] : [],
1049
+ ...query.includeArchived ? [
1050
+ {
1051
+ label: "Include archived",
1052
+ text: String(query.includeArchived)
1053
+ }
1054
+ ] : []
1055
+ ];
1056
+ }, "queryProperties");
1057
+ var updatedFromProperties = /* @__PURE__ */ __name((payload) => {
1058
+ if (payload.action !== "update")
1059
+ return [];
1060
+ return [
1061
+ {
1062
+ label: "Updated Keys",
1063
+ text: Object.keys(payload.updatedFrom).filter((key) => ![
1064
+ "editedAt",
1065
+ "updatedAt"
1066
+ ].includes(key)).join(", ")
1067
+ }
1068
+ ];
1069
+ }, "updatedFromProperties");
1070
+
1071
+ // src/events.ts
1072
+ var onAttachment = {
1073
+ name: "Attachment",
1074
+ title: "On Attachment",
1075
+ source: "linear.app",
1076
+ icon: "linear",
1077
+ examples: [
1078
+ attachmentCreated,
1079
+ attachmentRemoved,
1080
+ attachmentUpdated
1081
+ ],
1082
+ parsePayload: (payload) => payload,
1083
+ runProperties: (payload) => [
1084
+ {
1085
+ label: "Event action",
1086
+ text: payload.action
1087
+ },
1088
+ {
1089
+ label: "Attachment ID",
1090
+ text: payload.data.id
1091
+ }
1092
+ ]
1093
+ };
1094
+ var onAttachmentCreated = {
1095
+ name: "Attachment",
1096
+ title: "On Attachment Created",
1097
+ source: "linear.app",
1098
+ icon: "linear",
1099
+ filter: {
1100
+ action: [
1101
+ "create"
1102
+ ]
1103
+ },
1104
+ examples: [
1105
+ attachmentCreated
1106
+ ],
1107
+ parsePayload: (payload) => payload,
1108
+ runProperties: (payload) => [
1109
+ {
1110
+ label: "Attachment ID",
1111
+ text: payload.data.id
1112
+ }
1113
+ ]
1114
+ };
1115
+ var onAttachmentRemoved = {
1116
+ name: "Attachment",
1117
+ title: "On Attachment Removed",
1118
+ source: "linear.app",
1119
+ icon: "linear",
1120
+ filter: {
1121
+ action: [
1122
+ "remove"
1123
+ ]
1124
+ },
1125
+ examples: [
1126
+ attachmentRemoved
1127
+ ],
1128
+ parsePayload: (payload) => payload,
1129
+ runProperties: (payload) => [
1130
+ {
1131
+ label: "Attachment ID",
1132
+ text: payload.data.id
1133
+ }
1134
+ ]
1135
+ };
1136
+ var onAttachmentUpdated = {
1137
+ name: "Attachment",
1138
+ title: "On Attachment Updated",
1139
+ source: "linear.app",
1140
+ icon: "linear",
1141
+ filter: {
1142
+ action: [
1143
+ "update"
1144
+ ]
1145
+ },
1146
+ examples: [
1147
+ attachmentUpdated
1148
+ ],
1149
+ parsePayload: (payload) => payload,
1150
+ runProperties: (payload) => [
1151
+ {
1152
+ label: "Attachment ID",
1153
+ text: payload.data.id
1154
+ }
1155
+ ]
1156
+ };
1157
+ var onComment = {
1158
+ name: "Comment",
1159
+ title: "On Comment",
1160
+ source: "linear.app",
1161
+ icon: "linear",
1162
+ examples: [
1163
+ commentCreated,
1164
+ commentRemoved,
1165
+ commentUpdated
1166
+ ],
1167
+ parsePayload: (payload) => payload,
1168
+ runProperties: (payload) => [
1169
+ {
1170
+ label: "Event action",
1171
+ text: payload.action
1172
+ },
1173
+ ...onCommentProperties(payload),
1174
+ ...updatedFromProperties(payload)
1175
+ ]
1176
+ };
1177
+ var onCommentCreated = {
1178
+ name: "Comment",
1179
+ title: "On Comment Created",
1180
+ source: "linear.app",
1181
+ icon: "linear",
1182
+ filter: {
1183
+ action: [
1184
+ "create"
1185
+ ]
1186
+ },
1187
+ examples: [
1188
+ commentCreated
1189
+ ],
1190
+ parsePayload: (payload) => payload,
1191
+ runProperties: (payload) => onCommentProperties(payload)
1192
+ };
1193
+ var onCommentRemoved = {
1194
+ name: "Comment",
1195
+ title: "On Comment Removed",
1196
+ source: "linear.app",
1197
+ icon: "linear",
1198
+ filter: {
1199
+ action: [
1200
+ "remove"
1201
+ ]
1202
+ },
1203
+ examples: [
1204
+ commentRemoved
1205
+ ],
1206
+ parsePayload: (payload) => payload,
1207
+ runProperties: (payload) => onCommentProperties(payload)
1208
+ };
1209
+ var onCommentUpdated = {
1210
+ name: "Comment",
1211
+ title: "On Comment Updated",
1212
+ source: "linear.app",
1213
+ icon: "linear",
1214
+ filter: {
1215
+ action: [
1216
+ "update"
1217
+ ]
1218
+ },
1219
+ examples: [
1220
+ commentUpdated
1221
+ ],
1222
+ parsePayload: (payload) => payload,
1223
+ runProperties: (payload) => [
1224
+ ...onCommentProperties(payload),
1225
+ ...updatedFromProperties(payload)
1226
+ ]
1227
+ };
1228
+ var onCycle = {
1229
+ name: "Cycle",
1230
+ title: "On Cycle",
1231
+ source: "linear.app",
1232
+ icon: "linear",
1233
+ examples: [
1234
+ cycleCreated,
1235
+ cycleRemoved,
1236
+ cycleUpdated
1237
+ ],
1238
+ parsePayload: (payload) => payload,
1239
+ runProperties: (payload) => [
1240
+ {
1241
+ label: "Event action",
1242
+ text: payload.action
1243
+ },
1244
+ {
1245
+ label: "Cycle ID",
1246
+ text: payload.data.id
1247
+ }
1248
+ ]
1249
+ };
1250
+ var onCycleCreated = {
1251
+ name: "Cycle",
1252
+ title: "On Cycle Created",
1253
+ source: "linear.app",
1254
+ icon: "linear",
1255
+ filter: {
1256
+ action: [
1257
+ "create"
1258
+ ]
1259
+ },
1260
+ examples: [
1261
+ cycleCreated
1262
+ ],
1263
+ parsePayload: (payload) => payload,
1264
+ runProperties: (payload) => [
1265
+ {
1266
+ label: "Cycle ID",
1267
+ text: payload.data.id
1268
+ }
1269
+ ]
1270
+ };
1271
+ var onCycleRemoved = {
1272
+ name: "Cycle",
1273
+ title: "On Cycle Removed",
1274
+ source: "linear.app",
1275
+ icon: "linear",
1276
+ filter: {
1277
+ action: [
1278
+ "remove"
1279
+ ]
1280
+ },
1281
+ examples: [
1282
+ cycleRemoved
1283
+ ],
1284
+ parsePayload: (payload) => payload,
1285
+ runProperties: (payload) => [
1286
+ {
1287
+ label: "Cycle ID",
1288
+ text: payload.data.id
1289
+ }
1290
+ ]
1291
+ };
1292
+ var onCycleUpdated = {
1293
+ name: "Cycle",
1294
+ title: "On Cycle Updated",
1295
+ source: "linear.app",
1296
+ icon: "linear",
1297
+ filter: {
1298
+ action: [
1299
+ "update"
1300
+ ]
1301
+ },
1302
+ examples: [
1303
+ cycleUpdated
1304
+ ],
1305
+ parsePayload: (payload) => payload,
1306
+ runProperties: (payload) => [
1307
+ {
1308
+ label: "Cycle ID",
1309
+ text: payload.data.id
1310
+ }
1311
+ ]
1312
+ };
1313
+ var onIssue = {
1314
+ name: "Issue",
1315
+ title: "On Issue",
1316
+ source: "linear.app",
1317
+ icon: "linear",
1318
+ examples: [
1319
+ issueCreated,
1320
+ issueRemoved,
1321
+ issueUpdated
1322
+ ],
1323
+ parsePayload: (payload) => payload,
1324
+ runProperties: (payload) => [
1325
+ {
1326
+ label: "Event action",
1327
+ text: payload.action
1328
+ },
1329
+ ...onIssueProperties(payload),
1330
+ ...updatedFromProperties(payload)
1331
+ ]
1332
+ };
1333
+ var onIssueCreated = {
1334
+ name: "Issue",
1335
+ title: "On Issue Created",
1336
+ source: "linear.app",
1337
+ icon: "linear",
1338
+ filter: {
1339
+ action: [
1340
+ "create"
1341
+ ]
1342
+ },
1343
+ examples: [
1344
+ issueCreated
1345
+ ],
1346
+ parsePayload: (payload) => payload,
1347
+ runProperties: (payload) => onIssueProperties(payload)
1348
+ };
1349
+ var onIssueRemoved = {
1350
+ name: "Issue",
1351
+ title: "On Issue Removed",
1352
+ source: "linear.app",
1353
+ icon: "linear",
1354
+ filter: {
1355
+ action: [
1356
+ "remove"
1357
+ ]
1358
+ },
1359
+ examples: [
1360
+ issueRemoved
1361
+ ],
1362
+ parsePayload: (payload) => payload,
1363
+ runProperties: (payload) => onIssueProperties(payload)
1364
+ };
1365
+ var onIssueUpdated = {
1366
+ name: "Issue",
1367
+ title: "On Issue Updated",
1368
+ source: "linear.app",
1369
+ icon: "linear",
1370
+ filter: {
1371
+ action: [
1372
+ "update"
1373
+ ]
1374
+ },
1375
+ examples: [
1376
+ issueUpdated
1377
+ ],
1378
+ parsePayload: (payload) => payload,
1379
+ runProperties: (payload) => [
1380
+ ...onIssueProperties(payload),
1381
+ ...updatedFromProperties(payload)
1382
+ ]
1383
+ };
1384
+ var onIssueLabel = {
1385
+ name: "IssueLabel",
1386
+ title: "On IssueLabel",
1387
+ source: "linear.app",
1388
+ icon: "linear",
1389
+ examples: [
1390
+ issueLabelCreated,
1391
+ issueLabelRemoved,
1392
+ issueLabelUpdated
1393
+ ],
1394
+ parsePayload: (payload) => payload,
1395
+ runProperties: (payload) => [
1396
+ {
1397
+ label: "Event action",
1398
+ text: payload.action
1399
+ },
1400
+ {
1401
+ label: "IssueLabel ID",
1402
+ text: payload.data.id
1403
+ }
1404
+ ]
1405
+ };
1406
+ var onIssueLabelCreated = {
1407
+ name: "IssueLabel",
1408
+ title: "On IssueLabel Created",
1409
+ source: "linear.app",
1410
+ icon: "linear",
1411
+ filter: {
1412
+ action: [
1413
+ "create"
1414
+ ]
1415
+ },
1416
+ examples: [
1417
+ issueLabelCreated
1418
+ ],
1419
+ parsePayload: (payload) => payload,
1420
+ runProperties: (payload) => [
1421
+ {
1422
+ label: "IssueLabel ID",
1423
+ text: payload.data.id
1424
+ }
1425
+ ]
1426
+ };
1427
+ var onIssueLabelRemoved = {
1428
+ name: "IssueLabel",
1429
+ title: "On IssueLabel Removed",
1430
+ source: "linear.app",
1431
+ icon: "linear",
1432
+ filter: {
1433
+ action: [
1434
+ "remove"
1435
+ ]
1436
+ },
1437
+ examples: [
1438
+ issueLabelRemoved
1439
+ ],
1440
+ parsePayload: (payload) => payload,
1441
+ runProperties: (payload) => [
1442
+ {
1443
+ label: "IssueLabel ID",
1444
+ text: payload.data.id
1445
+ }
1446
+ ]
1447
+ };
1448
+ var onIssueLabelUpdated = {
1449
+ name: "IssueLabel",
1450
+ title: "On IssueLabel Updated",
1451
+ source: "linear.app",
1452
+ icon: "linear",
1453
+ filter: {
1454
+ action: [
1455
+ "update"
1456
+ ]
1457
+ },
1458
+ examples: [
1459
+ issueLabelUpdated
1460
+ ],
1461
+ parsePayload: (payload) => payload,
1462
+ runProperties: (payload) => [
1463
+ {
1464
+ label: "IssueLabel ID",
1465
+ text: payload.data.id
1466
+ }
1467
+ ]
1468
+ };
1469
+ var onIssueSLA = {
1470
+ name: "IssueSLA",
1471
+ title: "On Issue SLA",
1472
+ source: "linear.app",
1473
+ icon: "linear",
1474
+ parsePayload: (payload) => payload,
1475
+ runProperties: (payload) => [
1476
+ {
1477
+ label: "SLA action",
1478
+ text: payload.action
1479
+ },
1480
+ {
1481
+ label: "Issue ID",
1482
+ text: payload.issueData.id
1483
+ }
1484
+ ]
1485
+ };
1486
+ var onIssueSLASet = {
1487
+ name: "IssueSLA",
1488
+ title: "On Issue SLA Set",
1489
+ source: "linear.app",
1490
+ icon: "linear",
1491
+ filter: {
1492
+ action: [
1493
+ "set"
1494
+ ]
1495
+ },
1496
+ parsePayload: (payload) => payload,
1497
+ runProperties: (payload) => [
1498
+ {
1499
+ label: "Issue ID",
1500
+ text: payload.issueData.id
1501
+ }
1502
+ ]
1503
+ };
1504
+ var onIssueSLABreached = {
1505
+ name: "IssueSLA",
1506
+ title: "On Issue SLA Breached",
1507
+ source: "linear.app",
1508
+ icon: "linear",
1509
+ filter: {
1510
+ action: [
1511
+ "breached"
1512
+ ]
1513
+ },
1514
+ parsePayload: (payload) => payload,
1515
+ runProperties: (payload) => [
1516
+ {
1517
+ label: "Issue ID",
1518
+ text: payload.issueData.id
1519
+ }
1520
+ ]
1521
+ };
1522
+ var onIssueSLAHighRisk = {
1523
+ name: "IssueSLA",
1524
+ title: "On Issue SLA High Risk",
1525
+ source: "linear.app",
1526
+ icon: "linear",
1527
+ filter: {
1528
+ action: [
1529
+ "highRisk"
1530
+ ]
1531
+ },
1532
+ parsePayload: (payload) => payload,
1533
+ runProperties: (payload) => [
1534
+ {
1535
+ label: "Issue ID",
1536
+ text: payload.issueData.id
1537
+ }
1538
+ ]
1539
+ };
1540
+ var onProject = {
1541
+ name: "Project",
1542
+ title: "On Project",
1543
+ source: "linear.app",
1544
+ icon: "linear",
1545
+ examples: [
1546
+ projectCreated,
1547
+ projectRemoved,
1548
+ projectUpdated
1549
+ ],
1550
+ parsePayload: (payload) => payload,
1551
+ runProperties: (payload) => [
1552
+ {
1553
+ label: "Event action",
1554
+ text: payload.action
1555
+ },
1556
+ {
1557
+ label: "Project ID",
1558
+ text: payload.data.id
1559
+ },
1560
+ {
1561
+ label: "Project Name",
1562
+ text: payload.data.name,
1563
+ url: payload.url ?? void 0
1564
+ },
1565
+ ...updatedFromProperties(payload)
1566
+ ]
1567
+ };
1568
+ var onProjectCreated = {
1569
+ name: "Project",
1570
+ title: "On Project Created",
1571
+ source: "linear.app",
1572
+ icon: "linear",
1573
+ filter: {
1574
+ action: [
1575
+ "create"
1576
+ ]
1577
+ },
1578
+ examples: [
1579
+ projectCreated
1580
+ ],
1581
+ parsePayload: (payload) => payload,
1582
+ runProperties: (payload) => [
1583
+ {
1584
+ label: "Project ID",
1585
+ text: payload.data.id
1586
+ },
1587
+ {
1588
+ label: "Project Name",
1589
+ text: payload.data.name,
1590
+ url: payload.url ?? void 0
1591
+ }
1592
+ ]
1593
+ };
1594
+ var onProjectRemoved = {
1595
+ name: "Project",
1596
+ title: "On Project Removed",
1597
+ source: "linear.app",
1598
+ icon: "linear",
1599
+ filter: {
1600
+ action: [
1601
+ "remove"
1602
+ ]
1603
+ },
1604
+ examples: [
1605
+ projectRemoved
1606
+ ],
1607
+ parsePayload: (payload) => payload,
1608
+ runProperties: (payload) => [
1609
+ {
1610
+ label: "Project ID",
1611
+ text: payload.data.id
1612
+ },
1613
+ {
1614
+ label: "Project Name",
1615
+ text: payload.data.name,
1616
+ url: payload.url ?? void 0
1617
+ }
1618
+ ]
1619
+ };
1620
+ var onProjectUpdated = {
1621
+ name: "Project",
1622
+ title: "On Project Updated",
1623
+ source: "linear.app",
1624
+ icon: "linear",
1625
+ filter: {
1626
+ action: [
1627
+ "update"
1628
+ ]
1629
+ },
1630
+ examples: [
1631
+ projectUpdated
1632
+ ],
1633
+ parsePayload: (payload) => payload,
1634
+ runProperties: (payload) => [
1635
+ {
1636
+ label: "Project ID",
1637
+ text: payload.data.id
1638
+ },
1639
+ {
1640
+ label: "Project Name",
1641
+ text: payload.data.name,
1642
+ url: payload.url ?? void 0
1643
+ },
1644
+ ...updatedFromProperties(payload)
1645
+ ]
1646
+ };
1647
+ var onProjectUpdate = {
1648
+ name: "ProjectUpdate",
1649
+ title: "On ProjectUpdate",
1650
+ source: "linear.app",
1651
+ icon: "linear",
1652
+ examples: [
1653
+ projectUpdateCreated,
1654
+ projectUpdateRemoved,
1655
+ projectUpdateUpdated
1656
+ ],
1657
+ parsePayload: (payload) => payload,
1658
+ runProperties: (payload) => [
1659
+ {
1660
+ label: "Event action",
1661
+ text: payload.action
1662
+ },
1663
+ {
1664
+ label: "ProjectUpdate ID",
1665
+ text: payload.data.id
1666
+ }
1667
+ ]
1668
+ };
1669
+ var onProjectUpdateCreated = {
1670
+ name: "ProjectUpdate",
1671
+ title: "On ProjectUpdate Created",
1672
+ source: "linear.app",
1673
+ icon: "linear",
1674
+ filter: {
1675
+ action: [
1676
+ "create"
1677
+ ]
1678
+ },
1679
+ examples: [
1680
+ projectUpdateCreated
1681
+ ],
1682
+ parsePayload: (payload) => payload,
1683
+ runProperties: (payload) => [
1684
+ {
1685
+ label: "ProjectUpdate ID",
1686
+ text: payload.data.id
1687
+ }
1688
+ ]
1689
+ };
1690
+ var onProjectUpdateRemoved = {
1691
+ name: "ProjectUpdate",
1692
+ title: "On ProjectUpdate Removed",
1693
+ source: "linear.app",
1694
+ icon: "linear",
1695
+ filter: {
1696
+ action: [
1697
+ "remove"
1698
+ ]
1699
+ },
1700
+ examples: [
1701
+ projectUpdateRemoved
1702
+ ],
1703
+ parsePayload: (payload) => payload,
1704
+ runProperties: (payload) => [
1705
+ {
1706
+ label: "ProjectUpdate ID",
1707
+ text: payload.data.id
1708
+ }
1709
+ ]
1710
+ };
1711
+ var onProjectUpdateUpdated = {
1712
+ name: "ProjectUpdate",
1713
+ title: "On ProjectUpdate Updated",
1714
+ source: "linear.app",
1715
+ icon: "linear",
1716
+ filter: {
1717
+ action: [
1718
+ "update"
1719
+ ]
1720
+ },
1721
+ examples: [
1722
+ projectUpdateUpdated
1723
+ ],
1724
+ parsePayload: (payload) => payload,
1725
+ runProperties: (payload) => [
1726
+ {
1727
+ label: "ProjectUpdate ID",
1728
+ text: payload.data.id
1729
+ }
1730
+ ]
1731
+ };
1732
+ var onReaction = {
1733
+ name: "Reaction",
1734
+ title: "On Reaction",
1735
+ source: "linear.app",
1736
+ icon: "linear",
1737
+ examples: [
1738
+ reactionCreated,
1739
+ reactionRemoved,
1740
+ reactionUpdated
1741
+ ],
1742
+ parsePayload: (payload) => payload,
1743
+ runProperties: (payload) => [
1744
+ {
1745
+ label: "Event action",
1746
+ text: payload.action
1747
+ },
1748
+ {
1749
+ label: "Reaction ID",
1750
+ text: payload.data.id
1751
+ }
1752
+ ]
1753
+ };
1754
+ var onReactionCreated = {
1755
+ name: "Reaction",
1756
+ title: "On Reaction Created",
1757
+ source: "linear.app",
1758
+ icon: "linear",
1759
+ filter: {
1760
+ action: [
1761
+ "create"
1762
+ ]
1763
+ },
1764
+ examples: [
1765
+ reactionCreated
1766
+ ],
1767
+ parsePayload: (payload) => payload,
1768
+ runProperties: (payload) => [
1769
+ {
1770
+ label: "Reaction ID",
1771
+ text: payload.data.id
1772
+ }
1773
+ ]
1774
+ };
1775
+ var onReactionRemoved = {
1776
+ name: "Reaction",
1777
+ title: "On Reaction Removed",
1778
+ source: "linear.app",
1779
+ icon: "linear",
1780
+ filter: {
1781
+ action: [
1782
+ "remove"
1783
+ ]
1784
+ },
1785
+ examples: [
1786
+ reactionRemoved
1787
+ ],
1788
+ parsePayload: (payload) => payload,
1789
+ runProperties: (payload) => [
1790
+ {
1791
+ label: "Reaction ID",
1792
+ text: payload.data.id
1793
+ }
1794
+ ]
1795
+ };
1796
+ var onReactionUpdated = {
1797
+ name: "Reaction",
1798
+ title: "On Reaction Updated",
1799
+ source: "linear.app",
1800
+ icon: "linear",
1801
+ filter: {
1802
+ action: [
1803
+ "update"
1804
+ ]
1805
+ },
1806
+ examples: [
1807
+ reactionUpdated
1808
+ ],
1809
+ parsePayload: (payload) => payload,
1810
+ runProperties: (payload) => [
1811
+ {
1812
+ label: "Reaction ID",
1813
+ text: payload.data.id
1814
+ }
1815
+ ]
1816
+ };
1817
+ z.union([
1818
+ z.literal("Attachment"),
1819
+ z.literal("Comment"),
1820
+ z.literal("Cycle"),
1821
+ z.literal("Issue"),
1822
+ z.literal("IssueLabel"),
1823
+ z.literal("IssueSLA"),
1824
+ z.literal("Project"),
1825
+ z.literal("ProjectUpdate"),
1826
+ z.literal("Reaction")
1827
+ ]);
1828
+ var WebhookChangeActionTypeSchema = z.union([
1829
+ z.literal("create"),
1830
+ z.literal("remove"),
1831
+ z.literal("update")
1832
+ ]);
1833
+ var WebhookSLAActionTypeSchema = z.union([
1834
+ z.literal("set"),
1835
+ z.literal("breached"),
1836
+ z.literal("highRisk")
1837
+ ]);
1838
+ WebhookChangeActionTypeSchema.or(WebhookSLAActionTypeSchema);
1839
+ var IssueLabelDataSchema = z.object({
1840
+ archivedAt: z.coerce.date().optional().nullable(),
1841
+ color: z.string(),
1842
+ createdAt: z.coerce.date(),
1843
+ creatorId: z.string().optional().nullable(),
1844
+ description: z.string().optional().nullable(),
1845
+ id: z.string(),
1846
+ // isGroup: z.boolean(), // missing
1847
+ name: z.string(),
1848
+ organizationId: z.string(),
1849
+ parentId: z.string().optional().nullable(),
1850
+ teamId: z.string().optional().nullable(),
1851
+ updatedAt: z.coerce.date()
1852
+ });
1853
+ var IssueDataSchema = z.object({
1854
+ archivedAt: z.coerce.date().optional().nullable(),
1855
+ assignee: z.object({
1856
+ id: z.string(),
1857
+ name: z.string()
1858
+ }).optional().nullable(),
1859
+ assigneeId: z.string().optional().nullable(),
1860
+ autoArchivedAt: z.coerce.date().optional().nullable(),
1861
+ autoClosedAt: z.coerce.date().optional().nullable(),
1862
+ boardOrder: z.number(),
1863
+ canceledAt: z.coerce.date().optional().nullable(),
1864
+ completedAt: z.coerce.date().optional().nullable(),
1865
+ createdAt: z.coerce.date(),
1866
+ creatorId: z.string().optional().nullable(),
1867
+ cycleId: z.string().optional().nullable(),
1868
+ description: z.string().optional().nullable(),
1869
+ dueDate: z.coerce.date().optional().nullable(),
1870
+ estimate: z.number().optional().nullable(),
1871
+ favoriteId: z.string().optional().nullable(),
1872
+ id: z.string(),
1873
+ labelIds: z.array(z.string()),
1874
+ labels: z.array(IssueLabelDataSchema.pick({
1875
+ id: true,
1876
+ color: true,
1877
+ name: true
1878
+ })),
1879
+ number: z.number(),
1880
+ parentId: z.string().optional().nullable(),
1881
+ previousIdentifiers: z.array(z.string()),
1882
+ priority: z.number(),
1883
+ priorityLabel: z.string(),
1884
+ projectId: z.string().optional().nullable(),
1885
+ sortOrder: z.number(),
1886
+ state: z.object({
1887
+ id: z.string(),
1888
+ color: z.string(),
1889
+ name: z.string(),
1890
+ type: z.string()
1891
+ }),
1892
+ startedAt: z.coerce.date().optional().nullable(),
1893
+ stateId: z.string(),
1894
+ subIssueSortOrder: z.number().optional().nullable(),
1895
+ subscriberIds: z.array(z.string()),
1896
+ team: z.object({
1897
+ id: z.string(),
1898
+ key: z.string(),
1899
+ name: z.string()
1900
+ }),
1901
+ teamId: z.string(),
1902
+ title: z.string(),
1903
+ trashed: z.boolean().optional().nullable(),
1904
+ triagedAt: z.coerce.date().optional().nullable(),
1905
+ updatedAt: z.coerce.date()
1906
+ });
1907
+ var AttachmentDataSchema = z.object({
1908
+ archivedAt: z.coerce.date().optional().nullable(),
1909
+ createdAt: z.coerce.date(),
1910
+ creatorId: z.string().optional().nullable(),
1911
+ groupBySource: z.boolean(),
1912
+ id: z.string(),
1913
+ issueId: z.string(),
1914
+ metadata: z.object({}).passthrough(),
1915
+ source: z.object({
1916
+ type: z.string().nullable(),
1917
+ imageUrl: z.string().url().nullable()
1918
+ }).passthrough().partial().nullable(),
1919
+ sourceType: z.string().optional().nullable(),
1920
+ subtitle: z.string().optional().nullable(),
1921
+ title: z.string(),
1922
+ updatedAt: z.coerce.date(),
1923
+ url: z.string().url()
1924
+ });
1925
+ var CommentDataSchema = z.object({
1926
+ archivedAt: z.coerce.date().optional().nullable(),
1927
+ body: z.string(),
1928
+ botActorId: z.string().optional().nullable(),
1929
+ createdAt: z.coerce.date(),
1930
+ editedAt: z.string().optional().nullable(),
1931
+ id: z.string(),
1932
+ issue: IssueDataSchema.pick({
1933
+ id: true,
1934
+ title: true
1935
+ }),
1936
+ issueId: z.string(),
1937
+ parentId: z.string().optional().nullable(),
1938
+ reactionData: z.array(z.object({}).passthrough()),
1939
+ updatedAt: z.coerce.date(),
1940
+ userId: z.string().optional().nullable()
1941
+ });
1942
+ var ReactionDataSchema = z.object({
1943
+ archivedAt: z.coerce.date().optional().nullable(),
1944
+ comment: CommentDataSchema.pick({
1945
+ id: true,
1946
+ body: true,
1947
+ userId: true
1948
+ }).optional().nullable(),
1949
+ createdAt: z.coerce.date(),
1950
+ emoji: z.string(),
1951
+ id: z.string(),
1952
+ updatedAt: z.coerce.date(),
1953
+ user: z.object({
1954
+ id: z.string(),
1955
+ name: z.string()
1956
+ }).optional().nullable(),
1957
+ userId: z.string().optional().nullable()
1958
+ });
1959
+ var MilestoneDataSchema = z.object({
1960
+ archivedAt: z.coerce.date().optional().nullable(),
1961
+ createdAt: z.coerce.date(),
1962
+ description: z.string().optional().nullable(),
1963
+ id: z.string(),
1964
+ name: z.string(),
1965
+ projectId: z.string().optional().nullable(),
1966
+ sortOrder: z.number(),
1967
+ targetDate: z.coerce.date().optional().nullable(),
1968
+ updatedAt: z.coerce.date()
1969
+ });
1970
+ var RoadmapDataSchema = z.object({
1971
+ archivedAt: z.coerce.date().optional().nullable(),
1972
+ color: z.string().optional().nullable(),
1973
+ createdAt: z.coerce.date(),
1974
+ creatorId: z.string(),
1975
+ description: z.string().optional().nullable(),
1976
+ id: z.string(),
1977
+ name: z.string(),
1978
+ organizationId: z.string(),
1979
+ ownerId: z.string(),
1980
+ slugId: z.string(),
1981
+ sortOrder: z.number(),
1982
+ updatedAt: z.coerce.date()
1983
+ });
1984
+ var ProjectDataSchema = z.object({
1985
+ archivedAt: z.coerce.date().optional().nullable(),
1986
+ autoArchivedAt: z.coerce.date().optional().nullable(),
1987
+ canceledAt: z.coerce.date().optional().nullable(),
1988
+ color: z.string(),
1989
+ completedAt: z.coerce.date().optional().nullable(),
1990
+ completedIssueCountHistory: z.array(z.number()),
1991
+ completedScopeHistory: z.array(z.number()),
1992
+ content: z.string().optional().nullable(),
1993
+ convertedFromIssueId: z.string().optional().nullable(),
1994
+ createdAt: z.coerce.date(),
1995
+ creatorId: z.string(),
1996
+ description: z.string(),
1997
+ icon: z.string().optional().nullable(),
1998
+ id: z.string(),
1999
+ inProgressScopeHistory: z.array(z.number()),
2000
+ integrationsSettingsId: z.string().optional().nullable(),
2001
+ issueCountHistory: z.array(z.number()),
2002
+ leadId: z.string(),
2003
+ memberIds: z.array(z.string()),
2004
+ milestones: z.array(MilestoneDataSchema.pick({
2005
+ id: true,
2006
+ name: true
2007
+ })),
2008
+ name: z.string(),
2009
+ progress: z.number().optional().nullable(),
2010
+ projectUpdateRemindersPausedUntilAt: z.coerce.date().optional().nullable(),
2011
+ roadmaps: z.array(RoadmapDataSchema.pick({
2012
+ id: true,
2013
+ name: true
2014
+ })).optional().nullable(),
2015
+ scope: z.number().optional().nullable(),
2016
+ scopeHistory: z.array(z.number()),
2017
+ slackIssueComments: z.boolean(),
2018
+ slackIssueStatuses: z.boolean(),
2019
+ slackNewIssue: z.boolean(),
2020
+ slugId: z.string(),
2021
+ sortOrder: z.number(),
2022
+ startDate: z.coerce.date().optional().nullable(),
2023
+ startedAt: z.coerce.date().optional().nullable(),
2024
+ state: z.string(),
2025
+ targetDate: z.coerce.date().optional().nullable(),
2026
+ teamIds: z.array(z.string()),
2027
+ trashed: z.boolean().optional().nullable(),
2028
+ updatedAt: z.coerce.date()
2029
+ });
2030
+ var ProjectUpdateDataSchema = z.object({
2031
+ archivedAt: z.coerce.date().optional().nullable(),
2032
+ body: z.string(),
2033
+ createdAt: z.coerce.date(),
2034
+ // diff: z.any().optional().nullable(), // missing, "stringified" JSON but typed as Record
2035
+ editedAt: z.coerce.date().optional().nullable(),
2036
+ health: z.string(),
2037
+ id: z.string(),
2038
+ infoSnapshot: z.object({}).passthrough().optional().nullable(),
2039
+ project: ProjectDataSchema.pick({
2040
+ id: true,
2041
+ name: true
2042
+ }),
2043
+ projectId: z.string(),
2044
+ roadmaps: z.array(RoadmapDataSchema.pick({
2045
+ id: true,
2046
+ name: true
2047
+ })).optional().nullable(),
2048
+ updatedAt: z.coerce.date(),
2049
+ user: z.object({
2050
+ id: z.string(),
2051
+ name: z.string()
2052
+ }),
2053
+ userId: z.string()
2054
+ });
2055
+ var CycleDataSchema = z.object({
2056
+ archivedAt: z.coerce.date().optional().nullable(),
2057
+ autoArchivedAt: z.coerce.date().optional().nullable(),
2058
+ completedAt: z.coerce.date().optional().nullable(),
2059
+ completedIssueCountHistory: z.array(z.number()),
2060
+ completedScopeHistory: z.array(z.number()),
2061
+ createdAt: z.coerce.date(),
2062
+ description: z.string().optional().nullable(),
2063
+ endsAt: z.coerce.date(),
2064
+ id: z.string(),
2065
+ inProgressScopeHistory: z.array(z.number()),
2066
+ issueCountHistory: z.array(z.number()),
2067
+ name: z.string().optional().nullable(),
2068
+ number: z.number(),
2069
+ progress: z.number().optional().nullable(),
2070
+ scopeHistory: z.array(z.number()),
2071
+ startsAt: z.coerce.date(),
2072
+ teamId: z.string(),
2073
+ uncompletedIssuesUponCloseIds: z.array(z.string()),
2074
+ updatedAt: z.coerce.date()
2075
+ });
2076
+ var WebhookPayloadBaseSchema = z.object({
2077
+ createdAt: z.coerce.date(),
2078
+ organizationId: z.string().optional().nullable(),
2079
+ url: z.string().url().optional().nullable(),
2080
+ webhookId: z.string(),
2081
+ webhookTimestamp: z.coerce.date()
2082
+ });
2083
+ var CREATE = z.literal("create");
2084
+ var REMOVE = z.literal("remove");
2085
+ var UPDATE = z.literal("update");
2086
+ var AttachmentEventBaseSchema = WebhookPayloadBaseSchema.extend({
2087
+ type: z.literal("Attachment"),
2088
+ data: AttachmentDataSchema
2089
+ });
2090
+ var AttachmentEventSchema = z.discriminatedUnion("action", [
2091
+ AttachmentEventBaseSchema.extend({
2092
+ action: CREATE
2093
+ }),
2094
+ AttachmentEventBaseSchema.extend({
2095
+ action: REMOVE
2096
+ }),
2097
+ AttachmentEventBaseSchema.extend({
2098
+ action: UPDATE,
2099
+ updatedFrom: AttachmentDataSchema.partial()
2100
+ })
2101
+ ]);
2102
+ var CommentEventBaseSchema = WebhookPayloadBaseSchema.extend({
2103
+ type: z.literal("Comment"),
2104
+ data: CommentDataSchema
2105
+ });
2106
+ var CommentEventSchema = z.discriminatedUnion("action", [
2107
+ CommentEventBaseSchema.extend({
2108
+ action: CREATE
2109
+ }),
2110
+ CommentEventBaseSchema.extend({
2111
+ action: REMOVE
2112
+ }),
2113
+ CommentEventBaseSchema.extend({
2114
+ action: UPDATE,
2115
+ updatedFrom: CommentDataSchema.partial()
2116
+ })
2117
+ ]);
2118
+ var CycleEventBaseSchema = WebhookPayloadBaseSchema.extend({
2119
+ type: z.literal("Cycle"),
2120
+ data: CycleDataSchema
2121
+ });
2122
+ var CycleEventSchema = z.discriminatedUnion("action", [
2123
+ CycleEventBaseSchema.extend({
2124
+ action: CREATE
2125
+ }),
2126
+ CycleEventBaseSchema.extend({
2127
+ action: REMOVE
2128
+ }),
2129
+ CycleEventBaseSchema.extend({
2130
+ action: UPDATE,
2131
+ updatedFrom: CycleDataSchema.partial()
2132
+ })
2133
+ ]);
2134
+ var IssueEventBaseSchema = WebhookPayloadBaseSchema.extend({
2135
+ type: z.literal("Issue"),
2136
+ data: IssueDataSchema
2137
+ });
2138
+ var IssueEventSchema = z.discriminatedUnion("action", [
2139
+ IssueEventBaseSchema.extend({
2140
+ action: CREATE
2141
+ }),
2142
+ IssueEventBaseSchema.extend({
2143
+ action: REMOVE
2144
+ }),
2145
+ IssueEventBaseSchema.extend({
2146
+ action: UPDATE,
2147
+ updatedFrom: IssueDataSchema.partial()
2148
+ })
2149
+ ]);
2150
+ var IssueLabelEventBaseSchema = WebhookPayloadBaseSchema.extend({
2151
+ type: z.literal("IssueLabel"),
2152
+ data: IssueLabelDataSchema
2153
+ });
2154
+ var IssueLabelEventSchema = z.discriminatedUnion("action", [
2155
+ IssueLabelEventBaseSchema.extend({
2156
+ action: CREATE
2157
+ }),
2158
+ IssueLabelEventBaseSchema.extend({
2159
+ action: REMOVE
2160
+ }),
2161
+ IssueLabelEventBaseSchema.extend({
2162
+ action: UPDATE,
2163
+ updatedFrom: IssueLabelDataSchema.partial()
2164
+ })
2165
+ ]);
2166
+ var IssueSLAEventBaseSchema = WebhookPayloadBaseSchema.extend({
2167
+ type: z.literal("IssueSLA"),
2168
+ issueData: IssueDataSchema
2169
+ });
2170
+ var IssueSLAEventSchema = z.discriminatedUnion("action", [
2171
+ IssueSLAEventBaseSchema.extend({
2172
+ action: z.literal("set")
2173
+ }),
2174
+ IssueSLAEventBaseSchema.extend({
2175
+ action: z.literal("highRisk")
2176
+ }),
2177
+ IssueSLAEventBaseSchema.extend({
2178
+ action: z.literal("breached")
2179
+ })
2180
+ ]);
2181
+ var ProjectEventBaseSchema = WebhookPayloadBaseSchema.extend({
2182
+ type: z.literal("Project"),
2183
+ data: ProjectDataSchema
2184
+ });
2185
+ var ProjectEventSchema = z.discriminatedUnion("action", [
2186
+ ProjectEventBaseSchema.extend({
2187
+ action: CREATE
2188
+ }),
2189
+ ProjectEventBaseSchema.extend({
2190
+ action: REMOVE
2191
+ }),
2192
+ ProjectEventBaseSchema.extend({
2193
+ action: UPDATE,
2194
+ updatedFrom: ProjectDataSchema.partial()
2195
+ })
2196
+ ]);
2197
+ var ProjectUpdateEventBaseSchema = WebhookPayloadBaseSchema.extend({
2198
+ type: z.literal("ProjectUpdate"),
2199
+ data: ProjectUpdateDataSchema
2200
+ });
2201
+ var ProjectUpdateEventSchema = z.discriminatedUnion("action", [
2202
+ ProjectUpdateEventBaseSchema.extend({
2203
+ action: CREATE
2204
+ }),
2205
+ ProjectUpdateEventBaseSchema.extend({
2206
+ action: REMOVE
2207
+ }),
2208
+ ProjectUpdateEventBaseSchema.extend({
2209
+ action: UPDATE,
2210
+ updatedFrom: ProjectUpdateDataSchema.partial()
2211
+ })
2212
+ ]);
2213
+ var ReactionEventBaseSchema = WebhookPayloadBaseSchema.extend({
2214
+ type: z.literal("Reaction"),
2215
+ data: ReactionDataSchema
2216
+ });
2217
+ var ReactionEventSchema = z.discriminatedUnion("action", [
2218
+ ReactionEventBaseSchema.extend({
2219
+ action: CREATE
2220
+ }),
2221
+ ReactionEventBaseSchema.extend({
2222
+ action: REMOVE
2223
+ }),
2224
+ ReactionEventBaseSchema.extend({
2225
+ action: UPDATE,
2226
+ updatedFrom: ReactionDataSchema.partial()
2227
+ })
2228
+ ]);
2229
+ var WebhookPayloadSchema = z.union([
2230
+ AttachmentEventSchema,
2231
+ CommentEventSchema,
2232
+ CycleEventSchema,
2233
+ IssueEventSchema,
2234
+ IssueLabelEventSchema,
2235
+ IssueSLAEventSchema,
2236
+ ProjectEventSchema,
2237
+ ProjectUpdateEventSchema,
2238
+ ReactionEventSchema
2239
+ ]);
2240
+
2241
+ // src/webhooks.ts
2242
+ var _Webhooks = class _Webhooks {
2243
+ constructor(runTask) {
2244
+ this.runTask = runTask;
2245
+ }
2246
+ webhook(key, params) {
2247
+ return this.runTask(key, async (client, task, io) => {
2248
+ return serializeLinearOutput(await client.webhook(params.id));
2249
+ }, {
2250
+ name: "Get Webhook",
2251
+ params,
2252
+ properties: [
2253
+ {
2254
+ label: "Webhook ID",
2255
+ text: params.id
2256
+ }
2257
+ ]
2258
+ });
2259
+ }
2260
+ webhooks(key, params) {
2261
+ return this.runTask(key, async (client, task, io) => {
2262
+ let connections = await client.webhooks(params);
2263
+ const hooks = connections.nodes;
2264
+ while (connections.pageInfo.hasNextPage) {
2265
+ connections = await connections.fetchNext();
2266
+ hooks.push(...connections.nodes);
2267
+ }
2268
+ return serializeLinearOutput(hooks);
2269
+ }, {
2270
+ name: "List Webhooks",
2271
+ params,
2272
+ properties: queryProperties(params ?? {})
2273
+ });
2274
+ }
2275
+ createWebhook(key, params) {
2276
+ return this.runTask(key, async (client, task, io) => {
2277
+ const payload = await client.createWebhook({
2278
+ ...params,
2279
+ allPublicTeams: !params.teamId
2280
+ });
2281
+ return serializeLinearOutput({
2282
+ ...payload,
2283
+ webhook: await payload.webhook
2284
+ });
2285
+ }, {
2286
+ name: "Create Webhook",
2287
+ params,
2288
+ properties: [
2289
+ {
2290
+ label: "Webhook URL",
2291
+ text: params.url
2292
+ },
2293
+ {
2294
+ label: "Resource Types",
2295
+ text: params.resourceTypes.join(", ")
2296
+ }
2297
+ ]
2298
+ });
2299
+ }
2300
+ deleteWebhook(key, params) {
2301
+ return this.runTask(key, async (client, task, io) => {
2302
+ return serializeLinearOutput(await client.deleteWebhook(params.id));
2303
+ }, {
2304
+ name: "Delete Webhook",
2305
+ params,
2306
+ properties: [
2307
+ {
2308
+ label: "Webhook ID",
2309
+ text: params.id
2310
+ }
2311
+ ]
2312
+ });
2313
+ }
2314
+ updateWebhook(key, params) {
2315
+ return this.runTask(key, async (client, task) => {
2316
+ const payload = await client.updateWebhook(params.id, params.input);
2317
+ return serializeLinearOutput({
2318
+ ...payload,
2319
+ webhook: await payload.webhook
2320
+ });
2321
+ }, {
2322
+ name: "Update Webhook",
2323
+ params,
2324
+ properties: [
2325
+ {
2326
+ label: "Webhook ID",
2327
+ text: params.id
2328
+ },
2329
+ ...params.input.url ? [
2330
+ {
2331
+ label: "Webhook URL",
2332
+ text: params.input.url
2333
+ }
2334
+ ] : [],
2335
+ ...params.input.resourceTypes ? [
2336
+ {
2337
+ label: "Resource Types",
2338
+ text: params.input.resourceTypes.join(", ")
2339
+ }
2340
+ ] : []
2341
+ ]
2342
+ });
2343
+ }
2344
+ };
2345
+ __name(_Webhooks, "Webhooks");
2346
+ var Webhooks = _Webhooks;
2347
+ function createTrigger(source, event, params) {
2348
+ return new ExternalSourceTrigger({
2349
+ event,
2350
+ params,
2351
+ source,
2352
+ options: {}
2353
+ });
2354
+ }
2355
+ __name(createTrigger, "createTrigger");
2356
+ var WebhookRegistrationDataSchema = z.object({
2357
+ success: z.literal(true),
2358
+ webhook: z.object({
2359
+ id: z.string(),
2360
+ enabled: z.boolean()
2361
+ })
2362
+ });
2363
+ function createWebhookEventSource(integration) {
2364
+ return new ExternalSource("HTTP", {
2365
+ id: "linear.webhook",
2366
+ schema: z.object({
2367
+ teamId: z.string().optional()
2368
+ }),
2369
+ version: "0.1.0",
2370
+ integration,
2371
+ key: (params) => `${params.teamId ? params.teamId : "all"}`,
2372
+ handler: webhookHandler,
2373
+ register: async (event, io, ctx) => {
2374
+ const { params, source: httpSource, options } = event;
2375
+ const webhookData = WebhookRegistrationDataSchema.safeParse(httpSource.data);
2376
+ const allEvents = Array.from(/* @__PURE__ */ new Set([
2377
+ ...options.event.desired,
2378
+ ...options.event.missing
2379
+ ]));
2380
+ const registeredOptions = {
2381
+ event: allEvents
2382
+ };
2383
+ const label = `trigger.${params.teamId ? params.teamId : "all"}`;
2384
+ if (httpSource.active && webhookData.success) {
2385
+ const hasMissingOptions = Object.values(options).some((option) => option.missing.length > 0);
2386
+ if (!hasMissingOptions)
2387
+ return;
2388
+ const updatedWebhook = await io.integration.updateWebhook("update-webhook", {
2389
+ id: webhookData.data.webhook.id,
2390
+ input: {
2391
+ label,
2392
+ resourceTypes: allEvents,
2393
+ secret: httpSource.secret,
2394
+ url: httpSource.url
2395
+ }
2396
+ });
2397
+ return {
2398
+ data: WebhookRegistrationDataSchema.parse(updatedWebhook),
2399
+ options: registeredOptions
2400
+ };
2401
+ }
2402
+ const listResponse = await io.integration.webhooks("list-webhooks");
2403
+ const existingWebhook = listResponse.find((w) => w.url === httpSource.url);
2404
+ if (existingWebhook) {
2405
+ const updatedWebhook = await io.integration.updateWebhook("update-webhook", {
2406
+ id: existingWebhook.id,
2407
+ input: {
2408
+ label,
2409
+ resourceTypes: allEvents,
2410
+ secret: httpSource.secret,
2411
+ url: httpSource.url
2412
+ }
2413
+ });
2414
+ return {
2415
+ data: WebhookRegistrationDataSchema.parse(updatedWebhook),
2416
+ options: registeredOptions
2417
+ };
2418
+ }
2419
+ const createPayload = await io.integration.createWebhook("create-webhook", {
2420
+ label,
2421
+ resourceTypes: allEvents,
2422
+ secret: httpSource.secret,
2423
+ teamId: params.teamId,
2424
+ url: httpSource.url
2425
+ });
2426
+ return {
2427
+ data: WebhookRegistrationDataSchema.parse(createPayload),
2428
+ secret: (await createPayload.webhook)?.secret,
2429
+ options: registeredOptions
2430
+ };
2431
+ }
2432
+ });
2433
+ }
2434
+ __name(createWebhookEventSource, "createWebhookEventSource");
2435
+ async function webhookHandler(event, logger, integration) {
2436
+ logger.debug("[@trigger.dev/linear] Handling webhook payload");
2437
+ const { rawEvent: request, source } = event;
2438
+ const LINEAR_IPS = [
2439
+ "35.231.147.226",
2440
+ "35.243.134.228"
2441
+ ];
2442
+ const clientIp = request.headers.get("cf-connecting-ip") ?? (request.headers.get("x-real-ip") ?? request.headers.get("x-forwarded-for") ?? // default to allowing request if expected headers missing
2443
+ LINEAR_IPS[0]).split(",")[0];
2444
+ if (!LINEAR_IPS.includes(clientIp)) {
2445
+ logger.error("[@trigger.dev/linear] Error validating webhook source, IP invalid.");
2446
+ throw Error("[@trigger.dev/linear] Invalid source IP.");
2447
+ }
2448
+ const payloadUuid = request.headers.get("Linear-Delivery");
2449
+ const payloadEvent = request.headers.get("Linear-Event");
2450
+ if (!payloadUuid || !payloadEvent) {
2451
+ logger.debug("[@trigger.dev/linear] Missing required Linear headers");
2452
+ return {
2453
+ events: []
2454
+ };
2455
+ }
2456
+ if (!request.body) {
2457
+ logger.debug("[@trigger.dev/linear] No body found");
2458
+ return {
2459
+ events: []
2460
+ };
2461
+ }
2462
+ const signature = request.headers.get(LINEAR_WEBHOOK_SIGNATURE_HEADER);
2463
+ if (!signature) {
2464
+ logger.error("[@trigger.dev/linear] Error validating webhook signature, no signature found");
2465
+ throw Error("[@trigger.dev/linear] No signature found");
2466
+ }
2467
+ const rawBody = await request.text();
2468
+ const body = JSON.parse(rawBody);
2469
+ const webhookHelper = new LinearWebhooks(source.secret);
2470
+ if (!webhookHelper.verify(Buffer.from(rawBody), signature, body[LINEAR_WEBHOOK_TS_FIELD])) {
2471
+ logger.error("[@trigger.dev/linear] Error validating webhook signature, they don't match");
2472
+ throw Error("[@trigger.dev/linear] Invalid signature");
2473
+ }
2474
+ const webhookPayload = WebhookPayloadSchema.parse(body);
2475
+ return {
2476
+ events: [
2477
+ {
2478
+ id: payloadUuid,
2479
+ name: payloadEvent,
2480
+ source: "linear.app",
2481
+ payload: webhookPayload,
2482
+ context: {}
2483
+ }
2484
+ ]
2485
+ };
2486
+ }
2487
+ __name(webhookHandler, "webhookHandler");
2488
+
2489
+ // src/index.ts
2490
+ var _webhooks, webhooks_get;
2491
+ var _Linear = class _Linear {
2492
+ constructor(options) {
2493
+ __privateAdd(this, _webhooks);
2494
+ this.options = options;
2495
+ this.webhook = __privateGet(this, _webhooks, webhooks_get).webhook;
2496
+ this.webhooks = __privateGet(this, _webhooks, webhooks_get).webhooks;
2497
+ this.createWebhook = __privateGet(this, _webhooks, webhooks_get).createWebhook;
2498
+ this.deleteWebhook = __privateGet(this, _webhooks, webhooks_get).deleteWebhook;
2499
+ this.updateWebhook = __privateGet(this, _webhooks, webhooks_get).updateWebhook;
2500
+ if (Object.keys(options).includes("apiKey") && !options.apiKey) {
2501
+ throw `Can't create Linear integration (${options.id}) as apiKey was undefined`;
2502
+ }
2503
+ this._options = options;
2504
+ }
2505
+ get authSource() {
2506
+ return this._options.apiKey ? "LOCAL" : "HOSTED";
2507
+ }
2508
+ get id() {
2509
+ return this._options.id;
2510
+ }
2511
+ get metadata() {
2512
+ return {
2513
+ id: "linear",
2514
+ name: "Linear"
2515
+ };
2516
+ }
2517
+ get source() {
2518
+ return createWebhookEventSource(this);
2519
+ }
2520
+ cloneForRun(io, connectionKey, auth) {
2521
+ const linear = new _Linear(this._options);
2522
+ linear._io = io;
2523
+ linear._connectionKey = connectionKey;
2524
+ linear._client = this.createClient(auth);
2525
+ return linear;
2526
+ }
2527
+ createClient(auth) {
2528
+ if (auth) {
2529
+ return new LinearClient({
2530
+ accessToken: auth.accessToken
2531
+ });
2532
+ }
2533
+ if (this._options.apiKey) {
2534
+ return new LinearClient({
2535
+ apiKey: this._options.apiKey
2536
+ });
2537
+ }
2538
+ throw new Error("No auth");
2539
+ }
2540
+ runTask(key, callback, options, errorCallback) {
2541
+ if (!this._io)
2542
+ throw new Error("No IO");
2543
+ if (!this._connectionKey)
2544
+ throw new Error("No connection key");
2545
+ return this._io.runTask(key, (task, io) => {
2546
+ if (!this._client)
2547
+ throw new Error("No client");
2548
+ return callback(this._client, task, io);
2549
+ }, {
2550
+ icon: "linear",
2551
+ retry: retry.standardBackoff,
2552
+ ...options ?? {},
2553
+ connectionKey: this._connectionKey
2554
+ }, errorCallback ?? onError);
2555
+ }
2556
+ async getAll(task, key, params = {}) {
2557
+ const boundTask = task.bind(this);
2558
+ let edges = await boundTask(`${key}-0`, params);
2559
+ let nodes = edges.nodes;
2560
+ for (let i = 1; edges.pageInfo.hasNextPage; i++) {
2561
+ edges = await boundTask(`${key}-${i}`, {
2562
+ ...params,
2563
+ after: edges.pageInfo.endCursor
2564
+ });
2565
+ nodes = nodes.concat(edges.nodes);
2566
+ }
2567
+ return nodes;
2568
+ }
2569
+ attachment(key, params) {
2570
+ return this.runTask(key, async (client) => {
2571
+ const entity = await client.attachment(params.id);
2572
+ return serializeLinearOutput(entity);
2573
+ }, {
2574
+ name: "Get Attachment",
2575
+ params,
2576
+ properties: [
2577
+ {
2578
+ label: "Attachment ID",
2579
+ text: params.id
2580
+ }
2581
+ ]
2582
+ });
2583
+ }
2584
+ attachments(key, params = {}) {
2585
+ return this.runTask(key, async (client) => {
2586
+ const edges = await client.attachments(params);
2587
+ return serializeLinearOutput(edges);
2588
+ }, {
2589
+ name: "Get Attachments",
2590
+ params,
2591
+ properties: queryProperties(params)
2592
+ });
2593
+ }
2594
+ createAttachment(key, params) {
2595
+ return this.runTask(key, async (client) => {
2596
+ const payload = await client.createAttachment(params);
2597
+ return serializeLinearOutput(await payload.attachment);
2598
+ }, {
2599
+ name: "Create Attachment",
2600
+ params,
2601
+ properties: [
2602
+ {
2603
+ label: "Issue ID",
2604
+ text: params.issueId
2605
+ },
2606
+ {
2607
+ label: "Title",
2608
+ text: params.title
2609
+ },
2610
+ {
2611
+ label: "URL",
2612
+ text: params.url
2613
+ }
2614
+ ]
2615
+ });
2616
+ }
2617
+ deleteAttachment(key, params) {
2618
+ return this.runTask(key, (client) => client.deleteAttachment(params.id), {
2619
+ name: "Delete Attachment",
2620
+ params,
2621
+ properties: [
2622
+ {
2623
+ label: "Attachment ID",
2624
+ text: params.id
2625
+ }
2626
+ ]
2627
+ });
2628
+ }
2629
+ updateAttachment(key, params) {
2630
+ return this.runTask(key, async (client) => {
2631
+ const payload = await client.updateAttachment(params.id, params.input);
2632
+ return serializeLinearOutput(await payload.attachment);
2633
+ }, {
2634
+ name: "Update Attachment",
2635
+ params,
2636
+ properties: [
2637
+ {
2638
+ label: "Attachment ID",
2639
+ text: params.id
2640
+ }
2641
+ ]
2642
+ });
2643
+ }
2644
+ attachmentLinkDiscord(key, params) {
2645
+ return this.runTask(key, async (client) => {
2646
+ const payload = await client.attachmentLinkDiscord(params.channelId, params.issueId, params.messageId, params.url, params.variables);
2647
+ return serializeLinearOutput(await payload.attachment);
2648
+ }, {
2649
+ name: "Link Discord Message",
2650
+ params,
2651
+ properties: [
2652
+ {
2653
+ label: "Issue ID",
2654
+ text: params.issueId
2655
+ },
2656
+ {
2657
+ label: "Channel ID",
2658
+ text: params.channelId
2659
+ },
2660
+ {
2661
+ label: "Message ID",
2662
+ text: params.messageId
2663
+ },
2664
+ {
2665
+ label: "URL",
2666
+ text: params.url
2667
+ }
2668
+ ]
2669
+ });
2670
+ }
2671
+ attachmentLinkFront(key, params) {
2672
+ return this.runTask(key, async (client) => {
2673
+ const payload = await client.attachmentLinkFront(params.conversationId, params.issueId, params.variables);
2674
+ return serializeLinearOutput(payload);
2675
+ }, {
2676
+ name: "Link Front Conversation",
2677
+ params,
2678
+ properties: [
2679
+ {
2680
+ label: "Issue ID",
2681
+ text: params.issueId
2682
+ },
2683
+ {
2684
+ label: "Conversation ID",
2685
+ text: params.conversationId
2686
+ }
2687
+ ]
2688
+ });
2689
+ }
2690
+ attachmentLinkIntercom(key, params) {
2691
+ return this.runTask(key, async (client) => {
2692
+ const payload = await client.attachmentLinkIntercom(params.conversationId, params.issueId, params.variables);
2693
+ return serializeLinearOutput(await payload.attachment);
2694
+ }, {
2695
+ name: "Link Intercom Conversation",
2696
+ params,
2697
+ properties: [
2698
+ {
2699
+ label: "Issue ID",
2700
+ text: params.issueId
2701
+ },
2702
+ {
2703
+ label: "Conversation ID",
2704
+ text: params.conversationId
2705
+ }
2706
+ ]
2707
+ });
2708
+ }
2709
+ attachmentLinkJiraIssue(key, params) {
2710
+ return this.runTask(key, async (client) => {
2711
+ const payload = await client.attachmentLinkJiraIssue(params.issueId, params.jiraIssueId);
2712
+ return serializeLinearOutput(await payload.attachment);
2713
+ }, {
2714
+ name: "Link Jira Issue",
2715
+ params,
2716
+ properties: [
2717
+ {
2718
+ label: "Issue ID",
2719
+ text: params.issueId
2720
+ },
2721
+ {
2722
+ label: "Jira Issue ID",
2723
+ text: params.jiraIssueId
2724
+ }
2725
+ ]
2726
+ });
2727
+ }
2728
+ attachmentLinkSlack(key, params) {
2729
+ return this.runTask(key, async (client) => {
2730
+ const payload = await client.attachmentLinkSlack(params.channel, params.issueId, params.latest, params.url, params.variables);
2731
+ return serializeLinearOutput(await payload.attachment);
2732
+ }, {
2733
+ name: "Link Slack Message",
2734
+ params,
2735
+ properties: [
2736
+ {
2737
+ label: "Issue ID",
2738
+ text: params.issueId
2739
+ },
2740
+ {
2741
+ label: "Channel",
2742
+ text: params.channel
2743
+ },
2744
+ {
2745
+ label: "Latest",
2746
+ text: params.latest
2747
+ },
2748
+ {
2749
+ label: "URL",
2750
+ text: params.url
2751
+ }
2752
+ ]
2753
+ });
2754
+ }
2755
+ attachmentLinkURL(key, params) {
2756
+ return this.runTask(key, async (client) => {
2757
+ const payload = await client.attachmentLinkURL(params.issueId, params.url, params.variables);
2758
+ return serializeLinearOutput(await payload.attachment);
2759
+ }, {
2760
+ name: "Link URL",
2761
+ params,
2762
+ properties: [
2763
+ {
2764
+ label: "Issue ID",
2765
+ text: params.issueId
2766
+ },
2767
+ {
2768
+ label: "URL",
2769
+ text: params.url
2770
+ }
2771
+ ]
2772
+ });
2773
+ }
2774
+ attachmentLinkZendesk(key, params) {
2775
+ return this.runTask(key, async (client) => {
2776
+ const payload = await client.attachmentLinkZendesk(params.issueId, params.ticketId, params.variables);
2777
+ return serializeLinearOutput(await payload.attachment);
2778
+ }, {
2779
+ name: "Link Zendesk Ticket",
2780
+ params,
2781
+ properties: [
2782
+ {
2783
+ label: "Issue ID",
2784
+ text: params.issueId
2785
+ },
2786
+ {
2787
+ label: "Ticket ID",
2788
+ text: params.ticketId
2789
+ }
2790
+ ]
2791
+ });
2792
+ }
2793
+ comment(key, params) {
2794
+ return this.runTask(key, async (client) => {
2795
+ const entity = await client.comment(params.id);
2796
+ return serializeLinearOutput(entity);
2797
+ }, {
2798
+ name: "Get Comment",
2799
+ params,
2800
+ properties: [
2801
+ {
2802
+ label: "Comment ID",
2803
+ text: params.id
2804
+ }
2805
+ ]
2806
+ });
2807
+ }
2808
+ comments(key, params = {}) {
2809
+ return this.runTask(key, async (client) => {
2810
+ const edges = await client.comments(params);
2811
+ return serializeLinearOutput(edges);
2812
+ }, {
2813
+ name: "Get Comments",
2814
+ params,
2815
+ properties: queryProperties(params)
2816
+ });
2817
+ }
2818
+ createComment(key, params) {
2819
+ return this.runTask(key, async (client) => {
2820
+ const payload = await client.createComment(params);
2821
+ return serializeLinearOutput(await payload.comment);
2822
+ }, {
2823
+ name: "Create Comment",
2824
+ params,
2825
+ properties: [
2826
+ {
2827
+ label: "Issue ID",
2828
+ text: params.issueId
2829
+ },
2830
+ {
2831
+ label: "Body",
2832
+ text: params.body ?? ""
2833
+ }
2834
+ ]
2835
+ });
2836
+ }
2837
+ deleteComment(key, params) {
2838
+ return this.runTask(key, (client) => client.deleteComment(params.id), {
2839
+ name: "Delete Comment",
2840
+ params,
2841
+ properties: [
2842
+ {
2843
+ label: "Comment ID",
2844
+ text: params.id
2845
+ }
2846
+ ]
2847
+ });
2848
+ }
2849
+ updateComment(key, params) {
2850
+ return this.runTask(key, async (client) => {
2851
+ const payload = await client.updateComment(params.id, params.input);
2852
+ return serializeLinearOutput(await payload.comment);
2853
+ }, {
2854
+ name: "Update Comment",
2855
+ params,
2856
+ properties: [
2857
+ {
2858
+ label: "Comment ID",
2859
+ text: params.id
2860
+ }
2861
+ ]
2862
+ });
2863
+ }
2864
+ archiveCycle(key, params) {
2865
+ return this.runTask(key, async (client) => {
2866
+ const payload = await client.archiveCycle(params.id);
2867
+ return serializeLinearOutput({
2868
+ ...payload,
2869
+ entity: await payload.entity
2870
+ });
2871
+ }, {
2872
+ name: "Archive Cycle",
2873
+ params,
2874
+ properties: [
2875
+ {
2876
+ label: "Cycle ID",
2877
+ text: params.id
2878
+ }
2879
+ ]
2880
+ });
2881
+ }
2882
+ createCycle(key, params) {
2883
+ return this.runTask(key, async (client) => {
2884
+ const payload = await client.createCycle(params);
2885
+ return serializeLinearOutput(await payload.cycle);
2886
+ }, {
2887
+ name: "Create Cycle",
2888
+ params,
2889
+ properties: [
2890
+ {
2891
+ label: "Team ID",
2892
+ text: params.teamId
2893
+ },
2894
+ {
2895
+ label: "Start at",
2896
+ text: params.startsAt.toISOString()
2897
+ },
2898
+ {
2899
+ label: "Ends at",
2900
+ text: params.endsAt.toISOString()
2901
+ }
2902
+ ]
2903
+ });
2904
+ }
2905
+ // deleteCycle() does not exist
2906
+ updateCycle(key, params) {
2907
+ return this.runTask(key, async (client) => {
2908
+ const payload = await client.updateCycle(params.id, params.input);
2909
+ return serializeLinearOutput(await payload.cycle);
2910
+ }, {
2911
+ name: "Update Cycle",
2912
+ params,
2913
+ properties: [
2914
+ {
2915
+ label: "Cycle ID",
2916
+ text: params.id
2917
+ }
2918
+ ]
2919
+ });
2920
+ }
2921
+ document(key, params) {
2922
+ return this.runTask(key, async (client) => {
2923
+ const entity = await client.document(params.id);
2924
+ return serializeLinearOutput(entity);
2925
+ }, {
2926
+ name: "Get Document",
2927
+ params,
2928
+ properties: [
2929
+ {
2930
+ label: "Document ID",
2931
+ text: params.id
2932
+ }
2933
+ ]
2934
+ });
2935
+ }
2936
+ documents(key, params) {
2937
+ return this.runTask(key, async (client) => {
2938
+ const edges = await client.documents(params);
2939
+ return serializeLinearOutput(edges);
2940
+ }, {
2941
+ name: "Get Documents",
2942
+ params,
2943
+ properties: queryProperties(params)
2944
+ });
2945
+ }
2946
+ createDocument(key, params) {
2947
+ return this.runTask(key, async (client) => {
2948
+ const payload = await client.createDocument(params);
2949
+ return serializeLinearOutput(await payload.document);
2950
+ }, {
2951
+ name: "Create Document",
2952
+ params,
2953
+ properties: [
2954
+ {
2955
+ label: "Project ID",
2956
+ text: params.projectId
2957
+ },
2958
+ {
2959
+ label: "Title",
2960
+ text: params.title
2961
+ }
2962
+ ]
2963
+ });
2964
+ }
2965
+ searchDocuments(key, params) {
2966
+ return this.runTask(key, async (client) => {
2967
+ const payload = await client.searchDocuments(params.term, params.variables);
2968
+ return serializeLinearOutput(payload);
2969
+ }, {
2970
+ name: "Search Documents",
2971
+ params,
2972
+ properties: [
2973
+ {
2974
+ label: "Search Term",
2975
+ text: params.term
2976
+ }
2977
+ ]
2978
+ });
2979
+ }
2980
+ favorite(key, params) {
2981
+ return this.runTask(key, async (client) => {
2982
+ const entity = await client.favorite(params.id);
2983
+ return serializeLinearOutput(entity);
2984
+ }, {
2985
+ name: "Get Favorite",
2986
+ params,
2987
+ properties: [
2988
+ {
2989
+ label: "Favorite ID",
2990
+ text: params.id
2991
+ }
2992
+ ]
2993
+ });
2994
+ }
2995
+ favorites(key, params = {}) {
2996
+ return this.runTask(key, async (client) => {
2997
+ const edges = await client.favorites(params);
2998
+ return serializeLinearOutput(edges);
2999
+ }, {
3000
+ name: "Get Favorites",
3001
+ params,
3002
+ properties: queryProperties(params)
3003
+ });
3004
+ }
3005
+ createFavorite(key, params) {
3006
+ return this.runTask(key, async (client) => {
3007
+ const payload = await client.createFavorite(params);
3008
+ return serializeLinearOutput(await payload.favorite);
3009
+ }, {
3010
+ name: "Create Favorite",
3011
+ params
3012
+ });
3013
+ }
3014
+ issue(key, params) {
3015
+ return this.runTask(key, async (client) => {
3016
+ const entity = await client.issue(params.id);
3017
+ return serializeLinearOutput(entity);
3018
+ }, {
3019
+ name: "Get Issue",
3020
+ params,
3021
+ properties: [
3022
+ {
3023
+ label: "Issue ID",
3024
+ text: params.id
3025
+ }
3026
+ ]
3027
+ });
3028
+ }
3029
+ issues(key, params = {}) {
3030
+ return this.runTask(key, async (client) => {
3031
+ const edges = await client.issues(params);
3032
+ return serializeLinearOutput(edges);
3033
+ }, {
3034
+ name: "Get Issues",
3035
+ params,
3036
+ properties: queryProperties(params)
3037
+ });
3038
+ }
3039
+ archiveIssue(key, params) {
3040
+ return this.runTask(key, async (client) => {
3041
+ const payload = await client.archiveIssue(params.id, params.variables);
3042
+ return serializeLinearOutput({
3043
+ ...payload,
3044
+ entity: await payload.entity
3045
+ });
3046
+ }, {
3047
+ name: "Archive Issue",
3048
+ params,
3049
+ properties: [
3050
+ {
3051
+ label: "Issue ID",
3052
+ text: params.id
3053
+ }
3054
+ ]
3055
+ });
3056
+ }
3057
+ createIssue(key, params) {
3058
+ return this.runTask(key, async (client) => {
3059
+ const payload = await client.createIssue(params);
3060
+ return serializeLinearOutput(await payload.issue);
3061
+ }, {
3062
+ name: "Create Issue",
3063
+ params,
3064
+ properties: [
3065
+ {
3066
+ label: "Team ID",
3067
+ text: params.teamId
3068
+ },
3069
+ {
3070
+ label: "Title",
3071
+ text: params.title
3072
+ }
3073
+ ]
3074
+ });
3075
+ }
3076
+ deleteIssue(key, params) {
3077
+ return this.runTask(key, async (client) => {
3078
+ const payload = await client.deleteIssue(params.id);
3079
+ return serializeLinearOutput(await payload.entity);
3080
+ }, {
3081
+ name: "Delete Issue",
3082
+ params,
3083
+ properties: [
3084
+ {
3085
+ label: "Issue ID",
3086
+ text: params.id
3087
+ }
3088
+ ]
3089
+ });
3090
+ }
3091
+ searchIssues(key, params) {
3092
+ return this.runTask(key, async (client) => {
3093
+ const payload = await client.searchIssues(params.term, params.variables);
3094
+ return serializeLinearOutput(payload);
3095
+ }, {
3096
+ name: "Search Issues",
3097
+ params,
3098
+ properties: [
3099
+ {
3100
+ label: "Search Term",
3101
+ text: params.term
3102
+ }
3103
+ ]
3104
+ });
3105
+ }
3106
+ updateIssue(key, params) {
3107
+ return this.runTask(key, async (client) => {
3108
+ const payload = await client.updateIssue(params.id, params.input);
3109
+ return serializeLinearOutput(await payload.issue);
3110
+ }, {
3111
+ name: "Update Issue",
3112
+ params,
3113
+ properties: [
3114
+ {
3115
+ label: "Issue ID",
3116
+ text: params.id
3117
+ }
3118
+ ]
3119
+ });
3120
+ }
3121
+ issueLabel(key, params) {
3122
+ return this.runTask(key, async (client) => {
3123
+ const entity = await client.issueLabel(params.id);
3124
+ return serializeLinearOutput(entity);
3125
+ }, {
3126
+ name: "Get IssueLabel",
3127
+ params,
3128
+ properties: [
3129
+ {
3130
+ label: "IssueLabel ID",
3131
+ text: params.id
3132
+ }
3133
+ ]
3134
+ });
3135
+ }
3136
+ issueLabels(key, params = {}) {
3137
+ return this.runTask(key, async (client) => {
3138
+ const edges = await client.issueLabels(params);
3139
+ return serializeLinearOutput(edges);
3140
+ }, {
3141
+ name: "Get IssueLabels",
3142
+ params,
3143
+ properties: queryProperties(params)
3144
+ });
3145
+ }
3146
+ createIssueLabel(key, params) {
3147
+ return this.runTask(key, async (client) => {
3148
+ const payload = await client.createIssueLabel(params);
3149
+ return serializeLinearOutput(await payload.issueLabel);
3150
+ }, {
3151
+ name: "Create IssueLabel",
3152
+ params,
3153
+ properties: [
3154
+ {
3155
+ label: "Label name",
3156
+ text: params.name
3157
+ }
3158
+ ]
3159
+ });
3160
+ }
3161
+ deleteIssueLabel(key, params) {
3162
+ return this.runTask(key, (client) => client.deleteIssueLabel(params.id), {
3163
+ name: "Delete IssueLabel",
3164
+ params,
3165
+ properties: [
3166
+ {
3167
+ label: "Label ID",
3168
+ text: params.id
3169
+ }
3170
+ ]
3171
+ });
3172
+ }
3173
+ updateIssueLabel(key, params) {
3174
+ return this.runTask(key, async (client) => {
3175
+ const payload = await client.updateIssueLabel(params.id, params.input);
3176
+ return serializeLinearOutput(await payload.issueLabel);
3177
+ }, {
3178
+ name: "Update IssueLabel",
3179
+ params,
3180
+ properties: [
3181
+ {
3182
+ label: "Label ID",
3183
+ text: params.id
3184
+ }
3185
+ ]
3186
+ });
3187
+ }
3188
+ issuePriorityValues(key) {
3189
+ return this.runTask(key, async (client) => {
3190
+ const entity = await client.issuePriorityValues;
3191
+ return serializeLinearOutput(entity);
3192
+ }, {
3193
+ name: "Get Issue Priority Values"
3194
+ });
3195
+ }
3196
+ issueRelation(key, params) {
3197
+ return this.runTask(key, async (client) => {
3198
+ const entity = await client.issueRelation(params.id);
3199
+ return serializeLinearOutput(entity);
3200
+ }, {
3201
+ name: "Get IssueRelation",
3202
+ params,
3203
+ properties: [
3204
+ {
3205
+ label: "IssueRelation ID",
3206
+ text: params.id
3207
+ }
3208
+ ]
3209
+ });
3210
+ }
3211
+ issueRelations(key, params = {}) {
3212
+ return this.runTask(key, async (client) => {
3213
+ const edges = await client.issueRelations(params);
3214
+ return serializeLinearOutput(edges);
3215
+ }, {
3216
+ name: "Get IssueRelations",
3217
+ params,
3218
+ properties: queryProperties(params)
3219
+ });
3220
+ }
3221
+ createIssueRelation(key, params) {
3222
+ return this.runTask(key, async (client) => {
3223
+ const payload = await client.createIssueRelation(params);
3224
+ return serializeLinearOutput(await payload.issueRelation);
3225
+ }, {
3226
+ name: "Create IssueRelation",
3227
+ params,
3228
+ properties: [
3229
+ {
3230
+ label: "Issue ID",
3231
+ text: params.issueId
3232
+ },
3233
+ {
3234
+ label: "Related Issue ID",
3235
+ text: params.relatedIssueId
3236
+ },
3237
+ {
3238
+ label: "Relation Type",
3239
+ text: params.type
3240
+ }
3241
+ ]
3242
+ });
3243
+ }
3244
+ notification(key, params) {
3245
+ return this.runTask(key, async (client) => {
3246
+ const entity = await client.notification(params.id);
3247
+ return serializeLinearOutput(entity);
3248
+ }, {
3249
+ name: "Get Notification",
3250
+ params,
3251
+ properties: [
3252
+ {
3253
+ label: "Notification ID",
3254
+ text: params.id
3255
+ }
3256
+ ]
3257
+ });
3258
+ }
3259
+ notifications(key, params = {}) {
3260
+ return this.runTask(key, async (client) => {
3261
+ const edges = await client.notifications(params);
3262
+ return serializeLinearOutput(edges);
3263
+ }, {
3264
+ name: "Get Notifications",
3265
+ params,
3266
+ properties: queryProperties(params)
3267
+ });
3268
+ }
3269
+ archiveNotification(key, params) {
3270
+ return this.runTask(key, async (client) => {
3271
+ const payload = await client.archiveNotification(params.id);
3272
+ return serializeLinearOutput(payload);
3273
+ }, {
3274
+ name: "Archive Notification",
3275
+ params,
3276
+ properties: [
3277
+ {
3278
+ label: "Notification ID",
3279
+ text: params.id
3280
+ }
3281
+ ]
3282
+ });
3283
+ }
3284
+ createNotificationSubscription(key, params) {
3285
+ return this.runTask(key, async (client) => {
3286
+ const payload = await client.createNotificationSubscription(params.input);
3287
+ return serializeLinearOutput(payload);
3288
+ }, {
3289
+ name: "Create Notification Subscription",
3290
+ params
3291
+ });
3292
+ }
3293
+ organization(key) {
3294
+ return this.runTask(key, async (client) => {
3295
+ const entity = await client.organization;
3296
+ return serializeLinearOutput(entity);
3297
+ }, {
3298
+ name: "Get Viewer's Organization"
3299
+ });
3300
+ }
3301
+ createOrganizationFromOnboarding(key, params) {
3302
+ return this.runTask(key, async (client) => {
3303
+ const payload = await client.createOrganizationFromOnboarding(params.input, params.variables);
3304
+ return serializeLinearOutput(await payload.organization);
3305
+ }, {
3306
+ name: "Create Organization",
3307
+ params,
3308
+ properties: [
3309
+ {
3310
+ label: "Name",
3311
+ text: params.input.name
3312
+ },
3313
+ {
3314
+ label: "URL Key",
3315
+ text: params.input.urlKey
3316
+ }
3317
+ ]
3318
+ });
3319
+ }
3320
+ /** WARNING: Causes internal server errors on Linear's side, regardless of input. */
3321
+ createOrganizationInvite(key, params) {
3322
+ return this.runTask(key, async (client) => {
3323
+ const payload = await client.createOrganizationInvite(params.input);
3324
+ return serializeLinearOutput(await payload.organizationInvite);
3325
+ }, {
3326
+ name: "Create Organization Invite",
3327
+ params,
3328
+ properties: [
3329
+ {
3330
+ label: "Invitee Email",
3331
+ text: params.input.email
3332
+ }
3333
+ ]
3334
+ });
3335
+ }
3336
+ project(key, params) {
3337
+ return this.runTask(key, async (client) => {
3338
+ const entity = await client.project(params.id);
3339
+ return serializeLinearOutput(entity);
3340
+ }, {
3341
+ name: "Get Project",
3342
+ params,
3343
+ properties: [
3344
+ {
3345
+ label: "Project ID",
3346
+ text: params.id
3347
+ }
3348
+ ]
3349
+ });
3350
+ }
3351
+ projects(key, params = {}) {
3352
+ return this.runTask(key, async (client) => {
3353
+ const edges = await client.projects(params);
3354
+ return serializeLinearOutput(edges);
3355
+ }, {
3356
+ name: "Get Projects",
3357
+ params,
3358
+ properties: queryProperties(params)
3359
+ });
3360
+ }
3361
+ archiveProject(key, params) {
3362
+ return this.runTask(key, async (client) => {
3363
+ const payload = await client.archiveProject(params.id, params.variables);
3364
+ return serializeLinearOutput({
3365
+ ...payload,
3366
+ entity: await payload.entity
3367
+ });
3368
+ }, {
3369
+ name: "Archive Project",
3370
+ params,
3371
+ properties: [
3372
+ {
3373
+ label: "Project ID",
3374
+ text: params.id
3375
+ }
3376
+ ]
3377
+ });
3378
+ }
3379
+ createProject(key, params) {
3380
+ return this.runTask(key, async (client) => {
3381
+ const payload = await client.createProject(params);
3382
+ return serializeLinearOutput(await payload.project);
3383
+ }, {
3384
+ name: "Create Project",
3385
+ params,
3386
+ properties: [
3387
+ {
3388
+ label: "Team IDs",
3389
+ text: params.teamIds.join(", ")
3390
+ },
3391
+ {
3392
+ label: "Project name",
3393
+ text: params.name
3394
+ }
3395
+ ]
3396
+ });
3397
+ }
3398
+ deleteProject(key, params) {
3399
+ return this.runTask(key, async (client) => {
3400
+ const payload = await client.deleteProject(params.id);
3401
+ return serializeLinearOutput(await payload.entity);
3402
+ }, {
3403
+ name: "Delete Project",
3404
+ params,
3405
+ properties: [
3406
+ {
3407
+ label: "Project ID",
3408
+ text: params.id
3409
+ }
3410
+ ]
3411
+ });
3412
+ }
3413
+ searchProjects(key, params) {
3414
+ return this.runTask(key, async (client) => {
3415
+ const payload = await client.searchProjects(params.term, params.variables);
3416
+ return serializeLinearOutput(payload);
3417
+ }, {
3418
+ name: "Search Projects",
3419
+ params,
3420
+ properties: [
3421
+ {
3422
+ label: "Search Term",
3423
+ text: params.term
3424
+ }
3425
+ ]
3426
+ });
3427
+ }
3428
+ updateProject(key, params) {
3429
+ return this.runTask(key, async (client) => {
3430
+ const payload = await client.updateProject(params.id, params.input);
3431
+ return serializeLinearOutput(await payload.project);
3432
+ }, {
3433
+ name: "Update Project",
3434
+ params,
3435
+ properties: [
3436
+ {
3437
+ label: "Project ID",
3438
+ text: params.id
3439
+ }
3440
+ ]
3441
+ });
3442
+ }
3443
+ projectLink(key, params) {
3444
+ return this.runTask(key, async (client) => {
3445
+ const entity = await client.projectLink(params.id);
3446
+ return serializeLinearOutput(entity);
3447
+ }, {
3448
+ name: "Get ProjectLink",
3449
+ params,
3450
+ properties: [
3451
+ {
3452
+ label: "ProjectLink ID",
3453
+ text: params.id
3454
+ }
3455
+ ]
3456
+ });
3457
+ }
3458
+ projectLinks(key, params = {}) {
3459
+ return this.runTask(key, async (client) => {
3460
+ const edges = await client.projectLinks(params);
3461
+ return serializeLinearOutput(edges);
3462
+ }, {
3463
+ name: "Get ProjectLinks",
3464
+ params,
3465
+ properties: queryProperties(params)
3466
+ });
3467
+ }
3468
+ createProjectLink(key, params) {
3469
+ return this.runTask(key, async (client) => {
3470
+ const payload = await client.createProjectLink(params);
3471
+ return serializeLinearOutput(await payload.projectLink);
3472
+ }, {
3473
+ name: "Create ProjectLink",
3474
+ params,
3475
+ properties: [
3476
+ {
3477
+ label: "Project ID",
3478
+ text: params.projectId
3479
+ },
3480
+ {
3481
+ label: "Link Label",
3482
+ text: params.label
3483
+ },
3484
+ {
3485
+ label: "Link URL",
3486
+ text: params.url
3487
+ }
3488
+ ]
3489
+ });
3490
+ }
3491
+ createProjectMilestone(key, params) {
3492
+ return this.runTask(key, async (client) => {
3493
+ const payload = await client.createProjectMilestone(params);
3494
+ return serializeLinearOutput(await payload.projectMilestone);
3495
+ }, {
3496
+ name: "Create ProjectMilestone",
3497
+ params,
3498
+ properties: [
3499
+ {
3500
+ label: "Project ID",
3501
+ text: params.projectId
3502
+ },
3503
+ {
3504
+ label: "Milestone Name",
3505
+ text: params.name
3506
+ }
3507
+ ]
3508
+ });
3509
+ }
3510
+ projectUpdate(key, params) {
3511
+ return this.runTask(key, async (client) => {
3512
+ const entity = await client.projectUpdate(params.id);
3513
+ return serializeLinearOutput(entity);
3514
+ }, {
3515
+ name: "Get ProjectUpdate",
3516
+ params,
3517
+ properties: [
3518
+ {
3519
+ label: "ProjectUpdate ID",
3520
+ text: params.id
3521
+ }
3522
+ ]
3523
+ });
3524
+ }
3525
+ projectUpdates(key, params = {}) {
3526
+ return this.runTask(key, async (client) => {
3527
+ const edges = await client.projectUpdates(params);
3528
+ return serializeLinearOutput(edges);
3529
+ }, {
3530
+ name: "Get ProjectUpdates",
3531
+ params,
3532
+ properties: queryProperties(params)
3533
+ });
3534
+ }
3535
+ createProjectUpdate(key, params) {
3536
+ return this.runTask(key, async (client) => {
3537
+ const payload = await client.createProjectUpdate(params);
3538
+ return serializeLinearOutput(await payload.projectUpdate);
3539
+ }, {
3540
+ name: "Create ProjectUpdate",
3541
+ params,
3542
+ properties: [
3543
+ {
3544
+ label: "Project ID",
3545
+ text: params.projectId
3546
+ }
3547
+ ]
3548
+ });
3549
+ }
3550
+ deleteProjectUpdate(key, params) {
3551
+ return this.runTask(key, (client) => client.deleteProjectUpdate(params.id), {
3552
+ name: "Delete ProjectUpdate",
3553
+ params,
3554
+ properties: [
3555
+ {
3556
+ label: "ProjectUpdate ID",
3557
+ text: params.id
3558
+ }
3559
+ ]
3560
+ });
3561
+ }
3562
+ updateProjectUpdate(key, params) {
3563
+ return this.runTask(key, async (client) => {
3564
+ const payload = await client.updateProjectUpdate(params.id, params.input);
3565
+ return serializeLinearOutput(await payload.projectUpdate);
3566
+ }, {
3567
+ name: "Update ProjectUpdate",
3568
+ params,
3569
+ properties: [
3570
+ {
3571
+ label: "ProjectUpdate ID",
3572
+ text: params.id
3573
+ }
3574
+ ]
3575
+ });
3576
+ }
3577
+ createReaction(key, params) {
3578
+ return this.runTask(key, async (client) => {
3579
+ const payload = await client.createReaction(params);
3580
+ return serializeLinearOutput(await payload.reaction);
3581
+ }, {
3582
+ name: "Create Reaction",
3583
+ params,
3584
+ properties: [
3585
+ ...params.commentId ? [
3586
+ {
3587
+ label: "Comment ID",
3588
+ text: params.commentId
3589
+ }
3590
+ ] : [],
3591
+ ...params.issueId ? [
3592
+ {
3593
+ label: "Issue ID",
3594
+ text: params.issueId
3595
+ }
3596
+ ] : [],
3597
+ ...params.projectUpdateId ? [
3598
+ {
3599
+ label: "ProjectUpdate ID",
3600
+ text: params.projectUpdateId
3601
+ }
3602
+ ] : [],
3603
+ {
3604
+ label: "Emoji",
3605
+ text: params.emoji
3606
+ }
3607
+ ]
3608
+ });
3609
+ }
3610
+ deleteReaction(key, params) {
3611
+ return this.runTask(key, (client) => client.deleteReaction(params.id), {
3612
+ name: "Delete Reaction",
3613
+ params,
3614
+ properties: [
3615
+ {
3616
+ label: "Reaction ID",
3617
+ text: params.id
3618
+ }
3619
+ ]
3620
+ });
3621
+ }
3622
+ archiveRoadmap(key, params) {
3623
+ return this.runTask(key, async (client) => {
3624
+ const payload = await client.archiveRoadmap(params.id);
3625
+ return serializeLinearOutput({
3626
+ ...payload,
3627
+ entity: await payload.entity
3628
+ });
3629
+ }, {
3630
+ name: "Archive Roadmap",
3631
+ params,
3632
+ properties: [
3633
+ {
3634
+ label: "Roadmap ID",
3635
+ text: params.id
3636
+ }
3637
+ ]
3638
+ });
3639
+ }
3640
+ createRoadmap(key, params) {
3641
+ return this.runTask(key, async (client) => {
3642
+ const payload = await client.createRoadmap(params);
3643
+ return serializeLinearOutput(await payload.roadmap);
3644
+ }, {
3645
+ name: "Create Roadmap",
3646
+ params,
3647
+ properties: [
3648
+ {
3649
+ label: "Roadmap Name",
3650
+ text: params.name
3651
+ }
3652
+ ]
3653
+ });
3654
+ }
3655
+ team(key, params) {
3656
+ return this.runTask(key, async (client) => {
3657
+ const entity = await client.team(params.id);
3658
+ return serializeLinearOutput(entity);
3659
+ }, {
3660
+ name: "Get Team",
3661
+ params,
3662
+ properties: [
3663
+ {
3664
+ label: "Team ID",
3665
+ text: params.id
3666
+ }
3667
+ ]
3668
+ });
3669
+ }
3670
+ teams(key, params = {}) {
3671
+ return this.runTask(key, async (client) => {
3672
+ const edges = await client.teams(params);
3673
+ return serializeLinearOutput(edges);
3674
+ }, {
3675
+ name: "Get Teams",
3676
+ params,
3677
+ properties: queryProperties(params)
3678
+ });
3679
+ }
3680
+ createTeam(key, params) {
3681
+ return this.runTask(key, async (client) => {
3682
+ const payload = await client.createTeam(params);
3683
+ return serializeLinearOutput(await payload.team);
3684
+ }, {
3685
+ name: "Create Team",
3686
+ params,
3687
+ properties: [
3688
+ {
3689
+ label: "Team Name",
3690
+ text: params.name
3691
+ }
3692
+ ]
3693
+ });
3694
+ }
3695
+ teamMembership(key, params) {
3696
+ return this.runTask(key, async (client) => {
3697
+ const entity = await client.teamMembership(params.id);
3698
+ return serializeLinearOutput(entity);
3699
+ }, {
3700
+ name: "Get TeamMembership",
3701
+ params,
3702
+ properties: [
3703
+ {
3704
+ label: "TeamMembership ID",
3705
+ text: params.id
3706
+ }
3707
+ ]
3708
+ });
3709
+ }
3710
+ teamMemberships(key, params = {}) {
3711
+ return this.runTask(key, async (client) => {
3712
+ const edges = await client.teamMemberships(params);
3713
+ return serializeLinearOutput(edges);
3714
+ }, {
3715
+ name: "Get TeamMemberships",
3716
+ params,
3717
+ properties: queryProperties(params)
3718
+ });
3719
+ }
3720
+ createTeamMembership(key, params) {
3721
+ return this.runTask(key, async (client) => {
3722
+ const payload = await client.createTeamMembership(params);
3723
+ return serializeLinearOutput(await payload.teamMembership);
3724
+ }, {
3725
+ name: "Create TeamMembership",
3726
+ params,
3727
+ properties: [
3728
+ {
3729
+ label: "Team ID",
3730
+ text: params.teamId
3731
+ },
3732
+ {
3733
+ label: "User ID",
3734
+ text: params.userId
3735
+ }
3736
+ ]
3737
+ });
3738
+ }
3739
+ template(key, params) {
3740
+ return this.runTask(key, async (client) => {
3741
+ const entity = await client.template(params.id);
3742
+ return serializeLinearOutput(entity);
3743
+ }, {
3744
+ name: "Get Template",
3745
+ properties: [
3746
+ {
3747
+ label: "Template ID",
3748
+ text: params.id
3749
+ }
3750
+ ]
3751
+ });
3752
+ }
3753
+ templates(key) {
3754
+ return this.runTask(key, async (client) => {
3755
+ const entity = await client.templates;
3756
+ return serializeLinearOutput(entity);
3757
+ }, {
3758
+ name: "Get Templates"
3759
+ });
3760
+ }
3761
+ user(key, params) {
3762
+ return this.runTask(key, async (client) => {
3763
+ const entity = await client.user(params.id);
3764
+ return serializeLinearOutput(entity);
3765
+ }, {
3766
+ name: "Get User",
3767
+ params,
3768
+ properties: [
3769
+ {
3770
+ label: "User ID",
3771
+ text: params.id
3772
+ }
3773
+ ]
3774
+ });
3775
+ }
3776
+ users(key, params = {}) {
3777
+ return this.runTask(key, async (client) => {
3778
+ const edges = await client.users(params);
3779
+ return serializeLinearOutput(edges);
3780
+ }, {
3781
+ name: "Get Users",
3782
+ params,
3783
+ properties: queryProperties(params)
3784
+ });
3785
+ }
3786
+ updateUser(key, params) {
3787
+ return this.runTask(key, async (client) => {
3788
+ const payload = await client.updateUser(params.id, params.input);
3789
+ return serializeLinearOutput(await payload.user);
3790
+ }, {
3791
+ name: "Update User",
3792
+ params,
3793
+ properties: [
3794
+ {
3795
+ label: "User ID",
3796
+ text: params.id
3797
+ }
3798
+ ]
3799
+ });
3800
+ }
3801
+ viewer(key) {
3802
+ return this.runTask(key, async (client) => {
3803
+ const entity = await client.viewer;
3804
+ return serializeLinearOutput(entity);
3805
+ }, {
3806
+ name: "Get Viewer"
3807
+ });
3808
+ }
3809
+ workflowState(key, params) {
3810
+ return this.runTask(key, async (client) => {
3811
+ const entity = await client.workflowState(params.id);
3812
+ return serializeLinearOutput(entity);
3813
+ }, {
3814
+ name: "Get WorkflowState",
3815
+ params,
3816
+ properties: [
3817
+ {
3818
+ label: "WorkflowState ID",
3819
+ text: params.id
3820
+ }
3821
+ ]
3822
+ });
3823
+ }
3824
+ workflowStates(key, params = {}) {
3825
+ return this.runTask(key, async (client) => {
3826
+ const edges = await client.workflowStates(params);
3827
+ return serializeLinearOutput(edges);
3828
+ }, {
3829
+ name: "Get WorkflowStates",
3830
+ params,
3831
+ properties: queryProperties(params)
3832
+ });
3833
+ }
3834
+ archiveWorkflowState(key, params) {
3835
+ return this.runTask(key, async (client) => {
3836
+ const payload = await client.archiveWorkflowState(params.id);
3837
+ return serializeLinearOutput({
3838
+ ...payload,
3839
+ entity: await payload.entity
3840
+ });
3841
+ }, {
3842
+ name: "Archive WorkflowState",
3843
+ params,
3844
+ properties: [
3845
+ {
3846
+ label: "WorkflowState ID",
3847
+ text: params.id
3848
+ }
3849
+ ]
3850
+ });
3851
+ }
3852
+ createWorkflowState(key, params) {
3853
+ return this.runTask(key, async (client) => {
3854
+ const payload = await client.createWorkflowState(params);
3855
+ return serializeLinearOutput(await payload.workflowState);
3856
+ }, {
3857
+ name: "Create WorkflowState",
3858
+ params,
3859
+ properties: [
3860
+ {
3861
+ label: "Team ID",
3862
+ text: params.teamId
3863
+ },
3864
+ {
3865
+ label: "Workflow Type",
3866
+ text: params.type
3867
+ },
3868
+ {
3869
+ label: "State Name",
3870
+ text: params.name
3871
+ },
3872
+ {
3873
+ label: "State Color",
3874
+ text: params.color
3875
+ }
3876
+ ]
3877
+ });
3878
+ }
3879
+ // updateReaction() does not exist
3880
+ /** **WARNING:** Still in alpha - use with caution! */
3881
+ onAttachment(params = {}) {
3882
+ return createTrigger(this.source, onAttachment, params);
3883
+ }
3884
+ /** **WARNING:** Still in alpha - use with caution! */
3885
+ onAttachmentCreated(params = {}) {
3886
+ return createTrigger(this.source, onAttachmentCreated, params);
3887
+ }
3888
+ /** **WARNING:** Still in alpha - use with caution! */
3889
+ onAttachmentRemoved(params = {}) {
3890
+ return createTrigger(this.source, onAttachmentRemoved, params);
3891
+ }
3892
+ /** **WARNING:** Still in alpha - use with caution! */
3893
+ onAttachmentUpdated(params = {}) {
3894
+ return createTrigger(this.source, onAttachmentUpdated, params);
3895
+ }
3896
+ onComment(params = {}) {
3897
+ return createTrigger(this.source, onComment, params);
3898
+ }
3899
+ onCommentCreated(params = {}) {
3900
+ return createTrigger(this.source, onCommentCreated, params);
3901
+ }
3902
+ onCommentRemoved(params = {}) {
3903
+ return createTrigger(this.source, onCommentRemoved, params);
3904
+ }
3905
+ onCommentUpdated(params = {}) {
3906
+ return createTrigger(this.source, onCommentUpdated, params);
3907
+ }
3908
+ onCycle(params = {}) {
3909
+ return createTrigger(this.source, onCycle, params);
3910
+ }
3911
+ onCycleCreated(params = {}) {
3912
+ return createTrigger(this.source, onCycleCreated, params);
3913
+ }
3914
+ onCycleRemoved(params = {}) {
3915
+ return createTrigger(this.source, onCycleRemoved, params);
3916
+ }
3917
+ onCycleUpdated(params = {}) {
3918
+ return createTrigger(this.source, onCycleUpdated, params);
3919
+ }
3920
+ onIssue(params = {}) {
3921
+ return createTrigger(this.source, onIssue, params);
3922
+ }
3923
+ onIssueCreated(params = {}) {
3924
+ return createTrigger(this.source, onIssueCreated, params);
3925
+ }
3926
+ onIssueRemoved(params = {}) {
3927
+ return createTrigger(this.source, onIssueRemoved, params);
3928
+ }
3929
+ onIssueUpdated(params = {}) {
3930
+ return createTrigger(this.source, onIssueUpdated, params);
3931
+ }
3932
+ onIssueLabel(params = {}) {
3933
+ return createTrigger(this.source, onIssueLabel, params);
3934
+ }
3935
+ onIssueLabelCreated(params = {}) {
3936
+ return createTrigger(this.source, onIssueLabelCreated, params);
3937
+ }
3938
+ onIssueLabelRemoved(params = {}) {
3939
+ return createTrigger(this.source, onIssueLabelRemoved, params);
3940
+ }
3941
+ onIssueLabelUpdated(params = {}) {
3942
+ return createTrigger(this.source, onIssueLabelUpdated, params);
3943
+ }
3944
+ onIssueSLA(params = {}) {
3945
+ return createTrigger(this.source, onIssueSLA, params);
3946
+ }
3947
+ onIssueSLASet(params = {}) {
3948
+ return createTrigger(this.source, onIssueSLASet, params);
3949
+ }
3950
+ onIssueSLABreached(params = {}) {
3951
+ return createTrigger(this.source, onIssueSLABreached, params);
3952
+ }
3953
+ onIssueSLAHighRisk(params = {}) {
3954
+ return createTrigger(this.source, onIssueSLAHighRisk, params);
3955
+ }
3956
+ onProject(params = {}) {
3957
+ return createTrigger(this.source, onProject, params);
3958
+ }
3959
+ onProjectCreated(params = {}) {
3960
+ return createTrigger(this.source, onProjectCreated, params);
3961
+ }
3962
+ onProjectRemoved(params = {}) {
3963
+ return createTrigger(this.source, onProjectRemoved, params);
3964
+ }
3965
+ onProjectUpdated(params = {}) {
3966
+ return createTrigger(this.source, onProjectUpdated, params);
3967
+ }
3968
+ onProjectUpdate(params = {}) {
3969
+ return createTrigger(this.source, onProjectUpdate, params);
3970
+ }
3971
+ onProjectUpdateCreated(params = {}) {
3972
+ return createTrigger(this.source, onProjectUpdateCreated, params);
3973
+ }
3974
+ onProjectUpdateRemoved(params = {}) {
3975
+ return createTrigger(this.source, onProjectUpdateRemoved, params);
3976
+ }
3977
+ onProjectUpdateUpdated(params = {}) {
3978
+ return createTrigger(this.source, onProjectUpdateUpdated, params);
3979
+ }
3980
+ onReaction(params = {}) {
3981
+ return createTrigger(this.source, onReaction, params);
3982
+ }
3983
+ onReactionCreated(params = {}) {
3984
+ return createTrigger(this.source, onReactionCreated, params);
3985
+ }
3986
+ onReactionRemoved(params = {}) {
3987
+ return createTrigger(this.source, onReactionRemoved, params);
3988
+ }
3989
+ /** Good luck ever triggering this! */
3990
+ onReactionUpdated(params = {}) {
3991
+ return createTrigger(this.source, onReactionUpdated, params);
3992
+ }
3993
+ };
3994
+ _webhooks = new WeakSet();
3995
+ webhooks_get = /* @__PURE__ */ __name(function() {
3996
+ return new Webhooks(this.runTask.bind(this));
3997
+ }, "#webhooks");
3998
+ __name(_Linear, "Linear");
3999
+ var Linear = _Linear;
4000
+ function onError(error) {
4001
+ if (error instanceof LinearError) {
4002
+ if (error.errors?.some((e) => e.userError)) {
4003
+ return {
4004
+ skipRetrying: true
4005
+ };
4006
+ }
4007
+ }
4008
+ if (!(error instanceof RatelimitedLinearError)) {
4009
+ return;
4010
+ }
4011
+ const rateLimitRemaining = error.raw?.response?.headers?.get("X-RateLimit-Requests-Remaining");
4012
+ const rateLimitReset = error.raw?.response?.headers?.get("X-RateLimit-Requests-Reset");
4013
+ if (rateLimitRemaining === "0" && rateLimitReset) {
4014
+ const resetDate = new Date(Number(rateLimitReset) * 1e3);
4015
+ return {
4016
+ retryAt: resetDate,
4017
+ error
4018
+ };
4019
+ }
4020
+ const queryComplexity = error.raw?.response?.headers?.get("X-Complexity");
4021
+ const complexityRemaining = error.raw?.response?.headers?.get("X-RateLimit-Complexity-Remaining");
4022
+ const complexityReset = error.raw?.response?.headers?.get("X-RateLimit-Complexity-Reset");
4023
+ if ((complexityRemaining === "0" || Number(complexityRemaining) < Number(queryComplexity)) && complexityReset) {
4024
+ const resetDate = new Date(Number(complexityReset) * 1e3);
4025
+ return {
4026
+ retryAt: resetDate,
4027
+ error
4028
+ };
4029
+ }
4030
+ }
4031
+ __name(onError, "onError");
4032
+ var serializeLinearOutput = /* @__PURE__ */ __name((obj) => {
4033
+ return JSON.parse(JSON.stringify(obj), (key, value) => {
4034
+ if (typeof value === "function" || key.startsWith("_")) {
4035
+ return void 0;
4036
+ }
4037
+ return value;
4038
+ });
4039
+ }, "serializeLinearOutput");
4040
+ var PaginationOrderBy = LinearDocument.PaginationOrderBy;
4041
+
4042
+ export { Linear, PaginationOrderBy, events_exports as events, onError, serializeLinearOutput };
4043
+ //# sourceMappingURL=out.js.map
4044
+ //# sourceMappingURL=index.mjs.map