@burdenoff/fe-libs 2026.715.4 → 2026.715.5
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.
|
@@ -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;AAgGD,wBAAgB,gCAAgC,IAAI,IAAI,CAEvD;
|
|
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;AAgGD,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"}
|
|
@@ -81,15 +81,22 @@ function S(e) {
|
|
|
81
81
|
function C(e) {
|
|
82
82
|
return `${d}-${e}-at`;
|
|
83
83
|
}
|
|
84
|
-
function w(e
|
|
84
|
+
function w(e) {
|
|
85
|
+
try {
|
|
86
|
+
return c.find((t) => e.getItem(C(t)) !== null) ?? null;
|
|
87
|
+
} catch {
|
|
88
|
+
return null;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
function T(e, t, n) {
|
|
85
92
|
let r = e.getItem(S(t)), i = r ? Number(r) : 0;
|
|
86
93
|
return Number.isFinite(i) && n - i < u;
|
|
87
94
|
}
|
|
88
|
-
function
|
|
95
|
+
function E(e, t, n) {
|
|
89
96
|
let r = e.getItem(C(t)), i = r ? Number(r) : 0;
|
|
90
97
|
return Number.isFinite(i) && n - i < f;
|
|
91
98
|
}
|
|
92
|
-
function
|
|
99
|
+
function D() {
|
|
93
100
|
try {
|
|
94
101
|
let e = new URL(window.location.href || window.location.origin);
|
|
95
102
|
return e.hash = "", e.toString();
|
|
@@ -97,17 +104,17 @@ function E() {
|
|
|
97
104
|
return window.location.origin;
|
|
98
105
|
}
|
|
99
106
|
}
|
|
100
|
-
function
|
|
107
|
+
function O() {
|
|
101
108
|
return window.location.hash ? !0 : p.has(window.location.pathname);
|
|
102
109
|
}
|
|
103
|
-
function
|
|
110
|
+
function k(e, t) {
|
|
104
111
|
let n;
|
|
105
112
|
try {
|
|
106
113
|
n = new URL(window.location.href);
|
|
107
114
|
} catch {
|
|
108
115
|
return null;
|
|
109
116
|
}
|
|
110
|
-
let r = n.searchParams.get(b), i = r === "
|
|
117
|
+
let r = n.searchParams.get(b), i = r === "global" ? "global" : r === "workspace" ? "workspace" : r === "1" ? w(e) ?? "global" : null;
|
|
111
118
|
if (!i) return null;
|
|
112
119
|
n.searchParams.delete(b);
|
|
113
120
|
try {
|
|
@@ -115,41 +122,46 @@ function O(e, t) {
|
|
|
115
122
|
} catch {}
|
|
116
123
|
return window.history.replaceState(window.history.state, "", n.toString()), i;
|
|
117
124
|
}
|
|
118
|
-
function
|
|
119
|
-
if (typeof window > "u" || !y(e) || !v(window.location.hostname.toLowerCase())) return;
|
|
125
|
+
function A(e) {
|
|
126
|
+
if (typeof window > "u" || !y(e) || !v(window.location.hostname.toLowerCase())) return !1;
|
|
120
127
|
let t = x();
|
|
121
|
-
if (!t) return;
|
|
128
|
+
if (!t) return !1;
|
|
122
129
|
let n = Date.now();
|
|
123
|
-
if (
|
|
124
|
-
let r = c.find((e) => !
|
|
125
|
-
if (!r ||
|
|
130
|
+
if (k(t, n), O()) return !1;
|
|
131
|
+
let r = c.find((e) => !T(t, e, n));
|
|
132
|
+
if (!r || E(t, r, n)) return !1;
|
|
126
133
|
try {
|
|
127
134
|
t.setItem(C(r), String(n));
|
|
128
135
|
} catch {}
|
|
129
|
-
let i = new URL(
|
|
136
|
+
let i = new URL(D());
|
|
130
137
|
r === "workspace" && i.searchParams.set(b, r);
|
|
131
138
|
let a = new URL(s[r]);
|
|
132
|
-
a.searchParams.set("returnTo", i.toString())
|
|
139
|
+
a.searchParams.set("returnTo", i.toString());
|
|
140
|
+
try {
|
|
141
|
+
return window.location.replace(a.toString()), !0;
|
|
142
|
+
} catch {
|
|
143
|
+
return !1;
|
|
144
|
+
}
|
|
133
145
|
}
|
|
134
|
-
function
|
|
146
|
+
function j(e) {
|
|
135
147
|
return typeof e.query == "string" ? /\bquery\b/.test(e.query) && !/\bmutation\b|\bsubscription\b/.test(e.query) : !1;
|
|
136
148
|
}
|
|
137
|
-
function
|
|
149
|
+
function M(e) {
|
|
138
150
|
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
151
|
}
|
|
140
|
-
function
|
|
152
|
+
function N(e) {
|
|
141
153
|
return Object.fromEntries(h.map((t) => [t, e.get(t) ?? ""]));
|
|
142
154
|
}
|
|
143
|
-
function
|
|
144
|
-
let n =
|
|
145
|
-
return !n || !
|
|
155
|
+
function P(e, t) {
|
|
156
|
+
let n = M(t);
|
|
157
|
+
return !n || !j(t) ? null : JSON.stringify({
|
|
146
158
|
url: e.url,
|
|
147
|
-
headers:
|
|
159
|
+
headers: N(e.headers),
|
|
148
160
|
operationName: n,
|
|
149
161
|
variables: t.variables ?? null
|
|
150
162
|
});
|
|
151
163
|
}
|
|
152
|
-
function
|
|
164
|
+
function F(e) {
|
|
153
165
|
try {
|
|
154
166
|
let t = JSON.parse(e);
|
|
155
167
|
return Array.isArray(t) ? t : t && typeof t == "object" ? [t] : null;
|
|
@@ -157,66 +169,67 @@ function P(e) {
|
|
|
157
169
|
return null;
|
|
158
170
|
}
|
|
159
171
|
}
|
|
160
|
-
function
|
|
172
|
+
function I(e, t) {
|
|
161
173
|
return new Response(JSON.stringify(t ? e : e[0]), {
|
|
162
174
|
status: 200,
|
|
163
175
|
headers: { "content-type": "application/json" }
|
|
164
176
|
});
|
|
165
177
|
}
|
|
166
|
-
function
|
|
178
|
+
function L() {
|
|
167
179
|
return typeof performance < "u" && performance.now() < o;
|
|
168
180
|
}
|
|
169
|
-
function
|
|
181
|
+
function R(e) {
|
|
170
182
|
let t = new Headers(e.headers), n = !1;
|
|
171
183
|
for (let e of m) t.has(e) && (t.delete(e), n = !0);
|
|
172
184
|
return n ? new Request(e, { headers: t }) : e;
|
|
173
185
|
}
|
|
174
|
-
function
|
|
186
|
+
function z(e, t) {
|
|
175
187
|
let n = window.location.hostname.toLowerCase(), a = [...r, ...e ?? []];
|
|
176
188
|
for (let e of a) if (n === e.hostname) return e.bases;
|
|
177
189
|
return t ?? i;
|
|
178
190
|
}
|
|
179
|
-
function
|
|
191
|
+
function B(e, t) {
|
|
180
192
|
let { globalBase: n, workspaceBase: r } = e;
|
|
181
193
|
if (!n || !r) return;
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
if (
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
+
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) => {
|
|
195
|
+
let t = new URL(e, window.location.origin), i = u(t.pathname);
|
|
196
|
+
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;
|
|
197
|
+
}, f = async (e) => {
|
|
198
|
+
let t = /(?:^|\/)graphql$/.test(new URL(e.url).pathname);
|
|
199
|
+
if (i && t) return new Promise(() => void 0);
|
|
200
|
+
if (!(e.method.toUpperCase() === "POST" && t)) return o(e);
|
|
201
|
+
let n = await e.clone().text(), r = R(e.clone()), s = F(n);
|
|
202
|
+
if (!s?.length) return o(e);
|
|
203
|
+
let c = n.trimStart().startsWith("["), l = s.map((e) => P(r, e));
|
|
204
|
+
if (L() && l.every(Boolean)) {
|
|
205
|
+
let e = g(), t = l.map((t) => e.get(t)), n = Date.now();
|
|
206
|
+
if (t.every((e) => e && e.expiresAt > n)) return I(t.map((e) => e.value), c);
|
|
194
207
|
}
|
|
195
|
-
let
|
|
196
|
-
if (!
|
|
208
|
+
let u = await o(e);
|
|
209
|
+
if (!u.ok || !l.some(Boolean) || !L()) return u;
|
|
197
210
|
try {
|
|
198
|
-
let e = await
|
|
211
|
+
let e = await u.clone().json(), t = Array.isArray(e) ? e : [e], n = g();
|
|
199
212
|
t.forEach((e, t) => {
|
|
200
|
-
let r =
|
|
213
|
+
let r = l[t];
|
|
201
214
|
r && (e && typeof e == "object" && "errors" in e && Array.isArray(e.errors) || n.set(r, {
|
|
202
215
|
value: e,
|
|
203
216
|
expiresAt: Date.now() + a
|
|
204
217
|
}));
|
|
205
218
|
});
|
|
206
219
|
} catch {}
|
|
207
|
-
return
|
|
208
|
-
},
|
|
209
|
-
if (e == null) return
|
|
220
|
+
return u;
|
|
221
|
+
}, p = o, m = ((e, t) => {
|
|
222
|
+
if (e == null) return o(e, t);
|
|
210
223
|
if (e instanceof Request) {
|
|
211
|
-
let n =
|
|
212
|
-
return
|
|
224
|
+
let n = d(e.url), r = new Request(n, e);
|
|
225
|
+
return f(t ? new Request(r, t) : r);
|
|
213
226
|
}
|
|
214
227
|
let n = typeof e == "string" ? e : e.toString();
|
|
215
|
-
return
|
|
228
|
+
return f(new Request(d(n), t));
|
|
216
229
|
});
|
|
217
|
-
|
|
230
|
+
p.preconnect && (m.preconnect = p.preconnect), globalThis.fetch = m;
|
|
218
231
|
}
|
|
219
|
-
function
|
|
232
|
+
function V(e = "VITE_VERBOSE_CONSOLE") {
|
|
220
233
|
({
|
|
221
234
|
BASE_URL: "/",
|
|
222
235
|
DEV: !1,
|
|
@@ -226,4 +239,4 @@ function B(e = "VITE_VERBOSE_CONSOLE") {
|
|
|
226
239
|
})?.[e] !== "true" && (console.log = () => {}, console.info = () => {}, console.debug = () => {});
|
|
227
240
|
}
|
|
228
241
|
//#endregion
|
|
229
|
-
export { _ as clearGatewayGraphQLResponseCache,
|
|
242
|
+
export { _ as clearGatewayGraphQLResponseCache, B as installGatewayFetchRewrite, z as resolveGatewayBases, V as suppressConsole };
|