@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.
Files changed (46) hide show
  1. package/dist/cli/index.js +13609 -3797
  2. package/dist/connectors/airtable-oauth.js +12 -4
  3. package/dist/connectors/amplitude.js +335 -32
  4. package/dist/connectors/asana.d.ts +5 -0
  5. package/dist/connectors/asana.js +661 -0
  6. package/dist/connectors/attio.js +304 -36
  7. package/dist/connectors/customerio.d.ts +5 -0
  8. package/dist/connectors/customerio.js +633 -0
  9. package/dist/connectors/gmail-oauth.d.ts +5 -0
  10. package/dist/connectors/gmail-oauth.js +639 -0
  11. package/dist/connectors/google-ads-oauth.js +14 -8
  12. package/dist/connectors/google-ads.d.ts +5 -0
  13. package/dist/connectors/google-ads.js +784 -0
  14. package/dist/connectors/google-analytics-oauth.js +16 -8
  15. package/dist/connectors/google-sheets-oauth.js +12 -4
  16. package/dist/connectors/google-sheets.d.ts +5 -0
  17. package/dist/connectors/google-sheets.js +598 -0
  18. package/dist/connectors/hubspot-oauth.js +12 -4
  19. package/dist/connectors/hubspot.d.ts +5 -0
  20. package/dist/connectors/hubspot.js +550 -0
  21. package/dist/connectors/intercom-oauth.d.ts +5 -0
  22. package/dist/connectors/intercom-oauth.js +510 -0
  23. package/dist/connectors/intercom.d.ts +5 -0
  24. package/dist/connectors/intercom.js +627 -0
  25. package/dist/connectors/jira-api-key.d.ts +5 -0
  26. package/dist/connectors/jira-api-key.js +523 -0
  27. package/dist/connectors/kintone-api-token.js +16 -20
  28. package/dist/connectors/linkedin-ads-oauth.d.ts +5 -0
  29. package/dist/connectors/linkedin-ads-oauth.js +774 -0
  30. package/dist/connectors/linkedin-ads.d.ts +5 -0
  31. package/dist/connectors/linkedin-ads.js +782 -0
  32. package/dist/connectors/mailchimp-oauth.d.ts +5 -0
  33. package/dist/connectors/mailchimp-oauth.js +539 -0
  34. package/dist/connectors/mailchimp.d.ts +5 -0
  35. package/dist/connectors/mailchimp.js +646 -0
  36. package/dist/connectors/shopify-oauth.js +12 -4
  37. package/dist/connectors/shopify.js +500 -80
  38. package/dist/connectors/stripe-oauth.js +12 -4
  39. package/dist/connectors/zendesk-oauth.d.ts +5 -0
  40. package/dist/connectors/zendesk-oauth.js +505 -0
  41. package/dist/connectors/zendesk.d.ts +5 -0
  42. package/dist/connectors/zendesk.js +631 -0
  43. package/dist/index.js +13594 -3782
  44. package/dist/main.js +13596 -3784
  45. package/dist/vite-plugin.js +13596 -3784
  46. package/package.json +46 -2
