@zapier/trello-connector 0.0.0 → 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 +93 -0
- package/NOTICE +8 -0
- package/README.md +135 -2
- package/SKILL.md +139 -0
- package/cli.js +71 -0
- package/cli.ts +5 -0
- package/connections.ts +26 -0
- package/dist/cli.js +4 -0
- package/dist/index.js +2654 -0
- package/index.ts +145 -0
- package/package.json +59 -4
- package/preflight.sh +157 -0
- package/references/trello-api-gotchas.md +81 -0
- package/scripts/.gitkeep +0 -0
- package/scripts/addCardAttachment.ts +107 -0
- package/scripts/addCardLabel.ts +93 -0
- package/scripts/addCardMember.ts +93 -0
- package/scripts/addChecklistItem.ts +98 -0
- package/scripts/addMemberToBoard.ts +57 -0
- package/scripts/archiveCard.ts +67 -0
- package/scripts/closeBoard.ts +62 -0
- package/scripts/completeChecklistItem.ts +56 -0
- package/scripts/copyBoard.ts +81 -0
- package/scripts/createBoard.ts +72 -0
- package/scripts/createCard.ts +266 -0
- package/scripts/createChecklist.ts +50 -0
- package/scripts/createComment.ts +71 -0
- package/scripts/createLabel.ts +72 -0
- package/scripts/createList.ts +100 -0
- package/scripts/deleteChecklist.ts +38 -0
- package/scripts/findBoard.ts +62 -0
- package/scripts/findChecklist.ts +51 -0
- package/scripts/findChecklistItem.ts +49 -0
- package/scripts/findLabel.ts +54 -0
- package/scripts/findList.ts +55 -0
- package/scripts/findOrganizationMember.ts +59 -0
- package/scripts/getAction.ts +58 -0
- package/scripts/getBoard.ts +52 -0
- package/scripts/getCard.ts +79 -0
- package/scripts/getChecklist.ts +45 -0
- package/scripts/getChecklistItem.ts +48 -0
- package/scripts/getCurrentMember.ts +52 -0
- package/scripts/getLabel.ts +46 -0
- package/scripts/getList.ts +47 -0
- package/scripts/getMember.ts +52 -0
- package/scripts/getOrganization.ts +46 -0
- package/scripts/listBoardMembers.ts +58 -0
- package/scripts/listBoards.ts +78 -0
- package/scripts/listCardAttachments.ts +55 -0
- package/scripts/listCards.ts +129 -0
- package/scripts/listCustomFields.ts +62 -0
- package/scripts/listLabels.ts +52 -0
- package/scripts/listLists.ts +61 -0
- package/scripts/listOrganizations.ts +50 -0
- package/scripts/moveCard.ts +68 -0
- package/scripts/removeCardLabel.ts +43 -0
- package/scripts/searchCards.ts +153 -0
- package/scripts/updateCard.ts +184 -0
- package/tsup.config.ts +63 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,2654 @@
|
|
|
1
|
+
// index.ts
|
|
2
|
+
import { defineConnector, toFunctions } from "@zapier/connectors-sdk";
|
|
3
|
+
|
|
4
|
+
// connections.ts
|
|
5
|
+
import {
|
|
6
|
+
defineEnvPrefixResolver,
|
|
7
|
+
zapierConnectionResolver
|
|
8
|
+
} from "@zapier/connectors-sdk";
|
|
9
|
+
var TRELLO_OAUTH_HEADER = (apiKey, token) => `OAuth oauth_consumer_key="${apiKey}", oauth_token="${token}"`;
|
|
10
|
+
var directTrelloResolver = defineEnvPrefixResolver({
|
|
11
|
+
name: "env",
|
|
12
|
+
keys: ["API_KEY", "TOKEN"],
|
|
13
|
+
build: ({ API_KEY, TOKEN }) => {
|
|
14
|
+
const authorization = TRELLO_OAUTH_HEADER(API_KEY, TOKEN);
|
|
15
|
+
return (url, init = {}) => {
|
|
16
|
+
const headers = new Headers(init.headers);
|
|
17
|
+
headers.set("Authorization", authorization);
|
|
18
|
+
return globalThis.fetch(url, { ...init, headers });
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
var connectionResolvers = {
|
|
23
|
+
trello: [zapierConnectionResolver, directTrelloResolver]
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
// scripts/addCardAttachment.ts
|
|
27
|
+
import { defineTool, handleIfScriptMain } from "@zapier/connectors-sdk";
|
|
28
|
+
import { z } from "zod";
|
|
29
|
+
|
|
30
|
+
// lib/trello.ts
|
|
31
|
+
import { ConnectorHttpError, readResponseBody } from "@zapier/connectors-sdk";
|
|
32
|
+
var TRELLO_BASE = "https://api.trello.com/1";
|
|
33
|
+
var TRELLO_ID_REGEX = /^[0-9a-fA-F]{24}$/;
|
|
34
|
+
async function trelloError(tool, res) {
|
|
35
|
+
const body = await readResponseBody(res);
|
|
36
|
+
let hint = "";
|
|
37
|
+
if (res.status === 404) {
|
|
38
|
+
hint = " \u2014 verify the id exists and you have access.";
|
|
39
|
+
} else if (res.status === 401) {
|
|
40
|
+
hint = " \u2014 check Trello auth credentials.";
|
|
41
|
+
}
|
|
42
|
+
throw ConnectorHttpError.fromResponseBody(res, body, {
|
|
43
|
+
message: `Trello ${tool} ${res.status}${hint}`
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
function trelloFormBody(fields) {
|
|
47
|
+
const params = new URLSearchParams();
|
|
48
|
+
for (const [key, value] of Object.entries(fields)) {
|
|
49
|
+
if (value === void 0 || value === null) continue;
|
|
50
|
+
params.set(key, String(value));
|
|
51
|
+
}
|
|
52
|
+
return params.toString();
|
|
53
|
+
}
|
|
54
|
+
var trelloFormHeaders = {
|
|
55
|
+
"Content-Type": "application/x-www-form-urlencoded"
|
|
56
|
+
};
|
|
57
|
+
function nameContains(name, query) {
|
|
58
|
+
return name.toLowerCase().includes(query.toLowerCase());
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// scripts/addCardAttachment.ts
|
|
62
|
+
var inputSchema = z.object({
|
|
63
|
+
id: z.string().describe("24-char hex card id."),
|
|
64
|
+
url: z.string().url().describe(
|
|
65
|
+
"URL to attach (link attachment). Mutually exclusive with fileUrl."
|
|
66
|
+
).optional(),
|
|
67
|
+
fileUrl: z.string().url().describe(
|
|
68
|
+
"Remote file URL to download and upload. Mutually exclusive with url."
|
|
69
|
+
).optional(),
|
|
70
|
+
name: z.string().describe("Attachment display name.").optional(),
|
|
71
|
+
mimeType: z.string().optional()
|
|
72
|
+
}).strict().refine((v) => v.url ? !v.fileUrl : !!v.fileUrl, {
|
|
73
|
+
message: "Provide exactly one of url or fileUrl."
|
|
74
|
+
});
|
|
75
|
+
var outputSchema = z.object({
|
|
76
|
+
id: z.string().regex(TRELLO_ID_REGEX),
|
|
77
|
+
name: z.string(),
|
|
78
|
+
url: z.string(),
|
|
79
|
+
mimeType: z.string().nullable().optional(),
|
|
80
|
+
bytes: z.number().nullable().optional(),
|
|
81
|
+
isUpload: z.boolean().nullable().optional()
|
|
82
|
+
});
|
|
83
|
+
var definition = defineTool({
|
|
84
|
+
name: "addCardAttachment",
|
|
85
|
+
title: "Add Card Attachment",
|
|
86
|
+
description: "Add a URL link attachment or upload a file from a remote URL to a card. Provide url OR fileUrl, not both.",
|
|
87
|
+
inputSchema,
|
|
88
|
+
outputSchema,
|
|
89
|
+
annotations: {
|
|
90
|
+
readOnlyHint: false,
|
|
91
|
+
destructiveHint: false,
|
|
92
|
+
idempotentHint: false,
|
|
93
|
+
openWorldHint: true
|
|
94
|
+
},
|
|
95
|
+
connection: "trello",
|
|
96
|
+
run: async (input, ctx) => {
|
|
97
|
+
const cardPath = `${TRELLO_BASE}/cards/${encodeURIComponent(input.id)}/attachments`;
|
|
98
|
+
if (input.fileUrl) {
|
|
99
|
+
const fileRes = await ctx.fetch(input.fileUrl);
|
|
100
|
+
if (!fileRes.ok) await trelloError("addCardAttachment", fileRes);
|
|
101
|
+
const buffer = await fileRes.arrayBuffer();
|
|
102
|
+
const fileName = input.name ?? "attachment";
|
|
103
|
+
const form = new FormData();
|
|
104
|
+
form.append(
|
|
105
|
+
"file",
|
|
106
|
+
new Blob([buffer], {
|
|
107
|
+
type: input.mimeType ?? fileRes.headers.get("content-type") ?? void 0
|
|
108
|
+
}),
|
|
109
|
+
fileName
|
|
110
|
+
);
|
|
111
|
+
form.append("name", fileName);
|
|
112
|
+
if (input.mimeType) form.append("mimeType", input.mimeType);
|
|
113
|
+
const uploadRes = await ctx.fetch(cardPath, {
|
|
114
|
+
method: "POST",
|
|
115
|
+
body: form
|
|
116
|
+
});
|
|
117
|
+
if (!uploadRes.ok) await trelloError("addCardAttachment", uploadRes);
|
|
118
|
+
return uploadRes.json();
|
|
119
|
+
}
|
|
120
|
+
const linkRes = await ctx.fetch(cardPath, {
|
|
121
|
+
method: "POST",
|
|
122
|
+
headers: trelloFormHeaders,
|
|
123
|
+
body: trelloFormBody({
|
|
124
|
+
url: input.url,
|
|
125
|
+
name: input.name ?? input.url,
|
|
126
|
+
mimeType: input.mimeType
|
|
127
|
+
})
|
|
128
|
+
});
|
|
129
|
+
if (!linkRes.ok) await trelloError("addCardAttachment", linkRes);
|
|
130
|
+
return linkRes.json();
|
|
131
|
+
}
|
|
132
|
+
});
|
|
133
|
+
var addCardAttachment_default = definition;
|
|
134
|
+
await handleIfScriptMain(import.meta, definition, { connectionResolvers });
|
|
135
|
+
|
|
136
|
+
// scripts/addCardLabel.ts
|
|
137
|
+
import { defineTool as defineTool2, handleIfScriptMain as handleIfScriptMain2 } from "@zapier/connectors-sdk";
|
|
138
|
+
import { z as z2 } from "zod";
|
|
139
|
+
var inputSchema2 = z2.object({
|
|
140
|
+
id: z2.string().describe("24-char hex card id."),
|
|
141
|
+
value: z2.string().describe("Label id from listLabels.")
|
|
142
|
+
}).strict();
|
|
143
|
+
var outputSchema2 = z2.object({
|
|
144
|
+
id: z2.string().regex(new RegExp("^[0-9a-fA-F]{24}$")).describe("Trello object id (24 hex chars)."),
|
|
145
|
+
name: z2.string(),
|
|
146
|
+
desc: z2.string().nullable().optional(),
|
|
147
|
+
closed: z2.boolean().nullable().optional(),
|
|
148
|
+
idBoard: z2.string(),
|
|
149
|
+
idList: z2.string(),
|
|
150
|
+
idShort: z2.number().int().nullable().optional(),
|
|
151
|
+
shortLink: z2.string().nullable().optional(),
|
|
152
|
+
shortUrl: z2.string().nullable().optional(),
|
|
153
|
+
url: z2.string().nullable().optional(),
|
|
154
|
+
due: z2.union([z2.string().datetime({ offset: true }), z2.null()]).optional(),
|
|
155
|
+
dueComplete: z2.boolean().nullable().optional(),
|
|
156
|
+
dateLastActivity: z2.string().datetime({ offset: true }).nullable().optional(),
|
|
157
|
+
idLabels: z2.array(z2.string()).nullable().optional(),
|
|
158
|
+
idMembers: z2.array(z2.string()).nullable().optional(),
|
|
159
|
+
labels: z2.array(
|
|
160
|
+
z2.object({
|
|
161
|
+
id: z2.string().regex(new RegExp("^[0-9a-fA-F]{24}$")).describe("Trello object id (24 hex chars)."),
|
|
162
|
+
idBoard: z2.string(),
|
|
163
|
+
name: z2.string().nullable().optional(),
|
|
164
|
+
color: z2.string().nullable().optional()
|
|
165
|
+
})
|
|
166
|
+
).nullable().optional(),
|
|
167
|
+
pos: z2.number().nullable().optional(),
|
|
168
|
+
customFields: z2.record(z2.string(), z2.any()).nullable().describe("Custom field values keyed by field name when requested.").optional()
|
|
169
|
+
});
|
|
170
|
+
var definition2 = defineTool2({
|
|
171
|
+
name: "addCardLabel",
|
|
172
|
+
title: "Add Card Label",
|
|
173
|
+
description: "Add an existing board label to a card by label id.",
|
|
174
|
+
inputSchema: inputSchema2,
|
|
175
|
+
outputSchema: outputSchema2,
|
|
176
|
+
annotations: {
|
|
177
|
+
readOnlyHint: false,
|
|
178
|
+
destructiveHint: false,
|
|
179
|
+
idempotentHint: false,
|
|
180
|
+
openWorldHint: true
|
|
181
|
+
},
|
|
182
|
+
connection: "trello",
|
|
183
|
+
run: async (input, ctx) => {
|
|
184
|
+
const url = `https://api.trello.com/1/cards/${encodeURIComponent(input.id)}/idLabels`;
|
|
185
|
+
const body = {};
|
|
186
|
+
if (input.value !== void 0) body["value"] = input.value;
|
|
187
|
+
const res = await ctx.fetch(url, {
|
|
188
|
+
method: "POST",
|
|
189
|
+
headers: { "Content-Type": "application/json" },
|
|
190
|
+
body: JSON.stringify(body)
|
|
191
|
+
});
|
|
192
|
+
if (!res.ok) {
|
|
193
|
+
const errBody = await res.text();
|
|
194
|
+
throw new Error(`Trello addCardLabel ${res.status}: ${errBody}`);
|
|
195
|
+
}
|
|
196
|
+
const cardRes = await ctx.fetch(
|
|
197
|
+
`https://api.trello.com/1/cards/${encodeURIComponent(input.id)}`
|
|
198
|
+
);
|
|
199
|
+
if (!cardRes.ok) {
|
|
200
|
+
const errBody = await cardRes.text();
|
|
201
|
+
throw new Error(`Trello addCardLabel ${cardRes.status}: ${errBody}`);
|
|
202
|
+
}
|
|
203
|
+
return cardRes.json();
|
|
204
|
+
}
|
|
205
|
+
});
|
|
206
|
+
var addCardLabel_default = definition2;
|
|
207
|
+
await handleIfScriptMain2(import.meta, definition2, { connectionResolvers });
|
|
208
|
+
|
|
209
|
+
// scripts/addCardMember.ts
|
|
210
|
+
import { defineTool as defineTool3, handleIfScriptMain as handleIfScriptMain3 } from "@zapier/connectors-sdk";
|
|
211
|
+
import { z as z3 } from "zod";
|
|
212
|
+
var inputSchema3 = z3.object({
|
|
213
|
+
id: z3.string().describe("24-char hex card id."),
|
|
214
|
+
value: z3.string().describe("Member id to add.")
|
|
215
|
+
}).strict();
|
|
216
|
+
var outputSchema3 = z3.object({
|
|
217
|
+
id: z3.string().regex(new RegExp("^[0-9a-fA-F]{24}$")).describe("Trello object id (24 hex chars)."),
|
|
218
|
+
name: z3.string(),
|
|
219
|
+
desc: z3.string().nullable().optional(),
|
|
220
|
+
closed: z3.boolean().nullable().optional(),
|
|
221
|
+
idBoard: z3.string(),
|
|
222
|
+
idList: z3.string(),
|
|
223
|
+
idShort: z3.number().int().nullable().optional(),
|
|
224
|
+
shortLink: z3.string().nullable().optional(),
|
|
225
|
+
shortUrl: z3.string().nullable().optional(),
|
|
226
|
+
url: z3.string().nullable().optional(),
|
|
227
|
+
due: z3.union([z3.string().datetime({ offset: true }), z3.null()]).optional(),
|
|
228
|
+
dueComplete: z3.boolean().nullable().optional(),
|
|
229
|
+
dateLastActivity: z3.string().datetime({ offset: true }).nullable().optional(),
|
|
230
|
+
idLabels: z3.array(z3.string()).nullable().optional(),
|
|
231
|
+
idMembers: z3.array(z3.string()).nullable().optional(),
|
|
232
|
+
labels: z3.array(
|
|
233
|
+
z3.object({
|
|
234
|
+
id: z3.string().regex(new RegExp("^[0-9a-fA-F]{24}$")).describe("Trello object id (24 hex chars)."),
|
|
235
|
+
idBoard: z3.string(),
|
|
236
|
+
name: z3.string().nullable().optional(),
|
|
237
|
+
color: z3.string().nullable().optional()
|
|
238
|
+
})
|
|
239
|
+
).nullable().optional(),
|
|
240
|
+
pos: z3.number().nullable().optional(),
|
|
241
|
+
customFields: z3.record(z3.string(), z3.any()).nullable().describe("Custom field values keyed by field name when requested.").optional()
|
|
242
|
+
});
|
|
243
|
+
var definition3 = defineTool3({
|
|
244
|
+
name: "addCardMember",
|
|
245
|
+
title: "Add Card Member",
|
|
246
|
+
description: "Add a member to a card.",
|
|
247
|
+
inputSchema: inputSchema3,
|
|
248
|
+
outputSchema: outputSchema3,
|
|
249
|
+
annotations: {
|
|
250
|
+
readOnlyHint: false,
|
|
251
|
+
destructiveHint: false,
|
|
252
|
+
idempotentHint: false,
|
|
253
|
+
openWorldHint: true
|
|
254
|
+
},
|
|
255
|
+
connection: "trello",
|
|
256
|
+
run: async (input, ctx) => {
|
|
257
|
+
const url = `https://api.trello.com/1/cards/${encodeURIComponent(input.id)}/idMembers`;
|
|
258
|
+
const body = {};
|
|
259
|
+
if (input.value !== void 0) body["value"] = input.value;
|
|
260
|
+
const res = await ctx.fetch(url, {
|
|
261
|
+
method: "POST",
|
|
262
|
+
headers: { "Content-Type": "application/json" },
|
|
263
|
+
body: JSON.stringify(body)
|
|
264
|
+
});
|
|
265
|
+
if (!res.ok) {
|
|
266
|
+
const errBody = await res.text();
|
|
267
|
+
throw new Error(`Trello addCardMember ${res.status}: ${errBody}`);
|
|
268
|
+
}
|
|
269
|
+
const cardRes = await ctx.fetch(
|
|
270
|
+
`https://api.trello.com/1/cards/${encodeURIComponent(input.id)}`
|
|
271
|
+
);
|
|
272
|
+
if (!cardRes.ok) {
|
|
273
|
+
const errBody = await cardRes.text();
|
|
274
|
+
throw new Error(`Trello addCardMember ${cardRes.status}: ${errBody}`);
|
|
275
|
+
}
|
|
276
|
+
return cardRes.json();
|
|
277
|
+
}
|
|
278
|
+
});
|
|
279
|
+
var addCardMember_default = definition3;
|
|
280
|
+
await handleIfScriptMain3(import.meta, definition3, { connectionResolvers });
|
|
281
|
+
|
|
282
|
+
// scripts/addChecklistItem.ts
|
|
283
|
+
import { defineTool as defineTool4, handleIfScriptMain as handleIfScriptMain4 } from "@zapier/connectors-sdk";
|
|
284
|
+
import { z as z4 } from "zod";
|
|
285
|
+
var inputSchema4 = z4.object({
|
|
286
|
+
id: z4.string(),
|
|
287
|
+
name: z4.string(),
|
|
288
|
+
pos: z4.any().superRefine((x, ctx) => {
|
|
289
|
+
const schemas = [z4.enum(["top", "bottom"]), z4.number()];
|
|
290
|
+
const { errors, failed } = schemas.reduce(
|
|
291
|
+
({ errors: errors2, failed: failed2 }, schema) => ((result) => result.error ? {
|
|
292
|
+
errors: [...errors2, ...result.error.issues],
|
|
293
|
+
failed: failed2 + 1
|
|
294
|
+
} : { errors: errors2, failed: failed2 })(schema.safeParse(x)),
|
|
295
|
+
{ errors: [], failed: 0 }
|
|
296
|
+
);
|
|
297
|
+
const passed = schemas.length - failed;
|
|
298
|
+
if (passed !== 1) {
|
|
299
|
+
ctx.addIssue(
|
|
300
|
+
errors.length ? {
|
|
301
|
+
path: [],
|
|
302
|
+
code: "invalid_union",
|
|
303
|
+
errors: [errors],
|
|
304
|
+
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
305
|
+
} : {
|
|
306
|
+
path: [],
|
|
307
|
+
code: "custom",
|
|
308
|
+
errors: [errors],
|
|
309
|
+
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
310
|
+
}
|
|
311
|
+
);
|
|
312
|
+
}
|
|
313
|
+
}).optional()
|
|
314
|
+
}).strict();
|
|
315
|
+
var outputSchema4 = z4.object({
|
|
316
|
+
id: z4.string().regex(new RegExp("^[0-9a-fA-F]{24}$")).describe("Trello object id (24 hex chars)."),
|
|
317
|
+
name: z4.string(),
|
|
318
|
+
state: z4.enum(["complete", "incomplete"]),
|
|
319
|
+
idChecklist: z4.string().nullable().optional()
|
|
320
|
+
});
|
|
321
|
+
var definition4 = defineTool4({
|
|
322
|
+
name: "addChecklistItem",
|
|
323
|
+
title: "Add Checklist Item",
|
|
324
|
+
description: "Add an item to a checklist.",
|
|
325
|
+
inputSchema: inputSchema4,
|
|
326
|
+
outputSchema: outputSchema4,
|
|
327
|
+
annotations: {
|
|
328
|
+
readOnlyHint: false,
|
|
329
|
+
destructiveHint: false,
|
|
330
|
+
idempotentHint: false,
|
|
331
|
+
openWorldHint: true
|
|
332
|
+
},
|
|
333
|
+
connection: "trello",
|
|
334
|
+
run: async (input, ctx) => {
|
|
335
|
+
const url = `https://api.trello.com/1/checklists/${encodeURIComponent(input.id)}/checkItems`;
|
|
336
|
+
const body = {};
|
|
337
|
+
if (input.name !== void 0) body["name"] = input.name;
|
|
338
|
+
if (input.pos !== void 0) body["pos"] = input.pos;
|
|
339
|
+
const res = await ctx.fetch(url, {
|
|
340
|
+
method: "POST",
|
|
341
|
+
headers: { "Content-Type": "application/json" },
|
|
342
|
+
body: JSON.stringify(body)
|
|
343
|
+
});
|
|
344
|
+
if (!res.ok) {
|
|
345
|
+
const errBody = await res.text();
|
|
346
|
+
throw new Error(`Trello addChecklistItem ${res.status}: ${errBody}`);
|
|
347
|
+
}
|
|
348
|
+
return res.json();
|
|
349
|
+
}
|
|
350
|
+
});
|
|
351
|
+
var addChecklistItem_default = definition4;
|
|
352
|
+
await handleIfScriptMain4(import.meta, definition4, { connectionResolvers });
|
|
353
|
+
|
|
354
|
+
// scripts/addMemberToBoard.ts
|
|
355
|
+
import { defineTool as defineTool5, handleIfScriptMain as handleIfScriptMain5 } from "@zapier/connectors-sdk";
|
|
356
|
+
import { z as z5 } from "zod";
|
|
357
|
+
var inputSchema5 = z5.object({
|
|
358
|
+
id: z5.string().describe("24-char hex board id."),
|
|
359
|
+
email: z5.string().describe("Member email to invite/add."),
|
|
360
|
+
type: z5.enum(["normal", "admin", "observer"]).describe("Membership type.").optional(),
|
|
361
|
+
fullName: z5.string().describe("Display name when inviting by email.").optional()
|
|
362
|
+
}).strict();
|
|
363
|
+
var outputSchema5 = z5.object({ status: z5.number() });
|
|
364
|
+
var definition5 = defineTool5({
|
|
365
|
+
name: "addMemberToBoard",
|
|
366
|
+
title: "Add Member To Board",
|
|
367
|
+
description: "Add a member to a board by member id or email.",
|
|
368
|
+
inputSchema: inputSchema5,
|
|
369
|
+
outputSchema: outputSchema5,
|
|
370
|
+
annotations: {
|
|
371
|
+
readOnlyHint: false,
|
|
372
|
+
destructiveHint: false,
|
|
373
|
+
idempotentHint: false,
|
|
374
|
+
openWorldHint: true
|
|
375
|
+
},
|
|
376
|
+
connection: "trello",
|
|
377
|
+
run: async (input, ctx) => {
|
|
378
|
+
const url = `https://api.trello.com/1/boards/${encodeURIComponent(input.id)}/memberships`;
|
|
379
|
+
const body = {};
|
|
380
|
+
if (input.email !== void 0) body["email"] = input.email;
|
|
381
|
+
if (input.type !== void 0) body["type"] = input.type;
|
|
382
|
+
if (input.fullName !== void 0) body["fullName"] = input.fullName;
|
|
383
|
+
const res = await ctx.fetch(url, {
|
|
384
|
+
method: "POST",
|
|
385
|
+
headers: { "Content-Type": "application/json" },
|
|
386
|
+
body: JSON.stringify(body)
|
|
387
|
+
});
|
|
388
|
+
if (!res.ok) {
|
|
389
|
+
const errBody = await res.text();
|
|
390
|
+
throw new Error(`Trello addMemberToBoard ${res.status}: ${errBody}`);
|
|
391
|
+
}
|
|
392
|
+
return { status: res.status };
|
|
393
|
+
}
|
|
394
|
+
});
|
|
395
|
+
var addMemberToBoard_default = definition5;
|
|
396
|
+
await handleIfScriptMain5(import.meta, definition5, { connectionResolvers });
|
|
397
|
+
|
|
398
|
+
// scripts/archiveCard.ts
|
|
399
|
+
import { defineTool as defineTool6, handleIfScriptMain as handleIfScriptMain6 } from "@zapier/connectors-sdk";
|
|
400
|
+
import { z as z6 } from "zod";
|
|
401
|
+
var inputSchema6 = z6.object({
|
|
402
|
+
id: z6.string().describe("24-char hex card id to archive."),
|
|
403
|
+
closed: z6.boolean().default(true).describe("Archive when true (default); set false to reopen.")
|
|
404
|
+
}).strict();
|
|
405
|
+
var outputSchema6 = z6.object({
|
|
406
|
+
id: z6.string().regex(TRELLO_ID_REGEX),
|
|
407
|
+
name: z6.string(),
|
|
408
|
+
closed: z6.boolean(),
|
|
409
|
+
idBoard: z6.string(),
|
|
410
|
+
idList: z6.string(),
|
|
411
|
+
url: z6.string(),
|
|
412
|
+
shortUrl: z6.string().nullable().optional()
|
|
413
|
+
});
|
|
414
|
+
var definition6 = defineTool6({
|
|
415
|
+
name: "archiveCard",
|
|
416
|
+
title: "Archive Card",
|
|
417
|
+
description: "Archive (close) a card by id. Prefer this over updateCard when the job is only archiving. Reopen with closed=false.",
|
|
418
|
+
inputSchema: inputSchema6,
|
|
419
|
+
outputSchema: outputSchema6,
|
|
420
|
+
annotations: {
|
|
421
|
+
readOnlyHint: false,
|
|
422
|
+
destructiveHint: true,
|
|
423
|
+
idempotentHint: true,
|
|
424
|
+
openWorldHint: true
|
|
425
|
+
},
|
|
426
|
+
connection: "trello",
|
|
427
|
+
run: async (input, ctx) => {
|
|
428
|
+
const url = `${TRELLO_BASE}/cards/${encodeURIComponent(input.id)}`;
|
|
429
|
+
const res = await ctx.fetch(url, {
|
|
430
|
+
method: "PUT",
|
|
431
|
+
headers: trelloFormHeaders,
|
|
432
|
+
body: trelloFormBody({ closed: input.closed })
|
|
433
|
+
});
|
|
434
|
+
if (!res.ok) await trelloError("archiveCard", res);
|
|
435
|
+
const card = await res.json();
|
|
436
|
+
if (input.closed && card.closed) {
|
|
437
|
+
return card;
|
|
438
|
+
}
|
|
439
|
+
return card;
|
|
440
|
+
}
|
|
441
|
+
});
|
|
442
|
+
var archiveCard_default = definition6;
|
|
443
|
+
await handleIfScriptMain6(import.meta, definition6, { connectionResolvers });
|
|
444
|
+
|
|
445
|
+
// scripts/closeBoard.ts
|
|
446
|
+
import { defineTool as defineTool7, handleIfScriptMain as handleIfScriptMain7 } from "@zapier/connectors-sdk";
|
|
447
|
+
import { z as z7 } from "zod";
|
|
448
|
+
var inputSchema7 = z7.object({
|
|
449
|
+
id: z7.string().describe("24-char hex board id."),
|
|
450
|
+
closed: z7.boolean().default(true).describe("Set true to archive the board.")
|
|
451
|
+
}).strict();
|
|
452
|
+
var outputSchema7 = z7.object({
|
|
453
|
+
id: z7.string().regex(new RegExp("^[0-9a-fA-F]{24}$")).describe("Trello object id (24 hex chars)."),
|
|
454
|
+
name: z7.string(),
|
|
455
|
+
desc: z7.string().nullable().optional(),
|
|
456
|
+
closed: z7.boolean().nullable().optional(),
|
|
457
|
+
idOrganization: z7.string().nullable().optional(),
|
|
458
|
+
url: z7.string().nullable().optional(),
|
|
459
|
+
shortUrl: z7.string().nullable().optional(),
|
|
460
|
+
dateLastActivity: z7.string().datetime({ offset: true }).nullable().optional()
|
|
461
|
+
});
|
|
462
|
+
var definition7 = defineTool7({
|
|
463
|
+
name: "closeBoard",
|
|
464
|
+
title: "Close Board",
|
|
465
|
+
description: "Archive (close) a board by setting closed to true.",
|
|
466
|
+
inputSchema: inputSchema7,
|
|
467
|
+
outputSchema: outputSchema7,
|
|
468
|
+
annotations: {
|
|
469
|
+
readOnlyHint: false,
|
|
470
|
+
destructiveHint: false,
|
|
471
|
+
idempotentHint: true,
|
|
472
|
+
openWorldHint: true
|
|
473
|
+
},
|
|
474
|
+
connection: "trello",
|
|
475
|
+
run: async (input, ctx) => {
|
|
476
|
+
const url = `https://api.trello.com/1/boards/${encodeURIComponent(input.id)}`;
|
|
477
|
+
const body = {};
|
|
478
|
+
if (input.closed !== void 0) body["closed"] = input.closed;
|
|
479
|
+
const res = await ctx.fetch(url, {
|
|
480
|
+
method: "PUT",
|
|
481
|
+
headers: { "Content-Type": "application/json" },
|
|
482
|
+
body: JSON.stringify(body)
|
|
483
|
+
});
|
|
484
|
+
if (!res.ok) {
|
|
485
|
+
const errBody = await res.text();
|
|
486
|
+
throw new Error(`Trello closeBoard ${res.status}: ${errBody}`);
|
|
487
|
+
}
|
|
488
|
+
return res.json();
|
|
489
|
+
}
|
|
490
|
+
});
|
|
491
|
+
var closeBoard_default = definition7;
|
|
492
|
+
await handleIfScriptMain7(import.meta, definition7, { connectionResolvers });
|
|
493
|
+
|
|
494
|
+
// scripts/completeChecklistItem.ts
|
|
495
|
+
import { defineTool as defineTool8, handleIfScriptMain as handleIfScriptMain8 } from "@zapier/connectors-sdk";
|
|
496
|
+
import { z as z8 } from "zod";
|
|
497
|
+
var inputSchema8 = z8.object({
|
|
498
|
+
id: z8.string().describe("24-char hex card id."),
|
|
499
|
+
idCheckItem: z8.string(),
|
|
500
|
+
state: z8.enum(["complete", "incomplete"])
|
|
501
|
+
}).strict();
|
|
502
|
+
var outputSchema8 = z8.object({
|
|
503
|
+
id: z8.string().regex(new RegExp("^[0-9a-fA-F]{24}$")).describe("Trello object id (24 hex chars)."),
|
|
504
|
+
name: z8.string(),
|
|
505
|
+
state: z8.enum(["complete", "incomplete"]),
|
|
506
|
+
idChecklist: z8.string().nullable().optional()
|
|
507
|
+
});
|
|
508
|
+
var definition8 = defineTool8({
|
|
509
|
+
name: "completeChecklistItem",
|
|
510
|
+
title: "Complete Checklist Item",
|
|
511
|
+
description: "Mark a checklist item complete or incomplete.",
|
|
512
|
+
inputSchema: inputSchema8,
|
|
513
|
+
outputSchema: outputSchema8,
|
|
514
|
+
annotations: {
|
|
515
|
+
readOnlyHint: false,
|
|
516
|
+
destructiveHint: false,
|
|
517
|
+
idempotentHint: true,
|
|
518
|
+
openWorldHint: true
|
|
519
|
+
},
|
|
520
|
+
connection: "trello",
|
|
521
|
+
run: async (input, ctx) => {
|
|
522
|
+
const url = `https://api.trello.com/1/cards/${encodeURIComponent(input.id)}/checkItem/${encodeURIComponent(input.idCheckItem)}`;
|
|
523
|
+
const body = {};
|
|
524
|
+
if (input.state !== void 0) body["state"] = input.state;
|
|
525
|
+
const res = await ctx.fetch(url, {
|
|
526
|
+
method: "PUT",
|
|
527
|
+
headers: { "Content-Type": "application/json" },
|
|
528
|
+
body: JSON.stringify(body)
|
|
529
|
+
});
|
|
530
|
+
if (!res.ok) {
|
|
531
|
+
const errBody = await res.text();
|
|
532
|
+
throw new Error(`Trello completeChecklistItem ${res.status}: ${errBody}`);
|
|
533
|
+
}
|
|
534
|
+
return res.json();
|
|
535
|
+
}
|
|
536
|
+
});
|
|
537
|
+
var completeChecklistItem_default = definition8;
|
|
538
|
+
await handleIfScriptMain8(import.meta, definition8, { connectionResolvers });
|
|
539
|
+
|
|
540
|
+
// scripts/copyBoard.ts
|
|
541
|
+
import { defineTool as defineTool9, handleIfScriptMain as handleIfScriptMain9 } from "@zapier/connectors-sdk";
|
|
542
|
+
import { z as z9 } from "zod";
|
|
543
|
+
var inputSchema9 = z9.object({
|
|
544
|
+
id: z9.string().describe("24-char hex board id."),
|
|
545
|
+
name: z9.string().describe("Name for the copy.").optional(),
|
|
546
|
+
idOrganization: z9.string().describe("Destination workspace id.").optional(),
|
|
547
|
+
keepFromSource: z9.string().describe("Comma-separated props to keep, e.g. cards,labels.").optional(),
|
|
548
|
+
idBoardSource: z9.string().describe(
|
|
549
|
+
"Source board id (wire name idBoardSource; same as path id when omitted)."
|
|
550
|
+
).optional()
|
|
551
|
+
}).strict();
|
|
552
|
+
var outputSchema9 = z9.object({
|
|
553
|
+
id: z9.string().regex(new RegExp("^[0-9a-fA-F]{24}$")).describe("Trello object id (24 hex chars)."),
|
|
554
|
+
name: z9.string(),
|
|
555
|
+
desc: z9.string().nullable().optional(),
|
|
556
|
+
closed: z9.boolean().nullable().optional(),
|
|
557
|
+
idOrganization: z9.string().nullable().optional(),
|
|
558
|
+
url: z9.string().nullable().optional(),
|
|
559
|
+
shortUrl: z9.string().nullable().optional(),
|
|
560
|
+
dateLastActivity: z9.string().datetime({ offset: true }).nullable().optional()
|
|
561
|
+
});
|
|
562
|
+
var definition9 = defineTool9({
|
|
563
|
+
name: "copyBoard",
|
|
564
|
+
title: "Copy Board",
|
|
565
|
+
description: "Copy an existing board, optionally keeping cards and changing the destination workspace.",
|
|
566
|
+
inputSchema: inputSchema9,
|
|
567
|
+
outputSchema: outputSchema9,
|
|
568
|
+
annotations: {
|
|
569
|
+
readOnlyHint: false,
|
|
570
|
+
destructiveHint: false,
|
|
571
|
+
idempotentHint: false,
|
|
572
|
+
openWorldHint: true
|
|
573
|
+
},
|
|
574
|
+
connection: "trello",
|
|
575
|
+
run: async (input, ctx) => {
|
|
576
|
+
const fields = {
|
|
577
|
+
idBoardSource: input.idBoardSource ?? input.id
|
|
578
|
+
};
|
|
579
|
+
if (input.name !== void 0) fields.name = input.name;
|
|
580
|
+
if (input.idOrganization !== void 0) {
|
|
581
|
+
fields.idOrganization = input.idOrganization;
|
|
582
|
+
}
|
|
583
|
+
if (input.keepFromSource !== void 0) {
|
|
584
|
+
fields.keepFromSource = input.keepFromSource;
|
|
585
|
+
}
|
|
586
|
+
const res = await ctx.fetch(`${TRELLO_BASE}/boards`, {
|
|
587
|
+
method: "POST",
|
|
588
|
+
headers: trelloFormHeaders,
|
|
589
|
+
body: trelloFormBody(fields)
|
|
590
|
+
});
|
|
591
|
+
if (!res.ok) await trelloError("copyBoard", res);
|
|
592
|
+
return res.json();
|
|
593
|
+
}
|
|
594
|
+
});
|
|
595
|
+
var copyBoard_default = definition9;
|
|
596
|
+
await handleIfScriptMain9(import.meta, definition9, { connectionResolvers });
|
|
597
|
+
|
|
598
|
+
// scripts/createBoard.ts
|
|
599
|
+
import { defineTool as defineTool10, handleIfScriptMain as handleIfScriptMain10 } from "@zapier/connectors-sdk";
|
|
600
|
+
import { z as z10 } from "zod";
|
|
601
|
+
var inputSchema10 = z10.object({
|
|
602
|
+
name: z10.string().describe("Board name."),
|
|
603
|
+
desc: z10.string().describe("Board description.").optional(),
|
|
604
|
+
idOrganization: z10.string().describe("Workspace (organization) id. Resolve via listOrganizations.").optional(),
|
|
605
|
+
defaultLists: z10.boolean().describe("Create default To Do / Doing / Done lists. Default true.").optional()
|
|
606
|
+
}).strict();
|
|
607
|
+
var outputSchema10 = z10.object({
|
|
608
|
+
id: z10.string().regex(new RegExp("^[0-9a-fA-F]{24}$")).describe("Trello object id (24 hex chars)."),
|
|
609
|
+
name: z10.string(),
|
|
610
|
+
desc: z10.string().nullable().optional(),
|
|
611
|
+
closed: z10.boolean().nullable().optional(),
|
|
612
|
+
idOrganization: z10.string().nullable().optional(),
|
|
613
|
+
url: z10.string().nullable().optional(),
|
|
614
|
+
shortUrl: z10.string().nullable().optional(),
|
|
615
|
+
dateLastActivity: z10.string().datetime({ offset: true }).nullable().optional()
|
|
616
|
+
});
|
|
617
|
+
var definition10 = defineTool10({
|
|
618
|
+
name: "createBoard",
|
|
619
|
+
title: "Create Board",
|
|
620
|
+
description: "Create a new Trello board in a workspace.",
|
|
621
|
+
inputSchema: inputSchema10,
|
|
622
|
+
outputSchema: outputSchema10,
|
|
623
|
+
annotations: {
|
|
624
|
+
readOnlyHint: false,
|
|
625
|
+
destructiveHint: false,
|
|
626
|
+
idempotentHint: false,
|
|
627
|
+
openWorldHint: true
|
|
628
|
+
},
|
|
629
|
+
connection: "trello",
|
|
630
|
+
run: async (input, ctx) => {
|
|
631
|
+
const url = `https://api.trello.com/1/boards`;
|
|
632
|
+
const body = {};
|
|
633
|
+
if (input.name !== void 0) body["name"] = input.name;
|
|
634
|
+
if (input.desc !== void 0) body["desc"] = input.desc;
|
|
635
|
+
if (input.idOrganization !== void 0)
|
|
636
|
+
body["idOrganization"] = input.idOrganization;
|
|
637
|
+
if (input.defaultLists !== void 0)
|
|
638
|
+
body["defaultLists"] = input.defaultLists;
|
|
639
|
+
const res = await ctx.fetch(url, {
|
|
640
|
+
method: "POST",
|
|
641
|
+
headers: { "Content-Type": "application/json" },
|
|
642
|
+
body: JSON.stringify(body)
|
|
643
|
+
});
|
|
644
|
+
if (!res.ok) {
|
|
645
|
+
const errBody = await res.text();
|
|
646
|
+
throw new Error(`Trello createBoard ${res.status}: ${errBody}`);
|
|
647
|
+
}
|
|
648
|
+
return res.json();
|
|
649
|
+
}
|
|
650
|
+
});
|
|
651
|
+
var createBoard_default = definition10;
|
|
652
|
+
await handleIfScriptMain10(import.meta, definition10, { connectionResolvers });
|
|
653
|
+
|
|
654
|
+
// scripts/createCard.ts
|
|
655
|
+
import { defineTool as defineTool11, handleIfScriptMain as handleIfScriptMain11 } from "@zapier/connectors-sdk";
|
|
656
|
+
import { z as z11 } from "zod";
|
|
657
|
+
var cardOutputSchema = z11.object({
|
|
658
|
+
id: z11.string().regex(TRELLO_ID_REGEX),
|
|
659
|
+
idShort: z11.number().int().nullable().optional(),
|
|
660
|
+
name: z11.string(),
|
|
661
|
+
desc: z11.string().nullable().optional(),
|
|
662
|
+
idBoard: z11.string(),
|
|
663
|
+
idList: z11.string(),
|
|
664
|
+
shortUrl: z11.string().nullable().optional(),
|
|
665
|
+
url: z11.string(),
|
|
666
|
+
due: z11.union([z11.string().datetime({ offset: true }), z11.null()]).optional(),
|
|
667
|
+
start: z11.union([z11.string().datetime({ offset: true }), z11.null()]).optional(),
|
|
668
|
+
closed: z11.boolean(),
|
|
669
|
+
idMembers: z11.array(z11.string()).optional(),
|
|
670
|
+
idLabels: z11.array(z11.string()).optional(),
|
|
671
|
+
labels: z11.array(
|
|
672
|
+
z11.object({
|
|
673
|
+
id: z11.string(),
|
|
674
|
+
name: z11.string().nullable().optional(),
|
|
675
|
+
color: z11.string().nullable().optional()
|
|
676
|
+
})
|
|
677
|
+
).optional(),
|
|
678
|
+
dateLastActivity: z11.string().datetime({ offset: true }).nullable().optional(),
|
|
679
|
+
customFields: z11.record(z11.string(), z11.json()).optional()
|
|
680
|
+
});
|
|
681
|
+
var inputSchema11 = z11.object({
|
|
682
|
+
idList: z11.string().describe("Destination list id. Resolve via listLists or findList."),
|
|
683
|
+
name: z11.string().describe("Card title."),
|
|
684
|
+
desc: z11.string().describe("Card description (Trello Markdown).").optional(),
|
|
685
|
+
pos: z11.union([z11.enum(["top", "bottom"]), z11.number()]).describe("Position in the destination list.").optional(),
|
|
686
|
+
due: z11.string().datetime({ offset: true }).optional(),
|
|
687
|
+
start: z11.string().datetime({ offset: true }).optional(),
|
|
688
|
+
idMembers: z11.array(z11.string()).describe("Member ids to assign. Resolve via listBoardMembers.").optional(),
|
|
689
|
+
idLabels: z11.array(z11.string()).describe("Label ids to add. Resolve via listLabels or findLabel.").optional(),
|
|
690
|
+
attachmentUrl: z11.string().url().describe("URL attachment to add after create.").optional(),
|
|
691
|
+
attachmentFileUrl: z11.string().url().describe("Remote file URL to fetch and upload as attachment.").optional(),
|
|
692
|
+
checklistName: z11.string().describe("Create a checklist with this name after card create.").optional(),
|
|
693
|
+
checklistItems: z11.array(z11.string()).describe("Checklist item names for the new checklist.").optional(),
|
|
694
|
+
customFieldValues: z11.record(z11.string(), z11.json()).describe(
|
|
695
|
+
"Custom field values keyed by field name. Resolve names via listCustomFields."
|
|
696
|
+
).optional(),
|
|
697
|
+
address: z11.string().optional(),
|
|
698
|
+
coordinates: z11.string().describe("latitude,longitude").optional(),
|
|
699
|
+
locationName: z11.string().optional()
|
|
700
|
+
}).strict();
|
|
701
|
+
var definition11 = defineTool11({
|
|
702
|
+
name: "createCard",
|
|
703
|
+
title: "Create Card",
|
|
704
|
+
description: "Create a card on a list with optional members, labels, attachments, checklist, and custom fields. Resolve idList via listLists or findList first.",
|
|
705
|
+
inputSchema: inputSchema11,
|
|
706
|
+
outputSchema: cardOutputSchema,
|
|
707
|
+
annotations: {
|
|
708
|
+
readOnlyHint: false,
|
|
709
|
+
destructiveHint: false,
|
|
710
|
+
idempotentHint: false,
|
|
711
|
+
openWorldHint: true
|
|
712
|
+
},
|
|
713
|
+
connection: "trello",
|
|
714
|
+
run: async (input, ctx) => {
|
|
715
|
+
const createFields = {
|
|
716
|
+
name: input.name,
|
|
717
|
+
idList: input.idList
|
|
718
|
+
};
|
|
719
|
+
if (input.desc !== void 0)
|
|
720
|
+
createFields.desc = input.desc.slice(0, 16383);
|
|
721
|
+
if (input.pos !== void 0) createFields.pos = input.pos;
|
|
722
|
+
if (input.due !== void 0) createFields.due = input.due;
|
|
723
|
+
if (input.start !== void 0) createFields.start = input.start;
|
|
724
|
+
if (input.address !== void 0) createFields.address = input.address;
|
|
725
|
+
if (input.coordinates !== void 0)
|
|
726
|
+
createFields.coordinates = input.coordinates;
|
|
727
|
+
if (input.locationName !== void 0)
|
|
728
|
+
createFields.locationName = input.locationName;
|
|
729
|
+
if (input.idLabels?.length)
|
|
730
|
+
createFields.idLabels = input.idLabels.join(",");
|
|
731
|
+
const createRes = await ctx.fetch(`${TRELLO_BASE}/cards`, {
|
|
732
|
+
method: "POST",
|
|
733
|
+
headers: trelloFormHeaders,
|
|
734
|
+
body: trelloFormBody(createFields)
|
|
735
|
+
});
|
|
736
|
+
if (!createRes.ok) await trelloError("createCard", createRes);
|
|
737
|
+
let card = await createRes.json();
|
|
738
|
+
const cardId = card.id;
|
|
739
|
+
if (input.idMembers?.length) {
|
|
740
|
+
for (const memberId of input.idMembers) {
|
|
741
|
+
const memberRes = await ctx.fetch(
|
|
742
|
+
`${TRELLO_BASE}/cards/${cardId}/idMembers`,
|
|
743
|
+
{
|
|
744
|
+
method: "POST",
|
|
745
|
+
headers: trelloFormHeaders,
|
|
746
|
+
body: trelloFormBody({ value: memberId })
|
|
747
|
+
}
|
|
748
|
+
);
|
|
749
|
+
if (!memberRes.ok) await trelloError("createCard", memberRes);
|
|
750
|
+
}
|
|
751
|
+
}
|
|
752
|
+
const attachUrl = input.attachmentUrl ?? input.attachmentFileUrl;
|
|
753
|
+
if (attachUrl) {
|
|
754
|
+
if (input.attachmentFileUrl) {
|
|
755
|
+
const fileRes = await ctx.fetch(input.attachmentFileUrl);
|
|
756
|
+
if (!fileRes.ok) await trelloError("createCard", fileRes);
|
|
757
|
+
const buffer = await fileRes.arrayBuffer();
|
|
758
|
+
const form = new FormData();
|
|
759
|
+
form.append("file", new Blob([buffer]), "attachment");
|
|
760
|
+
form.append("name", "attachment");
|
|
761
|
+
const uploadRes = await ctx.fetch(
|
|
762
|
+
`${TRELLO_BASE}/cards/${cardId}/attachments`,
|
|
763
|
+
{ method: "POST", body: form }
|
|
764
|
+
);
|
|
765
|
+
if (!uploadRes.ok) await trelloError("createCard", uploadRes);
|
|
766
|
+
} else {
|
|
767
|
+
const urlRes = await ctx.fetch(
|
|
768
|
+
`${TRELLO_BASE}/cards/${cardId}/attachments`,
|
|
769
|
+
{
|
|
770
|
+
method: "POST",
|
|
771
|
+
headers: trelloFormHeaders,
|
|
772
|
+
body: trelloFormBody({ url: attachUrl, name: attachUrl })
|
|
773
|
+
}
|
|
774
|
+
);
|
|
775
|
+
if (!urlRes.ok) await trelloError("createCard", urlRes);
|
|
776
|
+
}
|
|
777
|
+
}
|
|
778
|
+
if (input.checklistName) {
|
|
779
|
+
const checklistRes = await ctx.fetch(`${TRELLO_BASE}/checklists`, {
|
|
780
|
+
method: "POST",
|
|
781
|
+
headers: trelloFormHeaders,
|
|
782
|
+
body: trelloFormBody({
|
|
783
|
+
idCard: cardId,
|
|
784
|
+
name: input.checklistName
|
|
785
|
+
})
|
|
786
|
+
});
|
|
787
|
+
if (!checklistRes.ok) await trelloError("createCard", checklistRes);
|
|
788
|
+
const checklist = await checklistRes.json();
|
|
789
|
+
if (input.checklistItems?.length) {
|
|
790
|
+
for (const itemName of input.checklistItems) {
|
|
791
|
+
const itemRes = await ctx.fetch(
|
|
792
|
+
`${TRELLO_BASE}/checklists/${checklist.id}/checkItems`,
|
|
793
|
+
{
|
|
794
|
+
method: "POST",
|
|
795
|
+
headers: trelloFormHeaders,
|
|
796
|
+
body: trelloFormBody({ name: itemName })
|
|
797
|
+
}
|
|
798
|
+
);
|
|
799
|
+
if (!itemRes.ok) await trelloError("createCard", itemRes);
|
|
800
|
+
}
|
|
801
|
+
}
|
|
802
|
+
}
|
|
803
|
+
if (input.customFieldValues && Object.keys(input.customFieldValues).length) {
|
|
804
|
+
const boardId = card.idBoard;
|
|
805
|
+
const fieldsRes = await ctx.fetch(
|
|
806
|
+
`${TRELLO_BASE}/boards/${boardId}/customFields`
|
|
807
|
+
);
|
|
808
|
+
if (!fieldsRes.ok) await trelloError("createCard", fieldsRes);
|
|
809
|
+
const fields = await fieldsRes.json();
|
|
810
|
+
const byName = new Map(fields.map((f) => [f.name, f]));
|
|
811
|
+
for (const [fieldName, rawValue] of Object.entries(
|
|
812
|
+
input.customFieldValues
|
|
813
|
+
)) {
|
|
814
|
+
const field = byName.get(fieldName);
|
|
815
|
+
if (!field) {
|
|
816
|
+
throw new Error(
|
|
817
|
+
`Trello createCard: unknown custom field "${fieldName}". Resolve via listCustomFields.`
|
|
818
|
+
);
|
|
819
|
+
}
|
|
820
|
+
let itemValue = {};
|
|
821
|
+
switch (field.type) {
|
|
822
|
+
case "checkbox":
|
|
823
|
+
itemValue = { checked: Boolean(rawValue) ? "true" : "false" };
|
|
824
|
+
break;
|
|
825
|
+
case "date":
|
|
826
|
+
itemValue = { date: String(rawValue) };
|
|
827
|
+
break;
|
|
828
|
+
case "number":
|
|
829
|
+
itemValue = { number: String(rawValue) };
|
|
830
|
+
break;
|
|
831
|
+
case "list": {
|
|
832
|
+
itemValue = { idValue: String(rawValue) };
|
|
833
|
+
break;
|
|
834
|
+
}
|
|
835
|
+
default:
|
|
836
|
+
itemValue = { text: String(rawValue) };
|
|
837
|
+
}
|
|
838
|
+
const cfRes = await ctx.fetch(
|
|
839
|
+
`${TRELLO_BASE}/cards/${cardId}/customField/${field.id}/item`,
|
|
840
|
+
{
|
|
841
|
+
method: "PUT",
|
|
842
|
+
headers: { "Content-Type": "application/json" },
|
|
843
|
+
body: JSON.stringify({ value: itemValue })
|
|
844
|
+
}
|
|
845
|
+
);
|
|
846
|
+
if (!cfRes.ok) await trelloError("createCard", cfRes);
|
|
847
|
+
}
|
|
848
|
+
}
|
|
849
|
+
const refreshRes = await ctx.fetch(`${TRELLO_BASE}/cards/${cardId}`);
|
|
850
|
+
if (refreshRes.ok) {
|
|
851
|
+
card = await refreshRes.json();
|
|
852
|
+
}
|
|
853
|
+
return card;
|
|
854
|
+
}
|
|
855
|
+
});
|
|
856
|
+
var createCard_default = definition11;
|
|
857
|
+
await handleIfScriptMain11(import.meta, definition11, { connectionResolvers });
|
|
858
|
+
|
|
859
|
+
// scripts/createChecklist.ts
|
|
860
|
+
import { defineTool as defineTool12, handleIfScriptMain as handleIfScriptMain12 } from "@zapier/connectors-sdk";
|
|
861
|
+
import { z as z12 } from "zod";
|
|
862
|
+
var inputSchema12 = z12.object({ idCard: z12.string(), name: z12.string() }).strict();
|
|
863
|
+
var outputSchema11 = z12.object({
|
|
864
|
+
id: z12.string().regex(new RegExp("^[0-9a-fA-F]{24}$")).describe("Trello object id (24 hex chars)."),
|
|
865
|
+
name: z12.string(),
|
|
866
|
+
idCard: z12.string().nullable().optional()
|
|
867
|
+
});
|
|
868
|
+
var definition12 = defineTool12({
|
|
869
|
+
name: "createChecklist",
|
|
870
|
+
title: "Create Checklist",
|
|
871
|
+
description: "Create a checklist on a card.",
|
|
872
|
+
inputSchema: inputSchema12,
|
|
873
|
+
outputSchema: outputSchema11,
|
|
874
|
+
annotations: {
|
|
875
|
+
readOnlyHint: false,
|
|
876
|
+
destructiveHint: false,
|
|
877
|
+
idempotentHint: false,
|
|
878
|
+
openWorldHint: true
|
|
879
|
+
},
|
|
880
|
+
connection: "trello",
|
|
881
|
+
run: async (input, ctx) => {
|
|
882
|
+
const url = `https://api.trello.com/1/checklists`;
|
|
883
|
+
const body = {};
|
|
884
|
+
if (input.idCard !== void 0) body["idCard"] = input.idCard;
|
|
885
|
+
if (input.name !== void 0) body["name"] = input.name;
|
|
886
|
+
const res = await ctx.fetch(url, {
|
|
887
|
+
method: "POST",
|
|
888
|
+
headers: { "Content-Type": "application/json" },
|
|
889
|
+
body: JSON.stringify(body)
|
|
890
|
+
});
|
|
891
|
+
if (!res.ok) {
|
|
892
|
+
const errBody = await res.text();
|
|
893
|
+
throw new Error(`Trello createChecklist ${res.status}: ${errBody}`);
|
|
894
|
+
}
|
|
895
|
+
return res.json();
|
|
896
|
+
}
|
|
897
|
+
});
|
|
898
|
+
var createChecklist_default = definition12;
|
|
899
|
+
await handleIfScriptMain12(import.meta, definition12, { connectionResolvers });
|
|
900
|
+
|
|
901
|
+
// scripts/createComment.ts
|
|
902
|
+
import { defineTool as defineTool13, handleIfScriptMain as handleIfScriptMain13 } from "@zapier/connectors-sdk";
|
|
903
|
+
import { z as z13 } from "zod";
|
|
904
|
+
var inputSchema13 = z13.object({
|
|
905
|
+
id: z13.string().describe("24-char hex card id."),
|
|
906
|
+
text: z13.string().describe(
|
|
907
|
+
"Comment body (Trello Markdown; @member mentions use @username)."
|
|
908
|
+
)
|
|
909
|
+
}).strict();
|
|
910
|
+
var outputSchema12 = z13.object({
|
|
911
|
+
id: z13.string().regex(new RegExp("^[0-9a-fA-F]{24}$")).describe("Trello object id (24 hex chars)."),
|
|
912
|
+
type: z13.string(),
|
|
913
|
+
date: z13.string().datetime({ offset: true }),
|
|
914
|
+
data: z13.object({
|
|
915
|
+
text: z13.string().nullable().optional(),
|
|
916
|
+
card: z13.object({
|
|
917
|
+
id: z13.string().nullable().optional(),
|
|
918
|
+
name: z13.string().nullable().optional()
|
|
919
|
+
}).nullable().optional()
|
|
920
|
+
}).nullable().optional()
|
|
921
|
+
});
|
|
922
|
+
var definition13 = defineTool13({
|
|
923
|
+
name: "createComment",
|
|
924
|
+
title: "Create Comment",
|
|
925
|
+
description: "Add a comment to a card.",
|
|
926
|
+
inputSchema: inputSchema13,
|
|
927
|
+
outputSchema: outputSchema12,
|
|
928
|
+
annotations: {
|
|
929
|
+
readOnlyHint: false,
|
|
930
|
+
destructiveHint: false,
|
|
931
|
+
idempotentHint: false,
|
|
932
|
+
openWorldHint: true
|
|
933
|
+
},
|
|
934
|
+
connection: "trello",
|
|
935
|
+
run: async (input, ctx) => {
|
|
936
|
+
const url = `https://api.trello.com/1/cards/${encodeURIComponent(input.id)}/actions/comments`;
|
|
937
|
+
const body = {};
|
|
938
|
+
if (input.text !== void 0) body["text"] = input.text;
|
|
939
|
+
const res = await ctx.fetch(url, {
|
|
940
|
+
method: "POST",
|
|
941
|
+
headers: { "Content-Type": "application/json" },
|
|
942
|
+
body: JSON.stringify(body)
|
|
943
|
+
});
|
|
944
|
+
if (!res.ok) {
|
|
945
|
+
const errBody = await res.text();
|
|
946
|
+
throw new Error(`Trello createComment ${res.status}: ${errBody}`);
|
|
947
|
+
}
|
|
948
|
+
return res.json();
|
|
949
|
+
}
|
|
950
|
+
});
|
|
951
|
+
var createComment_default = definition13;
|
|
952
|
+
await handleIfScriptMain13(import.meta, definition13, { connectionResolvers });
|
|
953
|
+
|
|
954
|
+
// scripts/createLabel.ts
|
|
955
|
+
import { defineTool as defineTool14, handleIfScriptMain as handleIfScriptMain14 } from "@zapier/connectors-sdk";
|
|
956
|
+
import { z as z14 } from "zod";
|
|
957
|
+
var inputSchema14 = z14.object({
|
|
958
|
+
name: z14.string().optional(),
|
|
959
|
+
color: z14.enum([
|
|
960
|
+
"yellow",
|
|
961
|
+
"purple",
|
|
962
|
+
"blue",
|
|
963
|
+
"red",
|
|
964
|
+
"green",
|
|
965
|
+
"orange",
|
|
966
|
+
"black",
|
|
967
|
+
"sky",
|
|
968
|
+
"pink",
|
|
969
|
+
"lime"
|
|
970
|
+
]).optional(),
|
|
971
|
+
idBoard: z14.string()
|
|
972
|
+
}).strict();
|
|
973
|
+
var outputSchema13 = z14.object({
|
|
974
|
+
id: z14.string().regex(new RegExp("^[0-9a-fA-F]{24}$")).describe("Trello object id (24 hex chars)."),
|
|
975
|
+
idBoard: z14.string(),
|
|
976
|
+
name: z14.string().nullable().optional(),
|
|
977
|
+
color: z14.string().nullable().optional()
|
|
978
|
+
});
|
|
979
|
+
var definition14 = defineTool14({
|
|
980
|
+
name: "createLabel",
|
|
981
|
+
title: "Create Label",
|
|
982
|
+
description: "Create a label on a board (or add a named label to a card when idCard set).",
|
|
983
|
+
inputSchema: inputSchema14,
|
|
984
|
+
outputSchema: outputSchema13,
|
|
985
|
+
annotations: {
|
|
986
|
+
readOnlyHint: false,
|
|
987
|
+
destructiveHint: false,
|
|
988
|
+
idempotentHint: false,
|
|
989
|
+
openWorldHint: true
|
|
990
|
+
},
|
|
991
|
+
connection: "trello",
|
|
992
|
+
run: async (input, ctx) => {
|
|
993
|
+
const url = `https://api.trello.com/1/labels`;
|
|
994
|
+
const body = {};
|
|
995
|
+
if (input.name !== void 0) body["name"] = input.name;
|
|
996
|
+
if (input.color !== void 0) body["color"] = input.color;
|
|
997
|
+
if (input.idBoard !== void 0) body["idBoard"] = input.idBoard;
|
|
998
|
+
const res = await ctx.fetch(url, {
|
|
999
|
+
method: "POST",
|
|
1000
|
+
headers: { "Content-Type": "application/json" },
|
|
1001
|
+
body: JSON.stringify(body)
|
|
1002
|
+
});
|
|
1003
|
+
if (!res.ok) {
|
|
1004
|
+
const errBody = await res.text();
|
|
1005
|
+
throw new Error(`Trello createLabel ${res.status}: ${errBody}`);
|
|
1006
|
+
}
|
|
1007
|
+
return res.json();
|
|
1008
|
+
}
|
|
1009
|
+
});
|
|
1010
|
+
var createLabel_default = definition14;
|
|
1011
|
+
await handleIfScriptMain14(import.meta, definition14, { connectionResolvers });
|
|
1012
|
+
|
|
1013
|
+
// scripts/createList.ts
|
|
1014
|
+
import { defineTool as defineTool15, handleIfScriptMain as handleIfScriptMain15 } from "@zapier/connectors-sdk";
|
|
1015
|
+
import { z as z15 } from "zod";
|
|
1016
|
+
var inputSchema15 = z15.object({
|
|
1017
|
+
name: z15.string(),
|
|
1018
|
+
idBoard: z15.string().describe("Board id."),
|
|
1019
|
+
pos: z15.any().superRefine((x, ctx) => {
|
|
1020
|
+
const schemas = [z15.enum(["top", "bottom"]), z15.number()];
|
|
1021
|
+
const { errors, failed } = schemas.reduce(
|
|
1022
|
+
({ errors: errors2, failed: failed2 }, schema) => ((result) => result.error ? {
|
|
1023
|
+
errors: [...errors2, ...result.error.issues],
|
|
1024
|
+
failed: failed2 + 1
|
|
1025
|
+
} : { errors: errors2, failed: failed2 })(schema.safeParse(x)),
|
|
1026
|
+
{ errors: [], failed: 0 }
|
|
1027
|
+
);
|
|
1028
|
+
const passed = schemas.length - failed;
|
|
1029
|
+
if (passed !== 1) {
|
|
1030
|
+
ctx.addIssue(
|
|
1031
|
+
errors.length ? {
|
|
1032
|
+
path: [],
|
|
1033
|
+
code: "invalid_union",
|
|
1034
|
+
errors: [errors],
|
|
1035
|
+
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
1036
|
+
} : {
|
|
1037
|
+
path: [],
|
|
1038
|
+
code: "custom",
|
|
1039
|
+
errors: [errors],
|
|
1040
|
+
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
1041
|
+
}
|
|
1042
|
+
);
|
|
1043
|
+
}
|
|
1044
|
+
}).optional()
|
|
1045
|
+
}).strict();
|
|
1046
|
+
var outputSchema14 = z15.object({
|
|
1047
|
+
id: z15.string().regex(new RegExp("^[0-9a-fA-F]{24}$")).describe("Trello object id (24 hex chars)."),
|
|
1048
|
+
name: z15.string(),
|
|
1049
|
+
closed: z15.boolean().nullable().optional(),
|
|
1050
|
+
idBoard: z15.string(),
|
|
1051
|
+
pos: z15.number().nullable().optional()
|
|
1052
|
+
});
|
|
1053
|
+
var definition15 = defineTool15({
|
|
1054
|
+
name: "createList",
|
|
1055
|
+
title: "Create List",
|
|
1056
|
+
description: "Create a list on a board.",
|
|
1057
|
+
inputSchema: inputSchema15,
|
|
1058
|
+
outputSchema: outputSchema14,
|
|
1059
|
+
annotations: {
|
|
1060
|
+
readOnlyHint: false,
|
|
1061
|
+
destructiveHint: false,
|
|
1062
|
+
idempotentHint: false,
|
|
1063
|
+
openWorldHint: true
|
|
1064
|
+
},
|
|
1065
|
+
connection: "trello",
|
|
1066
|
+
run: async (input, ctx) => {
|
|
1067
|
+
const url = `https://api.trello.com/1/lists`;
|
|
1068
|
+
const body = {};
|
|
1069
|
+
if (input.name !== void 0) body["name"] = input.name;
|
|
1070
|
+
if (input.idBoard !== void 0) body["idBoard"] = input.idBoard;
|
|
1071
|
+
if (input.pos !== void 0) body["pos"] = input.pos;
|
|
1072
|
+
const res = await ctx.fetch(url, {
|
|
1073
|
+
method: "POST",
|
|
1074
|
+
headers: { "Content-Type": "application/json" },
|
|
1075
|
+
body: JSON.stringify(body)
|
|
1076
|
+
});
|
|
1077
|
+
if (!res.ok) {
|
|
1078
|
+
const errBody = await res.text();
|
|
1079
|
+
throw new Error(`Trello createList ${res.status}: ${errBody}`);
|
|
1080
|
+
}
|
|
1081
|
+
return res.json();
|
|
1082
|
+
}
|
|
1083
|
+
});
|
|
1084
|
+
var createList_default = definition15;
|
|
1085
|
+
await handleIfScriptMain15(import.meta, definition15, { connectionResolvers });
|
|
1086
|
+
|
|
1087
|
+
// scripts/deleteChecklist.ts
|
|
1088
|
+
import { defineTool as defineTool16, handleIfScriptMain as handleIfScriptMain16 } from "@zapier/connectors-sdk";
|
|
1089
|
+
import { z as z16 } from "zod";
|
|
1090
|
+
var inputSchema16 = z16.object({ id: z16.string() }).strict();
|
|
1091
|
+
var outputSchema15 = z16.object({ status: z16.number() });
|
|
1092
|
+
var definition16 = defineTool16({
|
|
1093
|
+
name: "deleteChecklist",
|
|
1094
|
+
title: "Delete Checklist",
|
|
1095
|
+
description: "Delete a checklist.",
|
|
1096
|
+
inputSchema: inputSchema16,
|
|
1097
|
+
outputSchema: outputSchema15,
|
|
1098
|
+
annotations: {
|
|
1099
|
+
readOnlyHint: false,
|
|
1100
|
+
destructiveHint: true,
|
|
1101
|
+
idempotentHint: true,
|
|
1102
|
+
openWorldHint: true
|
|
1103
|
+
},
|
|
1104
|
+
connection: "trello",
|
|
1105
|
+
run: async (input, ctx) => {
|
|
1106
|
+
const url = `https://api.trello.com/1/checklists/${encodeURIComponent(input.id)}`;
|
|
1107
|
+
const res = await ctx.fetch(url, {
|
|
1108
|
+
method: "DELETE"
|
|
1109
|
+
});
|
|
1110
|
+
if (!res.ok) {
|
|
1111
|
+
const errBody = await res.text();
|
|
1112
|
+
throw new Error(`Trello deleteChecklist ${res.status}: ${errBody}`);
|
|
1113
|
+
}
|
|
1114
|
+
return { status: res.status };
|
|
1115
|
+
}
|
|
1116
|
+
});
|
|
1117
|
+
var deleteChecklist_default = definition16;
|
|
1118
|
+
await handleIfScriptMain16(import.meta, definition16, { connectionResolvers });
|
|
1119
|
+
|
|
1120
|
+
// scripts/findBoard.ts
|
|
1121
|
+
import { defineTool as defineTool17, handleIfScriptMain as handleIfScriptMain17 } from "@zapier/connectors-sdk";
|
|
1122
|
+
import { z as z17 } from "zod";
|
|
1123
|
+
var inputSchema17 = z17.object({ query: z17.string(), organizationId: z17.string().optional() }).strict();
|
|
1124
|
+
var itemSchema = z17.array(
|
|
1125
|
+
z17.object({
|
|
1126
|
+
id: z17.string().regex(new RegExp("^[0-9a-fA-F]{24}$")).describe("Trello object id (24 hex chars)."),
|
|
1127
|
+
name: z17.string(),
|
|
1128
|
+
desc: z17.string().nullable().optional(),
|
|
1129
|
+
closed: z17.boolean().nullable().optional(),
|
|
1130
|
+
idOrganization: z17.string().nullable().optional(),
|
|
1131
|
+
url: z17.string().nullable().optional(),
|
|
1132
|
+
shortUrl: z17.string().nullable().optional(),
|
|
1133
|
+
dateLastActivity: z17.string().datetime({ offset: true }).nullable().optional()
|
|
1134
|
+
})
|
|
1135
|
+
);
|
|
1136
|
+
var outputSchema16 = z17.object({ items: itemSchema });
|
|
1137
|
+
var definition17 = defineTool17({
|
|
1138
|
+
name: "findBoard",
|
|
1139
|
+
title: "Find Board",
|
|
1140
|
+
description: "Find boards by name via GET /search with modelTypes=boards.",
|
|
1141
|
+
inputSchema: inputSchema17,
|
|
1142
|
+
outputSchema: outputSchema16,
|
|
1143
|
+
annotations: {
|
|
1144
|
+
readOnlyHint: true,
|
|
1145
|
+
destructiveHint: false,
|
|
1146
|
+
idempotentHint: true,
|
|
1147
|
+
openWorldHint: true
|
|
1148
|
+
},
|
|
1149
|
+
connection: "trello",
|
|
1150
|
+
run: async (input, ctx) => {
|
|
1151
|
+
const url = new URL(`${TRELLO_BASE}/search`);
|
|
1152
|
+
url.searchParams.set("query", input.query);
|
|
1153
|
+
url.searchParams.set("modelTypes", "boards");
|
|
1154
|
+
url.searchParams.set("boardsLimit", "50");
|
|
1155
|
+
if (input.organizationId !== void 0) {
|
|
1156
|
+
url.searchParams.set("idOrganizations", input.organizationId);
|
|
1157
|
+
}
|
|
1158
|
+
const res = await ctx.fetch(url.toString(), { method: "GET" });
|
|
1159
|
+
if (!res.ok) await trelloError("findBoard", res);
|
|
1160
|
+
const data = await res.json();
|
|
1161
|
+
return { items: data.boards ?? [] };
|
|
1162
|
+
}
|
|
1163
|
+
});
|
|
1164
|
+
var findBoard_default = definition17;
|
|
1165
|
+
await handleIfScriptMain17(import.meta, definition17, { connectionResolvers });
|
|
1166
|
+
|
|
1167
|
+
// scripts/findChecklist.ts
|
|
1168
|
+
import { defineTool as defineTool18, handleIfScriptMain as handleIfScriptMain18 } from "@zapier/connectors-sdk";
|
|
1169
|
+
import { z as z18 } from "zod";
|
|
1170
|
+
var inputSchema18 = z18.object({ id: z18.string().describe("24-char hex card id."), name: z18.string() }).strict();
|
|
1171
|
+
var itemSchema2 = z18.array(
|
|
1172
|
+
z18.object({
|
|
1173
|
+
id: z18.string().regex(new RegExp("^[0-9a-fA-F]{24}$")).describe("Trello object id (24 hex chars)."),
|
|
1174
|
+
name: z18.string(),
|
|
1175
|
+
idCard: z18.string().nullable().optional()
|
|
1176
|
+
})
|
|
1177
|
+
);
|
|
1178
|
+
var outputSchema17 = z18.object({ items: itemSchema2 });
|
|
1179
|
+
var definition18 = defineTool18({
|
|
1180
|
+
name: "findChecklist",
|
|
1181
|
+
title: "Find Checklist",
|
|
1182
|
+
description: "Find checklists on a card whose name contains the search string.",
|
|
1183
|
+
inputSchema: inputSchema18,
|
|
1184
|
+
outputSchema: outputSchema17,
|
|
1185
|
+
annotations: {
|
|
1186
|
+
readOnlyHint: true,
|
|
1187
|
+
destructiveHint: false,
|
|
1188
|
+
idempotentHint: true,
|
|
1189
|
+
openWorldHint: true
|
|
1190
|
+
},
|
|
1191
|
+
connection: "trello",
|
|
1192
|
+
run: async (input, ctx) => {
|
|
1193
|
+
const url = `${TRELLO_BASE}/cards/${encodeURIComponent(input.id)}/checklists`;
|
|
1194
|
+
const res = await ctx.fetch(url, { method: "GET" });
|
|
1195
|
+
if (!res.ok) await trelloError("findChecklist", res);
|
|
1196
|
+
const checklists = await res.json();
|
|
1197
|
+
const items = (Array.isArray(checklists) ? checklists : []).filter(
|
|
1198
|
+
(cl) => nameContains(cl.name ?? "", input.name)
|
|
1199
|
+
);
|
|
1200
|
+
return { items };
|
|
1201
|
+
}
|
|
1202
|
+
});
|
|
1203
|
+
var findChecklist_default = definition18;
|
|
1204
|
+
await handleIfScriptMain18(import.meta, definition18, { connectionResolvers });
|
|
1205
|
+
|
|
1206
|
+
// scripts/findChecklistItem.ts
|
|
1207
|
+
import { defineTool as defineTool19, handleIfScriptMain as handleIfScriptMain19 } from "@zapier/connectors-sdk";
|
|
1208
|
+
import { z as z19 } from "zod";
|
|
1209
|
+
var inputSchema19 = z19.object({ id: z19.string(), name: z19.string() }).strict();
|
|
1210
|
+
var itemSchema3 = z19.array(
|
|
1211
|
+
z19.object({
|
|
1212
|
+
id: z19.string().regex(new RegExp("^[0-9a-fA-F]{24}$")).describe("Trello object id (24 hex chars)."),
|
|
1213
|
+
name: z19.string(),
|
|
1214
|
+
state: z19.enum(["complete", "incomplete"]),
|
|
1215
|
+
idChecklist: z19.string().nullable().optional()
|
|
1216
|
+
})
|
|
1217
|
+
);
|
|
1218
|
+
var outputSchema18 = z19.object({ items: itemSchema3 });
|
|
1219
|
+
var definition19 = defineTool19({
|
|
1220
|
+
name: "findChecklistItem",
|
|
1221
|
+
title: "Find Checklist Item",
|
|
1222
|
+
description: "Find checklist items whose name contains the search string.",
|
|
1223
|
+
inputSchema: inputSchema19,
|
|
1224
|
+
outputSchema: outputSchema18,
|
|
1225
|
+
annotations: {
|
|
1226
|
+
readOnlyHint: true,
|
|
1227
|
+
destructiveHint: false,
|
|
1228
|
+
idempotentHint: true,
|
|
1229
|
+
openWorldHint: true
|
|
1230
|
+
},
|
|
1231
|
+
connection: "trello",
|
|
1232
|
+
run: async (input, ctx) => {
|
|
1233
|
+
const url = `${TRELLO_BASE}/checklists/${encodeURIComponent(input.id)}/checkItems`;
|
|
1234
|
+
const res = await ctx.fetch(url, { method: "GET" });
|
|
1235
|
+
if (!res.ok) await trelloError("findChecklistItem", res);
|
|
1236
|
+
const checkItems = await res.json();
|
|
1237
|
+
const items = (Array.isArray(checkItems) ? checkItems : []).filter(
|
|
1238
|
+
(item) => nameContains(item.name ?? "", input.name)
|
|
1239
|
+
);
|
|
1240
|
+
return { items };
|
|
1241
|
+
}
|
|
1242
|
+
});
|
|
1243
|
+
var findChecklistItem_default = definition19;
|
|
1244
|
+
await handleIfScriptMain19(import.meta, definition19, { connectionResolvers });
|
|
1245
|
+
|
|
1246
|
+
// scripts/findLabel.ts
|
|
1247
|
+
import { defineTool as defineTool20, handleIfScriptMain as handleIfScriptMain20 } from "@zapier/connectors-sdk";
|
|
1248
|
+
import { z as z20 } from "zod";
|
|
1249
|
+
var inputSchema20 = z20.object({
|
|
1250
|
+
id: z20.string().describe("24-char hex board id."),
|
|
1251
|
+
name: z20.string()
|
|
1252
|
+
}).strict();
|
|
1253
|
+
var itemSchema4 = z20.array(
|
|
1254
|
+
z20.object({
|
|
1255
|
+
id: z20.string().regex(new RegExp("^[0-9a-fA-F]{24}$")).describe("Trello object id (24 hex chars)."),
|
|
1256
|
+
idBoard: z20.string(),
|
|
1257
|
+
name: z20.string().nullable().optional(),
|
|
1258
|
+
color: z20.string().nullable().optional()
|
|
1259
|
+
})
|
|
1260
|
+
);
|
|
1261
|
+
var outputSchema19 = z20.object({ items: itemSchema4 });
|
|
1262
|
+
var definition20 = defineTool20({
|
|
1263
|
+
name: "findLabel",
|
|
1264
|
+
title: "Find Label",
|
|
1265
|
+
description: "Find labels on a board whose name contains the search string.",
|
|
1266
|
+
inputSchema: inputSchema20,
|
|
1267
|
+
outputSchema: outputSchema19,
|
|
1268
|
+
annotations: {
|
|
1269
|
+
readOnlyHint: true,
|
|
1270
|
+
destructiveHint: false,
|
|
1271
|
+
idempotentHint: true,
|
|
1272
|
+
openWorldHint: true
|
|
1273
|
+
},
|
|
1274
|
+
connection: "trello",
|
|
1275
|
+
run: async (input, ctx) => {
|
|
1276
|
+
const url = `${TRELLO_BASE}/boards/${encodeURIComponent(input.id)}/labels`;
|
|
1277
|
+
const res = await ctx.fetch(url, { method: "GET" });
|
|
1278
|
+
if (!res.ok) await trelloError("findLabel", res);
|
|
1279
|
+
const labels = await res.json();
|
|
1280
|
+
const items = (Array.isArray(labels) ? labels : []).filter(
|
|
1281
|
+
(label) => nameContains(label.name ?? "", input.name)
|
|
1282
|
+
);
|
|
1283
|
+
return { items };
|
|
1284
|
+
}
|
|
1285
|
+
});
|
|
1286
|
+
var findLabel_default = definition20;
|
|
1287
|
+
await handleIfScriptMain20(import.meta, definition20, { connectionResolvers });
|
|
1288
|
+
|
|
1289
|
+
// scripts/findList.ts
|
|
1290
|
+
import { defineTool as defineTool21, handleIfScriptMain as handleIfScriptMain21 } from "@zapier/connectors-sdk";
|
|
1291
|
+
import { z as z21 } from "zod";
|
|
1292
|
+
var inputSchema21 = z21.object({
|
|
1293
|
+
id: z21.string().describe("24-char hex board id."),
|
|
1294
|
+
name: z21.string()
|
|
1295
|
+
}).strict();
|
|
1296
|
+
var itemSchema5 = z21.array(
|
|
1297
|
+
z21.object({
|
|
1298
|
+
id: z21.string().regex(new RegExp("^[0-9a-fA-F]{24}$")).describe("Trello object id (24 hex chars)."),
|
|
1299
|
+
name: z21.string(),
|
|
1300
|
+
closed: z21.boolean().nullable().optional(),
|
|
1301
|
+
idBoard: z21.string(),
|
|
1302
|
+
pos: z21.number().nullable().optional()
|
|
1303
|
+
})
|
|
1304
|
+
);
|
|
1305
|
+
var outputSchema20 = z21.object({ items: itemSchema5 });
|
|
1306
|
+
var definition21 = defineTool21({
|
|
1307
|
+
name: "findList",
|
|
1308
|
+
title: "Find List",
|
|
1309
|
+
description: "Find lists on a board whose name contains the search string.",
|
|
1310
|
+
inputSchema: inputSchema21,
|
|
1311
|
+
outputSchema: outputSchema20,
|
|
1312
|
+
annotations: {
|
|
1313
|
+
readOnlyHint: true,
|
|
1314
|
+
destructiveHint: false,
|
|
1315
|
+
idempotentHint: true,
|
|
1316
|
+
openWorldHint: true
|
|
1317
|
+
},
|
|
1318
|
+
connection: "trello",
|
|
1319
|
+
run: async (input, ctx) => {
|
|
1320
|
+
const url = `${TRELLO_BASE}/boards/${encodeURIComponent(input.id)}/lists`;
|
|
1321
|
+
const res = await ctx.fetch(url, { method: "GET" });
|
|
1322
|
+
if (!res.ok) await trelloError("findList", res);
|
|
1323
|
+
const lists = await res.json();
|
|
1324
|
+
const items = (Array.isArray(lists) ? lists : []).filter(
|
|
1325
|
+
(list) => nameContains(list.name ?? "", input.name)
|
|
1326
|
+
);
|
|
1327
|
+
return { items };
|
|
1328
|
+
}
|
|
1329
|
+
});
|
|
1330
|
+
var findList_default = definition21;
|
|
1331
|
+
await handleIfScriptMain21(import.meta, definition21, { connectionResolvers });
|
|
1332
|
+
|
|
1333
|
+
// scripts/findOrganizationMember.ts
|
|
1334
|
+
import { defineTool as defineTool22, handleIfScriptMain as handleIfScriptMain22 } from "@zapier/connectors-sdk";
|
|
1335
|
+
import { z as z22 } from "zod";
|
|
1336
|
+
var inputSchema22 = z22.object({ query: z22.string(), organizationId: z22.string().optional() }).strict();
|
|
1337
|
+
var itemSchema6 = z22.array(
|
|
1338
|
+
z22.object({
|
|
1339
|
+
id: z22.string().regex(new RegExp("^[0-9a-fA-F]{24}$")).describe("Trello object id (24 hex chars)."),
|
|
1340
|
+
username: z22.string(),
|
|
1341
|
+
fullName: z22.string().nullable().optional(),
|
|
1342
|
+
initials: z22.string().nullable().optional(),
|
|
1343
|
+
avatarUrl: z22.string().nullable().optional(),
|
|
1344
|
+
email: z22.string().nullable().describe("Present only when token has account read scope.").optional()
|
|
1345
|
+
})
|
|
1346
|
+
);
|
|
1347
|
+
var outputSchema21 = z22.object({ items: itemSchema6 });
|
|
1348
|
+
var definition22 = defineTool22({
|
|
1349
|
+
name: "findOrganizationMember",
|
|
1350
|
+
title: "Find Organization Member",
|
|
1351
|
+
description: "Find members via GET /search/members/.",
|
|
1352
|
+
inputSchema: inputSchema22,
|
|
1353
|
+
outputSchema: outputSchema21,
|
|
1354
|
+
annotations: {
|
|
1355
|
+
readOnlyHint: true,
|
|
1356
|
+
destructiveHint: false,
|
|
1357
|
+
idempotentHint: true,
|
|
1358
|
+
openWorldHint: true
|
|
1359
|
+
},
|
|
1360
|
+
connection: "trello",
|
|
1361
|
+
run: async (input, ctx) => {
|
|
1362
|
+
const url = new URL(`${TRELLO_BASE}/search/members/`);
|
|
1363
|
+
url.searchParams.set("query", input.query);
|
|
1364
|
+
url.searchParams.set("limit", "20");
|
|
1365
|
+
if (input.organizationId !== void 0) {
|
|
1366
|
+
url.searchParams.set("idOrganization", input.organizationId);
|
|
1367
|
+
}
|
|
1368
|
+
const res = await ctx.fetch(url.toString(), { method: "GET" });
|
|
1369
|
+
if (!res.ok) await trelloError("findOrganizationMember", res);
|
|
1370
|
+
const data = await res.json();
|
|
1371
|
+
return { items: Array.isArray(data) ? data : [] };
|
|
1372
|
+
}
|
|
1373
|
+
});
|
|
1374
|
+
var findOrganizationMember_default = definition22;
|
|
1375
|
+
await handleIfScriptMain22(import.meta, definition22, { connectionResolvers });
|
|
1376
|
+
|
|
1377
|
+
// scripts/getAction.ts
|
|
1378
|
+
import { defineTool as defineTool23, handleIfScriptMain as handleIfScriptMain23 } from "@zapier/connectors-sdk";
|
|
1379
|
+
import { z as z23 } from "zod";
|
|
1380
|
+
var inputSchema23 = z23.object({ id: z23.string() }).strict();
|
|
1381
|
+
var outputSchema22 = z23.object({
|
|
1382
|
+
id: z23.string().regex(new RegExp("^[0-9a-fA-F]{24}$")).describe("Trello object id (24 hex chars)."),
|
|
1383
|
+
type: z23.string(),
|
|
1384
|
+
date: z23.string().datetime({ offset: true }),
|
|
1385
|
+
data: z23.object({
|
|
1386
|
+
text: z23.string().nullable().optional(),
|
|
1387
|
+
card: z23.object({
|
|
1388
|
+
id: z23.string().nullable().optional(),
|
|
1389
|
+
name: z23.string().nullable().optional()
|
|
1390
|
+
}).nullable().optional()
|
|
1391
|
+
}).nullable().optional()
|
|
1392
|
+
});
|
|
1393
|
+
var definition23 = defineTool23({
|
|
1394
|
+
name: "getAction",
|
|
1395
|
+
title: "Get Action",
|
|
1396
|
+
description: "Get an action (activity) by id, including comments.",
|
|
1397
|
+
inputSchema: inputSchema23,
|
|
1398
|
+
outputSchema: outputSchema22,
|
|
1399
|
+
annotations: {
|
|
1400
|
+
readOnlyHint: true,
|
|
1401
|
+
destructiveHint: false,
|
|
1402
|
+
idempotentHint: true,
|
|
1403
|
+
openWorldHint: true
|
|
1404
|
+
},
|
|
1405
|
+
connection: "trello",
|
|
1406
|
+
run: async (input, ctx) => {
|
|
1407
|
+
const url = `https://api.trello.com/1/actions/${encodeURIComponent(input.id)}`;
|
|
1408
|
+
const res = await ctx.fetch(url, {
|
|
1409
|
+
method: "GET"
|
|
1410
|
+
});
|
|
1411
|
+
if (!res.ok) {
|
|
1412
|
+
const errBody = await res.text();
|
|
1413
|
+
throw new Error(`Trello getAction ${res.status}: ${errBody}`);
|
|
1414
|
+
}
|
|
1415
|
+
return res.json();
|
|
1416
|
+
}
|
|
1417
|
+
});
|
|
1418
|
+
var getAction_default = definition23;
|
|
1419
|
+
await handleIfScriptMain23(import.meta, definition23, { connectionResolvers });
|
|
1420
|
+
|
|
1421
|
+
// scripts/getBoard.ts
|
|
1422
|
+
import { defineTool as defineTool24, handleIfScriptMain as handleIfScriptMain24 } from "@zapier/connectors-sdk";
|
|
1423
|
+
import { z as z24 } from "zod";
|
|
1424
|
+
var inputSchema24 = z24.object({ id: z24.string().describe("24-char hex board id.") }).strict();
|
|
1425
|
+
var outputSchema23 = z24.object({
|
|
1426
|
+
id: z24.string().regex(new RegExp("^[0-9a-fA-F]{24}$")).describe("Trello object id (24 hex chars)."),
|
|
1427
|
+
name: z24.string(),
|
|
1428
|
+
desc: z24.string().nullable().optional(),
|
|
1429
|
+
closed: z24.boolean().nullable().optional(),
|
|
1430
|
+
idOrganization: z24.string().nullable().optional(),
|
|
1431
|
+
url: z24.string().nullable().optional(),
|
|
1432
|
+
shortUrl: z24.string().nullable().optional(),
|
|
1433
|
+
dateLastActivity: z24.string().datetime({ offset: true }).nullable().optional()
|
|
1434
|
+
});
|
|
1435
|
+
var definition24 = defineTool24({
|
|
1436
|
+
name: "getBoard",
|
|
1437
|
+
title: "Get Board",
|
|
1438
|
+
description: "Get a board by id.",
|
|
1439
|
+
inputSchema: inputSchema24,
|
|
1440
|
+
outputSchema: outputSchema23,
|
|
1441
|
+
annotations: {
|
|
1442
|
+
readOnlyHint: true,
|
|
1443
|
+
destructiveHint: false,
|
|
1444
|
+
idempotentHint: true,
|
|
1445
|
+
openWorldHint: true
|
|
1446
|
+
},
|
|
1447
|
+
connection: "trello",
|
|
1448
|
+
run: async (input, ctx) => {
|
|
1449
|
+
const url = `https://api.trello.com/1/boards/${encodeURIComponent(input.id)}`;
|
|
1450
|
+
const res = await ctx.fetch(url, {
|
|
1451
|
+
method: "GET"
|
|
1452
|
+
});
|
|
1453
|
+
if (!res.ok) {
|
|
1454
|
+
const errBody = await res.text();
|
|
1455
|
+
throw new Error(`Trello getBoard ${res.status}: ${errBody}`);
|
|
1456
|
+
}
|
|
1457
|
+
return res.json();
|
|
1458
|
+
}
|
|
1459
|
+
});
|
|
1460
|
+
var getBoard_default = definition24;
|
|
1461
|
+
await handleIfScriptMain24(import.meta, definition24, { connectionResolvers });
|
|
1462
|
+
|
|
1463
|
+
// scripts/getCard.ts
|
|
1464
|
+
import { defineTool as defineTool25, handleIfScriptMain as handleIfScriptMain25 } from "@zapier/connectors-sdk";
|
|
1465
|
+
import { z as z25 } from "zod";
|
|
1466
|
+
var inputSchema25 = z25.object({ id: z25.string().describe("24-char hex card id.") }).strict();
|
|
1467
|
+
var outputSchema24 = z25.object({
|
|
1468
|
+
id: z25.string().regex(new RegExp("^[0-9a-fA-F]{24}$")).describe("Trello object id (24 hex chars)."),
|
|
1469
|
+
name: z25.string(),
|
|
1470
|
+
desc: z25.string().nullable().optional(),
|
|
1471
|
+
closed: z25.boolean().nullable().optional(),
|
|
1472
|
+
idBoard: z25.string(),
|
|
1473
|
+
idList: z25.string(),
|
|
1474
|
+
idShort: z25.number().int().nullable().optional(),
|
|
1475
|
+
shortLink: z25.string().nullable().optional(),
|
|
1476
|
+
shortUrl: z25.string().nullable().optional(),
|
|
1477
|
+
url: z25.string().nullable().optional(),
|
|
1478
|
+
due: z25.union([z25.string().datetime({ offset: true }), z25.null()]).optional(),
|
|
1479
|
+
dueComplete: z25.boolean().nullable().optional(),
|
|
1480
|
+
dateLastActivity: z25.string().datetime({ offset: true }).nullable().optional(),
|
|
1481
|
+
idLabels: z25.array(z25.string()).nullable().optional(),
|
|
1482
|
+
idMembers: z25.array(z25.string()).nullable().optional(),
|
|
1483
|
+
labels: z25.array(
|
|
1484
|
+
z25.object({
|
|
1485
|
+
id: z25.string().regex(new RegExp("^[0-9a-fA-F]{24}$")).describe("Trello object id (24 hex chars)."),
|
|
1486
|
+
idBoard: z25.string(),
|
|
1487
|
+
name: z25.string().nullable().optional(),
|
|
1488
|
+
color: z25.string().nullable().optional()
|
|
1489
|
+
})
|
|
1490
|
+
).nullable().optional(),
|
|
1491
|
+
pos: z25.number().nullable().optional(),
|
|
1492
|
+
customFields: z25.record(z25.string(), z25.any()).nullable().describe("Custom field values keyed by field name when requested.").optional()
|
|
1493
|
+
});
|
|
1494
|
+
var definition25 = defineTool25({
|
|
1495
|
+
name: "getCard",
|
|
1496
|
+
title: "Get Card",
|
|
1497
|
+
description: "Get a card by id.",
|
|
1498
|
+
inputSchema: inputSchema25,
|
|
1499
|
+
outputSchema: outputSchema24,
|
|
1500
|
+
annotations: {
|
|
1501
|
+
readOnlyHint: true,
|
|
1502
|
+
destructiveHint: false,
|
|
1503
|
+
idempotentHint: true,
|
|
1504
|
+
openWorldHint: true
|
|
1505
|
+
},
|
|
1506
|
+
connection: "trello",
|
|
1507
|
+
run: async (input, ctx) => {
|
|
1508
|
+
const url = `https://api.trello.com/1/cards/${encodeURIComponent(input.id)}`;
|
|
1509
|
+
const res = await ctx.fetch(url, {
|
|
1510
|
+
method: "GET"
|
|
1511
|
+
});
|
|
1512
|
+
if (!res.ok) {
|
|
1513
|
+
const errBody = await res.text();
|
|
1514
|
+
throw new Error(`Trello getCard ${res.status}: ${errBody}`);
|
|
1515
|
+
}
|
|
1516
|
+
return res.json();
|
|
1517
|
+
}
|
|
1518
|
+
});
|
|
1519
|
+
var getCard_default = definition25;
|
|
1520
|
+
await handleIfScriptMain25(import.meta, definition25, { connectionResolvers });
|
|
1521
|
+
|
|
1522
|
+
// scripts/getChecklist.ts
|
|
1523
|
+
import { defineTool as defineTool26, handleIfScriptMain as handleIfScriptMain26 } from "@zapier/connectors-sdk";
|
|
1524
|
+
import { z as z26 } from "zod";
|
|
1525
|
+
var inputSchema26 = z26.object({ id: z26.string() }).strict();
|
|
1526
|
+
var outputSchema25 = z26.object({
|
|
1527
|
+
id: z26.string().regex(new RegExp("^[0-9a-fA-F]{24}$")).describe("Trello object id (24 hex chars)."),
|
|
1528
|
+
name: z26.string(),
|
|
1529
|
+
idCard: z26.string().nullable().optional()
|
|
1530
|
+
});
|
|
1531
|
+
var definition26 = defineTool26({
|
|
1532
|
+
name: "getChecklist",
|
|
1533
|
+
title: "Get Checklist",
|
|
1534
|
+
description: "Get a checklist by id.",
|
|
1535
|
+
inputSchema: inputSchema26,
|
|
1536
|
+
outputSchema: outputSchema25,
|
|
1537
|
+
annotations: {
|
|
1538
|
+
readOnlyHint: true,
|
|
1539
|
+
destructiveHint: false,
|
|
1540
|
+
idempotentHint: true,
|
|
1541
|
+
openWorldHint: true
|
|
1542
|
+
},
|
|
1543
|
+
connection: "trello",
|
|
1544
|
+
run: async (input, ctx) => {
|
|
1545
|
+
const url = `https://api.trello.com/1/checklists/${encodeURIComponent(input.id)}`;
|
|
1546
|
+
const res = await ctx.fetch(url, {
|
|
1547
|
+
method: "GET"
|
|
1548
|
+
});
|
|
1549
|
+
if (!res.ok) {
|
|
1550
|
+
const errBody = await res.text();
|
|
1551
|
+
throw new Error(`Trello getChecklist ${res.status}: ${errBody}`);
|
|
1552
|
+
}
|
|
1553
|
+
return res.json();
|
|
1554
|
+
}
|
|
1555
|
+
});
|
|
1556
|
+
var getChecklist_default = definition26;
|
|
1557
|
+
await handleIfScriptMain26(import.meta, definition26, { connectionResolvers });
|
|
1558
|
+
|
|
1559
|
+
// scripts/getChecklistItem.ts
|
|
1560
|
+
import { defineTool as defineTool27, handleIfScriptMain as handleIfScriptMain27 } from "@zapier/connectors-sdk";
|
|
1561
|
+
import { z as z27 } from "zod";
|
|
1562
|
+
var inputSchema27 = z27.object({ id: z27.string(), idCheckItem: z27.string() }).strict();
|
|
1563
|
+
var outputSchema26 = z27.object({
|
|
1564
|
+
id: z27.string().regex(new RegExp("^[0-9a-fA-F]{24}$")).describe("Trello object id (24 hex chars)."),
|
|
1565
|
+
name: z27.string(),
|
|
1566
|
+
state: z27.enum(["complete", "incomplete"]),
|
|
1567
|
+
idChecklist: z27.string().nullable().optional()
|
|
1568
|
+
});
|
|
1569
|
+
var definition27 = defineTool27({
|
|
1570
|
+
name: "getChecklistItem",
|
|
1571
|
+
title: "Get Checklist Item",
|
|
1572
|
+
description: "Get a checklist item by id.",
|
|
1573
|
+
inputSchema: inputSchema27,
|
|
1574
|
+
outputSchema: outputSchema26,
|
|
1575
|
+
annotations: {
|
|
1576
|
+
readOnlyHint: true,
|
|
1577
|
+
destructiveHint: false,
|
|
1578
|
+
idempotentHint: true,
|
|
1579
|
+
openWorldHint: true
|
|
1580
|
+
},
|
|
1581
|
+
connection: "trello",
|
|
1582
|
+
run: async (input, ctx) => {
|
|
1583
|
+
const url = `https://api.trello.com/1/checklists/${encodeURIComponent(input.id)}/checkItems/${encodeURIComponent(input.idCheckItem)}`;
|
|
1584
|
+
const res = await ctx.fetch(url, {
|
|
1585
|
+
method: "GET"
|
|
1586
|
+
});
|
|
1587
|
+
if (!res.ok) {
|
|
1588
|
+
const errBody = await res.text();
|
|
1589
|
+
throw new Error(`Trello getChecklistItem ${res.status}: ${errBody}`);
|
|
1590
|
+
}
|
|
1591
|
+
return res.json();
|
|
1592
|
+
}
|
|
1593
|
+
});
|
|
1594
|
+
var getChecklistItem_default = definition27;
|
|
1595
|
+
await handleIfScriptMain27(import.meta, definition27, { connectionResolvers });
|
|
1596
|
+
|
|
1597
|
+
// scripts/getCurrentMember.ts
|
|
1598
|
+
import { defineTool as defineTool28, handleIfScriptMain as handleIfScriptMain28 } from "@zapier/connectors-sdk";
|
|
1599
|
+
import { z as z28 } from "zod";
|
|
1600
|
+
var inputSchema28 = z28.object({}).strict();
|
|
1601
|
+
var outputSchema27 = z28.object({
|
|
1602
|
+
id: z28.string().regex(new RegExp("^[0-9a-fA-F]{24}$")).describe("Trello object id (24 hex chars)."),
|
|
1603
|
+
username: z28.string(),
|
|
1604
|
+
fullName: z28.string().nullable().optional(),
|
|
1605
|
+
initials: z28.string().nullable().optional(),
|
|
1606
|
+
avatarUrl: z28.string().nullable().optional(),
|
|
1607
|
+
email: z28.string().nullable().describe("Present only when token has account read scope.").optional()
|
|
1608
|
+
});
|
|
1609
|
+
var definition28 = defineTool28({
|
|
1610
|
+
name: "getCurrentMember",
|
|
1611
|
+
title: "Get Current Member",
|
|
1612
|
+
description: "Get the authenticated member (identity resolver).",
|
|
1613
|
+
inputSchema: inputSchema28,
|
|
1614
|
+
outputSchema: outputSchema27,
|
|
1615
|
+
annotations: {
|
|
1616
|
+
readOnlyHint: true,
|
|
1617
|
+
destructiveHint: false,
|
|
1618
|
+
idempotentHint: true,
|
|
1619
|
+
openWorldHint: true
|
|
1620
|
+
},
|
|
1621
|
+
connection: "trello",
|
|
1622
|
+
run: async (_input, ctx) => {
|
|
1623
|
+
const url = `https://api.trello.com/1/members/me`;
|
|
1624
|
+
const res = await ctx.fetch(url, {
|
|
1625
|
+
method: "GET"
|
|
1626
|
+
});
|
|
1627
|
+
if (!res.ok) {
|
|
1628
|
+
const errBody = await res.text();
|
|
1629
|
+
throw new Error(`Trello getCurrentMember ${res.status}: ${errBody}`);
|
|
1630
|
+
}
|
|
1631
|
+
return res.json();
|
|
1632
|
+
}
|
|
1633
|
+
});
|
|
1634
|
+
var getCurrentMember_default = definition28;
|
|
1635
|
+
await handleIfScriptMain28(import.meta, definition28, { connectionResolvers });
|
|
1636
|
+
|
|
1637
|
+
// scripts/getLabel.ts
|
|
1638
|
+
import { defineTool as defineTool29, handleIfScriptMain as handleIfScriptMain29 } from "@zapier/connectors-sdk";
|
|
1639
|
+
import { z as z29 } from "zod";
|
|
1640
|
+
var inputSchema29 = z29.object({ id: z29.string() }).strict();
|
|
1641
|
+
var outputSchema28 = z29.object({
|
|
1642
|
+
id: z29.string().regex(new RegExp("^[0-9a-fA-F]{24}$")).describe("Trello object id (24 hex chars)."),
|
|
1643
|
+
idBoard: z29.string(),
|
|
1644
|
+
name: z29.string().nullable().optional(),
|
|
1645
|
+
color: z29.string().nullable().optional()
|
|
1646
|
+
});
|
|
1647
|
+
var definition29 = defineTool29({
|
|
1648
|
+
name: "getLabel",
|
|
1649
|
+
title: "Get Label",
|
|
1650
|
+
description: "Get a label by id.",
|
|
1651
|
+
inputSchema: inputSchema29,
|
|
1652
|
+
outputSchema: outputSchema28,
|
|
1653
|
+
annotations: {
|
|
1654
|
+
readOnlyHint: true,
|
|
1655
|
+
destructiveHint: false,
|
|
1656
|
+
idempotentHint: true,
|
|
1657
|
+
openWorldHint: true
|
|
1658
|
+
},
|
|
1659
|
+
connection: "trello",
|
|
1660
|
+
run: async (input, ctx) => {
|
|
1661
|
+
const url = `https://api.trello.com/1/labels/${encodeURIComponent(input.id)}`;
|
|
1662
|
+
const res = await ctx.fetch(url, {
|
|
1663
|
+
method: "GET"
|
|
1664
|
+
});
|
|
1665
|
+
if (!res.ok) {
|
|
1666
|
+
const errBody = await res.text();
|
|
1667
|
+
throw new Error(`Trello getLabel ${res.status}: ${errBody}`);
|
|
1668
|
+
}
|
|
1669
|
+
return res.json();
|
|
1670
|
+
}
|
|
1671
|
+
});
|
|
1672
|
+
var getLabel_default = definition29;
|
|
1673
|
+
await handleIfScriptMain29(import.meta, definition29, { connectionResolvers });
|
|
1674
|
+
|
|
1675
|
+
// scripts/getList.ts
|
|
1676
|
+
import { defineTool as defineTool30, handleIfScriptMain as handleIfScriptMain30 } from "@zapier/connectors-sdk";
|
|
1677
|
+
import { z as z30 } from "zod";
|
|
1678
|
+
var inputSchema30 = z30.object({ id: z30.string() }).strict();
|
|
1679
|
+
var outputSchema29 = z30.object({
|
|
1680
|
+
id: z30.string().regex(new RegExp("^[0-9a-fA-F]{24}$")).describe("Trello object id (24 hex chars)."),
|
|
1681
|
+
name: z30.string(),
|
|
1682
|
+
closed: z30.boolean().nullable().optional(),
|
|
1683
|
+
idBoard: z30.string(),
|
|
1684
|
+
pos: z30.number().nullable().optional()
|
|
1685
|
+
});
|
|
1686
|
+
var definition30 = defineTool30({
|
|
1687
|
+
name: "getList",
|
|
1688
|
+
title: "Get List",
|
|
1689
|
+
description: "Get a list by id.",
|
|
1690
|
+
inputSchema: inputSchema30,
|
|
1691
|
+
outputSchema: outputSchema29,
|
|
1692
|
+
annotations: {
|
|
1693
|
+
readOnlyHint: true,
|
|
1694
|
+
destructiveHint: false,
|
|
1695
|
+
idempotentHint: true,
|
|
1696
|
+
openWorldHint: true
|
|
1697
|
+
},
|
|
1698
|
+
connection: "trello",
|
|
1699
|
+
run: async (input, ctx) => {
|
|
1700
|
+
const url = `https://api.trello.com/1/lists/${encodeURIComponent(input.id)}`;
|
|
1701
|
+
const res = await ctx.fetch(url, {
|
|
1702
|
+
method: "GET"
|
|
1703
|
+
});
|
|
1704
|
+
if (!res.ok) {
|
|
1705
|
+
const errBody = await res.text();
|
|
1706
|
+
throw new Error(`Trello getList ${res.status}: ${errBody}`);
|
|
1707
|
+
}
|
|
1708
|
+
return res.json();
|
|
1709
|
+
}
|
|
1710
|
+
});
|
|
1711
|
+
var getList_default = definition30;
|
|
1712
|
+
await handleIfScriptMain30(import.meta, definition30, { connectionResolvers });
|
|
1713
|
+
|
|
1714
|
+
// scripts/getMember.ts
|
|
1715
|
+
import { defineTool as defineTool31, handleIfScriptMain as handleIfScriptMain31 } from "@zapier/connectors-sdk";
|
|
1716
|
+
import { z as z31 } from "zod";
|
|
1717
|
+
var inputSchema31 = z31.object({ id: z31.string() }).strict();
|
|
1718
|
+
var outputSchema30 = z31.object({
|
|
1719
|
+
id: z31.string().regex(new RegExp("^[0-9a-fA-F]{24}$")).describe("Trello object id (24 hex chars)."),
|
|
1720
|
+
username: z31.string(),
|
|
1721
|
+
fullName: z31.string().nullable().optional(),
|
|
1722
|
+
initials: z31.string().nullable().optional(),
|
|
1723
|
+
avatarUrl: z31.string().nullable().optional(),
|
|
1724
|
+
email: z31.string().nullable().describe("Present only when token has account read scope.").optional()
|
|
1725
|
+
});
|
|
1726
|
+
var definition31 = defineTool31({
|
|
1727
|
+
name: "getMember",
|
|
1728
|
+
title: "Get Member",
|
|
1729
|
+
description: "Get a member by id.",
|
|
1730
|
+
inputSchema: inputSchema31,
|
|
1731
|
+
outputSchema: outputSchema30,
|
|
1732
|
+
annotations: {
|
|
1733
|
+
readOnlyHint: true,
|
|
1734
|
+
destructiveHint: false,
|
|
1735
|
+
idempotentHint: true,
|
|
1736
|
+
openWorldHint: true
|
|
1737
|
+
},
|
|
1738
|
+
connection: "trello",
|
|
1739
|
+
run: async (input, ctx) => {
|
|
1740
|
+
const url = `https://api.trello.com/1/members/${encodeURIComponent(input.id)}`;
|
|
1741
|
+
const res = await ctx.fetch(url, {
|
|
1742
|
+
method: "GET"
|
|
1743
|
+
});
|
|
1744
|
+
if (!res.ok) {
|
|
1745
|
+
const errBody = await res.text();
|
|
1746
|
+
throw new Error(`Trello getMember ${res.status}: ${errBody}`);
|
|
1747
|
+
}
|
|
1748
|
+
return res.json();
|
|
1749
|
+
}
|
|
1750
|
+
});
|
|
1751
|
+
var getMember_default = definition31;
|
|
1752
|
+
await handleIfScriptMain31(import.meta, definition31, { connectionResolvers });
|
|
1753
|
+
|
|
1754
|
+
// scripts/getOrganization.ts
|
|
1755
|
+
import { defineTool as defineTool32, handleIfScriptMain as handleIfScriptMain32 } from "@zapier/connectors-sdk";
|
|
1756
|
+
import { z as z32 } from "zod";
|
|
1757
|
+
var inputSchema32 = z32.object({ id: z32.string() }).strict();
|
|
1758
|
+
var outputSchema31 = z32.object({
|
|
1759
|
+
id: z32.string().regex(new RegExp("^[0-9a-fA-F]{24}$")).describe("Trello object id (24 hex chars)."),
|
|
1760
|
+
name: z32.string(),
|
|
1761
|
+
displayName: z32.string(),
|
|
1762
|
+
url: z32.string().nullable().optional()
|
|
1763
|
+
});
|
|
1764
|
+
var definition32 = defineTool32({
|
|
1765
|
+
name: "getOrganization",
|
|
1766
|
+
title: "Get Organization",
|
|
1767
|
+
description: "Get a workspace (organization) by id.",
|
|
1768
|
+
inputSchema: inputSchema32,
|
|
1769
|
+
outputSchema: outputSchema31,
|
|
1770
|
+
annotations: {
|
|
1771
|
+
readOnlyHint: true,
|
|
1772
|
+
destructiveHint: false,
|
|
1773
|
+
idempotentHint: true,
|
|
1774
|
+
openWorldHint: true
|
|
1775
|
+
},
|
|
1776
|
+
connection: "trello",
|
|
1777
|
+
run: async (input, ctx) => {
|
|
1778
|
+
const url = `https://api.trello.com/1/organizations/${encodeURIComponent(input.id)}`;
|
|
1779
|
+
const res = await ctx.fetch(url, {
|
|
1780
|
+
method: "GET"
|
|
1781
|
+
});
|
|
1782
|
+
if (!res.ok) {
|
|
1783
|
+
const errBody = await res.text();
|
|
1784
|
+
throw new Error(`Trello getOrganization ${res.status}: ${errBody}`);
|
|
1785
|
+
}
|
|
1786
|
+
return res.json();
|
|
1787
|
+
}
|
|
1788
|
+
});
|
|
1789
|
+
var getOrganization_default = definition32;
|
|
1790
|
+
await handleIfScriptMain32(import.meta, definition32, { connectionResolvers });
|
|
1791
|
+
|
|
1792
|
+
// scripts/listBoardMembers.ts
|
|
1793
|
+
import { defineTool as defineTool33, handleIfScriptMain as handleIfScriptMain33 } from "@zapier/connectors-sdk";
|
|
1794
|
+
import { z as z33 } from "zod";
|
|
1795
|
+
var inputSchema33 = z33.object({ id: z33.string().describe("24-char hex board id.") }).strict();
|
|
1796
|
+
var itemSchema7 = z33.array(
|
|
1797
|
+
z33.object({
|
|
1798
|
+
id: z33.string().regex(new RegExp("^[0-9a-fA-F]{24}$")).describe("Trello object id (24 hex chars)."),
|
|
1799
|
+
username: z33.string(),
|
|
1800
|
+
fullName: z33.string().nullable().optional(),
|
|
1801
|
+
initials: z33.string().nullable().optional(),
|
|
1802
|
+
avatarUrl: z33.string().nullable().optional(),
|
|
1803
|
+
email: z33.string().nullable().describe("Present only when token has account read scope.").optional()
|
|
1804
|
+
})
|
|
1805
|
+
);
|
|
1806
|
+
var outputSchema32 = z33.object({ items: itemSchema7 });
|
|
1807
|
+
var definition33 = defineTool33({
|
|
1808
|
+
name: "listBoardMembers",
|
|
1809
|
+
title: "List Board Members",
|
|
1810
|
+
description: "List members of a board.",
|
|
1811
|
+
inputSchema: inputSchema33,
|
|
1812
|
+
outputSchema: outputSchema32,
|
|
1813
|
+
annotations: {
|
|
1814
|
+
readOnlyHint: true,
|
|
1815
|
+
destructiveHint: false,
|
|
1816
|
+
idempotentHint: true,
|
|
1817
|
+
openWorldHint: true
|
|
1818
|
+
},
|
|
1819
|
+
connection: "trello",
|
|
1820
|
+
run: async (input, ctx) => {
|
|
1821
|
+
const url = `https://api.trello.com/1/boards/${encodeURIComponent(input.id)}/members`;
|
|
1822
|
+
const res = await ctx.fetch(url, {
|
|
1823
|
+
method: "GET"
|
|
1824
|
+
});
|
|
1825
|
+
if (!res.ok) {
|
|
1826
|
+
const errBody = await res.text();
|
|
1827
|
+
throw new Error(`Trello listBoardMembers ${res.status}: ${errBody}`);
|
|
1828
|
+
}
|
|
1829
|
+
const data = await res.json();
|
|
1830
|
+
return { items: data };
|
|
1831
|
+
}
|
|
1832
|
+
});
|
|
1833
|
+
var listBoardMembers_default = definition33;
|
|
1834
|
+
await handleIfScriptMain33(import.meta, definition33, { connectionResolvers });
|
|
1835
|
+
|
|
1836
|
+
// scripts/listBoards.ts
|
|
1837
|
+
import { defineTool as defineTool34, handleIfScriptMain as handleIfScriptMain34 } from "@zapier/connectors-sdk";
|
|
1838
|
+
import { z as z34 } from "zod";
|
|
1839
|
+
var inputSchema34 = z34.object({
|
|
1840
|
+
filter: z34.enum([
|
|
1841
|
+
"all",
|
|
1842
|
+
"closed",
|
|
1843
|
+
"members",
|
|
1844
|
+
"none",
|
|
1845
|
+
"open",
|
|
1846
|
+
"organization",
|
|
1847
|
+
"pinned",
|
|
1848
|
+
"public",
|
|
1849
|
+
"starred",
|
|
1850
|
+
"unpinned"
|
|
1851
|
+
]).default("all")
|
|
1852
|
+
}).strict();
|
|
1853
|
+
var itemSchema8 = z34.array(
|
|
1854
|
+
z34.object({
|
|
1855
|
+
id: z34.string().regex(new RegExp("^[0-9a-fA-F]{24}$")).describe("Trello object id (24 hex chars)."),
|
|
1856
|
+
name: z34.string(),
|
|
1857
|
+
desc: z34.string().nullable().optional(),
|
|
1858
|
+
closed: z34.boolean().nullable().optional(),
|
|
1859
|
+
idOrganization: z34.string().nullable().optional(),
|
|
1860
|
+
url: z34.string().nullable().optional(),
|
|
1861
|
+
shortUrl: z34.string().nullable().optional(),
|
|
1862
|
+
dateLastActivity: z34.string().datetime({ offset: true }).nullable().optional()
|
|
1863
|
+
})
|
|
1864
|
+
);
|
|
1865
|
+
var outputSchema33 = z34.object({ items: itemSchema8 });
|
|
1866
|
+
var definition34 = defineTool34({
|
|
1867
|
+
name: "listBoards",
|
|
1868
|
+
title: "List Boards",
|
|
1869
|
+
description: "List boards the authenticated member can access.",
|
|
1870
|
+
inputSchema: inputSchema34,
|
|
1871
|
+
outputSchema: outputSchema33,
|
|
1872
|
+
annotations: {
|
|
1873
|
+
readOnlyHint: true,
|
|
1874
|
+
destructiveHint: false,
|
|
1875
|
+
idempotentHint: true,
|
|
1876
|
+
openWorldHint: true
|
|
1877
|
+
},
|
|
1878
|
+
connection: "trello",
|
|
1879
|
+
run: async (input, ctx) => {
|
|
1880
|
+
const url = new URL(`https://api.trello.com/1/members/me/boards`);
|
|
1881
|
+
if (input.filter !== void 0) {
|
|
1882
|
+
url.searchParams.set("filter", String(input.filter));
|
|
1883
|
+
}
|
|
1884
|
+
const res = await ctx.fetch(url.toString(), {
|
|
1885
|
+
method: "GET"
|
|
1886
|
+
});
|
|
1887
|
+
if (!res.ok) {
|
|
1888
|
+
const errBody = await res.text();
|
|
1889
|
+
throw new Error(`Trello listBoards ${res.status}: ${errBody}`);
|
|
1890
|
+
}
|
|
1891
|
+
const data = await res.json();
|
|
1892
|
+
return { items: data };
|
|
1893
|
+
}
|
|
1894
|
+
});
|
|
1895
|
+
var listBoards_default = definition34;
|
|
1896
|
+
await handleIfScriptMain34(import.meta, definition34, { connectionResolvers });
|
|
1897
|
+
|
|
1898
|
+
// scripts/listCardAttachments.ts
|
|
1899
|
+
import { defineTool as defineTool35, handleIfScriptMain as handleIfScriptMain35 } from "@zapier/connectors-sdk";
|
|
1900
|
+
import { z as z35 } from "zod";
|
|
1901
|
+
var inputSchema35 = z35.object({ id: z35.string().describe("24-char hex card id.") }).strict();
|
|
1902
|
+
var itemSchema9 = z35.array(
|
|
1903
|
+
z35.object({
|
|
1904
|
+
id: z35.string().regex(new RegExp("^[0-9a-fA-F]{24}$")).describe("Trello object id (24 hex chars)."),
|
|
1905
|
+
name: z35.string(),
|
|
1906
|
+
url: z35.string().nullable().optional(),
|
|
1907
|
+
mimeType: z35.string().nullable().optional(),
|
|
1908
|
+
bytes: z35.union([z35.number().int(), z35.null()]).optional(),
|
|
1909
|
+
isUpload: z35.boolean().nullable().optional()
|
|
1910
|
+
})
|
|
1911
|
+
);
|
|
1912
|
+
var outputSchema34 = z35.object({ items: itemSchema9 });
|
|
1913
|
+
var definition35 = defineTool35({
|
|
1914
|
+
name: "listCardAttachments",
|
|
1915
|
+
title: "List Card Attachments",
|
|
1916
|
+
description: "List attachments on a card (metadata only; use download URLs from response).",
|
|
1917
|
+
inputSchema: inputSchema35,
|
|
1918
|
+
outputSchema: outputSchema34,
|
|
1919
|
+
annotations: {
|
|
1920
|
+
readOnlyHint: true,
|
|
1921
|
+
destructiveHint: false,
|
|
1922
|
+
idempotentHint: true,
|
|
1923
|
+
openWorldHint: true
|
|
1924
|
+
},
|
|
1925
|
+
connection: "trello",
|
|
1926
|
+
run: async (input, ctx) => {
|
|
1927
|
+
const url = `https://api.trello.com/1/cards/${encodeURIComponent(input.id)}/attachments`;
|
|
1928
|
+
const res = await ctx.fetch(url, {
|
|
1929
|
+
method: "GET"
|
|
1930
|
+
});
|
|
1931
|
+
if (!res.ok) {
|
|
1932
|
+
const errBody = await res.text();
|
|
1933
|
+
throw new Error(`Trello listCardAttachments ${res.status}: ${errBody}`);
|
|
1934
|
+
}
|
|
1935
|
+
const data = await res.json();
|
|
1936
|
+
return { items: data };
|
|
1937
|
+
}
|
|
1938
|
+
});
|
|
1939
|
+
var listCardAttachments_default = definition35;
|
|
1940
|
+
await handleIfScriptMain35(import.meta, definition35, { connectionResolvers });
|
|
1941
|
+
|
|
1942
|
+
// scripts/listCards.ts
|
|
1943
|
+
import { defineTool as defineTool36, handleIfScriptMain as handleIfScriptMain36 } from "@zapier/connectors-sdk";
|
|
1944
|
+
import { z as z36 } from "zod";
|
|
1945
|
+
var inputSchema36 = z36.object({
|
|
1946
|
+
id: z36.string().describe("24-char hex board id."),
|
|
1947
|
+
filter: z36.enum(["all", "closed", "none", "open", "visible"]).default("open"),
|
|
1948
|
+
before: z36.string().describe("Return cards older than this card id (cursor for next page).").optional(),
|
|
1949
|
+
limit: z36.number().int().gte(1).lte(1e3).describe(
|
|
1950
|
+
"Defaults to 20 when omitted; pass a value when you need a specific number of results."
|
|
1951
|
+
).optional()
|
|
1952
|
+
}).strict();
|
|
1953
|
+
var outputSchema35 = z36.object({
|
|
1954
|
+
items: z36.array(
|
|
1955
|
+
z36.object({
|
|
1956
|
+
id: z36.string().regex(new RegExp("^[0-9a-fA-F]{24}$")).describe("Trello object id (24 hex chars)."),
|
|
1957
|
+
name: z36.string(),
|
|
1958
|
+
desc: z36.string().nullable().optional(),
|
|
1959
|
+
closed: z36.boolean().nullable().optional(),
|
|
1960
|
+
idBoard: z36.string(),
|
|
1961
|
+
idList: z36.string(),
|
|
1962
|
+
idShort: z36.number().int().nullable().optional(),
|
|
1963
|
+
shortLink: z36.string().nullable().optional(),
|
|
1964
|
+
shortUrl: z36.string().nullable().optional(),
|
|
1965
|
+
url: z36.string().nullable().optional(),
|
|
1966
|
+
due: z36.union([z36.string().datetime({ offset: true }), z36.null()]).optional(),
|
|
1967
|
+
dueComplete: z36.boolean().nullable().optional(),
|
|
1968
|
+
dateLastActivity: z36.string().datetime({ offset: true }).nullable().optional(),
|
|
1969
|
+
idLabels: z36.any().nullable().describe("Nested object \u2014 shape passes through.").optional(),
|
|
1970
|
+
idMembers: z36.any().nullable().describe("Nested object \u2014 shape passes through.").optional(),
|
|
1971
|
+
labels: z36.any().nullable().describe("Nested object \u2014 shape passes through.").optional(),
|
|
1972
|
+
pos: z36.number().nullable().optional(),
|
|
1973
|
+
customFields: z36.any().nullable().describe("Nested object \u2014 shape passes through.").optional()
|
|
1974
|
+
})
|
|
1975
|
+
).nullable().optional(),
|
|
1976
|
+
has_more: z36.boolean().nullable().describe(
|
|
1977
|
+
"True when the page is full and before-cursor paging may return more."
|
|
1978
|
+
).optional()
|
|
1979
|
+
});
|
|
1980
|
+
var definition36 = defineTool36({
|
|
1981
|
+
name: "listCards",
|
|
1982
|
+
title: "List Cards",
|
|
1983
|
+
description: "List cards on a board with optional filter and before-cursor pagination.",
|
|
1984
|
+
inputSchema: inputSchema36,
|
|
1985
|
+
outputSchema: outputSchema35,
|
|
1986
|
+
annotations: {
|
|
1987
|
+
readOnlyHint: true,
|
|
1988
|
+
destructiveHint: false,
|
|
1989
|
+
idempotentHint: true,
|
|
1990
|
+
openWorldHint: true
|
|
1991
|
+
},
|
|
1992
|
+
connection: "trello",
|
|
1993
|
+
run: async (input, ctx) => {
|
|
1994
|
+
const url = new URL(
|
|
1995
|
+
`https://api.trello.com/1/boards/${encodeURIComponent(input.id)}/cards`
|
|
1996
|
+
);
|
|
1997
|
+
if (input.filter !== void 0) {
|
|
1998
|
+
url.searchParams.set("filter", String(input.filter));
|
|
1999
|
+
}
|
|
2000
|
+
if (input.before !== void 0) {
|
|
2001
|
+
url.searchParams.set("before", String(input.before));
|
|
2002
|
+
}
|
|
2003
|
+
url.searchParams.set("limit", String(input.limit ?? 20));
|
|
2004
|
+
const res = await ctx.fetch(url.toString(), {
|
|
2005
|
+
method: "GET"
|
|
2006
|
+
});
|
|
2007
|
+
if (!res.ok) {
|
|
2008
|
+
const errBody = await res.text();
|
|
2009
|
+
throw new Error(`Trello listCards ${res.status}: ${errBody}`);
|
|
2010
|
+
}
|
|
2011
|
+
const limit = input.limit ?? 20;
|
|
2012
|
+
const cards = await res.json();
|
|
2013
|
+
const items = Array.isArray(cards) ? cards : [];
|
|
2014
|
+
return { items, has_more: items.length >= limit };
|
|
2015
|
+
}
|
|
2016
|
+
});
|
|
2017
|
+
var listCards_default = definition36;
|
|
2018
|
+
await handleIfScriptMain36(import.meta, definition36, { connectionResolvers });
|
|
2019
|
+
|
|
2020
|
+
// scripts/listCustomFields.ts
|
|
2021
|
+
import { defineTool as defineTool37, handleIfScriptMain as handleIfScriptMain37 } from "@zapier/connectors-sdk";
|
|
2022
|
+
import { z as z37 } from "zod";
|
|
2023
|
+
var inputSchema37 = z37.object({ id: z37.string().describe("24-char hex board id.") }).strict();
|
|
2024
|
+
var itemSchema10 = z37.array(
|
|
2025
|
+
z37.object({
|
|
2026
|
+
id: z37.string().regex(new RegExp("^[0-9a-fA-F]{24}$")).describe("Trello object id (24 hex chars)."),
|
|
2027
|
+
name: z37.string(),
|
|
2028
|
+
type: z37.enum(["checkbox", "date", "list", "number", "text"]),
|
|
2029
|
+
options: z37.array(
|
|
2030
|
+
z37.object({
|
|
2031
|
+
id: z37.string(),
|
|
2032
|
+
value: z37.object({ text: z37.string().optional() }).optional(),
|
|
2033
|
+
color: z37.string().optional()
|
|
2034
|
+
})
|
|
2035
|
+
).nullable().optional()
|
|
2036
|
+
})
|
|
2037
|
+
);
|
|
2038
|
+
var outputSchema36 = z37.object({ items: itemSchema10 });
|
|
2039
|
+
var definition37 = defineTool37({
|
|
2040
|
+
name: "listCustomFields",
|
|
2041
|
+
title: "List Custom Fields",
|
|
2042
|
+
description: "List custom field definitions on a board. Use before setting custom field values on cards.",
|
|
2043
|
+
inputSchema: inputSchema37,
|
|
2044
|
+
outputSchema: outputSchema36,
|
|
2045
|
+
annotations: {
|
|
2046
|
+
readOnlyHint: true,
|
|
2047
|
+
destructiveHint: false,
|
|
2048
|
+
idempotentHint: true,
|
|
2049
|
+
openWorldHint: true
|
|
2050
|
+
},
|
|
2051
|
+
connection: "trello",
|
|
2052
|
+
run: async (input, ctx) => {
|
|
2053
|
+
const url = `https://api.trello.com/1/boards/${encodeURIComponent(input.id)}/customFields`;
|
|
2054
|
+
const res = await ctx.fetch(url, {
|
|
2055
|
+
method: "GET"
|
|
2056
|
+
});
|
|
2057
|
+
if (!res.ok) {
|
|
2058
|
+
const errBody = await res.text();
|
|
2059
|
+
throw new Error(`Trello listCustomFields ${res.status}: ${errBody}`);
|
|
2060
|
+
}
|
|
2061
|
+
const data = await res.json();
|
|
2062
|
+
return { items: data };
|
|
2063
|
+
}
|
|
2064
|
+
});
|
|
2065
|
+
var listCustomFields_default = definition37;
|
|
2066
|
+
await handleIfScriptMain37(import.meta, definition37, { connectionResolvers });
|
|
2067
|
+
|
|
2068
|
+
// scripts/listLabels.ts
|
|
2069
|
+
import { defineTool as defineTool38, handleIfScriptMain as handleIfScriptMain38 } from "@zapier/connectors-sdk";
|
|
2070
|
+
import { z as z38 } from "zod";
|
|
2071
|
+
var inputSchema38 = z38.object({ id: z38.string().describe("24-char hex board id.") }).strict();
|
|
2072
|
+
var itemSchema11 = z38.array(
|
|
2073
|
+
z38.object({
|
|
2074
|
+
id: z38.string().regex(new RegExp("^[0-9a-fA-F]{24}$")).describe("Trello object id (24 hex chars)."),
|
|
2075
|
+
idBoard: z38.string(),
|
|
2076
|
+
name: z38.string().nullable().optional(),
|
|
2077
|
+
color: z38.string().nullable().optional()
|
|
2078
|
+
})
|
|
2079
|
+
);
|
|
2080
|
+
var outputSchema37 = z38.object({ items: itemSchema11 });
|
|
2081
|
+
var definition38 = defineTool38({
|
|
2082
|
+
name: "listLabels",
|
|
2083
|
+
title: "List Labels",
|
|
2084
|
+
description: "List labels defined on a board.",
|
|
2085
|
+
inputSchema: inputSchema38,
|
|
2086
|
+
outputSchema: outputSchema37,
|
|
2087
|
+
annotations: {
|
|
2088
|
+
readOnlyHint: true,
|
|
2089
|
+
destructiveHint: false,
|
|
2090
|
+
idempotentHint: true,
|
|
2091
|
+
openWorldHint: true
|
|
2092
|
+
},
|
|
2093
|
+
connection: "trello",
|
|
2094
|
+
run: async (input, ctx) => {
|
|
2095
|
+
const url = `https://api.trello.com/1/boards/${encodeURIComponent(input.id)}/labels`;
|
|
2096
|
+
const res = await ctx.fetch(url, {
|
|
2097
|
+
method: "GET"
|
|
2098
|
+
});
|
|
2099
|
+
if (!res.ok) {
|
|
2100
|
+
const errBody = await res.text();
|
|
2101
|
+
throw new Error(`Trello listLabels ${res.status}: ${errBody}`);
|
|
2102
|
+
}
|
|
2103
|
+
const data = await res.json();
|
|
2104
|
+
return { items: data };
|
|
2105
|
+
}
|
|
2106
|
+
});
|
|
2107
|
+
var listLabels_default = definition38;
|
|
2108
|
+
await handleIfScriptMain38(import.meta, definition38, { connectionResolvers });
|
|
2109
|
+
|
|
2110
|
+
// scripts/listLists.ts
|
|
2111
|
+
import { defineTool as defineTool39, handleIfScriptMain as handleIfScriptMain39 } from "@zapier/connectors-sdk";
|
|
2112
|
+
import { z as z39 } from "zod";
|
|
2113
|
+
var inputSchema39 = z39.object({
|
|
2114
|
+
id: z39.string().describe("24-char hex board id."),
|
|
2115
|
+
filter: z39.enum(["all", "closed", "none", "open"]).default("open")
|
|
2116
|
+
}).strict();
|
|
2117
|
+
var itemSchema12 = z39.array(
|
|
2118
|
+
z39.object({
|
|
2119
|
+
id: z39.string().regex(new RegExp("^[0-9a-fA-F]{24}$")).describe("Trello object id (24 hex chars)."),
|
|
2120
|
+
name: z39.string(),
|
|
2121
|
+
closed: z39.boolean().nullable().optional(),
|
|
2122
|
+
idBoard: z39.string(),
|
|
2123
|
+
pos: z39.number().nullable().optional()
|
|
2124
|
+
})
|
|
2125
|
+
);
|
|
2126
|
+
var outputSchema38 = z39.object({ items: itemSchema12 });
|
|
2127
|
+
var definition39 = defineTool39({
|
|
2128
|
+
name: "listLists",
|
|
2129
|
+
title: "List Lists",
|
|
2130
|
+
description: "List all lists on a board. Use findList to match by name.",
|
|
2131
|
+
inputSchema: inputSchema39,
|
|
2132
|
+
outputSchema: outputSchema38,
|
|
2133
|
+
annotations: {
|
|
2134
|
+
readOnlyHint: true,
|
|
2135
|
+
destructiveHint: false,
|
|
2136
|
+
idempotentHint: true,
|
|
2137
|
+
openWorldHint: true
|
|
2138
|
+
},
|
|
2139
|
+
connection: "trello",
|
|
2140
|
+
run: async (input, ctx) => {
|
|
2141
|
+
const url = new URL(
|
|
2142
|
+
`https://api.trello.com/1/boards/${encodeURIComponent(input.id)}/lists`
|
|
2143
|
+
);
|
|
2144
|
+
if (input.filter !== void 0) {
|
|
2145
|
+
url.searchParams.set("filter", String(input.filter));
|
|
2146
|
+
}
|
|
2147
|
+
const res = await ctx.fetch(url.toString(), {
|
|
2148
|
+
method: "GET"
|
|
2149
|
+
});
|
|
2150
|
+
if (!res.ok) {
|
|
2151
|
+
const errBody = await res.text();
|
|
2152
|
+
throw new Error(`Trello listLists ${res.status}: ${errBody}`);
|
|
2153
|
+
}
|
|
2154
|
+
const data = await res.json();
|
|
2155
|
+
return { items: data };
|
|
2156
|
+
}
|
|
2157
|
+
});
|
|
2158
|
+
var listLists_default = definition39;
|
|
2159
|
+
await handleIfScriptMain39(import.meta, definition39, { connectionResolvers });
|
|
2160
|
+
|
|
2161
|
+
// scripts/listOrganizations.ts
|
|
2162
|
+
import { defineTool as defineTool40, handleIfScriptMain as handleIfScriptMain40 } from "@zapier/connectors-sdk";
|
|
2163
|
+
import { z as z40 } from "zod";
|
|
2164
|
+
var inputSchema40 = z40.object({}).strict();
|
|
2165
|
+
var itemSchema13 = z40.array(
|
|
2166
|
+
z40.object({
|
|
2167
|
+
id: z40.string().regex(new RegExp("^[0-9a-fA-F]{24}$")).describe("Trello object id (24 hex chars)."),
|
|
2168
|
+
name: z40.string(),
|
|
2169
|
+
displayName: z40.string(),
|
|
2170
|
+
url: z40.string().nullable().optional()
|
|
2171
|
+
})
|
|
2172
|
+
);
|
|
2173
|
+
var outputSchema39 = z40.object({ items: itemSchema13 });
|
|
2174
|
+
var definition40 = defineTool40({
|
|
2175
|
+
name: "listOrganizations",
|
|
2176
|
+
title: "List Organizations",
|
|
2177
|
+
description: "List workspaces the authenticated member belongs to.",
|
|
2178
|
+
inputSchema: inputSchema40,
|
|
2179
|
+
outputSchema: outputSchema39,
|
|
2180
|
+
annotations: {
|
|
2181
|
+
readOnlyHint: true,
|
|
2182
|
+
destructiveHint: false,
|
|
2183
|
+
idempotentHint: true,
|
|
2184
|
+
openWorldHint: true
|
|
2185
|
+
},
|
|
2186
|
+
connection: "trello",
|
|
2187
|
+
run: async (_input, ctx) => {
|
|
2188
|
+
const url = `https://api.trello.com/1/members/me/organizations`;
|
|
2189
|
+
const res = await ctx.fetch(url, {
|
|
2190
|
+
method: "GET"
|
|
2191
|
+
});
|
|
2192
|
+
if (!res.ok) {
|
|
2193
|
+
const errBody = await res.text();
|
|
2194
|
+
throw new Error(`Trello listOrganizations ${res.status}: ${errBody}`);
|
|
2195
|
+
}
|
|
2196
|
+
const data = await res.json();
|
|
2197
|
+
return { items: data };
|
|
2198
|
+
}
|
|
2199
|
+
});
|
|
2200
|
+
var listOrganizations_default = definition40;
|
|
2201
|
+
await handleIfScriptMain40(import.meta, definition40, { connectionResolvers });
|
|
2202
|
+
|
|
2203
|
+
// scripts/moveCard.ts
|
|
2204
|
+
import { defineTool as defineTool41, handleIfScriptMain as handleIfScriptMain41 } from "@zapier/connectors-sdk";
|
|
2205
|
+
import { z as z41 } from "zod";
|
|
2206
|
+
var inputSchema41 = z41.object({
|
|
2207
|
+
id: z41.string().describe("24-char hex card id to move."),
|
|
2208
|
+
idList: z41.string().describe("Destination list id. Resolve via listLists or findList."),
|
|
2209
|
+
idBoard: z41.string().describe("Destination board id when moving across boards.").optional()
|
|
2210
|
+
}).strict();
|
|
2211
|
+
var outputSchema40 = z41.object({
|
|
2212
|
+
id: z41.string().regex(TRELLO_ID_REGEX),
|
|
2213
|
+
name: z41.string(),
|
|
2214
|
+
closed: z41.boolean().nullable().optional(),
|
|
2215
|
+
idBoard: z41.string(),
|
|
2216
|
+
idList: z41.string(),
|
|
2217
|
+
url: z41.string(),
|
|
2218
|
+
shortUrl: z41.string().nullable().optional()
|
|
2219
|
+
});
|
|
2220
|
+
var definition41 = defineTool41({
|
|
2221
|
+
name: "moveCard",
|
|
2222
|
+
title: "Move Card",
|
|
2223
|
+
description: "Move a card to another list (and optionally another board). Resolve list ids via listLists or findList before calling.",
|
|
2224
|
+
inputSchema: inputSchema41,
|
|
2225
|
+
outputSchema: outputSchema40,
|
|
2226
|
+
annotations: {
|
|
2227
|
+
readOnlyHint: false,
|
|
2228
|
+
destructiveHint: false,
|
|
2229
|
+
idempotentHint: true,
|
|
2230
|
+
openWorldHint: true
|
|
2231
|
+
},
|
|
2232
|
+
connection: "trello",
|
|
2233
|
+
run: async (input, ctx) => {
|
|
2234
|
+
const url = `${TRELLO_BASE}/cards/${encodeURIComponent(input.id)}`;
|
|
2235
|
+
const body = { idList: input.idList };
|
|
2236
|
+
if (input.idBoard !== void 0) body.idBoard = input.idBoard;
|
|
2237
|
+
const res = await ctx.fetch(url, {
|
|
2238
|
+
method: "PUT",
|
|
2239
|
+
headers: trelloFormHeaders,
|
|
2240
|
+
body: trelloFormBody(body)
|
|
2241
|
+
});
|
|
2242
|
+
if (!res.ok) await trelloError("moveCard", res);
|
|
2243
|
+
return res.json();
|
|
2244
|
+
}
|
|
2245
|
+
});
|
|
2246
|
+
var moveCard_default = definition41;
|
|
2247
|
+
await handleIfScriptMain41(import.meta, definition41, { connectionResolvers });
|
|
2248
|
+
|
|
2249
|
+
// scripts/removeCardLabel.ts
|
|
2250
|
+
import { defineTool as defineTool42, handleIfScriptMain as handleIfScriptMain42 } from "@zapier/connectors-sdk";
|
|
2251
|
+
import { z as z42 } from "zod";
|
|
2252
|
+
var inputSchema42 = z42.object({
|
|
2253
|
+
id: z42.string().describe("24-char hex card id."),
|
|
2254
|
+
idLabel: z42.string()
|
|
2255
|
+
}).strict();
|
|
2256
|
+
var outputSchema41 = z42.object({ status: z42.number() });
|
|
2257
|
+
var definition42 = defineTool42({
|
|
2258
|
+
name: "removeCardLabel",
|
|
2259
|
+
title: "Remove Card Label",
|
|
2260
|
+
description: "Remove a label from a card.",
|
|
2261
|
+
inputSchema: inputSchema42,
|
|
2262
|
+
outputSchema: outputSchema41,
|
|
2263
|
+
annotations: {
|
|
2264
|
+
readOnlyHint: false,
|
|
2265
|
+
destructiveHint: true,
|
|
2266
|
+
idempotentHint: true,
|
|
2267
|
+
openWorldHint: true
|
|
2268
|
+
},
|
|
2269
|
+
connection: "trello",
|
|
2270
|
+
run: async (input, ctx) => {
|
|
2271
|
+
const url = `https://api.trello.com/1/cards/${encodeURIComponent(input.id)}/idLabels/${encodeURIComponent(input.idLabel)}`;
|
|
2272
|
+
const res = await ctx.fetch(url, {
|
|
2273
|
+
method: "DELETE"
|
|
2274
|
+
});
|
|
2275
|
+
if (!res.ok) {
|
|
2276
|
+
const errBody = await res.text();
|
|
2277
|
+
throw new Error(`Trello removeCardLabel ${res.status}: ${errBody}`);
|
|
2278
|
+
}
|
|
2279
|
+
return { status: res.status };
|
|
2280
|
+
}
|
|
2281
|
+
});
|
|
2282
|
+
var removeCardLabel_default = definition42;
|
|
2283
|
+
await handleIfScriptMain42(import.meta, definition42, { connectionResolvers });
|
|
2284
|
+
|
|
2285
|
+
// scripts/searchCards.ts
|
|
2286
|
+
import { defineTool as defineTool43, handleIfScriptMain as handleIfScriptMain43 } from "@zapier/connectors-sdk";
|
|
2287
|
+
import { z as z43 } from "zod";
|
|
2288
|
+
function buildSearchQuery(input) {
|
|
2289
|
+
if (input.query !== void 0) return input.query;
|
|
2290
|
+
const parts = [];
|
|
2291
|
+
if (input.keyword !== void 0) parts.push(input.keyword);
|
|
2292
|
+
if (input.listName !== void 0) parts.push(`list:${input.listName}`);
|
|
2293
|
+
if (input.member !== void 0) {
|
|
2294
|
+
parts.push(
|
|
2295
|
+
input.member.startsWith("@") ? input.member : `@${input.member}`
|
|
2296
|
+
);
|
|
2297
|
+
}
|
|
2298
|
+
if (input.label !== void 0) parts.push(`label:${input.label}`);
|
|
2299
|
+
if (input.dueFilter !== void 0) parts.push(`due:${input.dueFilter}`);
|
|
2300
|
+
if (parts.length === 0) {
|
|
2301
|
+
throw new Error("Trello searchCards: provide query or keyword.");
|
|
2302
|
+
}
|
|
2303
|
+
return parts.join(" ");
|
|
2304
|
+
}
|
|
2305
|
+
var inputSchema43 = z43.object({
|
|
2306
|
+
query: z43.string().describe(
|
|
2307
|
+
"Raw Trello query string (e.g. board:MyBoard @me due:week). Mutually exclusive with keyword-based structured search."
|
|
2308
|
+
).optional(),
|
|
2309
|
+
keyword: z43.string().describe("Search card name/description when not using raw query.").optional(),
|
|
2310
|
+
boardId: z43.string().describe("Limit to this board id.").optional(),
|
|
2311
|
+
listName: z43.string().optional(),
|
|
2312
|
+
member: z43.string().describe("Member filter; use @me for current user.").optional(),
|
|
2313
|
+
label: z43.string().optional(),
|
|
2314
|
+
dueFilter: z43.enum(["day", "week", "month", "overdue", "complete", "incomplete"]).optional(),
|
|
2315
|
+
organizationId: z43.string().optional(),
|
|
2316
|
+
cardsLimit: z43.number().int().gte(1).lte(1e3).describe(
|
|
2317
|
+
"Defaults to 20 when omitted; pass a value when you need a specific number of results."
|
|
2318
|
+
).optional(),
|
|
2319
|
+
partial: z43.boolean().default(true)
|
|
2320
|
+
}).strict();
|
|
2321
|
+
var outputSchema42 = z43.object({
|
|
2322
|
+
items: z43.array(
|
|
2323
|
+
z43.object({
|
|
2324
|
+
id: z43.string().regex(new RegExp("^[0-9a-fA-F]{24}$")).describe("Trello object id (24 hex chars)."),
|
|
2325
|
+
name: z43.string(),
|
|
2326
|
+
desc: z43.string().nullable().optional(),
|
|
2327
|
+
closed: z43.boolean().nullable().optional(),
|
|
2328
|
+
idBoard: z43.string(),
|
|
2329
|
+
idList: z43.string(),
|
|
2330
|
+
idShort: z43.number().int().nullable().optional(),
|
|
2331
|
+
shortLink: z43.string().nullable().optional(),
|
|
2332
|
+
shortUrl: z43.string().nullable().optional(),
|
|
2333
|
+
url: z43.string().nullable().optional(),
|
|
2334
|
+
due: z43.union([z43.string().datetime({ offset: true }), z43.null()]).optional(),
|
|
2335
|
+
dueComplete: z43.boolean().nullable().optional(),
|
|
2336
|
+
dateLastActivity: z43.string().datetime({ offset: true }).nullable().optional(),
|
|
2337
|
+
idLabels: z43.array(z43.string()).nullable().optional(),
|
|
2338
|
+
idMembers: z43.array(z43.string()).nullable().optional(),
|
|
2339
|
+
labels: z43.array(
|
|
2340
|
+
z43.object({
|
|
2341
|
+
id: z43.string(),
|
|
2342
|
+
name: z43.string().nullable().optional(),
|
|
2343
|
+
color: z43.string().nullable().optional()
|
|
2344
|
+
})
|
|
2345
|
+
).nullable().optional(),
|
|
2346
|
+
pos: z43.number().nullable().optional(),
|
|
2347
|
+
customFields: z43.record(z43.string(), z43.json()).nullable().optional()
|
|
2348
|
+
})
|
|
2349
|
+
).nullable().optional(),
|
|
2350
|
+
has_more: z43.boolean().nullable().optional()
|
|
2351
|
+
});
|
|
2352
|
+
var definition43 = defineTool43({
|
|
2353
|
+
name: "searchCards",
|
|
2354
|
+
title: "Search Cards",
|
|
2355
|
+
description: "Search for cards using Trello query DSL or structured filters.",
|
|
2356
|
+
inputSchema: inputSchema43,
|
|
2357
|
+
outputSchema: outputSchema42,
|
|
2358
|
+
annotations: {
|
|
2359
|
+
readOnlyHint: true,
|
|
2360
|
+
destructiveHint: false,
|
|
2361
|
+
idempotentHint: true,
|
|
2362
|
+
openWorldHint: true
|
|
2363
|
+
},
|
|
2364
|
+
connection: "trello",
|
|
2365
|
+
run: async (input, ctx) => {
|
|
2366
|
+
const url = new URL(`${TRELLO_BASE}/search`);
|
|
2367
|
+
url.searchParams.set("query", buildSearchQuery(input));
|
|
2368
|
+
url.searchParams.set("modelTypes", "cards");
|
|
2369
|
+
if (input.boardId !== void 0) {
|
|
2370
|
+
url.searchParams.set("idBoards", input.boardId);
|
|
2371
|
+
}
|
|
2372
|
+
if (input.organizationId !== void 0) {
|
|
2373
|
+
url.searchParams.set("idOrganizations", input.organizationId);
|
|
2374
|
+
}
|
|
2375
|
+
const limit = input.cardsLimit ?? 20;
|
|
2376
|
+
url.searchParams.set("cards_limit", String(limit));
|
|
2377
|
+
if (input.partial !== void 0) {
|
|
2378
|
+
url.searchParams.set("partial", String(input.partial));
|
|
2379
|
+
}
|
|
2380
|
+
const res = await ctx.fetch(url.toString(), { method: "GET" });
|
|
2381
|
+
if (!res.ok) await trelloError("searchCards", res);
|
|
2382
|
+
const data = await res.json();
|
|
2383
|
+
const items = Array.isArray(data.cards) ? data.cards : [];
|
|
2384
|
+
return { items, has_more: items.length >= limit };
|
|
2385
|
+
}
|
|
2386
|
+
});
|
|
2387
|
+
var searchCards_default = definition43;
|
|
2388
|
+
await handleIfScriptMain43(import.meta, definition43, { connectionResolvers });
|
|
2389
|
+
|
|
2390
|
+
// scripts/updateCard.ts
|
|
2391
|
+
import { defineTool as defineTool44, handleIfScriptMain as handleIfScriptMain44 } from "@zapier/connectors-sdk";
|
|
2392
|
+
import { z as z44 } from "zod";
|
|
2393
|
+
var inputSchema44 = z44.object({
|
|
2394
|
+
id: z44.string().describe("24-char hex card id."),
|
|
2395
|
+
name: z44.string().optional(),
|
|
2396
|
+
desc: z44.string().describe(
|
|
2397
|
+
"Card description (Trello Markdown). Append vs overwrite controlled by descOverwrite."
|
|
2398
|
+
).optional(),
|
|
2399
|
+
descOverwrite: z44.boolean().describe("When false, append desc to existing; when true, replace.").optional(),
|
|
2400
|
+
due: z44.string().datetime({ offset: true }).describe("Due datetime (ISO 8601). Pass null string to clear.").optional(),
|
|
2401
|
+
start: z44.string().datetime({ offset: true }).describe("Start datetime. Pass null string to clear.").optional(),
|
|
2402
|
+
dueComplete: z44.boolean().optional(),
|
|
2403
|
+
closed: z44.boolean().describe("Set true to archive the card (archiveCard tool behavior).").optional(),
|
|
2404
|
+
idList: z44.string().describe("Move card to this list id (moveCard tool behavior).").optional(),
|
|
2405
|
+
idBoard: z44.string().describe("Destination board when moving across boards.").optional(),
|
|
2406
|
+
pos: z44.any().superRefine((x, ctx) => {
|
|
2407
|
+
const schemas = [z44.enum(["top", "bottom"]), z44.number()];
|
|
2408
|
+
const { errors, failed } = schemas.reduce(
|
|
2409
|
+
({ errors: errors2, failed: failed2 }, schema) => ((result) => result.error ? {
|
|
2410
|
+
errors: [...errors2, ...result.error.issues],
|
|
2411
|
+
failed: failed2 + 1
|
|
2412
|
+
} : { errors: errors2, failed: failed2 })(schema.safeParse(x)),
|
|
2413
|
+
{ errors: [], failed: 0 }
|
|
2414
|
+
);
|
|
2415
|
+
const passed = schemas.length - failed;
|
|
2416
|
+
if (passed !== 1) {
|
|
2417
|
+
ctx.addIssue(
|
|
2418
|
+
errors.length ? {
|
|
2419
|
+
path: [],
|
|
2420
|
+
code: "invalid_union",
|
|
2421
|
+
errors: [errors],
|
|
2422
|
+
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
2423
|
+
} : {
|
|
2424
|
+
path: [],
|
|
2425
|
+
code: "custom",
|
|
2426
|
+
errors: [errors],
|
|
2427
|
+
message: "Invalid input: Should pass single schema. Passed " + passed
|
|
2428
|
+
}
|
|
2429
|
+
);
|
|
2430
|
+
}
|
|
2431
|
+
}).optional(),
|
|
2432
|
+
address: z44.string().optional(),
|
|
2433
|
+
locationName: z44.string().optional(),
|
|
2434
|
+
coordinates: z44.string().describe("latitude,longitude e.g. 40.712776,-74.005974").optional()
|
|
2435
|
+
}).strict();
|
|
2436
|
+
var outputSchema43 = z44.object({
|
|
2437
|
+
id: z44.string().regex(new RegExp("^[0-9a-fA-F]{24}$")).describe("Trello object id (24 hex chars)."),
|
|
2438
|
+
name: z44.string(),
|
|
2439
|
+
desc: z44.string().nullable().optional(),
|
|
2440
|
+
closed: z44.boolean().nullable().optional(),
|
|
2441
|
+
idBoard: z44.string(),
|
|
2442
|
+
idList: z44.string(),
|
|
2443
|
+
idShort: z44.number().int().nullable().optional(),
|
|
2444
|
+
shortLink: z44.string().nullable().optional(),
|
|
2445
|
+
shortUrl: z44.string().nullable().optional(),
|
|
2446
|
+
url: z44.string().nullable().optional(),
|
|
2447
|
+
due: z44.union([z44.string().datetime({ offset: true }), z44.null()]).optional(),
|
|
2448
|
+
dueComplete: z44.boolean().nullable().optional(),
|
|
2449
|
+
dateLastActivity: z44.string().datetime({ offset: true }).nullable().optional(),
|
|
2450
|
+
idLabels: z44.array(z44.string()).nullable().optional(),
|
|
2451
|
+
idMembers: z44.array(z44.string()).nullable().optional(),
|
|
2452
|
+
labels: z44.array(
|
|
2453
|
+
z44.object({
|
|
2454
|
+
id: z44.string().regex(new RegExp("^[0-9a-fA-F]{24}$")).describe("Trello object id (24 hex chars)."),
|
|
2455
|
+
idBoard: z44.string(),
|
|
2456
|
+
name: z44.string().nullable().optional(),
|
|
2457
|
+
color: z44.string().nullable().optional()
|
|
2458
|
+
})
|
|
2459
|
+
).nullable().optional(),
|
|
2460
|
+
pos: z44.number().nullable().optional(),
|
|
2461
|
+
customFields: z44.record(z44.string(), z44.any()).nullable().describe("Custom field values keyed by field name when requested.").optional()
|
|
2462
|
+
});
|
|
2463
|
+
var definition44 = defineTool44({
|
|
2464
|
+
name: "updateCard",
|
|
2465
|
+
title: "Update Card",
|
|
2466
|
+
description: "Update card fields (name, description, due, cover, list, archive). Custom fields updated separately in run() polish.",
|
|
2467
|
+
inputSchema: inputSchema44,
|
|
2468
|
+
outputSchema: outputSchema43,
|
|
2469
|
+
annotations: {
|
|
2470
|
+
readOnlyHint: false,
|
|
2471
|
+
destructiveHint: false,
|
|
2472
|
+
idempotentHint: true,
|
|
2473
|
+
openWorldHint: true
|
|
2474
|
+
},
|
|
2475
|
+
connection: "trello",
|
|
2476
|
+
run: async (input, ctx) => {
|
|
2477
|
+
const url = `https://api.trello.com/1/cards/${encodeURIComponent(input.id)}`;
|
|
2478
|
+
const body = {};
|
|
2479
|
+
if (input.name !== void 0) body["name"] = input.name;
|
|
2480
|
+
if (input.desc !== void 0) body["desc"] = input.desc;
|
|
2481
|
+
if (input.descOverwrite !== void 0)
|
|
2482
|
+
body["descOverwrite"] = input.descOverwrite;
|
|
2483
|
+
if (input.due !== void 0) body["due"] = input.due;
|
|
2484
|
+
if (input.start !== void 0) body["start"] = input.start;
|
|
2485
|
+
if (input.dueComplete !== void 0)
|
|
2486
|
+
body["dueComplete"] = input.dueComplete;
|
|
2487
|
+
if (input.closed !== void 0) body["closed"] = input.closed;
|
|
2488
|
+
if (input.idList !== void 0) body["idList"] = input.idList;
|
|
2489
|
+
if (input.idBoard !== void 0) body["idBoard"] = input.idBoard;
|
|
2490
|
+
if (input.pos !== void 0) body["pos"] = input.pos;
|
|
2491
|
+
if (input.address !== void 0) body["address"] = input.address;
|
|
2492
|
+
if (input.locationName !== void 0)
|
|
2493
|
+
body["locationName"] = input.locationName;
|
|
2494
|
+
if (input.coordinates !== void 0)
|
|
2495
|
+
body["coordinates"] = input.coordinates;
|
|
2496
|
+
const res = await ctx.fetch(url, {
|
|
2497
|
+
method: "PUT",
|
|
2498
|
+
headers: { "Content-Type": "application/json" },
|
|
2499
|
+
body: JSON.stringify(body)
|
|
2500
|
+
});
|
|
2501
|
+
if (!res.ok) {
|
|
2502
|
+
const errBody = await res.text();
|
|
2503
|
+
throw new Error(`Trello updateCard ${res.status}: ${errBody}`);
|
|
2504
|
+
}
|
|
2505
|
+
return res.json();
|
|
2506
|
+
}
|
|
2507
|
+
});
|
|
2508
|
+
var updateCard_default = definition44;
|
|
2509
|
+
await handleIfScriptMain44(import.meta, definition44, { connectionResolvers });
|
|
2510
|
+
|
|
2511
|
+
// index.ts
|
|
2512
|
+
var connector = defineConnector({
|
|
2513
|
+
scripts: {
|
|
2514
|
+
addCardAttachment: addCardAttachment_default,
|
|
2515
|
+
addCardLabel: addCardLabel_default,
|
|
2516
|
+
addCardMember: addCardMember_default,
|
|
2517
|
+
addChecklistItem: addChecklistItem_default,
|
|
2518
|
+
addMemberToBoard: addMemberToBoard_default,
|
|
2519
|
+
archiveCard: archiveCard_default,
|
|
2520
|
+
closeBoard: closeBoard_default,
|
|
2521
|
+
completeChecklistItem: completeChecklistItem_default,
|
|
2522
|
+
copyBoard: copyBoard_default,
|
|
2523
|
+
createBoard: createBoard_default,
|
|
2524
|
+
createCard: createCard_default,
|
|
2525
|
+
createChecklist: createChecklist_default,
|
|
2526
|
+
createComment: createComment_default,
|
|
2527
|
+
createLabel: createLabel_default,
|
|
2528
|
+
createList: createList_default,
|
|
2529
|
+
deleteChecklist: deleteChecklist_default,
|
|
2530
|
+
findBoard: findBoard_default,
|
|
2531
|
+
findChecklist: findChecklist_default,
|
|
2532
|
+
findChecklistItem: findChecklistItem_default,
|
|
2533
|
+
findLabel: findLabel_default,
|
|
2534
|
+
findList: findList_default,
|
|
2535
|
+
findOrganizationMember: findOrganizationMember_default,
|
|
2536
|
+
getAction: getAction_default,
|
|
2537
|
+
getBoard: getBoard_default,
|
|
2538
|
+
getCard: getCard_default,
|
|
2539
|
+
getChecklist: getChecklist_default,
|
|
2540
|
+
getChecklistItem: getChecklistItem_default,
|
|
2541
|
+
getCurrentMember: getCurrentMember_default,
|
|
2542
|
+
getLabel: getLabel_default,
|
|
2543
|
+
getList: getList_default,
|
|
2544
|
+
getMember: getMember_default,
|
|
2545
|
+
getOrganization: getOrganization_default,
|
|
2546
|
+
listBoardMembers: listBoardMembers_default,
|
|
2547
|
+
listBoards: listBoards_default,
|
|
2548
|
+
listCardAttachments: listCardAttachments_default,
|
|
2549
|
+
listCards: listCards_default,
|
|
2550
|
+
listCustomFields: listCustomFields_default,
|
|
2551
|
+
listLabels: listLabels_default,
|
|
2552
|
+
listLists: listLists_default,
|
|
2553
|
+
listOrganizations: listOrganizations_default,
|
|
2554
|
+
moveCard: moveCard_default,
|
|
2555
|
+
removeCardLabel: removeCardLabel_default,
|
|
2556
|
+
searchCards: searchCards_default,
|
|
2557
|
+
updateCard: updateCard_default
|
|
2558
|
+
},
|
|
2559
|
+
connectionResolvers
|
|
2560
|
+
});
|
|
2561
|
+
var index_default = connector;
|
|
2562
|
+
var {
|
|
2563
|
+
addCardAttachment,
|
|
2564
|
+
addCardLabel,
|
|
2565
|
+
addCardMember,
|
|
2566
|
+
addChecklistItem,
|
|
2567
|
+
addMemberToBoard,
|
|
2568
|
+
archiveCard,
|
|
2569
|
+
closeBoard,
|
|
2570
|
+
completeChecklistItem,
|
|
2571
|
+
copyBoard,
|
|
2572
|
+
createBoard,
|
|
2573
|
+
createCard,
|
|
2574
|
+
createChecklist,
|
|
2575
|
+
createComment,
|
|
2576
|
+
createLabel,
|
|
2577
|
+
createList,
|
|
2578
|
+
deleteChecklist,
|
|
2579
|
+
findBoard,
|
|
2580
|
+
findChecklist,
|
|
2581
|
+
findChecklistItem,
|
|
2582
|
+
findLabel,
|
|
2583
|
+
findList,
|
|
2584
|
+
findOrganizationMember,
|
|
2585
|
+
getAction,
|
|
2586
|
+
getBoard,
|
|
2587
|
+
getCard,
|
|
2588
|
+
getChecklist,
|
|
2589
|
+
getChecklistItem,
|
|
2590
|
+
getCurrentMember,
|
|
2591
|
+
getLabel,
|
|
2592
|
+
getList,
|
|
2593
|
+
getMember,
|
|
2594
|
+
getOrganization,
|
|
2595
|
+
listBoardMembers,
|
|
2596
|
+
listBoards,
|
|
2597
|
+
listCardAttachments,
|
|
2598
|
+
listCards,
|
|
2599
|
+
listCustomFields,
|
|
2600
|
+
listLabels,
|
|
2601
|
+
listLists,
|
|
2602
|
+
listOrganizations,
|
|
2603
|
+
moveCard,
|
|
2604
|
+
removeCardLabel,
|
|
2605
|
+
searchCards,
|
|
2606
|
+
updateCard
|
|
2607
|
+
} = toFunctions(connector);
|
|
2608
|
+
export {
|
|
2609
|
+
addCardAttachment,
|
|
2610
|
+
addCardLabel,
|
|
2611
|
+
addCardMember,
|
|
2612
|
+
addChecklistItem,
|
|
2613
|
+
addMemberToBoard,
|
|
2614
|
+
archiveCard,
|
|
2615
|
+
closeBoard,
|
|
2616
|
+
completeChecklistItem,
|
|
2617
|
+
copyBoard,
|
|
2618
|
+
createBoard,
|
|
2619
|
+
createCard,
|
|
2620
|
+
createChecklist,
|
|
2621
|
+
createComment,
|
|
2622
|
+
createLabel,
|
|
2623
|
+
createList,
|
|
2624
|
+
index_default as default,
|
|
2625
|
+
deleteChecklist,
|
|
2626
|
+
findBoard,
|
|
2627
|
+
findChecklist,
|
|
2628
|
+
findChecklistItem,
|
|
2629
|
+
findLabel,
|
|
2630
|
+
findList,
|
|
2631
|
+
findOrganizationMember,
|
|
2632
|
+
getAction,
|
|
2633
|
+
getBoard,
|
|
2634
|
+
getCard,
|
|
2635
|
+
getChecklist,
|
|
2636
|
+
getChecklistItem,
|
|
2637
|
+
getCurrentMember,
|
|
2638
|
+
getLabel,
|
|
2639
|
+
getList,
|
|
2640
|
+
getMember,
|
|
2641
|
+
getOrganization,
|
|
2642
|
+
listBoardMembers,
|
|
2643
|
+
listBoards,
|
|
2644
|
+
listCardAttachments,
|
|
2645
|
+
listCards,
|
|
2646
|
+
listCustomFields,
|
|
2647
|
+
listLabels,
|
|
2648
|
+
listLists,
|
|
2649
|
+
listOrganizations,
|
|
2650
|
+
moveCard,
|
|
2651
|
+
removeCardLabel,
|
|
2652
|
+
searchCards,
|
|
2653
|
+
updateCard
|
|
2654
|
+
};
|