@squadbase/vite-server 0.1.3-dev.1 → 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 (56) hide show
  1. package/dist/cli/index.js +71031 -6800
  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/asana.js +86 -3
  7. package/dist/connectors/attio.js +85 -2
  8. package/dist/connectors/customerio.js +86 -3
  9. package/dist/connectors/dbt.js +85 -2
  10. package/dist/connectors/gemini.js +86 -3
  11. package/dist/connectors/gmail-oauth.js +78 -4
  12. package/dist/connectors/gmail.d.ts +5 -0
  13. package/dist/connectors/gmail.js +875 -0
  14. package/dist/connectors/google-ads-oauth.js +78 -4
  15. package/dist/connectors/google-ads.js +85 -2
  16. package/dist/connectors/google-analytics-oauth.js +90 -8
  17. package/dist/connectors/google-analytics.js +85 -2
  18. package/dist/connectors/google-calendar-oauth.d.ts +5 -0
  19. package/dist/connectors/google-calendar-oauth.js +817 -0
  20. package/dist/connectors/google-calendar.d.ts +5 -0
  21. package/dist/connectors/google-calendar.js +991 -0
  22. package/dist/connectors/google-sheets-oauth.js +144 -33
  23. package/dist/connectors/google-sheets.js +119 -10
  24. package/dist/connectors/{microsoft-teams.d.ts → grafana.d.ts} +1 -1
  25. package/dist/connectors/grafana.js +638 -0
  26. package/dist/connectors/hubspot-oauth.js +77 -3
  27. package/dist/connectors/hubspot.js +79 -5
  28. package/dist/connectors/intercom-oauth.js +78 -4
  29. package/dist/connectors/intercom.js +86 -3
  30. package/dist/connectors/jira-api-key.js +84 -9
  31. package/dist/connectors/kintone-api-token.js +77 -3
  32. package/dist/connectors/kintone.js +86 -3
  33. package/dist/connectors/linkedin-ads-oauth.js +78 -4
  34. package/dist/connectors/linkedin-ads.js +86 -3
  35. package/dist/connectors/mailchimp-oauth.js +77 -3
  36. package/dist/connectors/mailchimp.js +86 -3
  37. package/dist/connectors/{microsoft-teams-oauth.d.ts → notion-oauth.d.ts} +1 -1
  38. package/dist/connectors/notion-oauth.js +567 -0
  39. package/dist/connectors/{slack.d.ts → notion.d.ts} +1 -1
  40. package/dist/connectors/notion.js +663 -0
  41. package/dist/connectors/openai.js +85 -2
  42. package/dist/connectors/shopify-oauth.js +77 -3
  43. package/dist/connectors/shopify.js +85 -2
  44. package/dist/connectors/stripe-api-key.d.ts +5 -0
  45. package/dist/connectors/stripe-api-key.js +600 -0
  46. package/dist/connectors/stripe-oauth.js +77 -3
  47. package/dist/connectors/wix-store.js +85 -2
  48. package/dist/connectors/zendesk-oauth.js +78 -4
  49. package/dist/connectors/zendesk.js +86 -3
  50. package/dist/index.js +75373 -8431
  51. package/dist/main.js +75359 -8417
  52. package/dist/vite-plugin.js +75210 -8305
  53. package/package.json +46 -2
  54. package/dist/connectors/microsoft-teams-oauth.js +0 -479
  55. package/dist/connectors/microsoft-teams.js +0 -381
  56. 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: "Personal Access Key",
50
- description: "Your HubSpot Personal Access Key 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,
@@ -243,7 +243,8 @@ var AUTH_TYPES = {
243
243
  API_KEY: "api-key",
244
244
  JWT: "jwt",
245
245
  SERVICE_ACCOUNT: "service-account",
246
- PAT: "pat"
246
+ PAT: "pat",
247
+ USER_PASSWORD: "user-password"
247
248
  };
248
249
 
249
250
  // ../connectors/src/connectors/hubspot/setup.ts
@@ -340,7 +341,7 @@ Use the search endpoint (POST /crm/v3/objects/{objectType}/search) for complex q
340
341
  var tools = { request: requestTool };
