@squadbase/vite-server 0.1.3-dev.9 → 0.1.3

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 (63) hide show
  1. package/dist/cli/index.js +14229 -29321
  2. package/dist/connectors/airtable-oauth.js +43 -6
  3. package/dist/connectors/airtable.js +43 -6
  4. package/dist/connectors/amplitude.js +43 -6
  5. package/dist/connectors/anthropic.js +43 -6
  6. package/dist/connectors/asana.js +43 -6
  7. package/dist/connectors/attio.js +43 -6
  8. package/dist/connectors/{google-ads-oauth.d.ts → backlog-api-key.d.ts} +1 -1
  9. package/dist/connectors/backlog-api-key.js +629 -0
  10. package/dist/connectors/customerio.js +43 -6
  11. package/dist/connectors/dbt.js +43 -6
  12. package/dist/connectors/{google-sheets-oauth.d.ts → gamma.d.ts} +1 -1
  13. package/dist/connectors/gamma.js +866 -0
  14. package/dist/connectors/gemini.js +43 -6
  15. package/dist/connectors/gmail-oauth.js +65 -8
  16. package/dist/connectors/gmail.js +104 -44
  17. package/dist/connectors/google-ads.d.ts +1 -1
  18. package/dist/connectors/google-ads.js +410 -332
  19. package/dist/connectors/google-analytics-oauth.js +61 -8
  20. package/dist/connectors/google-analytics.js +107 -292
  21. package/dist/connectors/google-calendar-oauth.js +61 -8
  22. package/dist/connectors/google-calendar.js +111 -58
  23. package/dist/connectors/{linkedin-ads-oauth.d.ts → google-docs.d.ts} +1 -1
  24. package/dist/connectors/google-docs.js +631 -0
  25. package/dist/connectors/google-drive.d.ts +5 -0
  26. package/dist/connectors/google-drive.js +875 -0
  27. package/dist/connectors/google-sheets.d.ts +1 -1
  28. package/dist/connectors/google-sheets.js +267 -285
  29. package/dist/connectors/google-slides.d.ts +5 -0
  30. package/dist/connectors/google-slides.js +663 -0
  31. package/dist/connectors/grafana.js +43 -6
  32. package/dist/connectors/hubspot-oauth.js +43 -6
  33. package/dist/connectors/hubspot.js +43 -6
  34. package/dist/connectors/intercom-oauth.js +43 -6
  35. package/dist/connectors/intercom.js +43 -6
  36. package/dist/connectors/jira-api-key.js +43 -6
  37. package/dist/connectors/kintone-api-token.js +256 -82
  38. package/dist/connectors/kintone.js +43 -6
  39. package/dist/connectors/linkedin-ads.js +188 -168
  40. package/dist/connectors/mailchimp-oauth.js +43 -6
  41. package/dist/connectors/mailchimp.js +43 -6
  42. package/dist/connectors/mixpanel.d.ts +5 -0
  43. package/dist/connectors/mixpanel.js +779 -0
  44. package/dist/connectors/notion-oauth.js +43 -6
  45. package/dist/connectors/notion.js +43 -6
  46. package/dist/connectors/openai.js +43 -6
  47. package/dist/connectors/sentry.d.ts +5 -0
  48. package/dist/connectors/sentry.js +761 -0
  49. package/dist/connectors/shopify-oauth.js +43 -6
  50. package/dist/connectors/shopify.js +43 -6
  51. package/dist/connectors/stripe-api-key.js +46 -7
  52. package/dist/connectors/stripe-oauth.js +43 -6
  53. package/dist/connectors/wix-store.js +43 -6
  54. package/dist/connectors/zendesk-oauth.js +43 -6
  55. package/dist/connectors/zendesk.js +43 -6
  56. package/dist/index.d.ts +1 -1
  57. package/dist/index.js +4476 -3949
  58. package/dist/main.js +4474 -3948
  59. package/dist/vite-plugin.js +4474 -3948
  60. package/package.json +30 -12
  61. package/dist/connectors/google-ads-oauth.js +0 -890
  62. package/dist/connectors/google-sheets-oauth.js +0 -718
  63. package/dist/connectors/linkedin-ads-oauth.js +0 -848
