@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
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Authored by the implementation agent: thin intent wrapper over PUT /cards/{id} (idList/idBoard).
|
|
3
|
+
import { defineTool, handleIfScriptMain } from "@zapier/connectors-sdk";
|
|
4
|
+
import { z } from "zod";
|
|
5
|
+
|
|
6
|
+
import { connectionResolvers } from "../connections.ts";
|
|
7
|
+
import {
|
|
8
|
+
TRELLO_BASE,
|
|
9
|
+
TRELLO_ID_REGEX,
|
|
10
|
+
trelloError,
|
|
11
|
+
trelloFormBody,
|
|
12
|
+
trelloFormHeaders,
|
|
13
|
+
} from "../lib/trello.ts";
|
|
14
|
+
|
|
15
|
+
const inputSchema = z
|
|
16
|
+
.object({
|
|
17
|
+
id: z.string().describe("24-char hex card id to move."),
|
|
18
|
+
idList: z
|
|
19
|
+
.string()
|
|
20
|
+
.describe("Destination list id. Resolve via listLists or findList."),
|
|
21
|
+
idBoard: z
|
|
22
|
+
.string()
|
|
23
|
+
.describe("Destination board id when moving across boards.")
|
|
24
|
+
.optional(),
|
|
25
|
+
})
|
|
26
|
+
.strict();
|
|
27
|
+
|
|
28
|
+
const outputSchema = z.object({
|
|
29
|
+
id: z.string().regex(TRELLO_ID_REGEX),
|
|
30
|
+
name: z.string(),
|
|
31
|
+
closed: z.boolean().nullable().optional(),
|
|
32
|
+
idBoard: z.string(),
|
|
33
|
+
idList: z.string(),
|
|
34
|
+
url: z.string(),
|
|
35
|
+
shortUrl: z.string().nullable().optional(),
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
const definition = defineTool({
|
|
39
|
+
name: "moveCard",
|
|
40
|
+
title: "Move Card",
|
|
41
|
+
description:
|
|
42
|
+
"Move a card to another list (and optionally another board). Resolve list ids via listLists or findList before calling.",
|
|
43
|
+
inputSchema,
|
|
44
|
+
outputSchema,
|
|
45
|
+
annotations: {
|
|
46
|
+
readOnlyHint: false,
|
|
47
|
+
destructiveHint: false,
|
|
48
|
+
idempotentHint: true,
|
|
49
|
+
openWorldHint: true,
|
|
50
|
+
},
|
|
51
|
+
connection: "trello",
|
|
52
|
+
run: async (input, ctx) => {
|
|
53
|
+
const url = `${TRELLO_BASE}/cards/${encodeURIComponent(input.id)}`;
|
|
54
|
+
const body: Record<string, string> = { idList: input.idList };
|
|
55
|
+
if (input.idBoard !== undefined) body.idBoard = input.idBoard;
|
|
56
|
+
const res = await ctx.fetch(url, {
|
|
57
|
+
method: "PUT",
|
|
58
|
+
headers: trelloFormHeaders,
|
|
59
|
+
body: trelloFormBody(body),
|
|
60
|
+
});
|
|
61
|
+
if (!res.ok) await trelloError("moveCard", res);
|
|
62
|
+
return res.json() as Promise<z.infer<typeof outputSchema>>;
|
|
63
|
+
},
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
export default definition;
|
|
67
|
+
|
|
68
|
+
await handleIfScriptMain(import.meta, definition, { connectionResolvers });
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { defineTool, handleIfScriptMain } from "@zapier/connectors-sdk";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
|
|
5
|
+
import { connectionResolvers } from "../connections.ts";
|
|
6
|
+
|
|
7
|
+
const inputSchema = z
|
|
8
|
+
.object({
|
|
9
|
+
id: z.string().describe("24-char hex card id."),
|
|
10
|
+
idLabel: z.string(),
|
|
11
|
+
})
|
|
12
|
+
.strict();
|
|
13
|
+
const outputSchema = z.object({ status: z.number() });
|
|
14
|
+
|
|
15
|
+
const definition = defineTool({
|
|
16
|
+
name: "removeCardLabel",
|
|
17
|
+
title: "Remove Card Label",
|
|
18
|
+
description: "Remove a label from a card.",
|
|
19
|
+
inputSchema,
|
|
20
|
+
outputSchema,
|
|
21
|
+
annotations: {
|
|
22
|
+
readOnlyHint: false,
|
|
23
|
+
destructiveHint: true,
|
|
24
|
+
idempotentHint: true,
|
|
25
|
+
openWorldHint: true,
|
|
26
|
+
},
|
|
27
|
+
connection: "trello",
|
|
28
|
+
run: async (input, ctx) => {
|
|
29
|
+
const url = `https://api.trello.com/1/cards/${encodeURIComponent(input.id)}/idLabels/${encodeURIComponent(input.idLabel)}`;
|
|
30
|
+
const res = await ctx.fetch(url, {
|
|
31
|
+
method: "DELETE",
|
|
32
|
+
});
|
|
33
|
+
if (!res.ok) {
|
|
34
|
+
const errBody = await res.text();
|
|
35
|
+
throw new Error(`Trello removeCardLabel ${res.status}: ${errBody}`);
|
|
36
|
+
}
|
|
37
|
+
return { status: res.status };
|
|
38
|
+
},
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
export default definition;
|
|
42
|
+
|
|
43
|
+
await handleIfScriptMain(import.meta, definition, { connectionResolvers });
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { defineTool, handleIfScriptMain } from "@zapier/connectors-sdk";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
|
|
5
|
+
import { connectionResolvers } from "../connections.ts";
|
|
6
|
+
import { TRELLO_BASE, trelloError } from "../lib/trello.ts";
|
|
7
|
+
|
|
8
|
+
function buildSearchQuery(input: {
|
|
9
|
+
query?: string;
|
|
10
|
+
keyword?: string;
|
|
11
|
+
listName?: string;
|
|
12
|
+
member?: string;
|
|
13
|
+
label?: string;
|
|
14
|
+
dueFilter?: string;
|
|
15
|
+
}): string {
|
|
16
|
+
if (input.query !== undefined) return input.query;
|
|
17
|
+
const parts: string[] = [];
|
|
18
|
+
if (input.keyword !== undefined) parts.push(input.keyword);
|
|
19
|
+
if (input.listName !== undefined) parts.push(`list:${input.listName}`);
|
|
20
|
+
if (input.member !== undefined) {
|
|
21
|
+
parts.push(
|
|
22
|
+
input.member.startsWith("@") ? input.member : `@${input.member}`,
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
if (input.label !== undefined) parts.push(`label:${input.label}`);
|
|
26
|
+
if (input.dueFilter !== undefined) parts.push(`due:${input.dueFilter}`);
|
|
27
|
+
if (parts.length === 0) {
|
|
28
|
+
throw new Error("Trello searchCards: provide query or keyword.");
|
|
29
|
+
}
|
|
30
|
+
return parts.join(" ");
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const inputSchema = z
|
|
34
|
+
.object({
|
|
35
|
+
query: z
|
|
36
|
+
.string()
|
|
37
|
+
.describe(
|
|
38
|
+
"Raw Trello query string (e.g. board:MyBoard @me due:week). Mutually exclusive with keyword-based structured search.",
|
|
39
|
+
)
|
|
40
|
+
.optional(),
|
|
41
|
+
keyword: z
|
|
42
|
+
.string()
|
|
43
|
+
.describe("Search card name/description when not using raw query.")
|
|
44
|
+
.optional(),
|
|
45
|
+
boardId: z.string().describe("Limit to this board id.").optional(),
|
|
46
|
+
listName: z.string().optional(),
|
|
47
|
+
member: z
|
|
48
|
+
.string()
|
|
49
|
+
.describe("Member filter; use @me for current user.")
|
|
50
|
+
.optional(),
|
|
51
|
+
label: z.string().optional(),
|
|
52
|
+
dueFilter: z
|
|
53
|
+
.enum(["day", "week", "month", "overdue", "complete", "incomplete"])
|
|
54
|
+
.optional(),
|
|
55
|
+
organizationId: z.string().optional(),
|
|
56
|
+
cardsLimit: z
|
|
57
|
+
.number()
|
|
58
|
+
.int()
|
|
59
|
+
.gte(1)
|
|
60
|
+
.lte(1000)
|
|
61
|
+
.describe(
|
|
62
|
+
"Defaults to 20 when omitted; pass a value when you need a specific number of results.",
|
|
63
|
+
)
|
|
64
|
+
.optional(),
|
|
65
|
+
partial: z.boolean().default(true),
|
|
66
|
+
})
|
|
67
|
+
.strict();
|
|
68
|
+
const outputSchema = z.object({
|
|
69
|
+
items: z
|
|
70
|
+
.array(
|
|
71
|
+
z.object({
|
|
72
|
+
id: z
|
|
73
|
+
.string()
|
|
74
|
+
.regex(new RegExp("^[0-9a-fA-F]{24}$"))
|
|
75
|
+
.describe("Trello object id (24 hex chars)."),
|
|
76
|
+
name: z.string(),
|
|
77
|
+
desc: z.string().nullable().optional(),
|
|
78
|
+
closed: z.boolean().nullable().optional(),
|
|
79
|
+
idBoard: z.string(),
|
|
80
|
+
idList: z.string(),
|
|
81
|
+
idShort: z.number().int().nullable().optional(),
|
|
82
|
+
shortLink: z.string().nullable().optional(),
|
|
83
|
+
shortUrl: z.string().nullable().optional(),
|
|
84
|
+
url: z.string().nullable().optional(),
|
|
85
|
+
due: z
|
|
86
|
+
.union([z.string().datetime({ offset: true }), z.null()])
|
|
87
|
+
.optional(),
|
|
88
|
+
dueComplete: z.boolean().nullable().optional(),
|
|
89
|
+
dateLastActivity: z
|
|
90
|
+
.string()
|
|
91
|
+
.datetime({ offset: true })
|
|
92
|
+
.nullable()
|
|
93
|
+
.optional(),
|
|
94
|
+
idLabels: z.array(z.string()).nullable().optional(),
|
|
95
|
+
idMembers: z.array(z.string()).nullable().optional(),
|
|
96
|
+
labels: z
|
|
97
|
+
.array(
|
|
98
|
+
z.object({
|
|
99
|
+
id: z.string(),
|
|
100
|
+
name: z.string().nullable().optional(),
|
|
101
|
+
color: z.string().nullable().optional(),
|
|
102
|
+
}),
|
|
103
|
+
)
|
|
104
|
+
.nullable()
|
|
105
|
+
.optional(),
|
|
106
|
+
pos: z.number().nullable().optional(),
|
|
107
|
+
customFields: z.record(z.string(), z.json()).nullable().optional(),
|
|
108
|
+
}),
|
|
109
|
+
)
|
|
110
|
+
.nullable()
|
|
111
|
+
.optional(),
|
|
112
|
+
has_more: z.boolean().nullable().optional(),
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
const definition = defineTool({
|
|
116
|
+
name: "searchCards",
|
|
117
|
+
title: "Search Cards",
|
|
118
|
+
description: "Search for cards using Trello query DSL or structured filters.",
|
|
119
|
+
inputSchema,
|
|
120
|
+
outputSchema,
|
|
121
|
+
annotations: {
|
|
122
|
+
readOnlyHint: true,
|
|
123
|
+
destructiveHint: false,
|
|
124
|
+
idempotentHint: true,
|
|
125
|
+
openWorldHint: true,
|
|
126
|
+
},
|
|
127
|
+
connection: "trello",
|
|
128
|
+
run: async (input, ctx) => {
|
|
129
|
+
const url = new URL(`${TRELLO_BASE}/search`);
|
|
130
|
+
url.searchParams.set("query", buildSearchQuery(input));
|
|
131
|
+
url.searchParams.set("modelTypes", "cards");
|
|
132
|
+
if (input.boardId !== undefined) {
|
|
133
|
+
url.searchParams.set("idBoards", input.boardId);
|
|
134
|
+
}
|
|
135
|
+
if (input.organizationId !== undefined) {
|
|
136
|
+
url.searchParams.set("idOrganizations", input.organizationId);
|
|
137
|
+
}
|
|
138
|
+
const limit = input.cardsLimit ?? 20;
|
|
139
|
+
url.searchParams.set("cards_limit", String(limit));
|
|
140
|
+
if (input.partial !== undefined) {
|
|
141
|
+
url.searchParams.set("partial", String(input.partial));
|
|
142
|
+
}
|
|
143
|
+
const res = await ctx.fetch(url.toString(), { method: "GET" });
|
|
144
|
+
if (!res.ok) await trelloError("searchCards", res);
|
|
145
|
+
const data = (await res.json()) as { cards?: unknown[] };
|
|
146
|
+
const items = Array.isArray(data.cards) ? data.cards : [];
|
|
147
|
+
return { items, has_more: items.length >= limit };
|
|
148
|
+
},
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
export default definition;
|
|
152
|
+
|
|
153
|
+
await handleIfScriptMain(import.meta, definition, { connectionResolvers });
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { defineTool, handleIfScriptMain } from "@zapier/connectors-sdk";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
|
|
5
|
+
import { connectionResolvers } from "../connections.ts";
|
|
6
|
+
|
|
7
|
+
const inputSchema = z
|
|
8
|
+
.object({
|
|
9
|
+
id: z.string().describe("24-char hex card id."),
|
|
10
|
+
name: z.string().optional(),
|
|
11
|
+
desc: z
|
|
12
|
+
.string()
|
|
13
|
+
.describe(
|
|
14
|
+
"Card description (Trello Markdown). Append vs overwrite controlled by descOverwrite.",
|
|
15
|
+
)
|
|
16
|
+
.optional(),
|
|
17
|
+
descOverwrite: z
|
|
18
|
+
.boolean()
|
|
19
|
+
.describe("When false, append desc to existing; when true, replace.")
|
|
20
|
+
.optional(),
|
|
21
|
+
due: z
|
|
22
|
+
.string()
|
|
23
|
+
.datetime({ offset: true })
|
|
24
|
+
.describe("Due datetime (ISO 8601). Pass null string to clear.")
|
|
25
|
+
.optional(),
|
|
26
|
+
start: z
|
|
27
|
+
.string()
|
|
28
|
+
.datetime({ offset: true })
|
|
29
|
+
.describe("Start datetime. Pass null string to clear.")
|
|
30
|
+
.optional(),
|
|
31
|
+
dueComplete: z.boolean().optional(),
|
|
32
|
+
closed: z
|
|
33
|
+
.boolean()
|
|
34
|
+
.describe("Set true to archive the card (archiveCard tool behavior).")
|
|
35
|
+
.optional(),
|
|
36
|
+
idList: z
|
|
37
|
+
.string()
|
|
38
|
+
.describe("Move card to this list id (moveCard tool behavior).")
|
|
39
|
+
.optional(),
|
|
40
|
+
idBoard: z
|
|
41
|
+
.string()
|
|
42
|
+
.describe("Destination board when moving across boards.")
|
|
43
|
+
.optional(),
|
|
44
|
+
pos: z
|
|
45
|
+
.any()
|
|
46
|
+
.superRefine((x, ctx) => {
|
|
47
|
+
const schemas = [z.enum(["top", "bottom"]), z.number()];
|
|
48
|
+
const { errors, failed } = schemas.reduce<{
|
|
49
|
+
errors: z.core.$ZodIssue[];
|
|
50
|
+
failed: number;
|
|
51
|
+
}>(
|
|
52
|
+
({ errors, failed }, schema) =>
|
|
53
|
+
((result) =>
|
|
54
|
+
result.error
|
|
55
|
+
? {
|
|
56
|
+
errors: [...errors, ...result.error.issues],
|
|
57
|
+
failed: failed + 1,
|
|
58
|
+
}
|
|
59
|
+
: { errors, failed })(schema.safeParse(x)),
|
|
60
|
+
{ errors: [], failed: 0 },
|
|
61
|
+
);
|
|
62
|
+
const passed = schemas.length - failed;
|
|
63
|
+
if (passed !== 1) {
|
|
64
|
+
ctx.addIssue(
|
|
65
|
+
errors.length
|
|
66
|
+
? {
|
|
67
|
+
path: [],
|
|
68
|
+
code: "invalid_union",
|
|
69
|
+
errors: [errors],
|
|
70
|
+
message:
|
|
71
|
+
"Invalid input: Should pass single schema. Passed " +
|
|
72
|
+
passed,
|
|
73
|
+
}
|
|
74
|
+
: {
|
|
75
|
+
path: [],
|
|
76
|
+
code: "custom",
|
|
77
|
+
errors: [errors],
|
|
78
|
+
message:
|
|
79
|
+
"Invalid input: Should pass single schema. Passed " +
|
|
80
|
+
passed,
|
|
81
|
+
},
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
})
|
|
85
|
+
.optional(),
|
|
86
|
+
address: z.string().optional(),
|
|
87
|
+
locationName: z.string().optional(),
|
|
88
|
+
coordinates: z
|
|
89
|
+
.string()
|
|
90
|
+
.describe("latitude,longitude e.g. 40.712776,-74.005974")
|
|
91
|
+
.optional(),
|
|
92
|
+
})
|
|
93
|
+
.strict();
|
|
94
|
+
const outputSchema = z.object({
|
|
95
|
+
id: z
|
|
96
|
+
.string()
|
|
97
|
+
.regex(new RegExp("^[0-9a-fA-F]{24}$"))
|
|
98
|
+
.describe("Trello object id (24 hex chars)."),
|
|
99
|
+
name: z.string(),
|
|
100
|
+
desc: z.string().nullable().optional(),
|
|
101
|
+
closed: z.boolean().nullable().optional(),
|
|
102
|
+
idBoard: z.string(),
|
|
103
|
+
idList: z.string(),
|
|
104
|
+
idShort: z.number().int().nullable().optional(),
|
|
105
|
+
shortLink: z.string().nullable().optional(),
|
|
106
|
+
shortUrl: z.string().nullable().optional(),
|
|
107
|
+
url: z.string().nullable().optional(),
|
|
108
|
+
due: z.union([z.string().datetime({ offset: true }), z.null()]).optional(),
|
|
109
|
+
dueComplete: z.boolean().nullable().optional(),
|
|
110
|
+
dateLastActivity: z.string().datetime({ offset: true }).nullable().optional(),
|
|
111
|
+
idLabels: z.array(z.string()).nullable().optional(),
|
|
112
|
+
idMembers: z.array(z.string()).nullable().optional(),
|
|
113
|
+
labels: z
|
|
114
|
+
.array(
|
|
115
|
+
z.object({
|
|
116
|
+
id: z
|
|
117
|
+
.string()
|
|
118
|
+
.regex(new RegExp("^[0-9a-fA-F]{24}$"))
|
|
119
|
+
.describe("Trello object id (24 hex chars)."),
|
|
120
|
+
idBoard: z.string(),
|
|
121
|
+
name: z.string().nullable().optional(),
|
|
122
|
+
color: z.string().nullable().optional(),
|
|
123
|
+
}),
|
|
124
|
+
)
|
|
125
|
+
.nullable()
|
|
126
|
+
.optional(),
|
|
127
|
+
pos: z.number().nullable().optional(),
|
|
128
|
+
customFields: z
|
|
129
|
+
.record(z.string(), z.any())
|
|
130
|
+
.nullable()
|
|
131
|
+
.describe("Custom field values keyed by field name when requested.")
|
|
132
|
+
.optional(),
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
const definition = defineTool({
|
|
136
|
+
name: "updateCard",
|
|
137
|
+
title: "Update Card",
|
|
138
|
+
description:
|
|
139
|
+
"Update card fields (name, description, due, cover, list, archive). Custom fields updated separately in run() polish.",
|
|
140
|
+
inputSchema,
|
|
141
|
+
outputSchema,
|
|
142
|
+
annotations: {
|
|
143
|
+
readOnlyHint: false,
|
|
144
|
+
destructiveHint: false,
|
|
145
|
+
idempotentHint: true,
|
|
146
|
+
openWorldHint: true,
|
|
147
|
+
},
|
|
148
|
+
connection: "trello",
|
|
149
|
+
run: async (input, ctx) => {
|
|
150
|
+
const url = `https://api.trello.com/1/cards/${encodeURIComponent(input.id)}`;
|
|
151
|
+
const body: Record<string, unknown> = {};
|
|
152
|
+
if (input.name !== undefined) body["name"] = input.name;
|
|
153
|
+
if (input.desc !== undefined) body["desc"] = input.desc;
|
|
154
|
+
if (input.descOverwrite !== undefined)
|
|
155
|
+
body["descOverwrite"] = input.descOverwrite;
|
|
156
|
+
if (input.due !== undefined) body["due"] = input.due;
|
|
157
|
+
if (input.start !== undefined) body["start"] = input.start;
|
|
158
|
+
if (input.dueComplete !== undefined)
|
|
159
|
+
body["dueComplete"] = input.dueComplete;
|
|
160
|
+
if (input.closed !== undefined) body["closed"] = input.closed;
|
|
161
|
+
if (input.idList !== undefined) body["idList"] = input.idList;
|
|
162
|
+
if (input.idBoard !== undefined) body["idBoard"] = input.idBoard;
|
|
163
|
+
if (input.pos !== undefined) body["pos"] = input.pos;
|
|
164
|
+
if (input.address !== undefined) body["address"] = input.address;
|
|
165
|
+
if (input.locationName !== undefined)
|
|
166
|
+
body["locationName"] = input.locationName;
|
|
167
|
+
if (input.coordinates !== undefined)
|
|
168
|
+
body["coordinates"] = input.coordinates;
|
|
169
|
+
const res = await ctx.fetch(url, {
|
|
170
|
+
method: "PUT",
|
|
171
|
+
headers: { "Content-Type": "application/json" },
|
|
172
|
+
body: JSON.stringify(body),
|
|
173
|
+
});
|
|
174
|
+
if (!res.ok) {
|
|
175
|
+
const errBody = await res.text();
|
|
176
|
+
throw new Error(`Trello updateCard ${res.status}: ${errBody}`);
|
|
177
|
+
}
|
|
178
|
+
return res.json();
|
|
179
|
+
},
|
|
180
|
+
});
|
|
181
|
+
|
|
182
|
+
export default definition;
|
|
183
|
+
|
|
184
|
+
await handleIfScriptMain(import.meta, definition, { connectionResolvers });
|
package/tsup.config.ts
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* tsup build config for connectors.
|
|
3
|
+
*
|
|
4
|
+
* Compiles index.ts (library entry, bundled) and cli.ts (CLI, bundled but
|
|
5
|
+
* with the connector's index module kept external).
|
|
6
|
+
*
|
|
7
|
+
* The cli.ts entry externalises ./index.ts → ./index.js via an esbuild plugin
|
|
8
|
+
* so that dist/cli.js imports the pre-built dist/index.js as a separate module
|
|
9
|
+
* rather than inlining scripts. Without this, each script's top-level
|
|
10
|
+
* `await handleIfScriptMain(import.meta, …)` ends up inside the single-file
|
|
11
|
+
* bundle; in Node 22.18+ import.meta.main is true for the bundle entry,
|
|
12
|
+
* causing every script to execute when the dispatch CLI starts instead of
|
|
13
|
+
* routing via runDispatchCli.
|
|
14
|
+
*
|
|
15
|
+
* Managed by @zapier/connectors-dev — do not edit; synced byte-for-byte
|
|
16
|
+
* across every connector.
|
|
17
|
+
*/
|
|
18
|
+
import { defineConfig } from "tsup";
|
|
19
|
+
|
|
20
|
+
export default defineConfig([
|
|
21
|
+
{
|
|
22
|
+
entry: ["index.ts"],
|
|
23
|
+
format: ["esm"],
|
|
24
|
+
dts: false,
|
|
25
|
+
clean: true,
|
|
26
|
+
target: "es2022",
|
|
27
|
+
external: [
|
|
28
|
+
"@modelcontextprotocol/sdk",
|
|
29
|
+
"@zapier/zapier-sdk",
|
|
30
|
+
"zod",
|
|
31
|
+
"@zapier/connectors-sdk",
|
|
32
|
+
],
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
entry: ["cli.ts"],
|
|
36
|
+
format: ["esm"],
|
|
37
|
+
dts: false,
|
|
38
|
+
clean: false,
|
|
39
|
+
target: "es2022",
|
|
40
|
+
external: [
|
|
41
|
+
"@modelcontextprotocol/sdk",
|
|
42
|
+
"@zapier/zapier-sdk",
|
|
43
|
+
"zod",
|
|
44
|
+
"@zapier/connectors-sdk",
|
|
45
|
+
],
|
|
46
|
+
esbuildPlugins: [
|
|
47
|
+
{
|
|
48
|
+
name: "externalize-connector-index",
|
|
49
|
+
setup(build) {
|
|
50
|
+
// Resolve ./index.ts to the pre-built ./index.js and mark it external
|
|
51
|
+
// so scripts are not inlined into dist/cli.js. When dist/index.js is
|
|
52
|
+
// imported (not the entry), import.meta.main is false inside it and
|
|
53
|
+
// handleIfScriptMain's existing !meta.main guard suppresses per-script
|
|
54
|
+
// execution — no SDK changes required.
|
|
55
|
+
build.onResolve({ filter: /^\.\/index(\.ts)?$/ }, () => ({
|
|
56
|
+
path: "./index.js",
|
|
57
|
+
external: true,
|
|
58
|
+
}));
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
],
|
|
62
|
+
},
|
|
63
|
+
]);
|