@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
@@ -149,21 +149,58 @@ var ConnectorPlugin = class _ConnectorPlugin {
149
149
  * Filters connections by connectorKey internally.
150
150
  * Returns tools keyed as `${connectorKey}_${toolName}`.
151
151
  */
152
- createTools(connections, config) {
152
+ createTools(connections, config, opts) {
153
153
  const myConnections = connections.filter(
154
154
  (c) => _ConnectorPlugin.deriveKey(c.connector.slug, c.connector.authType) === this.connectorKey
155
155
  );
156
156
  const result = {};
157
157
  for (const t of Object.values(this.tools)) {
158
- result[`${this.connectorKey}_${t.name}`] = t.createTool(
159
- myConnections,
160
- config
161
- );
158
+ const tool = t.createTool(myConnections, config);
159
+ const originalToModelOutput = tool.toModelOutput;
160
+ result[`${this.connectorKey}_${t.name}`] = {
161
+ ...tool,
162
+ toModelOutput: async (options) => {
163
+ if (!originalToModelOutput) {
164
+ return opts.truncateOutput(options.output);
165
+ }
166
+ const modelOutput = await originalToModelOutput(options);
167
+ if (modelOutput.type === "text" || modelOutput.type === "json") {
168
+ return opts.truncateOutput(modelOutput.value);
169
+ }
170
+ return modelOutput;
171
+ }
172
+ };
162
173
  }
163
174
  return result;
164
175
  }
165
176
  static deriveKey(slug, authType) {
166
- return authType ? `${slug}-${authType}` : slug;
177
+ if (authType) return `${slug}-${authType}`;
178
+ const LEGACY_NULL_AUTH_TYPE_MAP = {
179
+ // user-password
180
+ "postgresql": "user-password",
181
+ "mysql": "user-password",
182
+ "clickhouse": "user-password",
183
+ "kintone": "user-password",
184
+ "squadbase-db": "user-password",
185
+ // service-account
186
+ "snowflake": "service-account",
187
+ "bigquery": "service-account",
188
+ "google-analytics": "service-account",
189
+ "google-calendar": "service-account",
190
+ "aws-athena": "service-account",
191
+ "redshift": "service-account",
192
+ // api-key
193
+ "databricks": "api-key",
194
+ "dbt": "api-key",
195
+ "airtable": "api-key",
196
+ "openai": "api-key",
197
+ "gemini": "api-key",
198
+ "anthropic": "api-key",
199
+ "wix-store": "api-key"
200
+ };
201
+ const fallbackAuthType = LEGACY_NULL_AUTH_TYPE_MAP[slug];
202
+ if (fallbackAuthType) return `${slug}-${fallbackAuthType}`;
203
+ return slug;
167
204
  }
168
205
  };
169
206
 
@@ -279,21 +279,58 @@ var ConnectorPlugin = class _ConnectorPlugin {
279
279
  * Filters connections by connectorKey internally.
280
280
  * Returns tools keyed as `${connectorKey}_${toolName}`.
281
281
  */
282
- createTools(connections, config) {
282
+ createTools(connections, config, opts) {
283
283
  const myConnections = connections.filter(
284
284
  (c) => _ConnectorPlugin.deriveKey(c.connector.slug, c.connector.authType) === this.connectorKey
285
285
  );
286
286
  const result = {};
287
287
  for (const t of Object.values(this.tools)) {
288
- result[`${this.connectorKey}_${t.name}`] = t.createTool(
289
- myConnections,
290
- config
291
- );
288
+ const tool = t.createTool(myConnections, config);
289
+ const originalToModelOutput = tool.toModelOutput;
290
+ result[`${this.connectorKey}_${t.name}`] = {
291
+ ...tool,
292
+ toModelOutput: async (options) => {
293
+ if (!originalToModelOutput) {
294
+ return opts.truncateOutput(options.output);
295
+ }
296
+ const modelOutput = await originalToModelOutput(options);
297
+ if (modelOutput.type === "text" || modelOutput.type === "json") {
298
+ return opts.truncateOutput(modelOutput.value);
299
+ }
300
+ return modelOutput;
301
+ }
302
+ };
292
303
  }
293
304
  return result;
294
305
  }
295
306
  static deriveKey(slug, authType) {
296
- return authType ? `${slug}-${authType}` : slug;
307
+ if (authType) return `${slug}-${authType}`;
308
+ const LEGACY_NULL_AUTH_TYPE_MAP = {
309
+ // user-password
310
+ "postgresql": "user-password",
311
+ "mysql": "user-password",
312
+ "clickhouse": "user-password",
313
+ "kintone": "user-password",
314
+ "squadbase-db": "user-password",
315
+ // service-account
316
+ "snowflake": "service-account",
317
+ "bigquery": "service-account",
318
+ "google-analytics": "service-account",
319
+ "google-calendar": "service-account",
320
+ "aws-athena": "service-account",
321
+ "redshift": "service-account",
322
+ // api-key
323
+ "databricks": "api-key",
324
+ "dbt": "api-key",
325
+ "airtable": "api-key",
326
+ "openai": "api-key",
327
+ "gemini": "api-key",
328
+ "anthropic": "api-key",
329
+ "wix-store": "api-key"
330
+ };
331
+ const fallbackAuthType = LEGACY_NULL_AUTH_TYPE_MAP[slug];
332
+ if (fallbackAuthType) return `${slug}-${fallbackAuthType}`;
333
+ return slug;
297
334
  }
298
335
  };
299
336
 
@@ -239,21 +239,58 @@ var ConnectorPlugin = class _ConnectorPlugin {
239
239
  * Filters connections by connectorKey internally.
240
240
  * Returns tools keyed as `${connectorKey}_${toolName}`.
241
241
  */
242
- createTools(connections, config) {
242
+ createTools(connections, config, opts) {
243
243
  const myConnections = connections.filter(
244
244
  (c) => _ConnectorPlugin.deriveKey(c.connector.slug, c.connector.authType) === this.connectorKey
245
245
  );
246
246
  const result = {};
247
247
  for (const t of Object.values(this.tools)) {
248
- result[`${this.connectorKey}_${t.name}`] = t.createTool(
249
- myConnections,
250
- config
251
- );
248
+ const tool = t.createTool(myConnections, config);
249
+ const originalToModelOutput = tool.toModelOutput;
250
+ result[`${this.connectorKey}_${t.name}`] = {
251
+ ...tool,
252
+ toModelOutput: async (options) => {
253
+ if (!originalToModelOutput) {
254
+ return opts.truncateOutput(options.output);
255
+ }
256
+ const modelOutput = await originalToModelOutput(options);
257
+ if (modelOutput.type === "text" || modelOutput.type === "json") {
258
+ return opts.truncateOutput(modelOutput.value);
259
+ }
260
+ return modelOutput;
261
+ }
262
+ };
252
263
  }
253
264
  return result;
254
265
  }
255
266
  static deriveKey(slug, authType) {
256
- return authType ? `${slug}-${authType}` : slug;
267
+ if (authType) return `${slug}-${authType}`;
268
+ const LEGACY_NULL_AUTH_TYPE_MAP = {
269
+ // user-password
270
+ "postgresql": "user-password",
271
+ "mysql": "user-password",
272
+ "clickhouse": "user-password",
273
+ "kintone": "user-password",
274
+ "squadbase-db": "user-password",
275
+ // service-account
276
+ "snowflake": "service-account",
277
+ "bigquery": "service-account",
278
+ "google-analytics": "service-account",
279
+ "google-calendar": "service-account",
280
+ "aws-athena": "service-account",
281
+ "redshift": "service-account",
282
+ // api-key
283
+ "databricks": "api-key",
284
+ "dbt": "api-key",
285
+ "airtable": "api-key",
286
+ "openai": "api-key",
287
+ "gemini": "api-key",
288
+ "anthropic": "api-key",
289
+ "wix-store": "api-key"
290
+ };
291
+ const fallbackAuthType = LEGACY_NULL_AUTH_TYPE_MAP[slug];
292
+ if (fallbackAuthType) return `${slug}-${fallbackAuthType}`;
293
+ return slug;
257
294
  }
258
295
  };
259
296
 
@@ -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
 
@@ -276,21 +276,58 @@ var ConnectorPlugin = class _ConnectorPlugin {
276
276
  * Filters connections by connectorKey internally.
277
277
  * Returns tools keyed as `${connectorKey}_${toolName}`.
278
278
  */
279
- createTools(connections, config) {
279
+ createTools(connections, config, opts) {
280
280
  const myConnections = connections.filter(
281
281
  (c) => _ConnectorPlugin.deriveKey(c.connector.slug, c.connector.authType) === this.connectorKey
282
282
  );
283
283
  const result = {};
284
284
  for (const t of Object.values(this.tools)) {
285
- result[`${this.connectorKey}_${t.name}`] = t.createTool(
286
- myConnections,
287
- config
288
- );
285
+ const tool = t.createTool(myConnections, config);
286
+ const originalToModelOutput = tool.toModelOutput;
287
+ result[`${this.connectorKey}_${t.name}`] = {
288
+ ...tool,
289
+ toModelOutput: async (options) => {
290
+ if (!originalToModelOutput) {
291
+ return opts.truncateOutput(options.output);
292
+ }
293
+ const modelOutput = await originalToModelOutput(options);
294
+ if (modelOutput.type === "text" || modelOutput.type === "json") {
295
+ return opts.truncateOutput(modelOutput.value);
296
+ }
297
+ return modelOutput;
298
+ }
299
+ };
289
300
  }
290
301
  return result;
291
302
  }
292
303
  static deriveKey(slug, authType) {
293
- return authType ? `${slug}-${authType}` : slug;
304
+ if (authType) return `${slug}-${authType}`;
305
+ const LEGACY_NULL_AUTH_TYPE_MAP = {
306
+ // user-password
307
+ "postgresql": "user-password",
308
+ "mysql": "user-password",
309
+ "clickhouse": "user-password",
310
+ "kintone": "user-password",
311
+ "squadbase-db": "user-password",
312
+ // service-account
313
+ "snowflake": "service-account",
314
+ "bigquery": "service-account",
315
+ "google-analytics": "service-account",
316
+ "google-calendar": "service-account",
317
+ "aws-athena": "service-account",
318
+ "redshift": "service-account",
319
+ // api-key
320
+ "databricks": "api-key",
321
+ "dbt": "api-key",
322
+ "airtable": "api-key",
323
+ "openai": "api-key",
324
+ "gemini": "api-key",
325
+ "anthropic": "api-key",
326
+ "wix-store": "api-key"
327
+ };
328
+ const fallbackAuthType = LEGACY_NULL_AUTH_TYPE_MAP[slug];
329
+ if (fallbackAuthType) return `${slug}-${fallbackAuthType}`;
330
+ return slug;
294
331
  }
295
332
  };
296
333