@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/stripe-oauth/tools/request.ts
@@ -281,7 +282,7 @@ var tools = { request: requestTool };
281
282
  var stripeOauthConnector = new ConnectorPlugin({
282
283
  slug: "stripe",
283
284
  authType: AUTH_TYPES.OAUTH,
284
- name: "Stripe (OAuth)",
285
+ name: "Stripe",
285
286
  description: "Connect to Stripe for payment, customer, and subscription data using OAuth.",
286
287
  iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/2QNK0u2doqp41uL0POS4Ks/7a92367e2388ec77c7f4ada143606f9a/stripe.jpeg",
287
288
  parameters,
@@ -441,6 +442,79 @@ function resolveEnvVarOptional(entry, key) {
441
442
  return process.env[envVarName] || void 0;
442
443
  }
443
444
 
445
+ // src/connector-client/proxy-fetch.ts
446
+ import { getContext } from "hono/context-storage";
447
+ import { getCookie } from "hono/cookie";
448
+ var APP_SESSION_COOKIE_NAME = "__Host-squadbase-session";
449
+ function createSandboxProxyFetch(connectionId) {
450
+ return async (input, init) => {
451
+ const token = process.env.INTERNAL_SQUADBASE_OAUTH_MACHINE_CREDENTIAL;
452
+ const sandboxId = process.env.INTERNAL_SQUADBASE_SANDBOX_ID;
453
+ if (!token || !sandboxId) {
454
+ throw new Error(
455
+ "Connection proxy is not configured. Please check your deployment settings."
456
+ );
457
+ }
458
+ const originalUrl = typeof input === "string" ? input : input instanceof URL ? input.href : input.url;
459
+ const originalMethod = init?.method ?? "GET";
460
+ const originalBody = init?.body ? JSON.parse(init.body) : void 0;
461
+ const baseDomain = process.env["SQUADBASE_PREVIEW_BASE_DOMAIN"] ?? "preview.app.squadbase.dev";
462
+ const proxyUrl = `https://${sandboxId}.${baseDomain}/_sqcore/connections/${connectionId}/request`;
463
+ return fetch(proxyUrl, {
464
+ method: "POST",
465
+ headers: {
466
+ "Content-Type": "application/json",
467
+ Authorization: `Bearer ${token}`
468
+ },
469
+ body: JSON.stringify({
470
+ url: originalUrl,
471
+ method: originalMethod,
472
+ body: originalBody
473
+ })
474
+ });
475
+ };
476
+ }
477
+ function createDeployedAppProxyFetch(connectionId) {
478
+ const projectId = process.env["SQUADBASE_PROJECT_ID"];
479
+ if (!projectId) {
480
+ throw new Error(
481
+ "Connection proxy is not configured. Please check your deployment settings."
482
+ );
483
+ }
484
+ const baseDomain = process.env["SQUADBASE_APP_BASE_DOMAIN"] ?? "squadbase.app";
485
+ const proxyUrl = `https://${projectId}.${baseDomain}/_sqcore/connections/${connectionId}/request`;
486
+ return async (input, init) => {
487
+ const originalUrl = typeof input === "string" ? input : input instanceof URL ? input.href : input.url;
488
+ const originalMethod = init?.method ?? "GET";
489
+ const originalBody = init?.body ? JSON.parse(init.body) : void 0;
490
+ const c = getContext();
491
+ const appSession = getCookie(c, APP_SESSION_COOKIE_NAME);
492
+ if (!appSession) {
493
+ throw new Error(
494
+ "No authentication method available for connection proxy."
495
+ );
496
+ }
497
+ return fetch(proxyUrl, {
498
+ method: "POST",
499
+ headers: {
500
+ "Content-Type": "application/json",
501
+ Authorization: `Bearer ${appSession}`
502
+ },
503
+ body: JSON.stringify({
504
+ url: originalUrl,
505
+ method: originalMethod,
506
+ body: originalBody
507
+ })
508
+ });
509
+ };
510
+ }
511
+ function createProxyFetch(connectionId) {
512
+ if (process.env.INTERNAL_SQUADBASE_SANDBOX_ID) {
513
+ return createSandboxProxyFetch(connectionId);
514
+ }
515
+ return createDeployedAppProxyFetch(connectionId);
516
+ }
517
+
444
518
  // src/connectors/create-connector-sdk.ts
445
519
  function loadConnectionsSync() {
446
520
  const filePath = process.env.CONNECTIONS_PATH ?? path.join(process.cwd(), ".squadbase/connections.json");
@@ -474,7 +548,7 @@ function createConnectorSdk(plugin, createClient2) {
474
548
  if (val !== void 0) params[param.slug] = val;
475
549
  }
476
550
  }
477
- return createClient2(params);
551
+ return createClient2(params, createProxyFetch(connectionId));
478
552
  };
479
553
  }
480
554
 
@@ -299,6 +299,16 @@ var ConnectorPlugin = class _ConnectorPlugin {
299
299
  }
300
300
  };
301
301
 
302
+ // ../connectors/src/auth-types.ts
303
+ var AUTH_TYPES = {
304
+ OAUTH: "oauth",
305
+ API_KEY: "api-key",
306
+ JWT: "jwt",
307
+ SERVICE_ACCOUNT: "service-account",
308
+ PAT: "pat",
309
+ USER_PASSWORD: "user-password"
310
+ };
311
+
302
312
  // ../connectors/src/connectors/wix-store/setup.ts
