@trigger.dev/linear 3.3.11 → 4.8.0-webhooks.20261015065339

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