@burdenoff/fe-libs 2026.628.1 → 2026.629.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.
|
@@ -5,6 +5,7 @@ import { Gateway } from '../config';
|
|
|
5
5
|
* Useful for showing "backend offline" banners in the UI.
|
|
6
6
|
*/
|
|
7
7
|
export declare function isNetworkCircuitOpen(): boolean;
|
|
8
|
+
export declare function isAuthProtocolError(error: unknown): boolean;
|
|
8
9
|
export type { Gateway } from '../config';
|
|
9
10
|
export interface CreateClientOptions {
|
|
10
11
|
/** Gateway type: 'workspace' or 'global' */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/shared/graphql/client.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EAGZ,aAAa,EAId,MAAM,qBAAqB,CAAC;AAO7B,OAAO,EAAiB,KAAK,OAAO,EAAY,MAAM,WAAW,CAAC;AAqDlE;;;GAGG;AACH,wBAAgB,oBAAoB,IAAI,OAAO,CAE9C;AAkBD,YAAY,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,MAAM,WAAW,mBAAmB;IAClC,4CAA4C;IAC5C,OAAO,EAAE,OAAO,CAAC;IACjB,wEAAwE;IACxE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,mDAAmD;IACnD,SAAS,CAAC,EAAE,MAAM,GAAG,CAAC,MAAM,MAAM,GAAG,IAAI,CAAC,CAAC;IAC3C,8FAA8F;IAC9F,cAAc,CAAC,EAAE,MAAM,GAAG,CAAC,MAAM,MAAM,GAAG,IAAI,CAAC,CAAC;IAChD,gEAAgE;IAChE,MAAM,CAAC,EAAE,MAAM,GAAG,CAAC,MAAM,MAAM,GAAG,IAAI,CAAC,CAAC;IACxC,yEAAyE;IACzE,SAAS,CAAC,EAAE,MAAM;QAChB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,QAAQ,CAAC,EAAE,MAAM,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CAAC;IAC1E,8DAA8D;IAC9D,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,2BAA2B;IAC3B,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,OAAO,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;CACvB;AA8FD;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,mBAAmB,gBAkoB/D;AASD,MAAM,WAAW,eAAe;IAC9B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,GAAG,CAAC,MAAM,MAAM,GAAG,IAAI,CAAC,CAAC;IAC3C,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,WAAW,CAAC,EAAE,MAAM,IAAI,CAAC;IACzB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,eAAe,GAAG,IAAI,CA0BlE;AAED;;GAEG;AACH,wBAAgB,kBAAkB,IAAI,YAAY,CAKjD;AAED;;GAEG;AACH,wBAAgB,eAAe,IAAI,YAAY,CAK9C;AAED;;GAEG;AACH,wBAAgB,eAAe,IAAI,IAAI,CAStC"}
|
|
@@ -7,23 +7,40 @@ import { SSELink as c } from "./links/sse-link.js";
|
|
|
7
7
|
import { onError as l } from "@apollo/client/link/error";
|
|
8
8
|
import { RetryLink as u } from "@apollo/client/link/retry";
|
|
9
9
|
import { setContext as d } from "@apollo/client/link/context";
|
|
10
|
-
import { ApolloClient as ee, ApolloLink as f, InMemoryCache as te, Observable as p, from as
|
|
11
|
-
import { getMainDefinition as
|
|
12
|
-
import { print as
|
|
10
|
+
import { ApolloClient as ee, ApolloLink as f, InMemoryCache as te, Observable as p, from as m, split as ne } from "@apollo/client/core";
|
|
11
|
+
import { getMainDefinition as h } from "@apollo/client/utilities";
|
|
12
|
+
import { print as g } from "graphql";
|
|
13
13
|
//#region src/shared/graphql/client.ts
|
|
14
|
-
var
|
|
14
|
+
var _ = {
|
|
15
15
|
consecutiveFailures: 0,
|
|
16
16
|
lastFailureTime: 0,
|
|
17
17
|
isOpen: !1
|
|
18
|
-
},
|
|
19
|
-
function
|
|
20
|
-
return
|
|
18
|
+
}, v = 5, y = 3e4;
|
|
19
|
+
function re() {
|
|
20
|
+
return _.consecutiveFailures++, _.lastFailureTime = Date.now(), _.consecutiveFailures >= v && (_.isOpen = !0), _.isOpen;
|
|
21
21
|
}
|
|
22
|
-
function
|
|
23
|
-
|
|
22
|
+
function b() {
|
|
23
|
+
_.consecutiveFailures = 0, _.isOpen = !1, a();
|
|
24
24
|
}
|
|
25
|
-
function
|
|
26
|
-
return
|
|
25
|
+
function ie() {
|
|
26
|
+
return _.isOpen ? Date.now() - _.lastFailureTime > y ? (_.isOpen = !1, _.consecutiveFailures = 0, !1) : !0 : !1;
|
|
27
|
+
}
|
|
28
|
+
var x = /(?:\b40[13]\b|status code 40[13]|unauthori[sz]ed|unauthenticated|forbidden|invalid email or password)/i;
|
|
29
|
+
function S(e) {
|
|
30
|
+
return typeof e == "number" && Number.isInteger(e) ? e : typeof e == "string" && /^\d{3}$/.test(e) ? Number(e) : null;
|
|
31
|
+
}
|
|
32
|
+
function ae(e) {
|
|
33
|
+
let t = /* @__PURE__ */ new Set(), n = (e, r) => {
|
|
34
|
+
if (r > 3 || e == null || t.has(e)) return !1;
|
|
35
|
+
if (typeof e == "string") return x.test(e);
|
|
36
|
+
if (typeof e != "object") return !1;
|
|
37
|
+
t.add(e);
|
|
38
|
+
let i = e, a = S(i.status) ?? S(i.statusCode) ?? S(i.response?.status);
|
|
39
|
+
if (a === 401 || a === 403) return !0;
|
|
40
|
+
let o = i.message;
|
|
41
|
+
return typeof o == "string" && x.test(o) ? !0 : n(i.cause, r + 1);
|
|
42
|
+
};
|
|
43
|
+
return n(e, 0);
|
|
27
44
|
}
|
|
28
45
|
function oe(e) {
|
|
29
46
|
if (!e || typeof e != "object") return null;
|
|
@@ -36,21 +53,21 @@ function se(e) {
|
|
|
36
53
|
return typeof t == "string" && t.trim() ? t : null;
|
|
37
54
|
}
|
|
38
55
|
function ce(e) {
|
|
39
|
-
let t =
|
|
56
|
+
let t = h(e);
|
|
40
57
|
return t.kind === "OperationDefinition" && t.operation === "mutation";
|
|
41
58
|
}
|
|
42
59
|
function le(e) {
|
|
43
60
|
let t = e.errors;
|
|
44
61
|
return Array.isArray(t) && t.length > 0;
|
|
45
62
|
}
|
|
46
|
-
function
|
|
63
|
+
function C(e) {
|
|
47
64
|
let t = e.headers;
|
|
48
65
|
if (!t || typeof t != "object" || Array.isArray(t)) return {};
|
|
49
66
|
let n = {};
|
|
50
67
|
for (let [e, r] of Object.entries(t)) typeof r == "string" && (n[e] = r);
|
|
51
68
|
return n;
|
|
52
69
|
}
|
|
53
|
-
function
|
|
70
|
+
function w(e) {
|
|
54
71
|
let t = e.fetchOptions;
|
|
55
72
|
if (!t || typeof t != "object" || !("signal" in t)) return;
|
|
56
73
|
let n = t.signal;
|
|
@@ -58,7 +75,7 @@ function x(e) {
|
|
|
58
75
|
}
|
|
59
76
|
function ue({ uri: e, batchMax: t, batchInterval: n }) {
|
|
60
77
|
return new f((r) => new p((i) => {
|
|
61
|
-
let a = r.getContext(), o = { query:
|
|
78
|
+
let a = r.getContext(), o = { query: g(r.query) };
|
|
62
79
|
r.operationName && (o.operationName = r.operationName);
|
|
63
80
|
let c = r.variables ?? {}, l = r.extensions ?? {};
|
|
64
81
|
Object.keys(c).length > 0 && (o.variables = c), Object.keys(l).length > 0 && (o.extensions = l);
|
|
@@ -66,8 +83,8 @@ function ue({ uri: e, batchMax: t, batchInterval: n }) {
|
|
|
66
83
|
return s(e, {
|
|
67
84
|
"content-type": "application/json",
|
|
68
85
|
"Apollo-Require-Preflight": "true",
|
|
69
|
-
...
|
|
70
|
-
}, o,
|
|
86
|
+
...C(a)
|
|
87
|
+
}, o, w(a), {
|
|
71
88
|
batchMax: t,
|
|
72
89
|
batchInterval: n
|
|
73
90
|
}).then((e) => {
|
|
@@ -79,109 +96,109 @@ function ue({ uri: e, batchMax: t, batchInterval: n }) {
|
|
|
79
96
|
};
|
|
80
97
|
}));
|
|
81
98
|
}
|
|
82
|
-
function
|
|
83
|
-
let { gateway: s, baseUrl:
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
99
|
+
function T(a) {
|
|
100
|
+
let { gateway: s, baseUrl: g, authToken: v, workspaceToken: y, locale: x, geography: S, organizationId: C, productId: w, productSlug: T, workspaceId: E, projectId: D, tenantId: O, cache: k, enableSubscriptions: A = !1, sseUrl: j, onAuthError: M, onRefreshToken: N, onNetworkError: P, onNetworkStatusChange: F, onMutationSuccess: I, maxRetryAttempts: de = 3, batchMax: fe = 10, batchInterval: pe, debug: L = !1 } = a, R = null, z = null, me = (e) => {
|
|
101
|
+
z ||= setTimeout(() => {
|
|
102
|
+
z = null, R && R.refetchQueries({ include: "active" }).catch((t) => {
|
|
103
|
+
L && console.warn("[GraphQL] Active query refresh failed after mutation:", {
|
|
87
104
|
gateway: s,
|
|
88
105
|
operationName: e,
|
|
89
106
|
error: t
|
|
90
107
|
});
|
|
91
108
|
});
|
|
92
109
|
}, 0);
|
|
93
|
-
},
|
|
94
|
-
uri: n(t(
|
|
95
|
-
batchMax:
|
|
96
|
-
batchInterval:
|
|
97
|
-
}),
|
|
98
|
-
let n = t.headers ?? {}, r = typeof
|
|
110
|
+
}, B = e[s], V = ue({
|
|
111
|
+
uri: n(t(g, s)),
|
|
112
|
+
batchMax: fe,
|
|
113
|
+
batchInterval: pe
|
|
114
|
+
}), H = d((e, t) => {
|
|
115
|
+
let n = t.headers ?? {}, r = typeof v == "function" ? v() : v;
|
|
99
116
|
return { headers: {
|
|
100
117
|
...n,
|
|
101
118
|
...r ? { authorization: `Bearer ${r}` } : {}
|
|
102
119
|
} };
|
|
103
|
-
}),
|
|
104
|
-
let n = t.headers ?? {}, r = typeof
|
|
120
|
+
}), U = d((e, t) => {
|
|
121
|
+
let n = t.headers ?? {}, r = typeof x == "function" ? x() : x;
|
|
105
122
|
return { headers: {
|
|
106
123
|
...n,
|
|
107
124
|
...r ? { "accept-language": r } : {}
|
|
108
125
|
} };
|
|
109
|
-
}),
|
|
110
|
-
let n = t.headers ?? {}, r = typeof
|
|
126
|
+
}), W = d((e, t) => {
|
|
127
|
+
let n = t.headers ?? {}, r = typeof S == "function" ? S() : null;
|
|
111
128
|
return { headers: {
|
|
112
129
|
...n,
|
|
113
130
|
...r?.country ? { "x-geo-country": r.country } : {},
|
|
114
131
|
...r?.currency ? { "x-geo-currency": r.currency } : {},
|
|
115
132
|
...r?.timezone ? { "x-geo-timezone": r.timezone } : {}
|
|
116
133
|
} };
|
|
117
|
-
}),
|
|
118
|
-
let n = t.headers ?? {}, r = typeof
|
|
134
|
+
}), G = d((e, t) => {
|
|
135
|
+
let n = t.headers ?? {}, r = typeof C == "function" ? C() : C;
|
|
119
136
|
return { headers: {
|
|
120
137
|
...n,
|
|
121
138
|
...r ? { "x-org-id": r } : {}
|
|
122
139
|
} };
|
|
123
|
-
}),
|
|
124
|
-
let n = t.headers ?? {}, r = typeof
|
|
140
|
+
}), K = d((e, t) => {
|
|
141
|
+
let n = t.headers ?? {}, r = typeof w == "function" ? w() : w, i = typeof T == "function" ? T() : T;
|
|
125
142
|
return { headers: {
|
|
126
143
|
...n,
|
|
127
144
|
...r ? { "x-product-id": r } : {},
|
|
128
145
|
...i ? { "x-product-slug": i } : {}
|
|
129
146
|
} };
|
|
130
|
-
}),
|
|
131
|
-
let n = t.headers ?? {}, r = (typeof
|
|
147
|
+
}), q = d((e, t) => {
|
|
148
|
+
let n = t.headers ?? {}, r = (typeof E == "function" ? E() : E) || oe(e.variables);
|
|
132
149
|
return { headers: {
|
|
133
150
|
...n,
|
|
134
151
|
...r ? { "x-workspace-id": r } : {}
|
|
135
152
|
} };
|
|
136
|
-
}),
|
|
137
|
-
let n = t.headers ?? {}, r = (typeof
|
|
153
|
+
}), J = d((e, t) => {
|
|
154
|
+
let n = t.headers ?? {}, r = (typeof D == "function" ? D() : D) || se(e.variables);
|
|
138
155
|
return { headers: {
|
|
139
156
|
...n,
|
|
140
157
|
...r ? { "x-project-id": r } : {}
|
|
141
158
|
} };
|
|
142
|
-
}),
|
|
143
|
-
let n = t.headers ?? {}, r = typeof
|
|
159
|
+
}), Y = d((e, t) => {
|
|
160
|
+
let n = t.headers ?? {}, r = typeof O == "function" ? O() : O;
|
|
144
161
|
return { headers: {
|
|
145
162
|
...n,
|
|
146
163
|
...r ? { "x-tenant-id": r } : {}
|
|
147
164
|
} };
|
|
148
|
-
}),
|
|
149
|
-
let n = t.headers ?? {}, i = typeof
|
|
150
|
-
workspaceId: typeof
|
|
151
|
-
organizationId: typeof
|
|
152
|
-
tenantId: typeof
|
|
153
|
-
projectId: typeof
|
|
165
|
+
}), he = d((e, t) => {
|
|
166
|
+
let n = t.headers ?? {}, i = typeof y == "function" ? y() : y, a = r(i, {
|
|
167
|
+
workspaceId: typeof E == "function" ? E() : E,
|
|
168
|
+
organizationId: typeof C == "function" ? C() : C,
|
|
169
|
+
tenantId: typeof O == "function" ? O() : O,
|
|
170
|
+
projectId: typeof D == "function" ? D() : D
|
|
154
171
|
}) ? i : null;
|
|
155
172
|
return { headers: {
|
|
156
173
|
...n,
|
|
157
174
|
...a ? { "x-workspace-authorization": `Bearer ${a}` } : {}
|
|
158
175
|
} };
|
|
159
|
-
}),
|
|
176
|
+
}), ge = new u({
|
|
160
177
|
delay: {
|
|
161
178
|
initial: 1e3,
|
|
162
179
|
max: 8e3,
|
|
163
180
|
jitter: !0
|
|
164
181
|
},
|
|
165
182
|
attempts: {
|
|
166
|
-
max:
|
|
183
|
+
max: de,
|
|
167
184
|
retryIf: (e) => {
|
|
168
|
-
if (
|
|
185
|
+
if (ie() || !e) return !1;
|
|
169
186
|
let t = e.message?.toLowerCase?.() ?? "";
|
|
170
187
|
return !(t.includes("401") || t.includes("403") || t.includes("unauthorized") || t.includes("forbidden") || t.includes("unauthenticated"));
|
|
171
188
|
}
|
|
172
189
|
}
|
|
173
190
|
}), _e = new f((e, t) => {
|
|
174
|
-
if (
|
|
175
|
-
|
|
191
|
+
if (ie()) {
|
|
192
|
+
L && console.warn("[CircuitBreaker] Circuit is open, blocking request:", e.operationName);
|
|
176
193
|
let t = /* @__PURE__ */ Error("Network circuit breaker is open — backend appears unreachable. Retrying in 30 seconds.");
|
|
177
|
-
return
|
|
194
|
+
return P?.(t), new p((e) => {
|
|
178
195
|
e.error(t);
|
|
179
196
|
});
|
|
180
197
|
}
|
|
181
198
|
return new p((n) => {
|
|
182
199
|
let r = t(e).subscribe({
|
|
183
200
|
next: (e) => {
|
|
184
|
-
|
|
201
|
+
b(), _.consecutiveFailures === 0 && F?.(!1), n.next(e);
|
|
185
202
|
},
|
|
186
203
|
error: (e) => {
|
|
187
204
|
n.error(e);
|
|
@@ -194,15 +211,15 @@ function S(a) {
|
|
|
194
211
|
r.unsubscribe();
|
|
195
212
|
};
|
|
196
213
|
});
|
|
197
|
-
}),
|
|
198
|
-
function
|
|
199
|
-
|
|
214
|
+
}), X = !1, Z = [];
|
|
215
|
+
function Q(e) {
|
|
216
|
+
Z.forEach(({ resolve: t }) => t(e)), Z = [];
|
|
200
217
|
}
|
|
201
|
-
let
|
|
218
|
+
let ve = l(({ error: e, operation: t, forward: n }) => {
|
|
202
219
|
let r = e.errors;
|
|
203
220
|
if (r) {
|
|
204
221
|
let a = r.some((e) => e.extensions?.code === "UNAUTHENTICATED" || e.message.includes("Unauthorized") || e.message.includes("Unauthenticated"));
|
|
205
|
-
for (let e of r)
|
|
222
|
+
for (let e of r) L && console.error("[GraphQL Error]:", e.message);
|
|
206
223
|
i({ errors: r }, { operationName: t.operationName });
|
|
207
224
|
let o = new Set(["STORAGE_QUOTA_EXCEEDED", "RESOURCE_CAP_EXCEEDED"]);
|
|
208
225
|
for (let e of r) {
|
|
@@ -212,56 +229,65 @@ function S(a) {
|
|
|
212
229
|
break;
|
|
213
230
|
}
|
|
214
231
|
}
|
|
215
|
-
if (a &&
|
|
232
|
+
if (a && N) return new p((r) => {
|
|
216
233
|
(async () => {
|
|
217
|
-
if (
|
|
218
|
-
|
|
234
|
+
if (X) if (await new Promise((e) => {
|
|
235
|
+
Z.push({ resolve: e });
|
|
219
236
|
})) {
|
|
220
237
|
let e = n(t).subscribe(r);
|
|
221
238
|
return () => e.unsubscribe();
|
|
222
|
-
} else return
|
|
223
|
-
|
|
239
|
+
} else return M?.(), r.error(e), () => {};
|
|
240
|
+
X = !0;
|
|
224
241
|
try {
|
|
225
|
-
let i = await
|
|
226
|
-
if (
|
|
227
|
-
|
|
242
|
+
let i = await N();
|
|
243
|
+
if (X = !1, i) {
|
|
244
|
+
Q(!0);
|
|
228
245
|
let e = n(t).subscribe(r);
|
|
229
246
|
return () => e.unsubscribe();
|
|
230
|
-
} else return
|
|
247
|
+
} else return Q(!1), M?.(), r.error(e), () => {};
|
|
231
248
|
} catch {
|
|
232
|
-
return
|
|
249
|
+
return X = !1, Q(!1), M?.(), r.error(e), () => {};
|
|
233
250
|
}
|
|
234
251
|
})();
|
|
235
252
|
});
|
|
236
|
-
a &&
|
|
237
|
-
} else
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
253
|
+
a && M?.(), b();
|
|
254
|
+
} else {
|
|
255
|
+
if (L && console.error("[Network Error]:", e), ae(e)) {
|
|
256
|
+
b(), e instanceof Error && i(e, {
|
|
257
|
+
operationName: t.operationName,
|
|
258
|
+
fallbackMessage: "Your session is no longer valid. Please sign in again."
|
|
259
|
+
});
|
|
260
|
+
return;
|
|
261
|
+
}
|
|
262
|
+
if (re() && F?.(!0), e instanceof Error) P?.(e), i(e, {
|
|
244
263
|
operationName: t.operationName,
|
|
245
264
|
fallbackMessage: "We could not reach the server. Please check your connection and try again."
|
|
246
265
|
});
|
|
266
|
+
else {
|
|
267
|
+
let n = Error(String(e));
|
|
268
|
+
P?.(n), i(n, {
|
|
269
|
+
operationName: t.operationName,
|
|
270
|
+
fallbackMessage: "We could not reach the server. Please check your connection and try again."
|
|
271
|
+
});
|
|
272
|
+
}
|
|
247
273
|
}
|
|
248
|
-
}),
|
|
274
|
+
}), ye = new f((e, t) => {
|
|
249
275
|
let n = ce(e.query), r = n && e.getContext().autoRefreshAfterMutation !== !1 && e.getContext().skipMutationAutoRefresh !== !0;
|
|
250
276
|
return new p((i) => {
|
|
251
277
|
let a = t(e).subscribe({
|
|
252
278
|
next: (t) => {
|
|
253
279
|
if (i.next(t), le(t) || (n && o(), !r)) return;
|
|
254
280
|
let a = e.operationName || "anonymous mutation";
|
|
255
|
-
|
|
281
|
+
I ? Promise.resolve(I({
|
|
256
282
|
gateway: s,
|
|
257
283
|
operationName: a
|
|
258
284
|
})).catch((e) => {
|
|
259
|
-
|
|
285
|
+
L && console.warn("[GraphQL] Mutation refresh callback failed:", {
|
|
260
286
|
gateway: s,
|
|
261
287
|
operationName: a,
|
|
262
288
|
error: e
|
|
263
289
|
});
|
|
264
|
-
}) :
|
|
290
|
+
}) : me(a);
|
|
265
291
|
},
|
|
266
292
|
error: (e) => {
|
|
267
293
|
i.error(e);
|
|
@@ -274,49 +300,49 @@ function S(a) {
|
|
|
274
300
|
a.unsubscribe();
|
|
275
301
|
};
|
|
276
302
|
});
|
|
277
|
-
}), $ =
|
|
278
|
-
|
|
303
|
+
}), $ = m([
|
|
304
|
+
ge,
|
|
279
305
|
_e,
|
|
280
|
-
Q,
|
|
281
306
|
ve,
|
|
282
|
-
|
|
283
|
-
q,
|
|
307
|
+
ye,
|
|
284
308
|
H,
|
|
285
|
-
|
|
286
|
-
W,
|
|
309
|
+
he,
|
|
287
310
|
G,
|
|
288
311
|
K,
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
312
|
+
q,
|
|
313
|
+
J,
|
|
314
|
+
Y,
|
|
315
|
+
U,
|
|
316
|
+
W,
|
|
317
|
+
V
|
|
292
318
|
]);
|
|
293
|
-
if (
|
|
294
|
-
let e =
|
|
295
|
-
e && ($ =
|
|
296
|
-
|
|
319
|
+
if (A) {
|
|
320
|
+
let e = j || n(g || B.defaultBaseUrl) + B.sse;
|
|
321
|
+
e && ($ = m([
|
|
322
|
+
ge,
|
|
297
323
|
_e,
|
|
298
|
-
Q,
|
|
299
324
|
ve,
|
|
300
|
-
|
|
301
|
-
q,
|
|
325
|
+
ye,
|
|
302
326
|
H,
|
|
303
|
-
|
|
304
|
-
W,
|
|
327
|
+
he,
|
|
305
328
|
G,
|
|
306
329
|
K,
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
330
|
+
q,
|
|
331
|
+
J,
|
|
332
|
+
Y,
|
|
333
|
+
U,
|
|
334
|
+
W,
|
|
335
|
+
ne(({ query: e }) => {
|
|
336
|
+
let t = h(e);
|
|
311
337
|
return t.kind === "OperationDefinition" && t.operation === "subscription";
|
|
312
338
|
}, new c({
|
|
313
339
|
url: e,
|
|
314
340
|
headers: {},
|
|
315
|
-
debug:
|
|
316
|
-
}),
|
|
341
|
+
debug: L
|
|
342
|
+
}), V)
|
|
317
343
|
]));
|
|
318
344
|
}
|
|
319
|
-
let
|
|
345
|
+
let be = new te({ typePolicies: {
|
|
320
346
|
File: { keyFields: ["id"] },
|
|
321
347
|
Folder: { keyFields: ["id"] },
|
|
322
348
|
Tag: { keyFields: ["id"] },
|
|
@@ -351,9 +377,9 @@ function S(a) {
|
|
|
351
377
|
VibecontrolsAgent: { keyFields: ["id"] },
|
|
352
378
|
Query: { fields: { vibes: { keyArgs: ["filter"] } } }
|
|
353
379
|
} });
|
|
354
|
-
return
|
|
380
|
+
return R = new ee({
|
|
355
381
|
link: $,
|
|
356
|
-
cache:
|
|
382
|
+
cache: k ?? be,
|
|
357
383
|
defaultOptions: {
|
|
358
384
|
watchQuery: {
|
|
359
385
|
fetchPolicy: "cache-and-network",
|
|
@@ -365,19 +391,19 @@ function S(a) {
|
|
|
365
391
|
},
|
|
366
392
|
mutate: { errorPolicy: "all" }
|
|
367
393
|
}
|
|
368
|
-
}),
|
|
394
|
+
}), R;
|
|
369
395
|
}
|
|
370
|
-
var
|
|
371
|
-
function
|
|
396
|
+
var E = null, D = null;
|
|
397
|
+
function O(e) {
|
|
372
398
|
let { workspaceBaseUrl: t, globalBaseUrl: n, authToken: r, enableSubscriptions: i = !1, onAuthError: a, debug: o = !1 } = e;
|
|
373
|
-
|
|
399
|
+
E = T({
|
|
374
400
|
gateway: "workspace",
|
|
375
401
|
baseUrl: t,
|
|
376
402
|
authToken: r,
|
|
377
403
|
enableSubscriptions: i,
|
|
378
404
|
onAuthError: a,
|
|
379
405
|
debug: o
|
|
380
|
-
}),
|
|
406
|
+
}), D = T({
|
|
381
407
|
gateway: "global",
|
|
382
408
|
baseUrl: n,
|
|
383
409
|
authToken: r,
|
|
@@ -385,16 +411,16 @@ function T(e) {
|
|
|
385
411
|
debug: o
|
|
386
412
|
});
|
|
387
413
|
}
|
|
388
|
-
function
|
|
389
|
-
if (!
|
|
390
|
-
return
|
|
414
|
+
function k() {
|
|
415
|
+
if (!E) throw Error("Workspace client not initialized. Call initializeAppClients first.");
|
|
416
|
+
return E;
|
|
391
417
|
}
|
|
392
|
-
function
|
|
393
|
-
if (!
|
|
394
|
-
return
|
|
418
|
+
function A() {
|
|
419
|
+
if (!D) throw Error("Global client not initialized. Call initializeAppClients first.");
|
|
420
|
+
return D;
|
|
395
421
|
}
|
|
396
|
-
function
|
|
397
|
-
|
|
422
|
+
function j() {
|
|
423
|
+
E &&= (E.clearStore(), null), D &&= (D.clearStore(), null);
|
|
398
424
|
}
|
|
399
425
|
//#endregion
|
|
400
|
-
export {
|
|
426
|
+
export { T as createGraphQLClient, A as getGlobalClient, k as getWorkspaceClient, O as initializeAppClients, j as resetAppClients };
|