@burdenoff/fe-libs 2026.627.2 → 2026.628.1
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/shared/graphql/client.d.ts +2 -0
- package/dist/shared/graphql/client.d.ts.map +1 -1
- package/dist/shared/graphql/client.js +122 -120
- package/dist/shared/graphql/fetch.d.ts.map +1 -1
- package/dist/shared/graphql/fetch.js +101 -95
- package/dist/shared/providers/AppShellProvider.d.ts.map +1 -1
- package/dist/shared/providers/AppShellProvider.js +1 -0
- package/dist/shared/providers/shell/AuthBridgeClient.d.ts +4 -2
- package/dist/shared/providers/shell/AuthBridgeClient.d.ts.map +1 -1
- package/dist/shared/providers/shell/AuthBridgeClient.js +27 -16
- package/dist/shared/providers/shell/MultiGatewayProvider.d.ts +3 -1
- package/dist/shared/providers/shell/MultiGatewayProvider.d.ts.map +1 -1
- package/dist/shared/providers/shell/MultiGatewayProvider.js +76 -72
- package/dist/shared/utils/gatewayFetchRewrite.d.ts +8 -12
- package/dist/shared/utils/gatewayFetchRewrite.d.ts.map +1 -1
- package/dist/shared/utils/gatewayFetchRewrite.js +111 -62
- package/package.json +1 -1
|
@@ -6,28 +6,28 @@ import { useCallback as i, useEffect as a, useMemo as o, useRef as s } from "rea
|
|
|
6
6
|
import { jsx as c } from "react/jsx-runtime";
|
|
7
7
|
import { ApolloProvider as l } from "@apollo/client/react";
|
|
8
8
|
//#region src/shared/providers/shell/MultiGatewayProvider.tsx
|
|
9
|
-
function u({ children: u, workspaceBaseUrl: d, globalBaseUrl: f, organizationId: p,
|
|
10
|
-
let { getAccessToken:
|
|
9
|
+
function u({ children: u, workspaceBaseUrl: d, globalBaseUrl: f, organizationId: p, productSlug: m, defaultGateway: h = "workspace", debug: g = !1, enableSubscriptions: _ = !1, onAuthError: v, onNetworkError: y, onRefreshToken: b }) {
|
|
10
|
+
let { getAccessToken: x, getWorkspaceToken: S, accessToken: C, workspaceToken: w } = r(), T = s({
|
|
11
11
|
workspaceClient: null,
|
|
12
12
|
globalClient: null
|
|
13
|
-
}),
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
let e =
|
|
13
|
+
}), E = s(null), D = i(() => {
|
|
14
|
+
E.current ||= setTimeout(() => {
|
|
15
|
+
E.current = null;
|
|
16
|
+
let e = T.current, t = [];
|
|
17
17
|
e.workspaceClient && t.push(e.workspaceClient.refetchQueries({ include: "active" })), e.globalClient && t.push(e.globalClient.refetchQueries({ include: "active" })), t.length !== 0 && Promise.allSettled(t).then((e) => {
|
|
18
|
-
if (!
|
|
18
|
+
if (!g) return;
|
|
19
19
|
let t = e.filter((e) => e.status === "rejected");
|
|
20
20
|
t.length > 0 && console.warn("[MultiGatewayProvider] Active query refresh failed after mutation", t);
|
|
21
21
|
});
|
|
22
22
|
}, 0);
|
|
23
|
-
}, [
|
|
23
|
+
}, [g]), O = i(() => {
|
|
24
24
|
let e = sessionStorage.getItem("bf-active-profile");
|
|
25
25
|
if (e) {
|
|
26
26
|
let t = localStorage.getItem(`bf-p-${e}-locale`);
|
|
27
27
|
if (t) return t;
|
|
28
28
|
}
|
|
29
29
|
return localStorage.getItem("burdenoff-locale") || "en";
|
|
30
|
-
}, []),
|
|
30
|
+
}, []), k = i(() => {
|
|
31
31
|
let e = sessionStorage.getItem("bf-active-profile");
|
|
32
32
|
if (e) {
|
|
33
33
|
let t = localStorage.getItem(`bf-p-${e}-geography`);
|
|
@@ -40,110 +40,114 @@ function u({ children: u, workspaceBaseUrl: d, globalBaseUrl: f, organizationId:
|
|
|
40
40
|
return JSON.parse(t);
|
|
41
41
|
} catch {}
|
|
42
42
|
return null;
|
|
43
|
-
}, []),
|
|
43
|
+
}, []), A = i(() => e("workspace"), []), j = i(() => e("project"), []), M = o(() => t({
|
|
44
44
|
gateway: "workspace",
|
|
45
45
|
baseUrl: d,
|
|
46
|
-
authToken:
|
|
47
|
-
workspaceToken:
|
|
48
|
-
workspaceId:
|
|
49
|
-
projectId:
|
|
46
|
+
authToken: x,
|
|
47
|
+
workspaceToken: S,
|
|
48
|
+
workspaceId: A,
|
|
49
|
+
projectId: j,
|
|
50
50
|
organizationId: p,
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
51
|
+
productSlug: m,
|
|
52
|
+
locale: O,
|
|
53
|
+
geography: k,
|
|
54
|
+
enableSubscriptions: _,
|
|
55
|
+
debug: g,
|
|
56
|
+
onAuthError: v,
|
|
57
|
+
onRefreshToken: b,
|
|
58
|
+
onNetworkError: y,
|
|
59
|
+
onMutationSuccess: D
|
|
59
60
|
}), [
|
|
60
61
|
d,
|
|
61
|
-
b,
|
|
62
62
|
x,
|
|
63
|
-
|
|
63
|
+
S,
|
|
64
64
|
A,
|
|
65
|
+
j,
|
|
65
66
|
p,
|
|
66
|
-
|
|
67
|
+
m,
|
|
67
68
|
O,
|
|
68
|
-
|
|
69
|
-
h,
|
|
69
|
+
k,
|
|
70
70
|
_,
|
|
71
|
-
|
|
71
|
+
g,
|
|
72
72
|
v,
|
|
73
|
-
|
|
74
|
-
|
|
73
|
+
b,
|
|
74
|
+
y,
|
|
75
|
+
D
|
|
76
|
+
]), N = o(() => t({
|
|
75
77
|
gateway: "global",
|
|
76
78
|
baseUrl: f,
|
|
77
|
-
authToken:
|
|
79
|
+
authToken: x,
|
|
78
80
|
organizationId: p,
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
81
|
+
productSlug: m,
|
|
82
|
+
locale: O,
|
|
83
|
+
geography: k,
|
|
84
|
+
debug: g,
|
|
85
|
+
onAuthError: v,
|
|
86
|
+
onRefreshToken: b,
|
|
87
|
+
onNetworkError: y,
|
|
88
|
+
onMutationSuccess: D
|
|
86
89
|
}), [
|
|
87
90
|
f,
|
|
88
|
-
|
|
91
|
+
x,
|
|
89
92
|
p,
|
|
90
|
-
|
|
93
|
+
m,
|
|
91
94
|
O,
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
y,
|
|
95
|
+
k,
|
|
96
|
+
g,
|
|
95
97
|
v,
|
|
96
|
-
|
|
98
|
+
b,
|
|
99
|
+
y,
|
|
100
|
+
D
|
|
97
101
|
]);
|
|
98
102
|
a(() => {
|
|
99
|
-
|
|
100
|
-
workspaceClient:
|
|
101
|
-
globalClient:
|
|
103
|
+
T.current = {
|
|
104
|
+
workspaceClient: M,
|
|
105
|
+
globalClient: N
|
|
102
106
|
};
|
|
103
|
-
}, [
|
|
104
|
-
let e =
|
|
107
|
+
}, [M, N]), a(() => {
|
|
108
|
+
let e = E;
|
|
105
109
|
return () => {
|
|
106
110
|
e.current &&= (clearTimeout(e.current), null);
|
|
107
111
|
};
|
|
108
112
|
}, []);
|
|
109
|
-
let
|
|
113
|
+
let P = i((e) => e === "workspace" ? T.current.workspaceClient ?? M : T.current.globalClient ?? N, [M, N]);
|
|
110
114
|
return a(() => {
|
|
111
|
-
|
|
112
|
-
hasAccessToken: !!
|
|
113
|
-
hasWorkspaceToken: !!
|
|
115
|
+
g && console.log("[MultiGatewayProvider] Tokens updated:", {
|
|
116
|
+
hasAccessToken: !!C,
|
|
117
|
+
hasWorkspaceToken: !!w
|
|
114
118
|
});
|
|
115
119
|
}, [
|
|
116
|
-
S,
|
|
117
120
|
C,
|
|
118
|
-
|
|
121
|
+
w,
|
|
122
|
+
g
|
|
119
123
|
]), a(() => {
|
|
120
124
|
if (typeof window > "u") return;
|
|
121
125
|
let e = async (e) => {
|
|
122
|
-
|
|
123
|
-
try {
|
|
124
|
-
j.cache.evict({ id: "ROOT_QUERY" }), j.cache.gc();
|
|
125
|
-
} catch {}
|
|
126
|
+
g && console.log("[MultiGatewayProvider] Context changed; evicting cache + refetching", e);
|
|
126
127
|
try {
|
|
127
128
|
M.cache.evict({ id: "ROOT_QUERY" }), M.cache.gc();
|
|
128
129
|
} catch {}
|
|
129
130
|
try {
|
|
130
|
-
|
|
131
|
+
N.cache.evict({ id: "ROOT_QUERY" }), N.cache.gc();
|
|
131
132
|
} catch {}
|
|
132
133
|
try {
|
|
133
134
|
await M.refetchQueries({ include: "active" });
|
|
134
135
|
} catch {}
|
|
136
|
+
try {
|
|
137
|
+
await N.refetchQueries({ include: "active" });
|
|
138
|
+
} catch {}
|
|
135
139
|
};
|
|
136
140
|
return window.addEventListener("burdenoff:workspace-changed", e), window.addEventListener("burdenoff:organization-changed", e), window.addEventListener("burdenoff:project-changed", e), () => {
|
|
137
141
|
window.removeEventListener("burdenoff:workspace-changed", e), window.removeEventListener("burdenoff:organization-changed", e), window.removeEventListener("burdenoff:project-changed", e);
|
|
138
142
|
};
|
|
139
143
|
}, [
|
|
140
|
-
j,
|
|
141
144
|
M,
|
|
142
|
-
|
|
145
|
+
N,
|
|
146
|
+
g
|
|
143
147
|
]), a(() => {
|
|
144
|
-
let e =
|
|
148
|
+
let e = M, t = N;
|
|
145
149
|
return () => {
|
|
146
|
-
if (
|
|
150
|
+
if (g && console.log("[MultiGatewayProvider] Cleaning up Apollo clients"), !(typeof window < "u" && (window.location.hostname === "localhost" || window.location.hostname === "127.0.0.1" || window.location.hostname.endsWith(".local.burdenoff.com")))) {
|
|
147
151
|
try {
|
|
148
152
|
e.stop();
|
|
149
153
|
} catch {}
|
|
@@ -153,21 +157,21 @@ function u({ children: u, workspaceBaseUrl: d, globalBaseUrl: f, organizationId:
|
|
|
153
157
|
}
|
|
154
158
|
};
|
|
155
159
|
}, [
|
|
156
|
-
j,
|
|
157
160
|
M,
|
|
158
|
-
|
|
161
|
+
N,
|
|
162
|
+
g
|
|
159
163
|
]), /* @__PURE__ */ c(n, {
|
|
160
164
|
value: o(() => ({
|
|
161
|
-
workspaceClient:
|
|
162
|
-
globalClient:
|
|
163
|
-
getClient:
|
|
165
|
+
workspaceClient: M,
|
|
166
|
+
globalClient: N,
|
|
167
|
+
getClient: P
|
|
164
168
|
}), [
|
|
165
|
-
j,
|
|
166
169
|
M,
|
|
167
|
-
N
|
|
170
|
+
N,
|
|
171
|
+
P
|
|
168
172
|
]),
|
|
169
173
|
children: /* @__PURE__ */ c(l, {
|
|
170
|
-
client:
|
|
174
|
+
client: h === "workspace" ? M : N,
|
|
171
175
|
children: u
|
|
172
176
|
})
|
|
173
177
|
});
|
|
@@ -27,6 +27,7 @@ export interface GatewayBaseMapping {
|
|
|
27
27
|
/** Gateway bases for this hostname */
|
|
28
28
|
bases: GatewayBases;
|
|
29
29
|
}
|
|
30
|
+
export declare function clearGatewayGraphQLResponseCache(): void;
|
|
30
31
|
/**
|
|
31
32
|
* Resolve gateway base URLs from the current hostname.
|
|
32
33
|
*
|
|
@@ -35,22 +36,17 @@ export interface GatewayBaseMapping {
|
|
|
35
36
|
*/
|
|
36
37
|
export declare function resolveGatewayBases(extraMappings?: GatewayBaseMapping[], localDefaults?: GatewayBases): GatewayBases;
|
|
37
38
|
/**
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
* Pure + exported so it can be unit-tested without mocking `import.meta.env`.
|
|
39
|
+
* @deprecated Browser service-token headers are intentionally unsupported.
|
|
40
|
+
* Cloudflare Access client secrets must never be attached from app code.
|
|
41
41
|
*/
|
|
42
|
-
export declare function maybeAttachCfAccessHeaders(request: Request,
|
|
42
|
+
export declare function maybeAttachCfAccessHeaders(request: Request, _gatewayOrigins: ReadonlySet<string>, _clientId?: string, _clientSecret?: string): Request;
|
|
43
43
|
/**
|
|
44
44
|
* Options for installGatewayFetchRewrite.
|
|
45
45
|
*/
|
|
46
46
|
export interface GatewayFetchRewriteOptions {
|
|
47
47
|
/**
|
|
48
|
-
* Cloudflare Access service-token
|
|
49
|
-
*
|
|
50
|
-
* `import.meta.env.VITE_CF_ACCESS_CLIENT_ID/_SECRET` in its own source and
|
|
51
|
-
* forwards them here. When both are present, CF-Access-Client-Id/Secret headers
|
|
52
|
-
* are attached to requests targeting a configured gateway origin. Omit on
|
|
53
|
-
* prod/local (gateways are not CF-gated).
|
|
48
|
+
* @deprecated Browser Cloudflare Access service-token forwarding is disabled.
|
|
49
|
+
* Client secrets must stay out of browser request headers.
|
|
54
50
|
*/
|
|
55
51
|
cfAccess?: {
|
|
56
52
|
clientId?: string;
|
|
@@ -65,9 +61,9 @@ export interface GatewayFetchRewriteOptions {
|
|
|
65
61
|
* - `/workspaces/graphql` → workspaceBase
|
|
66
62
|
*
|
|
67
63
|
* @param bases - Gateway base URLs to rewrite to
|
|
68
|
-
* @param options -
|
|
64
|
+
* @param options - Deprecated options retained for source compatibility; ignored
|
|
69
65
|
*/
|
|
70
|
-
export declare function installGatewayFetchRewrite(bases: GatewayBases,
|
|
66
|
+
export declare function installGatewayFetchRewrite(bases: GatewayBases, _options?: GatewayFetchRewriteOptions): void;
|
|
71
67
|
/**
|
|
72
68
|
* Suppress verbose console output in production/non-debug environments.
|
|
73
69
|
*
|
|
@@ -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;AAgFD,wBAAgB,gCAAgC,IAAI,IAAI,CAEvD;AA2ID;;;;;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,CAuHN;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,OAAO,SAAyB,GAAG,IAAI,CAQtE"}
|
|
@@ -6,23 +6,38 @@ var t = {
|
|
|
6
6
|
}, n = {
|
|
7
7
|
globalBase: "https://alphagraphql.burdenoff.com",
|
|
8
8
|
workspaceBase: "https://alphagraphqlworkspaces.burdenoff.com"
|
|
9
|
-
}, r = [
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
9
|
+
}, r = [
|
|
10
|
+
...e.flatMap((e) => [{
|
|
11
|
+
hostname: `app.${e}`,
|
|
12
|
+
bases: t
|
|
13
|
+
}, {
|
|
14
|
+
hostname: `alphaapp.${e}`,
|
|
15
|
+
bases: n
|
|
16
|
+
}]),
|
|
17
|
+
{
|
|
18
|
+
hostname: "admin.burdenoff.com",
|
|
19
|
+
bases: t
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
hostname: "alphaadmin.burdenoff.com",
|
|
23
|
+
bases: n
|
|
24
|
+
}
|
|
25
|
+
], i = {
|
|
19
26
|
globalBase: "https://gw-global.local.burdenoff.com",
|
|
20
27
|
workspaceBase: "https://gw-wspace.local.burdenoff.com"
|
|
21
|
-
}, a = 15e3, o = 1e4, s = [
|
|
28
|
+
}, a = 15e3, o = 1e4, s = "https://alphagraphql.burdenoff.com/__cf-access-prime", c = "bf-alpha-api-access-primed-at", l = 1200 * 60 * 1e3, u = new Set([
|
|
29
|
+
"/auth/oauth/callback",
|
|
30
|
+
"/auth/session-bridge",
|
|
31
|
+
"/auth/sso-callback",
|
|
32
|
+
"/auth/sso-clear",
|
|
33
|
+
"/auth/sso-deposit",
|
|
34
|
+
"/auth/sso-relay",
|
|
35
|
+
"/auth/sso/callback"
|
|
36
|
+
]), d = [
|
|
22
37
|
"traceparent",
|
|
23
38
|
"tracestate",
|
|
24
39
|
"baggage"
|
|
25
|
-
],
|
|
40
|
+
], f = [
|
|
26
41
|
"authorization",
|
|
27
42
|
"accept-language",
|
|
28
43
|
"x-org-id",
|
|
@@ -32,29 +47,78 @@ var t = {
|
|
|
32
47
|
"x-geo-currency",
|
|
33
48
|
"x-geo-timezone"
|
|
34
49
|
];
|
|
35
|
-
function
|
|
50
|
+
function p() {
|
|
36
51
|
let e = globalThis;
|
|
37
52
|
return e.__boffGraphQLResponseCache ||= /* @__PURE__ */ new Map(), e.__boffGraphQLResponseCache;
|
|
38
53
|
}
|
|
39
|
-
function
|
|
54
|
+
function m() {
|
|
55
|
+
p().clear();
|
|
56
|
+
}
|
|
57
|
+
function h(t) {
|
|
58
|
+
return t === "alphaadmin.burdenoff.com" || e.some((e) => t === `alphaapp.${e}`);
|
|
59
|
+
}
|
|
60
|
+
function g(e) {
|
|
61
|
+
try {
|
|
62
|
+
return new URL(e.globalBase).hostname === "alphagraphql.burdenoff.com" && new URL(e.workspaceBase).hostname === "alphagraphqlworkspaces.burdenoff.com";
|
|
63
|
+
} catch {
|
|
64
|
+
return !1;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
function _() {
|
|
68
|
+
try {
|
|
69
|
+
return globalThis.sessionStorage ?? null;
|
|
70
|
+
} catch {
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
function v(e, t) {
|
|
75
|
+
let n = e.getItem(c), r = n ? Number(n) : 0;
|
|
76
|
+
return Number.isFinite(r) && t - r < l;
|
|
77
|
+
}
|
|
78
|
+
function y() {
|
|
79
|
+
try {
|
|
80
|
+
let e = new URL(window.location.href || window.location.origin);
|
|
81
|
+
return e.hash = "", e.toString();
|
|
82
|
+
} catch {
|
|
83
|
+
return window.location.origin;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
function b() {
|
|
87
|
+
return window.location.hash ? !0 : u.has(window.location.pathname);
|
|
88
|
+
}
|
|
89
|
+
function x(e) {
|
|
90
|
+
if (typeof window > "u" || !g(e) || !h(window.location.hostname.toLowerCase()) || b()) return;
|
|
91
|
+
let t = _();
|
|
92
|
+
if (!t) return;
|
|
93
|
+
let n = Date.now();
|
|
94
|
+
if (v(t, n)) return;
|
|
95
|
+
try {
|
|
96
|
+
t.setItem(c, String(n));
|
|
97
|
+
} catch {
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
let r = y(), i = new URL(s);
|
|
101
|
+
i.searchParams.set("returnTo", r), window.location.replace(i.toString());
|
|
102
|
+
}
|
|
103
|
+
function S(e) {
|
|
40
104
|
return typeof e.query == "string" ? /\bquery\b/.test(e.query) && !/\bmutation\b|\bsubscription\b/.test(e.query) : !1;
|
|
41
105
|
}
|
|
42
|
-
function
|
|
106
|
+
function C(e) {
|
|
43
107
|
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;
|
|
44
108
|
}
|
|
45
|
-
function
|
|
46
|
-
return Object.fromEntries(
|
|
109
|
+
function w(e) {
|
|
110
|
+
return Object.fromEntries(f.map((t) => [t, e.get(t) ?? ""]));
|
|
47
111
|
}
|
|
48
|
-
function
|
|
49
|
-
let n =
|
|
50
|
-
return !n || !
|
|
112
|
+
function T(e, t) {
|
|
113
|
+
let n = C(t);
|
|
114
|
+
return !n || !S(t) ? null : JSON.stringify({
|
|
51
115
|
url: e.url,
|
|
52
|
-
headers:
|
|
116
|
+
headers: w(e.headers),
|
|
53
117
|
operationName: n,
|
|
54
118
|
variables: t.variables ?? null
|
|
55
119
|
});
|
|
56
120
|
}
|
|
57
|
-
function
|
|
121
|
+
function E(e) {
|
|
58
122
|
try {
|
|
59
123
|
let t = JSON.parse(e);
|
|
60
124
|
return Array.isArray(t) ? t : t && typeof t == "object" ? [t] : null;
|
|
@@ -62,60 +126,45 @@ function m(e) {
|
|
|
62
126
|
return null;
|
|
63
127
|
}
|
|
64
128
|
}
|
|
65
|
-
function
|
|
129
|
+
function D(e, t) {
|
|
66
130
|
return new Response(JSON.stringify(t ? e : e[0]), {
|
|
67
131
|
status: 200,
|
|
68
132
|
headers: { "content-type": "application/json" }
|
|
69
133
|
});
|
|
70
134
|
}
|
|
71
|
-
function
|
|
135
|
+
function O() {
|
|
72
136
|
return typeof performance < "u" && performance.now() < o;
|
|
73
137
|
}
|
|
74
|
-
function
|
|
138
|
+
function k(e) {
|
|
75
139
|
let t = new Headers(e.headers), n = !1;
|
|
76
|
-
for (let e of
|
|
140
|
+
for (let e of d) t.has(e) && (t.delete(e), n = !0);
|
|
77
141
|
return n ? new Request(e, { headers: t }) : e;
|
|
78
142
|
}
|
|
79
|
-
function
|
|
143
|
+
function A(e, t) {
|
|
80
144
|
let n = window.location.hostname.toLowerCase(), a = [...r, ...e ?? []];
|
|
81
145
|
for (let e of a) if (n === e.hostname) return e.bases;
|
|
82
146
|
return t ?? i;
|
|
83
147
|
}
|
|
84
|
-
function
|
|
85
|
-
if (!n || !r) return e;
|
|
86
|
-
let i;
|
|
87
|
-
try {
|
|
88
|
-
i = new URL(e.url).origin;
|
|
89
|
-
} catch {
|
|
90
|
-
return e;
|
|
91
|
-
}
|
|
92
|
-
if (!t.has(i)) return e;
|
|
93
|
-
let a = new Headers(e.headers);
|
|
94
|
-
return a.set("CF-Access-Client-Id", n), a.set("CF-Access-Client-Secret", r), new Request(e, { headers: a });
|
|
95
|
-
}
|
|
96
|
-
function b(e, t) {
|
|
148
|
+
function j(e, t) {
|
|
97
149
|
let { globalBase: n, workspaceBase: r } = e;
|
|
98
150
|
if (!n || !r) return;
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
let t = new URL(e, window.location.origin), i = x(t.pathname);
|
|
105
|
-
return i === "/global/graphql" && v.has(t.origin) ? `${n}${i}${t.search}${t.hash}` : i === "/workspaces/graphql" && b.has(t.origin) ? `${r}${i}${t.search}${t.hash}` : e;
|
|
106
|
-
}, C = async (e) => {
|
|
151
|
+
x(e);
|
|
152
|
+
let i = globalThis.fetch.bind(globalThis), o = window.location.origin, s = new Set([o, "https://gw-global.local.burdenoff.com"]), c = new Set([o, "https://gw-wspace.local.burdenoff.com"]), l = (e) => /(?:^|\/)global\/graphql$/.test(e) ? "/global/graphql" : /(?:^|\/)workspaces\/graphql$/.test(e) ? "/workspaces/graphql" : "", u = (e) => {
|
|
153
|
+
let t = new URL(e, window.location.origin), i = l(t.pathname);
|
|
154
|
+
return i === "/global/graphql" && s.has(t.origin) ? `${n}${i}${t.search}${t.hash}` : i === "/workspaces/graphql" && c.has(t.origin) ? `${r}${i}${t.search}${t.hash}` : e;
|
|
155
|
+
}, d = async (e) => {
|
|
107
156
|
if (!(e.method.toUpperCase() === "POST" && /(?:^|\/)graphql$/.test(new URL(e.url).pathname))) return i(e);
|
|
108
|
-
let t = await e.clone().text(), n =
|
|
157
|
+
let t = await e.clone().text(), n = k(e.clone()), r = E(t);
|
|
109
158
|
if (!r?.length) return i(e);
|
|
110
|
-
let o = t.trimStart().startsWith("["), s = r.map((e) =>
|
|
111
|
-
if (
|
|
112
|
-
let e =
|
|
113
|
-
if (t.every((e) => e && e.expiresAt > n)) return
|
|
159
|
+
let o = t.trimStart().startsWith("["), s = r.map((e) => T(n, e));
|
|
160
|
+
if (O() && s.every(Boolean)) {
|
|
161
|
+
let e = p(), t = s.map((t) => e.get(t)), n = Date.now();
|
|
162
|
+
if (t.every((e) => e && e.expiresAt > n)) return D(t.map((e) => e.value), o);
|
|
114
163
|
}
|
|
115
164
|
let c = await i(e);
|
|
116
|
-
if (!c.ok || !s.some(Boolean) || !
|
|
165
|
+
if (!c.ok || !s.some(Boolean) || !O()) return c;
|
|
117
166
|
try {
|
|
118
|
-
let e = await c.clone().json(), t = Array.isArray(e) ? e : [e], n =
|
|
167
|
+
let e = await c.clone().json(), t = Array.isArray(e) ? e : [e], n = p();
|
|
119
168
|
t.forEach((e, t) => {
|
|
120
169
|
let r = s[t];
|
|
121
170
|
r && (e && typeof e == "object" && "errors" in e && Array.isArray(e.errors) || n.set(r, {
|
|
@@ -125,18 +174,18 @@ function b(e, t) {
|
|
|
125
174
|
});
|
|
126
175
|
} catch {}
|
|
127
176
|
return c;
|
|
128
|
-
},
|
|
177
|
+
}, f = i, m = ((e, t) => {
|
|
129
178
|
if (e == null) return i(e, t);
|
|
130
179
|
if (e instanceof Request) {
|
|
131
|
-
let n =
|
|
132
|
-
return
|
|
180
|
+
let n = u(e.url), r = new Request(n, e);
|
|
181
|
+
return d(t ? new Request(r, t) : r);
|
|
133
182
|
}
|
|
134
183
|
let n = typeof e == "string" ? e : e.toString();
|
|
135
|
-
return
|
|
184
|
+
return d(new Request(u(n), t));
|
|
136
185
|
});
|
|
137
|
-
|
|
186
|
+
f.preconnect && (m.preconnect = f.preconnect), globalThis.fetch = m;
|
|
138
187
|
}
|
|
139
|
-
function
|
|
188
|
+
function M(e = "VITE_VERBOSE_CONSOLE") {
|
|
140
189
|
({
|
|
141
190
|
BASE_URL: "/",
|
|
142
191
|
DEV: !1,
|
|
@@ -146,4 +195,4 @@ function x(e = "VITE_VERBOSE_CONSOLE") {
|
|
|
146
195
|
})?.[e] !== "true" && (console.log = () => {}, console.info = () => {}, console.debug = () => {});
|
|
147
196
|
}
|
|
148
197
|
//#endregion
|
|
149
|
-
export {
|
|
198
|
+
export { m as clearGatewayGraphQLResponseCache, j as installGatewayFetchRewrite, A as resolveGatewayBases, M as suppressConsole };
|