341
342
  var hubspotConnector = new ConnectorPlugin({
342
343
  slug: "hubspot",
343
- authType: AUTH_TYPES.PAT,
344
+ authType: AUTH_TYPES.API_KEY,
344
345
  name: "HubSpot",
345
346
  description: "Connect to HubSpot CRM for contacts, deals, companies, and marketing data using a Personal Access Key.",
346
347
  iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/5UcSkKkzhUMA4RsM45ynuo/43b967e36915ca0fc5d277684b204320/hubspot.svg",
@@ -506,6 +507,79 @@ function resolveEnvVarOptional(entry, key) {
506
507
  return process.env[envVarName] || void 0;
507
508
  }
508
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
+
509
583
  // src/connectors/create-connector-sdk.ts
510
584
  function loadConnectionsSync() {
511
585
  const filePath = process.env.CONNECTIONS_PATH ?? path.join(process.cwd(), ".squadbase/connections.json");
@@ -539,7 +613,7 @@ function createConnectorSdk(plugin, createClient2) {
539
613
  if (val !== void 0) params[param.slug] = val;
540
614
  }
541
615
  }
542
- return createClient2(params);
616
+ return createClient2(params, createProxyFetch(connectionId));
543
617
  };
544
618
  }
545
619
 
@@ -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/intercom-oauth/tools/request.ts
@@ -288,9 +289,9 @@ var tools = { request: requestTool };
288
289
  var intercomOauthConnector = new ConnectorPlugin({
289
290
  slug: "intercom",
290
291
  authType: AUTH_TYPES.OAUTH,
291
- name: "Intercom (OAuth)",
292
+ name: "Intercom",
292
293
  description: "Connect to Intercom for contacts, conversations, companies, and customer engagement data using OAuth.",
293
- iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/1vKzXhRhJvDWGlAXdqBzMM/c0a58d645fba28a7ff6e2e0f84a098e9/intercom.svg",
294
+ iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/sb2cRMGClpId0LKiSqsok/ae90a0849f21ffe3faf73e04a5676b45/intercom.svg",
294
295
  parameters,
295
296
  releaseFlag: { dev1: true, dev2: false, prod: false },
296
297
  onboarding: intercomOauthOnboarding,
@@ -466,6 +467,79 @@ function resolveEnvVarOptional(entry, key) {
466
467
  return process.env[envVarName] || void 0;
467
468
  }
468
469
 
470
+ // src/connector-client/proxy-fetch.ts
471
+ import { getContext } from "hono/context-storage";
472
+ import { getCookie } from "hono/cookie";
473
+ var APP_SESSION_COOKIE_NAME = "__Host-squadbase-session";
474
+ function createSandboxProxyFetch(connectionId) {
475
+ return async (input, init) => {
476
+ const token = process.env.INTERNAL_SQUADBASE_OAUTH_MACHINE_CREDENTIAL;
477
+ const sandboxId = process.env.INTERNAL_SQUADBASE_SANDBOX_ID;
478
+ if (!token || !sandboxId) {
479
+ throw new Error(
480
+ "Connection proxy is not configured. Please check your deployment settings."
481
+ );
482
+ }
483
+ const originalUrl = typeof input === "string" ? input : input instanceof URL ? input.href : input.url;
484
+ const originalMethod = init?.method ?? "GET";
485
+ const originalBody = init?.body ? JSON.parse(init.body) : void 0;
486
+ const baseDomain = process.env["SQUADBASE_PREVIEW_BASE_DOMAIN"] ?? "preview.app.squadbase.dev";
487
+ const proxyUrl = `https://${sandboxId}.${baseDomain}/_sqcore/connections/${connectionId}/request`;
488
+ return fetch(proxyUrl, {
489
+ method: "POST",
490
+ headers: {
491
+ "Content-Type": "application/json",
492
+ Authorization: `Bearer ${token}`
493
+ },
494
+ body: JSON.stringify({
495
+ url: originalUrl,
496
+ method: originalMethod,
497
+ body: originalBody
498
+ })
499
+ });
500
+ };
501
+ }
502
+ function createDeployedAppProxyFetch(connectionId) {
503
+ const projectId = process.env["SQUADBASE_PROJECT_ID"];
504
+ if (!projectId) {
505
+ throw new Error(
506
+ "Connection proxy is not configured. Please check your deployment settings."
507
+ );
508
+ }
509
+ const baseDomain = process.env["SQUADBASE_APP_BASE_DOMAIN"] ?? "squadbase.app";
510
+ const proxyUrl = `https://${projectId}.${baseDomain}/_sqcore/connections/${connectionId}/request`;
511
+ return async (input, init) => {
512
+ const originalUrl = typeof input === "string" ? input : input instanceof URL ? input.href : input.url;
513
+ const originalMethod = init?.method ?? "GET";
514
+ const originalBody = init?.body ? JSON.parse(init.body) : void 0;
515
+ const c = getContext();
516
+ const appSession = getCookie(c, APP_SESSION_COOKIE_NAME);
517
+ if (!appSession) {
518
+ throw new Error(
519
+ "No authentication method available for connection proxy."
520
+ );
521
+ }
522
+ return fetch(proxyUrl, {
523
+ method: "POST",
524
+ headers: {
525
+ "Content-Type": "application/json",
526
+ Authorization: `Bearer ${appSession}`
527
+ },
528
+ body: JSON.stringify({
529
+ url: originalUrl,
530
+ method: originalMethod,
531
+ body: originalBody
532
+ })
533
+ });
534
+ };
535
+ }
536
+ function createProxyFetch(connectionId) {
537
+ if (process.env.INTERNAL_SQUADBASE_SANDBOX_ID) {
538
+ return createSandboxProxyFetch(connectionId);
539
+ }
540
+ return createDeployedAppProxyFetch(connectionId);
541
+ }
542
+
469
543
  // src/connectors/create-connector-sdk.ts
470
544
  function loadConnectionsSync() {
471
545
  const filePath = process.env.CONNECTIONS_PATH ?? path.join(process.cwd(), ".squadbase/connections.json");
@@ -499,7 +573,7 @@ function createConnectorSdk(plugin, createClient2) {
499
573
  if (val !== void 0) params[param.slug] = val;
500
574
  }
501
575
  }
502
- return createClient2(params);
576
+ return createClient2(params, createProxyFetch(connectionId));
503
577
  };
504
578
  }
