@squadbase/vite-server 0.1.3-dev.0 → 0.1.3-dev.10

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 (70) hide show
  1. package/dist/cli/index.js +82859 -9645
  2. package/dist/connectors/airtable-oauth.js +77 -3
  3. package/dist/connectors/airtable.js +85 -2
  4. package/dist/connectors/amplitude.js +85 -2
  5. package/dist/connectors/anthropic.js +85 -2
  6. package/dist/connectors/{slack.d.ts → asana.d.ts} +1 -1
  7. package/dist/connectors/asana.js +744 -0
  8. package/dist/connectors/attio.js +85 -2
  9. package/dist/connectors/{microsoft-teams-oauth.d.ts → customerio.d.ts} +1 -1
  10. package/dist/connectors/customerio.js +716 -0
  11. package/dist/connectors/dbt.js +85 -2
  12. package/dist/connectors/gemini.js +86 -3
  13. package/dist/connectors/{microsoft-teams.d.ts → gmail-oauth.d.ts} +1 -1
  14. package/dist/connectors/gmail-oauth.js +713 -0
  15. package/dist/connectors/gmail.d.ts +5 -0
  16. package/dist/connectors/gmail.js +875 -0
  17. package/dist/connectors/google-ads-oauth.js +78 -4
  18. package/dist/connectors/google-ads.d.ts +5 -0
  19. package/dist/connectors/google-ads.js +867 -0
  20. package/dist/connectors/google-analytics-oauth.js +90 -8
  21. package/dist/connectors/google-analytics.js +85 -2
  22. package/dist/connectors/google-calendar-oauth.d.ts +5 -0
  23. package/dist/connectors/google-calendar-oauth.js +817 -0
  24. package/dist/connectors/google-calendar.d.ts +5 -0
  25. package/dist/connectors/google-calendar.js +991 -0
  26. package/dist/connectors/google-sheets-oauth.js +144 -33
  27. package/dist/connectors/google-sheets.d.ts +5 -0
  28. package/dist/connectors/google-sheets.js +707 -0
  29. package/dist/connectors/grafana.d.ts +5 -0
  30. package/dist/connectors/grafana.js +638 -0
  31. package/dist/connectors/hubspot-oauth.js +77 -3
  32. package/dist/connectors/hubspot.js +89 -6
  33. package/dist/connectors/intercom-oauth.d.ts +5 -0
  34. package/dist/connectors/intercom-oauth.js +584 -0
  35. package/dist/connectors/intercom.d.ts +5 -0
  36. package/dist/connectors/intercom.js +710 -0
  37. package/dist/connectors/jira-api-key.d.ts +5 -0
  38. package/dist/connectors/jira-api-key.js +598 -0
  39. package/dist/connectors/kintone-api-token.js +77 -3
  40. package/dist/connectors/kintone.js +86 -3
  41. package/dist/connectors/linkedin-ads-oauth.d.ts +5 -0
  42. package/dist/connectors/linkedin-ads-oauth.js +848 -0
  43. package/dist/connectors/linkedin-ads.d.ts +5 -0
  44. package/dist/connectors/linkedin-ads.js +865 -0
  45. package/dist/connectors/mailchimp-oauth.d.ts +5 -0
  46. package/dist/connectors/mailchimp-oauth.js +613 -0
  47. package/dist/connectors/mailchimp.d.ts +5 -0
  48. package/dist/connectors/mailchimp.js +729 -0
  49. package/dist/connectors/notion-oauth.d.ts +5 -0
  50. package/dist/connectors/notion-oauth.js +567 -0
  51. package/dist/connectors/notion.d.ts +5 -0
  52. package/dist/connectors/notion.js +663 -0
  53. package/dist/connectors/openai.js +85 -2
  54. package/dist/connectors/shopify-oauth.js +77 -3
  55. package/dist/connectors/shopify.js +85 -2
  56. package/dist/connectors/stripe-api-key.d.ts +5 -0
  57. package/dist/connectors/stripe-api-key.js +600 -0
  58. package/dist/connectors/stripe-oauth.js +77 -3
  59. package/dist/connectors/wix-store.js +85 -2
  60. package/dist/connectors/zendesk-oauth.d.ts +5 -0
  61. package/dist/connectors/zendesk-oauth.js +579 -0
  62. package/dist/connectors/zendesk.d.ts +5 -0
  63. package/dist/connectors/zendesk.js +714 -0
  64. package/dist/index.js +83024 -7099
  65. package/dist/main.js +82988 -7063
  66. package/dist/vite-plugin.js +82862 -6974
  67. package/package.json +86 -2
  68. package/dist/connectors/microsoft-teams-oauth.js +0 -479
  69. package/dist/connectors/microsoft-teams.js +0 -381
  70. package/dist/connectors/slack.js +0 -362
