@squadbase/vite-server 0.1.2 → 0.1.3-dev.1
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/dist/cli/index.js +13609 -3797
- package/dist/connectors/airtable-oauth.js +12 -4
- package/dist/connectors/amplitude.js +335 -32
- package/dist/connectors/asana.d.ts +5 -0
- package/dist/connectors/asana.js +661 -0
- package/dist/connectors/attio.js +304 -36
- package/dist/connectors/customerio.d.ts +5 -0
- package/dist/connectors/customerio.js +633 -0
- package/dist/connectors/gmail-oauth.d.ts +5 -0
- package/dist/connectors/gmail-oauth.js +639 -0
- package/dist/connectors/google-ads-oauth.js +14 -8
- package/dist/connectors/google-ads.d.ts +5 -0
- package/dist/connectors/google-ads.js +784 -0
- package/dist/connectors/google-analytics-oauth.js +16 -8
- package/dist/connectors/google-sheets-oauth.js +12 -4
- package/dist/connectors/google-sheets.d.ts +5 -0
- package/dist/connectors/google-sheets.js +598 -0
- package/dist/connectors/hubspot-oauth.js +12 -4
- package/dist/connectors/hubspot.d.ts +5 -0
- package/dist/connectors/hubspot.js +550 -0
- package/dist/connectors/intercom-oauth.d.ts +5 -0
- package/dist/connectors/intercom-oauth.js +510 -0
- package/dist/connectors/intercom.d.ts +5 -0
- package/dist/connectors/intercom.js +627 -0
- package/dist/connectors/jira-api-key.d.ts +5 -0
- package/dist/connectors/jira-api-key.js +523 -0
- package/dist/connectors/kintone-api-token.js +16 -20
- package/dist/connectors/linkedin-ads-oauth.d.ts +5 -0
- package/dist/connectors/linkedin-ads-oauth.js +774 -0
- package/dist/connectors/linkedin-ads.d.ts +5 -0
- package/dist/connectors/linkedin-ads.js +782 -0
- package/dist/connectors/mailchimp-oauth.d.ts +5 -0
- package/dist/connectors/mailchimp-oauth.js +539 -0
- package/dist/connectors/mailchimp.d.ts +5 -0
- package/dist/connectors/mailchimp.js +646 -0
- package/dist/connectors/shopify-oauth.js +12 -4
- package/dist/connectors/shopify.js +500 -80
- package/dist/connectors/stripe-oauth.js +12 -4
- package/dist/connectors/zendesk-oauth.d.ts +5 -0
- package/dist/connectors/zendesk-oauth.js +505 -0
- package/dist/connectors/zendesk.d.ts +5 -0
- package/dist/connectors/zendesk.js +631 -0
- package/dist/index.js +13594 -3782
- package/dist/main.js +13596 -3784
- package/dist/vite-plugin.js +13596 -3784
- package/package.json +46 -2
|
@@ -0,0 +1,646 @@
|
|
|
1
|
+
// ../connectors/src/parameter-definition.ts
|
|
2
|
+
var ParameterDefinition = class {
|
|
3
|
+
slug;
|
|
4
|
+
name;
|
|
5
|
+
description;
|
|
6
|
+
envVarBaseKey;
|
|
7
|
+
type;
|
|
8
|
+
secret;
|
|
9
|
+
required;
|
|
10
|
+
constructor(config) {
|
|
11
|
+
this.slug = config.slug;
|
|
12
|
+
this.name = config.name;
|
|
13
|
+
this.description = config.description;
|
|
14
|
+
this.envVarBaseKey = config.envVarBaseKey;
|
|
15
|
+
this.type = config.type;
|
|
16
|
+
this.secret = config.secret;
|
|
17
|
+
this.required = config.required;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Get the parameter value from a ConnectorConnectionObject.
|
|
21
|
+
*/
|
|
22
|
+
getValue(connection2) {
|
|
23
|
+
const param = connection2.parameters.find(
|
|
24
|
+
(p) => p.parameterSlug === this.slug
|
|
25
|
+
);
|
|
26
|
+
if (!param || param.value == null) {
|
|
27
|
+
throw new Error(
|
|
28
|
+
`Parameter "${this.slug}" not found or has no value in connection "${connection2.id}"`
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
return param.value;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Try to get the parameter value. Returns undefined if not found (for optional params).
|
|
35
|
+
*/
|
|
36
|
+
tryGetValue(connection2) {
|
|
37
|
+
const param = connection2.parameters.find(
|
|
38
|
+
(p) => p.parameterSlug === this.slug
|
|
39
|
+
);
|
|
40
|
+
if (!param || param.value == null) return void 0;
|
|
41
|
+
return param.value;
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
// ../connectors/src/connectors/mailchimp/parameters.ts
|
|
46
|
+
var parameters = {
|
|
47
|
+
apiKey: new ParameterDefinition({
|
|
48
|
+
slug: "api-key",
|
|
49
|
+
name: "Mailchimp API Key",
|
|
50
|
+
description: "Your Mailchimp API key. The key includes the datacenter suffix (e.g., xxxxxxxxxxxxxxxx-us6).",
|
|
51
|
+
envVarBaseKey: "MAILCHIMP_API_KEY",
|
|
52
|
+
type: "text",
|
|
53
|
+
secret: true,
|
|
54
|
+
required: true
|
|
55
|
+
})
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
// ../connectors/src/connectors/mailchimp/sdk/index.ts
|
|
59
|
+
function extractDatacenter(apiKey) {
|
|
60
|
+
const parts = apiKey.split("-");
|
|
61
|
+
const dc = parts[parts.length - 1];
|
|
62
|
+
if (!dc) {
|
|
63
|
+
throw new Error(
|
|
64
|
+
"Invalid Mailchimp API key format. Expected format: xxxxxxxxxxxxxxxx-us6"
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
return dc;
|
|
68
|
+
}
|
|
69
|
+
function createClient(params) {
|
|
70
|
+
const apiKey = params[parameters.apiKey.slug];
|
|
71
|
+
if (!apiKey) {
|
|
72
|
+
throw new Error(
|
|
73
|
+
`mailchimp: missing required parameter: ${parameters.apiKey.slug}`
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
const dc = extractDatacenter(apiKey);
|
|
77
|
+
const baseUrl = `https://${dc}.api.mailchimp.com/3.0`;
|
|
78
|
+
const authHeader = `Basic ${btoa(`anystring:${apiKey}`)}`;
|
|
79
|
+
function authHeaders(extra) {
|
|
80
|
+
const headers = new Headers(extra);
|
|
81
|
+
headers.set("Authorization", authHeader);
|
|
82
|
+
headers.set("Content-Type", "application/json");
|
|
83
|
+
return headers;
|
|
84
|
+
}
|
|
85
|
+
async function assertOk(res, label) {
|
|
86
|
+
if (!res.ok) {
|
|
87
|
+
const body = await res.text().catch(() => "(unreadable body)");
|
|
88
|
+
throw new Error(
|
|
89
|
+
`mailchimp ${label}: ${res.status} ${res.statusText} \u2014 ${body}`
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
function buildQuery(params2) {
|
|
94
|
+
if (!params2) return "";
|
|
95
|
+
const entries = Object.entries(params2).filter(
|
|
96
|
+
([, v]) => v !== void 0
|
|
97
|
+
);
|
|
98
|
+
if (entries.length === 0) return "";
|
|
99
|
+
const sp = new URLSearchParams();
|
|
100
|
+
for (const [k, v] of entries) sp.set(k, String(v));
|
|
101
|
+
return `?${sp.toString()}`;
|
|
102
|
+
}
|
|
103
|
+
return {
|
|
104
|
+
request(path2, init) {
|
|
105
|
+
const url = `${baseUrl}${path2.startsWith("/") ? "" : "/"}${path2}`;
|
|
106
|
+
const headers = new Headers(init?.headers);
|
|
107
|
+
headers.set("Authorization", authHeader);
|
|
108
|
+
headers.set("Content-Type", "application/json");
|
|
109
|
+
return fetch(url, { ...init, headers });
|
|
110
|
+
},
|
|
111
|
+
async getLists(options) {
|
|
112
|
+
const qs = buildQuery({
|
|
113
|
+
count: options?.count,
|
|
114
|
+
offset: options?.offset
|
|
115
|
+
});
|
|
116
|
+
const res = await fetch(`${baseUrl}/lists${qs}`, {
|
|
117
|
+
method: "GET",
|
|
118
|
+
headers: authHeaders()
|
|
119
|
+
});
|
|
120
|
+
await assertOk(res, "getLists");
|
|
121
|
+
return await res.json();
|
|
122
|
+
},
|
|
123
|
+
async getListMembers(listId, options) {
|
|
124
|
+
const qs = buildQuery({
|
|
125
|
+
count: options?.count,
|
|
126
|
+
offset: options?.offset,
|
|
127
|
+
status: options?.status
|
|
128
|
+
});
|
|
129
|
+
const res = await fetch(
|
|
130
|
+
`${baseUrl}/lists/${encodeURIComponent(listId)}/members${qs}`,
|
|
131
|
+
{ method: "GET", headers: authHeaders() }
|
|
132
|
+
);
|
|
133
|
+
await assertOk(res, "getListMembers");
|
|
134
|
+
return await res.json();
|
|
135
|
+
},
|
|
136
|
+
async getCampaigns(options) {
|
|
137
|
+
const qs = buildQuery({
|
|
138
|
+
count: options?.count,
|
|
139
|
+
offset: options?.offset,
|
|
140
|
+
status: options?.status,
|
|
141
|
+
type: options?.type
|
|
142
|
+
});
|
|
143
|
+
const res = await fetch(`${baseUrl}/campaigns${qs}`, {
|
|
144
|
+
method: "GET",
|
|
145
|
+
headers: authHeaders()
|
|
146
|
+
});
|
|
147
|
+
await assertOk(res, "getCampaigns");
|
|
148
|
+
return await res.json();
|
|
149
|
+
},
|
|
150
|
+
async getReports(options) {
|
|
151
|
+
const qs = buildQuery({
|
|
152
|
+
count: options?.count,
|
|
153
|
+
offset: options?.offset
|
|
154
|
+
});
|
|
155
|
+
const res = await fetch(`${baseUrl}/reports${qs}`, {
|
|
156
|
+
method: "GET",
|
|
157
|
+
headers: authHeaders()
|
|
158
|
+
});
|
|
159
|
+
await assertOk(res, "getReports");
|
|
160
|
+
return await res.json();
|
|
161
|
+
}
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
// ../connectors/src/connector-onboarding.ts
|
|
166
|
+
var ConnectorOnboarding = class {
|
|
167
|
+
/** Phase 1: Connection setup instructions (optional — some connectors don't need this) */
|
|
168
|
+
connectionSetupInstructions;
|
|
169
|
+
/** Phase 2: Data overview instructions */
|
|
170
|
+
dataOverviewInstructions;
|
|
171
|
+
constructor(config) {
|
|
172
|
+
this.connectionSetupInstructions = config.connectionSetupInstructions;
|
|
173
|
+
this.dataOverviewInstructions = config.dataOverviewInstructions;
|
|
174
|
+
}
|
|
175
|
+
getConnectionSetupPrompt(language) {
|
|
176
|
+
return this.connectionSetupInstructions?.[language] ?? null;
|
|
177
|
+
}
|
|
178
|
+
getDataOverviewInstructions(language) {
|
|
179
|
+
return this.dataOverviewInstructions[language];
|
|
180
|
+
}
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
// ../connectors/src/connector-tool.ts
|
|
184
|
+
var ConnectorTool = class {
|
|
185
|
+
name;
|
|
186
|
+
description;
|
|
187
|
+
inputSchema;
|
|
188
|
+
outputSchema;
|
|
189
|
+
_execute;
|
|
190
|
+
constructor(config) {
|
|
191
|
+
this.name = config.name;
|
|
192
|
+
this.description = config.description;
|
|
193
|
+
this.inputSchema = config.inputSchema;
|
|
194
|
+
this.outputSchema = config.outputSchema;
|
|
195
|
+
this._execute = config.execute;
|
|
196
|
+
}
|
|
197
|
+
createTool(connections, config) {
|
|
198
|
+
return {
|
|
199
|
+
description: this.description,
|
|
200
|
+
inputSchema: this.inputSchema,
|
|
201
|
+
outputSchema: this.outputSchema,
|
|
202
|
+
execute: (input) => this._execute(input, connections, config)
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
};
|
|
206
|
+
|
|
207
|
+
// ../connectors/src/connector-plugin.ts
|
|
208
|
+
var ConnectorPlugin = class _ConnectorPlugin {
|
|
209
|
+
slug;
|
|
210
|
+
authType;
|
|
211
|
+
name;
|
|
212
|
+
description;
|
|
213
|
+
iconUrl;
|
|
214
|
+
parameters;
|
|
215
|
+
releaseFlag;
|
|
216
|
+
proxyPolicy;
|
|
217
|
+
experimentalAttributes;
|
|
218
|
+
onboarding;
|
|
219
|
+
systemPrompt;
|
|
220
|
+
tools;
|
|
221
|
+
query;
|
|
222
|
+
checkConnection;
|
|
223
|
+
constructor(config) {
|
|
224
|
+
this.slug = config.slug;
|
|
225
|
+
this.authType = config.authType;
|
|
226
|
+
this.name = config.name;
|
|
227
|
+
this.description = config.description;
|
|
228
|
+
this.iconUrl = config.iconUrl;
|
|
229
|
+
this.parameters = config.parameters;
|
|
230
|
+
this.releaseFlag = config.releaseFlag;
|
|
231
|
+
this.proxyPolicy = config.proxyPolicy;
|
|
232
|
+
this.experimentalAttributes = config.experimentalAttributes;
|
|
233
|
+
this.onboarding = config.onboarding;
|
|
234
|
+
this.systemPrompt = config.systemPrompt;
|
|
235
|
+
this.tools = config.tools;
|
|
236
|
+
this.query = config.query;
|
|
237
|
+
this.checkConnection = config.checkConnection;
|
|
238
|
+
}
|
|
239
|
+
get connectorKey() {
|
|
240
|
+
return _ConnectorPlugin.deriveKey(this.slug, this.authType);
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* Create tools for connections that belong to this connector.
|
|
244
|
+
* Filters connections by connectorKey internally.
|
|
245
|
+
* Returns tools keyed as `${connectorKey}_${toolName}`.
|
|
246
|
+
*/
|
|
247
|
+
createTools(connections, config) {
|
|
248
|
+
const myConnections = connections.filter(
|
|
249
|
+
(c) => _ConnectorPlugin.deriveKey(c.connector.slug, c.connector.authType) === this.connectorKey
|
|
250
|
+
);
|
|
251
|
+
const result = {};
|
|
252
|
+
for (const t of Object.values(this.tools)) {
|
|
253
|
+
result[`${this.connectorKey}_${t.name}`] = t.createTool(
|
|
254
|
+
myConnections,
|
|
255
|
+
config
|
|
256
|
+
);
|
|
257
|
+
}
|
|
258
|
+
return result;
|
|
259
|
+
}
|
|
260
|
+
static deriveKey(slug, authType) {
|
|
261
|
+
return authType ? `${slug}-${authType}` : slug;
|
|
262
|
+
}
|
|
263
|
+
};
|
|
264
|
+
|
|
265
|
+
// ../connectors/src/connectors/mailchimp/setup.ts
|
|
266
|
+
var mailchimpOnboarding = new ConnectorOnboarding({
|
|
267
|
+
dataOverviewInstructions: {
|
|
268
|
+
en: `1. Call mailchimp_request with GET /lists to list all audiences
|
|
269
|
+
2. Pick an audience and call GET /lists/{list_id}/members?count=5 to sample members
|
|
270
|
+
3. Call GET /campaigns?count=5 to list recent campaigns
|
|
271
|
+
4. Call GET /reports?count=5 to view campaign reports`,
|
|
272
|
+
ja: `1. mailchimp_request \u3067 GET /lists \u3092\u547C\u3073\u51FA\u3057\u3001\u5168\u30AA\u30FC\u30C7\u30A3\u30A8\u30F3\u30B9\u4E00\u89A7\u3092\u53D6\u5F97
|
|
273
|
+
2. \u30AA\u30FC\u30C7\u30A3\u30A8\u30F3\u30B9\u3092\u9078\u629E\u3057 GET /lists/{list_id}/members?count=5 \u3067\u30E1\u30F3\u30D0\u30FC\u3092\u30B5\u30F3\u30D7\u30EA\u30F3\u30B0
|
|
274
|
+
3. GET /campaigns?count=5 \u3067\u6700\u8FD1\u306E\u30AD\u30E3\u30F3\u30DA\u30FC\u30F3\u4E00\u89A7\u3092\u53D6\u5F97
|
|
275
|
+
4. GET /reports?count=5 \u3067\u30AD\u30E3\u30F3\u30DA\u30FC\u30F3\u30EC\u30DD\u30FC\u30C8\u3092\u8868\u793A`
|
|
276
|
+
}
|
|
277
|
+
});
|
|
278
|
+
|
|
279
|
+
// ../connectors/src/connectors/mailchimp/tools/request.ts
|
|
280
|
+
import { z } from "zod";
|
|
281
|
+
var REQUEST_TIMEOUT_MS = 6e4;
|
|
282
|
+
function extractDatacenter2(apiKey) {
|
|
283
|
+
const parts = apiKey.split("-");
|
|
284
|
+
const dc = parts[parts.length - 1];
|
|
285
|
+
if (!dc) {
|
|
286
|
+
throw new Error(
|
|
287
|
+
"Invalid Mailchimp API key format. Expected format: xxxxxxxxxxxxxxxx-us6"
|
|
288
|
+
);
|
|
289
|
+
}
|
|
290
|
+
return dc;
|
|
291
|
+
}
|
|
292
|
+
var inputSchema = z.object({
|
|
293
|
+
toolUseIntent: z.string().optional().describe(
|
|
294
|
+
"Brief description of what you intend to accomplish with this tool call"
|
|
295
|
+
),
|
|
296
|
+
connectionId: z.string().describe("ID of the Mailchimp connection to use"),
|
|
297
|
+
method: z.enum(["GET", "POST", "PATCH", "PUT", "DELETE"]).describe(
|
|
298
|
+
"HTTP method. GET for reading, POST for creating, PATCH/PUT for updating, DELETE for removing."
|
|
299
|
+
),
|
|
300
|
+
path: z.string().describe(
|
|
301
|
+
"API path appended to the base URL (e.g., '/lists', '/campaigns', '/lists/{list_id}/members')"
|
|
302
|
+
),
|
|
303
|
+
queryParams: z.record(z.string(), z.string()).optional().describe("Query parameters to append to the URL (e.g., count, offset)"),
|
|
304
|
+
body: z.record(z.string(), z.unknown()).optional().describe("Request body (JSON) for POST/PATCH/PUT requests")
|
|
305
|
+
});
|
|
306
|
+
var outputSchema = z.discriminatedUnion("success", [
|
|
307
|
+
z.object({
|
|
308
|
+
success: z.literal(true),
|
|
309
|
+
status: z.number(),
|
|
310
|
+
data: z.record(z.string(), z.unknown())
|
|
311
|
+
}),
|
|
312
|
+
z.object({
|
|
313
|
+
success: z.literal(false),
|
|
314
|
+
error: z.string()
|
|
315
|
+
})
|
|
316
|
+
]);
|
|
317
|
+
var requestTool = new ConnectorTool({
|
|
318
|
+
name: "request",
|
|
319
|
+
description: `Send authenticated requests to the Mailchimp Marketing API v3.
|
|
320
|
+
Authentication is handled automatically using the API Key (Basic Auth).
|
|
321
|
+
Use this tool for all Mailchimp API interactions: managing audiences/lists, campaigns, members/subscribers, templates, automations, and reports.
|
|
322
|
+
The datacenter is automatically extracted from the API key suffix.`,
|
|
323
|
+
inputSchema,
|
|
324
|
+
outputSchema,
|
|
325
|
+
async execute({ connectionId, method, path: path2, queryParams, body }, connections) {
|
|
326
|
+
const connection2 = connections.find((c) => c.id === connectionId);
|
|
327
|
+
if (!connection2) {
|
|
328
|
+
return {
|
|
329
|
+
success: false,
|
|
330
|
+
error: `Connection ${connectionId} not found`
|
|
331
|
+
};
|
|
332
|
+
}
|
|
333
|
+
console.log(
|
|
334
|
+
`[connector-request] mailchimp/${connection2.name}: ${method} ${path2}`
|
|
335
|
+
);
|
|
336
|
+
try {
|
|
337
|
+
const apiKey = parameters.apiKey.getValue(connection2);
|
|
338
|
+
const dc = extractDatacenter2(apiKey);
|
|
339
|
+
const baseUrl = `https://${dc}.api.mailchimp.com/3.0`;
|
|
340
|
+
let url = `${baseUrl}${path2.startsWith("/") ? "" : "/"}${path2}`;
|
|
341
|
+
if (queryParams) {
|
|
342
|
+
const searchParams = new URLSearchParams(queryParams);
|
|
343
|
+
url += `?${searchParams.toString()}`;
|
|
344
|
+
}
|
|
345
|
+
const controller = new AbortController();
|
|
346
|
+
const timeout = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS);
|
|
347
|
+
try {
|
|
348
|
+
const response = await fetch(url, {
|
|
349
|
+
method,
|
|
350
|
+
headers: {
|
|
351
|
+
Authorization: `Basic ${btoa(`anystring:${apiKey}`)}`,
|
|
352
|
+
"Content-Type": "application/json"
|
|
353
|
+
},
|
|
354
|
+
body: body ? JSON.stringify(body) : void 0,
|
|
355
|
+
signal: controller.signal
|
|
356
|
+
});
|
|
357
|
+
const data = await response.json();
|
|
358
|
+
if (!response.ok) {
|
|
359
|
+
const errorMessage = typeof data?.detail === "string" ? data.detail : typeof data?.title === "string" ? data.title : `HTTP ${response.status} ${response.statusText}`;
|
|
360
|
+
return { success: false, error: errorMessage };
|
|
361
|
+
}
|
|
362
|
+
return { success: true, status: response.status, data };
|
|
363
|
+
} finally {
|
|
364
|
+
clearTimeout(timeout);
|
|
365
|
+
}
|
|
366
|
+
} catch (err) {
|
|
367
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
368
|
+
return { success: false, error: msg };
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
});
|
|
372
|
+
|
|
373
|
+
// ../connectors/src/connectors/mailchimp/index.ts
|
|
374
|
+
var tools = { request: requestTool };
|
|
375
|
+
var mailchimpConnector = new ConnectorPlugin({
|
|
376
|
+
slug: "mailchimp",
|
|
377
|
+
authType: null,
|
|
378
|
+
name: "Mailchimp",
|
|
379
|
+
description: "Connect to Mailchimp for email marketing, audiences, campaigns, and analytics.",
|
|
380
|
+
iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/5JXJ9GsMCDsJtGhO2EgTDj/a3a62e7a4e4e4e4e4e4e4e4e4e4e4e4e/mailchimp.svg",
|
|
381
|
+
parameters,
|
|
382
|
+
releaseFlag: { dev1: true, dev2: false, prod: false },
|
|
383
|
+
onboarding: mailchimpOnboarding,
|
|
384
|
+
systemPrompt: {
|
|
385
|
+
en: `### Tools
|
|
386
|
+
|
|
387
|
+
- \`mailchimp_request\`: The only way to call the Mailchimp Marketing API v3. Use it to manage audiences/lists, subscribers/members, campaigns, templates, automations, and reports. Authentication (Basic Auth with API key) is configured automatically. The datacenter is extracted from the API key suffix.
|
|
388
|
+
|
|
389
|
+
### Business Logic
|
|
390
|
+
|
|
391
|
+
The business logic type for this connector is "typescript". Use the connector SDK in your handler. Do NOT read credentials from environment variables.
|
|
392
|
+
|
|
393
|
+
SDK methods (client created via \`connection(connectionId)\`):
|
|
394
|
+
- \`client.request(path, init?)\` \u2014 low-level authenticated fetch
|
|
395
|
+
- \`client.getLists(options?)\` \u2014 list all audiences/lists
|
|
396
|
+
- \`client.getListMembers(listId, options?)\` \u2014 get members of a list
|
|
397
|
+
- \`client.getCampaigns(options?)\` \u2014 list all campaigns
|
|
398
|
+
- \`client.getReports(options?)\` \u2014 get campaign reports
|
|
399
|
+
|
|
400
|
+
\`\`\`ts
|
|
401
|
+
import type { Context } from "hono";
|
|
402
|
+
import { connection } from "@squadbase/vite-server/connectors/mailchimp";
|
|
403
|
+
|
|
404
|
+
const mailchimp = connection("<connectionId>");
|
|
405
|
+
|
|
406
|
+
export default async function handler(c: Context) {
|
|
407
|
+
const { count = 10, offset = 0 } = await c.req.json<{
|
|
408
|
+
count?: number;
|
|
409
|
+
offset?: number;
|
|
410
|
+
}>();
|
|
411
|
+
|
|
412
|
+
const { lists, total_items } = await mailchimp.getLists({ count, offset });
|
|
413
|
+
|
|
414
|
+
return c.json({ lists, total_items });
|
|
415
|
+
}
|
|
416
|
+
\`\`\`
|
|
417
|
+
|
|
418
|
+
### Mailchimp Marketing API v3 Reference
|
|
419
|
+
|
|
420
|
+
- Base URL: \`https://{dc}.api.mailchimp.com/3.0\` (datacenter auto-detected from API key)
|
|
421
|
+
- Authentication: Basic Auth (\`anystring:{apiKey}\`)
|
|
422
|
+
- Pagination: offset-based with \`count\` (default 10, max 1000) and \`offset\` parameters
|
|
423
|
+
|
|
424
|
+
#### Audiences / Lists
|
|
425
|
+
- GET \`/lists\` \u2014 List all audiences
|
|
426
|
+
- GET \`/lists/{list_id}\` \u2014 Get audience details
|
|
427
|
+
- POST \`/lists\` \u2014 Create an audience
|
|
428
|
+
- PATCH \`/lists/{list_id}\` \u2014 Update an audience
|
|
429
|
+
- DELETE \`/lists/{list_id}\` \u2014 Delete an audience
|
|
430
|
+
|
|
431
|
+
#### Members / Subscribers
|
|
432
|
+
- GET \`/lists/{list_id}/members\` \u2014 List members in an audience
|
|
433
|
+
- GET \`/lists/{list_id}/members/{subscriber_hash}\` \u2014 Get member details (subscriber_hash = MD5 of lowercase email)
|
|
434
|
+
- POST \`/lists/{list_id}/members\` \u2014 Add a member
|
|
435
|
+
- PUT \`/lists/{list_id}/members/{subscriber_hash}\` \u2014 Add or update a member
|
|
436
|
+
- PATCH \`/lists/{list_id}/members/{subscriber_hash}\` \u2014 Update a member
|
|
437
|
+
- DELETE \`/lists/{list_id}/members/{subscriber_hash}\` \u2014 Archive a member
|
|
438
|
+
|
|
439
|
+
#### Campaigns
|
|
440
|
+
- GET \`/campaigns\` \u2014 List campaigns
|
|
441
|
+
- GET \`/campaigns/{campaign_id}\` \u2014 Get campaign details
|
|
442
|
+
- POST \`/campaigns\` \u2014 Create a campaign
|
|
443
|
+
- PATCH \`/campaigns/{campaign_id}\` \u2014 Update a campaign
|
|
444
|
+
- DELETE \`/campaigns/{campaign_id}\` \u2014 Delete a campaign
|
|
445
|
+
- POST \`/campaigns/{campaign_id}/actions/send\` \u2014 Send a campaign
|
|
446
|
+
- GET \`/campaigns/{campaign_id}/content\` \u2014 Get campaign content
|
|
447
|
+
|
|
448
|
+
#### Templates
|
|
449
|
+
- GET \`/templates\` \u2014 List templates
|
|
450
|
+
- GET \`/templates/{template_id}\` \u2014 Get template details
|
|
451
|
+
- POST \`/templates\` \u2014 Create a template
|
|
452
|
+
- PATCH \`/templates/{template_id}\` \u2014 Update a template
|
|
453
|
+
- DELETE \`/templates/{template_id}\` \u2014 Delete a template
|
|
454
|
+
|
|
455
|
+
#### Automations
|
|
456
|
+
- GET \`/automations\` \u2014 List automations
|
|
457
|
+
- GET \`/automations/{workflow_id}\` \u2014 Get automation details
|
|
458
|
+
- GET \`/automations/{workflow_id}/emails\` \u2014 List automation emails
|
|
459
|
+
- POST \`/automations/{workflow_id}/actions/pause-all-emails\` \u2014 Pause automation
|
|
460
|
+
- POST \`/automations/{workflow_id}/actions/start-all-emails\` \u2014 Start automation
|
|
461
|
+
|
|
462
|
+
#### Reports
|
|
463
|
+
- GET \`/reports\` \u2014 List campaign reports
|
|
464
|
+
- GET \`/reports/{campaign_id}\` \u2014 Get a campaign report
|
|
465
|
+
- GET \`/reports/{campaign_id}/click-details\` \u2014 Get click details
|
|
466
|
+
- GET \`/reports/{campaign_id}/open-details\` \u2014 Get open details
|
|
467
|
+
- GET \`/reports/{campaign_id}/sent-to\` \u2014 Get sent-to details
|
|
468
|
+
- GET \`/reports/{campaign_id}/unsubscribed\` \u2014 List unsubscribed members
|
|
469
|
+
|
|
470
|
+
#### Search
|
|
471
|
+
- GET \`/search-members?query={query}\` \u2014 Search members across all audiences
|
|
472
|
+
|
|
473
|
+
#### Batch Operations
|
|
474
|
+
- POST \`/batches\` \u2014 Start a batch operation
|
|
475
|
+
- GET \`/batches\` \u2014 List batch operations
|
|
476
|
+
- GET \`/batches/{batch_id}\` \u2014 Get batch status
|
|
477
|
+
|
|
478
|
+
### Tips
|
|
479
|
+
- Use \`fields\` and \`exclude_fields\` query params to filter response fields
|
|
480
|
+
- The subscriber_hash is the MD5 hash of the lowercase email address
|
|
481
|
+
- Errors return \`type\`, \`title\`, \`status\`, \`detail\`, and \`instance\` fields`,
|
|
482
|
+
ja: `### \u30C4\u30FC\u30EB
|
|
483
|
+
|
|
484
|
+
- \`mailchimp_request\`: Mailchimp Marketing API v3\u3092\u547C\u3073\u51FA\u3059\u552F\u4E00\u306E\u624B\u6BB5\u3067\u3059\u3002\u30AA\u30FC\u30C7\u30A3\u30A8\u30F3\u30B9/\u30EA\u30B9\u30C8\u3001\u30B5\u30D6\u30B9\u30AF\u30E9\u30A4\u30D0\u30FC/\u30E1\u30F3\u30D0\u30FC\u3001\u30AD\u30E3\u30F3\u30DA\u30FC\u30F3\u3001\u30C6\u30F3\u30D7\u30EC\u30FC\u30C8\u3001\u30AA\u30FC\u30C8\u30E1\u30FC\u30B7\u30E7\u30F3\u3001\u30EC\u30DD\u30FC\u30C8\u306E\u7BA1\u7406\u306B\u4F7F\u7528\u3057\u307E\u3059\u3002\u8A8D\u8A3C\uFF08API\u30AD\u30FC\u306B\u3088\u308BBasic Auth\uFF09\u306F\u81EA\u52D5\u7684\u306B\u8A2D\u5B9A\u3055\u308C\u307E\u3059\u3002\u30C7\u30FC\u30BF\u30BB\u30F3\u30BF\u30FC\u306FAPI\u30AD\u30FC\u306E\u30B5\u30D5\u30A3\u30C3\u30AF\u30B9\u304B\u3089\u81EA\u52D5\u691C\u51FA\u3055\u308C\u307E\u3059\u3002
|
|
485
|
+
|
|
486
|
+
### Business Logic
|
|
487
|
+
|
|
488
|
+
\u3053\u306E\u30B3\u30CD\u30AF\u30BF\u306E\u30D3\u30B8\u30CD\u30B9\u30ED\u30B8\u30C3\u30AF\u30BF\u30A4\u30D7\u306F "typescript" \u3067\u3059\u3002\u30CF\u30F3\u30C9\u30E9\u5185\u3067\u306F\u30B3\u30CD\u30AF\u30BFSDK\u3092\u4F7F\u7528\u3057\u3066\u304F\u3060\u3055\u3044\u3002\u74B0\u5883\u5909\u6570\u304B\u3089\u8A8D\u8A3C\u60C5\u5831\u3092\u8AAD\u307F\u53D6\u3089\u306A\u3044\u3067\u304F\u3060\u3055\u3044\u3002
|
|
489
|
+
|
|
490
|
+
SDK\u30E1\u30BD\u30C3\u30C9 (\`connection(connectionId)\` \u3067\u4F5C\u6210\u3057\u305F\u30AF\u30E9\u30A4\u30A2\u30F3\u30C8):
|
|
491
|
+
- \`client.request(path, init?)\` \u2014 \u4F4E\u30EC\u30D9\u30EB\u306E\u8A8D\u8A3C\u4ED8\u304Dfetch
|
|
492
|
+
- \`client.getLists(options?)\` \u2014 \u5168\u30AA\u30FC\u30C7\u30A3\u30A8\u30F3\u30B9/\u30EA\u30B9\u30C8\u306E\u4E00\u89A7
|
|
493
|
+
- \`client.getListMembers(listId, options?)\` \u2014 \u30EA\u30B9\u30C8\u306E\u30E1\u30F3\u30D0\u30FC\u53D6\u5F97
|
|
494
|
+
- \`client.getCampaigns(options?)\` \u2014 \u5168\u30AD\u30E3\u30F3\u30DA\u30FC\u30F3\u306E\u4E00\u89A7
|
|
495
|
+
- \`client.getReports(options?)\` \u2014 \u30AD\u30E3\u30F3\u30DA\u30FC\u30F3\u30EC\u30DD\u30FC\u30C8\u306E\u53D6\u5F97
|
|
496
|
+
|
|
497
|
+
\`\`\`ts
|
|
498
|
+
import type { Context } from "hono";
|
|
499
|
+
import { connection } from "@squadbase/vite-server/connectors/mailchimp";
|
|
500
|
+
|
|
501
|
+
const mailchimp = connection("<connectionId>");
|
|
502
|
+
|
|
503
|
+
export default async function handler(c: Context) {
|
|
504
|
+
const { count = 10, offset = 0 } = await c.req.json<{
|
|
505
|
+
count?: number;
|
|
506
|
+
offset?: number;
|
|
507
|
+
}>();
|
|
508
|
+
|
|
509
|
+
const { lists, total_items } = await mailchimp.getLists({ count, offset });
|
|
510
|
+
|
|
511
|
+
return c.json({ lists, total_items });
|
|
512
|
+
}
|
|
513
|
+
\`\`\`
|
|
514
|
+
|
|
515
|
+
### Mailchimp Marketing API v3 \u30EA\u30D5\u30A1\u30EC\u30F3\u30B9
|
|
516
|
+
|
|
517
|
+
- \u30D9\u30FC\u30B9URL: \`https://{dc}.api.mailchimp.com/3.0\`\uFF08\u30C7\u30FC\u30BF\u30BB\u30F3\u30BF\u30FC\u306FAPI\u30AD\u30FC\u304B\u3089\u81EA\u52D5\u691C\u51FA\uFF09
|
|
518
|
+
- \u8A8D\u8A3C: Basic Auth (\`anystring:{apiKey}\`)
|
|
519
|
+
- \u30DA\u30FC\u30B8\u30CD\u30FC\u30B7\u30E7\u30F3: \`count\`\uFF08\u30C7\u30D5\u30A9\u30EB\u30C810\u3001\u6700\u59271000\uFF09\u3068\`offset\`\u30D1\u30E9\u30E1\u30FC\u30BF\u306B\u3088\u308B\u30AA\u30D5\u30BB\u30C3\u30C8\u30D9\u30FC\u30B9
|
|
520
|
+
|
|
521
|
+
#### \u30AA\u30FC\u30C7\u30A3\u30A8\u30F3\u30B9 / \u30EA\u30B9\u30C8
|
|
522
|
+
- GET \`/lists\` \u2014 \u5168\u30AA\u30FC\u30C7\u30A3\u30A8\u30F3\u30B9\u306E\u4E00\u89A7
|
|
523
|
+
- GET \`/lists/{list_id}\` \u2014 \u30AA\u30FC\u30C7\u30A3\u30A8\u30F3\u30B9\u306E\u8A73\u7D30
|
|
524
|
+
- POST \`/lists\` \u2014 \u30AA\u30FC\u30C7\u30A3\u30A8\u30F3\u30B9\u306E\u4F5C\u6210
|
|
525
|
+
- PATCH \`/lists/{list_id}\` \u2014 \u30AA\u30FC\u30C7\u30A3\u30A8\u30F3\u30B9\u306E\u66F4\u65B0
|
|
526
|
+
- DELETE \`/lists/{list_id}\` \u2014 \u30AA\u30FC\u30C7\u30A3\u30A8\u30F3\u30B9\u306E\u524A\u9664
|
|
527
|
+
|
|
528
|
+
#### \u30E1\u30F3\u30D0\u30FC / \u30B5\u30D6\u30B9\u30AF\u30E9\u30A4\u30D0\u30FC
|
|
529
|
+
- GET \`/lists/{list_id}/members\` \u2014 \u30AA\u30FC\u30C7\u30A3\u30A8\u30F3\u30B9\u306E\u30E1\u30F3\u30D0\u30FC\u4E00\u89A7
|
|
530
|
+
- GET \`/lists/{list_id}/members/{subscriber_hash}\` \u2014 \u30E1\u30F3\u30D0\u30FC\u306E\u8A73\u7D30\uFF08subscriber_hash = \u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9\u5C0F\u6587\u5B57\u306EMD5\uFF09
|
|
531
|
+
- POST \`/lists/{list_id}/members\` \u2014 \u30E1\u30F3\u30D0\u30FC\u306E\u8FFD\u52A0
|
|
532
|
+
- PUT \`/lists/{list_id}/members/{subscriber_hash}\` \u2014 \u30E1\u30F3\u30D0\u30FC\u306E\u8FFD\u52A0\u307E\u305F\u306F\u66F4\u65B0
|
|
533
|
+
- PATCH \`/lists/{list_id}/members/{subscriber_hash}\` \u2014 \u30E1\u30F3\u30D0\u30FC\u306E\u66F4\u65B0
|
|
534
|
+
- DELETE \`/lists/{list_id}/members/{subscriber_hash}\` \u2014 \u30E1\u30F3\u30D0\u30FC\u306E\u30A2\u30FC\u30AB\u30A4\u30D6
|
|
535
|
+
|
|
536
|
+
#### \u30AD\u30E3\u30F3\u30DA\u30FC\u30F3
|
|
537
|
+
- GET \`/campaigns\` \u2014 \u30AD\u30E3\u30F3\u30DA\u30FC\u30F3\u4E00\u89A7
|
|
538
|
+
- GET \`/campaigns/{campaign_id}\` \u2014 \u30AD\u30E3\u30F3\u30DA\u30FC\u30F3\u306E\u8A73\u7D30
|
|
539
|
+
- POST \`/campaigns\` \u2014 \u30AD\u30E3\u30F3\u30DA\u30FC\u30F3\u306E\u4F5C\u6210
|
|
540
|
+
- PATCH \`/campaigns/{campaign_id}\` \u2014 \u30AD\u30E3\u30F3\u30DA\u30FC\u30F3\u306E\u66F4\u65B0
|
|
541
|
+
- DELETE \`/campaigns/{campaign_id}\` \u2014 \u30AD\u30E3\u30F3\u30DA\u30FC\u30F3\u306E\u524A\u9664
|
|
542
|
+
- POST \`/campaigns/{campaign_id}/actions/send\` \u2014 \u30AD\u30E3\u30F3\u30DA\u30FC\u30F3\u306E\u9001\u4FE1
|
|
543
|
+
- GET \`/campaigns/{campaign_id}/content\` \u2014 \u30AD\u30E3\u30F3\u30DA\u30FC\u30F3\u30B3\u30F3\u30C6\u30F3\u30C4\u306E\u53D6\u5F97
|
|
544
|
+
|
|
545
|
+
#### \u30C6\u30F3\u30D7\u30EC\u30FC\u30C8
|
|
546
|
+
- GET \`/templates\` \u2014 \u30C6\u30F3\u30D7\u30EC\u30FC\u30C8\u4E00\u89A7
|
|
547
|
+
- GET \`/templates/{template_id}\` \u2014 \u30C6\u30F3\u30D7\u30EC\u30FC\u30C8\u306E\u8A73\u7D30
|
|
548
|
+
- POST \`/templates\` \u2014 \u30C6\u30F3\u30D7\u30EC\u30FC\u30C8\u306E\u4F5C\u6210
|
|
549
|
+
- PATCH \`/templates/{template_id}\` \u2014 \u30C6\u30F3\u30D7\u30EC\u30FC\u30C8\u306E\u66F4\u65B0
|
|
550
|
+
- DELETE \`/templates/{template_id}\` \u2014 \u30C6\u30F3\u30D7\u30EC\u30FC\u30C8\u306E\u524A\u9664
|
|
551
|
+
|
|
552
|
+
#### \u30AA\u30FC\u30C8\u30E1\u30FC\u30B7\u30E7\u30F3
|
|
553
|
+
- GET \`/automations\` \u2014 \u30AA\u30FC\u30C8\u30E1\u30FC\u30B7\u30E7\u30F3\u4E00\u89A7
|
|
554
|
+
- GET \`/automations/{workflow_id}\` \u2014 \u30AA\u30FC\u30C8\u30E1\u30FC\u30B7\u30E7\u30F3\u306E\u8A73\u7D30
|
|
555
|
+
- GET \`/automations/{workflow_id}/emails\` \u2014 \u30AA\u30FC\u30C8\u30E1\u30FC\u30B7\u30E7\u30F3\u30E1\u30FC\u30EB\u4E00\u89A7
|
|
556
|
+
- POST \`/automations/{workflow_id}/actions/pause-all-emails\` \u2014 \u30AA\u30FC\u30C8\u30E1\u30FC\u30B7\u30E7\u30F3\u306E\u4E00\u6642\u505C\u6B62
|
|
557
|
+
- POST \`/automations/{workflow_id}/actions/start-all-emails\` \u2014 \u30AA\u30FC\u30C8\u30E1\u30FC\u30B7\u30E7\u30F3\u306E\u958B\u59CB
|
|
558
|
+
|
|
559
|
+
#### \u30EC\u30DD\u30FC\u30C8
|
|
560
|
+
- GET \`/reports\` \u2014 \u30AD\u30E3\u30F3\u30DA\u30FC\u30F3\u30EC\u30DD\u30FC\u30C8\u4E00\u89A7
|
|
561
|
+
- GET \`/reports/{campaign_id}\` \u2014 \u30AD\u30E3\u30F3\u30DA\u30FC\u30F3\u30EC\u30DD\u30FC\u30C8\u306E\u53D6\u5F97
|
|
562
|
+
- GET \`/reports/{campaign_id}/click-details\` \u2014 \u30AF\u30EA\u30C3\u30AF\u8A73\u7D30
|
|
563
|
+
- GET \`/reports/{campaign_id}/open-details\` \u2014 \u958B\u5C01\u8A73\u7D30
|
|
564
|
+
- GET \`/reports/{campaign_id}/sent-to\` \u2014 \u9001\u4FE1\u5148\u8A73\u7D30
|
|
565
|
+
- GET \`/reports/{campaign_id}/unsubscribed\` \u2014 \u914D\u4FE1\u505C\u6B62\u30E1\u30F3\u30D0\u30FC\u4E00\u89A7
|
|
566
|
+
|
|
567
|
+
#### \u691C\u7D22
|
|
568
|
+
- GET \`/search-members?query={query}\` \u2014 \u5168\u30AA\u30FC\u30C7\u30A3\u30A8\u30F3\u30B9\u306E\u30E1\u30F3\u30D0\u30FC\u691C\u7D22
|
|
569
|
+
|
|
570
|
+
#### \u30D0\u30C3\u30C1\u64CD\u4F5C
|
|
571
|
+
- POST \`/batches\` \u2014 \u30D0\u30C3\u30C1\u64CD\u4F5C\u306E\u958B\u59CB
|
|
572
|
+
- GET \`/batches\` \u2014 \u30D0\u30C3\u30C1\u64CD\u4F5C\u4E00\u89A7
|
|
573
|
+
- GET \`/batches/{batch_id}\` \u2014 \u30D0\u30C3\u30C1\u72B6\u614B\u306E\u53D6\u5F97
|
|
574
|
+
|
|
575
|
+
### \u30D2\u30F3\u30C8
|
|
576
|
+
- \`fields\`\u3068\`exclude_fields\`\u30AF\u30A8\u30EA\u30D1\u30E9\u30E1\u30FC\u30BF\u3067\u30EC\u30B9\u30DD\u30F3\u30B9\u30D5\u30A3\u30FC\u30EB\u30C9\u3092\u30D5\u30A3\u30EB\u30BF\u53EF\u80FD
|
|
577
|
+
- subscriber_hash\u306F\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9\u306E\u5C0F\u6587\u5B57\u306EMD5\u30CF\u30C3\u30B7\u30E5
|
|
578
|
+
- \u30A8\u30E9\u30FC\u306F\`type\`, \`title\`, \`status\`, \`detail\`, \`instance\`\u30D5\u30A3\u30FC\u30EB\u30C9\u3092\u8FD4\u5374`
|
|
579
|
+
},
|
|
580
|
+
tools
|
|
581
|
+
});
|
|
582
|
+
|
|
583
|
+
// src/connectors/create-connector-sdk.ts
|
|
584
|
+
import { readFileSync } from "fs";
|
|
585
|
+
import path from "path";
|
|
586
|
+
|
|
587
|
+
// src/connector-client/env.ts
|
|
588
|
+
function resolveEnvVar(entry, key, connectionId) {
|
|
589
|
+
const envVarName = entry.envVars[key];
|
|
590
|
+
if (!envVarName) {
|
|
591
|
+
throw new Error(`Connection "${connectionId}" is missing envVars mapping for key "${key}"`);
|
|
592
|
+
}
|
|
593
|
+
const value = process.env[envVarName];
|
|
594
|
+
if (!value) {
|
|
595
|
+
throw new Error(`Environment variable "${envVarName}" (for connection "${connectionId}", key "${key}") is not set`);
|
|
596
|
+
}
|
|
597
|
+
return value;
|
|
598
|
+
}
|
|
599
|
+
function resolveEnvVarOptional(entry, key) {
|
|
600
|
+
const envVarName = entry.envVars[key];
|
|
601
|
+
if (!envVarName) return void 0;
|
|
602
|
+
return process.env[envVarName] || void 0;
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
// src/connectors/create-connector-sdk.ts
|
|
606
|
+
function loadConnectionsSync() {
|
|
607
|
+
const filePath = process.env.CONNECTIONS_PATH ?? path.join(process.cwd(), ".squadbase/connections.json");
|
|
608
|
+
try {
|
|
609
|
+
const raw = readFileSync(filePath, "utf-8");
|
|
610
|
+
return JSON.parse(raw);
|
|
611
|
+
} catch {
|
|
612
|
+
return {};
|
|
613
|
+
}
|
|
614
|
+
}
|
|
615
|
+
function createConnectorSdk(plugin, createClient2) {
|
|
616
|
+
return (connectionId) => {
|
|
617
|
+
const connections = loadConnectionsSync();
|
|
618
|
+
const entry = connections[connectionId];
|
|
619
|
+
if (!entry) {
|
|
620
|
+
throw new Error(
|
|
621
|
+
`Connection "${connectionId}" not found in .squadbase/connections.json`
|
|
622
|
+
);
|
|
623
|
+
}
|
|
624
|
+
if (entry.connector.slug !== plugin.slug) {
|
|
625
|
+
throw new Error(
|
|
626
|
+
`Connection "${connectionId}" is not a ${plugin.slug} connection (got "${entry.connector.slug}")`
|
|
627
|
+
);
|
|
628
|
+
}
|
|
629
|
+
const params = {};
|
|
630
|
+
for (const param of Object.values(plugin.parameters)) {
|
|
631
|
+
if (param.required) {
|
|
632
|
+
params[param.slug] = resolveEnvVar(entry, param.slug, connectionId);
|
|
633
|
+
} else {
|
|
634
|
+
const val = resolveEnvVarOptional(entry, param.slug);
|
|
635
|
+
if (val !== void 0) params[param.slug] = val;
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
return createClient2(params);
|
|
639
|
+
};
|
|
640
|
+
}
|
|
641
|
+
|
|
642
|
+
// src/connectors/entries/mailchimp.ts
|
|
643
|
+
var connection = createConnectorSdk(mailchimpConnector, createClient);
|
|
644
|
+
export {
|
|
645
|
+
connection
|
|
646
|
+
};
|
|
@@ -293,9 +293,13 @@ var shopifyOauthConnector = new ConnectorPlugin({
|
|
|
293
293
|
]
|
|
294
294
|
},
|
|
295
295
|
systemPrompt: {
|
|
296
|
-
en: `###
|
|
296
|
+
en: `### Tools
|
|
297
297
|
|
|
298
|
-
|
|
298
|
+
- \`shopify-oauth_request\`: The only way to call the Shopify Admin REST API. Use it to query products, orders, customers, inventory, collections, and more. Authentication is configured automatically via OAuth proxy. Shopify uses cursor-based pagination via the \`page_info\` query parameter (obtained from the Link header in the response).
|
|
299
|
+
|
|
300
|
+
### Shopify Admin REST API Reference
|
|
301
|
+
|
|
302
|
+
#### Available Endpoints (API version: 2024-10)
|
|
299
303
|
- GET \`/admin/api/2024-10/shop.json\` \u2014 Get shop info
|
|
300
304
|
- GET \`/admin/api/2024-10/products.json\` \u2014 List products
|
|
301
305
|
- GET \`/admin/api/2024-10/products/{id}.json\` \u2014 Get a product
|
|
@@ -336,9 +340,13 @@ const shopify = connection("<connectionId>");
|
|
|
336
340
|
const res = await shopify.request("/admin/api/2024-10/products.json?limit=10");
|
|
337
341
|
const data = await res.json();
|
|
338
342
|
\`\`\``,
|
|
339
|
-
ja: `###
|
|
343
|
+
ja: `### \u30C4\u30FC\u30EB
|
|
344
|
+
|
|
345
|
+
- \`shopify-oauth_request\`: Shopify Admin REST API\u3092\u547C\u3073\u51FA\u3059\u552F\u4E00\u306E\u624B\u6BB5\u3067\u3059\u3002\u5546\u54C1\u3001\u6CE8\u6587\u3001\u9867\u5BA2\u3001\u5728\u5EAB\u3001\u30B3\u30EC\u30AF\u30B7\u30E7\u30F3\u306A\u3069\u306E\u30AF\u30A8\u30EA\u306B\u4F7F\u7528\u3057\u307E\u3059\u3002OAuth\u30D7\u30ED\u30AD\u30B7\u7D4C\u7531\u3067\u8A8D\u8A3C\u306F\u81EA\u52D5\u8A2D\u5B9A\u3055\u308C\u307E\u3059\u3002Shopify\u306F\u30EC\u30B9\u30DD\u30F3\u30B9\u306E Link \u30D8\u30C3\u30C0\u30FC\u304B\u3089\u53D6\u5F97\u3059\u308B \`page_info\` \u30AF\u30A8\u30EA\u30D1\u30E9\u30E1\u30FC\u30BF\u306B\u3088\u308B\u30AB\u30FC\u30BD\u30EB\u30D9\u30FC\u30B9\u306E\u30DA\u30FC\u30B8\u30CD\u30FC\u30B7\u30E7\u30F3\u3092\u4F7F\u7528\u3057\u307E\u3059\u3002
|
|
346
|
+
|
|
347
|
+
### Shopify Admin REST API \u30EA\u30D5\u30A1\u30EC\u30F3\u30B9
|
|
340
348
|
|
|
341
|
-
|
|
349
|
+
#### \u5229\u7528\u53EF\u80FD\u306A\u30A8\u30F3\u30C9\u30DD\u30A4\u30F3\u30C8 (API\u30D0\u30FC\u30B8\u30E7\u30F3: 2024-10)
|
|
342
350
|
- GET \`/admin/api/2024-10/shop.json\` \u2014 \u30B7\u30E7\u30C3\u30D7\u60C5\u5831\u3092\u53D6\u5F97
|
|
343
351
|
- GET \`/admin/api/2024-10/products.json\` \u2014 \u5546\u54C1\u4E00\u89A7\u3092\u53D6\u5F97
|
|
344
352
|
- GET \`/admin/api/2024-10/products/{id}.json\` \u2014 \u5546\u54C1\u3092\u53D6\u5F97
|