505
579
 
@@ -255,6 +255,16 @@ var ConnectorPlugin = class _ConnectorPlugin {
255
255
  }
256
256
  };
257
257
 
258
+ // ../connectors/src/auth-types.ts
259
+ var AUTH_TYPES = {
260
+ OAUTH: "oauth",
261
+ API_KEY: "api-key",
262
+ JWT: "jwt",
263
+ SERVICE_ACCOUNT: "service-account",
264
+ PAT: "pat",
265
+ USER_PASSWORD: "user-password"
266
+ };
267
+
258
268
  // ../connectors/src/connectors/intercom/setup.ts
259
269
  var intercomOnboarding = new ConnectorOnboarding({
260
270
  dataOverviewInstructions: {
@@ -357,10 +367,10 @@ The Intercom-Version header is set to 2.11 automatically.`,
357
367
  var tools = { request: requestTool };
358
368
  var intercomConnector = new ConnectorPlugin({
359
369
  slug: "intercom",
360
- authType: null,
370
+ authType: AUTH_TYPES.API_KEY,
361
371
  name: "Intercom",
362
372
  description: "Connect to Intercom for contacts, conversations, companies, and customer engagement data using an Access Token.",
363
- iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/1vKzXhRhJvDWGlAXdqBzMM/c0a58d645fba28a7ff6e2e0f84a098e9/intercom.svg",
373
+ iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/sb2cRMGClpId0LKiSqsok/ae90a0849f21ffe3faf73e04a5676b45/intercom.svg",
364
374
  parameters,
365
375
  releaseFlag: { dev1: true, dev2: false, prod: false },
366
376
  onboarding: intercomOnboarding,
@@ -583,6 +593,79 @@ function resolveEnvVarOptional(entry, key) {
583
593
  return process.env[envVarName] || void 0;
584
594
  }
585
595
 
596
+ // src/connector-client/proxy-fetch.ts
597
+ import { getContext } from "hono/context-storage";
598
+ import { getCookie } from "hono/cookie";
599
+ var APP_SESSION_COOKIE_NAME = "__Host-squadbase-session";
600
+ function createSandboxProxyFetch(connectionId) {
601
+ return async (input, init) => {
602
+ const token = process.env.INTERNAL_SQUADBASE_OAUTH_MACHINE_CREDENTIAL;
603
+ const sandboxId = process.env.INTERNAL_SQUADBASE_SANDBOX_ID;
604
+ if (!token || !sandboxId) {
605
+ throw new Error(
606
+ "Connection proxy is not configured. Please check your deployment settings."
607
+ );
608
+ }
609
+ const originalUrl = typeof input === "string" ? input : input instanceof URL ? input.href : input.url;
610
+ const originalMethod = init?.method ?? "GET";
611
+ const originalBody = init?.body ? JSON.parse(init.body) : void 0;
612
+ const baseDomain = process.env["SQUADBASE_PREVIEW_BASE_DOMAIN"] ?? "preview.app.squadbase.dev";
613
+ const proxyUrl = `https://${sandboxId}.${baseDomain}/_sqcore/connections/${connectionId}/request`;
614
+ return fetch(proxyUrl, {
615
+ method: "POST",
616
+ headers: {
617
+ "Content-Type": "application/json",
618
+ Authorization: `Bearer ${token}`
619
+ },
620
+ body: JSON.stringify({
621
+ url: originalUrl,
622
+ method: originalMethod,
623
+ body: originalBody
624
+ })
625
+ });
626
+ };
627
+ }
628
+ function createDeployedAppProxyFetch(connectionId) {
629
+ const projectId = process.env["SQUADBASE_PROJECT_ID"];
630
+ if (!projectId) {
631
+ throw new Error(
632
+ "Connection proxy is not configured. Please check your deployment settings."
633
+ );
634
+ }
635
+ const baseDomain = process.env["SQUADBASE_APP_BASE_DOMAIN"] ?? "squadbase.app";
636
+ const proxyUrl = `https://${projectId}.${baseDomain}/_sqcore/connections/${connectionId}/request`;
637
+ return async (input, init) => {
638
+ const originalUrl = typeof input === "string" ? input : input instanceof URL ? input.href : input.url;
639
+ const originalMethod = init?.method ?? "GET";
640
+ const originalBody = init?.body ? JSON.parse(init.body) : void 0;
641
+ const c = getContext();
642
+ const appSession = getCookie(c, APP_SESSION_COOKIE_NAME);
643
+ if (!appSession) {
644
+ throw new Error(
645
+ "No authentication method available for connection proxy."
646
+ );
647
+ }
648
+ return fetch(proxyUrl, {
649
+ method: "POST",
650
+ headers: {
651
+ "Content-Type": "application/json",
652
+ Authorization: `Bearer ${appSession}`
653
+ },
654
+ body: JSON.stringify({
655
+ url: originalUrl,
656
+ method: originalMethod,
657
+ body: originalBody
658
+ })
659
+ });
660
+ };
661
+ }
662
+ function createProxyFetch(connectionId) {
663
+ if (process.env.INTERNAL_SQUADBASE_SANDBOX_ID) {
664
+ return createSandboxProxyFetch(connectionId);
665
+ }
666
+ return createDeployedAppProxyFetch(connectionId);
667
+ }
668
+
586
669
  // src/connectors/create-connector-sdk.ts
587
670
  function loadConnectionsSync() {
588
671
  const filePath = process.env.CONNECTIONS_PATH ?? path.join(process.cwd(), ".squadbase/connections.json");
@@ -616,7 +699,7 @@ function createConnectorSdk(plugin, createClient2) {
616
699
  if (val !== void 0) params[param.slug] = val;
617
700
  }
618
701
  }
619
- return createClient2(params);
702
+ return createClient2(params, createProxyFetch(connectionId));
620
703
  };