@@ -114,7 +114,8 @@ var AUTH_TYPES = {
114
114
  API_KEY: "api-key",
115
115
  JWT: "jwt",
116
116
  SERVICE_ACCOUNT: "service-account",
117
- PAT: "pat"
117
+ PAT: "pat",
118
+ USER_PASSWORD: "user-password"
118
119
  };
119
120
 
120
121
  // ../connectors/src/connectors/hubspot-oauth/tools/request.ts
@@ -281,7 +282,7 @@ var tools = { request: requestTool };
281
282
  var hubspotOauthConnector = new ConnectorPlugin({
282
283
  slug: "hubspot",
283
284
  authType: AUTH_TYPES.OAUTH,
284
- name: "HubSpot (OAuth)",
285
+ name: "HubSpot",
285
286
  description: "Connect to HubSpot CRM for contacts, deals, companies, and marketing data using OAuth.",
286
287
  iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/5UcSkKkzhUMA4RsM45ynuo/43b967e36915ca0fc5d277684b204320/hubspot.svg",
287
288
  parameters,
@@ -434,6 +435,79 @@ function resolveEnvVarOptional(entry, key) {
434
435
  return process.env[envVarName] || void 0;
435
436
  }
436
437
 
438
+ // src/connector-client/proxy-fetch.ts
439
+ import { getContext } from "hono/context-storage";
440
+ import { getCookie } from "hono/cookie";
441
+ var APP_SESSION_COOKIE_NAME = "__Host-squadbase-session";
442
+ function createSandboxProxyFetch(connectionId) {
443
+ return async (input, init) => {
444
+ const token = process.env.INTERNAL_SQUADBASE_OAUTH_MACHINE_CREDENTIAL;
445
+ const sandboxId = process.env.INTERNAL_SQUADBASE_SANDBOX_ID;
446
+ if (!token || !sandboxId) {
447
+ throw new Error(
448
+ "Connection proxy is not configured. Please check your deployment settings."
449
+ );
450
+ }
451
+ const originalUrl = typeof input === "string" ? input : input instanceof URL ? input.href : input.url;
452
+ const originalMethod = init?.method ?? "GET";
453
+ const originalBody = init?.body ? JSON.parse(init.body) : void 0;
454
+ const baseDomain = process.env["SQUADBASE_PREVIEW_BASE_DOMAIN"] ?? "preview.app.squadbase.dev";
455
+ const proxyUrl = `https://${sandboxId}.${baseDomain}/_sqcore/connections/${connectionId}/request`;
456
+ return fetch(proxyUrl, {
457
+ method: "POST",
458
+ headers: {
459
+ "Content-Type": "application/json",
460
+ Authorization: `Bearer ${token}`
461
+ },
462
+ body: JSON.stringify({
463
+ url: originalUrl,
464
+ method: originalMethod,
465
+ body: originalBody
466
+ })
467
+ });
468
+ };
469
+ }
470
+ function createDeployedAppProxyFetch(connectionId) {
471
+ const projectId = process.env["SQUADBASE_PROJECT_ID"];
472
+ if (!projectId) {
473
+ throw new Error(
474
+ "Connection proxy is not configured. Please check your deployment settings."
475
+ );
476
+ }
477
+ const baseDomain = process.env["SQUADBASE_APP_BASE_DOMAIN"] ?? "squadbase.app";
478
+ const proxyUrl = `https://${projectId}.${baseDomain}/_sqcore/connections/${connectionId}/request`;
479
+ return async (input, init) => {
480
+ const originalUrl = typeof input === "string" ? input : input instanceof URL ? input.href : input.url;
481
+ const originalMethod = init?.method ?? "GET";
482
+ const originalBody = init?.body ? JSON.parse(init.body) : void 0;
483
+ const c = getContext();
484
+ const appSession = getCookie(c, APP_SESSION_COOKIE_NAME);
485
+ if (!appSession) {
486
+ throw new Error(
487
+ "No authentication method available for connection proxy."
488
+ );
489
+ }
490
+ return fetch(proxyUrl, {
491
+ method: "POST",
492
+ headers: {
493
+ "Content-Type": "application/json",
494
+ Authorization: `Bearer ${appSession}`
495
+ },
496
+ body: JSON.stringify({
497
+ url: originalUrl,
498
+ method: originalMethod,
499
+ body: originalBody
500
+ })
501
+ });
502
+ };
503
+ }
504
+ function createProxyFetch(connectionId) {
505
+ if (process.env.INTERNAL_SQUADBASE_SANDBOX_ID) {
506
+ return createSandboxProxyFetch(connectionId);
507
+ }
508
+ return createDeployedAppProxyFetch(connectionId);
509
+ }
510
+
437
511
  // src/connectors/create-connector-sdk.ts
438
512
  function loadConnectionsSync() {
439
513
  const filePath = process.env.CONNECTIONS_PATH ?? path.join(process.cwd(), ".squadbase/connections.json");
@@ -467,7 +541,7 @@ function createConnectorSdk(plugin, createClient2) {
467
541
  if (val !== void 0) params[param.slug] = val;
468
542
  }
469
543
  }
470
- return createClient2(params);
544
+ return createClient2(params, createProxyFetch(connectionId));
471
545
  };
472
546
  }
