@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
@@ -88,21 +88,58 @@ var ConnectorPlugin = class _ConnectorPlugin {
88
88
  * Filters connections by connectorKey internally.
89
89
  * Returns tools keyed as `${connectorKey}_${toolName}`.
90
90
  */
91
- createTools(connections, config) {
91
+ createTools(connections, config, opts) {
92
92
  const myConnections = connections.filter(
93
93
  (c) => _ConnectorPlugin.deriveKey(c.connector.slug, c.connector.authType) === this.connectorKey
94
94
  );
95
95
  const result = {};
96
96
  for (const t of Object.values(this.tools)) {
97
- result[`${this.connectorKey}_${t.name}`] = t.createTool(
98
- myConnections,
99
- config
100
- );
97
+ const tool = t.createTool(myConnections, config);
98
+ const originalToModelOutput = tool.toModelOutput;
99
+ result[`${this.connectorKey}_${t.name}`] = {
100
+ ...tool,
101
+ toModelOutput: async (options) => {
102
+ if (!originalToModelOutput) {
103
+ return opts.truncateOutput(options.output);
104
+ }
105
+ const modelOutput = await originalToModelOutput(options);
106
+ if (modelOutput.type === "text" || modelOutput.type === "json") {
107
+ return opts.truncateOutput(modelOutput.value);
108
+ }
109
+ return modelOutput;
110
+ }
111
+ };
101
112
  }
102
113
  return result;
103
114
  }
104
115
  static deriveKey(slug, authType) {
105
- return authType ? `${slug}-${authType}` : slug;
116
+ if (authType) return `${slug}-${authType}`;
117
+ const LEGACY_NULL_AUTH_TYPE_MAP = {
118
+ // user-password
119
+ "postgresql": "user-password",
120
+ "mysql": "user-password",
121
+ "clickhouse": "user-password",
122
+ "kintone": "user-password",
123
+ "squadbase-db": "user-password",
124
+ // service-account
125
+ "snowflake": "service-account",
126
+ "bigquery": "service-account",
127
+ "google-analytics": "service-account",
128
+ "google-calendar": "service-account",
129
+ "aws-athena": "service-account",
130
+ "redshift": "service-account",
131
+ // api-key
132
+ "databricks": "api-key",
133
+ "dbt": "api-key",
134
+ "airtable": "api-key",
135
+ "openai": "api-key",
136
+ "gemini": "api-key",
137
+ "anthropic": "api-key",
138
+ "wix-store": "api-key"
139
+ };
140
+ const fallbackAuthType = LEGACY_NULL_AUTH_TYPE_MAP[slug];
141
+ if (fallbackAuthType) return `${slug}-${fallbackAuthType}`;
142
+ return slug;
106
143
  }
107
144
  };
108
145
 
@@ -362,21 +362,58 @@ var ConnectorPlugin = class _ConnectorPlugin {
362
362
  * Filters connections by connectorKey internally.
363
363
  * Returns tools keyed as `${connectorKey}_${toolName}`.
364
364
  */
365
- createTools(connections, config) {
365
+ createTools(connections, config, opts) {
366
366
  const myConnections = connections.filter(
367
367
  (c) => _ConnectorPlugin.deriveKey(c.connector.slug, c.connector.authType) === this.connectorKey
368
368
  );
369
369
  const result = {};
370
370
  for (const t of Object.values(this.tools)) {
371
- result[`${this.connectorKey}_${t.name}`] = t.createTool(
372
- myConnections,
373
- config
374
- );
371
+ const tool = t.createTool(myConnections, config);
372
+ const originalToModelOutput = tool.toModelOutput;
373
+ result[`${this.connectorKey}_${t.name}`] = {
374
+ ...tool,
375
+ toModelOutput: async (options) => {
376
+ if (!originalToModelOutput) {
377
+ return opts.truncateOutput(options.output);
378
+ }
379
+ const modelOutput = await originalToModelOutput(options);
380
+ if (modelOutput.type === "text" || modelOutput.type === "json") {
381
+ return opts.truncateOutput(modelOutput.value);
382
+ }
383
+ return modelOutput;
384
+ }
385
+ };
375
386
  }
376
387
  return result;
377
388
  }
378
389
  static deriveKey(slug, authType) {
379
- return authType ? `${slug}-${authType}` : slug;
390
+ if (authType) return `${slug}-${authType}`;
391
+ const LEGACY_NULL_AUTH_TYPE_MAP = {
392
+ // user-password
393
+ "postgresql": "user-password",
394
+ "mysql": "user-password",
395
+ "clickhouse": "user-password",
396
+ "kintone": "user-password",
397
+ "squadbase-db": "user-password",
398
+ // service-account
399
+ "snowflake": "service-account",
400
+ "bigquery": "service-account",
401
+ "google-analytics": "service-account",
402
+ "google-calendar": "service-account",
403
+ "aws-athena": "service-account",
404
+ "redshift": "service-account",
405
+ // api-key
406
+ "databricks": "api-key",
407
+ "dbt": "api-key",
408
+ "airtable": "api-key",
409
+ "openai": "api-key",
410
+ "gemini": "api-key",
411
+ "anthropic": "api-key",
412
+ "wix-store": "api-key"
413
+ };
414
+ const fallbackAuthType = LEGACY_NULL_AUTH_TYPE_MAP[slug];
415
+ if (fallbackAuthType) return `${slug}-${fallbackAuthType}`;
416
+ return slug;
380
417
  }
381
418
  };
382
419
 
@@ -156,21 +156,58 @@ var ConnectorPlugin = class _ConnectorPlugin {
156
156
  * Filters connections by connectorKey internally.
157
157
  * Returns tools keyed as `${connectorKey}_${toolName}`.
158
158
  */
159
- createTools(connections, config) {
159
+ createTools(connections, config, opts) {
160
160
  const myConnections = connections.filter(
161
161
  (c) => _ConnectorPlugin.deriveKey(c.connector.slug, c.connector.authType) === this.connectorKey
162
162
  );
163
163
  const result = {};
164
164
  for (const t of Object.values(this.tools)) {
165
- result[`${this.connectorKey}_${t.name}`] = t.createTool(
166
- myConnections,
167
- config
168
- );
165
+ const tool = t.createTool(myConnections, config);
166
+ const originalToModelOutput = tool.toModelOutput;
167
+ result[`${this.connectorKey}_${t.name}`] = {
168
+ ...tool,
169
+ toModelOutput: async (options) => {
170
+ if (!originalToModelOutput) {
171
+ return opts.truncateOutput(options.output);
172
+ }
173
+ const modelOutput = await originalToModelOutput(options);
174
+ if (modelOutput.type === "text" || modelOutput.type === "json") {
175
+ return opts.truncateOutput(modelOutput.value);
176
+ }
177
+ return modelOutput;
178
+ }
179
+ };
169
180
  }
170
181
  return result;
171
182
  }
172
183
  static deriveKey(slug, authType) {
173
- return authType ? `${slug}-${authType}` : slug;
184
+ if (authType) return `${slug}-${authType}`;
185
+ const LEGACY_NULL_AUTH_TYPE_MAP = {
186
+ // user-password
187
+ "postgresql": "user-password",
188
+ "mysql": "user-password",
189
+ "clickhouse": "user-password",
190
+ "kintone": "user-password",
191
+ "squadbase-db": "user-password",
192
+ // service-account
193
+ "snowflake": "service-account",
194
+ "bigquery": "service-account",
195
+ "google-analytics": "service-account",
196
+ "google-calendar": "service-account",
197
+ "aws-athena": "service-account",
198
+ "redshift": "service-account",
199
+ // api-key
200
+ "databricks": "api-key",
201
+ "dbt": "api-key",
202
+ "airtable": "api-key",
203
+ "openai": "api-key",
204
+ "gemini": "api-key",
205
+ "anthropic": "api-key",
206
+ "wix-store": "api-key"
207
+ };
208
+ const fallbackAuthType = LEGACY_NULL_AUTH_TYPE_MAP[slug];
209
+ if (fallbackAuthType) return `${slug}-${fallbackAuthType}`;
210
+ return slug;
174
211
  }
175
212
  };
176
213
 
@@ -250,7 +287,9 @@ Use this tool for all Stripe API interactions: querying charges, customers, invo
250
287
  if (body) {
251
288
  headers["Content-Type"] = "application/x-www-form-urlencoded";
252
289
  requestBody = new URLSearchParams(
253
- Object.entries(body).map(([k, v]) => [k, String(v)])
290
+ Object.entries(body).map(
291
+ ([k, v]) => [k, String(v)]
292
+ )
254
293
  ).toString();
255
294
  }
256
295
  const response = await fetch(url, {
@@ -90,21 +90,58 @@ var ConnectorPlugin = class _ConnectorPlugin {
90
90
  * Filters connections by connectorKey internally.
91
91
  * Returns tools keyed as `${connectorKey}_${toolName}`.
92
92
  */
93
- createTools(connections, config) {
93
+ createTools(connections, config, opts) {
94
94
  const myConnections = connections.filter(
95
95
  (c) => _ConnectorPlugin.deriveKey(c.connector.slug, c.connector.authType) === this.connectorKey
96
96
  );
97
97
  const result = {};
98
98
  for (const t of Object.values(this.tools)) {
99
- result[`${this.connectorKey}_${t.name}`] = t.createTool(
100
- myConnections,
101
- config
102
- );
99
+ const tool = t.createTool(myConnections, config);
100
+ const originalToModelOutput = tool.toModelOutput;
101
+ result[`${this.connectorKey}_${t.name}`] = {
102
+ ...tool,
103
+ toModelOutput: async (options) => {
104
+ if (!originalToModelOutput) {
105
+ return opts.truncateOutput(options.output);
106
+ }
107
+ const modelOutput = await originalToModelOutput(options);
108
+ if (modelOutput.type === "text" || modelOutput.type === "json") {
109
+ return opts.truncateOutput(modelOutput.value);
110
+ }
111
+ return modelOutput;
112
+ }
113
+ };
103
114
  }
104
115
  return result;
105
116
  }
106
117
  static deriveKey(slug, authType) {
107
- return authType ? `${slug}-${authType}` : slug;
118
+ if (authType) return `${slug}-${authType}`;
119
+ const LEGACY_NULL_AUTH_TYPE_MAP = {
120
+ // user-password
121
+ "postgresql": "user-password",
122
+ "mysql": "user-password",
123
+ "clickhouse": "user-password",
124
+ "kintone": "user-password",
125
+ "squadbase-db": "user-password",
126
+ // service-account
127
+ "snowflake": "service-account",
128
+ "bigquery": "service-account",
129
+ "google-analytics": "service-account",
130
+ "google-calendar": "service-account",
131
+ "aws-athena": "service-account",
132
+ "redshift": "service-account",
133
+ // api-key
134
+ "databricks": "api-key",
135
+ "dbt": "api-key",
136
+ "airtable": "api-key",
137
+ "openai": "api-key",
138
+ "gemini": "api-key",
139
+ "anthropic": "api-key",
140
+ "wix-store": "api-key"
141
+ };
142
+ const fallbackAuthType = LEGACY_NULL_AUTH_TYPE_MAP[slug];
143
+ if (fallbackAuthType) return `${slug}-${fallbackAuthType}`;
144
+ return slug;
108
145
  }
109
146
  };
110
147
 
@@ -281,21 +281,58 @@ var ConnectorPlugin = class _ConnectorPlugin {
281
281
  * Filters connections by connectorKey internally.
282
282
  * Returns tools keyed as `${connectorKey}_${toolName}`.
283
283
  */
284
- createTools(connections, config) {
284
+ createTools(connections, config, opts) {
285
285
  const myConnections = connections.filter(
286
286
  (c) => _ConnectorPlugin.deriveKey(c.connector.slug, c.connector.authType) === this.connectorKey
287
287
  );
288
288
  const result = {};
289
289
  for (const t of Object.values(this.tools)) {
290
- result[`${this.connectorKey}_${t.name}`] = t.createTool(
291
- myConnections,
292
- config
293
- );
290
+ const tool = t.createTool(myConnections, config);
291
+ const originalToModelOutput = tool.toModelOutput;
292
+ result[`${this.connectorKey}_${t.name}`] = {
293
+ ...tool,
294
+ toModelOutput: async (options) => {
295
+ if (!originalToModelOutput) {
296
+ return opts.truncateOutput(options.output);
297
+ }
298
+ const modelOutput = await originalToModelOutput(options);
299
+ if (modelOutput.type === "text" || modelOutput.type === "json") {
300
+ return opts.truncateOutput(modelOutput.value);
301
+ }
302
+ return modelOutput;
303
+ }
304
+ };
294
305
  }
295
306
  return result;
296
307
  }
297
308
  static deriveKey(slug, authType) {
298
- return authType ? `${slug}-${authType}` : slug;
309
+ if (authType) return `${slug}-${authType}`;
310
+ const LEGACY_NULL_AUTH_TYPE_MAP = {
311
+ // user-password
312
+ "postgresql": "user-password",
313
+ "mysql": "user-password",
314
+ "clickhouse": "user-password",
315
+ "kintone": "user-password",
316
+ "squadbase-db": "user-password",
317
+ // service-account
318
+ "snowflake": "service-account",
319
+ "bigquery": "service-account",
320
+ "google-analytics": "service-account",
321
+ "google-calendar": "service-account",
322
+ "aws-athena": "service-account",
323
+ "redshift": "service-account",
324
+ // api-key
325
+ "databricks": "api-key",
326
+ "dbt": "api-key",
327
+ "airtable": "api-key",
328
+ "openai": "api-key",
329
+ "gemini": "api-key",
330
+ "anthropic": "api-key",
331
+ "wix-store": "api-key"
332
+ };
333
+ const fallbackAuthType = LEGACY_NULL_AUTH_TYPE_MAP[slug];
334
+ if (fallbackAuthType) return `${slug}-${fallbackAuthType}`;
335
+ return slug;
299
336
  }
300
337
  };
301
338
 
@@ -88,21 +88,58 @@ var ConnectorPlugin = class _ConnectorPlugin {
88
88
  * Filters connections by connectorKey internally.
89
89
  * Returns tools keyed as `${connectorKey}_${toolName}`.
90
90
  */
91
- createTools(connections, config) {
91
+ createTools(connections, config, opts) {
92
92
  const myConnections = connections.filter(
93
93
  (c) => _ConnectorPlugin.deriveKey(c.connector.slug, c.connector.authType) === this.connectorKey
94
94
  );
95
95
  const result = {};
96
96
  for (const t of Object.values(this.tools)) {
97
- result[`${this.connectorKey}_${t.name}`] = t.createTool(
98
- myConnections,
99
- config
100
- );
97
+ const tool = t.createTool(myConnections, config);
98
+ const originalToModelOutput = tool.toModelOutput;
99
+ result[`${this.connectorKey}_${t.name}`] = {
100
+ ...tool,
101
+ toModelOutput: async (options) => {
102
+ if (!originalToModelOutput) {
103
+ return opts.truncateOutput(options.output);
104
+ }
105
+ const modelOutput = await originalToModelOutput(options);
106
+ if (modelOutput.type === "text" || modelOutput.type === "json") {
107
+ return opts.truncateOutput(modelOutput.value);
108
+ }
109
+ return modelOutput;
110
+ }
111
+ };
101
112
  }
102
113
  return result;
103
114
  }
104
115
  static deriveKey(slug, authType) {
105
- return authType ? `${slug}-${authType}` : slug;
116
+ if (authType) return `${slug}-${authType}`;
117
+ const LEGACY_NULL_AUTH_TYPE_MAP = {
118
+ // user-password
119
+ "postgresql": "user-password",
120
+ "mysql": "user-password",
121
+ "clickhouse": "user-password",
122
+ "kintone": "user-password",
123
+ "squadbase-db": "user-password",
124
+ // service-account
125
+ "snowflake": "service-account",
126
+ "bigquery": "service-account",
127
+ "google-analytics": "service-account",
128
+ "google-calendar": "service-account",
129
+ "aws-athena": "service-account",
130
+ "redshift": "service-account",
131
+ // api-key
132
+ "databricks": "api-key",
133
+ "dbt": "api-key",
134
+ "airtable": "api-key",
135
+ "openai": "api-key",
136
+ "gemini": "api-key",
137
+ "anthropic": "api-key",
138
+ "wix-store": "api-key"
139
+ };
140
+ const fallbackAuthType = LEGACY_NULL_AUTH_TYPE_MAP[slug];
141
+ if (fallbackAuthType) return `${slug}-${fallbackAuthType}`;
142
+ return slug;
106
143
  }
107
144
  };
108
145
 
@@ -263,21 +263,58 @@ var ConnectorPlugin = class _ConnectorPlugin {
263
263
  * Filters connections by connectorKey internally.
264
264
  * Returns tools keyed as `${connectorKey}_${toolName}`.
265
265
  */
266
- createTools(connections, config) {
266
+ createTools(connections, config, opts) {
267
267
  const myConnections = connections.filter(
268
268
  (c) => _ConnectorPlugin.deriveKey(c.connector.slug, c.connector.authType) === this.connectorKey
269
269
  );
270
270
  const result = {};
271
271
  for (const t of Object.values(this.tools)) {
272
- result[`${this.connectorKey}_${t.name}`] = t.createTool(
273
- myConnections,
274
- config
275
- );
272
+ const tool = t.createTool(myConnections, config);
273
+ const originalToModelOutput = tool.toModelOutput;
274
+ result[`${this.connectorKey}_${t.name}`] = {
275
+ ...tool,
276
+ toModelOutput: async (options) => {
277
+ if (!originalToModelOutput) {
278
+ return opts.truncateOutput(options.output);
279
+ }
280
+ const modelOutput = await originalToModelOutput(options);
281
+ if (modelOutput.type === "text" || modelOutput.type === "json") {
282
+ return opts.truncateOutput(modelOutput.value);
283
+ }
284
+ return modelOutput;
285
+ }
286
+ };
276
287
  }
277
288
  return result;
278
289
  }
279
290
  static deriveKey(slug, authType) {
280
- return authType ? `${slug}-${authType}` : slug;
291
+ if (authType) return `${slug}-${authType}`;
292
+ const LEGACY_NULL_AUTH_TYPE_MAP = {
293
+ // user-password
294
+ "postgresql": "user-password",
295
+ "mysql": "user-password",
296
+ "clickhouse": "user-password",
297
+ "kintone": "user-password",
298
+ "squadbase-db": "user-password",
299
+ // service-account
300
+ "snowflake": "service-account",
301
+ "bigquery": "service-account",
302
+ "google-analytics": "service-account",
303
+ "google-calendar": "service-account",
304
+ "aws-athena": "service-account",
305
+ "redshift": "service-account",
306
+ // api-key
307
+ "databricks": "api-key",
308
+ "dbt": "api-key",
309
+ "airtable": "api-key",
310
+ "openai": "api-key",
311
+ "gemini": "api-key",
312
+ "anthropic": "api-key",
313
+ "wix-store": "api-key"
314
+ };
315
+ const fallbackAuthType = LEGACY_NULL_AUTH_TYPE_MAP[slug];
316
+ if (fallbackAuthType) return `${slug}-${fallbackAuthType}`;
317
+ return slug;
281
318
  }
282
319
  };
283
320
 
package/dist/index.d.ts CHANGED
@@ -39,7 +39,7 @@ interface AirtableRecord {
39
39
  declare function createAirtableClient(entry: ConnectionEntry, slug: string): AirtableClient;
40
40
 
41
41
  interface GoogleAnalyticsClient {
42
- runReport(propertyId: string, request: {
42
+ runReport(request: {
43
43
  dateRanges: {
44
44
  startDate: string;
45
45
  endDate: string;