@frogbotai/piece-trello 0.22.0 → 0.24.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.
@@ -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,mHAOhB,CAAC;AACX,eAAO,MAAM,YAAY,aAAc,CAAC;AAExC,wBAAgB,YAAY,CAAC,MAAM,CAAC,EAAE,kBAAkB;IAUpD,+CAA+C;;IAE/C,mCAAmC;;IAEnC,6CAA6C;;IAE7C,6CAA6C;;IAE7C,gEAAgE;;IAEhE,yDAAyD;;IAEzD,iEAAiE;;IAEjE,iEAAiE;;IAEjE,qEAAqE;;EAGxE"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAIjD,eAAO,MAAM,aAAa,0KAUhB,CAAC;AACX,eAAO,MAAM,cAAc,6DAA8D,CAAC;AAC1F,eAAO,MAAM,YAAY,aAAc,CAAC;AAExC,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yBATpB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yBAAD,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yBAAD,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yBAAD,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yBAAD,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAuCwuF,CAAC;;;;;;;;;yBAvC1uF,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yBAAD,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yBAAD,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yBAAD,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAAD,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAAD,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAuCgkF,CAAC;;;;;;;;;;;;;;;;;EADrkF,CAAC"}
package/dist/index.js CHANGED
@@ -1,42 +1,49 @@
1
- import * as module from '@activepieces/piece-trello';
2
- import { createActivepiecesPiece } from 'frogbot/pieces';
1
+ import { definePiece } from 'frogbot/pieces';
2
+ import { addCardAttachment, createCard, customApiCall, deleteCard, deleteCardAttachment, getCard, getCardAttachment, listCardAttachments, updateCard, } from './actions.js';
3
+ import { createTrelloClient } from './client.js';
4
+ import { trelloAuth } from './config.js';
5
+ import { cardCreated, cardDeadline, cardMovedToList } from './triggers.js';
3
6
  export const trelloActions = [
4
- 'create_card',
5
- 'get_card',
6
- 'update_card',
7
- 'delete_card',
8
- 'get_card_attachments',
9
- 'add_card_attachment',
7
+ 'createCard',
8
+ 'getCard',
9
+ 'updateCard',
10
+ 'deleteCard',
11
+ 'listCardAttachments',
12
+ 'addCardAttachment',
13
+ 'getCardAttachment',
14
+ 'deleteCardAttachment',
15
+ 'customApiCall',
10
16
  ];
17
+ export const trelloTriggers = ['cardCreated', 'cardMovedToList', 'cardDeadline'];
11
18
  export const trelloScopes = [];
12
- export function createTrello(config) {
13
- const piece = createActivepiecesPiece({
14
- module: module,
15
- service: 'trello',
16
- credentialType: 'basic_auth',
17
- defaultActions: trelloActions,
18
- scopes: trelloScopes,
19
- config,
20
- });
21
- return Object.assign(piece, {
22
- /** Create Card: Create a new card in Trello */
23
- createCard: piece.tool('create_card'),
24
- /** Get Card: Gets a card by ID. */
25
- getCard: piece.tool('get_card'),
26
- /** Update Card: Updates an existing card. */
27
- updateCard: piece.tool('update_card'),
28
- /** Delete Card: Deletes an existing card. */
29
- deleteCard: piece.tool('delete_card'),
30
- /** Get All Card Attachments: Gets all attachments on a card. */
31
- getCardAttachments: piece.tool('get_card_attachments'),
32
- /** Add Card Attachment: Adds an attachment to a card. */
33
- addCardAttachment: piece.tool('add_card_attachment'),
34
- /** Get Card Attachment: Gets a specific attachment on a card. */
35
- getCardAttachment: piece.tool('get_card_attachment'),
36
- /** Delete Card Attachment: Deletes an attachment from a card. */
37
- deleteCardAttachment: piece.tool('delete_card_attachment'),
38
- /** Custom API Call: Make a custom API call to a specific endpoint */
39
- customApiCall: piece.tool('custom_api_call'),
40
- });
41
- }
19
+ export const createTrello = definePiece({
20
+ slug: 'trello',
21
+ label: 'Trello',
22
+ admin: {
23
+ description: 'Manage Trello cards, attachments, and card events',
24
+ group: 'Productivity',
25
+ },
26
+ auth: trelloAuth,
27
+ client: createTrelloClient,
28
+ webhook: {
29
+ async verify() {
30
+ return true;
31
+ },
32
+ async handshake({ req }) {
33
+ return req.method === 'HEAD' ? new Response(null, { status: 200 }) : null;
34
+ },
35
+ },
36
+ actions: [
37
+ createCard,
38
+ getCard,
39
+ updateCard,
40
+ deleteCard,
41
+ listCardAttachments,
42
+ addCardAttachment,
43
+ getCardAttachment,
44
+ deleteCardAttachment,
45
+ customApiCall,
46
+ ],
47
+ triggers: [cardCreated, cardMovedToList, cardDeadline],
48
+ });
42
49
  //# 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,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,UAAU;QACV,OAAO;QACP,UAAU;QACV,UAAU;QACV,mBAAmB;QACnB,iBAAiB;QACjB,iBAAiB;QACjB,oBAAoB;QACpB,aAAa;KACd;IACD,QAAQ,EAAE,CAAC,WAAW,EAAE,eAAe,EAAE,YAAY,CAAC;CACvD,CAAC,CAAC"}