473
547
 
@@ -46,8 +46,8 @@ var ParameterDefinition = class {
46
46
  var parameters = {
47
47
  apiKey: new ParameterDefinition({
48
48
  slug: "api-key",
49
- name: "HubSpot Private App Access Token",
50
- description: "The HubSpot private app access token for authentication (starts with pat-).",
49
+ name: "Private App Access Token",
50
+ description: "Your HubSpot Private App Access Token for authentication (starts with pat-). You can find it at Settings \u2192 Development \u2192 Legacy Apps \u2192 your Private App.",
51
51
  envVarBaseKey: "HUBSPOT_API_KEY",
52
52
  type: "text",
53
53
  secret: true,
@@ -237,6 +237,16 @@ var ConnectorPlugin = class _ConnectorPlugin {
237
237
  }
238
238
  };
239
239
 
240
+ // ../connectors/src/auth-types.ts
241
+ var AUTH_TYPES = {
242
+ OAUTH: "oauth",
243
+ API_KEY: "api-key",
244
+ JWT: "jwt",
245
+ SERVICE_ACCOUNT: "service-account",
246
+ PAT: "pat",
247
+ USER_PASSWORD: "user-password"
248
+ };
249
+
240
250
  // ../connectors/src/connectors/hubspot/setup.ts
241
251
  var hubspotOnboarding = new ConnectorOnboarding({
242
252
  dataOverviewInstructions: {
@@ -280,7 +290,7 @@ var outputSchema = z.discriminatedUnion("success", [
280
290
  var requestTool = new ConnectorTool({
281
291
  name: "request",
282
292
  description: `Send authenticated requests to the HubSpot API.
283
- Authentication is handled automatically using the Private App Access Token (Bearer token).
293
+ Authentication is handled automatically using the Personal Access Key (Bearer token).
284
294
  Use this tool for all HubSpot API interactions: querying contacts, deals, companies, tickets, and other CRM objects.
285
295
  Use the search endpoint (POST /crm/v3/objects/{objectType}/search) for complex queries with filters.`,
286
296
  inputSchema,
@@ -331,9 +341,9 @@ Use the search endpoint (POST /crm/v3/objects/{objectType}/search) for complex q
331
341
  var tools = { request: requestTool };
332
342
  var hubspotConnector = new ConnectorPlugin({
333
343
  slug: "hubspot",
334
- authType: null,
344
+ authType: AUTH_TYPES.API_KEY,
335
345
  name: "HubSpot",
336
- description: "Connect to HubSpot CRM for contacts, deals, companies, and marketing data using a Private App Access Token.",
346
+ description: "Connect to HubSpot CRM for contacts, deals, companies, and marketing data using a Personal Access Key.",
337
347
  iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/5UcSkKkzhUMA4RsM45ynuo/43b967e36915ca0fc5d277684b204320/hubspot.svg",
338
348
  parameters,
339
349
  releaseFlag: { dev1: true, dev2: false, prod: false },
@@ -497,6 +507,79 @@ function resolveEnvVarOptional(entry, key) {
497
507
  return process.env[envVarName] || void 0;
498
508
  }
499
509
 
510
+ // src/connector-client/proxy-fetch.ts
511
+ import { getContext } from "hono/context-storage";
512
+ import { getCookie } from "hono/cookie";
513
+ var APP_SESSION_COOKIE_NAME = "__Host-squadbase-session";
514
+ function createSandboxProxyFetch(connectionId) {
515
+ return async (input, init) => {
516
+ const token = process.env.INTERNAL_SQUADBASE_OAUTH_MACHINE_CREDENTIAL;
517
+ const sandboxId = process.env.INTERNAL_SQUADBASE_SANDBOX_ID;
518
+ if (!token || !sandboxId) {
519
+ throw new Error(
520
+ "Connection proxy is not configured. Please check your deployment settings."
521
+ );
522
+ }
523
+ const originalUrl = typeof input === "string" ? input : input instanceof URL ? input.href : input.url;
524
+ const originalMethod = init?.method ?? "GET";
525
+ const originalBody = init?.body ? JSON.parse(init.body) : void 0;
526
+ const baseDomain = process.env["SQUADBASE_PREVIEW_BASE_DOMAIN"] ?? "preview.app.squadbase.dev";
527
+ const proxyUrl = `https://${sandboxId}.${baseDomain}/_sqcore/connections/${connectionId}/request`;
528
+ return fetch(proxyUrl, {
529
+ method: "POST",
530
+ headers: {
531
+ "Content-Type": "application/json",
532
+ Authorization: `Bearer ${token}`
533
+ },
534
+ body: JSON.stringify({
535
+ url: originalUrl,
536
+ method: originalMethod,
537
+ body: originalBody
538
+ })
539
+ });
540
+ };
541
+ }
542
+ function createDeployedAppProxyFetch(connectionId) {
543
+ const projectId = process.env["SQUADBASE_PROJECT_ID"];
544
+ if (!projectId) {
545
+ throw new Error(
546
+ "Connection proxy is not configured. Please check your deployment settings."
547
+ );
548
+ }
549
+ const baseDomain = process.env["SQUADBASE_APP_BASE_DOMAIN"] ?? "squadbase.app";
550
+ const proxyUrl = `https://${projectId}.${baseDomain}/_sqcore/connections/${connectionId}/request`;
551
+ return async (input, init) => {
552
+ const originalUrl = typeof input === "string" ? input : input instanceof URL ? input.href : input.url;
553
+ const originalMethod = init?.method ?? "GET";
554
+ const originalBody = init?.body ? JSON.parse(init.body) : void 0;
555
+ const c = getContext();
556
+ const appSession = getCookie(c, APP_SESSION_COOKIE_NAME);
557
+ if (!appSession) {
558
+ throw new Error(
559
+ "No authentication method available for connection proxy."
560
+ );
561
+ }
562
+ return fetch(proxyUrl, {
563
+ method: "POST",
564
+ headers: {
565
+ "Content-Type": "application/json",
566
+ Authorization: `Bearer ${appSession}`
567
+ },
568
+ body: JSON.stringify({
569
+ url: originalUrl,
570
+ method: originalMethod,
571
+ body: originalBody
572
+ })
573
+ });
574
+ };
575
+ }
576
+ function createProxyFetch(connectionId) {
577
+ if (process.env.INTERNAL_SQUADBASE_SANDBOX_ID) {
578
+ return createSandboxProxyFetch(connectionId);
579
+ }
580
+ return createDeployedAppProxyFetch(connectionId);
581
+ }
582
+
500
583
  // src/connectors/create-connector-sdk.ts
501
584
  function loadConnectionsSync() {
502
585
  const filePath = process.env.CONNECTIONS_PATH ?? path.join(process.cwd(), ".squadbase/connections.json");
@@ -530,7 +613,7 @@ function createConnectorSdk(plugin, createClient2) {
530
613
  if (val !== void 0) params[param.slug] = val;
531
614
  }
532
615
  }
533
- return createClient2(params);
616
+ return createClient2(params, createProxyFetch(connectionId));
534
617
  };
535
618
  }
536
619
 
@@ -0,0 +1,5 @@
1
+ import * as _squadbase_connectors_sdk from '@squadbase/connectors/sdk';
2
+
3
+ declare const connection: (connectionId: string) => _squadbase_connectors_sdk.IntercomOauthConnectorSdk;
4
+
5
+ export { connection };