@frogbotai/piece-linear 0.21.0 → 0.23.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.
Files changed (78) hide show
  1. package/README.md +111 -0
  2. package/dist/actions/createComment.d.ts +48 -0
  3. package/dist/actions/createComment.d.ts.map +1 -0
  4. package/dist/actions/createComment.js +22 -0
  5. package/dist/actions/createComment.js.map +1 -0
  6. package/dist/actions/createIssue.d.ts +79 -0
  7. package/dist/actions/createIssue.d.ts.map +1 -0
  8. package/dist/actions/createIssue.js +37 -0
  9. package/dist/actions/createIssue.js.map +1 -0
  10. package/dist/actions/createProject.d.ts +49 -0
  11. package/dist/actions/createProject.d.ts.map +1 -0
  12. package/dist/actions/createProject.js +32 -0
  13. package/dist/actions/createProject.js.map +1 -0
  14. package/dist/actions/options.d.ts +35 -0
  15. package/dist/actions/options.d.ts.map +1 -0
  16. package/dist/actions/options.js +27 -0
  17. package/dist/actions/options.js.map +1 -0
  18. package/dist/actions/rawGraphqlQuery.d.ts +20 -0
  19. package/dist/actions/rawGraphqlQuery.d.ts.map +1 -0
  20. package/dist/actions/rawGraphqlQuery.js +16 -0
  21. package/dist/actions/rawGraphqlQuery.js.map +1 -0
  22. package/dist/actions/updateIssue.d.ts +88 -0
  23. package/dist/actions/updateIssue.d.ts.map +1 -0
  24. package/dist/actions/updateIssue.js +39 -0
  25. package/dist/actions/updateIssue.js.map +1 -0
  26. package/dist/actions/updateProject.d.ts +57 -0
  27. package/dist/actions/updateProject.d.ts.map +1 -0
  28. package/dist/actions/updateProject.js +33 -0
  29. package/dist/actions/updateProject.js.map +1 -0
  30. package/dist/client.d.ts +6 -0
  31. package/dist/client.d.ts.map +1 -0
  32. package/dist/client.js +9 -0
  33. package/dist/client.js.map +1 -0
  34. package/dist/config.d.ts +20 -0
  35. package/dist/config.d.ts.map +1 -0
  36. package/dist/config.js +25 -0
  37. package/dist/config.js.map +1 -0
  38. package/dist/index.d.ts +456 -15
  39. package/dist/index.d.ts.map +1 -1
  40. package/dist/index.js +107 -30
  41. package/dist/index.js.map +1 -1
  42. package/dist/triggers/commentCreated.d.ts +12 -0
  43. package/dist/triggers/commentCreated.d.ts.map +1 -0
  44. package/dist/triggers/commentCreated.js +17 -0
  45. package/dist/triggers/commentCreated.js.map +1 -0
  46. package/dist/triggers/issueCreated.d.ts +11 -0
  47. package/dist/triggers/issueCreated.d.ts.map +1 -0
  48. package/dist/triggers/issueCreated.js +10 -0
  49. package/dist/triggers/issueCreated.js.map +1 -0
  50. package/dist/triggers/issueRemoved.d.ts +11 -0
  51. package/dist/triggers/issueRemoved.d.ts.map +1 -0
  52. package/dist/triggers/issueRemoved.js +10 -0
  53. package/dist/triggers/issueRemoved.js.map +1 -0
  54. package/dist/triggers/issueUpdated.d.ts +11 -0
  55. package/dist/triggers/issueUpdated.d.ts.map +1 -0
  56. package/dist/triggers/issueUpdated.js +10 -0
  57. package/dist/triggers/issueUpdated.js.map +1 -0
  58. package/dist/triggers/projectCreated.d.ts +9 -0
  59. package/dist/triggers/projectCreated.d.ts.map +1 -0
  60. package/dist/triggers/projectCreated.js +9 -0
  61. package/dist/triggers/projectCreated.js.map +1 -0
  62. package/dist/triggers/projectRemoved.d.ts +9 -0
  63. package/dist/triggers/projectRemoved.d.ts.map +1 -0
  64. package/dist/triggers/projectRemoved.js +9 -0
  65. package/dist/triggers/projectRemoved.js.map +1 -0
  66. package/dist/triggers/projectUpdated.d.ts +12 -0
  67. package/dist/triggers/projectUpdated.d.ts.map +1 -0
  68. package/dist/triggers/projectUpdated.js +15 -0
  69. package/dist/triggers/projectUpdated.js.map +1 -0
  70. package/dist/triggers/webhook.d.ts +34 -0
  71. package/dist/triggers/webhook.d.ts.map +1 -0
  72. package/dist/triggers/webhook.js +52 -0
  73. package/dist/triggers/webhook.js.map +1 -0
  74. package/dist/webhook.d.ts +4 -0
  75. package/dist/webhook.d.ts.map +1 -0
  76. package/dist/webhook.js +33 -0
  77. package/dist/webhook.js.map +1 -0
  78. package/package.json +6 -4
