@squadbase/vite-server 0.1.12-dev.a9ac647 → 0.1.17-dev.3b633bb

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 (77) hide show
  1. package/dist/cli/index.js +14375 -1652
  2. package/dist/connectors/airtable-oauth.js +282 -46
  3. package/dist/connectors/airtable.js +319 -51
  4. package/dist/connectors/amplitude.js +322 -47
  5. package/dist/connectors/anthropic.js +135 -47
  6. package/dist/connectors/asana.js +327 -49
  7. package/dist/connectors/attio.js +302 -49
  8. package/dist/connectors/aws-billing.js +287 -46
  9. package/dist/connectors/azure-sql.js +421 -102
  10. package/dist/connectors/backlog-api-key.js +317 -47
  11. package/dist/connectors/clickup.js +338 -49
  12. package/dist/connectors/cosmosdb.js +305 -50
  13. package/dist/connectors/customerio.js +319 -47
  14. package/dist/connectors/dbt.js +340 -47
  15. package/dist/connectors/freshdesk.js +342 -53
  16. package/dist/connectors/freshsales.js +333 -52
  17. package/dist/connectors/freshservice.js +361 -53
  18. package/dist/connectors/gamma.js +327 -52
  19. package/dist/connectors/gemini.js +134 -47
  20. package/dist/connectors/github.js +386 -49
  21. package/dist/connectors/gmail-oauth.js +204 -7
  22. package/dist/connectors/gmail.js +350 -47
  23. package/dist/connectors/google-ads.js +288 -46
  24. package/dist/connectors/google-analytics-oauth.js +310 -46
  25. package/dist/connectors/google-analytics.js +547 -87
  26. package/dist/connectors/google-audit-log.js +438 -47
  27. package/dist/connectors/google-calendar-oauth.js +259 -46
  28. package/dist/connectors/google-calendar.js +359 -47
  29. package/dist/connectors/google-docs.js +220 -6
  30. package/dist/connectors/google-drive.js +262 -5
  31. package/dist/connectors/google-search-console-oauth.js +256 -46
  32. package/dist/connectors/google-sheets.js +272 -47
  33. package/dist/connectors/google-slides.js +205 -6
  34. package/dist/connectors/grafana.js +332 -49
  35. package/dist/connectors/hubspot-oauth.js +208 -5
  36. package/dist/connectors/hubspot.js +306 -49
  37. package/dist/connectors/influxdb.js +416 -51
  38. package/dist/connectors/intercom-oauth.js +210 -5
  39. package/dist/connectors/intercom.js +302 -49
  40. package/dist/connectors/jdbc.js +762 -110
  41. package/dist/connectors/jira-api-key.js +326 -47
  42. package/dist/connectors/kintone-api-token.js +281 -47
  43. package/dist/connectors/kintone.js +328 -47
  44. package/dist/connectors/linear.js +330 -49
  45. package/dist/connectors/linkedin-ads.js +268 -50
  46. package/dist/connectors/mailchimp-oauth.js +268 -46
  47. package/dist/connectors/mailchimp.js +320 -49
  48. package/dist/connectors/meta-ads-oauth.js +273 -48
  49. package/dist/connectors/meta-ads.js +285 -50
  50. package/dist/connectors/mixpanel.js +338 -47
  51. package/dist/connectors/monday.js +360 -49
  52. package/dist/connectors/mongodb.js +319 -57
  53. package/dist/connectors/notion-oauth.js +231 -5
  54. package/dist/connectors/notion.js +323 -51
  55. package/dist/connectors/openai.js +134 -47
  56. package/dist/connectors/oracle.js +454 -103
  57. package/dist/connectors/outlook-oauth.js +204 -5
  58. package/dist/connectors/powerbi-oauth.js +498 -5
  59. package/dist/connectors/salesforce.js +384 -49
  60. package/dist/connectors/semrush.js +609 -49
  61. package/dist/connectors/sentry.js +289 -50
  62. package/dist/connectors/shopify-oauth.js +187 -5
  63. package/dist/connectors/shopify.js +357 -47
  64. package/dist/connectors/sqlserver.js +415 -102
  65. package/dist/connectors/stripe-api-key.js +269 -46
  66. package/dist/connectors/stripe-oauth.js +202 -5
  67. package/dist/connectors/supabase.js +303 -48
  68. package/dist/connectors/tableau.js +536 -163
  69. package/dist/connectors/tiktok-ads.js +279 -48
  70. package/dist/connectors/wix-store.js +320 -49
  71. package/dist/connectors/zendesk-oauth.js +239 -5
  72. package/dist/connectors/zendesk.js +358 -47
  73. package/dist/index.d.ts +149 -1
  74. package/dist/index.js +15057 -2117
  75. package/dist/main.js +15005 -2073
  76. package/dist/vite-plugin.js +14752 -2019
  77. package/package.json +1 -1
