@trigger.dev/linear 0.0.0-airtable-fix-20231207124630

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