@@ -204,21 +204,58 @@ var ConnectorPlugin = class _ConnectorPlugin {
204
204
  * Filters connections by connectorKey internally.
205
205
  * Returns tools keyed as `${connectorKey}_${toolName}`.
206
206
  */
207
- createTools(connections, config) {
207
+ createTools(connections, config, opts) {
208
208
  const myConnections = connections.filter(
209
209
  (c) => _ConnectorPlugin.deriveKey(c.connector.slug, c.connector.authType) === this.connectorKey
210
210
  );
211
211
  const result = {};
212
212
  for (const t of Object.values(this.tools)) {
213
- result[`${this.connectorKey}_${t.name}`] = t.createTool(
214
- myConnections,
215
- config
216
- );
213
+ const tool = t.createTool(myConnections, config);
214
+ const originalToModelOutput = tool.toModelOutput;
215
+ result[`${this.connectorKey}_${t.name}`] = {
216
+ ...tool,
217
+ toModelOutput: async (options) => {
218
+ if (!originalToModelOutput) {
219
+ return opts.truncateOutput(options.output);
220
+ }
221
+ const modelOutput = await originalToModelOutput(options);
222
+ if (modelOutput.type === "text" || modelOutput.type === "json") {
223
+ return opts.truncateOutput(modelOutput.value);
224
+ }
225
+ return modelOutput;
226
+ }
227
+ };
217
228
  }
218
229
  return result;
219
230
  }
220
231
  static deriveKey(slug, authType) {
221
- return authType ? `${slug}-${authType}` : slug;
232
+ if (authType) return `${slug}-${authType}`;
233
+ const LEGACY_NULL_AUTH_TYPE_MAP = {
234
+ // user-password
235
+ "postgresql": "user-password",
236
+ "mysql": "user-password",
237
+ "clickhouse": "user-password",
238
+ "kintone": "user-password",
239
+ "squadbase-db": "user-password",
240
+ // service-account
241
+ "snowflake": "service-account",
242
+ "bigquery": "service-account",
243
+ "google-analytics": "service-account",
244
+ "google-calendar": "service-account",
245
+ "aws-athena": "service-account",
246
+ "redshift": "service-account",
247
+ // api-key
248
+ "databricks": "api-key",
249
+ "dbt": "api-key",
250
+ "airtable": "api-key",
251
+ "openai": "api-key",
252
+ "gemini": "api-key",
253
+ "anthropic": "api-key",
254
+ "wix-store": "api-key"
255
+ };
256
+ const fallbackAuthType = LEGACY_NULL_AUTH_TYPE_MAP[slug];
257
+ if (fallbackAuthType) return `${slug}-${fallbackAuthType}`;
258
+ return slug;
222
259
  }
223
260
  };
224
261
 
@@ -569,7 +606,15 @@ var googleCalendarOauthConnector = new ConnectorPlugin({
569
606
 
570
607
  ### Business Logic
571
608
 
572
- 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.
609
+ 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 and do NOT read \`INTERNAL_SQUADBASE_*\` env vars \u2014 the SDK takes care of OAuth.
610
+
611
+ SDK surface (client created via \`connection(connectionId)\`):
612
+ - \`client.request(path, init?)\` \u2014 low-level authenticated fetch (\`path\` is appended to \`https://www.googleapis.com/calendar/v3\`; \`{calendarId}\` placeholders are auto-replaced).
613
+ - \`client.listCalendars()\` \u2014 list calendars accessible by the OAuth user.
614
+ - \`client.listEvents(options?, calendarId?)\` \u2014 list events with optional filters.
615
+ - \`client.getEvent(eventId, calendarId?)\` \u2014 fetch a single event.
616
+
617
+ If a handler test fails with \`Connection proxy is not configured\`, retry \u2014 the sandbox is still initializing. Do NOT abandon the SDK and construct OAuth proxy URLs manually.
573
618
 
574
619
  #### Example
575
620
 
@@ -626,7 +671,15 @@ console.log(event.summary, event.attendees);
626
671
 
627
672
  ### Business Logic
628
673
 
629
- \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
674
+ \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\u30BF SDK \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\`INTERNAL_SQUADBASE_*\` \u306E\u74B0\u5883\u5909\u6570\u3092\u4F7F\u3063\u3066\u624B\u52D5\u3067 OAuth \u30D7\u30ED\u30AD\u30B7\u3092\u53E9\u304F\u3053\u3068\u3082\u3057\u306A\u3044\u3067\u304F\u3060\u3055\u3044 \u2014 SDK \u304C OAuth \u3092\u51E6\u7406\u3057\u307E\u3059\u3002
675
+
676
+ SDK\uFF08\`connection(connectionId)\` \u3067\u4F5C\u6210\u3057\u305F\u30AF\u30E9\u30A4\u30A2\u30F3\u30C8\uFF09:
677
+ - \`client.request(path, init?)\` \u2014 \u4F4E\u30EC\u30D9\u30EB\u306E\u8A8D\u8A3C\u4ED8\u304D fetch\uFF08\`path\` \u306F \`https://www.googleapis.com/calendar/v3\` \u306B\u8FFD\u52A0\u3055\u308C\u3001\`{calendarId}\` \u30D7\u30EC\u30FC\u30B9\u30DB\u30EB\u30C0\u306F\u81EA\u52D5\u7F6E\u63DB\u3055\u308C\u307E\u3059\uFF09\u3002
678
+ - \`client.listCalendars()\` \u2014 OAuth \u30E6\u30FC\u30B6\u30FC\u304C\u30A2\u30AF\u30BB\u30B9\u53EF\u80FD\u306A\u30AB\u30EC\u30F3\u30C0\u30FC\u4E00\u89A7\u3092\u53D6\u5F97\u3002
679
+ - \`client.listEvents(options?, calendarId?)\` \u2014 \u30D5\u30A3\u30EB\u30BF\u30FC\u4ED8\u304D\u3067\u30A4\u30D9\u30F3\u30C8\u4E00\u89A7\u3092\u53D6\u5F97\u3002
680
+ - \`client.getEvent(eventId, calendarId?)\` \u2014 \u5358\u4E00\u30A4\u30D9\u30F3\u30C8\u3092\u53D6\u5F97\u3002
681
+
682
+ \u30CF\u30F3\u30C9\u30E9\u306E\u30C6\u30B9\u30C8\u304C \`Connection proxy is not configured\` \u3067\u5931\u6557\u3059\u308B\u5834\u5408\u306F\u518D\u8A66\u884C\u3057\u3066\u304F\u3060\u3055\u3044\u3002\u901A\u5E38\u306F\u30B5\u30F3\u30C9\u30DC\u30C3\u30AF\u30B9\u306E\u521D\u671F\u5316\u4E2D\u306B\u8D77\u304D\u307E\u3059\u3002SDK \u3092\u8AE6\u3081\u3066 OAuth \u30D7\u30ED\u30AD\u30B7\u306E URL \u3092\u81EA\u5206\u3067\u7D44\u307F\u7ACB\u3066\u308B\u3053\u3068\u306F **\u3057\u306A\u3044\u3067\u304F\u3060\u3055\u3044**\u3002
630
683
 
631
684
  #### Example
632
685
 
@@ -55,26 +55,26 @@ var parameters = {
55
55
  type: "base64EncodedJson",
56
56
  secret: true,
57
57
  required: true
58
- }),
59
- impersonateEmail: new ParameterDefinition({
60
- slug: "impersonate-email",
61
- name: "User Email Address(es)",
62
- description: "The email address(es) of the Google Workspace user(s) whose calendar will be accessed via Domain-wide Delegation. Multiple addresses can be provided as a comma-separated list (e.g., 'user1@example.com, user2@example.com') to aggregate accessible calendars across users during setup. After setup completes, this value is overwritten with the owner email of the selected calendar.",
63
- envVarBaseKey: "GOOGLE_CALENDAR_IMPERSONATE_EMAIL",
64
- type: "text",
65
- secret: false,
66
- required: true
67
- }),
68
- calendarId: new ParameterDefinition({
69
- slug: "calendar-id",
70
- name: "Default Calendar ID",
71
- description: "The default Google Calendar ID to use (e.g., 'primary' or an email address like 'user@example.com'). If not set, 'primary' is used.",
72
- envVarBaseKey: "GOOGLE_CALENDAR_CALENDAR_ID",
73
- type: "text",
74
- secret: false,
75
- required: false
76
58
  })
77
59
  };
60
+ var impersonateEmailParameter = new ParameterDefinition({
61
+ slug: "impersonate-email",
62
+ name: "User Email Address(es)",
63
+ description: "The email address(es) of the Google Workspace user(s) whose calendar is accessed via Domain-wide Delegation. Collected during the setup flow.",
64
+ envVarBaseKey: "GOOGLE_CALENDAR_IMPERSONATE_EMAIL",
65
+ type: "text",
66
+ secret: false,
67
+ required: false
68
+ });
69
+ var calendarIdParameter = new ParameterDefinition({
70
+ slug: "calendar-id",
71
+ name: "Default Calendar ID",
72
+ description: "The default Google Calendar ID to use (e.g., 'primary' or an email address like 'user@example.com'). If not set, 'primary' is used.",
73
+ envVarBaseKey: "GOOGLE_CALENDAR_CALENDAR_ID",
74
+ type: "text",
75
+ secret: false,
76
+ required: false
77
+ });
78
78
 
79
79
  // ../connectors/src/connectors/google-calendar/sdk/index.ts
80
80
  var TOKEN_URL = "https://oauth2.googleapis.com/token";
@@ -106,8 +106,8 @@ function buildJwt(clientEmail, privateKey, nowSec, subject) {
106
106
  }
107
107
  function createClient(params) {
108
108
  const serviceAccountKeyJsonBase64 = params[parameters.serviceAccountKeyJsonBase64.slug];
109
- const impersonateEmail = params[parameters.impersonateEmail.slug];
110
- const defaultCalendarId = params[parameters.calendarId.slug] ?? "primary";
109
+ const impersonateEmail = params[impersonateEmailParameter.slug];
110
+ const defaultCalendarId = params[calendarIdParameter.slug] ?? "primary";
111
111
  if (!serviceAccountKeyJsonBase64) {
112
112
  throw new Error(
113
113
  `google-calendar: missing required parameter: ${parameters.serviceAccountKeyJsonBase64.slug}`
@@ -115,7 +115,7 @@ function createClient(params) {
115
115
  }
116
116
  if (!impersonateEmail) {
117
117
  throw new Error(
118
- `google-calendar: missing required parameter: ${parameters.impersonateEmail.slug}`
118
+ `google-calendar: missing required parameter: ${impersonateEmailParameter.slug}`
119
119
  );
120
120
  }
121
121
  let serviceAccountKey;
@@ -316,21 +316,58 @@ var ConnectorPlugin = class _ConnectorPlugin {
316
316
  * Filters connections by connectorKey internally.
317
317
  * Returns tools keyed as `${connectorKey}_${toolName}`.
318
318
  */
319
- createTools(connections, config) {
319
+ createTools(connections, config, opts) {
320
320
  const myConnections = connections.filter(
321
321
  (c) => _ConnectorPlugin.deriveKey(c.connector.slug, c.connector.authType) === this.connectorKey
322
322
  );
323
323
  const result = {};
324
324
  for (const t of Object.values(this.tools)) {
325
- result[`${this.connectorKey}_${t.name}`] = t.createTool(
326
- myConnections,
327
- config
328
- );
325
+ const tool = t.createTool(myConnections, config);
326
+ const originalToModelOutput = tool.toModelOutput;
327
+ result[`${this.connectorKey}_${t.name}`] = {
328
+ ...tool,
329
+ toModelOutput: async (options) => {
330
+ if (!originalToModelOutput) {
331
+ return opts.truncateOutput(options.output);
332
+ }
333
+ const modelOutput = await originalToModelOutput(options);
334
+ if (modelOutput.type === "text" || modelOutput.type === "json") {
335
+ return opts.truncateOutput(modelOutput.value);
336
+ }
337
+ return modelOutput;
338
+ }
339
+ };
329
340
  }
330
341
  return result;
331
342
  }
332
343
  static deriveKey(slug, authType) {
333
- return authType ? `${slug}-${authType}` : slug;
344
+ if (authType) return `${slug}-${authType}`;
345
+ const LEGACY_NULL_AUTH_TYPE_MAP = {
346
+ // user-password
347
+ "postgresql": "user-password",
348
+ "mysql": "user-password",
349
+ "clickhouse": "user-password",
350
+ "kintone": "user-password",
351
+ "squadbase-db": "user-password",
352
+ // service-account
353
+ "snowflake": "service-account",
354
+ "bigquery": "service-account",
355
+ "google-analytics": "service-account",
356
+ "google-calendar": "service-account",
357
+ "aws-athena": "service-account",
358
+ "redshift": "service-account",
359
+ // api-key
360
+ "databricks": "api-key",
361
+ "dbt": "api-key",
362
+ "airtable": "api-key",
363
+ "openai": "api-key",
364
+ "gemini": "api-key",
365
+ "anthropic": "api-key",
366
+ "wix-store": "api-key"
367
+ };
368
+ const fallbackAuthType = LEGACY_NULL_AUTH_TYPE_MAP[slug];
369
+ if (fallbackAuthType) return `${slug}-${fallbackAuthType}`;
370
+ return slug;
334
371
  }
335
372
  };
336
373
 
@@ -442,7 +479,7 @@ var listCalendarsTool = new ConnectorTool({
442
479
  error: `Connection ${connectionId} not found`
443
480
  };
444
481
  }
445
- const impersonateEmailRaw = parameters.impersonateEmail.getValue(connection2);
482
+ const impersonateEmailRaw = impersonateEmailParameter.getValue(connection2);
446
483
  const emails = impersonateEmailRaw.split(",").map((e) => e.trim()).filter((e) => e.length > 0);
447
484
  if (emails.length === 0) {
448
485
  return {
@@ -518,57 +555,73 @@ var listCalendarsTool = new ConnectorTool({
518
555
  });
519
556
 
520
557
  // ../connectors/src/connectors/google-calendar/setup.ts
521
- var listCalendarsToolName = `google-calendar_${listCalendarsTool.name}`;
558
+ var listCalendarsToolName = `google-calendar-service-account_${listCalendarsTool.name}`;
522
559
  var googleCalendarOnboarding = new ConnectorOnboarding({
523
560
  connectionSetupInstructions: {
524
- ja: `\u4EE5\u4E0B\u306E\u624B\u9806\u3067Google Calendar\u30B3\u30CD\u30AF\u30B7\u30E7\u30F3\u306E\u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u3092\u884C\u3063\u3066\u304F\u3060\u3055\u3044\u3002
561
+ ja: `\u4EE5\u4E0B\u306E\u624B\u9806\u3067Google Calendar\u30B3\u30CD\u30AF\u30B7\u30E7\u30F3\u306E\u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u3092\u884C\u3063\u3066\u304F\u3060\u3055\u3044\u3002\u63A5\u7D9A\u4F5C\u6210\u6642\u306B\u306F\u30B5\u30FC\u30D3\u30B9\u30A2\u30AB\u30A6\u30F3\u30C8JSON\u306E\u307F\u304C\u8A2D\u5B9A\u6E08\u307F\u3067\u3001\u5BFE\u8C61\u30E6\u30FC\u30B6\u30FC\u306E\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9\u3084\u30AB\u30EC\u30F3\u30C0\u30FCID\u306F\u3053\u306E\u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u4E2D\u306B\u53D6\u5F97\u3057\u307E\u3059\u3002
525
562
 
526
- 1. \`${listCalendarsToolName}\` \u3092\u547C\u3073\u51FA\u3057\u3066\u3001\u30B3\u30CD\u30AF\u30B7\u30E7\u30F3\u306E \`impersonate-email\` \u30D1\u30E9\u30E1\u30FC\u30BF\u306B\u8A2D\u5B9A\u3055\u308C\u305F\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9\uFF08\u30AB\u30F3\u30DE\u533A\u5207\u308A\u5BFE\u5FDC\uFF09\u3067\u30A2\u30AF\u30BB\u30B9\u53EF\u80FD\u306A\u30AB\u30EC\u30F3\u30C0\u30FC\u4E00\u89A7\u3092\u53D6\u5F97\u3059\u308B
527
- 2. \u8FD4\u5374\u3055\u308C\u305F \`calendars\` \u914D\u5217\uFF08\u5404\u8981\u7D20: \`{ impersonateEmail, id, summary, primary, accessRole }\`\uFF09\u3092\u5143\u306B\u3001\u300C\u4F7F\u7528\u3059\u308B\u30AB\u30EC\u30F3\u30C0\u30FC\u3092\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044\u3002\u300D\u3068\u30E6\u30FC\u30B6\u30FC\u306B\u4F1D\u3048\u305F\u4E0A\u3067\u3001\`updateConnectionParameters\` \u3092\u547C\u3073\u51FA\u3059:
563
+ 1. \`askUserQuestion\` \u3067\u30E6\u30FC\u30B6\u30FC\u306B\u3001\u30B5\u30FC\u30D3\u30B9\u30A2\u30AB\u30A6\u30F3\u30C8\u304CDomain-wide Delegation\u3067\u4EE3\u7406\u30A2\u30AF\u30BB\u30B9\u3059\u308BGoogle Workspace\u30E6\u30FC\u30B6\u30FC\u306E\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9\u3092\u30D2\u30A2\u30EA\u30F3\u30B0\u3059\u308B:
564
+ - \`question\`: \u300C\u30A2\u30AF\u30BB\u30B9\u3057\u305F\u3044\u30AB\u30EC\u30F3\u30C0\u30FC\u3092\u6301\u3064\u30E6\u30FC\u30B6\u30FC\u306E\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044\uFF08\u8907\u6570\u3042\u308B\u5834\u5408\u306F\u30AB\u30F3\u30DE\u533A\u5207\u308A\u3067\u5165\u529B\u53EF\uFF09\u300D
565
+ - \`header\`: \u300C\u30E1\u30FC\u30EB\u5165\u529B\u300D
566
+ - \`options\`: \`[]\`\uFF08\u9078\u629E\u80A2\u306A\u3057\u30FB\u81EA\u7531\u5165\u529B\u306E\u307F\uFF09
567
+ - \`allowFreeText\`: \`true\`
568
+ 2. \u30E6\u30FC\u30B6\u30FC\u304B\u3089\u53D7\u3051\u53D6\u3063\u305F\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9\uFF08\u30AB\u30F3\u30DE\u533A\u5207\u308A\u5BFE\u5FDC\uFF09\u3092 \`updateConnectionParameters\` \u3067\u4FDD\u5B58\u3059\u308B:
569
+ - \`parameterSlug\`: \`"impersonate-email"\`
570
+ - \`options\`: \`[{ value: <\u5165\u529B\u3055\u308C\u305F\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9\u6587\u5B57\u5217>, label: <\u540C\u3058\u5024> }]\`\uFF081\u4EF6\u306E\u307F\u306E\u30AA\u30D7\u30B7\u30E7\u30F3\u306F\u81EA\u52D5\u9078\u629E\u3055\u308C\u308B\uFF09
571
+ 3. \`${listCalendarsToolName}\` \u3092\u547C\u3073\u51FA\u3057\u3001\u4FDD\u5B58\u3057\u305F\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9\u3067\u30A2\u30AF\u30BB\u30B9\u53EF\u80FD\u306A\u30AB\u30EC\u30F3\u30C0\u30FC\u4E00\u89A7\u3092\u53D6\u5F97\u3059\u308B\u3002
572
+ - \`errors\` \u306B\u30A8\u30E9\u30FC\u304C\u3042\u308A \`calendars\` \u304C\u7A7A\u306E\u5834\u5408\uFF08\u3059\u3079\u3066\u306E\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9\u3067\u5931\u6557\uFF09\u3001\u5165\u529B\u3055\u308C\u305F\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9\u304C\u5B58\u5728\u3057\u306A\u3044\u53EF\u80FD\u6027\u304C\u3042\u308B\u3002\`askUserQuestion\` \u3067\u300C{\u5165\u529B\u3057\u305F\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9} \u306E\u30AB\u30EC\u30F3\u30C0\u30FC\u306B\u30A2\u30AF\u30BB\u30B9\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\u3002\u30A2\u30C9\u30EC\u30B9\u306B\u8AA4\u308A\u304C\u3042\u308B\u53EF\u80FD\u6027\u304C\u3042\u308A\u307E\u3059\u3002\u4F3C\u305F\u30A2\u30C9\u30EC\u30B9\u3067\u306F\u3042\u308A\u307E\u305B\u3093\u304B\uFF1F\u300D\u3068\u805E\u304D\u8FD4\u3057\u3001\u30B9\u30C6\u30C3\u30D72\u304B\u3089\u518D\u5EA6\u5B9F\u884C\u3059\u308B
573
+ 4. \u8FD4\u5374\u3055\u308C\u305F \`calendars\` \u914D\u5217\uFF08\u5404\u8981\u7D20: \`{ impersonateEmail, id, summary, primary, accessRole }\`\uFF09\u3092\u5143\u306B\u300C\u4F7F\u7528\u3059\u308B\u30AB\u30EC\u30F3\u30C0\u30FC\u3092\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044\u3002\u300D\u3068\u77ED\u304F\u4F1D\u3048\u305F\u4E0A\u3067\u3001\`updateConnectionParameters\` \u3092\u547C\u3073\u51FA\u3059:
528
574
  - \`parameterSlug\`: \`"calendar-id"\`
529
- - \`options\`: \u30AB\u30EC\u30F3\u30C0\u30FC\u4E00\u89A7\u3002\u5404 option \u306E \`label\` \u306F \`\u30AB\u30EC\u30F3\u30C0\u30FC\u540D (owner: impersonateEmail)\` \u306E\u5F62\u5F0F\u3001\`value\` \u306F\u30AB\u30EC\u30F3\u30C0\u30FCID
575
+ - \`options\`: \u5404 option \u306E \`label\` \u306F \`\u30AB\u30EC\u30F3\u30C0\u30FC\u540D (owner: impersonateEmail)\` \u306E\u5F62\u5F0F\u3001\`value\` \u306F\u30AB\u30EC\u30F3\u30C0\u30FCID
530
576
  - \`errors\` \u306B\u5931\u6557\u3057\u305F\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9\u304C\u3042\u308B\u5834\u5408\u306F\u3001\u305D\u306E\u65E8\u3092\u77ED\u304F\u4F1D\u3048\u308B
531
- 3. \u30E6\u30FC\u30B6\u30FC\u304C\u9078\u629E\u3057\u305F\u30AB\u30EC\u30F3\u30C0\u30FC\u306E \`label\` \u304C\u30E1\u30C3\u30BB\u30FC\u30B8\u3068\u3057\u3066\u5C4A\u304F\u3002\u305D\u306E label \u304B\u3089 owner \u306E\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9\u3092\u62BD\u51FA\u3057\u3001\`updateConnectionParameters\` \u3092\u547C\u3073\u51FA\u3059:
577
+ 5. \u30E6\u30FC\u30B6\u30FC\u304C\u9078\u629E\u3057\u305F\u30AB\u30EC\u30F3\u30C0\u30FC\u306E \`label\` \u304B\u3089 owner \u306E\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9\u3092\u62BD\u51FA\u3057\u3001\`updateConnectionParameters\` \u3092\u547C\u3073\u51FA\u3057\u3066 \`impersonate-email\` \u3092\u6700\u7D42\u5024\u3067\u4E0A\u66F8\u304D\u3059\u308B:
532
578
  - \`parameterSlug\`: \`"impersonate-email"\`
533
- - \`options\`: \`[{ value: <ownerEmail>, label: <ownerEmail> }]\`\uFF08\u9078\u629E\u6E08\u307F\u30AB\u30EC\u30F3\u30C0\u30FC\u306E owner email \u3092\u5358\u4E00\u30AA\u30D7\u30B7\u30E7\u30F3\u3068\u3057\u3066\u6E21\u3059\uFF09
534
- 4. \`updateConnectionContext\` \u3092\u547C\u3073\u51FA\u3057\u3066\u3001\u5BFE\u8C61\u60C5\u5831\u3092\u8A18\u9332\u3059\u308B:
535
- - \`user\`: \u8A2D\u5B9A\u3057\u305F\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9
579
+ - \`options\`: \`[{ value: <ownerEmail>, label: <ownerEmail> }]\`
580
+ 6. \`updateConnectionContext\` \u3092\u547C\u3073\u51FA\u3057\u3066\u3001\u5BFE\u8C61\u60C5\u5831\u3092\u8A18\u9332\u3059\u308B:
581
+ - \`user\`: \u6700\u7D42\u7684\u306B\u8A2D\u5B9A\u3057\u305F\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9
536
582
  - \`calendar\`: \u9078\u629E\u3055\u308C\u305F\u30AB\u30EC\u30F3\u30C0\u30FC\u540D
537
583
  - \`calendarId\`: \u9078\u629E\u3055\u308C\u305F\u30AB\u30EC\u30F3\u30C0\u30FCID
538
584
  - \`note\`: \u300CDomain-wide Delegation\u3067 {email} \u306E {calendar} \u306B\u30A2\u30AF\u30BB\u30B9\u300D\u306A\u3069\u306E\u8AAC\u660E
539
585
 
540
586
  #### \u5236\u7D04
541
- - **\u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u4E2D\u306B\u30E6\u30FC\u30B6\u30FC\u3078\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9\u7B49\u306E\u5165\u529B\u3092\u6C42\u3081\u306A\u3044\u3053\u3068**\u3002\u5FC5\u8981\u306A\u5024\u306F\u63A5\u7D9A\u4F5C\u6210\u6642\u306E\u30D1\u30E9\u30E1\u30FC\u30BF\uFF08\`impersonate-email\`\uFF09\u304B\u3089\u53D6\u5F97\u3059\u308B
542
587
  - **\u30B5\u30FC\u30D3\u30B9\u30A2\u30AB\u30A6\u30F3\u30C8\u306E\u30C9\u30E1\u30A4\u30F3\u5168\u4F53\u306E\u59D4\u4EFB\u8A2D\u5B9A\u304C\u5FC5\u8981\u3067\u3059**\u3002\`${listCalendarsToolName}\` \u306E \`errors\` \u306B\u6A29\u9650\u30A8\u30E9\u30FC\u304C\u51FA\u308B\u5834\u5408\u3001Google Workspace\u7BA1\u7406\u8005\u306BDomain-wide Delegation\u306E\u8A2D\u5B9A\u78BA\u8A8D\u3092\u4FC3\u3057\u3066\u304F\u3060\u3055\u3044
543
588
  - \u30C4\u30FC\u30EB\u9593\u306F1\u6587\u3060\u3051\u66F8\u3044\u3066\u5373\u6B21\u306E\u30C4\u30FC\u30EB\u547C\u3073\u51FA\u3057\u3002\u4E0D\u8981\u306A\u8AAC\u660E\u306F\u7701\u7565\u3057\u3001\u52B9\u7387\u7684\u306B\u9032\u3081\u308B`,
544
- en: `Follow these steps to set up the Google Calendar connection.
589
+ en: `Follow these steps to set up the Google Calendar connection. Only the service account JSON is provided at connection creation time \u2014 the target user email and calendar ID are collected during this setup flow.
545
590
 
546
- 1. Call \`${listCalendarsToolName}\` to list calendars accessible via the email address(es) configured in the connection's \`impersonate-email\` parameter (comma-separated list supported)
547
- 2. Using the returned \`calendars\` array (each item: \`{ impersonateEmail, id, summary, primary, accessRole }\`), tell the user "Please select a calendar.", then call \`updateConnectionParameters\`:
591
+ 1. Call \`askUserQuestion\` to ask the user for the Google Workspace user email the service account will impersonate via Domain-wide Delegation:
592
+ - \`question\`: "Please enter the email address of the user whose calendar you want to access (comma-separated list allowed for multiple users)"
593
+ - \`header\`: "Email input"
594
+ - \`options\`: \`[]\` (no preset choices \u2014 free text only)
595
+ - \`allowFreeText\`: \`true\`
596
+ 2. Save the email(s) the user provided (comma-separated supported) via \`updateConnectionParameters\`:
597
+ - \`parameterSlug\`: \`"impersonate-email"\`
598
+ - \`options\`: \`[{ value: <the email string entered>, label: <same value> }]\` (a single option is auto-selected)
599
+ 3. Call \`${listCalendarsToolName}\` to list calendars accessible via the saved email(s).
600
+ - If \`errors\` is non-empty and \`calendars\` is empty (all emails failed), the entered address may not exist. Use \`askUserQuestion\` to ask: "Could not access the calendar for {entered email}. The address may be incorrect \u2014 did you mean a similar address?" Then re-run from step 2 with the new input
601
+ 4. Using the returned \`calendars\` array (each item: \`{ impersonateEmail, id, summary, primary, accessRole }\`), briefly say "Please select a calendar." then call \`updateConnectionParameters\`:
548
602
  - \`parameterSlug\`: \`"calendar-id"\`
549
- - \`options\`: The calendar list. Each option's \`label\` should be \`Calendar Name (owner: impersonateEmail)\`, \`value\` should be the calendar ID
603
+ - \`options\`: Each option's \`label\` should be \`Calendar Name (owner: impersonateEmail)\`, \`value\` should be the calendar ID
550
604
  - If \`errors\` contains failing email addresses, briefly mention them
551
- 3. The \`label\` of the user's selected calendar will arrive as a message. Extract the owner email from that label and call \`updateConnectionParameters\`:
605
+ 5. Extract the owner email from the \`label\` of the user's selected calendar, then call \`updateConnectionParameters\` to overwrite \`impersonate-email\` with the final value:
552
606
  - \`parameterSlug\`: \`"impersonate-email"\`
553
- - \`options\`: \`[{ value: <ownerEmail>, label: <ownerEmail> }]\` (pass the selected calendar's owner email as a single option)
554
- 4. Call \`updateConnectionContext\` to record the target:
555
- - \`user\`: The configured email address
607
+ - \`options\`: \`[{ value: <ownerEmail>, label: <ownerEmail> }]\`
608
+ 6. Call \`updateConnectionContext\` to record the target:
609
+ - \`user\`: The final configured email address
556
610
  - \`calendar\`: The selected calendar's name
557
611
  - \`calendarId\`: The selected calendar ID
558
612
  - \`note\`: A description such as "Accessing {email}'s {calendar} via Domain-wide Delegation"
559
613
 
560
614
  #### Constraints
561
- - **Do NOT prompt the user for any input (e.g., email addresses) during setup**. The required values come from the connection parameters (\`impersonate-email\`) filled in at connection creation time
562
615
  - **Domain-wide Delegation must be configured on the service account**. If \`${listCalendarsToolName}\` returns permission errors in the \`errors\` field, ask the user to verify the Domain-wide Delegation setup with their Google Workspace administrator
563
616
  - Write only 1 sentence between tool calls, then immediately call the next tool. Skip unnecessary explanations and proceed efficiently`
564
617
  },
565
618
  dataOverviewInstructions: {
566
- en: `1. Call google-calendar_request with GET /calendars/{calendarId} to get the default calendar's metadata
567
- 2. Call google-calendar_request with GET /users/me/calendarList to list all accessible calendars
568
- 3. Call google-calendar_request with GET /calendars/{calendarId}/events with query params timeMin (RFC3339) and maxResults=10 to sample upcoming events`,
569
- ja: `1. google-calendar_request \u3067 GET /calendars/{calendarId} \u3092\u547C\u3073\u51FA\u3057\u3001\u30C7\u30D5\u30A9\u30EB\u30C8\u30AB\u30EC\u30F3\u30C0\u30FC\u306E\u30E1\u30BF\u30C7\u30FC\u30BF\u3092\u53D6\u5F97
570
- 2. google-calendar_request \u3067 GET /users/me/calendarList \u3092\u547C\u3073\u51FA\u3057\u3001\u30A2\u30AF\u30BB\u30B9\u53EF\u80FD\u306A\u5168\u30AB\u30EC\u30F3\u30C0\u30FC\u306E\u4E00\u89A7\u3092\u53D6\u5F97
571
- 3. google-calendar_request \u3067 GET /calendars/{calendarId}/events \u3092\u30AF\u30A8\u30EA\u30D1\u30E9\u30E1\u30FC\u30BF timeMin\uFF08RFC3339\u5F62\u5F0F\uFF09\u3068 maxResults=10 \u3067\u547C\u3073\u51FA\u3057\u3001\u76F4\u8FD1\u306E\u30A4\u30D9\u30F3\u30C8\u3092\u30B5\u30F3\u30D7\u30EA\u30F3\u30B0`
619
+ en: `1. Call google-calendar-service-account_request with GET /calendars/{calendarId} to get the default calendar's metadata
620
+ 2. Call google-calendar-service-account_request with GET /users/me/calendarList to list all accessible calendars
621
+ 3. Call google-calendar-service-account_request with GET /calendars/{calendarId}/events with query params timeMin (RFC3339) and maxResults=10 to sample upcoming events`,
622
+ ja: `1. google-calendar-service-account_request \u3067 GET /calendars/{calendarId} \u3092\u547C\u3073\u51FA\u3057\u3001\u30C7\u30D5\u30A9\u30EB\u30C8\u30AB\u30EC\u30F3\u30C0\u30FC\u306E\u30E1\u30BF\u30C7\u30FC\u30BF\u3092\u53D6\u5F97
623
+ 2. google-calendar-service-account_request \u3067 GET /users/me/calendarList \u3092\u547C\u3073\u51FA\u3057\u3001\u30A2\u30AF\u30BB\u30B9\u53EF\u80FD\u306A\u5168\u30AB\u30EC\u30F3\u30C0\u30FC\u306E\u4E00\u89A7\u3092\u53D6\u5F97
624
+ 3. google-calendar-service-account_request \u3067 GET /calendars/{calendarId}/events \u3092\u30AF\u30A8\u30EA\u30D1\u30E9\u30E1\u30FC\u30BF timeMin\uFF08RFC3339\u5F62\u5F0F\uFF09\u3068 maxResults=10 \u3067\u547C\u3073\u51FA\u3057\u3001\u76F4\u8FD1\u306E\u30A4\u30D9\u30F3\u30C8\u3092\u30B5\u30F3\u30D7\u30EA\u30F3\u30B0`
572
625
  }
573
626
  });
