@corsair-dev/linear 0.1.0
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/LICENSE +191 -0
- package/dist/client.d.ts +32 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/endpoints/comments.d.ts +6 -0
- package/dist/endpoints/comments.d.ts.map +1 -0
- package/dist/endpoints/index.d.ts +1515 -0
- package/dist/endpoints/index.d.ts.map +1 -0
- package/dist/endpoints/issues.d.ts +7 -0
- package/dist/endpoints/issues.d.ts.map +1 -0
- package/dist/endpoints/projects.d.ts +7 -0
- package/dist/endpoints/projects.d.ts.map +1 -0
- package/dist/endpoints/teams.d.ts +4 -0
- package/dist/endpoints/teams.d.ts.map +1 -0
- package/dist/endpoints/types.d.ts +8804 -0
- package/dist/endpoints/types.d.ts.map +1 -0
- package/dist/endpoints/users.d.ts +4 -0
- package/dist/endpoints/users.d.ts.map +1 -0
- package/dist/error-handlers.d.ts +46 -0
- package/dist/error-handlers.d.ts.map +1 -0
- package/dist/index.d.ts +6195 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +548 -0
- package/dist/schema/database.d.ts +234 -0
- package/dist/schema/database.d.ts.map +1 -0
- package/dist/schema/index.d.ts +233 -0
- package/dist/schema/index.d.ts.map +1 -0
- package/dist/tsup.config.d.ts +3 -0
- package/dist/tsup.config.d.ts.map +1 -0
- package/dist/webhooks/comments.d.ts +5 -0
- package/dist/webhooks/comments.d.ts.map +1 -0
- package/dist/webhooks/index.d.ts +654 -0
- package/dist/webhooks/index.d.ts.map +1 -0
- package/dist/webhooks/issues.d.ts +5 -0
- package/dist/webhooks/issues.d.ts.map +1 -0
- package/dist/webhooks/projects.d.ts +5 -0
- package/dist/webhooks/projects.d.ts.map +1 -0
- package/dist/webhooks/types.d.ts +2880 -0
- package/dist/webhooks/types.d.ts.map +1 -0
- package/package.json +40 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sour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,GAAG,CAAiC,GACtE,oBAAoB,CAAC,CAAC,CAAC,CAyDzB;AAED,OAAO,EACN,sBAAsB,EACtB,4BAA4B,GAC5B,MAAM,kBAAkB,CAAC;AAM1B,YAAY,EACX,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,iBAAiB,EACjB,iBAAiB,EACjB,iBAAiB,EACjB,cAAc,EACd,eAAe,EACf,kBAAkB,EAClB,oBAAoB,EACpB,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,WAAW,GACX,MAAM,kBAAkB,CAAC;AAM1B,YAAY,EACX,OAAO,EACP,iBAAiB,EACjB,qBAAqB,EACrB,qBAAqB,EACrB,oBAAoB,EACpB,qBAAqB,EACrB,kBAAkB,EAClB,gBAAgB,EAChB,kBAAkB,EAClB,KAAK,EACL,KAAK,EACL,eAAe,EACf,mBAAmB,EACnB,mBAAmB,EACnB,gBAAgB,EAChB,aAAa,EACb,kBAAkB,EAClB,mBAAmB,EACnB,KAAK,EACL,oBAAoB,EACpB,qBAAqB,EACrB,QAAQ,EACR,OAAO,EACP,iBAAiB,EACjB,qBAAqB,EACrB,qBAAqB,EACrB,kBAAkB,EAClB,YAAY,EACZ,oBAAoB,EACpB,qBAAqB,EACrB,IAAI,EACJ,cAAc,EACd,eAAe,EACf,iBAAiB,EACjB,kBAAkB,EAClB,gBAAgB,EAChB,kBAAkB,EAClB,IAAI,EACJ,aAAa,EACb,iBAAiB,GACjB,MAAM,mBAAmB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,548 @@
|
|
|
1
|
+
import{logEventFromContext as U}from"corsair/core";import{ApiError as Ze}from"corsair/http";import{request as Xe}from"corsair/http";import{BaseWebhookHandler as ro}from"corsair/http";import{verifyHmacSignature as io}from"corsair/http";var I=class extends Error{constructor(i,r){super(i);this.code=r;this.name="LinearAPIError"}},et="https://api.linear.app/graphql";async function p(t,a,i){let r={BASE:et,VERSION:"1.0.0",WITH_CREDENTIALS:!1,CREDENTIALS:"omit",HEADERS:{"Content-Type":"application/json",Authorization:a}},o={method:"POST",url:"",body:{query:t,variables:i||{}},mediaType:"application/json"};try{let c=await Xe(r,o);if(c.errors&&c.errors.length>0){let s=c.errors.map(h=>h.message).join(", ");throw new I(s)}if(!c.data)throw new I("No data returned from Linear API");return c.data}catch(c){if(c instanceof I)throw c;if(c instanceof Ze){let s=typeof c.body=="object"?JSON.stringify(c.body):String(c.body??"");throw new I(`${c.message} (status=${c.status}, body=${s})`)}throw new I(c instanceof Error?c.message:"Unknown error")}}var tt=`
|
|
2
|
+
query Comments($issueId: String!, $first: Int!, $after: String) {
|
|
3
|
+
issue(id: $issueId) {
|
|
4
|
+
comments(first: $first, after: $after) {
|
|
5
|
+
nodes {
|
|
6
|
+
id
|
|
7
|
+
body
|
|
8
|
+
issue {
|
|
9
|
+
id
|
|
10
|
+
}
|
|
11
|
+
user {
|
|
12
|
+
id
|
|
13
|
+
name
|
|
14
|
+
displayName
|
|
15
|
+
}
|
|
16
|
+
parent {
|
|
17
|
+
id
|
|
18
|
+
}
|
|
19
|
+
editedAt
|
|
20
|
+
createdAt
|
|
21
|
+
updatedAt
|
|
22
|
+
archivedAt
|
|
23
|
+
}
|
|
24
|
+
pageInfo {
|
|
25
|
+
hasNextPage
|
|
26
|
+
hasPreviousPage
|
|
27
|
+
startCursor
|
|
28
|
+
endCursor
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
`,ot=`
|
|
34
|
+
mutation CreateComment($input: CommentCreateInput!) {
|
|
35
|
+
commentCreate(input: $input) {
|
|
36
|
+
success
|
|
37
|
+
comment {
|
|
38
|
+
id
|
|
39
|
+
body
|
|
40
|
+
issue {
|
|
41
|
+
id
|
|
42
|
+
}
|
|
43
|
+
user {
|
|
44
|
+
id
|
|
45
|
+
name
|
|
46
|
+
displayName
|
|
47
|
+
}
|
|
48
|
+
parent {
|
|
49
|
+
id
|
|
50
|
+
}
|
|
51
|
+
createdAt
|
|
52
|
+
updatedAt
|
|
53
|
+
archivedAt
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
`,nt=`
|
|
58
|
+
mutation UpdateComment($id: String!, $input: CommentUpdateInput!) {
|
|
59
|
+
commentUpdate(id: $id, input: $input) {
|
|
60
|
+
success
|
|
61
|
+
comment {
|
|
62
|
+
id
|
|
63
|
+
body
|
|
64
|
+
issue {
|
|
65
|
+
id
|
|
66
|
+
}
|
|
67
|
+
user {
|
|
68
|
+
id
|
|
69
|
+
name
|
|
70
|
+
displayName
|
|
71
|
+
}
|
|
72
|
+
parent {
|
|
73
|
+
id
|
|
74
|
+
}
|
|
75
|
+
editedAt
|
|
76
|
+
createdAt
|
|
77
|
+
updatedAt
|
|
78
|
+
archivedAt
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
`,at=`
|
|
83
|
+
mutation DeleteComment($id: String!) {
|
|
84
|
+
commentDelete(id: $id) {
|
|
85
|
+
success
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
`,oe=async(t,a)=>{let i=t.key,o=(await p(tt,i,{issueId:a.issueId,first:a.first||50,after:a.after})).issue.comments;if(o.nodes&&t.db.comments)try{for(let c of o.nodes)await t.db.comments.upsertByEntityId(c.id,{...c,issueId:c.issue.id,userId:c.user.id,parentId:c.parent?.id,createdAt:new Date(c.createdAt??""),updatedAt:new Date(c.updatedAt??"")})}catch(c){console.warn("Failed to save comments to database:",c)}return await U(t,"linear.comments.list",{...a},"completed"),o},ne=async(t,a)=>{let i=t.key,o=(await p(ot,i,{input:a})).commentCreate.comment;if(o&&t.db.comments)try{await t.db.comments.upsertByEntityId(o.id,{...o,issueId:o.issue.id,userId:o.user.id,parentId:o.parent?.id,createdAt:new Date(o.createdAt??""),updatedAt:new Date(o.updatedAt??"")})}catch(c){console.warn("Failed to save comment to database:",c)}return await U(t,"linear.comments.create",{...a},"completed"),o},ae=async(t,a)=>{let i=t.key,o=(await p(nt,i,{id:a.id,input:a.input})).commentUpdate.comment;if(o&&t.db.comments)try{await t.db.comments.upsertByEntityId(o.id,{...o,issueId:o.issue.id,userId:o.user.id,parentId:o.parent?.id,createdAt:new Date(o.createdAt??""),updatedAt:new Date(o.updatedAt??"")})}catch(c){console.warn("Failed to update comment in database:",c)}return await U(t,"linear.comments.update",{...a},"completed"),o},re=async(t,a)=>{let i=t.key,o=(await p(at,i,{id:a.id})).commentDelete.success;if(o&&t.db.comments)try{await t.db.comments.deleteByEntityId(a.id)}catch(c){console.warn("Failed to delete comment from database:",c)}return await U(t,"linear.comments.delete",{...a},"completed"),o};import{logEventFromContext as S}from"corsair/core";var rt=`
|
|
89
|
+
query Issues($teamId: ID!, $first: Int!, $after: String) {
|
|
90
|
+
issues(filter: { team: { id: { eq: $teamId } } }, first: $first, after: $after) {
|
|
91
|
+
nodes {
|
|
92
|
+
id
|
|
93
|
+
title
|
|
94
|
+
description
|
|
95
|
+
priority
|
|
96
|
+
estimate
|
|
97
|
+
sortOrder
|
|
98
|
+
number
|
|
99
|
+
identifier
|
|
100
|
+
url
|
|
101
|
+
state {
|
|
102
|
+
id
|
|
103
|
+
name
|
|
104
|
+
type
|
|
105
|
+
color
|
|
106
|
+
position
|
|
107
|
+
}
|
|
108
|
+
team {
|
|
109
|
+
id
|
|
110
|
+
name
|
|
111
|
+
key
|
|
112
|
+
}
|
|
113
|
+
assignee {
|
|
114
|
+
id
|
|
115
|
+
name
|
|
116
|
+
displayName
|
|
117
|
+
email
|
|
118
|
+
avatarUrl
|
|
119
|
+
}
|
|
120
|
+
creator {
|
|
121
|
+
id
|
|
122
|
+
name
|
|
123
|
+
displayName
|
|
124
|
+
email
|
|
125
|
+
avatarUrl
|
|
126
|
+
}
|
|
127
|
+
labels {
|
|
128
|
+
nodes {
|
|
129
|
+
id
|
|
130
|
+
name
|
|
131
|
+
color
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
createdAt
|
|
135
|
+
updatedAt
|
|
136
|
+
}
|
|
137
|
+
pageInfo {
|
|
138
|
+
hasNextPage
|
|
139
|
+
hasPreviousPage
|
|
140
|
+
startCursor
|
|
141
|
+
endCursor
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
`,st=`
|
|
146
|
+
query Issues($first: Int!, $after: String) {
|
|
147
|
+
issues(first: $first, after: $after) {
|
|
148
|
+
nodes {
|
|
149
|
+
id
|
|
150
|
+
title
|
|
151
|
+
description
|
|
152
|
+
priority
|
|
153
|
+
estimate
|
|
154
|
+
sortOrder
|
|
155
|
+
number
|
|
156
|
+
identifier
|
|
157
|
+
url
|
|
158
|
+
state {
|
|
159
|
+
id
|
|
160
|
+
name
|
|
161
|
+
type
|
|
162
|
+
color
|
|
163
|
+
position
|
|
164
|
+
}
|
|
165
|
+
team {
|
|
166
|
+
id
|
|
167
|
+
name
|
|
168
|
+
key
|
|
169
|
+
}
|
|
170
|
+
assignee {
|
|
171
|
+
id
|
|
172
|
+
name
|
|
173
|
+
displayName
|
|
174
|
+
email
|
|
175
|
+
avatarUrl
|
|
176
|
+
}
|
|
177
|
+
creator {
|
|
178
|
+
id
|
|
179
|
+
name
|
|
180
|
+
displayName
|
|
181
|
+
email
|
|
182
|
+
avatarUrl
|
|
183
|
+
}
|
|
184
|
+
labels {
|
|
185
|
+
nodes {
|
|
186
|
+
id
|
|
187
|
+
name
|
|
188
|
+
color
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
createdAt
|
|
192
|
+
updatedAt
|
|
193
|
+
}
|
|
194
|
+
pageInfo {
|
|
195
|
+
hasNextPage
|
|
196
|
+
hasPreviousPage
|
|
197
|
+
startCursor
|
|
198
|
+
endCursor
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
`,it=`
|
|
203
|
+
query Issue($id: String!) {
|
|
204
|
+
issue(id: $id) {
|
|
205
|
+
id
|
|
206
|
+
title
|
|
207
|
+
description
|
|
208
|
+
priority
|
|
209
|
+
estimate
|
|
210
|
+
sortOrder
|
|
211
|
+
number
|
|
212
|
+
identifier
|
|
213
|
+
url
|
|
214
|
+
state {
|
|
215
|
+
id
|
|
216
|
+
name
|
|
217
|
+
type
|
|
218
|
+
color
|
|
219
|
+
position
|
|
220
|
+
}
|
|
221
|
+
team {
|
|
222
|
+
id
|
|
223
|
+
name
|
|
224
|
+
key
|
|
225
|
+
}
|
|
226
|
+
assignee {
|
|
227
|
+
id
|
|
228
|
+
name
|
|
229
|
+
displayName
|
|
230
|
+
email
|
|
231
|
+
avatarUrl
|
|
232
|
+
}
|
|
233
|
+
creator {
|
|
234
|
+
id
|
|
235
|
+
name
|
|
236
|
+
displayName
|
|
237
|
+
email
|
|
238
|
+
avatarUrl
|
|
239
|
+
}
|
|
240
|
+
project {
|
|
241
|
+
id
|
|
242
|
+
name
|
|
243
|
+
state
|
|
244
|
+
}
|
|
245
|
+
cycle {
|
|
246
|
+
id
|
|
247
|
+
number
|
|
248
|
+
name
|
|
249
|
+
}
|
|
250
|
+
labels {
|
|
251
|
+
nodes {
|
|
252
|
+
id
|
|
253
|
+
name
|
|
254
|
+
color
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
subscribers {
|
|
258
|
+
nodes {
|
|
259
|
+
id
|
|
260
|
+
name
|
|
261
|
+
displayName
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
dueDate
|
|
265
|
+
startedAt
|
|
266
|
+
completedAt
|
|
267
|
+
canceledAt
|
|
268
|
+
createdAt
|
|
269
|
+
updatedAt
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
`,dt=`
|
|
273
|
+
mutation CreateIssue($input: IssueCreateInput!) {
|
|
274
|
+
issueCreate(input: $input) {
|
|
275
|
+
success
|
|
276
|
+
issue {
|
|
277
|
+
id
|
|
278
|
+
title
|
|
279
|
+
description
|
|
280
|
+
priority
|
|
281
|
+
estimate
|
|
282
|
+
sortOrder
|
|
283
|
+
number
|
|
284
|
+
identifier
|
|
285
|
+
url
|
|
286
|
+
state {
|
|
287
|
+
id
|
|
288
|
+
name
|
|
289
|
+
type
|
|
290
|
+
}
|
|
291
|
+
team {
|
|
292
|
+
id
|
|
293
|
+
name
|
|
294
|
+
key
|
|
295
|
+
}
|
|
296
|
+
assignee {
|
|
297
|
+
id
|
|
298
|
+
name
|
|
299
|
+
displayName
|
|
300
|
+
}
|
|
301
|
+
creator {
|
|
302
|
+
id
|
|
303
|
+
name
|
|
304
|
+
displayName
|
|
305
|
+
}
|
|
306
|
+
createdAt
|
|
307
|
+
updatedAt
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
`,ct=`
|
|
312
|
+
mutation UpdateIssue($id: String!, $input: IssueUpdateInput!) {
|
|
313
|
+
issueUpdate(id: $id, input: $input) {
|
|
314
|
+
success
|
|
315
|
+
issue {
|
|
316
|
+
id
|
|
317
|
+
title
|
|
318
|
+
description
|
|
319
|
+
priority
|
|
320
|
+
estimate
|
|
321
|
+
sortOrder
|
|
322
|
+
number
|
|
323
|
+
identifier
|
|
324
|
+
url
|
|
325
|
+
state {
|
|
326
|
+
id
|
|
327
|
+
name
|
|
328
|
+
type
|
|
329
|
+
}
|
|
330
|
+
team {
|
|
331
|
+
id
|
|
332
|
+
name
|
|
333
|
+
key
|
|
334
|
+
}
|
|
335
|
+
assignee {
|
|
336
|
+
id
|
|
337
|
+
name
|
|
338
|
+
displayName
|
|
339
|
+
}
|
|
340
|
+
updatedAt
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
`,pt=`
|
|
345
|
+
mutation DeleteIssue($id: String!) {
|
|
346
|
+
issueDelete(id: $id) {
|
|
347
|
+
success
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
`,se=async(t,a)=>{let i=a.teamId?rt:st,r={first:a.first||50};a.teamId&&(r.teamId=a.teamId),a.after&&(r.after=a.after);let c=(await p(i,t.key,r)).issues;if(c.nodes&&t.db.issues)try{for(let s of c.nodes)await t.db.issues.upsertByEntityId(s.id,{...s,stateId:s.state?.id,teamId:s.team?.id,assigneeId:s.assignee?.id,creatorId:s.creator?.id,createdAt:new Date(s.createdAt??""),updatedAt:new Date(s.updatedAt??"")})}catch(s){console.warn("Failed to save issues to database:",s)}return await S(t,"linear.issues.list",{...a},"completed"),c},ie=async(t,a)=>{let r=(await p(it,t.key,{id:a.id})).issue;if(r&&t.db.issues)try{await t.db.issues.upsertByEntityId(r.id,{...r,stateId:r.state?.id,teamId:r.team?.id,assigneeId:r.assignee?.id,creatorId:r.creator?.id,projectId:r.project?.id,cycleId:r.cycle?.id,createdAt:new Date(r.createdAt??""),updatedAt:new Date(r.updatedAt??"")})}catch(o){console.warn("Failed to save issue to database:",o)}return await S(t,"linear.issues.get",{...a},"completed"),r},de=async(t,a)=>{let r=(await p(dt,t.key,{input:a})).issueCreate.issue;return r&&await t.endpoints.issues.get({id:r.id}),await S(t,"linear.issues.create",{...a},"completed"),r},ce=async(t,a)=>{let r=(await p(ct,t.key,{id:a.id,input:a.input})).issueUpdate.issue;return r&&await t.endpoints.issues.get({id:r.id}),await S(t,"linear.issues.update",{...a},"completed"),r},pe=async(t,a)=>{let r=(await p(pt,t.key,{id:a.id})).issueDelete.success;if(r&&t.db.issues)try{await t.db.issues.deleteByEntityId(a.id)}catch(o){console.warn("Failed to delete issue from database:",o)}return await S(t,"linear.issues.delete",{...a},"completed"),r};import{logEventFromContext as w}from"corsair/core";var lt=`
|
|
351
|
+
query Projects($first: Int!, $after: String) {
|
|
352
|
+
projects(first: $first, after: $after) {
|
|
353
|
+
nodes {
|
|
354
|
+
id
|
|
355
|
+
name
|
|
356
|
+
description
|
|
357
|
+
icon
|
|
358
|
+
color
|
|
359
|
+
state
|
|
360
|
+
priority
|
|
361
|
+
sortOrder
|
|
362
|
+
startDate
|
|
363
|
+
targetDate
|
|
364
|
+
completedAt
|
|
365
|
+
canceledAt
|
|
366
|
+
lead {
|
|
367
|
+
id
|
|
368
|
+
name
|
|
369
|
+
displayName
|
|
370
|
+
}
|
|
371
|
+
teams {
|
|
372
|
+
nodes {
|
|
373
|
+
id
|
|
374
|
+
name
|
|
375
|
+
key
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
createdAt
|
|
379
|
+
updatedAt
|
|
380
|
+
}
|
|
381
|
+
pageInfo {
|
|
382
|
+
hasNextPage
|
|
383
|
+
hasPreviousPage
|
|
384
|
+
startCursor
|
|
385
|
+
endCursor
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
`,ut=`
|
|
390
|
+
query Project($id: String!) {
|
|
391
|
+
project(id: $id) {
|
|
392
|
+
id
|
|
393
|
+
name
|
|
394
|
+
description
|
|
395
|
+
icon
|
|
396
|
+
color
|
|
397
|
+
state
|
|
398
|
+
priority
|
|
399
|
+
sortOrder
|
|
400
|
+
startDate
|
|
401
|
+
targetDate
|
|
402
|
+
completedAt
|
|
403
|
+
canceledAt
|
|
404
|
+
lead {
|
|
405
|
+
id
|
|
406
|
+
name
|
|
407
|
+
displayName
|
|
408
|
+
email
|
|
409
|
+
}
|
|
410
|
+
teams {
|
|
411
|
+
nodes {
|
|
412
|
+
id
|
|
413
|
+
name
|
|
414
|
+
key
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
createdAt
|
|
418
|
+
updatedAt
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
`,mt=`
|
|
422
|
+
mutation CreateProject($input: ProjectCreateInput!) {
|
|
423
|
+
projectCreate(input: $input) {
|
|
424
|
+
success
|
|
425
|
+
project {
|
|
426
|
+
id
|
|
427
|
+
name
|
|
428
|
+
description
|
|
429
|
+
icon
|
|
430
|
+
color
|
|
431
|
+
state
|
|
432
|
+
priority
|
|
433
|
+
startDate
|
|
434
|
+
targetDate
|
|
435
|
+
lead {
|
|
436
|
+
id
|
|
437
|
+
name
|
|
438
|
+
displayName
|
|
439
|
+
}
|
|
440
|
+
teams {
|
|
441
|
+
nodes {
|
|
442
|
+
id
|
|
443
|
+
name
|
|
444
|
+
key
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
createdAt
|
|
448
|
+
updatedAt
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
`,bt=`
|
|
453
|
+
mutation UpdateProject($id: String!, $input: ProjectUpdateInput!) {
|
|
454
|
+
projectUpdate(id: $id, input: $input) {
|
|
455
|
+
success
|
|
456
|
+
project {
|
|
457
|
+
id
|
|
458
|
+
name
|
|
459
|
+
description
|
|
460
|
+
icon
|
|
461
|
+
color
|
|
462
|
+
state
|
|
463
|
+
priority
|
|
464
|
+
startDate
|
|
465
|
+
targetDate
|
|
466
|
+
updatedAt
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
`,yt=`
|
|
471
|
+
mutation DeleteProject($id: String!) {
|
|
472
|
+
projectDelete(id: $id) {
|
|
473
|
+
success
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
`,le=async(t,a)=>{let r=(await p(lt,t.key,{first:a.first||50,after:a.after})).projects;if(r.nodes&&t.db.projects)try{for(let o of r.nodes)await t.db.projects.upsertByEntityId(o.id,{...o,leadId:o.lead?.id,createdAt:new Date(o.createdAt??""),updatedAt:new Date(o.updatedAt??"")})}catch(o){console.warn("Failed to save projects to database:",o)}return await w(t,"linear.projects.list",{...a},"completed"),r},ue=async(t,a)=>{let r=(await p(ut,t.key,{id:a.id})).project;if(r&&t.db.projects)try{await t.db.projects.upsertByEntityId(r.id,{...r,leadId:r.lead?.id,createdAt:new Date(r.createdAt??""),updatedAt:new Date(r.updatedAt??"")})}catch(o){console.warn("Failed to save project to database:",o)}return await w(t,"linear.projects.get",{...a},"completed"),r},me=async(t,a)=>{let r=(await p(mt,t.key,{input:a})).projectCreate.project;return r&&await t.endpoints.projects.get({id:r.id}),await w(t,"linear.projects.create",{...a},"completed"),r},be=async(t,a)=>{let r=(await p(bt,t.key,{id:a.id,input:a.input})).projectUpdate.project;return r&&await t.endpoints.projects.get({id:r.id}),await w(t,"linear.projects.update",{...a},"completed"),r},ye=async(t,a)=>{let r=(await p(yt,t.key,{id:a.id})).projectDelete.success;if(r&&t.db.projects)try{await t.db.projects.deleteByEntityId(a.id)}catch(o){console.warn("Failed to delete project from database:",o)}return await w(t,"linear.projects.delete",{...a},"completed"),r};import{logEventFromContext as ge}from"corsair/core";var gt=`
|
|
477
|
+
query Teams($first: Int!, $after: String) {
|
|
478
|
+
teams(first: $first, after: $after) {
|
|
479
|
+
nodes {
|
|
480
|
+
id
|
|
481
|
+
name
|
|
482
|
+
key
|
|
483
|
+
description
|
|
484
|
+
icon
|
|
485
|
+
color
|
|
486
|
+
private
|
|
487
|
+
createdAt
|
|
488
|
+
updatedAt
|
|
489
|
+
}
|
|
490
|
+
pageInfo {
|
|
491
|
+
hasNextPage
|
|
492
|
+
hasPreviousPage
|
|
493
|
+
startCursor
|
|
494
|
+
endCursor
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
`,ft=`
|
|
499
|
+
query Team($id: String!) {
|
|
500
|
+
team(id: $id) {
|
|
501
|
+
id
|
|
502
|
+
name
|
|
503
|
+
key
|
|
504
|
+
description
|
|
505
|
+
icon
|
|
506
|
+
color
|
|
507
|
+
private
|
|
508
|
+
createdAt
|
|
509
|
+
updatedAt
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
`,fe=async(t,a)=>{let r=(await p(gt,t.key,{first:a.first||50,after:a.after})).teams;if(r.nodes&&t.db.teams)try{for(let o of r.nodes)await t.db.teams.upsertByEntityId(o.id,{...o,createdAt:new Date(o.createdAt??""),updatedAt:new Date(o.updatedAt??"")})}catch(o){console.warn("Failed to save teams to database:",o)}return await ge(t,"linear.teams.list",{...a},"completed"),r},he=async(t,a)=>{let r=(await p(ft,t.key,{id:a.id})).team;if(r&&t.db.teams)try{await t.db.teams.upsertByEntityId(r.id,{...r,createdAt:new Date(r.createdAt??""),updatedAt:new Date(r.updatedAt??"")})}catch(o){console.warn("Failed to save team to database:",o)}return await ge(t,"linear.teams.get",{...a},"completed"),r};import{logEventFromContext as Ie}from"corsair/core";var ht=`
|
|
513
|
+
query Users($first: Int!, $after: String) {
|
|
514
|
+
users(first: $first, after: $after) {
|
|
515
|
+
nodes {
|
|
516
|
+
id
|
|
517
|
+
name
|
|
518
|
+
email
|
|
519
|
+
displayName
|
|
520
|
+
avatarUrl
|
|
521
|
+
active
|
|
522
|
+
admin
|
|
523
|
+
createdAt
|
|
524
|
+
updatedAt
|
|
525
|
+
}
|
|
526
|
+
pageInfo {
|
|
527
|
+
hasNextPage
|
|
528
|
+
hasPreviousPage
|
|
529
|
+
startCursor
|
|
530
|
+
endCursor
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
`,It=`
|
|
535
|
+
query User($id: String!) {
|
|
536
|
+
user(id: $id) {
|
|
537
|
+
id
|
|
538
|
+
name
|
|
539
|
+
email
|
|
540
|
+
displayName
|
|
541
|
+
avatarUrl
|
|
542
|
+
active
|
|
543
|
+
admin
|
|
544
|
+
createdAt
|
|
545
|
+
updatedAt
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
`,je=async(t,a)=>{let r=(await p(ht,t.key,{first:a.first||50,after:a.after})).users;if(r.nodes&&t.db.users)try{for(let o of r.nodes)await t.db.users.upsertByEntityId(o.id,{...o,createdAt:new Date(o.createdAt??""),updatedAt:new Date(o.updatedAt??"")})}catch(o){console.warn("Failed to save users to database:",o)}return await Ie(t,"linear.users.list",{...a},"completed"),r},Ce=async(t,a)=>{let r=(await p(It,t.key,{id:a.id})).user;if(r&&t.db.users)try{await t.db.users.upsertByEntityId(r.id,{...r,createdAt:new Date(r.createdAt??""),updatedAt:new Date(r.updatedAt??"")})}catch(o){console.warn("Failed to save user to database:",o)}return await Ie(t,"linear.users.get",{...a},"completed"),r};import{z as e}from"zod";var j=e.union([e.literal(0),e.literal(1),e.literal(2),e.literal(3),e.literal(4)]),jt=e.object({teamId:e.string().optional(),first:e.number().optional(),after:e.string().optional()}),Ct=e.object({id:e.string()}),Et=e.object({title:e.string(),description:e.string().optional(),teamId:e.string(),assigneeId:e.string().optional(),priority:j.optional(),estimate:e.number().optional(),stateId:e.string().optional(),projectId:e.string().optional(),cycleId:e.string().optional(),parentId:e.string().optional(),labelIds:e.array(e.string()).optional(),subscriberIds:e.array(e.string()).optional(),dueDate:e.string().optional()}),Lt=e.object({id:e.string(),input:e.object({title:e.string().optional(),description:e.string().optional(),assigneeId:e.string().optional(),priority:j.optional(),estimate:e.number().optional(),stateId:e.string().optional(),projectId:e.string().optional(),cycleId:e.string().optional(),parentId:e.string().optional(),labelIds:e.array(e.string()).optional(),subscriberIds:e.array(e.string()).optional(),dueDate:e.string().optional()})}),vt=e.object({id:e.string()}),At=e.object({first:e.number().optional(),after:e.string().optional()}),St=e.object({id:e.string()}),wt=e.object({first:e.number().optional(),after:e.string().optional()}),kt=e.object({id:e.string()}),Rt=e.object({first:e.number().optional(),after:e.string().optional()}),Ut=e.object({id:e.string()}),Dt=e.object({name:e.string(),description:e.string().optional(),icon:e.string().optional(),color:e.string().optional(),teamIds:e.array(e.string()),leadId:e.string().optional(),state:e.enum(["planned","started","paused","completed","canceled"]).optional(),priority:e.number().optional(),startDate:e.string().optional(),targetDate:e.string().optional()}),Pt=e.object({id:e.string(),input:e.object({name:e.string().optional(),description:e.string().optional(),icon:e.string().optional(),color:e.string().optional(),teamIds:e.array(e.string()).optional(),leadId:e.string().optional(),state:e.enum(["planned","started","paused","completed","canceled"]).optional(),priority:e.number().optional(),startDate:e.string().optional(),targetDate:e.string().optional()})}),xt=e.object({id:e.string()}),Tt=e.object({issueId:e.string(),first:e.number().optional(),after:e.string().optional()}),zt=e.object({issueId:e.string(),body:e.string(),parentId:e.string().optional()}),Wt=e.object({id:e.string(),input:e.object({body:e.string().optional()})}),Ot=e.object({id:e.string()}),l={issuesList:jt,issuesGet:Ct,issuesCreate:Et,issuesUpdate:Lt,issuesDelete:vt,teamsList:At,teamsGet:St,usersList:wt,usersGet:kt,projectsList:Rt,projectsGet:Ut,projectsCreate:Dt,projectsUpdate:Pt,projectsDelete:xt,commentsList:Tt,commentsCreate:zt,commentsUpdate:Wt,commentsDelete:Ot},g=e.object({id:e.string(),name:e.string(),email:e.string().optional().nullable(),displayName:e.string(),avatarUrl:e.string().optional().nullable(),active:e.boolean(),admin:e.boolean(),createdAt:e.coerce.date().nullable().optional(),updatedAt:e.coerce.date().nullable().optional()}),f=e.object({id:e.string(),name:e.string(),key:e.string(),description:e.string().optional().nullable(),icon:e.string().optional().nullable(),color:e.string().optional().nullable(),private:e.boolean(),createdAt:e.coerce.date().nullable().optional(),updatedAt:e.coerce.date().nullable().optional(),archivedAt:e.coerce.date().nullable().optional()}),ve=e.enum(["backlog","unstarted","started","completed","canceled"]),Nt=e.object({id:e.string(),name:e.string(),type:ve,color:e.string(),position:e.number(),description:e.string().optional().nullable(),team:f,createdAt:e.coerce.date().nullable().optional(),updatedAt:e.coerce.date().nullable().optional()}),$t=e.object({id:e.string(),name:e.string(),description:e.string().optional().nullable(),color:e.string(),team:f.optional().nullable(),createdAt:e.coerce.date().nullable().optional(),updatedAt:e.coerce.date().nullable().optional()}),Ae=$t.extend({parent:e.lazy(()=>Ae.optional().nullable())}),C=e.enum(["backlog","planned","started","paused","completed","canceled"]),Se=e.object({id:e.string(),name:e.string(),description:e.string().optional().nullable(),icon:e.string().optional().nullable(),color:e.string().optional().nullable(),state:C,priority:e.number(),sortOrder:e.number(),startDate:e.coerce.date().nullable().optional(),targetDate:e.coerce.date().nullable().optional(),completedAt:e.coerce.date().nullable().optional(),canceledAt:e.coerce.date().nullable().optional(),lead:g.optional().nullable(),teams:e.array(f),createdAt:e.coerce.date().nullable().optional(),updatedAt:e.coerce.date().nullable().optional(),archivedAt:e.coerce.date().nullable().optional()}),Gt=e.object({id:e.string(),number:e.number(),name:e.string().optional().nullable(),description:e.string().optional().nullable(),startsAt:e.coerce.date().nullable().optional(),endsAt:e.coerce.date().nullable().optional(),completedAt:e.coerce.date().nullable().optional(),team:f,createdAt:e.coerce.date().nullable().optional(),updatedAt:e.coerce.date().nullable().optional(),archivedAt:e.coerce.date().nullable().optional()}),Bt=e.object({id:e.string(),title:e.string(),description:e.string().optional().nullable(),priority:j,estimate:e.number().optional().nullable(),sortOrder:e.number(),number:e.number(),identifier:e.string(),url:e.string(),state:Nt,team:f,assignee:g.optional().nullable(),creator:g,project:Se.optional().nullable(),cycle:Gt.optional().nullable(),labels:e.array(Ae),subscribers:e.array(g),dueDate:e.coerce.date().nullable().optional(),startedAt:e.coerce.date().nullable().optional(),completedAt:e.coerce.date().nullable().optional(),canceledAt:e.coerce.date().nullable().optional(),triagedAt:e.coerce.date().nullable().optional(),snoozedUntilAt:e.coerce.date().nullable().optional(),createdAt:e.coerce.date().nullable().optional(),updatedAt:e.coerce.date().nullable().optional(),archivedAt:e.coerce.date().nullable().optional()}),k=Bt.extend({parent:e.lazy(()=>k.optional().nullable())}),_t=e.object({id:e.string(),body:e.string(),issue:k,user:g,editedAt:e.coerce.date().nullable().optional(),createdAt:e.coerce.date().nullable().optional(),updatedAt:e.coerce.date().nullable().optional(),archivedAt:e.coerce.date().nullable().optional()}),D=_t.extend({parent:e.lazy(()=>D.optional().nullable())}),E=e.object({hasNextPage:e.boolean(),hasPreviousPage:e.boolean(),startCursor:e.string().optional().nullable(),endCursor:e.string().optional().nullable()}),y=e.object({id:e.string(),name:e.string(),displayName:e.string(),email:e.string().optional().nullable()}),V=e.object({id:e.string(),name:e.string(),key:e.string()}),we=e.object({id:e.string(),name:e.string(),type:ve,color:e.string().optional(),position:e.number().optional()}),Mt=e.object({id:e.string(),name:e.string(),color:e.string()}),Ft=e.object({nodes:e.array(Mt)}),Ht=e.object({nodes:e.array(y)}),qt=e.object({id:e.string()}),Q=e.object({nodes:e.array(V)}),Kt=e.object({id:e.string(),title:e.string(),description:e.string().optional().nullable(),priority:j,estimate:e.number().optional().nullable(),sortOrder:e.number(),number:e.number(),identifier:e.string(),url:e.string(),state:we,team:V,assignee:y.optional().nullable(),creator:y,project:e.object({id:e.string(),name:e.string(),state:C}).optional().nullable(),cycle:e.object({id:e.string(),number:e.number(),name:e.string().optional().nullable()}).optional().nullable(),labels:Ft.optional().nullable(),subscribers:Ht.nullish(),dueDate:e.coerce.date().nullable().optional(),startedAt:e.coerce.date().nullable().optional(),completedAt:e.coerce.date().nullable().optional(),canceledAt:e.coerce.date().nullable().optional(),triagedAt:e.coerce.date().nullable().optional(),snoozedUntilAt:e.coerce.date().nullable().optional(),createdAt:e.coerce.date().nullable().optional(),updatedAt:e.coerce.date().nullable().optional(),archivedAt:e.coerce.date().nullable().optional()}),P=Kt.extend({parent:e.lazy(()=>P.optional().nullable())}),ke=e.object({nodes:e.array(P),pageInfo:E}),So=e.object({nodes:e.array(k),pageInfo:E}),Re=e.object({nodes:e.array(f),pageInfo:E}),Ue=e.object({nodes:e.array(g),pageInfo:E}),wo=e.object({nodes:e.array(Se),pageInfo:E}),De=e.object({nodes:e.array(D),pageInfo:E}),ko=e.object({title:e.string(),description:e.string().optional(),teamId:e.string(),assigneeId:e.string().optional(),priority:j.optional(),estimate:e.number().optional(),stateId:e.string().optional(),projectId:e.string().optional(),cycleId:e.string().optional(),parentId:e.string().optional(),labelIds:e.array(e.string()).optional(),subscriberIds:e.array(e.string()).optional(),dueDate:e.coerce.date().nullable().optional()}),Ro=e.object({title:e.string().optional(),description:e.string().optional(),assigneeId:e.string().optional(),priority:j.optional(),estimate:e.number().optional(),stateId:e.string().optional(),projectId:e.string().optional(),cycleId:e.string().optional(),parentId:e.string().optional(),labelIds:e.array(e.string()).optional(),subscriberIds:e.array(e.string()).optional(),dueDate:e.coerce.date().nullable().optional()}),Uo=e.object({name:e.string(),description:e.string().optional(),icon:e.string().optional(),color:e.string().optional(),teamIds:e.array(e.string()),leadId:e.string().optional(),state:C.optional(),priority:e.number().optional(),startDate:e.coerce.date().nullable().optional(),targetDate:e.coerce.date().nullable().optional()}),Do=e.object({name:e.string().optional(),description:e.string().optional(),icon:e.string().optional(),color:e.string().optional(),teamIds:e.array(e.string()).optional(),leadId:e.string().optional(),state:C.optional(),priority:e.number().optional(),startDate:e.coerce.date().nullable().optional(),targetDate:e.coerce.date().nullable().optional()}),Po=e.object({issueId:e.string(),body:e.string(),parentId:e.string().optional()}),xo=e.object({body:e.string().optional()}),Pe=e.object({id:e.string(),name:e.string(),description:e.string().optional().nullable(),icon:e.string().optional().nullable(),color:e.string().optional().nullable(),state:C,priority:e.number(),sortOrder:e.number().optional(),startDate:e.coerce.date().nullable().optional(),targetDate:e.coerce.date().nullable().optional(),completedAt:e.coerce.date().nullable().optional(),canceledAt:e.coerce.date().nullable().optional(),lead:y.optional().nullable(),teams:Q,createdAt:e.coerce.date().nullable().optional(),updatedAt:e.coerce.date().nullable().optional(),archivedAt:e.coerce.date().nullable().optional()}),xe=e.object({id:e.string(),name:e.string(),description:e.string().optional().nullable(),icon:e.string().optional().nullable(),color:e.string().optional().nullable(),state:C,priority:e.number(),sortOrder:e.number().optional(),startDate:e.coerce.date().nullable().optional(),targetDate:e.coerce.date().nullable().optional(),completedAt:e.coerce.date().nullable().optional(),canceledAt:e.coerce.date().nullable().optional(),lead:y.optional().nullable(),teams:Q.optional(),createdAt:e.coerce.date().nullable().optional(),updatedAt:e.coerce.date().nullable().optional(),archivedAt:e.coerce.date().nullable().optional()}),Y=e.object({id:e.string(),name:e.string(),description:e.string().optional().nullable(),icon:e.string().optional().nullable(),color:e.string().optional().nullable(),state:C,priority:e.number(),sortOrder:e.number(),startDate:e.coerce.date().nullable().optional(),targetDate:e.coerce.date().nullable().optional(),completedAt:e.coerce.date().nullable().optional(),canceledAt:e.coerce.date().nullable().optional(),lead:y.optional().nullable(),teams:Q,createdAt:e.coerce.date().nullable().optional(),updatedAt:e.coerce.date().nullable().optional()}),Te=e.object({nodes:e.array(Y),pageInfo:E}),To=e.object({issues:ke}),zo=e.object({issue:P}),Wo=e.object({issueCreate:e.object({success:e.boolean(),issue:k})}),Oo=e.object({issueUpdate:e.object({success:e.boolean(),issue:k})}),No=e.object({issueDelete:e.object({success:e.boolean()})}),$o=e.object({teams:Re}),Go=e.object({team:f}),Bo=e.object({users:Ue}),_o=e.object({user:g}),Mo=e.object({projects:Te}),Fo=e.object({project:Y}),Ho=e.object({projectCreate:e.object({success:e.boolean(),project:Pe})}),qo=e.object({projectUpdate:e.object({success:e.boolean(),project:xe})}),Ko=e.object({projectDelete:e.object({success:e.boolean()})}),Vo=e.object({issue:e.object({comments:De})}),Qo=e.object({commentCreate:e.object({success:e.boolean(),comment:D})}),Yo=e.object({commentUpdate:e.object({success:e.boolean(),comment:D})}),Jo=e.object({commentDelete:e.object({success:e.boolean()})}),Ee=e.object({id:e.string(),title:e.string().optional(),description:e.string().optional().nullable(),priority:j.optional(),estimate:e.number().optional().nullable(),sortOrder:e.number().optional(),number:e.number().optional(),identifier:e.string().optional(),url:e.string().optional(),state:we.optional(),team:V.optional(),assignee:y.optional().nullable(),creator:y.optional(),createdAt:e.coerce.date().nullable().optional(),updatedAt:e.coerce.date().nullable().optional()}),Le=e.object({id:e.string(),body:e.string(),issue:qt,user:y,parent:e.object({id:e.string()}).optional().nullable(),editedAt:e.coerce.date().nullable().optional(),createdAt:e.coerce.date().nullable().optional(),updatedAt:e.coerce.date().nullable().optional(),archivedAt:e.coerce.date().nullable().optional()}),u={issuesList:ke,issuesGet:P,issuesCreate:Ee,issuesUpdate:Ee,issuesDelete:e.boolean(),teamsList:Re,teamsGet:f,usersList:Ue,usersGet:g,projectsList:Te,projectsGet:Y,projectsCreate:Pe,projectsUpdate:xe,projectsDelete:e.boolean(),commentsList:De,commentsCreate:Le,commentsUpdate:Le,commentsDelete:e.boolean()};var R={list:oe,create:ne,update:ae,delete:re},L={list:se,get:ie,create:de,update:ce,delete:pe},v={list:le,get:ue,create:me,update:be,delete:ye},J={list:fe,get:he},Z={list:je,get:Ce};import{ApiError as A}from"corsair/http";var ze={RATE_LIMIT_ERROR:{match:(t,a)=>{if(t instanceof A&&t.status===429)return!0;let i=t.message.toLowerCase();return i.includes("rate_limited")||i.includes("ratelimited")||i.includes("rate limit")||i.includes("too many requests")||t.message.includes("429")},handler:async(t,a)=>{console.log(`[LINEAR:${a.operation}] Rate limit exceeded`);let i;return t instanceof A&&t.retryAfter&&(i=t.retryAfter),{maxRetries:5,headersRetryAfterMs:i}}},AUTH_ERROR:{match:(t,a)=>{if(t instanceof A&&t.status===401)return!0;let i=t.message.toLowerCase();return i.includes("unauthorized")||i.includes("authentication")||i.includes("invalid token")||i.includes("token expired")||i.includes("token revoked")||i.includes("invalid api key")||i.includes("forbidden")||i.includes("access denied")},handler:async(t,a)=>(console.log(`[LINEAR:${a.operation}] Authentication failed - check your API key`),{maxRetries:0})},NOT_FOUND_ERROR:{match:(t,a)=>{if(t instanceof A&&t.status===404)return!0;let i=t.message.toLowerCase();return i.includes("not found")||i.includes("does not exist")||i.includes("could not find")||i.includes("issue not found")||i.includes("team not found")||i.includes("project not found")||i.includes("comment not found")||i.includes("user not found")},handler:async(t,a)=>(console.warn(`[LINEAR:${a.operation}] Resource not found: ${t.message}`),{maxRetries:0})},PERMISSION_ERROR:{match:(t,a)=>{if(t instanceof A&&t.status===403)return!0;let i=t.message.toLowerCase();return i.includes("permission denied")||i.includes("forbidden")||i.includes("access denied")||i.includes("insufficient permissions")||i.includes("unauthorized access")||i.includes("not authorized")},handler:async(t,a)=>(console.warn(`[LINEAR:${a.operation}] Permission denied: ${t.message}`),{maxRetries:0})},NETWORK_ERROR:{match:(t,a)=>{let i=t.message.toLowerCase();return i.includes("network")||i.includes("connection")||i.includes("econnrefused")||i.includes("enotfound")||i.includes("etimedout")||i.includes("fetch failed")||i.includes("network error")},handler:async(t,a)=>(console.warn(`[LINEAR:${a.operation}] Network error: ${t.message}`),{maxRetries:3})},VALIDATION_ERROR:{match:(t,a)=>{if(t instanceof A&&t.status===400)return!0;let i=t.message.toLowerCase();return i.includes("validation")||i.includes("invalid input")||i.includes("bad request")||i.includes("malformed")||i.includes("required field")||i.includes("graphql validation")},handler:async(t,a)=>(console.warn(`[LINEAR:${a.operation}] Validation error: ${t.message}`),{maxRetries:0})},DEFAULT:{match:(t,a)=>!0,handler:async(t,a)=>(console.error(`[LINEAR:${a.operation}] Unhandled error: ${t.message}`),{maxRetries:0})}};import{z as d}from"zod";var We=d.object({id:d.string(),title:d.string(),description:d.string().nullable().optional(),priority:d.union([d.literal(0),d.literal(1),d.literal(2),d.literal(3),d.literal(4)]),estimate:d.number().nullable().optional(),sortOrder:d.number().optional(),number:d.number(),identifier:d.string(),url:d.string(),stateId:d.string(),teamId:d.string(),assigneeId:d.string().nullable().optional(),creatorId:d.string(),projectId:d.string().nullable().optional(),cycleId:d.string().nullable().optional(),parentId:d.string().nullable().optional(),dueDate:d.coerce.date().nullable().optional(),startedAt:d.coerce.date().nullable().optional(),completedAt:d.coerce.date().nullable().optional(),canceledAt:d.coerce.date().nullable().optional(),triagedAt:d.coerce.date().nullable().optional(),snoozedUntilAt:d.coerce.date().nullable().optional(),createdAt:d.coerce.date().nullable().optional(),updatedAt:d.coerce.date().nullable().optional(),archivedAt:d.coerce.date().nullable().optional()}),Oe=d.object({id:d.string(),name:d.string(),key:d.string(),description:d.string().nullable().optional(),icon:d.string().nullable().optional(),color:d.string().nullable().optional(),private:d.boolean(),createdAt:d.coerce.date().nullable().optional(),updatedAt:d.coerce.date().nullable().optional(),archivedAt:d.coerce.date().nullable().optional()}),Ne=d.object({id:d.string(),name:d.string(),description:d.string().nullable().optional(),icon:d.string().nullable().optional(),color:d.string().nullable().optional(),state:d.enum(["planned","started","paused","completed","canceled","backlog"]),priority:d.number(),sortOrder:d.number().optional(),startDate:d.coerce.date().nullable().optional(),targetDate:d.coerce.date().nullable().optional(),completedAt:d.coerce.date().nullable().optional(),canceledAt:d.coerce.date().nullable().optional(),leadId:d.string().nullable().optional(),createdAt:d.coerce.date().nullable().optional(),updatedAt:d.coerce.date().nullable().optional(),archivedAt:d.coerce.date().nullable().optional()}),$e=d.object({id:d.string(),body:d.string(),issueId:d.string(),userId:d.string(),parentId:d.string().nullable().optional(),editedAt:d.coerce.date().nullable().optional(),createdAt:d.coerce.date().nullable().optional(),updatedAt:d.coerce.date().nullable().optional(),archivedAt:d.coerce.date().nullable().optional()}),Ge=d.object({id:d.string(),name:d.string(),email:d.string().optional().nullable(),displayName:d.string(),avatarUrl:d.string().optional().nullable(),active:d.boolean(),admin:d.boolean(),createdAt:d.coerce.date().nullable().optional(),updatedAt:d.coerce.date().nullable().optional()});var Be={version:"1.0.0",entities:{issues:We,teams:Oe,projects:Ne,comments:$e,users:Ge}};import{logEventFromContext as X}from"corsair/core";import{z as n}from"zod";import{verifyHmacSignature as Vt}from"corsair/http";var yn=n.object({id:n.string(),createdAt:n.string(),updatedAt:n.string(),archivedAt:n.string().optional()}).catchall(n.any()),x=n.object({id:n.string(),identifier:n.string(),title:n.string(),description:n.string().optional(),priority:n.union([n.literal(0),n.literal(1),n.literal(2),n.literal(3),n.literal(4)]),estimate:n.number().optional(),sortOrder:n.number(),startedAt:n.string().optional(),completedAt:n.string().optional(),canceledAt:n.string().optional(),autoArchivedAt:n.string().optional(),autoClosedAt:n.string().optional(),dueDate:n.string().optional(),trashed:n.boolean().optional(),snoozedUntilAt:n.string().optional(),previousIdentifiers:n.array(n.string()),createdAt:n.string(),updatedAt:n.string(),branchName:n.string(),customerTicketCount:n.number(),stateId:n.string(),teamId:n.string(),creatorId:n.string()}).catchall(n.any()),T=n.object({id:n.string(),body:n.string(),editedAt:n.string().optional(),createdAt:n.string(),updatedAt:n.string(),issueId:n.string(),userId:n.string()}).catchall(n.any()),z=n.object({id:n.string(),name:n.string(),description:n.string().optional(),icon:n.string().optional(),color:n.string().optional(),priority:n.union([n.literal(0),n.literal(1),n.literal(2),n.literal(3),n.literal(4)]),sortOrder:n.number(),state:n.enum(["planned","started","paused","completed","canceled"]),progress:n.number(),url:n.string(),startDate:n.string().optional(),targetDate:n.string().optional(),completedAt:n.string().optional(),canceledAt:n.string().optional(),startedAt:n.string().optional(),completedScopeHistory:n.array(n.number()),inProgressScopeHistory:n.array(n.number()),scope:n.number(),createdAt:n.string(),updatedAt:n.string()}).catchall(n.any()),W=n.object({action:n.literal("create"),type:n.literal("Issue"),data:x,url:n.string(),createdAt:n.string(),organizationId:n.string(),webhookId:n.string()}),O=n.object({action:n.literal("update"),type:n.literal("Issue"),data:x,updatedFrom:x.partial().optional(),url:n.string(),createdAt:n.string(),organizationId:n.string(),webhookId:n.string()}),N=n.object({action:n.literal("remove"),type:n.literal("Issue"),data:x,url:n.string(),createdAt:n.string(),organizationId:n.string(),webhookId:n.string()}),$=n.object({action:n.literal("create"),type:n.literal("Comment"),data:T,url:n.string(),createdAt:n.string(),organizationId:n.string(),webhookId:n.string()}),G=n.object({action:n.literal("update"),type:n.literal("Comment"),data:T,updatedFrom:T.partial().optional(),url:n.string(),createdAt:n.string(),organizationId:n.string(),webhookId:n.string()}),B=n.object({action:n.literal("remove"),type:n.literal("Comment"),data:T,url:n.string(),createdAt:n.string(),organizationId:n.string(),webhookId:n.string()}),_=n.object({action:n.literal("create"),type:n.literal("Project"),data:z,url:n.string(),createdAt:n.string(),organizationId:n.string(),webhookId:n.string()}),M=n.object({action:n.literal("update"),type:n.literal("Project"),data:z,updatedFrom:z.partial().optional(),url:n.string(),createdAt:n.string(),organizationId:n.string(),webhookId:n.string()}),F=n.object({action:n.literal("remove"),type:n.literal("Project"),data:z,url:n.string(),createdAt:n.string(),organizationId:n.string(),webhookId:n.string()}),gn=n.union([W,O,N,$,G,B,_,M,F]);function Qt(t){return typeof t=="string"?JSON.parse(t):t}function m(t,a){if(!a)return{valid:!1};let i=t.rawBody;if(!i)return{valid:!1,error:"Missing raw body for signature verification"};let r=t.headers,o=Array.isArray(r["linear-signature"])?r["linear-signature"][0]:r["linear-signature"];return o?Vt(i,a,o)?{valid:!0}:{valid:!1,error:"Invalid signature"}:{valid:!1,error:"Missing linear-signature header"}}function _e(t,a){return i=>{let r=Qt(i.body);return typeof r.type=="string"&&r.type===t&&typeof r.action=="string"&&r.action===a}}var b=_e;var Me={match:b("Comment","create"),handler:async(t,a)=>{let i=t.key,r=m(a,i);if(!r.valid)return{success:!1,statusCode:401,error:r.error||"Signature verification failed"};let o=a.payload;if(o.type!=="Comment"||o.action!=="create")return{success:!0,data:void 0};console.log("\u{1F4AC} Linear Comment Created Event:",{id:o.data.id,body:o.data.body?.substring(0,100)});let c="";if(t.db.comments&&o.data.id)try{let s=o.data;c=(await t.db.comments.upsertByEntityId(s.id,{...s,editedAt:s.editedAt?new Date(s.editedAt??""):null,createdAt:new Date(s.createdAt??""),updatedAt:new Date(s.updatedAt??"")}))?.id||""}catch(s){console.warn("Failed to save comment to database:",s)}return await X(t,"linear.webhook.commentCreate",{...o},"completed"),{success:!0,corsairEntityId:c,data:o}}},Fe={match:b("Comment","update"),handler:async(t,a)=>{let i=t.key,r=m(a,i);if(!r.valid)return{success:!1,statusCode:401,error:r.error||"Signature verification failed"};let o=a.payload;if(o.type!=="Comment"||o.action!=="update")return{success:!0,data:void 0};console.log("\u270F\uFE0F Linear Comment Updated Event:",{id:o.data.id,updatedFields:o.updatedFrom?Object.keys(o.updatedFrom):[]});let c="";if(t.db.comments&&o.data.id)try{let s=o.data;c=(await t.db.comments.upsertByEntityId(s.id,{...s,editedAt:s.editedAt?new Date(s.editedAt??""):null,createdAt:new Date(s.createdAt??""),updatedAt:new Date(s.updatedAt??"")}))?.id||""}catch(s){console.warn("Failed to update comment in database:",s)}return await X(t,"linear.webhook.commentUpdate",{...o},"completed"),{success:!0,corsairEntityId:c,data:o}}},He={match:b("Comment","remove"),handler:async(t,a)=>{let i=t.key,r=m(a,i);if(!r.valid)return{success:!1,statusCode:401,error:r.error||"Signature verification failed"};let o=a.payload;if(o.type!=="Comment"||o.action!=="remove")return{success:!0,data:void 0};console.log("\u{1F5D1}\uFE0F Linear Comment Deleted Event:",{id:o.data.id});let c="";if(t.db.comments&&o.data.id)try{let s=await t.db.comments.findByEntityId(o.data.id);s&&(c=s.id),await t.db.comments.deleteByEntityId(o.data.id)}catch(s){console.warn("Failed to delete comment from database:",s)}return await X(t,"linear.webhook.commentRemove",{...o},"completed"),{success:!0,corsairEntityId:c,data:o}}};import{logEventFromContext as ee}from"corsair/core";var qe={match:b("Issue","create"),handler:async(t,a)=>{let i=t.key,r=m(a,i);if(!r.valid)return{success:!1,statusCode:401,error:r.error||"Signature verification failed"};let o=a.payload;if(o.type!=="Issue"||o.action!=="create")return{success:!0,data:void 0};console.log("\u{1F4CB} Linear Issue Created Event:",{id:o.data.id,identifier:o.data.identifier,title:o.data.title});let c="";if(t.db.issues&&o.data.id)try{let s=o.data;c=(await t.db.issues.upsertByEntityId(s.id,{...s,number:parseInt(s.identifier.split("-")[1]||"0",10),url:o.url,dueDate:s.dueDate?new Date(s.dueDate??""):null,startedAt:s.startedAt?new Date(s.startedAt??""):null,completedAt:s.completedAt?new Date(s.completedAt??""):null,canceledAt:s.canceledAt?new Date(s.canceledAt??""):null,triagedAt:s.triagedAt?new Date(s.triagedAt??""):null,snoozedUntilAt:s.snoozedUntilAt?new Date(s.snoozedUntilAt??""):null,archivedAt:s.archivedAt?new Date(s.archivedAt??""):null,createdAt:new Date(s.createdAt??""),updatedAt:new Date(s.updatedAt??"")}))?.id||""}catch(s){console.warn("Failed to save issue to database:",s)}return await ee(t,"linear.webhook.issueCreate",{...o},"completed"),{success:!0,corsairEntityId:c,data:o}}},Ke={match:b("Issue","update"),handler:async(t,a)=>{let i=t.key,r=m(a,i);if(!r.valid)return{success:!1,statusCode:401,error:r.error||"Signature verification failed"};let o=a.payload;if(o.type!=="Issue"||o.action!=="update")return{success:!0,data:void 0};console.log("\u{1F4DD} Linear Issue Updated Event:",{id:o.data.id,identifier:o.data.identifier,title:o.data.title,updatedFields:o.updatedFrom?Object.keys(o.updatedFrom):[]});let c="";if(t.db.issues&&o.data.id)try{let s=o.data;c=(await t.db.issues.upsertByEntityId(s.id,{...s,number:parseInt(s.identifier.split("-")[1]||"0",10),url:o.url,dueDate:s.dueDate?new Date(s.dueDate??""):null,startedAt:s.startedAt?new Date(s.startedAt??""):null,completedAt:s.completedAt?new Date(s.completedAt??""):null,canceledAt:s.canceledAt?new Date(s.canceledAt??""):null,triagedAt:s.triagedAt?new Date(s.triagedAt??""):null,snoozedUntilAt:s.snoozedUntilAt?new Date(s.snoozedUntilAt??""):null,archivedAt:s.archivedAt?new Date(s.archivedAt??""):null,createdAt:new Date(s.createdAt??""),updatedAt:new Date(s.updatedAt??"")}))?.id||""}catch(s){console.warn("Failed to update issue in database:",s)}return await ee(t,"linear.webhook.issueUpdate",{...o},"completed"),{success:!0,corsairEntityId:c,data:o}}},Ve={match:b("Issue","remove"),handler:async(t,a)=>{let i=t.key,r=m(a,i);if(!r.valid)return{success:!1,statusCode:401,error:r.error||"Signature verification failed"};let o=a.payload;if(o.type!=="Issue"||o.action!=="remove")return{success:!0,data:void 0};console.log("\u{1F5D1}\uFE0F Linear Issue Deleted Event:",{id:o.data.id,identifier:o.data.identifier});let c="";if(t.db.issues&&o.data.id)try{let s=await t.db.issues.findByEntityId(o.data.id);s&&(c=s.id),await t.db.issues.deleteByEntityId(o.data.id)}catch(s){console.warn("Failed to delete issue from database:",s)}return await ee(t,"linear.webhook.issueRemove",{...o},"completed"),{success:!0,corsairEntityId:c,data:o}}};import{logEventFromContext as te}from"corsair/core";var Qe={match:b("Project","create"),handler:async(t,a)=>{let i=t.key,r=m(a,i);if(!r.valid)return{success:!1,statusCode:401,error:r.error||"Signature verification failed"};let o=a.payload;if(o.type!=="Project"||o.action!=="create")return{success:!0,data:void 0};console.log("\u{1F4CA} Linear Project Created Event:",{id:o.data.id,name:o.data.name,state:o.data.state});let c="";if(t.db.projects&&o.data.id)try{let s=o.data;c=(await t.db.projects.upsertByEntityId(s.id,{...s,completedAt:s.completedAt?new Date(s.completedAt):null,canceledAt:s.canceledAt?new Date(s.canceledAt):null,createdAt:new Date(s.createdAt??""),updatedAt:new Date(s.updatedAt??""),startDate:s.startDate?new Date(s.startDate):null,targetDate:s.targetDate?new Date(s.targetDate):null}))?.id||""}catch(s){console.warn("Failed to save project to database:",s)}return await te(t,"linear.webhook.projectCreate",{...o},"completed"),{success:!0,corsairEntityId:c,data:o}}},Ye={match:b("Project","update"),handler:async(t,a)=>{let i=t.key,r=m(a,i);if(!r.valid)return{success:!1,statusCode:401,error:r.error||"Signature verification failed"};let o=a.payload;if(o.type!=="Project"||o.action!=="update")return{success:!0,data:void 0};console.log("\u{1F4DD} Linear Project Updated Event:",{id:o.data.id,name:o.data.name,updatedFields:o.updatedFrom?Object.keys(o.updatedFrom):[]});let c="";if(t.db.projects&&o.data.id)try{let s=o.data;c=(await t.db.projects.upsertByEntityId(s.id,{...s,completedAt:s.completedAt?new Date(s.completedAt):null,canceledAt:s.canceledAt?new Date(s.canceledAt):null,createdAt:new Date(s.createdAt??""),startDate:s.startDate?new Date(s.startDate):null,targetDate:s.targetDate?new Date(s.targetDate):null,updatedAt:new Date(s.updatedAt??"")}))?.id||""}catch(s){console.warn("Failed to update project in database:",s)}return await te(t,"linear.webhook.projectUpdate",{...o},"completed"),{success:!0,corsairEntityId:c,data:o}}},Je={match:b("Project","remove"),handler:async(t,a)=>{let i=t.key,r=m(a,i);if(!r.valid)return{success:!1,statusCode:401,error:r.error||"Signature verification failed"};let o=a.payload;if(o.type!=="Project"||o.action!=="remove")return{success:!0,data:void 0};console.log("\u{1F5D1}\uFE0F Linear Project Deleted Event:",{id:o.data.id,name:o.data.name});let c="";if(t.db.projects&&o.data.id)try{let s=await t.db.projects.findByEntityId(o.data.id);s&&(c=s.id),await t.db.projects.deleteByEntityId(o.data.id)}catch(s){console.warn("Failed to delete project from database:",s)}return await te(t,"linear.webhook.projectRemove",{...o},"completed"),{success:!0,corsairEntityId:c,data:o}}};var H={create:Me,update:Fe,remove:He},q={create:qe,update:Ke,remove:Ve},K={create:Qe,update:Ye,remove:Je};var Yt={issues:{create:q.create,update:q.update,remove:q.remove},comments:{create:H.create,update:H.update,remove:H.remove},projects:{create:K.create,update:K.update,remove:K.remove}},Jt={issues:{list:L.list,get:L.get,create:L.create,update:L.update,delete:L.delete},comments:{list:R.list,create:R.create,update:R.update,delete:R.delete},projects:{list:v.list,get:v.get,create:v.create,update:v.update,delete:v.delete},teams:{list:J.list,get:J.get},users:{list:Z.list,get:Z.get}},Zt={"issues.list":{input:l.issuesList,output:u.issuesList},"issues.get":{input:l.issuesGet,output:u.issuesGet},"issues.create":{input:l.issuesCreate,output:u.issuesCreate},"issues.update":{input:l.issuesUpdate,output:u.issuesUpdate},"issues.delete":{input:l.issuesDelete,output:u.issuesDelete},"comments.list":{input:l.commentsList,output:u.commentsList},"comments.create":{input:l.commentsCreate,output:u.commentsCreate},"comments.update":{input:l.commentsUpdate,output:u.commentsUpdate},"comments.delete":{input:l.commentsDelete,output:u.commentsDelete},"projects.list":{input:l.projectsList,output:u.projectsList},"projects.get":{input:l.projectsGet,output:u.projectsGet},"projects.create":{input:l.projectsCreate,output:u.projectsCreate},"projects.update":{input:l.projectsUpdate,output:u.projectsUpdate},"projects.delete":{input:l.projectsDelete,output:u.projectsDelete},"teams.list":{input:l.teamsList,output:u.teamsList},"teams.get":{input:l.teamsGet,output:u.teamsGet},"users.list":{input:l.usersList,output:u.usersList},"users.get":{input:l.usersGet,output:u.usersGet}},Xt={"issues.create":{description:"A new issue was created",payload:W,response:W},"issues.update":{description:"An issue was updated",payload:O,response:O},"issues.remove":{description:"An issue was deleted",payload:N,response:N},"comments.create":{description:"A comment was added to an issue",payload:$,response:$},"comments.update":{description:"A comment was updated",payload:G,response:G},"comments.remove":{description:"A comment was deleted",payload:B,response:B},"projects.create":{description:"A new project was created",payload:_,response:_},"projects.update":{description:"A project was updated",payload:M,response:M},"projects.remove":{description:"A project was deleted",payload:F,response:F}},eo="api_key",to={"issues.list":{riskLevel:"read",description:"List issues in a team"},"issues.get":{riskLevel:"read",description:"Get a specific issue"},"issues.create":{riskLevel:"write",description:"Create a new issue"},"issues.update":{riskLevel:"write",description:"Update an existing issue"},"issues.delete":{riskLevel:"destructive",irreversible:!0,description:"Permanently delete an issue [DESTRUCTIVE \xB7 IRREVERSIBLE]"},"comments.list":{riskLevel:"read",description:"List comments on an issue"},"comments.create":{riskLevel:"write",description:"Post a comment on an issue"},"comments.update":{riskLevel:"write",description:"Update a comment"},"comments.delete":{riskLevel:"destructive",irreversible:!0,description:"Delete a comment [DESTRUCTIVE]"},"projects.list":{riskLevel:"read",description:"List projects in a team"},"projects.get":{riskLevel:"read",description:"Get a specific project"},"projects.create":{riskLevel:"write",description:"Create a new project"},"projects.update":{riskLevel:"write",description:"Update an existing project"},"projects.delete":{riskLevel:"destructive",irreversible:!0,description:"Permanently delete a project [DESTRUCTIVE \xB7 IRREVERSIBLE]"},"teams.list":{riskLevel:"read",description:"List teams in the workspace"},"teams.get":{riskLevel:"read",description:"Get a specific team"},"users.list":{riskLevel:"read",description:"List users in the workspace"},"users.get":{riskLevel:"read",description:"Get a specific user"}};function Nn(t={}){let a={...t,authType:t.authType??eo};return{id:"linear",schema:Be,options:a,hooks:a.hooks,webhookHooks:a.webhookHooks,endpoints:Jt,webhooks:Yt,endpointMeta:to,endpointSchemas:Zt,webhookSchemas:Xt,pluginWebhookMatcher:i=>"linear-signature"in i.headers,errorHandlers:{...ze,...a.errorHandlers},keyBuilder:async(i,r)=>{if(r==="webhook"&&a.webhookSecret)return a.webhookSecret;if(r==="webhook"){let o=await i.keys.get_webhook_signature();return o||""}if(r==="endpoint"&&a.key)return a.key;if(r==="endpoint"&&i.authType==="api_key"){let o=await i.keys.get_api_key();return o||""}return""}}}export{_e as createLinearEventMatch,Nn as linear,Zt as linearEndpointSchemas,m as verifyLinearWebhookSignature};
|