@burdenoff/fe-libs 2026.1119.3 → 2026.1119.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.
- package/dist/shared/graphql/client.js +155 -151
- package/package.json +1 -1
|
@@ -9,37 +9,37 @@ import { dispatchBackendErrorEvent as v, markConnectionHealthy as y } from "../u
|
|
|
9
9
|
import { onError as ee } from "@apollo/client/link/error";
|
|
10
10
|
import { RetryLink as b } from "@apollo/client/link/retry";
|
|
11
11
|
import { setContext as x } from "@apollo/client/link/context";
|
|
12
|
-
import { ApolloClient as S, ApolloLink as C, InMemoryCache as te, Observable as w, from as T, split as
|
|
13
|
-
import { getMainDefinition as
|
|
14
|
-
import { print as
|
|
12
|
+
import { ApolloClient as S, ApolloLink as C, InMemoryCache as te, Observable as w, from as T, split as ne } from "@apollo/client/core";
|
|
13
|
+
import { getMainDefinition as E } from "@apollo/client/utilities";
|
|
14
|
+
import { print as D } from "graphql";
|
|
15
15
|
// src/shared/graphql/client.ts
|
|
16
|
-
var
|
|
16
|
+
var O = {
|
|
17
17
|
consecutiveFailures: 0,
|
|
18
18
|
lastFailureTime: 0,
|
|
19
19
|
isOpen: !1,
|
|
20
20
|
openCount: 0,
|
|
21
21
|
nextRetryTime: 0
|
|
22
|
-
},
|
|
23
|
-
function
|
|
24
|
-
if (
|
|
25
|
-
|
|
26
|
-
let e = Math.min(
|
|
27
|
-
|
|
22
|
+
}, k = 20, A = 5e3, j = 3e4;
|
|
23
|
+
function re() {
|
|
24
|
+
if (O.consecutiveFailures++, O.lastFailureTime = Date.now(), !O.isOpen && O.consecutiveFailures >= k) {
|
|
25
|
+
O.isOpen = !0, O.openCount++;
|
|
26
|
+
let e = Math.min(A * 2 ** (O.openCount - 1), j);
|
|
27
|
+
O.nextRetryTime = Date.now() + e;
|
|
28
28
|
}
|
|
29
|
-
return
|
|
29
|
+
return O.isOpen;
|
|
30
30
|
}
|
|
31
|
-
function
|
|
32
|
-
|
|
31
|
+
function M() {
|
|
32
|
+
O.consecutiveFailures = 0, O.isOpen = !1, O.openCount = 0, O.nextRetryTime = 0, y();
|
|
33
33
|
}
|
|
34
|
-
function
|
|
35
|
-
return !(!
|
|
34
|
+
function N() {
|
|
35
|
+
return !(!O.isOpen || Date.now() >= O.nextRetryTime);
|
|
36
36
|
}
|
|
37
|
-
function
|
|
37
|
+
function P(e, t, n) {
|
|
38
38
|
if (n || !e || h(e)) return !1;
|
|
39
39
|
let r = e.message?.toLowerCase?.() ?? "";
|
|
40
40
|
return !(r.includes("401") || r.includes("403") || r.includes("unauthorized") || r.includes("forbidden") || r.includes("unauthenticated") || !c(t));
|
|
41
41
|
}
|
|
42
|
-
function
|
|
42
|
+
function ie({ maxAttempts: e, delay: t }) {
|
|
43
43
|
return new b({
|
|
44
44
|
delay: t ?? {
|
|
45
45
|
initial: 1e3,
|
|
@@ -48,87 +48,90 @@ function re({ maxAttempts: e, delay: t }) {
|
|
|
48
48
|
},
|
|
49
49
|
attempts: {
|
|
50
50
|
max: e,
|
|
51
|
-
retryIf: (e, t) =>
|
|
51
|
+
retryIf: (e, t) => P(e, t, N())
|
|
52
52
|
}
|
|
53
53
|
});
|
|
54
54
|
}
|
|
55
|
-
var
|
|
56
|
-
function
|
|
55
|
+
var F = /(?:\b40[13]\b|status code 40[13]|unauthori[sz]ed|unauthenticated|forbidden|invalid email or password)/i;
|
|
56
|
+
function I(e) {
|
|
57
57
|
return typeof e == "number" && Number.isInteger(e) ? e : typeof e == "string" && /^\d{3}$/.test(e) ? Number(e) : null;
|
|
58
58
|
}
|
|
59
|
-
function
|
|
59
|
+
function ae(e) {
|
|
60
60
|
let t = /* @__PURE__ */ new Set(), n = (e, r) => {
|
|
61
61
|
if (r > 3 || e == null || t.has(e)) return !1;
|
|
62
|
-
if (typeof e == "string") return
|
|
62
|
+
if (typeof e == "string") return F.test(e);
|
|
63
63
|
if (typeof e != "object") return !1;
|
|
64
64
|
t.add(e);
|
|
65
|
-
let i = e, a =
|
|
65
|
+
let i = e, a = I(i.status) ?? I(i.statusCode) ?? I(i.response?.status);
|
|
66
66
|
if (a === 401 || a === 403) return !0;
|
|
67
67
|
let o = i.message;
|
|
68
|
-
return typeof o == "string" &&
|
|
68
|
+
return typeof o == "string" && F.test(o) ? !0 : n(i.cause, r + 1);
|
|
69
69
|
};
|
|
70
70
|
return n(e, 0);
|
|
71
71
|
}
|
|
72
|
-
function
|
|
72
|
+
function oe(e) {
|
|
73
73
|
if (!e || typeof e != "object") return null;
|
|
74
74
|
let t = e, n = t.workspaceId || t.input?.workspaceId;
|
|
75
75
|
return typeof n == "string" && n.trim() ? n : null;
|
|
76
76
|
}
|
|
77
|
-
function
|
|
77
|
+
function se(e) {
|
|
78
78
|
let t = e.workspaceDecision;
|
|
79
79
|
return t && typeof t == "object" ? t : null;
|
|
80
80
|
}
|
|
81
|
-
function
|
|
81
|
+
function ce(e) {
|
|
82
82
|
if (!e || typeof e != "object") return null;
|
|
83
83
|
let t = e.projectId;
|
|
84
84
|
return typeof t == "string" && t.trim() ? t : null;
|
|
85
85
|
}
|
|
86
|
-
function
|
|
87
|
-
let t =
|
|
86
|
+
function L({ query: e }) {
|
|
87
|
+
let t = E(e);
|
|
88
88
|
return t.kind === "OperationDefinition" && t.operation === "subscription";
|
|
89
89
|
}
|
|
90
90
|
function le(e) {
|
|
91
|
-
|
|
92
|
-
return t.kind === "OperationDefinition" && t.operation === "mutation";
|
|
91
|
+
return e.getContext().suppressGlobalErrorEvent === !0;
|
|
93
92
|
}
|
|
94
93
|
function ue(e) {
|
|
94
|
+
let t = E(e);
|
|
95
|
+
return t.kind === "OperationDefinition" && t.operation === "mutation";
|
|
96
|
+
}
|
|
97
|
+
function de(e) {
|
|
95
98
|
let t = e.errors;
|
|
96
99
|
return Array.isArray(t) && t.length > 0;
|
|
97
100
|
}
|
|
98
|
-
function
|
|
101
|
+
function fe(e) {
|
|
99
102
|
let t = e.headers;
|
|
100
103
|
if (!t || typeof t != "object" || Array.isArray(t)) return {};
|
|
101
104
|
let n = {};
|
|
102
105
|
for (let [e, r] of Object.entries(t)) typeof r == "string" && (n[e] = r);
|
|
103
106
|
return n;
|
|
104
107
|
}
|
|
105
|
-
function
|
|
108
|
+
function R(e) {
|
|
106
109
|
let t = e.fetchOptions;
|
|
107
110
|
if (!t || typeof t != "object" || !("signal" in t)) return;
|
|
108
111
|
let n = t.signal;
|
|
109
112
|
return n instanceof AbortSignal ? n : void 0;
|
|
110
113
|
}
|
|
111
|
-
var
|
|
112
|
-
function
|
|
113
|
-
return
|
|
114
|
+
var z = "bypassFetchResponseCache", B = "sendUnbatched", V = /* @__PURE__ */ new Set(["network-only", "no-cache"]);
|
|
115
|
+
function H(e, t) {
|
|
116
|
+
return V.has(e.fetchPolicy ?? t) ? {
|
|
114
117
|
...e,
|
|
115
118
|
context: {
|
|
116
119
|
...e.context,
|
|
117
|
-
[
|
|
120
|
+
[z]: !0
|
|
118
121
|
}
|
|
119
122
|
} : e;
|
|
120
123
|
}
|
|
121
124
|
var pe = class extends S {
|
|
122
125
|
constructor(e) {
|
|
123
|
-
super(e),
|
|
126
|
+
super(e), U(this);
|
|
124
127
|
}
|
|
125
128
|
};
|
|
126
|
-
function
|
|
129
|
+
function U(e) {
|
|
127
130
|
let t = e.query;
|
|
128
|
-
e.query = (n) => t(
|
|
131
|
+
e.query = (n) => t(H(n, e.defaultOptions.query?.fetchPolicy));
|
|
129
132
|
let n = e.watchQuery;
|
|
130
133
|
e.watchQuery = (t) => {
|
|
131
|
-
let r = n(
|
|
134
|
+
let r = n(H(t, e.defaultOptions.watchQuery?.fetchPolicy)), i = E(t.query).name?.value;
|
|
132
135
|
if (i) {
|
|
133
136
|
let e = r.refetch.bind(r);
|
|
134
137
|
r.refetch = (t) => (a(i), e(t));
|
|
@@ -138,7 +141,7 @@ function H(e) {
|
|
|
138
141
|
}
|
|
139
142
|
function me({ uri: e, batchMax: t, batchInterval: n }) {
|
|
140
143
|
return new C((i) => new w((a) => {
|
|
141
|
-
let o = i.getContext(), s = { query:
|
|
144
|
+
let o = i.getContext(), s = { query: D(i.query) };
|
|
142
145
|
i.operationName && (s.operationName = i.operationName);
|
|
143
146
|
let c = i.variables ?? {}, l = i.extensions ?? {};
|
|
144
147
|
Object.keys(c).length > 0 && (s.variables = c), Object.keys(l).length > 0 && (s.extensions = l);
|
|
@@ -146,8 +149,8 @@ function me({ uri: e, batchMax: t, batchInterval: n }) {
|
|
|
146
149
|
return r(e, {
|
|
147
150
|
"content-type": "application/json",
|
|
148
151
|
"Apollo-Require-Preflight": "true",
|
|
149
|
-
...
|
|
150
|
-
}, s,
|
|
152
|
+
...fe(o)
|
|
153
|
+
}, s, R(o), {
|
|
151
154
|
batchMax: o.sendUnbatched === !0 ? 1 : t,
|
|
152
155
|
batchInterval: n,
|
|
153
156
|
...o.bypassFetchResponseCache === !0 ? { responseCache: "reload" } : {}
|
|
@@ -160,89 +163,89 @@ function me({ uri: e, batchMax: t, batchInterval: n }) {
|
|
|
160
163
|
};
|
|
161
164
|
}));
|
|
162
165
|
}
|
|
163
|
-
function
|
|
164
|
-
let { gateway: a, baseUrl: c, authToken: y, workspaceToken: b, locale: S, geography:
|
|
165
|
-
workspaceId: (typeof
|
|
166
|
-
organizationId: (typeof
|
|
167
|
-
tenantId: (typeof
|
|
168
|
-
projectId: (typeof
|
|
166
|
+
function W(r) {
|
|
167
|
+
let { gateway: a, baseUrl: c, authToken: y, workspaceToken: b, locale: S, geography: D, organizationId: k, productId: A, productSlug: j, workspaceId: P, projectId: F, tenantId: I, cache: fe, enableSubscriptions: R = !1, sseUrl: z, onAuthError: B, onRefreshToken: V, onNetworkError: H, onNetworkStatusChange: U, onMutationSuccess: W, maxRetryAttempts: G = 3, batchMax: K = 10, batchInterval: he, debug: q = !1 } = r, J = g(r.workspaceOperationGuard), Y = null, ge = null, X = () => ({
|
|
168
|
+
workspaceId: (typeof P == "function" ? P() : P) || null,
|
|
169
|
+
organizationId: (typeof k == "function" ? k() : k) || null,
|
|
170
|
+
tenantId: (typeof I == "function" ? I() : I) || null,
|
|
171
|
+
projectId: (typeof F == "function" ? F() : F) || null
|
|
169
172
|
}), _e = (e) => {
|
|
170
173
|
ge ||= setTimeout(() => {
|
|
171
|
-
ge = null,
|
|
172
|
-
|
|
174
|
+
ge = null, Y && _(Y, J, () => X().workspaceId).catch((t) => {
|
|
175
|
+
q && console.warn("[GraphQL] Active query refresh failed after mutation:", {
|
|
173
176
|
gateway: a,
|
|
174
177
|
operationName: e,
|
|
175
178
|
error: t
|
|
176
179
|
});
|
|
177
180
|
});
|
|
178
181
|
}, 0);
|
|
179
|
-
},
|
|
180
|
-
uri:
|
|
181
|
-
batchMax:
|
|
182
|
+
}, Z = e[a], ve = l(t(c, a)), ye = me({
|
|
183
|
+
uri: ve,
|
|
184
|
+
batchMax: K,
|
|
182
185
|
batchInterval: he
|
|
183
|
-
}),
|
|
186
|
+
}), be = x((e, t) => {
|
|
184
187
|
let n = t.headers ?? {}, r = typeof y == "function" ? y() : y;
|
|
185
188
|
return { headers: {
|
|
186
189
|
...n,
|
|
187
190
|
...r ? { authorization: `Bearer ${r}` } : {}
|
|
188
191
|
} };
|
|
189
|
-
}),
|
|
192
|
+
}), xe = x((e, t) => {
|
|
190
193
|
let n = t.headers ?? {}, r = typeof S == "function" ? S() : S;
|
|
191
194
|
return { headers: {
|
|
192
195
|
...n,
|
|
193
196
|
...r ? { "accept-language": r } : {}
|
|
194
197
|
} };
|
|
195
|
-
}),
|
|
196
|
-
let n = t.headers ?? {}, r = typeof
|
|
198
|
+
}), Se = x((e, t) => {
|
|
199
|
+
let n = t.headers ?? {}, r = typeof D == "function" ? D() : null;
|
|
197
200
|
return { headers: {
|
|
198
201
|
...n,
|
|
199
202
|
...r?.country ? { "x-geo-country": r.country } : {},
|
|
200
203
|
...r?.currency ? { "x-geo-currency": r.currency } : {},
|
|
201
204
|
...r?.timezone ? { "x-geo-timezone": r.timezone } : {}
|
|
202
205
|
} };
|
|
203
|
-
}),
|
|
204
|
-
let n = t.headers ?? {}, r = typeof
|
|
206
|
+
}), Ce = x((e, t) => {
|
|
207
|
+
let n = t.headers ?? {}, r = typeof k == "function" ? k() : k;
|
|
205
208
|
return { headers: {
|
|
206
209
|
...n,
|
|
207
210
|
...r ? { "x-org-id": r } : {}
|
|
208
211
|
} };
|
|
209
|
-
}),
|
|
210
|
-
let n = t.headers ?? {}, r = typeof
|
|
212
|
+
}), we = x((e, t) => {
|
|
213
|
+
let n = t.headers ?? {}, r = typeof A == "function" ? A() : A, i = typeof j == "function" ? j() : j;
|
|
211
214
|
return { headers: {
|
|
212
215
|
...n,
|
|
213
216
|
...r ? { "x-product-id": r } : {},
|
|
214
217
|
...i ? { "x-product-slug": i } : {}
|
|
215
218
|
} };
|
|
216
|
-
}),
|
|
217
|
-
let n = t.headers ?? {}, r =
|
|
219
|
+
}), Te = x((e, t) => {
|
|
220
|
+
let n = t.headers ?? {}, r = se(t), i = (r ? r.workspaceId : typeof P == "function" ? P() : P) || oe(e.variables);
|
|
218
221
|
return { headers: {
|
|
219
222
|
...n,
|
|
220
223
|
...i ? { "x-workspace-id": i } : {}
|
|
221
224
|
} };
|
|
222
|
-
}),
|
|
223
|
-
let n = t.headers ?? {}, r =
|
|
225
|
+
}), Ee = x((e, t) => {
|
|
226
|
+
let n = t.headers ?? {}, r = se(t), i = (r ? r.projectId : typeof F == "function" ? F() : F) || ce(e.variables);
|
|
224
227
|
return { headers: {
|
|
225
228
|
...n,
|
|
226
229
|
...i ? { "x-project-id": i } : {}
|
|
227
230
|
} };
|
|
228
|
-
}),
|
|
229
|
-
let n = t.headers ?? {}, r = typeof
|
|
231
|
+
}), De = x((e, t) => {
|
|
232
|
+
let n = t.headers ?? {}, r = typeof I == "function" ? I() : I;
|
|
230
233
|
return { headers: {
|
|
231
234
|
...n,
|
|
232
235
|
...r ? { "x-tenant-id": r } : {}
|
|
233
236
|
} };
|
|
234
|
-
}),
|
|
235
|
-
if (a !== "workspace" ||
|
|
237
|
+
}), Oe = (e, t, n) => {
|
|
238
|
+
if (a !== "workspace" || J === "off") return;
|
|
236
239
|
let r = m(e, t, n);
|
|
237
240
|
if (r) {
|
|
238
|
-
if (
|
|
241
|
+
if (J === "enforce") throw new p(r);
|
|
239
242
|
typeof window < "u" && window.dispatchEvent(new CustomEvent(d, { detail: r }));
|
|
240
243
|
}
|
|
241
|
-
},
|
|
244
|
+
}, ke = x(async (e, n) => {
|
|
242
245
|
let r = n.headers ?? {}, o = n.requiredWorkspaceAuth === !0, s = !o && n.preferWorkspaceAuth === !0;
|
|
243
246
|
if (a === "global" && !o && !s) return { headers: r };
|
|
244
|
-
let c = typeof y == "function" ? y() : y, l = typeof b == "function" ? b() : b, d =
|
|
245
|
-
|
|
247
|
+
let c = typeof y == "function" ? y() : y, l = typeof b == "function" ? b() : b, d = X(), { workspaceId: f, organizationId: p, tenantId: m, projectId: h } = d;
|
|
248
|
+
Oe(e, f, "before-send");
|
|
246
249
|
let g = !1, _ = u(l, {
|
|
247
250
|
workspaceId: f,
|
|
248
251
|
organizationId: p,
|
|
@@ -256,7 +259,7 @@ function U(r) {
|
|
|
256
259
|
if (n) {
|
|
257
260
|
g = !0;
|
|
258
261
|
let r = await Promise.race([i({
|
|
259
|
-
url: a === "workspace" ?
|
|
262
|
+
url: a === "workspace" ? ve : t(void 0, "workspace"),
|
|
260
263
|
authToken: n,
|
|
261
264
|
workspaceId: f ?? void 0,
|
|
262
265
|
organizationId: p ?? void 0,
|
|
@@ -273,12 +276,12 @@ function U(r) {
|
|
|
273
276
|
} catch {}
|
|
274
277
|
if (o) {
|
|
275
278
|
if (!_) throw Error("Workspace authentication is unavailable; retry the request");
|
|
276
|
-
let e =
|
|
279
|
+
let e = X();
|
|
277
280
|
if (c !== (typeof y == "function" ? y() : y) || e.workspaceId !== f || e.organizationId !== p || e.projectId !== h || e.tenantId !== m) throw Error("The active workspace changed; retry the request");
|
|
278
281
|
}
|
|
279
282
|
if (g) {
|
|
280
|
-
let t =
|
|
281
|
-
t !== f &&
|
|
283
|
+
let t = X().workspaceId;
|
|
284
|
+
t !== f && Oe(e, t, "after-token-mint");
|
|
282
285
|
}
|
|
283
286
|
return {
|
|
284
287
|
headers: {
|
|
@@ -287,18 +290,18 @@ function U(r) {
|
|
|
287
290
|
},
|
|
288
291
|
workspaceDecision: d
|
|
289
292
|
};
|
|
290
|
-
}),
|
|
291
|
-
if (
|
|
292
|
-
|
|
293
|
-
let t = Math.max(0, Math.ceil((
|
|
294
|
-
return
|
|
293
|
+
}), Ae = ie({ maxAttempts: G }), je = new C((e, t) => {
|
|
294
|
+
if (N()) {
|
|
295
|
+
q && console.warn("[CircuitBreaker] Circuit is open, blocking request:", e.operationName);
|
|
296
|
+
let t = Math.max(0, Math.ceil((O.nextRetryTime - Date.now()) / 1e3)), n = /* @__PURE__ */ Error(`Network circuit breaker is open — backend appears unreachable. Retrying in ${t} seconds.`);
|
|
297
|
+
return H?.(n), new w((e) => {
|
|
295
298
|
e.error(n);
|
|
296
299
|
});
|
|
297
300
|
}
|
|
298
301
|
return new w((n) => {
|
|
299
302
|
let r = t(e).subscribe({
|
|
300
303
|
next: (e) => {
|
|
301
|
-
|
|
304
|
+
M(), O.consecutiveFailures === 0 && U?.(!1), n.next(e);
|
|
302
305
|
},
|
|
303
306
|
error: (e) => {
|
|
304
307
|
n.error(e);
|
|
@@ -311,9 +314,9 @@ function U(r) {
|
|
|
311
314
|
r.unsubscribe();
|
|
312
315
|
};
|
|
313
316
|
});
|
|
314
|
-
}),
|
|
317
|
+
}), Q = !1, $ = [];
|
|
315
318
|
function Me(e) {
|
|
316
|
-
|
|
319
|
+
$.forEach(({ resolve: t }) => t(e)), $ = [];
|
|
317
320
|
}
|
|
318
321
|
let Ne = (e) => {
|
|
319
322
|
h(e) && e.detail?.operationKind === "mutation" && typeof window < "u" && window.dispatchEvent(new CustomEvent(f, { detail: e.detail }));
|
|
@@ -327,19 +330,19 @@ function U(r) {
|
|
|
327
330
|
let a = null, o = !1, s = () => {
|
|
328
331
|
o || (a = Pe(e, t, i));
|
|
329
332
|
}, c = () => {
|
|
330
|
-
|
|
333
|
+
B?.(), o || i.error(n);
|
|
331
334
|
};
|
|
332
335
|
return (async () => {
|
|
333
|
-
if (
|
|
334
|
-
|
|
336
|
+
if (Q) await new Promise((e) => {
|
|
337
|
+
$.push({ resolve: e });
|
|
335
338
|
}) ? s() : c();
|
|
336
339
|
else {
|
|
337
|
-
|
|
340
|
+
Q = !0;
|
|
338
341
|
try {
|
|
339
342
|
let e = await r();
|
|
340
|
-
|
|
343
|
+
Q = !1, Me(e), e ? s() : c();
|
|
341
344
|
} catch {
|
|
342
|
-
|
|
345
|
+
Q = !1, Me(!1), c();
|
|
343
346
|
}
|
|
344
347
|
}
|
|
345
348
|
})(), () => {
|
|
@@ -350,57 +353,58 @@ function U(r) {
|
|
|
350
353
|
Ne(e);
|
|
351
354
|
return;
|
|
352
355
|
}
|
|
353
|
-
let r = e.errors;
|
|
354
|
-
if (
|
|
355
|
-
let
|
|
356
|
-
for (let e of
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
356
|
+
let r = L(t), i = r || le(t), a = e.errors;
|
|
357
|
+
if (a) {
|
|
358
|
+
let o = a.some((e) => e.extensions?.code === "UNAUTHENTICATED" || e.message.includes("Unauthorized") || e.message.includes("Unauthenticated"));
|
|
359
|
+
for (let e of a) q && console.error("[GraphQL Error]:", e.message);
|
|
360
|
+
r ? console.warn("[GraphQL] Subscription returned errors:", {
|
|
361
|
+
operationName: t.operationName,
|
|
362
|
+
errors: a
|
|
363
|
+
}) : !(o && V) && !i && v({ errors: a }, { operationName: t.operationName });
|
|
364
|
+
let s = /* @__PURE__ */ new Set(["STORAGE_QUOTA_EXCEEDED", "RESOURCE_CAP_EXCEEDED"]);
|
|
365
|
+
for (let e of a) {
|
|
360
366
|
let t = e.extensions?.code;
|
|
361
|
-
if (t &&
|
|
367
|
+
if (t && s.has(t) && typeof window < "u") {
|
|
362
368
|
window.dispatchEvent(new CustomEvent("burdenoff:upgrade-prompt", { detail: { extensions: e.extensions } }));
|
|
363
369
|
break;
|
|
364
370
|
}
|
|
365
371
|
}
|
|
366
|
-
if (
|
|
367
|
-
|
|
372
|
+
if (o && V) return Fe(t, n, e, V);
|
|
373
|
+
o && B?.(), M();
|
|
368
374
|
} else {
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
if (ie(e)) {
|
|
373
|
-
N(), r ? console.warn("[GraphQL] Subscription refused by the gateway:", {
|
|
375
|
+
if (q && console.error("[Network Error]:", e), r && s(e) && e.status === 401 && V) return M(), Fe(t, n, e, V);
|
|
376
|
+
if (ae(e)) {
|
|
377
|
+
M(), r ? console.warn("[GraphQL] Subscription refused by the gateway:", {
|
|
374
378
|
operationName: t.operationName,
|
|
375
379
|
error: e
|
|
376
|
-
}) : e instanceof Error && v(e, {
|
|
380
|
+
}) : e instanceof Error && !i && v(e, {
|
|
377
381
|
operationName: t.operationName,
|
|
378
382
|
fallbackMessage: "Your session is no longer valid. Please sign in again."
|
|
379
383
|
});
|
|
380
384
|
return;
|
|
381
385
|
}
|
|
382
|
-
|
|
383
|
-
let
|
|
384
|
-
|
|
386
|
+
re() && U?.(!0);
|
|
387
|
+
let a = e instanceof Error ? e : Error(String(e));
|
|
388
|
+
H?.(a), r ? console.warn("[GraphQL] Subscription stream failed:", {
|
|
385
389
|
operationName: t.operationName,
|
|
386
|
-
error:
|
|
387
|
-
}) : v(
|
|
390
|
+
error: a
|
|
391
|
+
}) : i || v(a, {
|
|
388
392
|
operationName: t.operationName,
|
|
389
393
|
fallbackMessage: "We could not reach the server. Please check your connection and try again."
|
|
390
394
|
});
|
|
391
395
|
}
|
|
392
396
|
}), Le = new C((e, t) => {
|
|
393
|
-
let r =
|
|
397
|
+
let r = ue(e.query), i = r && e.getContext().autoRefreshAfterMutation !== !1 && e.getContext().skipMutationAutoRefresh !== !0;
|
|
394
398
|
return new w((o) => {
|
|
395
399
|
let s = t(e).subscribe({
|
|
396
400
|
next: (t) => {
|
|
397
|
-
if (r && n(), o.next(t),
|
|
401
|
+
if (r && n(), o.next(t), de(t) || !i) return;
|
|
398
402
|
let s = e.operationName || "anonymous mutation";
|
|
399
|
-
|
|
403
|
+
W ? Promise.resolve(W({
|
|
400
404
|
gateway: a,
|
|
401
405
|
operationName: s
|
|
402
406
|
})).catch((e) => {
|
|
403
|
-
|
|
407
|
+
q && console.warn("[GraphQL] Mutation refresh callback failed:", {
|
|
404
408
|
gateway: a,
|
|
405
409
|
operationName: s,
|
|
406
410
|
error: e
|
|
@@ -420,52 +424,52 @@ function U(r) {
|
|
|
420
424
|
});
|
|
421
425
|
}), Re = new C((e) => new w((t) => {
|
|
422
426
|
t.error(/* @__PURE__ */ Error(`[graphql] Refusing to send subscription "${e.operationName ?? "anonymous"}" over the batched HTTP transport — this gateway client was created without enableSubscriptions/SSE. Enable subscriptions on this client so it routes over SSE.`));
|
|
423
|
-
})), ze =
|
|
424
|
-
|
|
427
|
+
})), ze = ne(L, Re, ye), Be = T([
|
|
428
|
+
Ae,
|
|
425
429
|
je,
|
|
426
430
|
Ie,
|
|
427
431
|
Le,
|
|
428
|
-
|
|
429
|
-
|
|
432
|
+
be,
|
|
433
|
+
ke,
|
|
434
|
+
Ce,
|
|
430
435
|
we,
|
|
431
436
|
Te,
|
|
432
437
|
Ee,
|
|
433
438
|
De,
|
|
434
|
-
|
|
439
|
+
xe,
|
|
435
440
|
Se,
|
|
436
|
-
Ce,
|
|
437
441
|
ze
|
|
438
442
|
]);
|
|
439
|
-
if (
|
|
440
|
-
let e =
|
|
443
|
+
if (R) {
|
|
444
|
+
let e = Z.sse, t = z || (e ? l(c || Z.defaultBaseUrl) + e : void 0);
|
|
441
445
|
if (t) {
|
|
442
446
|
let e = new o({
|
|
443
447
|
url: t,
|
|
444
448
|
headers: {},
|
|
445
|
-
debug:
|
|
446
|
-
}), n =
|
|
447
|
-
let t =
|
|
449
|
+
debug: q
|
|
450
|
+
}), n = ne(({ query: e }) => {
|
|
451
|
+
let t = E(e);
|
|
448
452
|
return t.kind === "OperationDefinition" && t.operation === "subscription";
|
|
449
|
-
}, e,
|
|
450
|
-
|
|
451
|
-
|
|
453
|
+
}, e, ye);
|
|
454
|
+
Be = T([
|
|
455
|
+
Ae,
|
|
452
456
|
je,
|
|
453
457
|
Ie,
|
|
454
458
|
Le,
|
|
455
|
-
|
|
456
|
-
|
|
459
|
+
be,
|
|
460
|
+
ke,
|
|
461
|
+
Ce,
|
|
457
462
|
we,
|
|
458
463
|
Te,
|
|
459
464
|
Ee,
|
|
460
465
|
De,
|
|
461
|
-
|
|
466
|
+
xe,
|
|
462
467
|
Se,
|
|
463
|
-
Ce,
|
|
464
468
|
n
|
|
465
469
|
]);
|
|
466
470
|
}
|
|
467
471
|
}
|
|
468
|
-
let
|
|
472
|
+
let Ve = new te({ typePolicies: {
|
|
469
473
|
File: { keyFields: ["id"] },
|
|
470
474
|
Folder: { keyFields: ["id"] },
|
|
471
475
|
Tag: { keyFields: ["id"] },
|
|
@@ -500,9 +504,9 @@ function U(r) {
|
|
|
500
504
|
VibecontrolsAgent: { keyFields: ["id"] },
|
|
501
505
|
Query: { fields: { vibes: { keyArgs: ["filter"] } } }
|
|
502
506
|
} });
|
|
503
|
-
return
|
|
504
|
-
link:
|
|
505
|
-
cache:
|
|
507
|
+
return Y = new pe({
|
|
508
|
+
link: Be,
|
|
509
|
+
cache: fe ?? Ve,
|
|
506
510
|
defaultOptions: {
|
|
507
511
|
watchQuery: {
|
|
508
512
|
fetchPolicy: "cache-and-network",
|
|
@@ -514,19 +518,19 @@ function U(r) {
|
|
|
514
518
|
},
|
|
515
519
|
mutate: { errorPolicy: "all" }
|
|
516
520
|
}
|
|
517
|
-
}),
|
|
521
|
+
}), Y;
|
|
518
522
|
}
|
|
519
|
-
var
|
|
523
|
+
var G = null, K = null;
|
|
520
524
|
function he(e) {
|
|
521
525
|
let { workspaceBaseUrl: t, globalBaseUrl: n, authToken: r, enableSubscriptions: i = !1, onAuthError: a, debug: o = !1 } = e;
|
|
522
|
-
|
|
526
|
+
G = W({
|
|
523
527
|
gateway: "workspace",
|
|
524
528
|
baseUrl: t,
|
|
525
529
|
authToken: r,
|
|
526
530
|
enableSubscriptions: i,
|
|
527
531
|
onAuthError: a,
|
|
528
532
|
debug: o
|
|
529
|
-
}),
|
|
533
|
+
}), K = W({
|
|
530
534
|
gateway: "global",
|
|
531
535
|
baseUrl: n,
|
|
532
536
|
authToken: r,
|
|
@@ -534,15 +538,15 @@ function he(e) {
|
|
|
534
538
|
debug: o
|
|
535
539
|
});
|
|
536
540
|
}
|
|
537
|
-
function K() {
|
|
538
|
-
if (!W) throw Error("Workspace client not initialized. Call initializeAppClients first.");
|
|
539
|
-
return W;
|
|
540
|
-
}
|
|
541
541
|
function q() {
|
|
542
|
-
if (!G) throw Error("
|
|
542
|
+
if (!G) throw Error("Workspace client not initialized. Call initializeAppClients first.");
|
|
543
543
|
return G;
|
|
544
544
|
}
|
|
545
545
|
function J() {
|
|
546
|
-
|
|
546
|
+
if (!K) throw Error("Global client not initialized. Call initializeAppClients first.");
|
|
547
|
+
return K;
|
|
548
|
+
}
|
|
549
|
+
function Y() {
|
|
550
|
+
G &&= (G.clearStore(), null), K &&= (K.clearStore(), null);
|
|
547
551
|
}
|
|
548
|
-
export {
|
|
552
|
+
export { z as BYPASS_FETCH_RESPONSE_CACHE_CONTEXT_KEY, B as SEND_UNBATCHED_CONTEXT_KEY, W as createGraphQLClient, ie as createRetryLink, J as getGlobalClient, q as getWorkspaceClient, he as initializeAppClients, U as installFetchPolicyAwareEntryPoints, ae as isAuthProtocolError, Y as resetAppClients, P as shouldRetryOperationError };
|