@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
@@ -94,21 +94,58 @@ var ConnectorPlugin = class _ConnectorPlugin {
94
94
  * Filters connections by connectorKey internally.
95
95
  * Returns tools keyed as `${connectorKey}_${toolName}`.
96
96
  */
97
- createTools(connections, config) {
97
+ createTools(connections, config, opts) {
98
98
  const myConnections = connections.filter(
99
99
  (c) => _ConnectorPlugin.deriveKey(c.connector.slug, c.connector.authType) === this.connectorKey
100
100
  );
101
101
  const result = {};
102
102
  for (const t of Object.values(this.tools)) {
103
- result[`${this.connectorKey}_${t.name}`] = t.createTool(
104
- myConnections,
105
- config
106
- );
103
+ const tool = t.createTool(myConnections, config);
104
+ const originalToModelOutput = tool.toModelOutput;
105
+ result[`${this.connectorKey}_${t.name}`] = {
106
+ ...tool,
107
+ toModelOutput: async (options) => {
108
+ if (!originalToModelOutput) {
109
+ return opts.truncateOutput(options.output);
110
+ }
111
+ const modelOutput = await originalToModelOutput(options);
112
+ if (modelOutput.type === "text" || modelOutput.type === "json") {
113
+ return opts.truncateOutput(modelOutput.value);
114
+ }
115
+ return modelOutput;
116
+ }
117
+ };
107
118
  }
108
119
  return result;
109
120
  }
110
121
  static deriveKey(slug, authType) {
111
- return authType ? `${slug}-${authType}` : slug;
122
+ if (authType) return `${slug}-${authType}`;
123
+ const LEGACY_NULL_AUTH_TYPE_MAP = {
124
+ // user-password
125
+ "postgresql": "user-password",
126
+ "mysql": "user-password",
127
+ "clickhouse": "user-password",
128
+ "kintone": "user-password",
129
+ "squadbase-db": "user-password",
130
+ // service-account
131
+ "snowflake": "service-account",
132
+ "bigquery": "service-account",
133
+ "google-analytics": "service-account",
134
+ "google-calendar": "service-account",
135
+ "aws-athena": "service-account",
136
+ "redshift": "service-account",
137
+ // api-key
138
+ "databricks": "api-key",
139
+ "dbt": "api-key",
140
+ "airtable": "api-key",
141
+ "openai": "api-key",
142
+ "gemini": "api-key",
143
+ "anthropic": "api-key",
144
+ "wix-store": "api-key"
145
+ };
146
+ const fallbackAuthType = LEGACY_NULL_AUTH_TYPE_MAP[slug];
147
+ if (fallbackAuthType) return `${slug}-${fallbackAuthType}`;
148
+ return slug;
112
149
  }
113
150
  };
114
151
 
@@ -246,21 +246,58 @@ var ConnectorPlugin = class _ConnectorPlugin {
246
246
  * Filters connections by connectorKey internally.
247
247
  * Returns tools keyed as `${connectorKey}_${toolName}`.
248
248
  */
249
- createTools(connections, config) {
249
+ createTools(connections, config, opts) {
250
250
  const myConnections = connections.filter(
251
251
  (c) => _ConnectorPlugin.deriveKey(c.connector.slug, c.connector.authType) === this.connectorKey
252
252
  );
253
253
  const result = {};
254
254
  for (const t of Object.values(this.tools)) {
255
- result[`${this.connectorKey}_${t.name}`] = t.createTool(
256
- myConnections,
257
- config
258
- );
255
+ const tool = t.createTool(myConnections, config);
256
+ const originalToModelOutput = tool.toModelOutput;
257
+ result[`${this.connectorKey}_${t.name}`] = {
258
+ ...tool,
259
+ toModelOutput: async (options) => {
260
+ if (!originalToModelOutput) {
261
+ return opts.truncateOutput(options.output);
262
+ }
263
+ const modelOutput = await originalToModelOutput(options);
264
+ if (modelOutput.type === "text" || modelOutput.type === "json") {
265
+ return opts.truncateOutput(modelOutput.value);
266
+ }
267
+ return modelOutput;
268
+ }
269
+ };
259
270
  }
260
271
  return result;
261
272
  }
262
273
  static deriveKey(slug, authType) {
263
- return authType ? `${slug}-${authType}` : slug;
274
+ if (authType) return `${slug}-${authType}`;
275
+ const LEGACY_NULL_AUTH_TYPE_MAP = {
276
+ // user-password
277
+ "postgresql": "user-password",
278
+ "mysql": "user-password",
279
+ "clickhouse": "user-password",
280
+ "kintone": "user-password",
281
+ "squadbase-db": "user-password",
282
+ // service-account
283
+ "snowflake": "service-account",
284
+ "bigquery": "service-account",
285
+ "google-analytics": "service-account",
286
+ "google-calendar": "service-account",
287
+ "aws-athena": "service-account",
288
+ "redshift": "service-account",
289
+ // api-key
290
+ "databricks": "api-key",
291
+ "dbt": "api-key",
292
+ "airtable": "api-key",
293
+ "openai": "api-key",
294
+ "gemini": "api-key",
295
+ "anthropic": "api-key",
296
+ "wix-store": "api-key"
297
+ };
298
+ const fallbackAuthType = LEGACY_NULL_AUTH_TYPE_MAP[slug];
299
+ if (fallbackAuthType) return `${slug}-${fallbackAuthType}`;
300
+ return slug;
264
301
  }
265
302
  };
266
303
 
@@ -106,21 +106,58 @@ var ConnectorPlugin = class _ConnectorPlugin {
106
106
  * Filters connections by connectorKey internally.
107
107
  * Returns tools keyed as `${connectorKey}_${toolName}`.
108
108
  */
109
- createTools(connections, config) {
109
+ createTools(connections, config, opts) {
110
110
  const myConnections = connections.filter(
111
111
  (c) => _ConnectorPlugin.deriveKey(c.connector.slug, c.connector.authType) === this.connectorKey
112
112
  );
113
113
  const result = {};
114
114
  for (const t of Object.values(this.tools)) {
115
- result[`${this.connectorKey}_${t.name}`] = t.createTool(
116
- myConnections,
117
- config
118
- );
115
+ const tool = t.createTool(myConnections, config);
116
+ const originalToModelOutput = tool.toModelOutput;
117
+ result[`${this.connectorKey}_${t.name}`] = {
118
+ ...tool,
119
+ toModelOutput: async (options) => {
120
+ if (!originalToModelOutput) {
121
+ return opts.truncateOutput(options.output);
122
+ }
123
+ const modelOutput = await originalToModelOutput(options);
124
+ if (modelOutput.type === "text" || modelOutput.type === "json") {
125
+ return opts.truncateOutput(modelOutput.value);
126
+ }
127
+ return modelOutput;
128
+ }
129
+ };
119
130
  }
120
131
  return result;
121
132
  }
122
133
  static deriveKey(slug, authType) {
123
- return authType ? `${slug}-${authType}` : slug;
134
+ if (authType) return `${slug}-${authType}`;
135
+ const LEGACY_NULL_AUTH_TYPE_MAP = {
136
+ // user-password
137
+ "postgresql": "user-password",
138
+ "mysql": "user-password",
139
+ "clickhouse": "user-password",
140
+ "kintone": "user-password",
141
+ "squadbase-db": "user-password",
142
+ // service-account
143
+ "snowflake": "service-account",
144
+ "bigquery": "service-account",
145
+ "google-analytics": "service-account",
146
+ "google-calendar": "service-account",
147
+ "aws-athena": "service-account",
148
+ "redshift": "service-account",
149
+ // api-key
150
+ "databricks": "api-key",
151
+ "dbt": "api-key",
152
+ "airtable": "api-key",
153
+ "openai": "api-key",
154
+ "gemini": "api-key",
155
+ "anthropic": "api-key",
156
+ "wix-store": "api-key"
157
+ };
158
+ const fallbackAuthType = LEGACY_NULL_AUTH_TYPE_MAP[slug];
159
+ if (fallbackAuthType) return `${slug}-${fallbackAuthType}`;
160
+ return slug;
124
161
  }
125
162
  };
126
163
 
@@ -0,0 +1,5 @@
1
+ import * as _squadbase_connectors_sdk from '@squadbase/connectors/sdk';
2
+
3
+ declare const connection: (connectionId: string) => _squadbase_connectors_sdk.SentryConnectorSdk;
4
+
5
+ export { connection };