@burdenoff/fe-libs 2026.530.4 → 2026.530.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.
- 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 +61 -43
- package/dist/shared/graphql/fetch.d.ts +7 -0
- package/dist/shared/graphql/fetch.d.ts.map +1 -1
- package/dist/shared/graphql/fetch.js +112 -100
- package/dist/shared/graphql/index.d.ts +1 -1
- package/dist/shared/graphql/index.d.ts.map +1 -1
- package/dist/shared/providers/shell/AuthTokenProvider.d.ts.map +1 -1
- package/dist/shared/providers/shell/AuthTokenProvider.js +46 -40
- package/dist/shared/providers/shell/MultiGatewayProvider.d.ts +1 -1
- package/dist/shared/providers/shell/MultiGatewayProvider.d.ts.map +1 -1
- package/dist/shared/providers/shell/MultiGatewayProvider.js +37 -26
- package/dist/shared/providers/shell/ProfileI18nBridge.d.ts.map +1 -1
- package/dist/shared/providers/shell/ProfileI18nBridge.js +1 -0
- package/dist/shared/types/index.d.ts +4 -0
- package/dist/shared/types/index.d.ts.map +1 -1
- package/dist/shared/utils/backendErrors.d.ts.map +1 -1
- package/dist/shared/utils/backendErrors.js +30 -30
- package/dist/shared-graphql.js +8 -8
- package/dist/shared.js +96 -96
- package/package.json +1 -1
|
@@ -78,126 +78,132 @@ function C() {
|
|
|
78
78
|
return a("tenant");
|
|
79
79
|
}
|
|
80
80
|
function w() {
|
|
81
|
+
return a("project");
|
|
82
|
+
}
|
|
83
|
+
function T() {
|
|
81
84
|
try {
|
|
82
85
|
return typeof window > "u" ? null : new URLSearchParams(window.location.search).get("org");
|
|
83
86
|
} catch {
|
|
84
87
|
return null;
|
|
85
88
|
}
|
|
86
89
|
}
|
|
87
|
-
function
|
|
90
|
+
function E(e) {
|
|
88
91
|
return {
|
|
89
92
|
workspaceId: typeof e.workspaceId == "string" ? e.workspaceId : x() || void 0,
|
|
90
|
-
organizationId: typeof e.organizationId == "string" ? e.organizationId : S() ||
|
|
91
|
-
tenantId: typeof e.tenantId == "string" ? e.tenantId : C() || void 0
|
|
93
|
+
organizationId: typeof e.organizationId == "string" ? e.organizationId : S() || T() || void 0,
|
|
94
|
+
tenantId: typeof e.tenantId == "string" ? e.tenantId : C() || void 0,
|
|
95
|
+
projectId: typeof e.projectId == "string" ? e.projectId : w() || void 0
|
|
92
96
|
};
|
|
93
97
|
}
|
|
94
|
-
function
|
|
98
|
+
function D(e, t, n) {
|
|
95
99
|
try {
|
|
96
100
|
let a = r() ?? g();
|
|
97
101
|
if (!a) return;
|
|
98
102
|
i(a, t), sessionStorage.setItem("burdenoff-active-context-workspace", e), n && sessionStorage.setItem("burdenoff-active-context-organization", n);
|
|
99
103
|
} catch {}
|
|
100
104
|
}
|
|
101
|
-
async function
|
|
102
|
-
let { url: t, authToken: n, workspaceId: r, organizationId: i,
|
|
103
|
-
if (!n ||
|
|
104
|
-
let
|
|
105
|
-
if (!
|
|
106
|
-
let
|
|
107
|
-
if (
|
|
108
|
-
workspaceId:
|
|
109
|
-
organizationId:
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
105
|
+
async function O(e) {
|
|
106
|
+
let { url: t, authToken: n, workspaceId: r, organizationId: i, projectId: a, locale: o, signal: s, currentQuery: c } = e;
|
|
107
|
+
if (!n || c.includes("issueWorkspaceToken")) return null;
|
|
108
|
+
let l = r || x();
|
|
109
|
+
if (!l) return null;
|
|
110
|
+
let d = h(), m = x(), g = i || S() || T();
|
|
111
|
+
if (d && m === l && u(d, {
|
|
112
|
+
workspaceId: l,
|
|
113
|
+
organizationId: g,
|
|
114
|
+
projectId: a
|
|
115
|
+
})) return d;
|
|
116
|
+
if (!g) return null;
|
|
117
|
+
let _ = `${g}:${l}:${a ?? ""}`, v = p.get(_);
|
|
118
|
+
if (v) return v;
|
|
119
|
+
let y = fetch(t, {
|
|
115
120
|
method: "POST",
|
|
116
121
|
headers: {
|
|
117
122
|
"Content-Type": "application/json",
|
|
118
123
|
Authorization: `Bearer ${n}`,
|
|
119
|
-
...
|
|
124
|
+
...o ? { "Accept-Language": o } : {}
|
|
120
125
|
},
|
|
121
126
|
body: JSON.stringify({
|
|
122
127
|
query: f,
|
|
123
128
|
variables: { input: {
|
|
124
|
-
organizationId:
|
|
125
|
-
workspaceId:
|
|
129
|
+
organizationId: g,
|
|
130
|
+
workspaceId: l,
|
|
131
|
+
...a ? { projectId: a } : {}
|
|
126
132
|
} }
|
|
127
133
|
}),
|
|
128
|
-
signal:
|
|
134
|
+
signal: s
|
|
129
135
|
}).then(async (e) => {
|
|
130
136
|
let t = (await e.json()).data?.issueWorkspaceToken;
|
|
131
|
-
return t?.success && t.token ? (
|
|
137
|
+
return t?.success && t.token ? (D(t.workspaceId || l, t.token, g), t.token) : null;
|
|
132
138
|
}).catch(() => null).finally(() => {
|
|
133
|
-
p.delete(
|
|
139
|
+
p.delete(_);
|
|
134
140
|
});
|
|
135
|
-
return p.set(
|
|
141
|
+
return p.set(_, y), y;
|
|
136
142
|
}
|
|
137
|
-
function
|
|
143
|
+
function k(e, n) {
|
|
138
144
|
let r = t[e], i = n || r.defaultBaseUrl;
|
|
139
145
|
return `${i.endsWith("/") ? i.slice(0, -1) : i}${r.graphql}`;
|
|
140
146
|
}
|
|
141
|
-
function
|
|
147
|
+
function A() {
|
|
142
148
|
return globalThis;
|
|
143
149
|
}
|
|
144
|
-
function
|
|
145
|
-
let e =
|
|
150
|
+
function j() {
|
|
151
|
+
let e = A();
|
|
146
152
|
return e.__graphqlFetchQueues ||= /* @__PURE__ */ new Map(), e.__graphqlFetchQueues;
|
|
147
153
|
}
|
|
148
|
-
function
|
|
149
|
-
let e =
|
|
154
|
+
function M() {
|
|
155
|
+
let e = A();
|
|
150
156
|
return e.__graphqlFetchResponseCache ||= /* @__PURE__ */ new Map(), e.__graphqlFetchResponseCache;
|
|
151
157
|
}
|
|
152
|
-
function
|
|
153
|
-
let e =
|
|
158
|
+
function N() {
|
|
159
|
+
let e = A();
|
|
154
160
|
return e.__graphqlFetchPendingResponses ||= /* @__PURE__ */ new Map(), e.__graphqlFetchPendingResponses;
|
|
155
161
|
}
|
|
156
|
-
var
|
|
162
|
+
var P = 10, F = 2500, I = 100, L = 1e4, R = 15e3, z = new Set([
|
|
157
163
|
"traceparent",
|
|
158
164
|
"tracestate",
|
|
159
165
|
"baggage"
|
|
160
166
|
]);
|
|
161
|
-
function
|
|
162
|
-
if (typeof performance > "u") return
|
|
163
|
-
let e =
|
|
164
|
-
return e.__graphqlFetchBurstStartedAt ??= performance.now(), performance.now() - e.__graphqlFetchBurstStartedAt <
|
|
167
|
+
function B() {
|
|
168
|
+
if (typeof performance > "u") return I;
|
|
169
|
+
let e = A();
|
|
170
|
+
return e.__graphqlFetchBurstStartedAt ??= performance.now(), performance.now() - e.__graphqlFetchBurstStartedAt < L ? F : I;
|
|
165
171
|
}
|
|
166
|
-
function
|
|
172
|
+
function V(e) {
|
|
167
173
|
return typeof e.query == "string" ? /^\s*query\b/.test(e.query) : !1;
|
|
168
174
|
}
|
|
169
|
-
function
|
|
175
|
+
function H(e) {
|
|
170
176
|
return typeof e.operationName == "string" && e.operationName.length > 0 ? {
|
|
171
177
|
operationName: e.operationName,
|
|
172
178
|
variables: e.variables ?? null
|
|
173
179
|
} : e;
|
|
174
180
|
}
|
|
175
|
-
function
|
|
181
|
+
function U(e) {
|
|
176
182
|
let t = /* @__PURE__ */ new Map();
|
|
177
183
|
for (let [n, r] of Object.entries(e)) {
|
|
178
184
|
let e = n.toLowerCase();
|
|
179
|
-
|
|
185
|
+
z.has(e) || t.set(e, r);
|
|
180
186
|
}
|
|
181
187
|
return Object.fromEntries(Array.from(t.entries()).sort(([e], [t]) => e.localeCompare(t)));
|
|
182
188
|
}
|
|
183
|
-
function
|
|
189
|
+
function W(t) {
|
|
184
190
|
let n = e();
|
|
185
191
|
return {
|
|
186
192
|
...t,
|
|
187
193
|
traceparent: n.traceparent
|
|
188
194
|
};
|
|
189
195
|
}
|
|
190
|
-
function W(e) {
|
|
191
|
-
return K(e) && Array.isArray(e.errors);
|
|
192
|
-
}
|
|
193
196
|
function G(e) {
|
|
197
|
+
return q(e) && Array.isArray(e.errors);
|
|
198
|
+
}
|
|
199
|
+
function K(e) {
|
|
194
200
|
let t = e.status;
|
|
195
201
|
return t === 401 ? "Invalid email or password." : t === 403 ? "You do not have permission to do that." : t === 404 ? "We could not find what you were looking for." : t === 408 || t === 504 ? "The server took too long to respond. Please try again." : t === 429 ? "Too many requests. Please wait a moment and try again." : t >= 500 && t < 600 ? "The server is having trouble right now. Please try again in a moment." : t >= 400 && t < 500 ? "The request could not be processed. Please refresh and try again." : "We could not reach the server. Please check your connection and try again.";
|
|
196
202
|
}
|
|
197
|
-
function
|
|
203
|
+
function q(e) {
|
|
198
204
|
return typeof e == "object" && !!e && !Array.isArray(e);
|
|
199
205
|
}
|
|
200
|
-
async function
|
|
206
|
+
async function J(e) {
|
|
201
207
|
let t = await e.text();
|
|
202
208
|
if (!t) return null;
|
|
203
209
|
try {
|
|
@@ -206,21 +212,21 @@ async function q(e) {
|
|
|
206
212
|
return t;
|
|
207
213
|
}
|
|
208
214
|
}
|
|
209
|
-
async function
|
|
215
|
+
async function Y(e, t, n) {
|
|
210
216
|
if (n.length === 1) {
|
|
211
217
|
let r = n[0];
|
|
212
218
|
try {
|
|
213
219
|
let n = await fetch(e, {
|
|
214
220
|
method: "POST",
|
|
215
|
-
headers:
|
|
221
|
+
headers: W(t),
|
|
216
222
|
credentials: "include",
|
|
217
223
|
body: JSON.stringify(r.body),
|
|
218
224
|
signal: r.signal
|
|
219
|
-
}), i = await
|
|
220
|
-
if (!n.ok && !
|
|
221
|
-
r.cacheKey &&
|
|
225
|
+
}), i = await J(n);
|
|
226
|
+
if (!n.ok && !G(i)) throw Error(K(n));
|
|
227
|
+
r.cacheKey && M().set(r.cacheKey, {
|
|
222
228
|
value: i,
|
|
223
|
-
expiresAt: Date.now() +
|
|
229
|
+
expiresAt: Date.now() + R
|
|
224
230
|
}), r.resolve(i);
|
|
225
231
|
} catch (e) {
|
|
226
232
|
r.reject(e);
|
|
@@ -231,41 +237,41 @@ async function J(e, t, n) {
|
|
|
231
237
|
try {
|
|
232
238
|
let i = await fetch(e, {
|
|
233
239
|
method: "POST",
|
|
234
|
-
headers:
|
|
240
|
+
headers: W(t),
|
|
235
241
|
credentials: "include",
|
|
236
242
|
body: JSON.stringify(r)
|
|
237
|
-
}), a = await
|
|
238
|
-
if (!i.ok && !
|
|
243
|
+
}), a = await J(i);
|
|
244
|
+
if (!i.ok && !G(a)) throw Error(K(i));
|
|
239
245
|
Array.isArray(a) ? a.forEach((e, t) => {
|
|
240
246
|
let r = n[t];
|
|
241
|
-
r && (r.cacheKey &&
|
|
247
|
+
r && (r.cacheKey && M().set(r.cacheKey, {
|
|
242
248
|
value: e,
|
|
243
|
-
expiresAt: Date.now() +
|
|
249
|
+
expiresAt: Date.now() + R
|
|
244
250
|
}), r.resolve(e));
|
|
245
251
|
}) : n.forEach((e) => {
|
|
246
|
-
e.cacheKey &&
|
|
252
|
+
e.cacheKey && M().set(e.cacheKey, {
|
|
247
253
|
value: a,
|
|
248
|
-
expiresAt: Date.now() +
|
|
254
|
+
expiresAt: Date.now() + R
|
|
249
255
|
}), e.resolve(a);
|
|
250
256
|
});
|
|
251
257
|
} catch (e) {
|
|
252
258
|
n.forEach((t) => t.reject(e));
|
|
253
259
|
}
|
|
254
260
|
}
|
|
255
|
-
function
|
|
256
|
-
let a =
|
|
261
|
+
function X(e, t, n, r, i) {
|
|
262
|
+
let a = U(t), o = Math.max(1, i?.batchMax ?? P), s = Math.max(0, i?.batchInterval ?? B()), c = `${e}|${JSON.stringify(a)}`, l = V(n) ? `${c}|${JSON.stringify(H(n))}` : void 0;
|
|
257
263
|
if (l) {
|
|
258
|
-
let e =
|
|
264
|
+
let e = M(), t = e.get(l);
|
|
259
265
|
if (t) {
|
|
260
266
|
if (t.expiresAt > Date.now()) return Promise.resolve(t.value);
|
|
261
267
|
e.delete(l);
|
|
262
268
|
}
|
|
263
|
-
let n =
|
|
269
|
+
let n = N().get(l);
|
|
264
270
|
if (n) return n;
|
|
265
271
|
}
|
|
266
272
|
let u = new Promise((t, i) => {
|
|
267
273
|
if (o <= 1) {
|
|
268
|
-
|
|
274
|
+
Y(e, a, [{
|
|
269
275
|
body: n,
|
|
270
276
|
resolve: t,
|
|
271
277
|
reject: i,
|
|
@@ -274,7 +280,7 @@ function Y(e, t, n, r, i) {
|
|
|
274
280
|
}]);
|
|
275
281
|
return;
|
|
276
282
|
}
|
|
277
|
-
let u =
|
|
283
|
+
let u = j(), d = u.get(c);
|
|
278
284
|
if (d || (d = {
|
|
279
285
|
requests: [],
|
|
280
286
|
timer: null,
|
|
@@ -287,57 +293,63 @@ function Y(e, t, n, r, i) {
|
|
|
287
293
|
signal: r,
|
|
288
294
|
cacheKey: l
|
|
289
295
|
}), d.requests.length >= d.batchMax) {
|
|
290
|
-
|
|
296
|
+
Z(e, a, c);
|
|
291
297
|
return;
|
|
292
298
|
}
|
|
293
|
-
d.timer ||= setTimeout(() =>
|
|
299
|
+
d.timer ||= setTimeout(() => Z(e, a, c), d.batchInterval);
|
|
294
300
|
});
|
|
295
|
-
return l && (
|
|
296
|
-
|
|
301
|
+
return l && (N().set(l, u), u.finally(() => {
|
|
302
|
+
N().delete(l);
|
|
297
303
|
}).catch(() => {})), u;
|
|
298
304
|
}
|
|
299
|
-
function
|
|
300
|
-
let r =
|
|
301
|
-
i && (r.delete(n), i.timer &&= (clearTimeout(i.timer), null),
|
|
305
|
+
function Z(e, t, n) {
|
|
306
|
+
let r = j(), i = r.get(n);
|
|
307
|
+
i && (r.delete(n), i.timer &&= (clearTimeout(i.timer), null), Y(e, t, i.requests));
|
|
302
308
|
}
|
|
303
|
-
async function
|
|
304
|
-
let { gateway: t, query: n, variables: r, operationName: i, authToken: a, workspaceToken: o, workspaceId: c, organizationId: f, tenantId: p,
|
|
309
|
+
async function Q(e) {
|
|
310
|
+
let { gateway: t, query: n, variables: r, operationName: i, authToken: a, workspaceToken: o, workspaceId: c, organizationId: f, tenantId: p, projectId: g, locale: _, baseUrl: x, extraHeaders: S, signal: w } = e, T = l(k(t, x)), D = a && !v(a) ? a : m(), A = _ ?? b(), j = E({
|
|
305
311
|
workspaceId: c,
|
|
306
312
|
organizationId: f,
|
|
307
|
-
tenantId: p
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
313
|
+
tenantId: p,
|
|
314
|
+
projectId: g
|
|
315
|
+
}), M = { "Content-Type": "application/json" };
|
|
316
|
+
D && (M.Authorization = `Bearer ${D}`), A && (M["Accept-Language"] = A);
|
|
317
|
+
let N = y();
|
|
318
|
+
if (N?.country && (M["X-Geo-Country"] = N.country), N?.currency && (M["X-Geo-Currency"] = N.currency), N?.timezone && (M["X-Geo-Timezone"] = N.timezone), t === "workspace" ? o !== !1 : o) {
|
|
312
319
|
let e = typeof o == "string" ? o : h();
|
|
313
|
-
e && !u(e,
|
|
314
|
-
url:
|
|
315
|
-
authToken:
|
|
316
|
-
workspaceId:
|
|
317
|
-
organizationId:
|
|
318
|
-
|
|
319
|
-
|
|
320
|
+
e && !u(e, j) && (e = null), !e && o === !0 && /^\s*mutation\b/.test(n) && (e = await O({
|
|
321
|
+
url: T,
|
|
322
|
+
authToken: D,
|
|
323
|
+
workspaceId: j.workspaceId,
|
|
324
|
+
organizationId: j.organizationId,
|
|
325
|
+
projectId: j.projectId,
|
|
326
|
+
locale: A,
|
|
327
|
+
signal: w,
|
|
320
328
|
currentQuery: n
|
|
321
|
-
})), e && (
|
|
329
|
+
})), e && (M["X-Workspace-Authorization"] = `Bearer ${e}`);
|
|
322
330
|
}
|
|
323
331
|
if (t === "workspace" || c) {
|
|
324
|
-
let e =
|
|
325
|
-
e && (
|
|
332
|
+
let e = j.workspaceId;
|
|
333
|
+
e && (M["x-workspace-id"] = e);
|
|
326
334
|
}
|
|
327
335
|
if (t === "global" || f) {
|
|
328
|
-
let e =
|
|
329
|
-
e && (
|
|
336
|
+
let e = j.organizationId;
|
|
337
|
+
e && (M["x-org-id"] = e);
|
|
330
338
|
}
|
|
331
339
|
if (p) {
|
|
332
340
|
let e = typeof p == "string" ? p : C();
|
|
333
|
-
e && (
|
|
341
|
+
e && (M["x-tenant-id"] = e);
|
|
342
|
+
}
|
|
343
|
+
if (t === "workspace" || g) {
|
|
344
|
+
let e = j.projectId;
|
|
345
|
+
e && (M["x-project-id"] = e);
|
|
334
346
|
}
|
|
335
|
-
let
|
|
336
|
-
|
|
337
|
-
let
|
|
338
|
-
r && (
|
|
347
|
+
let P = s(S);
|
|
348
|
+
P && Object.assign(M, P);
|
|
349
|
+
let F = { query: n };
|
|
350
|
+
r && (F.variables = r), i && (F.operationName = i);
|
|
339
351
|
try {
|
|
340
|
-
let e = await
|
|
352
|
+
let e = await X(T, M, F, w);
|
|
341
353
|
return e.errors?.length && d({ errors: e.errors }, { operationName: i }), e;
|
|
342
354
|
} catch (e) {
|
|
343
355
|
throw d(e, {
|
|
@@ -347,4 +359,4 @@ async function Z(e) {
|
|
|
347
359
|
}
|
|
348
360
|
}
|
|
349
361
|
//#endregion
|
|
350
|
-
export {
|
|
362
|
+
export { X as enqueueGraphQLFetch, m as getStoredAuthToken, b as getStoredLocale, S as getStoredOrganizationId, w as getStoredProjectId, x as getStoredWorkspaceId, h as getStoredWorkspaceToken, Q as graphqlFetch, k as resolveGatewayUrl };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { createGraphQLClient, initializeAppClients, getWorkspaceClient, getGlobalClient, resetAppClients, type CreateClientOptions, type AppClientConfig, type Gateway, } from './client';
|
|
2
2
|
export { GatewayProvider, useGateway, useGatewayClient, useSafeGateway, useSafeGatewayClient, type GatewayContextValue, type GatewayProviderProps, } from './GatewayContext';
|
|
3
|
-
export { graphqlFetch, getStoredAuthToken, getStoredWorkspaceToken, getStoredWorkspaceId, getStoredLocale, getStoredOrganizationId, resolveGatewayUrl, type GraphQLFetchOptions, type GraphQLResponse, } from './fetch';
|
|
3
|
+
export { graphqlFetch, getStoredAuthToken, getStoredWorkspaceToken, getStoredWorkspaceId, getStoredLocale, getStoredOrganizationId, getStoredProjectId, resolveGatewayUrl, type GraphQLFetchOptions, type GraphQLResponse, } from './fetch';
|
|
4
4
|
export { getWorkspaceTokenPayload, isWorkspaceTokenValidForContext, type WorkspaceTokenContext, type WorkspaceTokenPayload, } from './workspaceToken';
|
|
5
5
|
export { SSELink, type SSELinkOptions } from './links/sse-link';
|
|
6
6
|
export { WsLink, type WsLinkOptions } from './links/ws-link';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/shared/graphql/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,mBAAmB,EACnB,oBAAoB,EACpB,kBAAkB,EAClB,eAAe,EACf,eAAe,EACf,KAAK,mBAAmB,EACxB,KAAK,eAAe,EACpB,KAAK,OAAO,GACb,MAAM,UAAU,CAAC;AAGlB,OAAO,EACL,eAAe,EACf,UAAU,EACV,gBAAgB,EAChB,cAAc,EACd,oBAAoB,EACpB,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,GAC1B,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EACL,YAAY,EACZ,kBAAkB,EAClB,uBAAuB,EACvB,oBAAoB,EACpB,eAAe,EACf,uBAAuB,EACvB,iBAAiB,EACjB,KAAK,mBAAmB,EACxB,KAAK,eAAe,GACrB,MAAM,SAAS,CAAC;AAEjB,OAAO,EACL,wBAAwB,EACxB,+BAA+B,EAC/B,KAAK,qBAAqB,EAC1B,KAAK,qBAAqB,GAC3B,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EAAE,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAChE,OAAO,EAAE,MAAM,EAAE,KAAK,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAI7D,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,KAAK,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAE9F,OAAO,EACL,cAAc,EACd,QAAQ,EACR,WAAW,EACX,YAAY,EACZ,eAAe,EACf,eAAe,GAChB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,GAAG,EAAE,MAAM,qBAAqB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/shared/graphql/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,mBAAmB,EACnB,oBAAoB,EACpB,kBAAkB,EAClB,eAAe,EACf,eAAe,EACf,KAAK,mBAAmB,EACxB,KAAK,eAAe,EACpB,KAAK,OAAO,GACb,MAAM,UAAU,CAAC;AAGlB,OAAO,EACL,eAAe,EACf,UAAU,EACV,gBAAgB,EAChB,cAAc,EACd,oBAAoB,EACpB,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,GAC1B,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EACL,YAAY,EACZ,kBAAkB,EAClB,uBAAuB,EACvB,oBAAoB,EACpB,eAAe,EACf,uBAAuB,EACvB,kBAAkB,EAClB,iBAAiB,EACjB,KAAK,mBAAmB,EACxB,KAAK,eAAe,GACrB,MAAM,SAAS,CAAC;AAEjB,OAAO,EACL,wBAAwB,EACxB,+BAA+B,EAC/B,KAAK,qBAAqB,EAC1B,KAAK,qBAAqB,GAC3B,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EAAE,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAChE,OAAO,EAAE,MAAM,EAAE,KAAK,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAI7D,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,KAAK,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAE9F,OAAO,EACL,cAAc,EACd,QAAQ,EACR,WAAW,EACX,YAAY,EACZ,eAAe,EACf,eAAe,GAChB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,GAAG,EAAE,MAAM,qBAAqB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AuthTokenProvider.d.ts","sourceRoot":"","sources":["../../../../src/shared/providers/shell/AuthTokenProvider.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAKL,KAAK,SAAS,
|
|
1
|
+
{"version":3,"file":"AuthTokenProvider.d.ts","sourceRoot":"","sources":["../../../../src/shared/providers/shell/AuthTokenProvider.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAKL,KAAK,SAAS,EAKf,MAAM,OAAO,CAAC;AAef,MAAM,WAAW,qBAAqB;IACpC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,cAAc,EAAE,MAAM,MAAM,GAAG,IAAI,CAAC;IACpC,iBAAiB,EAAE,MAAM,MAAM,GAAG,IAAI,CAAC;IACvC,qBAAqB,EAAE,MAAM,MAAM,GAAG,IAAI,CAAC;IAC3C,iBAAiB,EAAE,MAAM,IAAI,CAAC;IAC9B,eAAe,EAAE,OAAO,CAAC;IACzB,iBAAiB,EAAE,OAAO,CAAC;CAC5B;AAID,MAAM,WAAW,sBAAsB;IACrC,QAAQ,EAAE,SAAS,CAAC;IACpB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,aAAa,CAAC,EAAE,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,EAAE,cAAc,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;IACpF,iBAAiB,CAAC,EAAE,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;CAC1D;AA4GD,wBAAgB,iBAAiB,CAAC,EAChC,QAAQ,EACR,KAAa,EACb,aAAa,EACb,iBAAiB,GAClB,EAAE,sBAAsB,2CAoGxB;AAED,wBAAgB,YAAY,IAAI,qBAAqB,CAMpD"}
|
|
@@ -1,46 +1,46 @@
|
|
|
1
1
|
import { getProfileWorkspaceToken as e, resolveActiveProfileId as t } from "./ProfileStorageManager.js";
|
|
2
2
|
import { readActiveContextValueWithUrlPrecedence as n } from "./ActiveContextStorage.js";
|
|
3
3
|
import { isWorkspaceTokenValidForContext as r } from "../../graphql/workspaceToken.js";
|
|
4
|
-
import { createContext as i, use as a, useCallback as o, useEffect as s,
|
|
5
|
-
import { jsx as
|
|
4
|
+
import { createContext as i, use as a, useCallback as o, useEffect as s, useEffectEvent as c, useMemo as l, useRef as u, useState as d } from "react";
|
|
5
|
+
import { jsx as f } from "react/jsx-runtime";
|
|
6
6
|
//#region src/shared/providers/shell/AuthTokenProvider.tsx
|
|
7
|
-
var
|
|
8
|
-
function
|
|
7
|
+
var p = "bf-p", m = "bf-active-profile", h = i(null);
|
|
8
|
+
function g(e) {
|
|
9
9
|
try {
|
|
10
|
-
let t = localStorage.getItem(`${
|
|
10
|
+
let t = localStorage.getItem(`${p}-${e}-tokens`);
|
|
11
11
|
return t ? JSON.parse(t) : null;
|
|
12
12
|
} catch {
|
|
13
13
|
return null;
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
|
-
function
|
|
16
|
+
function _(t) {
|
|
17
17
|
return e(t);
|
|
18
18
|
}
|
|
19
|
-
function
|
|
19
|
+
function v(e) {
|
|
20
20
|
try {
|
|
21
|
-
let t = localStorage.getItem(`${
|
|
21
|
+
let t = localStorage.getItem(`${p}-${e}-auth-storage`);
|
|
22
22
|
return t ? JSON.parse(t) : null;
|
|
23
23
|
} catch {
|
|
24
24
|
return null;
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
|
-
function
|
|
27
|
+
function y(e) {
|
|
28
28
|
try {
|
|
29
|
-
let t = localStorage.getItem(`${
|
|
29
|
+
let t = localStorage.getItem(`${p}-${e}-user`);
|
|
30
30
|
return t ? JSON.parse(t) : null;
|
|
31
31
|
} catch {
|
|
32
32
|
return null;
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
|
-
function
|
|
35
|
+
function b(e) {
|
|
36
36
|
try {
|
|
37
|
-
let t = localStorage.getItem(`${
|
|
37
|
+
let t = localStorage.getItem(`${p}-${e}-context`);
|
|
38
38
|
return t ? JSON.parse(t) : null;
|
|
39
39
|
} catch {
|
|
40
40
|
return null;
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
|
-
function
|
|
43
|
+
function x() {
|
|
44
44
|
let e = t();
|
|
45
45
|
if (!e) return {
|
|
46
46
|
accessToken: null,
|
|
@@ -49,9 +49,11 @@ function b() {
|
|
|
49
49
|
userId: null,
|
|
50
50
|
isAuthenticated: !1
|
|
51
51
|
};
|
|
52
|
-
let i =
|
|
52
|
+
let i = g(e), a = v(e), o = _(e) ?? a?.state?.workspaceToken ?? null, s = y(e), c = b(e), l = n("workspace") ?? c?.workspaceId ?? a?.state?.currentWorkspaceId ?? null, u = r(o, {
|
|
53
53
|
workspaceId: l,
|
|
54
|
-
organizationId: n("organization")
|
|
54
|
+
organizationId: n("organization") ?? c?.organizationId ?? null,
|
|
55
|
+
tenantId: n("tenant") ?? c?.tenantId ?? null,
|
|
56
|
+
projectId: n("project") ?? c?.projectId ?? null
|
|
55
57
|
}) ? o : null;
|
|
56
58
|
return {
|
|
57
59
|
accessToken: i?.accessToken ?? a?.state?.accessToken ?? null,
|
|
@@ -61,30 +63,34 @@ function b() {
|
|
|
61
63
|
isAuthenticated: !!(i?.accessToken ?? a?.state?.accessToken) && !!(s?.id ?? a?.state?.user?.id)
|
|
62
64
|
};
|
|
63
65
|
}
|
|
64
|
-
function
|
|
65
|
-
let [i, a] =
|
|
66
|
+
function S({ children: e, debug: t = !1, onTokenChange: n, onWorkspaceChange: r }) {
|
|
67
|
+
let [i, a] = d(x), g = u(i.accessToken), _ = u(i.workspaceToken);
|
|
66
68
|
s(() => {
|
|
67
|
-
|
|
69
|
+
g.current = i.accessToken, _.current = i.workspaceToken;
|
|
68
70
|
}, [i.accessToken, i.workspaceToken]);
|
|
69
|
-
let
|
|
70
|
-
let e =
|
|
71
|
+
let v = o(() => {
|
|
72
|
+
let e = x();
|
|
71
73
|
a(e), t && console.log("[AuthTokenProvider] Reloaded from profile storage:", {
|
|
72
74
|
hasAccessToken: !!e.accessToken,
|
|
73
75
|
hasWorkspaceToken: !!e.workspaceToken,
|
|
74
76
|
userId: e.userId
|
|
75
77
|
});
|
|
76
|
-
}, [t])
|
|
78
|
+
}, [t]), y = c(() => {
|
|
79
|
+
t && console.log("[AuthTokenProvider] Detected same-tab profile storage change"), v();
|
|
80
|
+
});
|
|
77
81
|
s(() => {
|
|
78
82
|
let e = (e) => {
|
|
79
|
-
(e.key?.startsWith(
|
|
83
|
+
(e.key?.startsWith(p) || e.key === m) && v();
|
|
80
84
|
};
|
|
81
85
|
return window.addEventListener("storage", e), () => window.removeEventListener("storage", e);
|
|
82
|
-
}, [
|
|
86
|
+
}, [v]), s(() => {
|
|
83
87
|
let e = () => {
|
|
84
|
-
|
|
88
|
+
y();
|
|
89
|
+
};
|
|
90
|
+
return window.addEventListener("bf-profile-storage-change", e), window.addEventListener("burdenoff:organization-changed", e), window.addEventListener("burdenoff:workspace-changed", e), window.addEventListener("burdenoff:project-changed", e), () => {
|
|
91
|
+
window.removeEventListener("bf-profile-storage-change", e), window.removeEventListener("burdenoff:organization-changed", e), window.removeEventListener("burdenoff:workspace-changed", e), window.removeEventListener("burdenoff:project-changed", e);
|
|
85
92
|
};
|
|
86
|
-
|
|
87
|
-
}, [_, t]), s(() => {
|
|
93
|
+
}, []), s(() => {
|
|
88
94
|
n?.(i.accessToken, i.workspaceToken);
|
|
89
95
|
}, [
|
|
90
96
|
i.accessToken,
|
|
@@ -93,33 +99,33 @@ function x({ children: e, debug: t = !1, onTokenChange: n, onWorkspaceChange: r
|
|
|
93
99
|
]), s(() => {
|
|
94
100
|
r?.(i.workspaceId);
|
|
95
101
|
}, [i.workspaceId, r]);
|
|
96
|
-
let
|
|
102
|
+
let b = o(() => g.current, []), S = o(() => _.current, []), C = o(() => _.current || g.current, []), w = l(() => ({
|
|
97
103
|
accessToken: i.accessToken,
|
|
98
104
|
workspaceToken: i.workspaceToken,
|
|
99
105
|
workspaceId: i.workspaceId,
|
|
100
106
|
userId: i.userId,
|
|
101
|
-
getAccessToken:
|
|
102
|
-
getWorkspaceToken:
|
|
103
|
-
getWorkspaceAuthToken:
|
|
104
|
-
reloadFromStorage:
|
|
107
|
+
getAccessToken: b,
|
|
108
|
+
getWorkspaceToken: S,
|
|
109
|
+
getWorkspaceAuthToken: C,
|
|
110
|
+
reloadFromStorage: v,
|
|
105
111
|
isAuthenticated: i.isAuthenticated,
|
|
106
112
|
hasWorkspaceToken: !!i.workspaceToken
|
|
107
113
|
}), [
|
|
108
114
|
i,
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
115
|
+
b,
|
|
116
|
+
S,
|
|
117
|
+
C,
|
|
118
|
+
v
|
|
113
119
|
]);
|
|
114
|
-
return /* @__PURE__ */
|
|
115
|
-
value:
|
|
120
|
+
return /* @__PURE__ */ f(h.Provider, {
|
|
121
|
+
value: w,
|
|
116
122
|
children: e
|
|
117
123
|
});
|
|
118
124
|
}
|
|
119
|
-
function
|
|
120
|
-
let e = a(
|
|
125
|
+
function C() {
|
|
126
|
+
let e = a(h);
|
|
121
127
|
if (!e) throw Error("useAuthToken must be used within AuthTokenProvider");
|
|
122
128
|
return e;
|
|
123
129
|
}
|
|
124
130
|
//#endregion
|
|
125
|
-
export {
|
|
131
|
+
export { S as AuthTokenProvider, C as useAuthToken };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MultiGatewayProvider.d.ts","sourceRoot":"","sources":["../../../../src/shared/providers/shell/MultiGatewayProvider.tsx"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAA2C,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAGhF,OAAO,
|
|
1
|
+
{"version":3,"file":"MultiGatewayProvider.d.ts","sourceRoot":"","sources":["../../../../src/shared/providers/shell/MultiGatewayProvider.tsx"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAA2C,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAGhF,OAAO,EAAuB,KAAK,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAKzE,MAAM,WAAW,yBAAyB;IACxC,QAAQ,EAAE,SAAS,CAAC;IACpB,qCAAqC;IACrC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,kCAAkC;IAClC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,kEAAkE;IAClE,cAAc,CAAC,EAAE,MAAM,MAAM,GAAG,IAAI,CAAC;IACrC,qEAAqE;IACrE,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,2BAA2B;IAC3B,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,2BAA2B;IAC3B,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,gDAAgD;IAChD,WAAW,CAAC,EAAE,MAAM,IAAI,CAAC;IACzB,yCAAyC;IACzC,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IACxC,+CAA+C;IAC/C,cAAc,CAAC,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC;CACzC;AAED,wBAAgB,oBAAoB,CAAC,EACnC,QAAQ,EACR,gBAAgB,EAChB,aAAa,EACb,cAAc,EACd,cAA4B,EAC5B,KAAa,EACb,mBAA2B,EAC3B,WAAW,EACX,cAAc,EACd,cAAc,GACf,EAAE,yBAAyB,2CAyN3B"}
|