@@ -0,0 +1,18 @@
1
+ import type { PieceOption } from 'frogbot/pieces';
2
+ import type { Trello } from './client.js';
3
+ export declare function boardOptions({ client }: {
4
+ client: Trello;
5
+ }): Promise<PieceOption[]>;
6
+ export declare function listOptions({ client, input, }: {
7
+ client: Trello;
8
+ input: {
9
+ boardId?: string;
10
+ };
11
+ }): Promise<PieceOption[]>;
12
+ export declare function labelOptions({ client, input, }: {
13
+ client: Trello;
14
+ input: {
15
+ boardId?: string;
16
+ };
17
+ }): Promise<PieceOption[]>;
18
+ //# sourceMappingURL=options.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../src/options.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAElD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAE1C,wBAAsB,YAAY,CAAC,EAAE,MAAM,EAAE,EAAE;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC,CAEzF;AAED,wBAAsB,WAAW,CAAC,EAChC,MAAM,EACN,KAAK,GACN,EAAE;IACD,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE;QAAE,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CAC7B,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC,CAOzB;AAED,wBAAsB,YAAY,CAAC,EACjC,MAAM,EACN,KAAK,GACN,EAAE;IACD,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE;QAAE,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CAC7B,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC,CAOzB"}
@@ -0,0 +1,20 @@
1
+ export async function boardOptions({ client }) {
2
+ return (await client.listBoards()).map(({ id, name }) => ({ label: name, value: id }));
3
+ }
4
+ export async function listOptions({ client, input, }) {
5
+ if (!input.boardId)
6
+ return [];
7
+ return (await client.listLists(input.boardId)).map(({ id, name }) => ({
8
+ label: name,
9
+ value: id,
10
+ }));
11
+ }
12
+ export async function labelOptions({ client, input, }) {
13
+ if (!input.boardId)
14
+ return [];
15
+ return (await client.listLabels(input.boardId)).map(({ color, id, name }) => ({
16
+ label: name || color,
17
+ value: id,
18
+ }));
19
+ }
20
+ //# sourceMappingURL=options.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"options.js","sourceRoot":"","sources":["../src/options.ts"],"names":[],"mappings":"AAIA,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,EAAE,MAAM,EAAsB;IAC/D,OAAO,CAAC,MAAM,MAAM,CAAC,UAAU,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;AACzF,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,EAChC,MAAM,EACN,KAAK,GAIN;IACC,IAAI,CAAC,KAAK,CAAC,OAAO;QAAE,OAAO,EAAE,CAAC;IAE9B,OAAO,CAAC,MAAM,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC;QACpE,KAAK,EAAE,IAAI;QACX,KAAK,EAAE,EAAE;KACV,CAAC,CAAC,CAAC;AACN,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,EACjC,MAAM,EACN,KAAK,GAIN;IACC,IAAI,CAAC,KAAK,CAAC,OAAO;QAAE,OAAO,EAAE,CAAC;IAE9B,OAAO,CAAC,MAAM,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC;QAC5E,KAAK,EAAE,IAAI,IAAI,KAAK;QACpB,KAAK,EAAE,EAAE;KACV,CAAC,CAAC,CAAC;AACN,CAAC"}
@@ -0,0 +1,20 @@
1
+ import { z } from 'zod';
2
+ export declare const cardOutput: z.ZodObject<{
3
+ id: z.ZodString;
4
+ name: z.ZodString;
5
+ desc: z.ZodOptional<z.ZodString>;
6
+ idBoard: z.ZodOptional<z.ZodString>;
7
+ idList: z.ZodOptional<z.ZodString>;
8
+ due: z.ZodOptional<z.ZodNullable<z.ZodString>>;
9
+ dueComplete: z.ZodOptional<z.ZodBoolean>;
10
+ dateLastActivity: z.ZodOptional<z.ZodString>;
11
+ url: z.ZodOptional<z.ZodString>;
12
+ }, z.core.$loose>;
13
+ export declare const attachmentOutput: z.ZodObject<{
14
+ id: z.ZodString;
15
+ name: z.ZodString;
16
+ url: z.ZodString;
17
+ mimeType: z.ZodOptional<z.ZodString>;
18
+ }, z.core.$loose>;
19
+ export declare const emptyOutput: z.ZodObject<{}, z.core.$loose>;
20
+ //# sourceMappingURL=schemas.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../src/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,UAAU;;;;;;;;;;iBAYP,CAAC;AAEjB,eAAO,MAAM,gBAAgB;;;;;iBAOb,CAAC;AAEjB,eAAO,MAAM,WAAW,gCAA6B,CAAC"}
@@ -0,0 +1,24 @@
1
+ import { z } from 'zod';
2
+ export const cardOutput = z
3
+ .object({
4
+ id: z.string(),
5
+ name: z.string(),
6
+ desc: z.string().optional(),
7
+ idBoard: z.string().optional(),
8
+ idList: z.string().optional(),
9
+ due: z.string().nullable().optional(),
10
+ dueComplete: z.boolean().optional(),
11
+ dateLastActivity: z.string().optional(),
12
+ url: z.string().optional(),
13
+ })
14
+ .passthrough();
15
+ export const attachmentOutput = z
16
+ .object({
17
+ id: z.string(),
18
+ name: z.string(),
19
+ url: z.string(),
20
+ mimeType: z.string().optional(),
21
+ })
22
+ .passthrough();
23
+ export const emptyOutput = z.object({}).passthrough();
24
+ //# sourceMappingURL=schemas.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schemas.js","sourceRoot":"","sources":["../src/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC;KACxB,MAAM,CAAC;IACN,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE;IACd,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC3B,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC9B,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC7B,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;IACrC,WAAW,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;IACnC,gBAAgB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACvC,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAC3B,CAAC;KACD,WAAW,EAAE,CAAC;AAEjB,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC;KAC9B,MAAM,CAAC;IACN,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE;IACd,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE;IACf,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAChC,CAAC;KACD,WAAW,EAAE,CAAC;AAEjB,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC"}
@@ -0,0 +1,138 @@
1
+ import { type PieceRunArgs, type PieceWebhookTrigger } from 'frogbot/pieces';
2
+ import { z } from 'zod';
3
+ import type { Trello } from './client.js';
4
+ type WebhookState = {
5
+ webhookId: string;
6
+ webhookUrl: string;
7
+ owned: boolean;
8
+ };
9
+ export declare const cardCreated: PieceWebhookTrigger<z.ZodObject<z.core.$ZodLooseShape, z.core.$strip>, z.ZodObject<{
10
+ id: z.ZodString;
11
+ name: z.ZodString;
12
+ desc: z.ZodOptional<z.ZodString>;
13
+ idBoard: z.ZodOptional<z.ZodString>;
14
+ idList: z.ZodOptional<z.ZodString>;
15
+ due: z.ZodOptional<z.ZodNullable<z.ZodString>>;
16
+ dueComplete: z.ZodOptional<z.ZodBoolean>;
17
+ dateLastActivity: z.ZodOptional<z.ZodString>;
18
+ url: z.ZodOptional<z.ZodString>;
19
+ }, z.core.$loose>, Record<string, never>, {
20
+ request: <T>(path: string, init?: RequestInit & {
21
+ query?: {
22
+ [x: string]: string | number | boolean | undefined;
23
+ };
24
+ }) => Promise<T>;
25
+ verifyWebhook(body: Buffer, signature: string | null, webhookUrl: string): boolean;
26
+ listAll<T extends {
27
+ id: string;
28
+ }>(path: string): Promise<T[]>;
29
+ getCard: (cardId: string) => Promise<Record<string, unknown>>;
30
+ listBoards: () => Promise<{
31
+ id: string;
32
+ name: string;
33
+ }[]>;
34
+ listLists: (boardId: string) => Promise<{
35
+ id: string;
36
+ name: string;
37
+ }[]>;
38
+ listLabels: (boardId: string) => Promise<{
39
+ color: string;
40
+ id: string;
41
+ name: string;
42
+ }[]>;
43
+ listWebhooks: () => Promise<import("./client.js").TrelloWebhook[]>;
44
+ createWebhook: (idModel: string, callbackURL: string) => Promise<import("./client.js").TrelloWebhook>;
45
+ deleteWebhook: (id: string) => Promise<unknown>;
46
+ }, WebhookState>;
47
+ export declare const cardMovedToList: PieceWebhookTrigger<z.ZodObject<z.core.$ZodLooseShape, z.core.$strip>, z.ZodObject<{
48
+ id: z.ZodString;
49
+ name: z.ZodString;
50
+ desc: z.ZodOptional<z.ZodString>;
51
+ idBoard: z.ZodOptional<z.ZodString>;
52
+ idList: z.ZodOptional<z.ZodString>;
53
+ due: z.ZodOptional<z.ZodNullable<z.ZodString>>;
54
+ dueComplete: z.ZodOptional<z.ZodBoolean>;
55
+ dateLastActivity: z.ZodOptional<z.ZodString>;
56
+ url: z.ZodOptional<z.ZodString>;
57
+ }, z.core.$loose>, Record<string, never>, {
58
+ request: <T>(path: string, init?: RequestInit & {
59
+ query?: {
60
+ [x: string]: string | number | boolean | undefined;
61
+ };
62
+ }) => Promise<T>;
63
+ verifyWebhook(body: Buffer, signature: string | null, webhookUrl: string): boolean;
64
+ listAll<T extends {
65
+ id: string;
66
+ }>(path: string): Promise<T[]>;
67
+ getCard: (cardId: string) => Promise<Record<string, unknown>>;
68
+ listBoards: () => Promise<{
69
+ id: string;
70
+ name: string;
71
+ }[]>;
72
+ listLists: (boardId: string) => Promise<{
73
+ id: string;
74
+ name: string;
75
+ }[]>;
76
+ listLabels: (boardId: string) => Promise<{
77
+ color: string;
78
+ id: string;
79
+ name: string;
80
+ }[]>;
81
+ listWebhooks: () => Promise<import("./client.js").TrelloWebhook[]>;
82
+ createWebhook: (idModel: string, callbackURL: string) => Promise<import("./client.js").TrelloWebhook>;
83
+ deleteWebhook: (id: string) => Promise<unknown>;
84
+ }, WebhookState>;
85
+ declare const deadlineInput: z.ZodObject<{
86
+ boardId: z.ZodString;
87
+ listId: z.ZodOptional<z.ZodString>;
88
+ timeUnit: z.ZodDefault<z.ZodEnum<{
89
+ minutes: "minutes";
90
+ hours: "hours";
91
+ }>>;
92
+ timeBeforeDue: z.ZodDefault<z.ZodNumber>;
93
+ }, z.core.$strip>;
94
+ export declare const cardDeadline: {
95
+ slug: string;
96
+ description: string;
97
+ type: "polling";
98
+ schedule: string;
99
+ input: z.ZodObject<{
100
+ boardId: z.ZodString;
101
+ listId: z.ZodOptional<z.ZodString>;
102
+ timeUnit: z.ZodDefault<z.ZodEnum<{
103
+ minutes: "minutes";
104
+ hours: "hours";
105
+ }>>;
106
+ timeBeforeDue: z.ZodDefault<z.ZodNumber>;
107
+ }, z.core.$strip>;
108
+ output: z.ZodObject<{
109
+ id: z.ZodString;
110
+ name: z.ZodString;
111
+ desc: z.ZodOptional<z.ZodString>;
112
+ idBoard: z.ZodOptional<z.ZodString>;
113
+ idList: z.ZodOptional<z.ZodString>;
114
+ due: z.ZodOptional<z.ZodNullable<z.ZodString>>;
115
+ dueComplete: z.ZodOptional<z.ZodBoolean>;
116
+ dateLastActivity: z.ZodOptional<z.ZodString>;
117
+ url: z.ZodOptional<z.ZodString>;
118
+ }, z.core.$loose>;
119
+ run({ client, input, cursor, }: PieceRunArgs<z.output<typeof deadlineInput>, Record<string, never>, Trello> & {
120
+ cursor?: number;
121
+ }): Promise<{
122
+ events: {
123
+ [x: string]: unknown;
124
+ id: string;
125
+ name: string;
126
+ desc?: string | undefined;
127
+ idBoard?: string | undefined;
128
+ idList?: string | undefined;
129
+ due?: string | null | undefined;
130
+ dueComplete?: boolean | undefined;
131
+ dateLastActivity?: string | undefined;
132
+ url?: string | undefined;
133
+ }[];
134
+ cursor: number;
135
+ }>;
136
+ };
137
+ export {};
138
+ //# sourceMappingURL=triggers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"triggers.d.ts","sourceRoot":"","sources":["../src/triggers.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAC7E,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAY1C,KAAK,YAAY,GAAG;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,OAAO,CAAC;CAChB,CAAC;AAuEF,eAAO,MAAM,WAAW;;;;;;;;;;;;aAnEnB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;gBAgFJ,CAAC;AAIH,eAAO,MAAM,eAAe;;;;;;;;;;;;aApFvB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;gBAkGJ,CAAC;AAEH,QAAA,MAAM,aAAa;;;;;;;;iBAKjB,CAAC;AAEH,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;oCAWpB,YAAY,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,CAAC,GAAG;QAC/E,MAAM,CAAC,EAAE,MAAM,CAAC;KACjB;;;;;;;;;;;;;;;CAiBF,CAAC"}
@@ -0,0 +1,104 @@
1
+ import { createHash } from 'node:crypto';
2
+ import { z } from 'zod';
3
+ import { cardOutput } from './schemas.js';
4
+ function webhookTrigger({ slug, description, input, model, matches, }) {
5
+ return {
6
+ slug,
7
+ description,
8
+ type: 'webhook',
9
+ input,
10
+ output: cardOutput,
11
+ async onEnable({ client, input, webhookUrl }) {
12
+ const idModel = model(input);
13
+ const existing = (await client.listWebhooks()).find((webhook) => webhook.idModel === idModel && webhook.callbackURL === webhookUrl);
14
+ const webhook = existing ?? (await client.createWebhook(idModel, webhookUrl));
15
+ return { webhookId: webhook.id, webhookUrl, owned: !existing };
16
+ },
17
+ async onDisable({ client, state }) {
18
+ if (state.owned)
19
+ await client.deleteWebhook(state.webhookId);
20
+ },
21
+ async run({ client, input, req, state }) {
22
+ if (!req.arrayBuffer)
23
+ throw new Error('Trello webhook raw body is unavailable.');
24
+ const body = Buffer.from(await req.arrayBuffer());
25
+ const signature = req.headers.get('x-trello-webhook');
26
+ if (!client.verifyWebhook(body, signature, state.webhookUrl)) {
27
+ throw new Error('Trello webhook signature is invalid.');
28
+ }
29
+ const delivery = req.data;
30
+ const cardId = matches(delivery, input);
31
+ if (!cardId)
32
+ return [];
33
+ const card = cardOutput.parse(await client.getCard(cardId));
34
+ return [
35
+ {
36
+ dedupeKey: createHash('sha256').update(JSON.stringify(delivery)).digest('hex'),
37
+ data: card,
38
+ },
39
+ ];
40
+ },
41
+ };
42
+ }
43
+ const boardListInput = z.object({
44
+ boardId: z.string().min(1),
45
+ listId: z.string().optional(),
46
+ });
47
+ export const cardCreated = webhookTrigger({
48
+ slug: 'cardCreated',
49
+ description: 'Emit a card created on a board or optional list.',
50
+ input: boardListInput,
51
+ model: (input) => String(input.listId ?? input.boardId),
52
+ matches(delivery, input) {
53
+ const display = delivery.action?.display;
54
+ if (display?.translationKey !== 'action_create_card')
55
+ return undefined;
56
+ if (input.listId && display.entities?.list?.id !== input.listId)
57
+ return undefined;
58
+ return display.entities?.card?.id;
59
+ },
60
+ });
61
+ const movedInput = z.object({ boardId: z.string().min(1), listId: z.string().min(1) });
62
+ export const cardMovedToList = webhookTrigger({
63
+ slug: 'cardMovedToList',
64
+ description: 'Emit a card moved into a selected list.',
65
+ input: movedInput,
66
+ model: (input) => String(input.listId),
67
+ matches(delivery, input) {
68
+ const display = delivery.action?.display;
69
+ if (display?.translationKey !== 'action_move_card_from_list_to_list')
70
+ return undefined;
71
+ if (display.entities?.listAfter?.id !== input.listId)
72
+ return undefined;
73
+ if (display.entities?.listBefore?.id === input.listId)
74
+ return undefined;
75
+ return display.entities?.card?.id;
76
+ },
77
+ });
78
+ const deadlineInput = z.object({
79
+ boardId: z.string().min(1),
80
+ listId: z.string().optional(),
81
+ timeUnit: z.enum(['minutes', 'hours']).default('hours'),
82
+ timeBeforeDue: z.number().min(0).default(24),
83
+ });
84
+ export const cardDeadline = {
85
+ slug: 'cardDeadline',
86
+ description: 'Emit cards approaching their due date.',
87
+ type: 'polling',
88
+ schedule: '*/5 * * * *',
89
+ input: deadlineInput,
90
+ output: cardOutput,
91
+ async run({ client, input, cursor, }) {
92
+ const path = input.listId ? `lists/${input.listId}/cards` : `boards/${input.boardId}/cards`;
93
+ const cards = await client.listAll(path);
94
+ const now = Date.now();
95
+ const range = input.timeBeforeDue * (input.timeUnit === 'minutes' ? 60_000 : 3_600_000);
96
+ const events = cards.filter((card) => {
97
+ const due = card.due ? Date.parse(card.due) : Number.NaN;
98
+ return !card.dueComplete && due > now && due < now + range && due > (cursor ?? 0);
99
+ });
100
+ const latest = events.reduce((value, card) => Math.max(value, Date.parse(card.due)), cursor ?? 0);
101
+ return { events, cursor: latest };
102
+ },
103
+ };
104
+ //# sourceMappingURL=triggers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"triggers.js","sourceRoot":"","sources":["../src/triggers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAGzC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAiB1C,SAAS,cAAc,CAAC,EACtB,IAAI,EACJ,WAAW,EACX,KAAK,EACL,KAAK,EACL,OAAO,GAOR;IAOC,OAAO;QACL,IAAI;QACJ,WAAW;QACX,IAAI,EAAE,SAAS;QACf,KAAK;QACL,MAAM,EAAE,UAAU;QAClB,KAAK,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE;YAC1C,MAAM,OAAO,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC;YAC7B,MAAM,QAAQ,GAAG,CAAC,MAAM,MAAM,CAAC,YAAY,EAAE,CAAC,CAAC,IAAI,CACjD,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,OAAO,KAAK,OAAO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,CAAC;IACpC,CAAC;CACF,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@frogbotai/piece-trello",
3
- "version": "0.22.0",
3
+ "version": "0.24.0",
4
4
  "description": "Trello tools for FrogBot.",
5
5
  "license": "MIT",
6
6
  "author": "Colby Gilbert",
@@ -19,14 +19,14 @@
19
19
  ],
20
20
  "sideEffects": false,
21
21
  "dependencies": {
22
- "@activepieces/piece-trello": "0.4.10"
22
+ "zod": "^4.3.6"
23
23
  },
24
24
  "peerDependencies": {
25
- "frogbot": "0.22.0"
25
+ "frogbot": "0.24.0"
26
26
  },
27
27
  "devDependencies": {
28
28
  "typescript": "5.6.2",
29
- "frogbot": "0.22.0"
29
+ "frogbot": "0.24.0"
30
30
  },
31
31
  "publishConfig": {
32
32
  "access": "public"