@burdenoff/fe-libs 2026.715.4 → 2026.715.6
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.
|
@@ -28,10 +28,10 @@ export declare function getCurrentHostname(): string;
|
|
|
28
28
|
*
|
|
29
29
|
* Priority:
|
|
30
30
|
* 1. Known production domains → PROD_GATEWAYS (hostname always wins for real deploys)
|
|
31
|
-
* 2. Known alpha/staging domains →
|
|
31
|
+
* 2. Known alpha/staging domains → same-origin alpha Worker proxy
|
|
32
32
|
* 3. Localhost-like host: `VITE_GATEWAY_TARGET` env var, case-insensitive
|
|
33
33
|
* - `'prod'` → PROD_GATEWAYS (emits a one-time console warning — mutations write to real data)
|
|
34
|
-
* - `'alpha'` →
|
|
34
|
+
* - `'alpha'` → remote alpha gateways
|
|
35
35
|
* - `'local'` or anything else → LOCAL_DEFAULTS
|
|
36
36
|
* 4. Everything else (unknown deployed domain, or localhost with no env):
|
|
37
37
|
* LOCAL_DEFAULTS (fails loud against a missing local stack rather than
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gatewayUrls.d.ts","sourceRoot":"","sources":["../../../src/shared/config/gatewayUrls.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,MAAM,WAAW,kBAAkB;IACjC,gBAAgB,EAAE,MAAM,CAAC;IACzB,aAAa,EAAE,MAAM,CAAC;IACtB,kBAAkB,EAAE,MAAM,CAAC;CAC5B;AAoBD;;;GAGG;AACH,eAAO,MAAM,mBAAmB,
|
|
1
|
+
{"version":3,"file":"gatewayUrls.d.ts","sourceRoot":"","sources":["../../../src/shared/config/gatewayUrls.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,MAAM,WAAW,kBAAkB;IACjC,gBAAgB,EAAE,MAAM,CAAC;IACzB,aAAa,EAAE,MAAM,CAAC;IACtB,kBAAkB,EAAE,MAAM,CAAC;CAC5B;AAoBD;;;GAGG;AACH,eAAO,MAAM,mBAAmB,UA0C/B,CAAC;AAEF,eAAO,MAAM,UAAU,aAGrB,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,WAAW,aAOtB,CAAC;AAEH,wBAAgB,kBAAkB,IAAI,MAAM,CAG3C;AAuCD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,kBAAkB,IAAI,kBAAkB,CA6BvD"}
|
|
@@ -16,21 +16,29 @@ function o() {
|
|
|
16
16
|
return typeof window > "u" ? "" : window.location.hostname.toLowerCase();
|
|
17
17
|
}
|
|
18
18
|
function s(e) {
|
|
19
|
+
let t = `https://${e}`;
|
|
20
|
+
return {
|
|
21
|
+
workspaceBaseUrl: t,
|
|
22
|
+
globalBaseUrl: t,
|
|
23
|
+
publicStoreBaseUrl: t
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
function c(e) {
|
|
19
27
|
return e ? e === "localhost" || e === "127.0.0.1" || e === "0.0.0.0" || e === "[::1]" || e === "::1" || e.endsWith(".localhost") || e.endsWith(".local.burdenoff.com") : !1;
|
|
20
28
|
}
|
|
21
|
-
var
|
|
22
|
-
function
|
|
29
|
+
var l = !1;
|
|
30
|
+
function u() {
|
|
23
31
|
let r = o();
|
|
24
32
|
if (i.has(r)) return t;
|
|
25
|
-
if (a.has(r)) return
|
|
26
|
-
if (
|
|
27
|
-
let n =
|
|
28
|
-
if (n === "prod") return
|
|
33
|
+
if (a.has(r)) return s(r);
|
|
34
|
+
if (c(r)) {
|
|
35
|
+
let n = d();
|
|
36
|
+
if (n === "prod") return l || (l = !0, console.warn("[gatewayUrls] WARNING: localhost dev server is configured to hit PRODUCTION backends (VITE_GATEWAY_TARGET=prod). Any mutation will modify real prod data. Remove the env var or delete .env.local to disable.")), t;
|
|
29
37
|
if (n === "alpha") return e;
|
|
30
38
|
}
|
|
31
39
|
return n;
|
|
32
40
|
}
|
|
33
|
-
function
|
|
41
|
+
function d() {
|
|
34
42
|
try {
|
|
35
43
|
return {
|
|
36
44
|
BASE_URL: "/",
|
|
@@ -44,4 +52,4 @@ function u() {
|
|
|
44
52
|
}
|
|
45
53
|
}
|
|
46
54
|
//#endregion
|
|
47
|
-
export { r as ALL_PRODUCT_DOMAINS, a as ALPHA_HOSTS, i as PROD_HOSTS, o as getCurrentHostname,
|
|
55
|
+
export { r as ALL_PRODUCT_DOMAINS, a as ALPHA_HOSTS, i as PROD_HOSTS, o as getCurrentHostname, u as resolveGatewayUrls };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gatewayFetchRewrite.d.ts","sourceRoot":"","sources":["../../../src/shared/utils/gatewayFetchRewrite.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,MAAM,WAAW,YAAY;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,kBAAkB;IACjC,2BAA2B;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,sCAAsC;IACtC,KAAK,EAAE,YAAY,CAAC;CACrB;
|
|
1
|
+
{"version":3,"file":"gatewayFetchRewrite.d.ts","sourceRoot":"","sources":["../../../src/shared/utils/gatewayFetchRewrite.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,MAAM,WAAW,YAAY;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,kBAAkB;IACjC,2BAA2B;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,sCAAsC;IACtC,KAAK,EAAE,YAAY,CAAC;CACrB;AAyGD,wBAAgB,gCAAgC,IAAI,IAAI,CAEvD;AAkPD;;;;;GAKG;AACH,wBAAgB,mBAAmB,CACjC,aAAa,CAAC,EAAE,kBAAkB,EAAE,EACpC,aAAa,CAAC,EAAE,YAAY,GAC3B,YAAY,CAad;AAED;;;GAGG;AACH,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,OAAO,EAChB,eAAe,EAAE,WAAW,CAAC,MAAM,CAAC,EACpC,SAAS,CAAC,EAAE,MAAM,EAClB,aAAa,CAAC,EAAE,MAAM,GACrB,OAAO,CAET;AAED;;GAEG;AACH,MAAM,WAAW,0BAA0B;IACzC;;;OAGG;IACH,QAAQ,CAAC,EAAE;QAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,YAAY,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CACzD;AAED;;;;;;;;;GASG;AACH,wBAAgB,0BAA0B,CACxC,KAAK,EAAE,YAAY,EACnB,QAAQ,CAAC,EAAE,0BAA0B,GACpC,IAAI,CA6HN;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,OAAO,SAAyB,GAAG,IAAI,CAQtE"}
|
|
@@ -3,16 +3,21 @@ import { ALL_PRODUCT_DOMAINS as e } from "../config/gatewayUrls.js";
|
|
|
3
3
|
var t = {
|
|
4
4
|
globalBase: "https://graphql.burdenoff.com",
|
|
5
5
|
workspaceBase: "https://graphqlworkspaces.burdenoff.com"
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
};
|
|
7
|
+
function n(e) {
|
|
8
|
+
let t = `https://${e}`;
|
|
9
|
+
return {
|
|
10
|
+
globalBase: t,
|
|
11
|
+
workspaceBase: t
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
var r = [
|
|
10
15
|
...e.flatMap((e) => [{
|
|
11
16
|
hostname: `app.${e}`,
|
|
12
17
|
bases: t
|
|
13
18
|
}, {
|
|
14
19
|
hostname: `alphaapp.${e}`,
|
|
15
|
-
bases: n
|
|
20
|
+
bases: n(`alphaapp.${e}`)
|
|
16
21
|
}]),
|
|
17
22
|
{
|
|
18
23
|
hostname: "admin.burdenoff.com",
|
|
@@ -20,7 +25,7 @@ var t = {
|
|
|
20
25
|
},
|
|
21
26
|
{
|
|
22
27
|
hostname: "alphaadmin.burdenoff.com",
|
|
23
|
-
bases: n
|
|
28
|
+
bases: n("alphaadmin.burdenoff.com")
|
|
24
29
|
}
|
|
25
30
|
], i = {
|
|
26
31
|
globalBase: "https://gw-global.local.burdenoff.com",
|
|
@@ -81,15 +86,22 @@ function S(e) {
|
|
|
81
86
|
function C(e) {
|
|
82
87
|
return `${d}-${e}-at`;
|
|
83
88
|
}
|
|
84
|
-
function w(e
|
|
89
|
+
function w(e) {
|
|
90
|
+
try {
|
|
91
|
+
return c.find((t) => e.getItem(C(t)) !== null) ?? null;
|
|
92
|
+
} catch {
|
|
93
|
+
return null;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
function T(e, t, n) {
|
|
85
97
|
let r = e.getItem(S(t)), i = r ? Number(r) : 0;
|
|
86
98
|
return Number.isFinite(i) && n - i < u;
|
|
87
99
|
}
|
|
88
|
-
function
|
|
100
|
+
function E(e, t, n) {
|
|
89
101
|
let r = e.getItem(C(t)), i = r ? Number(r) : 0;
|
|
90
102
|
return Number.isFinite(i) && n - i < f;
|
|
91
103
|
}
|
|
92
|
-
function
|
|
104
|
+
function D() {
|
|
93
105
|
try {
|
|
94
106
|
let e = new URL(window.location.href || window.location.origin);
|
|
95
107
|
return e.hash = "", e.toString();
|
|
@@ -97,17 +109,17 @@ function E() {
|
|
|
97
109
|
return window.location.origin;
|
|
98
110
|
}
|
|
99
111
|
}
|
|
100
|
-
function
|
|
112
|
+
function O() {
|
|
101
113
|
return window.location.hash ? !0 : p.has(window.location.pathname);
|
|
102
114
|
}
|
|
103
|
-
function
|
|
115
|
+
function k(e, t) {
|
|
104
116
|
let n;
|
|
105
117
|
try {
|
|
106
118
|
n = new URL(window.location.href);
|
|
107
119
|
} catch {
|
|
108
120
|
return null;
|
|
109
121
|
}
|
|
110
|
-
let r = n.searchParams.get(b), i = r === "
|
|
122
|
+
let r = n.searchParams.get(b), i = r === "global" ? "global" : r === "workspace" ? "workspace" : r === "1" ? w(e) ?? "global" : null;
|
|
111
123
|
if (!i) return null;
|
|
112
124
|
n.searchParams.delete(b);
|
|
113
125
|
try {
|
|
@@ -115,41 +127,46 @@ function O(e, t) {
|
|
|
115
127
|
} catch {}
|
|
116
128
|
return window.history.replaceState(window.history.state, "", n.toString()), i;
|
|
117
129
|
}
|
|
118
|
-
function
|
|
119
|
-
if (typeof window > "u" || !y(e) || !v(window.location.hostname.toLowerCase())) return;
|
|
130
|
+
function A(e) {
|
|
131
|
+
if (typeof window > "u" || !y(e) || !v(window.location.hostname.toLowerCase())) return !1;
|
|
120
132
|
let t = x();
|
|
121
|
-
if (!t) return;
|
|
133
|
+
if (!t) return !1;
|
|
122
134
|
let n = Date.now();
|
|
123
|
-
if (
|
|
124
|
-
let r = c.find((e) => !
|
|
125
|
-
if (!r ||
|
|
135
|
+
if (k(t, n), O()) return !1;
|
|
136
|
+
let r = c.find((e) => !T(t, e, n));
|
|
137
|
+
if (!r || E(t, r, n)) return !1;
|
|
126
138
|
try {
|
|
127
139
|
t.setItem(C(r), String(n));
|
|
128
140
|
} catch {}
|
|
129
|
-
let i = new URL(
|
|
141
|
+
let i = new URL(D());
|
|
130
142
|
r === "workspace" && i.searchParams.set(b, r);
|
|
131
143
|
let a = new URL(s[r]);
|
|
132
|
-
a.searchParams.set("returnTo", i.toString())
|
|
144
|
+
a.searchParams.set("returnTo", i.toString());
|
|
145
|
+
try {
|
|
146
|
+
return window.location.replace(a.toString()), !0;
|
|
147
|
+
} catch {
|
|
148
|
+
return !1;
|
|
149
|
+
}
|
|
133
150
|
}
|
|
134
|
-
function
|
|
151
|
+
function j(e) {
|
|
135
152
|
return typeof e.query == "string" ? /\bquery\b/.test(e.query) && !/\bmutation\b|\bsubscription\b/.test(e.query) : !1;
|
|
136
153
|
}
|
|
137
|
-
function
|
|
154
|
+
function M(e) {
|
|
138
155
|
return typeof e.operationName == "string" && e.operationName ? e.operationName : typeof e.query == "string" ? e.query.match(/(?:query|mutation|subscription)\s+([A-Za-z0-9_]+)/)?.[1] ?? null : null;
|
|
139
156
|
}
|
|
140
|
-
function
|
|
157
|
+
function N(e) {
|
|
141
158
|
return Object.fromEntries(h.map((t) => [t, e.get(t) ?? ""]));
|
|
142
159
|
}
|
|
143
|
-
function
|
|
144
|
-
let n =
|
|
145
|
-
return !n || !
|
|
160
|
+
function P(e, t) {
|
|
161
|
+
let n = M(t);
|
|
162
|
+
return !n || !j(t) ? null : JSON.stringify({
|
|
146
163
|
url: e.url,
|
|
147
|
-
headers:
|
|
164
|
+
headers: N(e.headers),
|
|
148
165
|
operationName: n,
|
|
149
166
|
variables: t.variables ?? null
|
|
150
167
|
});
|
|
151
168
|
}
|
|
152
|
-
function
|
|
169
|
+
function F(e) {
|
|
153
170
|
try {
|
|
154
171
|
let t = JSON.parse(e);
|
|
155
172
|
return Array.isArray(t) ? t : t && typeof t == "object" ? [t] : null;
|
|
@@ -157,66 +174,67 @@ function P(e) {
|
|
|
157
174
|
return null;
|
|
158
175
|
}
|
|
159
176
|
}
|
|
160
|
-
function
|
|
177
|
+
function I(e, t) {
|
|
161
178
|
return new Response(JSON.stringify(t ? e : e[0]), {
|
|
162
179
|
status: 200,
|
|
163
180
|
headers: { "content-type": "application/json" }
|
|
164
181
|
});
|
|
165
182
|
}
|
|
166
|
-
function
|
|
183
|
+
function L() {
|
|
167
184
|
return typeof performance < "u" && performance.now() < o;
|
|
168
185
|
}
|
|
169
|
-
function
|
|
186
|
+
function R(e) {
|
|
170
187
|
let t = new Headers(e.headers), n = !1;
|
|
171
188
|
for (let e of m) t.has(e) && (t.delete(e), n = !0);
|
|
172
189
|
return n ? new Request(e, { headers: t }) : e;
|
|
173
190
|
}
|
|
174
|
-
function
|
|
191
|
+
function z(e, t) {
|
|
175
192
|
let n = window.location.hostname.toLowerCase(), a = [...r, ...e ?? []];
|
|
176
193
|
for (let e of a) if (n === e.hostname) return e.bases;
|
|
177
194
|
return t ?? i;
|
|
178
195
|
}
|
|
179
|
-
function
|
|
196
|
+
function B(e, t) {
|
|
180
197
|
let { globalBase: n, workspaceBase: r } = e;
|
|
181
198
|
if (!n || !r) return;
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
if (
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
199
|
+
let i = A(e), o = globalThis.fetch.bind(globalThis), s = window.location.origin, c = new Set([s, "https://gw-global.local.burdenoff.com"]), l = new Set([s, "https://gw-wspace.local.burdenoff.com"]), u = (e) => /(?:^|\/)global\/graphql$/.test(e) ? "/global/graphql" : /(?:^|\/)workspaces\/graphql$/.test(e) ? "/workspaces/graphql" : "", d = (e) => {
|
|
200
|
+
let t = new URL(e, window.location.origin), i = u(t.pathname);
|
|
201
|
+
return i === "/global/graphql" && c.has(t.origin) ? `${n}${i}${t.search}${t.hash}` : i === "/workspaces/graphql" && l.has(t.origin) ? `${r}${i}${t.search}${t.hash}` : e;
|
|
202
|
+
}, f = async (e) => {
|
|
203
|
+
let t = /(?:^|\/)graphql$/.test(new URL(e.url).pathname);
|
|
204
|
+
if (i && t) return new Promise(() => void 0);
|
|
205
|
+
if (!(e.method.toUpperCase() === "POST" && t)) return o(e);
|
|
206
|
+
let n = await e.clone().text(), r = R(e.clone()), s = F(n);
|
|
207
|
+
if (!s?.length) return o(e);
|
|
208
|
+
let c = n.trimStart().startsWith("["), l = s.map((e) => P(r, e));
|
|
209
|
+
if (L() && l.every(Boolean)) {
|
|
210
|
+
let e = g(), t = l.map((t) => e.get(t)), n = Date.now();
|
|
211
|
+
if (t.every((e) => e && e.expiresAt > n)) return I(t.map((e) => e.value), c);
|
|
194
212
|
}
|
|
195
|
-
let
|
|
196
|
-
if (!
|
|
213
|
+
let u = await o(e);
|
|
214
|
+
if (!u.ok || !l.some(Boolean) || !L()) return u;
|
|
197
215
|
try {
|
|
198
|
-
let e = await
|
|
216
|
+
let e = await u.clone().json(), t = Array.isArray(e) ? e : [e], n = g();
|
|
199
217
|
t.forEach((e, t) => {
|
|
200
|
-
let r =
|
|
218
|
+
let r = l[t];
|
|
201
219
|
r && (e && typeof e == "object" && "errors" in e && Array.isArray(e.errors) || n.set(r, {
|
|
202
220
|
value: e,
|
|
203
221
|
expiresAt: Date.now() + a
|
|
204
222
|
}));
|
|
205
223
|
});
|
|
206
224
|
} catch {}
|
|
207
|
-
return
|
|
208
|
-
},
|
|
209
|
-
if (e == null) return
|
|
225
|
+
return u;
|
|
226
|
+
}, p = o, m = ((e, t) => {
|
|
227
|
+
if (e == null) return o(e, t);
|
|
210
228
|
if (e instanceof Request) {
|
|
211
|
-
let n =
|
|
212
|
-
return
|
|
229
|
+
let n = d(e.url), r = new Request(n, e);
|
|
230
|
+
return f(t ? new Request(r, t) : r);
|
|
213
231
|
}
|
|
214
232
|
let n = typeof e == "string" ? e : e.toString();
|
|
215
|
-
return
|
|
233
|
+
return f(new Request(d(n), t));
|
|
216
234
|
});
|
|
217
|
-
|
|
235
|
+
p.preconnect && (m.preconnect = p.preconnect), globalThis.fetch = m;
|
|
218
236
|
}
|
|
219
|
-
function
|
|
237
|
+
function V(e = "VITE_VERBOSE_CONSOLE") {
|
|
220
238
|
({
|
|
221
239
|
BASE_URL: "/",
|
|
222
240
|
DEV: !1,
|
|
@@ -226,4 +244,4 @@ function B(e = "VITE_VERBOSE_CONSOLE") {
|
|
|
226
244
|
})?.[e] !== "true" && (console.log = () => {}, console.info = () => {}, console.debug = () => {});
|
|
227
245
|
}
|
|
228
246
|
//#endregion
|
|
229
|
-
export { _ as clearGatewayGraphQLResponseCache,
|
|
247
|
+
export { _ as clearGatewayGraphQLResponseCache, B as installGatewayFetchRewrite, z as resolveGatewayBases, V as suppressConsole };
|