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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/dist/cli/index.js +14539 -29447
  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 +522 -118
  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 +4574 -3863
  58. package/dist/main.js +4572 -3862
  59. package/dist/vite-plugin.js +4572 -3862
  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
@@ -257,21 +257,58 @@ var ConnectorPlugin = class _ConnectorPlugin {
257
257
  * Filters connections by connectorKey internally.
258
258
  * Returns tools keyed as `${connectorKey}_${toolName}`.
259
259
  */
260
- createTools(connections, config) {
260
+ createTools(connections, config, opts) {
261
261
  const myConnections = connections.filter(
262
262
  (c) => _ConnectorPlugin.deriveKey(c.connector.slug, c.connector.authType) === this.connectorKey
263
263
  );
264
264
  const result = {};
265
265
  for (const t of Object.values(this.tools)) {
266
- result[`${this.connectorKey}_${t.name}`] = t.createTool(
267
- myConnections,
268
- config
269
- );
266
+ const tool = t.createTool(myConnections, config);
267
+ const originalToModelOutput = tool.toModelOutput;
268
+ result[`${this.connectorKey}_${t.name}`] = {
269
+ ...tool,
270
+ toModelOutput: async (options) => {
271
+ if (!originalToModelOutput) {
272
+ return opts.truncateOutput(options.output);
273
+ }
274
+ const modelOutput = await originalToModelOutput(options);
275
+ if (modelOutput.type === "text" || modelOutput.type === "json") {
276
+ return opts.truncateOutput(modelOutput.value);
277
+ }
278
+ return modelOutput;
279
+ }
280
+ };
270
281
  }
271
282
  return result;
272
283
  }
273
284
  static deriveKey(slug, authType) {
274
- return authType ? `${slug}-${authType}` : slug;
285
+ if (authType) return `${slug}-${authType}`;
286
+ const LEGACY_NULL_AUTH_TYPE_MAP = {
287
+ // user-password
288
+ "postgresql": "user-password",
289
+ "mysql": "user-password",
290
+ "clickhouse": "user-password",
291
+ "kintone": "user-password",
292
+ "squadbase-db": "user-password",
293
+ // service-account
294
+ "snowflake": "service-account",
295
+ "bigquery": "service-account",
296
+ "google-analytics": "service-account",
297
+ "google-calendar": "service-account",
298
+ "aws-athena": "service-account",
299
+ "redshift": "service-account",
300
+ // api-key
301
+ "databricks": "api-key",
302
+ "dbt": "api-key",
303
+ "airtable": "api-key",
304
+ "openai": "api-key",
305
+ "gemini": "api-key",
306
+ "anthropic": "api-key",
307
+ "wix-store": "api-key"
308
+ };
309
+ const fallbackAuthType = LEGACY_NULL_AUTH_TYPE_MAP[slug];
310
+ if (fallbackAuthType) return `${slug}-${fallbackAuthType}`;
311
+ return slug;
275
312
  }
276
313
  };
277
314
 
@@ -399,21 +399,58 @@ var ConnectorPlugin = class _ConnectorPlugin {
399
399
  * Filters connections by connectorKey internally.
400
400
  * Returns tools keyed as `${connectorKey}_${toolName}`.
401
401
  */
402
- createTools(connections, config) {
402
+ createTools(connections, config, opts) {
403
403
  const myConnections = connections.filter(
404
404
  (c) => _ConnectorPlugin.deriveKey(c.connector.slug, c.connector.authType) === this.connectorKey
405
405
  );
406
406
  const result = {};
407
407
  for (const t of Object.values(this.tools)) {
408
- result[`${this.connectorKey}_${t.name}`] = t.createTool(
409
- myConnections,
410
- config
411
- );
408
+ const tool = t.createTool(myConnections, config);
409
+ const originalToModelOutput = tool.toModelOutput;
410
+ result[`${this.connectorKey}_${t.name}`] = {
411
+ ...tool,
412
+ toModelOutput: async (options) => {
413
+ if (!originalToModelOutput) {
414
+ return opts.truncateOutput(options.output);
415
+ }
416
+ const modelOutput = await originalToModelOutput(options);
417
+ if (modelOutput.type === "text" || modelOutput.type === "json") {
418
+ return opts.truncateOutput(modelOutput.value);
419
+ }
420
+ return modelOutput;
421
+ }
422
+ };
412
423
  }
413
424
  return result;
414
425
  }
415
426
  static deriveKey(slug, authType) {
416
- return authType ? `${slug}-${authType}` : slug;
427
+ if (authType) return `${slug}-${authType}`;
428
+ const LEGACY_NULL_AUTH_TYPE_MAP = {
429
+ // user-password
430
+ "postgresql": "user-password",
431
+ "mysql": "user-password",
432
+ "clickhouse": "user-password",
433
+ "kintone": "user-password",
434
+ "squadbase-db": "user-password",
435
+ // service-account
436
+ "snowflake": "service-account",
437
+ "bigquery": "service-account",
438
+ "google-analytics": "service-account",
439
+ "google-calendar": "service-account",
440
+ "aws-athena": "service-account",
441
+ "redshift": "service-account",
442
+ // api-key
443
+ "databricks": "api-key",
444
+ "dbt": "api-key",
445
+ "airtable": "api-key",
446
+ "openai": "api-key",
447
+ "gemini": "api-key",
448
+ "anthropic": "api-key",
449
+ "wix-store": "api-key"
450
+ };
451
+ const fallbackAuthType = LEGACY_NULL_AUTH_TYPE_MAP[slug];
452
+ if (fallbackAuthType) return `${slug}-${fallbackAuthType}`;
453
+ return slug;
417
454
  }
418
455
  };
419
456
 
@@ -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.GoogleSheetsConnectorSdk;
3
+ declare const connection: (connectionId: string) => _squadbase_connectors_sdk.GammaConnectorSdk;
4
4
 
5
5
  export { connection };