package/dist/index.d.ts CHANGED
@@ -1,18 +1,459 @@
1
- import { type PieceFactoryConfig } from 'frogbot/pieces';
2
- export declare const linearActions: readonly ["linear_create_issue", "linear_update_issue", "linear_create_project", "linear_create_comment"];
1
+ import type { z } from 'zod';
2
+ import { createLinearClient, type Linear } from './client.js';
3
+ export declare const linearActions: readonly ["createIssue", "updateIssue", "createProject", "updateProject", "createComment", "rawGraphqlQuery"];
4
+ export declare const linearTriggers: readonly ["commentCreated", "issueCreated", "issueUpdated", "issueRemoved", "projectCreated", "projectUpdated", "projectRemoved"];
3
5
  export declare const linearScopes: readonly [];
4
- export declare function createLinear(config?: PieceFactoryConfig): import("frogbot/pieces").Piece & {
5
- /** Create Issue: Create a new issue in Linear workspace */
6
- linearCreateIssue: import("node_modules/frogbot/dist/tools/types").AnyTool;
7
- /** Update Issue: Update a issue in Linear Workspace */
8
- linearUpdateIssue: import("node_modules/frogbot/dist/tools/types").AnyTool;
9
- /** Create Project: Create a new project in Linear workspace */
10
- linearCreateProject: import("node_modules/frogbot/dist/tools/types").AnyTool;
11
- /** Update Project: Update a existing project in Linear workspace */
12
- linearUpdateProject: import("node_modules/frogbot/dist/tools/types").AnyTool;
13
- /** Create Comment: Create a new comment on an issue in Linear workspace */
14
- linearCreateComment: import("node_modules/frogbot/dist/tools/types").AnyTool;
15
- /** Raw GraphQL query: Perform a raw GraphQL query */
16
- rawGraphqlQuery: import("node_modules/frogbot/dist/tools/types").AnyTool;
6
+ export declare const linearOAuth: {
7
+ authorizationUrl: string;
8
+ tokenUrl: string;
9
+ scopes: string[];
10
+ scopeSeparator: ",";
11
+ params: {
12
+ actor: string;
13
+ };
14
+ toAuth({ tokens }: {
15
+ tokens: import("frogbot/pieces").OAuthTokens;
16
+ }): {
17
+ accessToken: string;
18
+ };
19
+ account({ client }: {
20
+ tokens: import("frogbot/pieces").OAuthTokens;
21
+ client: import("@linear/sdk").LinearClient;
22
+ req: import("node_modules/frogbot/dist/types/request.js").FrogbotRequest;
23
+ }): Promise<{
24
+ id: string;
25
+ label: string;
26
+ email: string;
27
+ }>;
17
28
  };
29
+ export declare const createLinear: import("frogbot/pieces").PieceFactory<{
30
+ readonly slug: "linear";
31
+ readonly label: "Linear";
32
+ readonly admin: {
33
+ readonly description: "Manage Linear issues, projects, comments, and webhooks";
34
+ readonly group: "Productivity";
35
+ };
36
+ readonly auth: z.ZodPipe<z.ZodObject<{
37
+ apiKey: z.ZodOptional<z.ZodString>;
38
+ accessToken: z.ZodOptional<z.ZodString>;
39
+ }, z.core.$strip>, z.ZodUnion<readonly [z.ZodObject<{
40
+ apiKey: z.ZodString;
41
+ }, z.core.$strip>, z.ZodObject<{
42
+ accessToken: z.ZodString;
43
+ }, z.core.$strip>]>>;
44
+ readonly options: z.ZodObject<{
45
+ webhookSecret: z.ZodOptional<z.ZodString>;
46
+ channelMode: z.ZodDefault<z.ZodEnum<{
47
+ "agent-sessions": "agent-sessions";
48
+ comments: "comments";
49
+ }>>;
50
+ botUsername: z.ZodOptional<z.ZodString>;
51
+ }, z.core.$strip>;
52
+ readonly oauth: {
53
+ authorizationUrl: string;
54
+ tokenUrl: string;
55
+ scopes: string[];
56
+ scopeSeparator: ",";
57
+ params: {
58
+ actor: string;
59
+ };
60
+ toAuth({ tokens }: {
61
+ tokens: import("frogbot/pieces").OAuthTokens;
62
+ }): {
63
+ accessToken: string;
64
+ };
65
+ account({ client }: {
66
+ tokens: import("frogbot/pieces").OAuthTokens;
67
+ client: import("@linear/sdk").LinearClient;
68
+ req: import("node_modules/frogbot/dist/types/request.js").FrogbotRequest;
69
+ }): Promise<{
70
+ id: string;
71
+ label: string;
72
+ email: string;
73
+ }>;
74
+ };
75
+ readonly client: typeof createLinearClient;
76
+ readonly webhook: import("frogbot/pieces").PieceWebhook<{
77
+ channelMode: "agent-sessions" | "comments";
78
+ webhookSecret?: string | undefined;
79
+ botUsername?: string | undefined;
80
+ }>;
81
+ readonly channel: {
82
+ adapter({ auth, options }: {
83
+ auth: {
84
+ apiKey: string;
85
+ } | {
86
+ accessToken: string;
87
+ };
88
+ options: {
89
+ channelMode: "agent-sessions" | "comments";
90
+ webhookSecret?: string | undefined;
91
+ botUsername?: string | undefined;
92
+ };
93
+ }): import("@chat-adapter/linear").LinearAdapter;
94
+ identity({ author, client, req }: {
95
+ author: import("chat").Author;
96
+ client: import("@linear/sdk").LinearClient;
97
+ req: import("node_modules/frogbot/dist/types/request.js").FrogbotRequest;
98
+ }): Promise<{
99
+ collection: string;
100
+ id: string | number;
101
+ } | null>;
102
+ };
103
+ readonly actions: readonly [{
104
+ slug: string;
105
+ description: string;
106
+ input: z.ZodObject<{
107
+ teamId: z.ZodString;
108
+ title: z.ZodString;
109
+ description: z.ZodOptional<z.ZodString>;
110
+ stateId: z.ZodOptional<z.ZodString>;
111
+ labelIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
112
+ assigneeId: z.ZodOptional<z.ZodString>;
113
+ priority: z.ZodOptional<z.ZodNumber>;
114
+ templateId: z.ZodOptional<z.ZodString>;
115
+ }, z.core.$strip>;
116
+ output: z.ZodObject<{
117
+ success: z.ZodBoolean;
118
+ lastSyncId: z.ZodOptional<z.ZodNumber>;
119
+ }, z.core.$loose>;
120
+ idempotent: false;
121
+ options: {
122
+ teamId: ({ client }: {
123
+ client: Linear;
124
+ }) => Promise<{
125
+ label: string;
126
+ value: string;
127
+ }[]>;
128
+ stateId: ({ client, input }: {
129
+ client: Linear;
130
+ input: {
131
+ teamId?: string;
132
+ };
133
+ }) => Promise<{
134
+ label: string;
135
+ value: string;
136
+ }[]>;
137
+ labelIds: ({ client, input }: {
138
+ client: Linear;
139
+ input: {
140
+ teamId?: string;
141
+ };
142
+ }) => Promise<{
143
+ label: string;
144
+ value: string;
145
+ }[]>;
146
+ assigneeId: ({ client }: {
147
+ client: Linear;
148
+ }) => Promise<{
149
+ label: string;
150
+ value: string;
151
+ }[]>;
152
+ priority: ({ client }: {
153
+ client: Linear;
154
+ }) => Promise<{
155
+ label: string;
156
+ value: string;
157
+ }[]>;
158
+ };
159
+ run({ client, input }: import("frogbot/pieces").PieceRunArgs<z.output<z.ZodObject<{
160
+ teamId: z.ZodString;
161
+ title: z.ZodString;
162
+ description: z.ZodOptional<z.ZodString>;
163
+ stateId: z.ZodOptional<z.ZodString>;
164
+ labelIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
165
+ assigneeId: z.ZodOptional<z.ZodString>;
166
+ priority: z.ZodOptional<z.ZodNumber>;
167
+ templateId: z.ZodOptional<z.ZodString>;
168
+ }, z.core.$strip>>, object, Linear>): Promise<{
169
+ success: boolean;
170
+ lastSyncId: number;
171
+ issue: {
172
+ id: string | undefined;
173
+ };
174
+ }>;
175
+ }, {
176
+ slug: string;
177
+ description: string;
178
+ input: z.ZodObject<{
179
+ teamId: z.ZodString;
180
+ issueId: z.ZodString;
181
+ title: z.ZodOptional<z.ZodString>;
182
+ description: z.ZodOptional<z.ZodString>;
183
+ stateId: z.ZodOptional<z.ZodString>;
184
+ labelIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
185
+ assigneeId: z.ZodOptional<z.ZodString>;
186
+ priority: z.ZodOptional<z.ZodNumber>;
187
+ }, z.core.$strip>;
188
+ output: z.ZodObject<{
189
+ success: z.ZodBoolean;
190
+ lastSyncId: z.ZodOptional<z.ZodNumber>;
191
+ }, z.core.$loose>;
192
+ idempotent: boolean;
193
+ options: {
194
+ teamId: ({ client }: {
195
+ client: Linear;
196
+ }) => Promise<{
197
+ label: string;
198
+ value: string;
199
+ }[]>;
200
+ issueId: ({ client, input }: {
201
+ client: Linear;
202
+ input: {
203
+ teamId?: string;
204
+ };
205
+ }) => Promise<{
206
+ label: string;
207
+ value: string;
208
+ }[]>;
209
+ stateId: ({ client, input }: {
210
+ client: Linear;
211
+ input: {
212
+ teamId?: string;
213
+ };
214
+ }) => Promise<{
215
+ label: string;
216
+ value: string;
217
+ }[]>;
218
+ labelIds: ({ client, input }: {
219
+ client: Linear;
220
+ input: {
221
+ teamId?: string;
222
+ };
223
+ }) => Promise<{
224
+ label: string;
225
+ value: string;
226
+ }[]>;
227
+ assigneeId: ({ client }: {
228
+ client: Linear;
229
+ }) => Promise<{
230
+ label: string;
231
+ value: string;
232
+ }[]>;
233
+ priority: ({ client }: {
234
+ client: Linear;
235
+ }) => Promise<{
236
+ label: string;
237
+ value: string;
238
+ }[]>;
239
+ };
240
+ run({ client, input }: import("frogbot/pieces").PieceRunArgs<z.output<z.ZodObject<{
241
+ teamId: z.ZodString;
242
+ issueId: z.ZodString;
243
+ title: z.ZodOptional<z.ZodString>;
244
+ description: z.ZodOptional<z.ZodString>;
245
+ stateId: z.ZodOptional<z.ZodString>;
246
+ labelIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
247
+ assigneeId: z.ZodOptional<z.ZodString>;
248
+ priority: z.ZodOptional<z.ZodNumber>;
249
+ }, z.core.$strip>>, object, Linear>): Promise<{
250
+ success: boolean;
251
+ lastSyncId: number;
252
+ issue: {
253
+ id: string | undefined;
254
+ };
255
+ }>;
256
+ }, {
257
+ slug: string;
258
+ description: string;
259
+ input: z.ZodObject<{
260
+ teamId: z.ZodString;
261
+ name: z.ZodString;
262
+ description: z.ZodOptional<z.ZodString>;
263
+ icon: z.ZodOptional<z.ZodString>;
264
+ color: z.ZodOptional<z.ZodString>;
265
+ startDate: z.ZodOptional<z.ZodString>;
266
+ targetDate: z.ZodOptional<z.ZodString>;
267
+ statusId: z.ZodOptional<z.ZodString>;
268
+ }, z.core.$strip>;
269
+ output: z.ZodObject<{
270
+ success: z.ZodBoolean;
271
+ lastSyncId: z.ZodOptional<z.ZodNumber>;
272
+ }, z.core.$loose>;
273
+ idempotent: boolean;
274
+ options: {
275
+ teamId: ({ client }: {
276
+ client: Linear;
277
+ }) => Promise<{
278
+ label: string;
279
+ value: string;
280
+ }[]>;
281
+ };
282
+ run({ client, input }: import("frogbot/pieces").PieceRunArgs<z.output<z.ZodObject<{
283
+ teamId: z.ZodString;
284
+ name: z.ZodString;
285
+ description: z.ZodOptional<z.ZodString>;
286
+ icon: z.ZodOptional<z.ZodString>;
287
+ color: z.ZodOptional<z.ZodString>;
288
+ startDate: z.ZodOptional<z.ZodString>;
289
+ targetDate: z.ZodOptional<z.ZodString>;
290
+ statusId: z.ZodOptional<z.ZodString>;
291
+ }, z.core.$strip>>, object, Linear>): Promise<{
292
+ success: boolean;
293
+ lastSyncId: number;
294
+ project: {
295
+ id: string | undefined;
296
+ };
297
+ }>;
298
+ }, {
299
+ slug: string;
300
+ description: string;
301
+ input: z.ZodObject<{
302
+ teamId: z.ZodString;
303
+ projectId: z.ZodString;
304
+ name: z.ZodString;
305
+ description: z.ZodOptional<z.ZodString>;
306
+ icon: z.ZodOptional<z.ZodString>;
307
+ color: z.ZodOptional<z.ZodString>;
308
+ startDate: z.ZodOptional<z.ZodString>;
309
+ targetDate: z.ZodOptional<z.ZodString>;
310
+ statusId: z.ZodOptional<z.ZodString>;
311
+ }, z.core.$strip>;
312
+ output: z.ZodObject<{
313
+ success: z.ZodBoolean;
314
+ lastSyncId: z.ZodOptional<z.ZodNumber>;
315
+ }, z.core.$loose>;
316
+ idempotent: boolean;
317
+ options: {
318
+ teamId: ({ client }: {
319
+ client: Linear;
320
+ }) => Promise<{
321
+ label: string;
322
+ value: string;
323
+ }[]>;
324
+ projectId: ({ client }: {
325
+ client: Linear;
326
+ }) => Promise<{
327
+ label: string;
328
+ value: string;
329
+ }[]>;
330
+ };
331
+ run({ client, input }: import("frogbot/pieces").PieceRunArgs<z.output<z.ZodObject<{
332
+ teamId: z.ZodString;
333
+ projectId: z.ZodString;
334
+ name: z.ZodString;
335
+ description: z.ZodOptional<z.ZodString>;
336
+ icon: z.ZodOptional<z.ZodString>;
337
+ color: z.ZodOptional<z.ZodString>;
338
+ startDate: z.ZodOptional<z.ZodString>;
339
+ targetDate: z.ZodOptional<z.ZodString>;
340
+ statusId: z.ZodOptional<z.ZodString>;
341
+ }, z.core.$strip>>, object, Linear>): Promise<{
342
+ success: boolean;
343
+ lastSyncId: number;
344
+ project: {
345
+ id: string | undefined;
346
+ };
347
+ }>;
348
+ }, {
349
+ slug: string;
350
+ description: string;
351
+ input: z.ZodObject<{
352
+ teamId: z.ZodString;
353
+ issueId: z.ZodString;
354
+ body: z.ZodString;
355
+ }, z.core.$strip>;
356
+ output: z.ZodObject<{
357
+ success: z.ZodBoolean;
358
+ lastSyncId: z.ZodOptional<z.ZodNumber>;
359
+ }, z.core.$loose>;
360
+ idempotent: boolean;
361
+ options: {
362
+ teamId: ({ client }: {
363
+ client: Linear;
364
+ }) => Promise<{
365
+ label: string;
366
+ value: string;
367
+ }[]>;
368
+ issueId: ({ client, input }: {
369
+ client: Linear;
370
+ input: {
371
+ teamId?: string;
372
+ };
373
+ }) => Promise<{
374
+ label: string;
375
+ value: string;
376
+ }[]>;
377
+ };
378
+ run({ client, input }: import("frogbot/pieces").PieceRunArgs<z.output<z.ZodObject<{
379
+ teamId: z.ZodString;
380
+ issueId: z.ZodString;
381
+ body: z.ZodString;
382
+ }, z.core.$strip>>, object, Linear>): Promise<{
383
+ success: boolean;
384
+ lastSyncId: number;
385
+ comment: {
386
+ id: string | undefined;
387
+ };
388
+ }>;
389
+ }, {
390
+ slug: string;
391
+ description: string;
392
+ input: z.ZodObject<{
393
+ query: z.ZodString;
394
+ variables: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
395
+ }, z.core.$strip>;
396
+ output: z.ZodUnknown;
397
+ idempotent: boolean;
398
+ run({ client, input }: import("frogbot/pieces").PieceRunArgs<z.output<z.ZodObject<{
399
+ query: z.ZodString;
400
+ variables: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
401
+ }, z.core.$strip>>, object, Linear>): Promise<import("@linear/sdk").LinearRawResponse<unknown>>;
402
+ }];
403
+ readonly triggers: readonly [import("frogbot/pieces").PieceWebhookTrigger<z.ZodObject<{
404
+ teamIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
405
+ authorIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
406
+ }, z.core.$strip>, undefined, {
407
+ channelMode: "agent-sessions" | "comments";
408
+ webhookSecret?: string | undefined;
409
+ botUsername?: string | undefined;
410
+ }, import("@linear/sdk").LinearClient, {
411
+ webhookId: string;
412
+ }>, import("frogbot/pieces").PieceWebhookTrigger<z.ZodObject<{
413
+ teamId: z.ZodString;
414
+ }, z.core.$strip>, undefined, {
415
+ channelMode: "agent-sessions" | "comments";
416
+ webhookSecret?: string | undefined;
417
+ botUsername?: string | undefined;
418
+ }, import("@linear/sdk").LinearClient, {
419
+ webhookId: string;
420
+ }>, import("frogbot/pieces").PieceWebhookTrigger<z.ZodObject<{
421
+ teamId: z.ZodOptional<z.ZodString>;
422
+ }, z.core.$strip>, undefined, {
423
+ channelMode: "agent-sessions" | "comments";
424
+ webhookSecret?: string | undefined;
425
+ botUsername?: string | undefined;
426
+ }, import("@linear/sdk").LinearClient, {
427
+ webhookId: string;
428
+ }>, import("frogbot/pieces").PieceWebhookTrigger<z.ZodObject<{
429
+ teamId: z.ZodString;
430
+ }, z.core.$strip>, undefined, {
431
+ channelMode: "agent-sessions" | "comments";
432
+ webhookSecret?: string | undefined;
433
+ botUsername?: string | undefined;
434
+ }, import("@linear/sdk").LinearClient, {
435
+ webhookId: string;
436
+ }>, import("frogbot/pieces").PieceWebhookTrigger<z.ZodObject<{}, z.core.$strip>, undefined, {
437
+ channelMode: "agent-sessions" | "comments";
438
+ webhookSecret?: string | undefined;
439
+ botUsername?: string | undefined;
440
+ }, import("@linear/sdk").LinearClient, {
441
+ webhookId: string;
442
+ }>, import("frogbot/pieces").PieceWebhookTrigger<z.ZodObject<{
443
+ teamIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
444
+ projectStatus: z.ZodOptional<z.ZodString>;
445
+ }, z.core.$strip>, undefined, {
446
+ channelMode: "agent-sessions" | "comments";
447
+ webhookSecret?: string | undefined;
448
+ botUsername?: string | undefined;
449
+ }, import("@linear/sdk").LinearClient, {
450
+ webhookId: string;
451
+ }>, import("frogbot/pieces").PieceWebhookTrigger<z.ZodObject<{}, z.core.$strip>, undefined, {
452
+ channelMode: "agent-sessions" | "comments";
453
+ webhookSecret?: string | undefined;
454
+ botUsername?: string | undefined;
455
+ }, import("@linear/sdk").LinearClient, {
456
+ webhookId: string;
457
+ }>];
458
+ }>;
18
459
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAA2B,KAAK,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAElF,eAAO,MAAM,aAAa,2GAKhB,CAAC;AACX,eAAO,MAAM,YAAY,aAAc,CAAC;AAExC,wBAAgB,YAAY,CAAC,MAAM,CAAC,EAAE,kBAAkB;IAUpD,2DAA2D;;IAE3D,uDAAuD;;IAEvD,+DAA+D;;IAE/D,oEAAoE;;IAEpE,2EAA2E;;IAE3E,qDAAqD;;EAGxD"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAQ7B,OAAO,EAAE,kBAAkB,EAAE,KAAK,MAAM,EAAE,MAAM,aAAa,CAAC;AAW9D,eAAO,MAAM,aAAa,+GAOhB,CAAC;AACX,eAAO,MAAM,cAAc,mIAQjB,CAAC;AACX,eAAO,MAAM,YAAY,aAAc,CAAC;AAExC,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;CAsByC,CAAC;AAoClE,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0BA/DP,CAAC;;;;;;;;;0BAAD,CAAC;;;;;;;;;;;;;;;;;;;qEAjBK,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0BAiBd,CAAC;;;;;;;;;0BAAD,CAAC;;;;;;;;;0BAAD,CAAC;;;;;;;;;;;;;;;;;;;qEAjBQ,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qEAJD,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qEACZ,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0BAoBpB,CAAC;;;;;;;qEAvBV,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;qEAJmC,EAAE,MAClD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgHF,CAAC"}
package/dist/index.js CHANGED
@@ -1,34 +1,111 @@
1
- import * as module from '@activepieces/piece-linear';
2
- import { createActivepiecesPiece } from 'frogbot/pieces';
1
+ import { createLinearAdapter } from '@chat-adapter/linear';
2
+ import { definePiece } from 'frogbot/pieces';
3
+ import { createComment } from './actions/createComment.js';
4
+ import { createIssue } from './actions/createIssue.js';
5
+ import { createProject } from './actions/createProject.js';
6
+ import { rawGraphqlQuery } from './actions/rawGraphqlQuery.js';
7
+ import { updateIssue } from './actions/updateIssue.js';
8
+ import { updateProject } from './actions/updateProject.js';
9
+ import { createLinearClient } from './client.js';
10
+ import { linearAuth, linearOptions } from './config.js';
11
+ import { commentCreated } from './triggers/commentCreated.js';
12
+ import { issueCreated } from './triggers/issueCreated.js';
13
+ import { issueRemoved } from './triggers/issueRemoved.js';
14
+ import { issueUpdated } from './triggers/issueUpdated.js';
15
+ import { projectCreated } from './triggers/projectCreated.js';
16
+ import { projectRemoved } from './triggers/projectRemoved.js';
17
+ import { projectUpdated } from './triggers/projectUpdated.js';
18
+ import { linearWebhook } from './webhook.js';
3
19
  export const linearActions = [
4
- 'linear_create_issue',
5
- 'linear_update_issue',
6
- 'linear_create_project',
7
- 'linear_create_comment',
20
+ 'createIssue',
21
+ 'updateIssue',
22
+ 'createProject',
23
+ 'updateProject',
24
+ 'createComment',
25
+ 'rawGraphqlQuery',
26
+ ];
27
+ export const linearTriggers = [
28
+ 'commentCreated',
29
+ 'issueCreated',
30
+ 'issueUpdated',
31
+ 'issueRemoved',
32
+ 'projectCreated',
33
+ 'projectUpdated',
34
+ 'projectRemoved',
8
35
  ];