621
704
  }
622
705
 
@@ -47,7 +47,7 @@ var parameters = {
47
47
  instanceUrl: new ParameterDefinition({
48
48
  slug: "instance-url",
49
49
  name: "Jira Instance URL",
50
- description: "The base URL of your Jira Cloud instance (e.g., https://your-domain.atlassian.net).",
50
+ description: "Your Jira Cloud site URL \u2014 just the base address, without any trailing path. For example: https://your-domain.atlassian.net",
51
51
  envVarBaseKey: "JIRA_INSTANCE_URL",
52
52
  type: "text",
53
53
  secret: false,
@@ -64,8 +64,8 @@ var parameters = {
64
64
  }),
65
65
  apiToken: new ParameterDefinition({
66
66
  slug: "api-token",
67
- name: "Jira API Token",
68
- description: "API token for authentication. Generate from Atlassian Account Settings > Security > API tokens (https://id.atlassian.com/manage/api-tokens).",
67
+ name: "Atlassian API Token",
68
+ description: "Your Atlassian account API token (used for Jira authentication). You can create one at: Atlassian Account Settings > Security > API tokens (https://id.atlassian.com/manage/api-tokens).",
69
69
  envVarBaseKey: "JIRA_API_TOKEN",
70
70
  type: "text",
71
71
  secret: true,
@@ -210,7 +210,8 @@ var AUTH_TYPES = {
210
210
  API_KEY: "api-key",
211
211
  JWT: "jwt",
212
212
  SERVICE_ACCOUNT: "service-account",
213
- PAT: "pat"
213
+ PAT: "pat",
214
+ USER_PASSWORD: "user-password"
214
215
  };
215
216
 
216
217
  // ../connectors/src/connectors/jira/setup.ts
@@ -239,7 +240,7 @@ var outputSchema = z.discriminatedUnion("success", [
239
240
  z.object({
240
241
  success: z.literal(true),
241
242
  status: z.number(),
242
- data: z.record(z.string(), z.unknown())
243
+ data: z.union([z.record(z.string(), z.unknown()), z.array(z.unknown())])
243
244
  }),
244
245
  z.object({
245
246
  success: z.literal(false),
@@ -287,7 +288,8 @@ The base URL and authentication credentials are configured per connection \u2014
287
288
  }
288
289
  const data = await response.json();
289
290
  if (!response.ok) {
290
- const errorMessages = Array.isArray(data?.errorMessages) ? data.errorMessages.join("; ") : data?.message ?? `HTTP ${response.status} ${response.statusText}`;
291
+ const errData = data;
292
+ const errorMessages = Array.isArray(errData?.errorMessages) ? errData.errorMessages.join("; ") : errData?.message ?? `HTTP ${response.status} ${response.statusText}`;
291
293
  return { success: false, error: errorMessages };
292
294
  }
293
295
  return { success: true, status: response.status, data };
@@ -306,9 +308,9 @@ var tools = { request: requestTool };
306
308
  var jiraConnector = new ConnectorPlugin({
307
309
  slug: "jira",
308
310
  authType: AUTH_TYPES.API_KEY,
309
- name: "Jira (API Key)",
311
+ name: "Jira",
310
312
  description: "Connect to Jira Cloud for issue tracking, project management, and workflow data retrieval using API token authentication.",
311
- iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/3IsIFg5im7VjMxGh1K1j6P/a3be559bdca30e5497dd55a2f4ee66f0/jira.png",
313
+ iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/5zt4yjb36szSPPkCECYlPL/bc3e7223dc84fb16a1cce53a80f5afcc/jira.png",
312
314
  parameters,
313
315
  releaseFlag: { dev1: true, dev2: false, prod: false },
314
316
  onboarding: jiraOnboarding,
@@ -479,6 +481,79 @@ function resolveEnvVarOptional(entry, key) {
479
481
  return process.env[envVarName] || void 0;
480
482
  }
481
483
 
484
+ // src/connector-client/proxy-fetch.ts
485
+ import { getContext } from "hono/context-storage";
486
+ import { getCookie } from "hono/cookie";
487
+ var APP_SESSION_COOKIE_NAME = "__Host-squadbase-session";
488
+ function createSandboxProxyFetch(connectionId) {
489
+ return async (input, init) => {
490
+ const token = process.env.INTERNAL_SQUADBASE_OAUTH_MACHINE_CREDENTIAL;
491
+ const sandboxId = process.env.INTERNAL_SQUADBASE_SANDBOX_ID;
492
+ if (!token || !sandboxId) {
493
+ throw new Error(
494
+ "Connection proxy is not configured. Please check your deployment settings."
495
+ );
496
+ }
497
+ const originalUrl = typeof input === "string" ? input : input instanceof URL ? input.href : input.url;
498
+ const originalMethod = init?.method ?? "GET";
499
+ const originalBody = init?.body ? JSON.parse(init.body) : void 0;
500
+ const baseDomain = process.env["SQUADBASE_PREVIEW_BASE_DOMAIN"] ?? "preview.app.squadbase.dev";
501
+ const proxyUrl = `https://${sandboxId}.${baseDomain}/_sqcore/connections/${connectionId}/request`;
502
+ return fetch(proxyUrl, {
503
+ method: "POST",
504
+ headers: {
505
+ "Content-Type": "application/json",
506
+ Authorization: `Bearer ${token}`
507
+ },
508
+ body: JSON.stringify({
509
+ url: originalUrl,
510
+ method: originalMethod,
511
+ body: originalBody
512
+ })
513
+ });
514
+ };
515
+ }
516
+ function createDeployedAppProxyFetch(connectionId) {
517
+ const projectId = process.env["SQUADBASE_PROJECT_ID"];
518
+ if (!projectId) {
519
+ throw new Error(
520
+ "Connection proxy is not configured. Please check your deployment settings."
521
+ );
522
+ }
523
+ const baseDomain = process.env["SQUADBASE_APP_BASE_DOMAIN"] ?? "squadbase.app";
524
+ const proxyUrl = `https://${projectId}.${baseDomain}/_sqcore/connections/${connectionId}/request`;
525
+ return async (input, init) => {
526
+ const originalUrl = typeof input === "string" ? input : input instanceof URL ? input.href : input.url;
527
+ const originalMethod = init?.method ?? "GET";
528
+ const originalBody = init?.body ? JSON.parse(init.body) : void 0;
529
+ const c = getContext();
530
+ const appSession = getCookie(c, APP_SESSION_COOKIE_NAME);
531
+ if (!appSession) {
532
+ throw new Error(
533
+ "No authentication method available for connection proxy."
534
+ );
535
+ }
536
+ return fetch(proxyUrl, {
537
+ method: "POST",
538
+ headers: {
539
+ "Content-Type": "application/json",
540
+ Authorization: `Bearer ${appSession}`
541
+ },
542
+ body: JSON.stringify({
543
+ url: originalUrl,
544
+ method: originalMethod,
545
+ body: originalBody
546
+ })
547
+ });
548
+ };
549
+ }
550
+ function createProxyFetch(connectionId) {
551
+ if (process.env.INTERNAL_SQUADBASE_SANDBOX_ID) {
552
+ return createSandboxProxyFetch(connectionId);
553
+ }
554
+ return createDeployedAppProxyFetch(connectionId);
555
+ }
556
+
482
557
  // src/connectors/create-connector-sdk.ts
483
558
  function loadConnectionsSync() {
484
559
  const filePath = process.env.CONNECTIONS_PATH ?? path.join(process.cwd(), ".squadbase/connections.json");
@@ -512,7 +587,7 @@ function createConnectorSdk(plugin, createClient2) {
512
587
  if (val !== void 0) params[param.slug] = val;
513
588
  }
514
589
  }
515
- return createClient2(params);
590
+ return createClient2(params, createProxyFetch(connectionId));
516
591
  };
517
592
  }
518
593