303
313
  var wixStoreOnboarding = new ConnectorOnboarding({
304
314
  dataOverviewInstructions: {
@@ -385,7 +395,7 @@ Authentication is handled automatically using the API Key and Site ID.`,
385
395
  var tools = { request: requestTool };
386
396
  var wixStoreConnector = new ConnectorPlugin({
387
397
  slug: "wix-store",
388
- authType: null,
398
+ authType: AUTH_TYPES.API_KEY,
389
399
  name: "Wix Store",
390
400
  description: "Connect to Wix Store.",
391
401
  iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/YyFxclQFzROIYpFam6vRK/e7e75d3feac49a1cc5e433c147216d23/Wix_logo_black.svg",
@@ -567,6 +577,79 @@ function resolveEnvVarOptional(entry, key) {
567
577
  return process.env[envVarName] || void 0;
568
578
  }
569
579
 
580
+ // src/connector-client/proxy-fetch.ts
581
+ import { getContext } from "hono/context-storage";
582
+ import { getCookie } from "hono/cookie";
583
+ var APP_SESSION_COOKIE_NAME = "__Host-squadbase-session";
584
+ function createSandboxProxyFetch(connectionId) {
585
+ return async (input, init) => {
586
+ const token = process.env.INTERNAL_SQUADBASE_OAUTH_MACHINE_CREDENTIAL;
587
+ const sandboxId = process.env.INTERNAL_SQUADBASE_SANDBOX_ID;
588
+ if (!token || !sandboxId) {
589
+ throw new Error(
590
+ "Connection proxy is not configured. Please check your deployment settings."
591
+ );
592
+ }
593
+ const originalUrl = typeof input === "string" ? input : input instanceof URL ? input.href : input.url;
594
+ const originalMethod = init?.method ?? "GET";
595
+ const originalBody = init?.body ? JSON.parse(init.body) : void 0;
596
+ const baseDomain = process.env["SQUADBASE_PREVIEW_BASE_DOMAIN"] ?? "preview.app.squadbase.dev";
597
+ const proxyUrl = `https://${sandboxId}.${baseDomain}/_sqcore/connections/${connectionId}/request`;
598
+ return fetch(proxyUrl, {
599
+ method: "POST",
600
+ headers: {
601
+ "Content-Type": "application/json",
602
+ Authorization: `Bearer ${token}`
603
+ },
604
+ body: JSON.stringify({
605
+ url: originalUrl,
606
+ method: originalMethod,
607
+ body: originalBody
608
+ })
609
+ });
610
+ };
611
+ }
612
+ function createDeployedAppProxyFetch(connectionId) {
613
+ const projectId = process.env["SQUADBASE_PROJECT_ID"];
614
+ if (!projectId) {
615
+ throw new Error(
616
+ "Connection proxy is not configured. Please check your deployment settings."
617
+ );
618
+ }
619
+ const baseDomain = process.env["SQUADBASE_APP_BASE_DOMAIN"] ?? "squadbase.app";
620
+ const proxyUrl = `https://${projectId}.${baseDomain}/_sqcore/connections/${connectionId}/request`;
621
+ return async (input, init) => {
622
+ const originalUrl = typeof input === "string" ? input : input instanceof URL ? input.href : input.url;
623
+ const originalMethod = init?.method ?? "GET";
624
+ const originalBody = init?.body ? JSON.parse(init.body) : void 0;
625
+ const c = getContext();
626
+ const appSession = getCookie(c, APP_SESSION_COOKIE_NAME);
627
+ if (!appSession) {
628
+ throw new Error(
629
+ "No authentication method available for connection proxy."
630
+ );
631
+ }
632
+ return fetch(proxyUrl, {
633
+ method: "POST",
634
+ headers: {
635
+ "Content-Type": "application/json",
636
+ Authorization: `Bearer ${appSession}`
637
+ },
638
+ body: JSON.stringify({
639
+ url: originalUrl,
640
+ method: originalMethod,
641
+ body: originalBody
642
+ })
643
+ });
644
+ };
645
+ }
646
+ function createProxyFetch(connectionId) {
647
+ if (process.env.INTERNAL_SQUADBASE_SANDBOX_ID) {
648
+ return createSandboxProxyFetch(connectionId);
649
+ }
650
+ return createDeployedAppProxyFetch(connectionId);
651
+ }
652
+
570
653
  // src/connectors/create-connector-sdk.ts
571
654
  function loadConnectionsSync() {
572
655
  const filePath = process.env.CONNECTIONS_PATH ?? path.join(process.cwd(), ".squadbase/connections.json");
@@ -600,7 +683,7 @@ function createConnectorSdk(plugin, createClient2) {
600
683
  if (val !== void 0) params[param.slug] = val;
601
684
  }
602
685
  }
603
- return createClient2(params);
686
+ return createClient2(params, createProxyFetch(connectionId));
604
687
  };
605
688
  }
606
689
 
@@ -0,0 +1,5 @@
1
+ import * as _squadbase_connectors_sdk from '@squadbase/connectors/sdk';
2
+
3
+ declare const connection: (connectionId: string) => _squadbase_connectors_sdk.ZendeskOauthConnectorSdk;
4
+
5
+ export { connection };