@@ -1,48 +1,60 @@
1
+ var __getOwnPropNames = Object.getOwnPropertyNames;
2
+ var __esm = (fn, res) => function __init() {
3
+ return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
4
+ };
5
+
1
6
  // ../connectors/src/parameter-definition.ts
2
- var ParameterDefinition = class {
3
- slug;
4
- name;
5
- description;
6
- envVarBaseKey;
7
- type;
8
- secret;
9
- required;
10
- constructor(config) {
11
- this.slug = config.slug;
12
- this.name = config.name;
13
- this.description = config.description;
14
- this.envVarBaseKey = config.envVarBaseKey;
15
- this.type = config.type;
16
- this.secret = config.secret;
17
- this.required = config.required;
18
- }
19
- /**
20
- * Get the parameter value from a ConnectorConnectionObject.
21
- */
22
- getValue(connection2) {
23
- const param = connection2.parameters.find(
24
- (p) => p.parameterSlug === this.slug
25
- );
26
- if (!param || param.value == null) {
27
- throw new Error(
28
- `Parameter "${this.slug}" not found or has no value in connection "${connection2.id}"`
29
- );
30
- }
31
- return param.value;
32
- }
33
- /**
34
- * Try to get the parameter value. Returns undefined if not found (for optional params).
35
- */
36
- tryGetValue(connection2) {
37
- const param = connection2.parameters.find(
38
- (p) => p.parameterSlug === this.slug
39
- );
40
- if (!param || param.value == null) return void 0;
41
- return param.value;
7
+ var ParameterDefinition;
8
+ var init_parameter_definition = __esm({
9
+ "../connectors/src/parameter-definition.ts"() {
10
+ "use strict";
11
+ ParameterDefinition = class {
12
+ slug;
13
+ name;
14
+ description;
15
+ envVarBaseKey;
16
+ type;
17
+ secret;
18
+ required;
19
+ constructor(config) {
20
+ this.slug = config.slug;
21
+ this.name = config.name;
22
+ this.description = config.description;
23
+ this.envVarBaseKey = config.envVarBaseKey;
24
+ this.type = config.type;
25
+ this.secret = config.secret;
26
+ this.required = config.required;
27
+ }
28
+ /**
29
+ * Get the parameter value from a ConnectorConnectionObject.
30
+ */
31
+ getValue(connection2) {
32
+ const param = connection2.parameters.find(
33
+ (p) => p.parameterSlug === this.slug
34
+ );
35
+ if (!param || param.value == null) {
36
+ throw new Error(
37
+ `Parameter "${this.slug}" not found or has no value in connection "${connection2.id}"`
38
+ );
39
+ }
40
+ return param.value;
41
+ }
42
+ /**
43
+ * Try to get the parameter value. Returns undefined if not found (for optional params).
44
+ */
45
+ tryGetValue(connection2) {
46
+ const param = connection2.parameters.find(
47
+ (p) => p.parameterSlug === this.slug
48
+ );
49
+ if (!param || param.value == null) return void 0;
50
+ return param.value;
51
+ }
52
+ };
42
53
  }
43
- };
54
+ });
44
55
 
45
56
  // ../connectors/src/connectors/clickup/parameters.ts
57
+ init_parameter_definition();
46
58
  var parameters = {
47
59
  apiToken: new ParameterDefinition({
48
60
  slug: "api-token",
@@ -287,6 +299,28 @@ var ConnectorPlugin = class _ConnectorPlugin {
287
299
  tools;
288
300
  query;
289
301
  checkConnection;
302
+ /**
303
+ * SQPD-1212: Logic-based, rule-driven connection setup. Connectors that
304
+ * implement this expose a step-by-step exploration flow (database/schema/
305
+ * table/etc. discovery) that the dashboard backend drives via the
306
+ * `/connections/:connectionId/setup` endpoint. Implement by delegating to
307
+ * `runSetupFlow` from `setup-flow.ts`.
308
+ */
309
+ setup;
310
+ /**
311
+ * Opt-out of the default "verify before save" behavior on connection
312
+ * creation. The backend invokes `checkConnection` synchronously while
313
+ * creating the connection and aborts (no row inserted) if it fails — this
314
+ * flag disables that for connectors where the check cannot succeed pre-save:
315
+ *
316
+ * - `squadbase-db` populates `connection-url` only after Neon provisioning
317
+ * - OAuth connectors require an OAuth-aware proxyFetch keyed by the
318
+ * connectionId, which doesn't exist until the row is saved
319
+ *
320
+ * Exceptions are the explicit position; new credential-input connectors get
321
+ * the default verify-on-create behavior without opt-in.
322
+ */
323
+ skipConnectionCheckOnCreate;
290
324
  constructor(config) {
291
325
  this.slug = config.slug;
292
326
  this.authType = config.authType;
@@ -303,6 +337,8 @@ var ConnectorPlugin = class _ConnectorPlugin {
303
337
  this.tools = config.tools;
304
338
  this.query = config.query;
305
339
  this.checkConnection = config.checkConnection;
340
+ this.setup = config.setup;
341
+ this.skipConnectionCheckOnCreate = config.skipConnectionCheckOnCreate;
306
342
  }
307
343
  get connectorKey() {
308
344
  return _ConnectorPlugin.deriveKey(this.slug, this.authType);
@@ -367,6 +403,76 @@ var ConnectorPlugin = class _ConnectorPlugin {
367
403
  }
368
404
  };
369
405
 
406
+ // ../connectors/src/setup-flow.ts
407
+ async function runSetupFlow(flow, params, ctx, config) {
408
+ const runtime = {
409
+ params,
410
+ language: ctx.language,
411
+ config
412
+ };
413
+ let state = flow.initialState();
414
+ let answerIdx = 0;
415
+ const pendingParameterUpdates = [];
416
+ for (const step of flow.steps) {
417
+ const ans = ctx.answers[answerIdx];
418
+ if (ans && ans.questionSlug === step.slug) {
419
+ state = step.applyAnswer(state, ans.answer);
420
+ if (step.toParameterUpdates) {
421
+ pendingParameterUpdates.push(...step.toParameterUpdates(state));
422
+ }
423
+ answerIdx += 1;
424
+ continue;
425
+ }
426
+ const resolvedAllowFreeText = step.allowFreeText !== void 0 ? step.allowFreeText : true;
427
+ if (step.type === "text") {
428
+ if (step.fetchOptions) {
429
+ const options2 = await step.fetchOptions(state, runtime);
430
+ if (options2.length === 0) {
431
+ continue;
432
+ }
433
+ }
434
+ return {
435
+ type: "nextQuestion",
436
+ questionSlug: step.slug,
437
+ question: step.question[ctx.language],
438
+ questionType: "text",
439
+ allowFreeText: resolvedAllowFreeText,
440
+ ...pendingParameterUpdates.length > 0 && {
441
+ parameterUpdates: pendingParameterUpdates
442
+ }
443
+ };
444
+ }
445
+ const options = step.fetchOptions ? await step.fetchOptions(state, runtime) : [];
446
+ if (options.length === 0) {
447
+ continue;
448
+ }
449
+ return {
450
+ type: "nextQuestion",
451
+ questionSlug: step.slug,
452
+ question: step.question[ctx.language],
453
+ questionType: step.type,
454
+ options,
455
+ allowFreeText: resolvedAllowFreeText,
456
+ ...pendingParameterUpdates.length > 0 && {
457
+ parameterUpdates: pendingParameterUpdates
458
+ }
459
+ };
460
+ }
461
+ const dataInvestigationResult = await flow.finalize(state, runtime);
462
+ return {
463
+ type: "fulfilled",
464
+ dataInvestigationResult,
465
+ ...pendingParameterUpdates.length > 0 && {
466
+ parameterUpdates: pendingParameterUpdates
467
+ }
468
+ };
469
+ }
470
+ async function resolveSetupSelection(params) {
471
+ const { selected, allSentinel, fetchAll, limit } = params;
472
+ const resolved = selected.includes(allSentinel) ? await fetchAll() : selected.filter((v) => v !== allSentinel);
473
+ return resolved.slice(0, limit);
474
+ }
475
+
370
476
  // ../connectors/src/auth-types.ts
371
477
  var AUTH_TYPES = {
372
478
  OAUTH: "oauth",
@@ -403,11 +509,142 @@ var clickupOnboarding = new ConnectorOnboarding({
403
509
  }
404
510
  });
405
511
 
512
+ // ../connectors/src/connectors/clickup/utils.ts
513
+ var BASE_URL2 = "https://api.clickup.com/api/v2";
514
+ async function apiFetch(params, path2, init) {
515
+ const token = params[parameters.apiToken.slug];
516
+ if (!token) {
517
+ throw new Error("clickup: missing required parameter: api-token");
518
+ }
519
+ const url = `${BASE_URL2}${path2.startsWith("/") ? "" : "/"}${path2}`;
520
+ const headers = new Headers(init?.headers);
521
+ headers.set("Authorization", token);
522
+ if (!headers.has("Accept")) headers.set("Accept", "application/json");
523
+ return fetch(url, { ...init, headers });
524
+ }
525
+
526
+ // ../connectors/src/connectors/clickup/setup-flow.ts
527
+ var ALL_SPACES = "__ALL_SPACES__";
528
+ var CLICKUP_SETUP_MAX_SPACES = 10;
529
+ async function listTeams(params) {
530
+ const res = await apiFetch(params, "/team");
531
+ if (!res.ok) {
532
+ const body = await res.text().catch(() => res.statusText);
533
+ throw new Error(`clickup: listTeams failed (${res.status}): ${body}`);
534
+ }
535
+ const data = await res.json();
536
+ return data.teams ?? [];
537
+ }
538
+ async function listSpaces(params, teamId) {
539
+ const res = await apiFetch(
540
+ params,
541
+ `/team/${encodeURIComponent(teamId)}/space?archived=false`
542
+ );
543
+ if (!res.ok) {
544
+ const body = await res.text().catch(() => res.statusText);
545
+ throw new Error(`clickup: listSpaces failed (${res.status}): ${body}`);
546
+ }
547
+ const data = await res.json();
548
+ return data.spaces ?? [];
549
+ }
550
+ async function listFolders(params, spaceId) {
551
+ const res = await apiFetch(
552
+ params,
553
+ `/space/${encodeURIComponent(spaceId)}/folder?archived=false`
554
+ );
555
+ if (!res.ok) return [];
556
+ const data = await res.json();
557
+ return data.folders ?? [];
558
+ }
559
+ async function listFolderlessLists(params, spaceId) {
560
+ const res = await apiFetch(
561
+ params,
562
+ `/space/${encodeURIComponent(spaceId)}/list?archived=false`
563
+ );
564
+ if (!res.ok) return [];
565
+ const data = await res.json();
566
+ return data.lists ?? [];
567
+ }
568
+ var clickupSetupFlow = {
569
+ initialState: () => ({}),
570
+ steps: [
571
+ {
572
+ slug: "workspace",
573
+ type: "select",
574
+ question: {
575
+ ja: "\u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u306B\u4F7F\u3046\u30EF\u30FC\u30AF\u30B9\u30DA\u30FC\u30B9\u3092\u9078\u3093\u3067\u304F\u3060\u3055\u3044",
576
+ en: "Select the workspace to use for setup"
577
+ },
578
+ async fetchOptions(_state, rt) {
579
+ const teams = await listTeams(rt.params);
580
+ return teams.filter((t) => t.id && t.name).map((t) => ({ value: t.id, label: t.name }));
581
+ },
582
+ applyAnswer: (state, answer) => ({ ...state, workspace: answer[0] })
583
+ },
584
+ {
585
+ slug: "spaces",
586
+ type: "multiSelect",
587
+ question: {
588
+ ja: "\u5BFE\u8C61\u306E\u30B9\u30DA\u30FC\u30B9\u3092\u9078\u3093\u3067\u304F\u3060\u3055\u3044\uFF08\u8907\u6570\u9078\u629E\u53EF\uFF09",
589
+ en: "Select target spaces (multi-select allowed)"
590
+ },
591
+ async fetchOptions(state, rt) {
592
+ if (!state.workspace) return [];
593
+ const spaces = await listSpaces(rt.params, state.workspace);
594
+ const spaceOptions = spaces.filter((s) => s.id && s.name).map((s) => ({ value: s.id, label: s.name }));
595
+ return [
596
+ {
597
+ value: ALL_SPACES,
598
+ label: rt.language === "ja" ? "\u3059\u3079\u3066\u306E\u30B9\u30DA\u30FC\u30B9" : "All spaces"
599
+ },
600
+ ...spaceOptions
601
+ ];
602
+ },
603
+ applyAnswer: (state, answer) => ({ ...state, spaces: answer })
604
+ }
605
+ ],
606
+ async finalize(state, rt) {
607
+ if (!state.workspace || !state.spaces) {
608
+ throw new Error("ClickUp setup: incomplete state on finalize");
609
+ }
610
+ const teamId = state.workspace;
611
+ const allSpaces = await listSpaces(rt.params, teamId);
612
+ const spaceById = new Map(allSpaces.map((s) => [s.id, s]));
613
+ const targetSpaceIds = await resolveSetupSelection({
614
+ selected: state.spaces,
615
+ allSentinel: ALL_SPACES,
616
+ fetchAll: async () => allSpaces.map((s) => s.id).filter((id) => id),
617
+ limit: CLICKUP_SETUP_MAX_SPACES
618
+ });
619
+ const sections = [
620
+ "## ClickUp",
621
+ "",
622
+ `### Workspace: ${teamId}`,
623
+ ""
624
+ ];
625
+ for (const spaceId of targetSpaceIds) {
626
+ const space = spaceById.get(spaceId);
627
+ const spaceName = space?.name ?? spaceId;
628
+ sections.push(`#### Space: ${spaceName}`, "");
629
+ const [folders, folderlessLists] = await Promise.all([
630
+ listFolders(rt.params, spaceId),
631
+ listFolderlessLists(rt.params, spaceId)
632
+ ]);
633
+ sections.push(`- Folders (${folders.length}):`);
634
+ for (const f of folders) sections.push(` - ${f.name}`);
635
+ sections.push(`- Folderless lists (${folderlessLists.length}):`);
636
+ for (const l of folderlessLists) sections.push(` - ${l.name}`);
637
+ sections.push("");
638
+ }
639
+ return sections.join("\n");
640
+ }
641
+ };
642
+
406
643
  // ../connectors/src/connectors/clickup/tools/request.ts
407
644
  import { z } from "zod";
408
645
  var BASE_HOST = "https://api.clickup.com";
409
646
  var BASE_PATH_SEGMENT = "/api/v2";
410
- var BASE_URL2 = `${BASE_HOST}${BASE_PATH_SEGMENT}`;
647
+ var BASE_URL3 = `${BASE_HOST}${BASE_PATH_SEGMENT}`;
411
648
  var REQUEST_TIMEOUT_MS = 6e4;
412
649
  var inputSchema = z.object({
413
650
  toolUseIntent: z.string().optional().describe(
@@ -480,7 +717,7 @@ Pagination: ClickUp uses zero-indexed \`page\` query parameter on list endpoints
480
717
  try {
481
718
  const token = parameters.apiToken.getValue(connection2);
482
719
  const normalizedPath = normalizeRequestPath(path2, BASE_PATH_SEGMENT);
483
- const url = `${BASE_URL2}${normalizedPath}`;
720
+ const url = `${BASE_URL3}${normalizedPath}`;
484
721
  const controller = new AbortController();
485
722
  const timeout = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS);
486
723
  try {
@@ -698,7 +935,39 @@ export default async function handler(c: Context) {
698
935
  - GET \`/team/{team_id}/time_entries?start_date=...&end_date=...\` \u2014 \u6642\u9593\u8A18\u9332\u4E00\u89A7\uFF08Unix \u30DF\u30EA\u79D2\u30BF\u30A4\u30E0\u30B9\u30BF\u30F3\u30D7\uFF09
699
936
  - POST \`/team/{team_id}/time_entries\` \u2014 \u6642\u9593\u8A18\u9332\u306E\u4F5C\u6210`
700
937
  },
701
- tools
938
+ tools,
939
+ setup: (params, ctx, config) => runSetupFlow(clickupSetupFlow, params, ctx, config),
940
+ async checkConnection(params, _config) {
941
+ try {
942
+ const apiToken = params[parameters.apiToken.slug];
943
+ if (!apiToken) {
944
+ return {
945
+ success: false,
946
+ error: "Missing required parameter: api-token"
947
+ };
948
+ }
949
+ const res = await fetch("https://api.clickup.com/api/v2/user", {
950
+ method: "GET",
951
+ headers: {
952
+ Authorization: apiToken,
953
+ Accept: "application/json"
954
+ }
955
+ });
956
+ if (!res.ok) {
957
+ const errorText = await res.text().catch(() => res.statusText);
958
+ return {
959
+ success: false,
960
+ error: `ClickUp API failed: HTTP ${res.status} ${errorText}`
961
+ };
962
+ }
963
+ return { success: true };
964
+ } catch (error) {
965
+ return {
966
+ success: false,
967
+ error: error instanceof Error ? error.message : String(error)
968
+ };
969
+ }
970
+ }
702
971
  });
703
972
 
704
973
  // src/connectors/create-connector-sdk.ts
@@ -727,6 +996,7 @@ function resolveEnvVarOptional(entry, key) {
727
996
  import { getContext } from "hono/context-storage";
728
997
  import { getCookie } from "hono/cookie";
729
998
  var APP_SESSION_COOKIE_NAME = "__Host-squadbase-session";
999
+ var TABLEAU_SESSION_SENTINEL_URL = "squadbase://tableau-session/";
730
1000
  function normalizeHeaders(input) {
731
1001
  const out = {};
732
1002
  if (!input) return out;
@@ -735,6 +1005,11 @@ function normalizeHeaders(input) {
735
1005
  });
736
1006
  return out;
737
1007
  }
1008
+ function extractInputUrl(input) {
1009
+ if (typeof input === "string") return input;
1010
+ if (input instanceof URL) return input.href;
1011
+ return input.url;
1012
+ }
738
1013
  function createSandboxProxyFetch(connectionId) {
739
1014
  return async (input, init) => {
740
1015
  const token = process.env.INTERNAL_SQUADBASE_OAUTH_MACHINE_CREDENTIAL;
@@ -744,10 +1019,17 @@ function createSandboxProxyFetch(connectionId) {
744
1019
  "Connection proxy is not configured. Please check your deployment settings."
745
1020
  );
746
1021
  }
747
- const originalUrl = typeof input === "string" ? input : input instanceof URL ? input.href : input.url;
1022
+ const originalUrl = extractInputUrl(input);
1023
+ const baseDomain = process.env["SQUADBASE_PREVIEW_BASE_DOMAIN"] ?? "preview.app.squadbase.dev";
1024
+ if (originalUrl === TABLEAU_SESSION_SENTINEL_URL) {
1025
+ const sessionUrl = `https://${sandboxId}.${baseDomain}/_sqcore/connections/${connectionId}/tableau-session`;
1026
+ return fetch(sessionUrl, {
1027
+ method: "POST",
1028
+ headers: { Authorization: `Bearer ${token}` }
1029
+ });
1030
+ }
748
1031
  const originalMethod = init?.method ?? "GET";
749
1032
  const originalBody = init?.body ? JSON.parse(init.body) : void 0;
750
- const baseDomain = process.env["SQUADBASE_PREVIEW_BASE_DOMAIN"] ?? "preview.app.squadbase.dev";
751
1033
  const proxyUrl = `https://${sandboxId}.${baseDomain}/_sqcore/connections/${connectionId}/request`;
752
1034
  return fetch(proxyUrl, {
753
1035
  method: "POST",
@@ -773,10 +1055,9 @@ function createDeployedAppProxyFetch(connectionId) {
773
1055
  }
774
1056
  const baseDomain = process.env["SQUADBASE_APP_BASE_DOMAIN"] ?? "squadbase.app";
775
1057
  const proxyUrl = `https://${projectId}.${baseDomain}/_sqcore/connections/${connectionId}/request`;
1058
+ const sessionUrl = `https://${projectId}.${baseDomain}/_sqcore/connections/${connectionId}/tableau-session`;
776
1059
  return async (input, init) => {
777
- const originalUrl = typeof input === "string" ? input : input instanceof URL ? input.href : input.url;
778
- const originalMethod = init?.method ?? "GET";
779
- const originalBody = init?.body ? JSON.parse(init.body) : void 0;
1060
+ const originalUrl = extractInputUrl(input);
780
1061
  const c = getContext();
781
1062
  const appSession = getCookie(c, APP_SESSION_COOKIE_NAME);
782
1063
  if (!appSession) {
@@ -784,6 +1065,14 @@ function createDeployedAppProxyFetch(connectionId) {
784
1065
  "No authentication method available for connection proxy."
785
1066
  );
786
1067
  }
1068
+ if (originalUrl === TABLEAU_SESSION_SENTINEL_URL) {
1069
+ return fetch(sessionUrl, {
1070
+ method: "POST",
1071
+ headers: { Authorization: `Bearer ${appSession}` }
1072
+ });
1073
+ }
1074
+ const originalMethod = init?.method ?? "GET";
1075
+ const originalBody = init?.body ? JSON.parse(init.body) : void 0;
787
1076
  return fetch(proxyUrl, {
788
1077
  method: "POST",
789
1078
  headers: {