@@ -0,0 +1,523 @@
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/jira/parameters.ts
46
+ var parameters = {
47
+ instanceUrl: new ParameterDefinition({
48
+ slug: "instance-url",
49
+ name: "Jira Instance URL",
50
+ description: "The base URL of your Jira Cloud instance (e.g., https://your-domain.atlassian.net).",
51
+ envVarBaseKey: "JIRA_INSTANCE_URL",
52
+ type: "text",
53
+ secret: false,
54
+ required: true
55
+ }),
56
+ email: new ParameterDefinition({
57
+ slug: "email",
58
+ name: "Email Address",
59
+ description: "The email address associated with your Atlassian account used for API authentication.",
60
+ envVarBaseKey: "JIRA_EMAIL",
61
+ type: "text",
62
+ secret: false,
63
+ required: true
64
+ }),
65
+ apiToken: new ParameterDefinition({
66
+ slug: "api-token",
67
+ name: "Jira API Token",
68
+ description: "API token for authentication. Generate from Atlassian Account Settings > Security > API tokens (https://id.atlassian.com/manage/api-tokens).",
69
+ envVarBaseKey: "JIRA_API_TOKEN",
70
+ type: "text",
71
+ secret: true,
72
+ required: true
73
+ })
74
+ };
75
+
76
+ // ../connectors/src/connectors/jira/sdk/index.ts
77
+ function createClient(params) {
78
+ const instanceUrl = params[parameters.instanceUrl.slug];
79
+ const email = params[parameters.email.slug];
80
+ const apiToken = params[parameters.apiToken.slug];
81
+ if (!instanceUrl || !email || !apiToken) {
82
+ const required = [
83
+ parameters.instanceUrl.slug,
84
+ parameters.email.slug,
85
+ parameters.apiToken.slug
86
+ ];
87
+ const missing = required.filter((s) => !params[s]);
88
+ throw new Error(
89
+ `jira: missing required parameters: ${missing.join(", ")}`
90
+ );
91
+ }
92
+ const credentials = Buffer.from(`${email}:${apiToken}`).toString("base64");
93
+ return {
94
+ request(path2, init) {
95
+ const url = `${instanceUrl.replace(/\/+$/, "")}${path2}`;
96
+ const headers = new Headers(init?.headers);
97
+ headers.set("Authorization", `Basic ${credentials}`);
98
+ headers.set("Accept", "application/json");
99
+ if (init?.body) {
100
+ headers.set("Content-Type", "application/json");
101
+ }
102
+ return fetch(url, { ...init, headers });
103
+ }
104
+ };
105
+ }
106
+
107
+ // ../connectors/src/connector-onboarding.ts
108
+ var ConnectorOnboarding = class {
109
+ /** Phase 1: Connection setup instructions (optional — some connectors don't need this) */
110
+ connectionSetupInstructions;
111
+ /** Phase 2: Data overview instructions */
112
+ dataOverviewInstructions;
113
+ constructor(config) {
114
+ this.connectionSetupInstructions = config.connectionSetupInstructions;
115
+ this.dataOverviewInstructions = config.dataOverviewInstructions;
116
+ }
117
+ getConnectionSetupPrompt(language) {
118
+ return this.connectionSetupInstructions?.[language] ?? null;
119
+ }
120
+ getDataOverviewInstructions(language) {
121
+ return this.dataOverviewInstructions[language];
122
+ }
123
+ };
124
+
125
+ // ../connectors/src/connector-tool.ts
126
+ var ConnectorTool = class {
127
+ name;
128
+ description;
129
+ inputSchema;
130
+ outputSchema;
131
+ _execute;
132
+ constructor(config) {
133
+ this.name = config.name;
134
+ this.description = config.description;
135
+ this.inputSchema = config.inputSchema;
136
+ this.outputSchema = config.outputSchema;
137
+ this._execute = config.execute;
138
+ }
139
+ createTool(connections, config) {
140
+ return {
141
+ description: this.description,
142
+ inputSchema: this.inputSchema,
143
+ outputSchema: this.outputSchema,
144
+ execute: (input) => this._execute(input, connections, config)
145
+ };
146
+ }
147
+ };
148
+
149
+ // ../connectors/src/connector-plugin.ts
150
+ var ConnectorPlugin = class _ConnectorPlugin {
151
+ slug;
152
+ authType;
153
+ name;
154
+ description;
155
+ iconUrl;
156
+ parameters;
157
+ releaseFlag;
158
+ proxyPolicy;
159
+ experimentalAttributes;
160
+ onboarding;
161
+ systemPrompt;
162
+ tools;
163
+ query;
164
+ checkConnection;
165
+ constructor(config) {
166
+ this.slug = config.slug;
167
+ this.authType = config.authType;
168
+ this.name = config.name;
169
+ this.description = config.description;
170
+ this.iconUrl = config.iconUrl;
171
+ this.parameters = config.parameters;
172
+ this.releaseFlag = config.releaseFlag;
173
+ this.proxyPolicy = config.proxyPolicy;
174
+ this.experimentalAttributes = config.experimentalAttributes;
175
+ this.onboarding = config.onboarding;
176
+ this.systemPrompt = config.systemPrompt;
177
+ this.tools = config.tools;
178
+ this.query = config.query;
179
+ this.checkConnection = config.checkConnection;
180
+ }
181
+ get connectorKey() {
182
+ return _ConnectorPlugin.deriveKey(this.slug, this.authType);
183
+ }
184
+ /**
185
+ * Create tools for connections that belong to this connector.
186
+ * Filters connections by connectorKey internally.
187
+ * Returns tools keyed as `${connectorKey}_${toolName}`.
188
+ */
189
+ createTools(connections, config) {
190
+ const myConnections = connections.filter(
191
+ (c) => _ConnectorPlugin.deriveKey(c.connector.slug, c.connector.authType) === this.connectorKey
192
+ );
193
+ const result = {};
194
+ for (const t of Object.values(this.tools)) {
195
+ result[`${this.connectorKey}_${t.name}`] = t.createTool(
196
+ myConnections,
197
+ config
198
+ );
199
+ }
200
+ return result;
201
+ }
202
+ static deriveKey(slug, authType) {
203
+ return authType ? `${slug}-${authType}` : slug;
204
+ }
205
+ };
206
+
207
+ // ../connectors/src/auth-types.ts
208
+ var AUTH_TYPES = {
209
+ OAUTH: "oauth",
210
+ API_KEY: "api-key",
211
+ JWT: "jwt",
212
+ SERVICE_ACCOUNT: "service-account",
213
+ PAT: "pat"
214
+ };
215
+
216
+ // ../connectors/src/connectors/jira/setup.ts
217
+ var jiraOnboarding = new ConnectorOnboarding({
218
+ dataOverviewInstructions: {
219
+ en: `1. Call jira-api-key_request with GET project to list all accessible projects
220
+ 2. For key projects, call jira-api-key_request with POST search to search issues using JQL (e.g., body: { "jql": "project = PROJ order by created DESC", "maxResults": 5, "fields": ["summary", "status", "assignee", "priority", "created"] })
221
+ 3. Call jira-api-key_request with GET issue/{issueKey} to inspect a sample issue's full details`,
222
+ ja: `1. jira-api-key_request \u3067 GET project \u3092\u547C\u3073\u51FA\u3057\u3001\u30A2\u30AF\u30BB\u30B9\u53EF\u80FD\u306A\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u4E00\u89A7\u3092\u53D6\u5F97
223
+ 2. \u4E3B\u8981\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u306B\u3064\u3044\u3066 jira-api-key_request \u3067 POST search \u3092\u4F7F\u7528\u3057\u3066JQL\u3067\u30A4\u30B7\u30E5\u30FC\u3092\u691C\u7D22\uFF08\u4F8B: body: { "jql": "project = PROJ order by created DESC", "maxResults": 5, "fields": ["summary", "status", "assignee", "priority", "created"] }\uFF09
224
+ 3. jira-api-key_request \u3067 GET issue/{issueKey} \u3092\u547C\u3073\u51FA\u3057\u3001\u30B5\u30F3\u30D7\u30EB\u30A4\u30B7\u30E5\u30FC\u306E\u8A73\u7D30\u3092\u78BA\u8A8D`
225
+ }
226
+ });
227
+
228
+ // ../connectors/src/connectors/jira/tools/request.ts
229
+ import { z } from "zod";
230
+ var REQUEST_TIMEOUT_MS = 6e4;
231
+ var inputSchema = z.object({
232
+ toolUseIntent: z.string().optional().describe("Brief description of what you intend to accomplish with this tool call"),
233
+ connectionId: z.string().describe("ID of the Jira connection to use"),
234
+ method: z.enum(["GET", "POST", "PUT", "DELETE"]).describe("HTTP method. Use GET to read resources, POST to create or search, PUT to update, DELETE to remove."),
235
+ path: z.string().describe("API path relative to /rest/api/3/ (e.g., 'project', 'search', 'issue/PROJ-123'). Query parameters can be appended (e.g., 'project?maxResults=50')."),
236
+ body: z.record(z.string(), z.unknown()).optional().describe("Request body as JSON object. Required for POST and PUT requests (e.g., issue creation, JQL search).")
237
+ });
238
+ var outputSchema = z.discriminatedUnion("success", [
239
+ z.object({
240
+ success: z.literal(true),
241
+ status: z.number(),
242
+ data: z.record(z.string(), z.unknown())
243
+ }),
244
+ z.object({
245
+ success: z.literal(false),
246
+ error: z.string()
247
+ })
248
+ ]);
249
+ var requestTool = new ConnectorTool({
250
+ name: "request",
251
+ description: `Send authenticated requests to the Jira Cloud REST API (v3).
252
+ Authentication is handled automatically using Basic Auth (email + API token).
253
+ Use this tool for all Jira operations: listing projects, searching issues with JQL, creating/updating issues, managing transitions, and adding comments.
254
+ The base URL and authentication credentials are configured per connection \u2014 only specify the API path relative to /rest/api/3/.`,
255
+ inputSchema,
256
+ outputSchema,
257
+ async execute({ connectionId, method, path: path2, body }, connections) {
258
+ const connection2 = connections.find((c) => c.id === connectionId);
259
+ if (!connection2) {
260
+ return { success: false, error: `Connection ${connectionId} not found` };
261
+ }
262
+ console.log(`[connector-request] jira-api-key/${connection2.name}: ${method} ${path2}`);
263
+ try {
264
+ const instanceUrl = parameters.instanceUrl.getValue(connection2);
265
+ const email = parameters.email.getValue(connection2);
266
+ const apiToken = parameters.apiToken.getValue(connection2);
267
+ const baseUrl = `${instanceUrl.replace(/\/+$/, "")}/rest/api/3/${path2}`;
268
+ const credentials = Buffer.from(`${email}:${apiToken}`).toString("base64");
269
+ const controller = new AbortController();
270
+ const timeout = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS);
271
+ try {
272
+ const headers = {
273
+ Authorization: `Basic ${credentials}`,
274
+ Accept: "application/json"
275
+ };
276
+ if (body) {
277
+ headers["Content-Type"] = "application/json";
278
+ }
279
+ const response = await fetch(baseUrl, {
280
+ method,
281
+ headers,
282
+ body: body ? JSON.stringify(body) : void 0,
283
+ signal: controller.signal
284
+ });
285
+ if (response.status === 204) {
286
+ return { success: true, status: 204, data: {} };
287
+ }
288
+ const data = await response.json();
289
+ if (!response.ok) {
290
+ const errorMessages = Array.isArray(data?.errorMessages) ? data.errorMessages.join("; ") : data?.message ?? `HTTP ${response.status} ${response.statusText}`;
291
+ return { success: false, error: errorMessages };
292
+ }
293
+ return { success: true, status: response.status, data };
294
+ } finally {
295
+ clearTimeout(timeout);
296
+ }
297
+ } catch (err) {
298
+ const msg = err instanceof Error ? err.message : String(err);
299
+ return { success: false, error: msg };
300
+ }
301
+ }
302
+ });
303
+
304
+ // ../connectors/src/connectors/jira/index.ts
305
+ var tools = { request: requestTool };
306
+ var jiraConnector = new ConnectorPlugin({
307
+ slug: "jira",
308
+ authType: AUTH_TYPES.API_KEY,
309
+ name: "Jira (API Key)",
310
+ description: "Connect to Jira Cloud for issue tracking, project management, and workflow data retrieval using API token authentication.",
311
+ iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/3IsIFg5im7VjMxGh1K1j6P/a3be559bdca30e5497dd55a2f4ee66f0/jira.png",
312
+ parameters,
313
+ releaseFlag: { dev1: true, dev2: false, prod: false },
314
+ onboarding: jiraOnboarding,
315
+ systemPrompt: {
316
+ en: `### Tools
317
+
318
+ - \`jira-api-key_request\`: The only way to call the Jira Cloud REST API (v3). Use it to list projects, search issues with JQL, get issue details, create/update issues, manage transitions, and add comments. Authentication (Basic Auth with email + API token) and instance URL are configured automatically.
319
+
320
+ ### Business Logic
321
+
322
+ The business logic type for this connector is "typescript". Write handler code using the connector SDK shown below. Do NOT access credentials directly from environment variables.
323
+
324
+ #### Example
325
+
326
+ \`\`\`ts
327
+ import { connection } from "@squadbase/vite-server/connectors/jira-api-key";
328
+
329
+ const jira = connection("<connectionId>");
330
+
331
+ // Search issues with JQL
332
+ const res = await jira.request("/rest/api/3/search?jql=project=PROJ&maxResults=10");
333
+ const data = await res.json();
334
+
335
+ // Create an issue
336
+ await jira.request("/rest/api/3/issue", {
337
+ method: "POST",
338
+ body: JSON.stringify({
339
+ fields: {
340
+ project: { key: "PROJ" },
341
+ summary: "New issue title",
342
+ issuetype: { name: "Task" },
343
+ },
344
+ }),
345
+ });
346
+ \`\`\`
347
+
348
+ ### Jira Cloud REST API v3 Reference
349
+
350
+ #### List Projects
351
+ - GET project
352
+ - Query params: maxResults, startAt, expand
353
+
354
+ #### Search Issues (JQL)
355
+ - POST search
356
+ - Body: { "jql": "project = PROJ AND status = 'In Progress'", "maxResults": 50, "startAt": 0, "fields": ["summary", "status", "assignee", "priority"] }
357
+ - Supports pagination via startAt and maxResults
358
+
359
+ #### Get Issue
360
+ - GET issue/{issueIdOrKey}
361
+ - Query params: fields, expand
362
+
363
+ #### Create Issue
364
+ - POST issue
365
+ - Body: { "fields": { "project": { "key": "PROJ" }, "summary": "Title", "description": { "type": "doc", "version": 1, "content": [...] }, "issuetype": { "name": "Task" } } }
366
+ - Description uses Atlassian Document Format (ADF)
367
+
368
+ #### Update Issue
369
+ - PUT issue/{issueIdOrKey}
370
+ - Body: { "fields": { "summary": "Updated title" } }
371
+
372
+ #### Transition Issue
373
+ - POST issue/{issueIdOrKey}/transitions (list available transitions with GET)
374
+ - Body: { "transition": { "id": "31" } }
375
+
376
+ #### Add Comment
377
+ - POST issue/{issueIdOrKey}/comment
378
+ - Body: { "body": { "type": "doc", "version": 1, "content": [{ "type": "paragraph", "content": [{ "type": "text", "text": "Comment text" }] }] } }
379
+
380
+ #### JQL Syntax
381
+ - Comparison: project = "PROJ", status = "Done", assignee = "user@example.com"
382
+ - Operators: AND, OR, NOT, IN, IS, IS NOT
383
+ - Order: ORDER BY created DESC
384
+ - Functions: currentUser(), startOfDay(), endOfWeek()
385
+ - Text search: summary ~ "keyword"`,
386
+ ja: `### \u30C4\u30FC\u30EB
387
+
388
+ - \`jira-api-key_request\`: Jira Cloud REST API\uFF08v3\uFF09\u3092\u547C\u3073\u51FA\u3059\u552F\u4E00\u306E\u624B\u6BB5\u3067\u3059\u3002\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u4E00\u89A7\u306E\u53D6\u5F97\u3001JQL\u306B\u3088\u308B\u30A4\u30B7\u30E5\u30FC\u691C\u7D22\u3001\u30A4\u30B7\u30E5\u30FC\u8A73\u7D30\u306E\u53D6\u5F97\u3001\u30A4\u30B7\u30E5\u30FC\u306E\u4F5C\u6210\u30FB\u66F4\u65B0\u3001\u30C8\u30E9\u30F3\u30B8\u30B7\u30E7\u30F3\u7BA1\u7406\u3001\u30B3\u30E1\u30F3\u30C8\u8FFD\u52A0\u306B\u4F7F\u7528\u3057\u307E\u3059\u3002\u8A8D\u8A3C\uFF08Basic Auth: \u30E1\u30FC\u30EB + API\u30C8\u30FC\u30AF\u30F3\uFF09\u3068\u30A4\u30F3\u30B9\u30BF\u30F3\u30B9URL\u306F\u81EA\u52D5\u7684\u306B\u8A2D\u5B9A\u3055\u308C\u307E\u3059\u3002
389
+
390
+ ### Business Logic
391
+
392
+ \u3053\u306E\u30B3\u30CD\u30AF\u30BF\u306E\u30D3\u30B8\u30CD\u30B9\u30ED\u30B8\u30C3\u30AF\u30BF\u30A4\u30D7\u306F "typescript" \u3067\u3059\u3002\u4EE5\u4E0B\u306B\u793A\u3059\u30B3\u30CD\u30AF\u30BFSDK\u3092\u4F7F\u7528\u3057\u3066\u30CF\u30F3\u30C9\u30E9\u30B3\u30FC\u30C9\u3092\u8A18\u8FF0\u3057\u3066\u304F\u3060\u3055\u3044\u3002\u74B0\u5883\u5909\u6570\u304B\u3089\u76F4\u63A5\u8A8D\u8A3C\u60C5\u5831\u306B\u30A2\u30AF\u30BB\u30B9\u3057\u306A\u3044\u3067\u304F\u3060\u3055\u3044\u3002
393
+
394
+ #### Example
395
+
396
+ \`\`\`ts
397
+ import { connection } from "@squadbase/vite-server/connectors/jira-api-key";
398
+
399
+ const jira = connection("<connectionId>");
400
+
401
+ // JQL\u3067\u30A4\u30B7\u30E5\u30FC\u3092\u691C\u7D22
402
+ const res = await jira.request("/rest/api/3/search?jql=project=PROJ&maxResults=10");
403
+ const data = await res.json();
404
+
405
+ // \u30A4\u30B7\u30E5\u30FC\u3092\u4F5C\u6210
406
+ await jira.request("/rest/api/3/issue", {
407
+ method: "POST",
408
+ body: JSON.stringify({
409
+ fields: {
410
+ project: { key: "PROJ" },
411
+ summary: "\u65B0\u3057\u3044\u30A4\u30B7\u30E5\u30FC",
412
+ issuetype: { name: "Task" },
413
+ },
414
+ }),
415
+ });
416
+ \`\`\`
417
+
418
+ ### Jira Cloud REST API v3 \u30EA\u30D5\u30A1\u30EC\u30F3\u30B9
419
+
420
+ #### \u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u4E00\u89A7\u306E\u53D6\u5F97
421
+ - GET project
422
+ - \u30AF\u30A8\u30EA\u30D1\u30E9\u30E1\u30FC\u30BF: maxResults, startAt, expand
423
+
424
+ #### \u30A4\u30B7\u30E5\u30FC\u691C\u7D22\uFF08JQL\uFF09
425
+ - POST search
426
+ - Body: { "jql": "project = PROJ AND status = 'In Progress'", "maxResults": 50, "startAt": 0, "fields": ["summary", "status", "assignee", "priority"] }
427
+ - startAt \u3068 maxResults \u3067\u30DA\u30FC\u30B8\u30CD\u30FC\u30B7\u30E7\u30F3\u53EF\u80FD
428
+
429
+ #### \u30A4\u30B7\u30E5\u30FC\u306E\u53D6\u5F97
430
+ - GET issue/{issueIdOrKey}
431
+ - \u30AF\u30A8\u30EA\u30D1\u30E9\u30E1\u30FC\u30BF: fields, expand
432
+
433
+ #### \u30A4\u30B7\u30E5\u30FC\u306E\u4F5C\u6210
434
+ - POST issue
435
+ - Body: { "fields": { "project": { "key": "PROJ" }, "summary": "\u30BF\u30A4\u30C8\u30EB", "description": { "type": "doc", "version": 1, "content": [...] }, "issuetype": { "name": "Task" } } }
436
+ - description \u306F Atlassian Document Format (ADF) \u3092\u4F7F\u7528
437
+
438
+ #### \u30A4\u30B7\u30E5\u30FC\u306E\u66F4\u65B0
439
+ - PUT issue/{issueIdOrKey}
440
+ - Body: { "fields": { "summary": "\u66F4\u65B0\u3055\u308C\u305F\u30BF\u30A4\u30C8\u30EB" } }
441
+
442
+ #### \u30C8\u30E9\u30F3\u30B8\u30B7\u30E7\u30F3\u306E\u5B9F\u884C
443
+ - POST issue/{issueIdOrKey}/transitions\uFF08\u5229\u7528\u53EF\u80FD\u306A\u30C8\u30E9\u30F3\u30B8\u30B7\u30E7\u30F3\u306FGET\u3067\u53D6\u5F97\uFF09
444
+ - Body: { "transition": { "id": "31" } }
445
+
446
+ #### \u30B3\u30E1\u30F3\u30C8\u306E\u8FFD\u52A0
447
+ - POST issue/{issueIdOrKey}/comment
448
+ - Body: { "body": { "type": "doc", "version": 1, "content": [{ "type": "paragraph", "content": [{ "type": "text", "text": "\u30B3\u30E1\u30F3\u30C8\u5185\u5BB9" }] }] } }
449
+
450
+ #### JQL \u69CB\u6587
451
+ - \u6BD4\u8F03: project = "PROJ", status = "Done", assignee = "user@example.com"
452
+ - \u6F14\u7B97\u5B50: AND, OR, NOT, IN, IS, IS NOT
453
+ - \u30BD\u30FC\u30C8: ORDER BY created DESC
454
+ - \u95A2\u6570: currentUser(), startOfDay(), endOfWeek()
455
+ - \u30C6\u30AD\u30B9\u30C8\u691C\u7D22: summary ~ "\u30AD\u30FC\u30EF\u30FC\u30C9"`
456
+ },
457
+ tools
458
+ });
459
+
460
+ // src/connectors/create-connector-sdk.ts
461
+ import { readFileSync } from "fs";
462
+ import path from "path";
463
+
464
+ // src/connector-client/env.ts
465
+ function resolveEnvVar(entry, key, connectionId) {
466
+ const envVarName = entry.envVars[key];
467
+ if (!envVarName) {
468
+ throw new Error(`Connection "${connectionId}" is missing envVars mapping for key "${key}"`);
469
+ }
470
+ const value = process.env[envVarName];
471
+ if (!value) {
472
+ throw new Error(`Environment variable "${envVarName}" (for connection "${connectionId}", key "${key}") is not set`);
473
+ }
474
+ return value;
475
+ }
476
+ function resolveEnvVarOptional(entry, key) {
477
+ const envVarName = entry.envVars[key];
478
+ if (!envVarName) return void 0;
479
+ return process.env[envVarName] || void 0;
480
+ }
481
+
482
+ // src/connectors/create-connector-sdk.ts
483
+ function loadConnectionsSync() {
484
+ const filePath = process.env.CONNECTIONS_PATH ?? path.join(process.cwd(), ".squadbase/connections.json");
485
+ try {
486
+ const raw = readFileSync(filePath, "utf-8");
487
+ return JSON.parse(raw);
488
+ } catch {
489
+ return {};
490
+ }
491
+ }
492
+ function createConnectorSdk(plugin, createClient2) {
493
+ return (connectionId) => {
494
+ const connections = loadConnectionsSync();
495
+ const entry = connections[connectionId];
496
+ if (!entry) {
497
+ throw new Error(
498
+ `Connection "${connectionId}" not found in .squadbase/connections.json`
499
+ );
500
+ }
501
+ if (entry.connector.slug !== plugin.slug) {
502
+ throw new Error(
503
+ `Connection "${connectionId}" is not a ${plugin.slug} connection (got "${entry.connector.slug}")`
504
+ );
505
+ }
506
+ const params = {};
507
+ for (const param of Object.values(plugin.parameters)) {
508
+ if (param.required) {
509
+ params[param.slug] = resolveEnvVar(entry, param.slug, connectionId);
510
+ } else {
511
+ const val = resolveEnvVarOptional(entry, param.slug);
512
+ if (val !== void 0) params[param.slug] = val;
513
+ }
514
+ }
515
+ return createClient2(params);
516
+ };
517
+ }
518
+
519
+ // src/connectors/entries/jira-api-key.ts
520
+ var connection = createConnectorSdk(jiraConnector, createClient);
521
+ export {
522
+ connection
523
+ };
@@ -288,12 +288,13 @@ var kintoneApiTokenConnector = new ConnectorPlugin({
288
288
  releaseFlag: { dev1: true, dev2: false, prod: false },
289
289
  onboarding: kintoneApiTokenOnboarding,
290
290
  systemPrompt: {
291
- en: `### kintone REST API (API Token)
292
- - Call the kintone REST API using the authenticated request tool
293
- - The base URL (e.g., https://example.cybozu.com) is automatically resolved
294
- - Authentication uses the kintone API token (scoped to specific apps)
291
+ en: `### Tools
295
292
 
296
- ### List Apps
293
+ - \`kintone-api-key_request\`: The only way to call the kintone REST API. Use it to list apps, get field definitions, query records, and create/update records. Authentication (API Token) and base URL are configured automatically. API tokens are scoped per app \u2014 combine multiple tokens with commas to access multiple apps.
294
+
295
+ ### kintone REST API Reference
296
+
297
+ #### List Apps
297
298
  - GET apps.json
298
299
 
299
300
  ### Get Field Definitions
@@ -303,20 +304,17 @@ var kintoneApiTokenConnector = new ConnectorPlugin({
303
304
  - GET records.json?app={appId}&query={query}
304
305
  - Query example: records.json?app=1&query=updatedTime > "2024-01-01" order by recordNumber asc limit 100
305
306
 
306
- ### Add Record
307
+ #### Add Record
307
308
  - POST record.json
308
309
  - Body: { "app": 1, "record": { "fieldName": { "value": "value" } } }
309
310
 
310
- ### kintone Query Syntax
311
+ #### kintone Query Syntax
311
312
  - Comparison: fieldName = "value", fieldName > 100
312
313
  - Operators: and, or, not
313
314
  - Sort: order by fieldName asc/desc
314
315
  - Limit: limit 100 offset 0
315
316
  - String: like "partial match"
316
317
 
317
- ### Tips
318
- - API tokens are scoped per app. If you need to access multiple apps, you can combine multiple tokens separated by commas.
319
-
320
318
  ### Business Logic
321
319
 
322
320
  The business logic type for this connector is "typescript". Write handler code using the connector SDK shown below. Do NOT access credentials directly from environment variables.
@@ -337,12 +335,13 @@ await kintone.request("/k/v1/record.json", {
337
335
  body: JSON.stringify({ app: 1, record: { title: { value: "Hello" } } }),
338
336
  });
339
337
  \`\`\``,
340
- ja: `### kintone REST API (API Token)
341
- - \u8A8D\u8A3C\u6E08\u307F\u30EA\u30AF\u30A8\u30B9\u30C8\u30C4\u30FC\u30EB\u3092\u4F7F\u7528\u3057\u3066kintone REST API\u3092\u547C\u3073\u51FA\u3057\u307E\u3059
342
- - \u30D9\u30FC\u30B9URL\uFF08\u4F8B: https://example.cybozu.com\uFF09\u306F\u81EA\u52D5\u7684\u306B\u89E3\u6C7A\u3055\u308C\u307E\u3059
343
- - \u8A8D\u8A3C\u306B\u306Fkintone API\u30C8\u30FC\u30AF\u30F3\uFF08\u7279\u5B9A\u306E\u30A2\u30D7\u30EA\u306B\u30B9\u30B3\u30FC\u30D7\u3055\u308C\u305F\u3082\u306E\uFF09\u3092\u4F7F\u7528\u3057\u307E\u3059
338
+ ja: `### \u30C4\u30FC\u30EB
344
339
 
345
- ### \u30A2\u30D7\u30EA\u4E00\u89A7\u306E\u53D6\u5F97
340
+ - \`kintone-api-key_request\`: kintone REST API\u3092\u547C\u3073\u51FA\u3059\u552F\u4E00\u306E\u624B\u6BB5\u3067\u3059\u3002\u30A2\u30D7\u30EA\u4E00\u89A7\u306E\u53D6\u5F97\u3001\u30D5\u30A3\u30FC\u30EB\u30C9\u5B9A\u7FA9\u306E\u53D6\u5F97\u3001\u30EC\u30B3\u30FC\u30C9\u306E\u691C\u7D22\u3001\u30EC\u30B3\u30FC\u30C9\u306E\u4F5C\u6210\u30FB\u66F4\u65B0\u306B\u4F7F\u7528\u3057\u307E\u3059\u3002\u8A8D\u8A3C\uFF08API\u30C8\u30FC\u30AF\u30F3\uFF09\u3068\u30D9\u30FC\u30B9URL\u306F\u81EA\u52D5\u7684\u306B\u8A2D\u5B9A\u3055\u308C\u307E\u3059\u3002API\u30C8\u30FC\u30AF\u30F3\u306F\u30A2\u30D7\u30EA\u3054\u3068\u306B\u30B9\u30B3\u30FC\u30D7\u3055\u308C\u3066\u3044\u307E\u3059 \u2014 \u8907\u6570\u306E\u30A2\u30D7\u30EA\u306B\u30A2\u30AF\u30BB\u30B9\u3059\u308B\u5834\u5408\u306F\u30AB\u30F3\u30DE\u533A\u5207\u308A\u3067\u30C8\u30FC\u30AF\u30F3\u3092\u7D44\u307F\u5408\u308F\u305B\u3066\u304F\u3060\u3055\u3044\u3002
341
+
342
+ ### kintone REST API \u30EA\u30D5\u30A1\u30EC\u30F3\u30B9
343
+
344
+ #### \u30A2\u30D7\u30EA\u4E00\u89A7\u306E\u53D6\u5F97
346
345
  - GET apps.json
347
346
 
348
347
  ### \u30D5\u30A3\u30FC\u30EB\u30C9\u5B9A\u7FA9\u306E\u53D6\u5F97
@@ -352,20 +351,17 @@ await kintone.request("/k/v1/record.json", {
352
351
  - GET records.json?app={appId}&query={query}
353
352
  - \u30AF\u30A8\u30EA\u4F8B: records.json?app=1&query=updatedTime > "2024-01-01" order by recordNumber asc limit 100
354
353
 
355
- ### \u30EC\u30B3\u30FC\u30C9\u306E\u8FFD\u52A0
354
+ #### \u30EC\u30B3\u30FC\u30C9\u306E\u8FFD\u52A0
356
355
  - POST record.json
357
356
  - Body: { "app": 1, "record": { "fieldName": { "value": "value" } } }
358
357
 
359
- ### kintone \u30AF\u30A8\u30EA\u69CB\u6587
358
+ #### kintone \u30AF\u30A8\u30EA\u69CB\u6587
360
359
  - \u6BD4\u8F03: fieldName = "value", fieldName > 100
361
360
  - \u6F14\u7B97\u5B50: and, or, not
362
361
  - \u30BD\u30FC\u30C8: order by fieldName asc/desc
363
362
  - \u5236\u9650: limit 100 offset 0
364
363
  - \u6587\u5B57\u5217: like "\u90E8\u5206\u4E00\u81F4"
365
364
 
366
- ### \u30D2\u30F3\u30C8
367
- - API\u30C8\u30FC\u30AF\u30F3\u306F\u30A2\u30D7\u30EA\u3054\u3068\u306B\u30B9\u30B3\u30FC\u30D7\u3055\u308C\u3066\u3044\u307E\u3059\u3002\u8907\u6570\u306E\u30A2\u30D7\u30EA\u306B\u30A2\u30AF\u30BB\u30B9\u3059\u308B\u5FC5\u8981\u304C\u3042\u308B\u5834\u5408\u306F\u3001\u30AB\u30F3\u30DE\u533A\u5207\u308A\u3067\u8907\u6570\u306E\u30C8\u30FC\u30AF\u30F3\u3092\u7D44\u307F\u5408\u308F\u305B\u308B\u3053\u3068\u304C\u3067\u304D\u307E\u3059\u3002
368
-
369
365
  ### Business Logic
370
366
 
371
367
  \u3053\u306E\u30B3\u30CD\u30AF\u30BF\u306E\u30D3\u30B8\u30CD\u30B9\u30ED\u30B8\u30C3\u30AF\u30BF\u30A4\u30D7\u306F "typescript" \u3067\u3059\u3002\u4EE5\u4E0B\u306B\u793A\u3059\u30B3\u30CD\u30AF\u30BFSDK\u3092\u4F7F\u7528\u3057\u3066\u30CF\u30F3\u30C9\u30E9\u30B3\u30FC\u30C9\u3092\u8A18\u8FF0\u3057\u3066\u304F\u3060\u3055\u3044\u3002\u74B0\u5883\u5909\u6570\u304B\u3089\u76F4\u63A5\u8A8D\u8A3C\u60C5\u5831\u306B\u30A2\u30AF\u30BB\u30B9\u3057\u306A\u3044\u3067\u304F\u3060\u3055\u3044\u3002
@@ -0,0 +1,5 @@
1
+ import * as _squadbase_connectors_sdk from '@squadbase/connectors/sdk';
2
+
3
+ declare const connection: (connectionId: string) => _squadbase_connectors_sdk.LinkedInAdsOauthConnectorSdk;
4
+
5
+ export { connection };