@squadbase/vite-server 0.0.1-build-19 → 0.0.1-build-20

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.
package/dist/cli/index.js CHANGED
@@ -17062,14 +17062,35 @@ function createConnectorRegistry() {
17062
17062
  return { getQuery: getQuery2, loadConnections: loadConnections2, reloadEnvFile: reloadEnvFile2, watchConnectionsFile: watchConnectionsFile2 };
17063
17063
  }
17064
17064
  var APP_SESSION_COOKIE_NAME = "__Host-squadbase-session";
17065
- var PREVIEW_SESSION_COOKIE_NAME = "squadbase-preview-session";
17066
- function resolveProxyUrl(connectionId) {
17067
- const connectionPath = `/_sqcore/connections/${connectionId}/request`;
17065
+ function createSandboxProxyFetch(connectionId) {
17066
+ const token = process.env.INTERNAL_SQUADBASE_OAUTH_MACHINE_CREDENTIAL;
17068
17067
  const sandboxId = process.env.INTERNAL_SQUADBASE_SANDBOX_ID;
17069
- if (sandboxId) {
17070
- const baseDomain2 = process.env["SQUADBASE_PREVIEW_BASE_DOMAIN"] ?? "preview.app.squadbase.dev";
17071
- return `https://${sandboxId}.${baseDomain2}${connectionPath}`;
17068
+ if (!token || !sandboxId) {
17069
+ throw new Error(
17070
+ "Connection proxy is not configured. Please check your deployment settings."
17071
+ );
17072
17072
  }
17073
+ const envPrefix = process.env.SQUADBASE_ENV === "prod" ? "" : `${process.env.SQUADBASE_ENV ?? "dev1"}-`;
17074
+ const proxyUrl = `https://${sandboxId}.preview.${envPrefix}app.squadbase.dev/_sqcore/connections/${connectionId}/request`;
17075
+ return async (input, init) => {
17076
+ const originalUrl = typeof input === "string" ? input : input instanceof URL ? input.href : input.url;
17077
+ const originalMethod = init?.method ?? "GET";
17078
+ const originalBody = init?.body ? JSON.parse(init.body) : void 0;
17079
+ return fetch(proxyUrl, {
17080
+ method: "POST",
17081
+ headers: {
17082
+ "Content-Type": "application/json",
17083
+ Authorization: `Bearer ${token}`
17084
+ },
17085
+ body: JSON.stringify({
17086
+ url: originalUrl,
17087
+ method: originalMethod,
17088
+ body: originalBody
17089
+ })
17090
+ });
17091
+ };
17092
+ }
17093
+ function createDeployedAppProxyFetch(connectionId) {
17073
17094
  const projectId = process.env["SQUADBASE_PROJECT_ID"];
17074
17095
  if (!projectId) {
17075
17096
  throw new Error(
@@ -17077,41 +17098,23 @@ function resolveProxyUrl(connectionId) {
17077
17098
  );
17078
17099
  }
17079
17100
  const baseDomain = process.env["SQUADBASE_APP_BASE_DOMAIN"] ?? "squadbase.app";
17080
- return `https://${projectId}.${baseDomain}${connectionPath}`;
17081
- }
17082
- function resolveAuthHeaders() {
17083
- const machineCredential = process.env.INTERNAL_SQUADBASE_OAUTH_MACHINE_CREDENTIAL;
17084
- if (machineCredential) {
17085
- return { Authorization: `Bearer ${machineCredential}` };
17086
- }
17087
- const c = getContext();
17088
- const cookies = getCookie(c);
17089
- const previewSession = cookies[PREVIEW_SESSION_COOKIE_NAME];
17090
- if (previewSession) {
17091
- return {
17092
- Cookie: `${PREVIEW_SESSION_COOKIE_NAME}=${previewSession}`
17093
- };
17094
- }
17095
- const appSession = cookies[APP_SESSION_COOKIE_NAME];
17096
- if (appSession) {
17097
- return { Authorization: `Bearer ${appSession}` };
17098
- }
17099
- throw new Error(
17100
- "No authentication method available for connection proxy."
17101
- );
17102
- }
17103
- function createProxyFetch(connectionId) {
17101
+ const proxyUrl = `https://${projectId}.${baseDomain}/_sqcore/connections/${connectionId}/request`;
17104
17102
  return async (input, init) => {
17105
17103
  const originalUrl = typeof input === "string" ? input : input instanceof URL ? input.href : input.url;
17106
17104
  const originalMethod = init?.method ?? "GET";
17107
17105
  const originalBody = init?.body ? JSON.parse(init.body) : void 0;
17108
- const proxyUrl = resolveProxyUrl(connectionId);
17109
- const authHeaders = resolveAuthHeaders();
17106
+ const c = getContext();
17107
+ const appSession = getCookie(c, APP_SESSION_COOKIE_NAME);
17108
+ if (!appSession) {
17109
+ throw new Error(
17110
+ "No authentication method available for connection proxy."
17111
+ );
17112
+ }
17110
17113
  return fetch(proxyUrl, {
17111
17114
  method: "POST",
17112
17115
  headers: {
17113
17116
  "Content-Type": "application/json",
17114
- ...authHeaders
17117
+ Authorization: `Bearer ${appSession}`
17115
17118
  },
17116
17119
  body: JSON.stringify({
17117
17120
  url: originalUrl,
@@ -17121,6 +17124,12 @@ function createProxyFetch(connectionId) {
17121
17124
  });
17122
17125
  };
17123
17126
  }
17127
+ function createProxyFetch(connectionId) {
17128
+ if (process.env.INTERNAL_SQUADBASE_SANDBOX_ID) {
17129
+ return createSandboxProxyFetch(connectionId);
17130
+ }
17131
+ return createDeployedAppProxyFetch(connectionId);
17132
+ }
17124
17133
  function resolveParams(entry, connectionId, plugin) {
17125
17134
  const params = {};
17126
17135
  for (const param of Object.values(plugin.parameters)) {
package/dist/index.js CHANGED
@@ -16997,14 +16997,35 @@ function createConnectorRegistry() {
16997
16997
  return { getQuery: getQuery2, loadConnections: loadConnections2, reloadEnvFile: reloadEnvFile2, watchConnectionsFile: watchConnectionsFile2 };
16998
16998
  }
16999
16999
  var APP_SESSION_COOKIE_NAME = "__Host-squadbase-session";
17000
- var PREVIEW_SESSION_COOKIE_NAME = "squadbase-preview-session";
17001
- function resolveProxyUrl(connectionId) {
17002
- const connectionPath = `/_sqcore/connections/${connectionId}/request`;
17000
+ function createSandboxProxyFetch(connectionId) {
17001
+ const token = process.env.INTERNAL_SQUADBASE_OAUTH_MACHINE_CREDENTIAL;
17003
17002
  const sandboxId = process.env.INTERNAL_SQUADBASE_SANDBOX_ID;
17004
- if (sandboxId) {
17005
- const baseDomain2 = process.env["SQUADBASE_PREVIEW_BASE_DOMAIN"] ?? "preview.app.squadbase.dev";
17006
- return `https://${sandboxId}.${baseDomain2}${connectionPath}`;
17003
+ if (!token || !sandboxId) {
17004
+ throw new Error(
17005
+ "Connection proxy is not configured. Please check your deployment settings."
17006
+ );
17007
17007
  }
17008
+ const envPrefix = process.env.SQUADBASE_ENV === "prod" ? "" : `${process.env.SQUADBASE_ENV ?? "dev1"}-`;
17009
+ const proxyUrl = `https://${sandboxId}.preview.${envPrefix}app.squadbase.dev/_sqcore/connections/${connectionId}/request`;
17010
+ return async (input, init) => {
17011
+ const originalUrl = typeof input === "string" ? input : input instanceof URL ? input.href : input.url;
17012
+ const originalMethod = init?.method ?? "GET";
17013
+ const originalBody = init?.body ? JSON.parse(init.body) : void 0;
17014
+ return fetch(proxyUrl, {
17015
+ method: "POST",
17016
+ headers: {
17017
+ "Content-Type": "application/json",
17018
+ Authorization: `Bearer ${token}`
17019
+ },
17020
+ body: JSON.stringify({
17021
+ url: originalUrl,
17022
+ method: originalMethod,
17023
+ body: originalBody
17024
+ })
17025
+ });
17026
+ };
17027
+ }
17028
+ function createDeployedAppProxyFetch(connectionId) {
17008
17029
  const projectId = process.env["SQUADBASE_PROJECT_ID"];
17009
17030
  if (!projectId) {
17010
17031
  throw new Error(
@@ -17012,41 +17033,23 @@ function resolveProxyUrl(connectionId) {
17012
17033
  );
17013
17034
  }
17014
17035
  const baseDomain = process.env["SQUADBASE_APP_BASE_DOMAIN"] ?? "squadbase.app";
17015
- return `https://${projectId}.${baseDomain}${connectionPath}`;
17016
- }
17017
- function resolveAuthHeaders() {
17018
- const machineCredential = process.env.INTERNAL_SQUADBASE_OAUTH_MACHINE_CREDENTIAL;
17019
- if (machineCredential) {
17020
- return { Authorization: `Bearer ${machineCredential}` };
17021
- }
17022
- const c = getContext();
17023
- const cookies = getCookie(c);
17024
- const previewSession = cookies[PREVIEW_SESSION_COOKIE_NAME];
17025
- if (previewSession) {
17026
- return {
17027
- Cookie: `${PREVIEW_SESSION_COOKIE_NAME}=${previewSession}`
17028
- };
17029
- }
17030
- const appSession = cookies[APP_SESSION_COOKIE_NAME];
17031
- if (appSession) {
17032
- return { Authorization: `Bearer ${appSession}` };
17033
- }
17034
- throw new Error(
17035
- "No authentication method available for connection proxy."
17036
- );
17037
- }
17038
- function createProxyFetch(connectionId) {
17036
+ const proxyUrl = `https://${projectId}.${baseDomain}/_sqcore/connections/${connectionId}/request`;
17039
17037
  return async (input, init) => {
17040
17038
  const originalUrl = typeof input === "string" ? input : input instanceof URL ? input.href : input.url;
17041
17039
  const originalMethod = init?.method ?? "GET";
17042
17040
  const originalBody = init?.body ? JSON.parse(init.body) : void 0;
17043
- const proxyUrl = resolveProxyUrl(connectionId);
17044
- const authHeaders = resolveAuthHeaders();
17041
+ const c = getContext();
17042
+ const appSession = getCookie(c, APP_SESSION_COOKIE_NAME);
17043
+ if (!appSession) {
17044
+ throw new Error(
17045
+ "No authentication method available for connection proxy."
17046
+ );
17047
+ }
17045
17048
  return fetch(proxyUrl, {
17046
17049
  method: "POST",
17047
17050
  headers: {
17048
17051
  "Content-Type": "application/json",
17049
- ...authHeaders
17052
+ Authorization: `Bearer ${appSession}`
17050
17053
  },
17051
17054
  body: JSON.stringify({
17052
17055
  url: originalUrl,
@@ -17056,6 +17059,12 @@ function createProxyFetch(connectionId) {
17056
17059
  });
17057
17060
  };
17058
17061
  }
17062
+ function createProxyFetch(connectionId) {
17063
+ if (process.env.INTERNAL_SQUADBASE_SANDBOX_ID) {
17064
+ return createSandboxProxyFetch(connectionId);
17065
+ }
17066
+ return createDeployedAppProxyFetch(connectionId);
17067
+ }
17059
17068
  function resolveParams(entry, connectionId, plugin) {
17060
17069
  const params = {};
17061
17070
  for (const param of Object.values(plugin.parameters)) {
@@ -17894,12 +17903,12 @@ var pages_default = app4;
17894
17903
  import { getContext as getContext2 } from "hono/context-storage";
17895
17904
  import { getCookie as getCookie2 } from "hono/cookie";
17896
17905
  var APP_SESSION_COOKIE_NAME2 = "__Host-squadbase-session";
17897
- var PREVIEW_SESSION_COOKIE_NAME2 = "squadbase-preview-session";
17906
+ var PREVIEW_SESSION_COOKIE_NAME = "squadbase-preview-session";
17898
17907
  var APP_BASE_DOMAIN = "squadbase.app";
17899
17908
  var PREVIEW_BASE_DOMAIN = "preview.app.squadbase.dev";
17900
17909
  var SANDBOX_ID_ENV_NAME = "INTERNAL_SQUADBASE_SANDBOX_ID";
17901
17910
  var MACHINE_CREDENTIAL_ENV_NAME = "INTERNAL_SQUADBASE_OAUTH_MACHINE_CREDENTIAL";
17902
- function resolveProxyUrl2(connectionId) {
17911
+ function resolveProxyUrl(connectionId) {
17903
17912
  const connectionPath = `/_sqcore/connections/${connectionId}/request`;
17904
17913
  const sandboxId = process.env[SANDBOX_ID_ENV_NAME];
17905
17914
  if (sandboxId) {
@@ -17915,17 +17924,17 @@ function resolveProxyUrl2(connectionId) {
17915
17924
  const baseDomain = process.env["SQUADBASE_APP_BASE_DOMAIN"] ?? APP_BASE_DOMAIN;
17916
17925
  return `https://${projectId}.${baseDomain}${connectionPath}`;
17917
17926
  }
17918
- function resolveAuthHeaders2() {
17927
+ function resolveAuthHeaders() {
17919
17928
  const machineCredential = process.env[MACHINE_CREDENTIAL_ENV_NAME];
17920
17929
  if (machineCredential) {
17921
17930
  return { Authorization: `Bearer ${machineCredential}` };
17922
17931
  }
17923
17932
  const c = getContext2();
17924
17933
  const cookies = getCookie2(c);
17925
- const previewSession = cookies[PREVIEW_SESSION_COOKIE_NAME2];
17934
+ const previewSession = cookies[PREVIEW_SESSION_COOKIE_NAME];
17926
17935
  if (previewSession) {
17927
17936
  return {
17928
- Cookie: `${PREVIEW_SESSION_COOKIE_NAME2}=${previewSession}`
17937
+ Cookie: `${PREVIEW_SESSION_COOKIE_NAME}=${previewSession}`
17929
17938
  };
17930
17939
  }
17931
17940
  const appSession = cookies[APP_SESSION_COOKIE_NAME2];
@@ -17939,8 +17948,8 @@ function resolveAuthHeaders2() {
17939
17948
  function connection(connectionId) {
17940
17949
  return {
17941
17950
  async fetch(url, options) {
17942
- const proxyUrl = resolveProxyUrl2(connectionId);
17943
- const authHeaders = resolveAuthHeaders2();
17951
+ const proxyUrl = resolveProxyUrl(connectionId);
17952
+ const authHeaders = resolveAuthHeaders();
17944
17953
  return await fetch(proxyUrl, {
17945
17954
  method: "POST",
17946
17955
  headers: {
package/dist/main.js CHANGED
@@ -16997,14 +16997,35 @@ function createConnectorRegistry() {
16997
16997
  return { getQuery: getQuery2, loadConnections: loadConnections2, reloadEnvFile: reloadEnvFile2, watchConnectionsFile: watchConnectionsFile2 };
16998
16998
  }
16999
16999
  var APP_SESSION_COOKIE_NAME = "__Host-squadbase-session";
17000
- var PREVIEW_SESSION_COOKIE_NAME = "squadbase-preview-session";
17001
- function resolveProxyUrl(connectionId) {
17002
- const connectionPath = `/_sqcore/connections/${connectionId}/request`;
17000
+ function createSandboxProxyFetch(connectionId) {
17001
+ const token = process.env.INTERNAL_SQUADBASE_OAUTH_MACHINE_CREDENTIAL;
17003
17002
  const sandboxId = process.env.INTERNAL_SQUADBASE_SANDBOX_ID;
17004
- if (sandboxId) {
17005
- const baseDomain2 = process.env["SQUADBASE_PREVIEW_BASE_DOMAIN"] ?? "preview.app.squadbase.dev";
17006
- return `https://${sandboxId}.${baseDomain2}${connectionPath}`;
17003
+ if (!token || !sandboxId) {
17004
+ throw new Error(
17005
+ "Connection proxy is not configured. Please check your deployment settings."
17006
+ );
17007
17007
  }
17008
+ const envPrefix = process.env.SQUADBASE_ENV === "prod" ? "" : `${process.env.SQUADBASE_ENV ?? "dev1"}-`;
17009
+ const proxyUrl = `https://${sandboxId}.preview.${envPrefix}app.squadbase.dev/_sqcore/connections/${connectionId}/request`;
17010
+ return async (input, init) => {
17011
+ const originalUrl = typeof input === "string" ? input : input instanceof URL ? input.href : input.url;
17012
+ const originalMethod = init?.method ?? "GET";
17013
+ const originalBody = init?.body ? JSON.parse(init.body) : void 0;
17014
+ return fetch(proxyUrl, {
17015
+ method: "POST",
17016
+ headers: {
17017
+ "Content-Type": "application/json",
17018
+ Authorization: `Bearer ${token}`
17019
+ },
17020
+ body: JSON.stringify({
17021
+ url: originalUrl,
17022
+ method: originalMethod,
17023
+ body: originalBody
17024
+ })
17025
+ });
17026
+ };
17027
+ }
17028
+ function createDeployedAppProxyFetch(connectionId) {
17008
17029
  const projectId = process.env["SQUADBASE_PROJECT_ID"];
17009
17030
  if (!projectId) {
17010
17031
  throw new Error(
@@ -17012,41 +17033,23 @@ function resolveProxyUrl(connectionId) {
17012
17033
  );
17013
17034
  }
17014
17035
  const baseDomain = process.env["SQUADBASE_APP_BASE_DOMAIN"] ?? "squadbase.app";
17015
- return `https://${projectId}.${baseDomain}${connectionPath}`;
17016
- }
17017
- function resolveAuthHeaders() {
17018
- const machineCredential = process.env.INTERNAL_SQUADBASE_OAUTH_MACHINE_CREDENTIAL;
17019
- if (machineCredential) {
17020
- return { Authorization: `Bearer ${machineCredential}` };
17021
- }
17022
- const c = getContext();
17023
- const cookies = getCookie(c);
17024
- const previewSession = cookies[PREVIEW_SESSION_COOKIE_NAME];
17025
- if (previewSession) {
17026
- return {
17027
- Cookie: `${PREVIEW_SESSION_COOKIE_NAME}=${previewSession}`
17028
- };
17029
- }
17030
- const appSession = cookies[APP_SESSION_COOKIE_NAME];
17031
- if (appSession) {
17032
- return { Authorization: `Bearer ${appSession}` };
17033
- }
17034
- throw new Error(
17035
- "No authentication method available for connection proxy."
17036
- );
17037
- }
17038
- function createProxyFetch(connectionId) {
17036
+ const proxyUrl = `https://${projectId}.${baseDomain}/_sqcore/connections/${connectionId}/request`;
17039
17037
  return async (input, init) => {
17040
17038
  const originalUrl = typeof input === "string" ? input : input instanceof URL ? input.href : input.url;
17041
17039
  const originalMethod = init?.method ?? "GET";
17042
17040
  const originalBody = init?.body ? JSON.parse(init.body) : void 0;
17043
- const proxyUrl = resolveProxyUrl(connectionId);
17044
- const authHeaders = resolveAuthHeaders();
17041
+ const c = getContext();
17042
+ const appSession = getCookie(c, APP_SESSION_COOKIE_NAME);
17043
+ if (!appSession) {
17044
+ throw new Error(
17045
+ "No authentication method available for connection proxy."
17046
+ );
17047
+ }
17045
17048
  return fetch(proxyUrl, {
17046
17049
  method: "POST",
17047
17050
  headers: {
17048
17051
  "Content-Type": "application/json",
17049
- ...authHeaders
17052
+ Authorization: `Bearer ${appSession}`
17050
17053
  },
17051
17054
  body: JSON.stringify({
17052
17055
  url: originalUrl,
@@ -17056,6 +17059,12 @@ function createProxyFetch(connectionId) {
17056
17059
  });
17057
17060
  };
17058
17061
  }
17062
+ function createProxyFetch(connectionId) {
17063
+ if (process.env.INTERNAL_SQUADBASE_SANDBOX_ID) {
17064
+ return createSandboxProxyFetch(connectionId);
17065
+ }
17066
+ return createDeployedAppProxyFetch(connectionId);
17067
+ }
17059
17068
  function resolveParams(entry, connectionId, plugin) {
17060
17069
  const params = {};
17061
17070
  for (const param of Object.values(plugin.parameters)) {
@@ -16998,14 +16998,35 @@ function createConnectorRegistry() {
16998
16998
  return { getQuery: getQuery2, loadConnections: loadConnections2, reloadEnvFile: reloadEnvFile2, watchConnectionsFile: watchConnectionsFile2 };
16999
16999
  }
17000
17000
  var APP_SESSION_COOKIE_NAME = "__Host-squadbase-session";
17001
- var PREVIEW_SESSION_COOKIE_NAME = "squadbase-preview-session";
17002
- function resolveProxyUrl(connectionId) {
17003
- const connectionPath = `/_sqcore/connections/${connectionId}/request`;
17001
+ function createSandboxProxyFetch(connectionId) {
17002
+ const token = process.env.INTERNAL_SQUADBASE_OAUTH_MACHINE_CREDENTIAL;
17004
17003
  const sandboxId = process.env.INTERNAL_SQUADBASE_SANDBOX_ID;
17005
- if (sandboxId) {
17006
- const baseDomain2 = process.env["SQUADBASE_PREVIEW_BASE_DOMAIN"] ?? "preview.app.squadbase.dev";
17007
- return `https://${sandboxId}.${baseDomain2}${connectionPath}`;
17004
+ if (!token || !sandboxId) {
17005
+ throw new Error(
17006
+ "Connection proxy is not configured. Please check your deployment settings."
17007
+ );
17008
17008
  }
17009
+ const envPrefix = process.env.SQUADBASE_ENV === "prod" ? "" : `${process.env.SQUADBASE_ENV ?? "dev1"}-`;
17010
+ const proxyUrl = `https://${sandboxId}.preview.${envPrefix}app.squadbase.dev/_sqcore/connections/${connectionId}/request`;
17011
+ return async (input, init) => {
17012
+ const originalUrl = typeof input === "string" ? input : input instanceof URL ? input.href : input.url;
17013
+ const originalMethod = init?.method ?? "GET";
17014
+ const originalBody = init?.body ? JSON.parse(init.body) : void 0;
17015
+ return fetch(proxyUrl, {
17016
+ method: "POST",
17017
+ headers: {
17018
+ "Content-Type": "application/json",
17019
+ Authorization: `Bearer ${token}`
17020
+ },
17021
+ body: JSON.stringify({
17022
+ url: originalUrl,
17023
+ method: originalMethod,
17024
+ body: originalBody
17025
+ })
17026
+ });
17027
+ };
17028
+ }
17029
+ function createDeployedAppProxyFetch(connectionId) {
17009
17030
  const projectId = process.env["SQUADBASE_PROJECT_ID"];
17010
17031
  if (!projectId) {
17011
17032
  throw new Error(
@@ -17013,41 +17034,23 @@ function resolveProxyUrl(connectionId) {
17013
17034
  );
17014
17035
  }
17015
17036
  const baseDomain = process.env["SQUADBASE_APP_BASE_DOMAIN"] ?? "squadbase.app";
17016
- return `https://${projectId}.${baseDomain}${connectionPath}`;
17017
- }
17018
- function resolveAuthHeaders() {
17019
- const machineCredential = process.env.INTERNAL_SQUADBASE_OAUTH_MACHINE_CREDENTIAL;
17020
- if (machineCredential) {
17021
- return { Authorization: `Bearer ${machineCredential}` };
17022
- }
17023
- const c = getContext();
17024
- const cookies = getCookie(c);
17025
- const previewSession = cookies[PREVIEW_SESSION_COOKIE_NAME];
17026
- if (previewSession) {
17027
- return {
17028
- Cookie: `${PREVIEW_SESSION_COOKIE_NAME}=${previewSession}`
17029
- };
17030
- }
17031
- const appSession = cookies[APP_SESSION_COOKIE_NAME];
17032
- if (appSession) {
17033
- return { Authorization: `Bearer ${appSession}` };
17034
- }
17035
- throw new Error(
17036
- "No authentication method available for connection proxy."
17037
- );
17038
- }
17039
- function createProxyFetch(connectionId) {
17037
+ const proxyUrl = `https://${projectId}.${baseDomain}/_sqcore/connections/${connectionId}/request`;
17040
17038
  return async (input, init) => {
17041
17039
  const originalUrl = typeof input === "string" ? input : input instanceof URL ? input.href : input.url;
17042
17040
  const originalMethod = init?.method ?? "GET";
17043
17041
  const originalBody = init?.body ? JSON.parse(init.body) : void 0;
17044
- const proxyUrl = resolveProxyUrl(connectionId);
17045
- const authHeaders = resolveAuthHeaders();
17042
+ const c = getContext();
17043
+ const appSession = getCookie(c, APP_SESSION_COOKIE_NAME);
17044
+ if (!appSession) {
17045
+ throw new Error(
17046
+ "No authentication method available for connection proxy."
17047
+ );
17048
+ }
17046
17049
  return fetch(proxyUrl, {
17047
17050
  method: "POST",
17048
17051
  headers: {
17049
17052
  "Content-Type": "application/json",
17050
- ...authHeaders
17053
+ Authorization: `Bearer ${appSession}`
17051
17054
  },
17052
17055
  body: JSON.stringify({
17053
17056
  url: originalUrl,
@@ -17057,6 +17060,12 @@ function createProxyFetch(connectionId) {
17057
17060
  });
17058
17061
  };
17059
17062
  }
17063
+ function createProxyFetch(connectionId) {
17064
+ if (process.env.INTERNAL_SQUADBASE_SANDBOX_ID) {
17065
+ return createSandboxProxyFetch(connectionId);
17066
+ }
17067
+ return createDeployedAppProxyFetch(connectionId);
17068
+ }
17060
17069
  function resolveParams(entry, connectionId, plugin) {
17061
17070
  const params = {};
17062
17071
  for (const param of Object.values(plugin.parameters)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@squadbase/vite-server",
3
- "version": "0.0.1-build-19",
3
+ "version": "0.0.1-build-20",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {