@trigger.dev/linear 0.0.0-prerelease-20231013155033 → 0.0.0-prerelease-20231206103411

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