@trigger.dev/linear 0.0.0-auto-yield-20231011151933

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