574
627
 
@@ -623,13 +676,13 @@ Authentication is handled automatically using a service account.
623
676
  try {
624
677
  const { GoogleAuth } = await import("google-auth-library");
625
678
  const keyJsonBase64 = parameters.serviceAccountKeyJsonBase64.getValue(connection2);
626
- const impersonateEmail = parameters.impersonateEmail.tryGetValue(connection2);
627
- const calendarId = parameters.calendarId.tryGetValue(connection2) ?? "primary";
679
+ const impersonateEmail = impersonateEmailParameter.tryGetValue(connection2);
680
+ const calendarId = calendarIdParameter.tryGetValue(connection2) ?? "primary";
628
681
  const resolvedSubject = subject ?? impersonateEmail;
629
682
  if (!resolvedSubject) {
630
683
  return {
631
684
  success: false,
632
- error: `Missing required parameter: ${parameters.impersonateEmail.slug}. Configure the user email for this connection.`
685
+ error: `Missing required parameter: ${impersonateEmailParameter.slug}. Configure the user email for this connection.`
633
686
  };
634
687
  }
635
688
  const credentials = JSON.parse(
@@ -708,7 +761,7 @@ var googleCalendarConnector = new ConnectorPlugin({
708
761
  systemPrompt: {
709
762
  en: `### Tools
710
763
 
711
- - \`google-calendar_request\`: The only way to call the Google Calendar API. Use it to list calendars, get events, and manage calendar data. Authentication is handled automatically using a service account with Domain-wide Delegation \u2014 the service account impersonates the user configured on the connection (\`impersonate-email\` parameter). The {calendarId} placeholder in paths is automatically replaced with the configured default calendar ID. Pass an optional \`subject\` only if you need to override the configured user for a specific request.
764
+ - \`google-calendar-service-account_request\`: The only way to call the Google Calendar API. Use it to list calendars, get events, and manage calendar data. Authentication is handled automatically using a service account with Domain-wide Delegation \u2014 the service account impersonates the user configured on the connection (\`impersonate-email\` parameter). The {calendarId} placeholder in paths is automatically replaced with the configured default calendar ID. Pass an optional \`subject\` only if you need to override the configured user for a specific request.
712
765
 
713
766
  ### Business Logic
714
767
 
@@ -779,7 +832,7 @@ export default async function handler(c: Context) {
779
832
  - The default calendar ID is "primary" if not configured`,
780
833
  ja: `### \u30C4\u30FC\u30EB
781
834
 
782
- - \`google-calendar_request\`: Google Calendar API\u3092\u547C\u3073\u51FA\u3059\u552F\u4E00\u306E\u624B\u6BB5\u3067\u3059\u3002\u30AB\u30EC\u30F3\u30C0\u30FC\u306E\u4E00\u89A7\u53D6\u5F97\u3001\u30A4\u30D9\u30F3\u30C8\u306E\u53D6\u5F97\u3001\u30AB\u30EC\u30F3\u30C0\u30FC\u30C7\u30FC\u30BF\u306E\u7BA1\u7406\u306B\u4F7F\u7528\u3057\u307E\u3059\u3002\u30B5\u30FC\u30D3\u30B9\u30A2\u30AB\u30A6\u30F3\u30C8\uFF0BDomain-wide Delegation\u3067\u8A8D\u8A3C\u304C\u81EA\u52D5\u7684\u306B\u51E6\u7406\u3055\u308C\u3001\u30B3\u30CD\u30AF\u30B7\u30E7\u30F3\u306B\u8A2D\u5B9A\u3055\u308C\u305F\u30E6\u30FC\u30B6\u30FC\uFF08\`impersonate-email\`\u30D1\u30E9\u30E1\u30FC\u30BF\uFF09\u3068\u3057\u3066\u52D5\u4F5C\u3057\u307E\u3059\u3002\u30D1\u30B9\u5185\u306E{calendarId}\u30D7\u30EC\u30FC\u30B9\u30DB\u30EB\u30C0\u30FC\u306F\u8A2D\u5B9A\u6E08\u307F\u306E\u30C7\u30D5\u30A9\u30EB\u30C8\u30AB\u30EC\u30F3\u30C0\u30FCID\u3067\u81EA\u52D5\u7684\u306B\u7F6E\u63DB\u3055\u308C\u307E\u3059\u3002\u7279\u5B9A\u30EA\u30AF\u30A8\u30B9\u30C8\u3067\u8A2D\u5B9A\u30E6\u30FC\u30B6\u30FC\u3092\u4E0A\u66F8\u304D\u3057\u305F\u3044\u5834\u5408\u306E\u307F\u3001\u30AA\u30D7\u30B7\u30E7\u30F3\u306E\`subject\`\u30D1\u30E9\u30E1\u30FC\u30BF\u3092\u6E21\u3057\u3066\u304F\u3060\u3055\u3044\u3002
835
+ - \`google-calendar-service-account_request\`: Google Calendar API\u3092\u547C\u3073\u51FA\u3059\u552F\u4E00\u306E\u624B\u6BB5\u3067\u3059\u3002\u30AB\u30EC\u30F3\u30C0\u30FC\u306E\u4E00\u89A7\u53D6\u5F97\u3001\u30A4\u30D9\u30F3\u30C8\u306E\u53D6\u5F97\u3001\u30AB\u30EC\u30F3\u30C0\u30FC\u30C7\u30FC\u30BF\u306E\u7BA1\u7406\u306B\u4F7F\u7528\u3057\u307E\u3059\u3002\u30B5\u30FC\u30D3\u30B9\u30A2\u30AB\u30A6\u30F3\u30C8\uFF0BDomain-wide Delegation\u3067\u8A8D\u8A3C\u304C\u81EA\u52D5\u7684\u306B\u51E6\u7406\u3055\u308C\u3001\u30B3\u30CD\u30AF\u30B7\u30E7\u30F3\u306B\u8A2D\u5B9A\u3055\u308C\u305F\u30E6\u30FC\u30B6\u30FC\uFF08\`impersonate-email\`\u30D1\u30E9\u30E1\u30FC\u30BF\uFF09\u3068\u3057\u3066\u52D5\u4F5C\u3057\u307E\u3059\u3002\u30D1\u30B9\u5185\u306E{calendarId}\u30D7\u30EC\u30FC\u30B9\u30DB\u30EB\u30C0\u30FC\u306F\u8A2D\u5B9A\u6E08\u307F\u306E\u30C7\u30D5\u30A9\u30EB\u30C8\u30AB\u30EC\u30F3\u30C0\u30FCID\u3067\u81EA\u52D5\u7684\u306B\u7F6E\u63DB\u3055\u308C\u307E\u3059\u3002\u7279\u5B9A\u30EA\u30AF\u30A8\u30B9\u30C8\u3067\u8A2D\u5B9A\u30E6\u30FC\u30B6\u30FC\u3092\u4E0A\u66F8\u304D\u3057\u305F\u3044\u5834\u5408\u306E\u307F\u3001\u30AA\u30D7\u30B7\u30E7\u30F3\u306E\`subject\`\u30D1\u30E9\u30E1\u30FC\u30BF\u3092\u6E21\u3057\u3066\u304F\u3060\u3055\u3044\u3002
783
836
 
784
837
  ### Business Logic
785
838
 
@@ -1,5 +1,5 @@
1
1
  import * as _squadbase_connectors_sdk from '@squadbase/connectors/sdk';
2
2
 
3
- declare const connection: (connectionId: string) => _squadbase_connectors_sdk.LinkedInAdsOauthConnectorSdk;
3
+ declare const connection: (connectionId: string) => _squadbase_connectors_sdk.GoogleDocsConnectorSdk;
4
4
 
5
5
  export { connection };