9
36
  export const linearScopes = [];
10
- export function createLinear(config) {
11
- const piece = createActivepiecesPiece({
12
- module: module,
13
- service: 'linear',
14
- credentialType: 'secret_text',
15
- defaultActions: linearActions,
16
- scopes: linearScopes,
17
- config,
18
- });
19
- return Object.assign(piece, {
20
- /** Create Issue: Create a new issue in Linear workspace */
21
- linearCreateIssue: piece.tool('linear_create_issue'),
22
- /** Update Issue: Update a issue in Linear Workspace */
23
- linearUpdateIssue: piece.tool('linear_update_issue'),
24
- /** Create Project: Create a new project in Linear workspace */
25
- linearCreateProject: piece.tool('linear_create_project'),
26
- /** Update Project: Update a existing project in Linear workspace */
27
- linearUpdateProject: piece.tool('linear_update_project'),
28
- /** Create Comment: Create a new comment on an issue in Linear workspace */
29
- linearCreateComment: piece.tool('linear_create_comment'),
30
- /** Raw GraphQL query: Perform a raw GraphQL query */
31
- rawGraphqlQuery: piece.tool('rawGraphqlQuery'),
32
- });
33
- }
37
+ export const linearOAuth = {
38
+ authorizationUrl: 'https://linear.app/oauth/authorize',
39
+ tokenUrl: 'https://api.linear.app/oauth/token',
40
+ scopes: ['read', 'write', 'comments:create', 'issues:create', 'app:mentionable'],
41
+ scopeSeparator: ',',
42
+ params: { actor: 'app' },
43
+ toAuth({ tokens }) {
44
+ if (!tokens.access_token?.trim()) {
45
+ throw new Error('Linear OAuth did not return an access token.');
46
+ }
47
+ return { accessToken: tokens.access_token };
48
+ },
49
+ async account({ client }) {
50
+ const viewer = await client.viewer;
51
+ if (!viewer.email?.trim()) {
52
+ throw new Error('Linear did not return an account email address.');
53
+ }
54
+ return { id: viewer.id, label: viewer.name, email: viewer.email };
55
+ },
56
+ };
57
+ const linearChannel = {
58
+ adapter({ auth, options }) {
59
+ if (!options.webhookSecret) {
60
+ throw new Error('Linear channels require a webhookSecret option.');
61
+ }
62
+ return createLinearAdapter({
63
+ ...('apiKey' in auth ? { apiKey: auth.apiKey } : { accessToken: auth.accessToken }),
64
+ webhookSecret: options.webhookSecret,
65
+ mode: options.channelMode,
66
+ userName: options.botUsername,
67
+ });
68
+ },
69
+ async identity({ author, client, req }) {
70
+ const account = await client.user(author.userId);
71
+ const email = account.email?.trim().toLowerCase();
72
+ if (!email)
73
+ return null;
74
+ const config = await req.frogbot.config;
75
+ const payloadConfig = await config._internal.payloadConfig;
76
+ const result = await req.frogbot.find({
77
+ collection: payloadConfig.admin.user,
78
+ where: { email: { equals: email } },
79
+ limit: 1,
80
+ overrideAccess: true,
81
+ req,
82
+ });
83
+ const match = result.docs[0];
84
+ return match ? { ...match, collection: payloadConfig.admin.user } : null;
85
+ },
86
+ };
87
+ export const createLinear = definePiece({
88
+ slug: 'linear',
89
+ label: 'Linear',
90
+ admin: {
91
+ description: 'Manage Linear issues, projects, comments, and webhooks',
92
+ group: 'Productivity',
93
+ },
94
+ auth: linearAuth,
95
+ options: linearOptions,
96
+ oauth: linearOAuth,
97
+ client: createLinearClient,
98
+ webhook: linearWebhook,
99
+ channel: linearChannel,
100
+ actions: [createIssue, updateIssue, createProject, updateProject, createComment, rawGraphqlQuery],
101
+ triggers: [
102
+ commentCreated,
103
+ issueCreated,
104
+ issueUpdated,
105
+ issueRemoved,
106
+ projectCreated,
107
+ projectUpdated,
108
+ projectRemoved,
109
+ ],
110
+ });
34
111
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,4BAA4B,CAAC;AACrD,OAAO,EAAE,uBAAuB,EAA2B,MAAM,gBAAg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,CAAC;IACjG,QAAQ,EAAE;QACR,cAAc;QACd,YAAY;QACZ,YAAY;QACZ,YAAY;QACZ,cAAc;QACd,cAAc;QACd,cAAc;KACf;CACF,CAAC,CAAC"}
@@ -0,0 +1,12 @@
1
+ import { z } from 'zod';
2
+ export declare const commentCreated: import("frogbot/pieces").PieceWebhookTrigger<z.ZodObject<{
3
+ teamIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
4
+ authorIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
5
+ }, z.core.$strip>, undefined, {
6
+ channelMode: "agent-sessions" | "comments";
7
+ webhookSecret?: string | undefined;
8
+ botUsername?: string | undefined;
9
+ }, import("@linear/sdk").LinearClient, {
10
+ webhookId: string;
11
+ }>;
12
+ //# sourceMappingURL=commentCreated.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"commentCreated.d.ts","sourceRoot":"","sources":["../../src/triggers/commentCreated.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,cAAc;;;;;;;;;EAczB,CAAC"}
@@ -0,0 +1,17 @@
1
+ import { z } from 'zod';
2
+ import { webhookTrigger } from './webhook.js';
3
+ export const commentCreated = webhookTrigger({
4
+ slug: 'commentCreated',
5
+ action: 'create',
6
+ resourceType: 'Comment',
7
+ input: z.object({
8
+ teamIds: z.array(z.string()).optional(),
9
+ authorIds: z.array(z.string()).optional(),
10
+ }),
11
+ matches: (delivery, input) => (!input.teamIds?.length ||
12
+ (delivery.data?.issue?.team?.id !== undefined &&
13
+ input.teamIds.includes(delivery.data.issue.team.id))) &&
14
+ (!input.authorIds?.length ||
15
+ (delivery.data?.userId !== undefined && input.authorIds.includes(delivery.data.userId))),
16
+ });
17
+ //# sourceMappingURL=commentCreated.js.map