@burdenoff/fe-libs 2026.627.1 → 2026.627.3
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/hooks/shell/index.d.ts +1 -0
- package/dist/shared/hooks/shell/index.d.ts.map +1 -1
- package/dist/shared/hooks/shell/useEffectiveContext.d.ts +40 -0
- package/dist/shared/hooks/shell/useEffectiveContext.d.ts.map +1 -0
- package/dist/shared/hooks/shell/useEffectiveContext.js +25 -0
- package/dist/shared/providers/AppShellProvider.d.ts.map +1 -1
- package/dist/shared/providers/AppShellProvider.js +16 -9
- 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 +30 -43
- package/dist/shared-hooks-shell.js +5 -4
- package/package.json +1 -1
|
@@ -27,6 +27,8 @@ export interface CreateClientOptions {
|
|
|
27
27
|
organizationId?: string | (() => string | null);
|
|
28
28
|
/** Product ID or getter function for x-product-id header (for product-level isolation) */
|
|
29
29
|
productId?: string | (() => string | null);
|
|
30
|
+
/** Product slug or getter function for x-product-slug header */
|
|
31
|
+
productSlug?: string | (() => string | null);
|
|
30
32
|
/** Workspace ID or getter function for x-workspace-id header (workspace context) */
|
|
31
33
|
workspaceId?: string | (() => string | null);
|
|
32
34
|
/** Project ID or getter function for x-project-id header (project context) */
|
|
@@ -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,CAAC;QAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;KACnB,GAAG,IAAI,CAAC;IACT,8EAA8E;IAC9E,cAAc,CAAC,EAAE,MAAM,GAAG,CAAC,MAAM,MAAM,GAAG,IAAI,CAAC,CAAC;IAChD,0FAA0F;IAC1F,SAAS,CAAC,EAAE,MAAM,GAAG,CAAC,MAAM,MAAM,GAAG,IAAI,CAAC,CAAC;IAC3C,oFAAoF;IACpF,WAAW,CAAC,EAAE,MAAM,GAAG,CAAC,MAAM,MAAM,GAAG,IA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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,66 +7,67 @@ 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 ne, split as re } from "@apollo/client/core";
|
|
11
|
+
import { getMainDefinition as ie } from "@apollo/client/utilities";
|
|
12
|
+
import { print as m } from "graphql";
|
|
13
13
|
//#region src/shared/graphql/client.ts
|
|
14
|
-
var
|
|
14
|
+
var h = {
|
|
15
15
|
consecutiveFailures: 0,
|
|
16
16
|
lastFailureTime: 0,
|
|
17
17
|
isOpen: !1
|
|
18
|
-
},
|
|
19
|
-
function
|
|
20
|
-
return
|
|
18
|
+
}, g = 5, _ = 3e4;
|
|
19
|
+
function ae() {
|
|
20
|
+
return h.consecutiveFailures++, h.lastFailureTime = Date.now(), h.consecutiveFailures >= g && (h.isOpen = !0), h.isOpen;
|
|
21
21
|
}
|
|
22
|
-
function
|
|
23
|
-
|
|
22
|
+
function v() {
|
|
23
|
+
h.consecutiveFailures = 0, h.isOpen = !1, a();
|
|
24
24
|
}
|
|
25
|
-
function
|
|
26
|
-
return
|
|
25
|
+
function y() {
|
|
26
|
+
return h.isOpen ? Date.now() - h.lastFailureTime > _ ? (h.isOpen = !1, h.consecutiveFailures = 0, !1) : !0 : !1;
|
|
27
27
|
}
|
|
28
|
-
function
|
|
28
|
+
function oe(e) {
|
|
29
29
|
if (!e || typeof e != "object") return null;
|
|
30
30
|
let t = e, n = t.workspaceId || t.input?.workspaceId;
|
|
31
31
|
return typeof n == "string" && n.trim() ? n : null;
|
|
32
32
|
}
|
|
33
|
-
function
|
|
33
|
+
function se(e) {
|
|
34
34
|
if (!e || typeof e != "object") return null;
|
|
35
35
|
let t = e.projectId;
|
|
36
36
|
return typeof t == "string" && t.trim() ? t : null;
|
|
37
37
|
}
|
|
38
|
-
function
|
|
39
|
-
let t =
|
|
38
|
+
function ce(e) {
|
|
39
|
+
let t = ie(e);
|
|
40
40
|
return t.kind === "OperationDefinition" && t.operation === "mutation";
|
|
41
41
|
}
|
|
42
|
-
function
|
|
42
|
+
function le(e) {
|
|
43
43
|
let t = e.errors;
|
|
44
44
|
return Array.isArray(t) && t.length > 0;
|
|
45
45
|
}
|
|
46
|
-
function
|
|
46
|
+
function b(e) {
|
|
47
47
|
let t = e.headers;
|
|
48
48
|
if (!t || typeof t != "object" || Array.isArray(t)) return {};
|
|
49
49
|
let n = {};
|
|
50
50
|
for (let [e, r] of Object.entries(t)) typeof r == "string" && (n[e] = r);
|
|
51
51
|
return n;
|
|
52
52
|
}
|
|
53
|
-
function
|
|
53
|
+
function x(e) {
|
|
54
54
|
let t = e.fetchOptions;
|
|
55
55
|
if (!t || typeof t != "object" || !("signal" in t)) return;
|
|
56
56
|
let n = t.signal;
|
|
57
57
|
return n instanceof AbortSignal ? n : void 0;
|
|
58
58
|
}
|
|
59
|
-
function
|
|
59
|
+
function ue({ uri: e, batchMax: t, batchInterval: n }) {
|
|
60
60
|
return new f((r) => new p((i) => {
|
|
61
|
-
let a = r.getContext(), o = { query:
|
|
61
|
+
let a = r.getContext(), o = { query: m(r.query) };
|
|
62
62
|
r.operationName && (o.operationName = r.operationName);
|
|
63
63
|
let c = r.variables ?? {}, l = r.extensions ?? {};
|
|
64
64
|
Object.keys(c).length > 0 && (o.variables = c), Object.keys(l).length > 0 && (o.extensions = l);
|
|
65
65
|
let u = !1;
|
|
66
66
|
return s(e, {
|
|
67
67
|
"content-type": "application/json",
|
|
68
|
-
|
|
69
|
-
|
|
68
|
+
"Apollo-Require-Preflight": "true",
|
|
69
|
+
...b(a)
|
|
70
|
+
}, o, x(a), {
|
|
70
71
|
batchMax: t,
|
|
71
72
|
batchInterval: n
|
|
72
73
|
}).then((e) => {
|
|
@@ -78,75 +79,76 @@ function le({ uri: e, batchMax: t, batchInterval: n }) {
|
|
|
78
79
|
};
|
|
79
80
|
}));
|
|
80
81
|
}
|
|
81
|
-
function
|
|
82
|
-
let { gateway: s, baseUrl:
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
82
|
+
function S(a) {
|
|
83
|
+
let { gateway: s, baseUrl: m, authToken: g, workspaceToken: _, locale: b, geography: x, organizationId: S, productId: C, productSlug: w, workspaceId: T, projectId: E, tenantId: D, cache: O, enableSubscriptions: de = !1, sseUrl: fe, onAuthError: k, onRefreshToken: A, onNetworkError: j, onNetworkStatusChange: M, onMutationSuccess: N, maxRetryAttempts: pe = 3, batchMax: me = 10, batchInterval: he, debug: P = !1 } = a, F = null, I = null, ge = (e) => {
|
|
84
|
+
I ||= setTimeout(() => {
|
|
85
|
+
I = null, F && F.refetchQueries({ include: "active" }).catch((t) => {
|
|
86
|
+
P && console.warn("[GraphQL] Active query refresh failed after mutation:", {
|
|
86
87
|
gateway: s,
|
|
87
88
|
operationName: e,
|
|
88
89
|
error: t
|
|
89
90
|
});
|
|
90
91
|
});
|
|
91
92
|
}, 0);
|
|
92
|
-
},
|
|
93
|
-
uri: n(t(
|
|
94
|
-
batchMax:
|
|
95
|
-
batchInterval:
|
|
96
|
-
}),
|
|
97
|
-
let n = t.headers ?? {}, r = typeof
|
|
93
|
+
}, L = e[s], R = ue({
|
|
94
|
+
uri: n(t(m, s)),
|
|
95
|
+
batchMax: me,
|
|
96
|
+
batchInterval: he
|
|
97
|
+
}), z = d((e, t) => {
|
|
98
|
+
let n = t.headers ?? {}, r = typeof g == "function" ? g() : g;
|
|
98
99
|
return { headers: {
|
|
99
100
|
...n,
|
|
100
101
|
...r ? { authorization: `Bearer ${r}` } : {}
|
|
101
102
|
} };
|
|
102
|
-
}),
|
|
103
|
-
let n = t.headers ?? {}, r = typeof
|
|
103
|
+
}), B = d((e, t) => {
|
|
104
|
+
let n = t.headers ?? {}, r = typeof b == "function" ? b() : b;
|
|
104
105
|
return { headers: {
|
|
105
106
|
...n,
|
|
106
107
|
...r ? { "accept-language": r } : {}
|
|
107
108
|
} };
|
|
108
|
-
}),
|
|
109
|
-
let n = t.headers ?? {}, r = typeof
|
|
109
|
+
}), V = d((e, t) => {
|
|
110
|
+
let n = t.headers ?? {}, r = typeof x == "function" ? x() : null;
|
|
110
111
|
return { headers: {
|
|
111
112
|
...n,
|
|
112
113
|
...r?.country ? { "x-geo-country": r.country } : {},
|
|
113
114
|
...r?.currency ? { "x-geo-currency": r.currency } : {},
|
|
114
115
|
...r?.timezone ? { "x-geo-timezone": r.timezone } : {}
|
|
115
116
|
} };
|
|
116
|
-
}),
|
|
117
|
-
let n = t.headers ?? {}, r = typeof
|
|
117
|
+
}), H = d((e, t) => {
|
|
118
|
+
let n = t.headers ?? {}, r = typeof S == "function" ? S() : S;
|
|
118
119
|
return { headers: {
|
|
119
120
|
...n,
|
|
120
121
|
...r ? { "x-org-id": r } : {}
|
|
121
122
|
} };
|
|
122
|
-
}),
|
|
123
|
-
let n = t.headers ?? {}, r = typeof w == "function" ? w() : w;
|
|
123
|
+
}), U = d((e, t) => {
|
|
124
|
+
let n = t.headers ?? {}, r = typeof C == "function" ? C() : C, i = typeof w == "function" ? w() : w;
|
|
124
125
|
return { headers: {
|
|
125
126
|
...n,
|
|
126
|
-
...r ? { "x-product-id": r } : {}
|
|
127
|
+
...r ? { "x-product-id": r } : {},
|
|
128
|
+
...i ? { "x-product-slug": i } : {}
|
|
127
129
|
} };
|
|
128
|
-
}),
|
|
129
|
-
let n = t.headers ?? {}, r = (typeof T == "function" ? T() : T) ||
|
|
130
|
+
}), W = d((e, t) => {
|
|
131
|
+
let n = t.headers ?? {}, r = (typeof T == "function" ? T() : T) || oe(e.variables);
|
|
130
132
|
return { headers: {
|
|
131
133
|
...n,
|
|
132
134
|
...r ? { "x-workspace-id": r } : {}
|
|
133
135
|
} };
|
|
134
|
-
}),
|
|
135
|
-
let n = t.headers ?? {}, r = (typeof E == "function" ? E() : E) ||
|
|
136
|
+
}), G = d((e, t) => {
|
|
137
|
+
let n = t.headers ?? {}, r = (typeof E == "function" ? E() : E) || se(e.variables);
|
|
136
138
|
return { headers: {
|
|
137
139
|
...n,
|
|
138
140
|
...r ? { "x-project-id": r } : {}
|
|
139
141
|
} };
|
|
140
|
-
}),
|
|
142
|
+
}), K = d((e, t) => {
|
|
141
143
|
let n = t.headers ?? {}, r = typeof D == "function" ? D() : D;
|
|
142
144
|
return { headers: {
|
|
143
145
|
...n,
|
|
144
146
|
...r ? { "x-tenant-id": r } : {}
|
|
145
147
|
} };
|
|
146
|
-
}),
|
|
147
|
-
let n = t.headers ?? {}, i = typeof
|
|
148
|
+
}), q = d((e, t) => {
|
|
149
|
+
let n = t.headers ?? {}, i = typeof _ == "function" ? _() : _, a = r(i, {
|
|
148
150
|
workspaceId: typeof T == "function" ? T() : T,
|
|
149
|
-
organizationId: typeof
|
|
151
|
+
organizationId: typeof S == "function" ? S() : S,
|
|
150
152
|
tenantId: typeof D == "function" ? D() : D,
|
|
151
153
|
projectId: typeof E == "function" ? E() : E
|
|
152
154
|
}) ? i : null;
|
|
@@ -154,32 +156,32 @@ function C(a) {
|
|
|
154
156
|
...n,
|
|
155
157
|
...a ? { "x-workspace-authorization": `Bearer ${a}` } : {}
|
|
156
158
|
} };
|
|
157
|
-
}),
|
|
159
|
+
}), J = new u({
|
|
158
160
|
delay: {
|
|
159
161
|
initial: 1e3,
|
|
160
162
|
max: 8e3,
|
|
161
163
|
jitter: !0
|
|
162
164
|
},
|
|
163
165
|
attempts: {
|
|
164
|
-
max:
|
|
166
|
+
max: pe,
|
|
165
167
|
retryIf: (e) => {
|
|
166
|
-
if (
|
|
168
|
+
if (y() || !e) return !1;
|
|
167
169
|
let t = e.message?.toLowerCase?.() ?? "";
|
|
168
170
|
return !(t.includes("401") || t.includes("403") || t.includes("unauthorized") || t.includes("forbidden") || t.includes("unauthenticated"));
|
|
169
171
|
}
|
|
170
172
|
}
|
|
171
|
-
}),
|
|
172
|
-
if (
|
|
173
|
-
|
|
173
|
+
}), _e = new f((e, t) => {
|
|
174
|
+
if (y()) {
|
|
175
|
+
P && console.warn("[CircuitBreaker] Circuit is open, blocking request:", e.operationName);
|
|
174
176
|
let t = /* @__PURE__ */ Error("Network circuit breaker is open — backend appears unreachable. Retrying in 30 seconds.");
|
|
175
|
-
return
|
|
177
|
+
return j?.(t), new p((e) => {
|
|
176
178
|
e.error(t);
|
|
177
179
|
});
|
|
178
180
|
}
|
|
179
181
|
return new p((n) => {
|
|
180
182
|
let r = t(e).subscribe({
|
|
181
183
|
next: (e) => {
|
|
182
|
-
|
|
184
|
+
v(), h.consecutiveFailures === 0 && M?.(!1), n.next(e);
|
|
183
185
|
},
|
|
184
186
|
error: (e) => {
|
|
185
187
|
n.error(e);
|
|
@@ -192,15 +194,15 @@ function C(a) {
|
|
|
192
194
|
r.unsubscribe();
|
|
193
195
|
};
|
|
194
196
|
});
|
|
195
|
-
}),
|
|
196
|
-
function
|
|
197
|
-
|
|
197
|
+
}), Y = !1, X = [];
|
|
198
|
+
function Z(e) {
|
|
199
|
+
X.forEach(({ resolve: t }) => t(e)), X = [];
|
|
198
200
|
}
|
|
199
|
-
let
|
|
201
|
+
let Q = l(({ error: e, operation: t, forward: n }) => {
|
|
200
202
|
let r = e.errors;
|
|
201
203
|
if (r) {
|
|
202
204
|
let a = r.some((e) => e.extensions?.code === "UNAUTHENTICATED" || e.message.includes("Unauthorized") || e.message.includes("Unauthenticated"));
|
|
203
|
-
for (let e of r)
|
|
205
|
+
for (let e of r) P && console.error("[GraphQL Error]:", e.message);
|
|
204
206
|
i({ errors: r }, { operationName: t.operationName });
|
|
205
207
|
let o = new Set(["STORAGE_QUOTA_EXCEEDED", "RESOURCE_CAP_EXCEEDED"]);
|
|
206
208
|
for (let e of r) {
|
|
@@ -210,56 +212,56 @@ function C(a) {
|
|
|
210
212
|
break;
|
|
211
213
|
}
|
|
212
214
|
}
|
|
213
|
-
if (a &&
|
|
215
|
+
if (a && A) return new p((r) => {
|
|
214
216
|
(async () => {
|
|
215
|
-
if (
|
|
216
|
-
|
|
217
|
+
if (Y) if (await new Promise((e) => {
|
|
218
|
+
X.push({ resolve: e });
|
|
217
219
|
})) {
|
|
218
220
|
let e = n(t).subscribe(r);
|
|
219
221
|
return () => e.unsubscribe();
|
|
220
|
-
} else return
|
|
221
|
-
|
|
222
|
+
} else return k?.(), r.error(e), () => {};
|
|
223
|
+
Y = !0;
|
|
222
224
|
try {
|
|
223
|
-
let i = await
|
|
224
|
-
if (
|
|
225
|
-
|
|
225
|
+
let i = await A();
|
|
226
|
+
if (Y = !1, i) {
|
|
227
|
+
Z(!0);
|
|
226
228
|
let e = n(t).subscribe(r);
|
|
227
229
|
return () => e.unsubscribe();
|
|
228
|
-
} else return
|
|
230
|
+
} else return Z(!1), k?.(), r.error(e), () => {};
|
|
229
231
|
} catch {
|
|
230
|
-
return
|
|
232
|
+
return Y = !1, Z(!1), k?.(), r.error(e), () => {};
|
|
231
233
|
}
|
|
232
234
|
})();
|
|
233
235
|
});
|
|
234
|
-
a &&
|
|
235
|
-
} else if (
|
|
236
|
+
a && k?.(), v();
|
|
237
|
+
} else if (P && console.error("[Network Error]:", e), ae() && M?.(!0), e instanceof Error) j?.(e), i(e, {
|
|
236
238
|
operationName: t.operationName,
|
|
237
239
|
fallbackMessage: "We could not reach the server. Please check your connection and try again."
|
|
238
240
|
});
|
|
239
241
|
else {
|
|
240
242
|
let n = Error(String(e));
|
|
241
|
-
|
|
243
|
+
j?.(n), i(n, {
|
|
242
244
|
operationName: t.operationName,
|
|
243
245
|
fallbackMessage: "We could not reach the server. Please check your connection and try again."
|
|
244
246
|
});
|
|
245
247
|
}
|
|
246
|
-
}),
|
|
247
|
-
let n =
|
|
248
|
+
}), ve = new f((e, t) => {
|
|
249
|
+
let n = ce(e.query), r = n && e.getContext().autoRefreshAfterMutation !== !1 && e.getContext().skipMutationAutoRefresh !== !0;
|
|
248
250
|
return new p((i) => {
|
|
249
251
|
let a = t(e).subscribe({
|
|
250
252
|
next: (t) => {
|
|
251
|
-
if (i.next(t),
|
|
253
|
+
if (i.next(t), le(t) || (n && o(), !r)) return;
|
|
252
254
|
let a = e.operationName || "anonymous mutation";
|
|
253
|
-
|
|
255
|
+
N ? Promise.resolve(N({
|
|
254
256
|
gateway: s,
|
|
255
257
|
operationName: a
|
|
256
258
|
})).catch((e) => {
|
|
257
|
-
|
|
259
|
+
P && console.warn("[GraphQL] Mutation refresh callback failed:", {
|
|
258
260
|
gateway: s,
|
|
259
261
|
operationName: a,
|
|
260
262
|
error: e
|
|
261
263
|
});
|
|
262
|
-
}) :
|
|
264
|
+
}) : ge(a);
|
|
263
265
|
},
|
|
264
266
|
error: (e) => {
|
|
265
267
|
i.error(e);
|
|
@@ -272,49 +274,49 @@ function C(a) {
|
|
|
272
274
|
a.unsubscribe();
|
|
273
275
|
};
|
|
274
276
|
});
|
|
275
|
-
}), $ =
|
|
276
|
-
Y,
|
|
277
|
-
he,
|
|
278
|
-
ge,
|
|
279
|
-
_e,
|
|
280
|
-
B,
|
|
277
|
+
}), $ = ne([
|
|
281
278
|
J,
|
|
279
|
+
_e,
|
|
280
|
+
Q,
|
|
281
|
+
ve,
|
|
282
|
+
z,
|
|
283
|
+
q,
|
|
284
|
+
H,
|
|
282
285
|
U,
|
|
283
286
|
W,
|
|
284
287
|
G,
|
|
285
288
|
K,
|
|
286
|
-
|
|
289
|
+
B,
|
|
287
290
|
V,
|
|
288
|
-
|
|
289
|
-
z
|
|
291
|
+
R
|
|
290
292
|
]);
|
|
291
|
-
if (
|
|
292
|
-
let e =
|
|
293
|
-
e && ($ =
|
|
294
|
-
Y,
|
|
295
|
-
he,
|
|
296
|
-
ge,
|
|
297
|
-
_e,
|
|
298
|
-
B,
|
|
293
|
+
if (de) {
|
|
294
|
+
let e = fe || n(m || L.defaultBaseUrl) + L.sse;
|
|
295
|
+
e && ($ = ne([
|
|
299
296
|
J,
|
|
297
|
+
_e,
|
|
298
|
+
Q,
|
|
299
|
+
ve,
|
|
300
|
+
z,
|
|
301
|
+
q,
|
|
302
|
+
H,
|
|
300
303
|
U,
|
|
301
304
|
W,
|
|
302
305
|
G,
|
|
303
306
|
K,
|
|
304
|
-
|
|
307
|
+
B,
|
|
305
308
|
V,
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
let t = h(e);
|
|
309
|
+
re(({ query: e }) => {
|
|
310
|
+
let t = ie(e);
|
|
309
311
|
return t.kind === "OperationDefinition" && t.operation === "subscription";
|
|
310
312
|
}, new c({
|
|
311
313
|
url: e,
|
|
312
314
|
headers: {},
|
|
313
|
-
debug:
|
|
314
|
-
}),
|
|
315
|
+
debug: P
|
|
316
|
+
}), R)
|
|
315
317
|
]));
|
|
316
318
|
}
|
|
317
|
-
let
|
|
319
|
+
let ye = new te({ typePolicies: {
|
|
318
320
|
File: { keyFields: ["id"] },
|
|
319
321
|
Folder: { keyFields: ["id"] },
|
|
320
322
|
Tag: { keyFields: ["id"] },
|
|
@@ -349,9 +351,9 @@ function C(a) {
|
|
|
349
351
|
VibecontrolsAgent: { keyFields: ["id"] },
|
|
350
352
|
Query: { fields: { vibes: { keyArgs: ["filter"] } } }
|
|
351
353
|
} });
|
|
352
|
-
return
|
|
354
|
+
return F = new ee({
|
|
353
355
|
link: $,
|
|
354
|
-
cache: O ??
|
|
356
|
+
cache: O ?? ye,
|
|
355
357
|
defaultOptions: {
|
|
356
358
|
watchQuery: {
|
|
357
359
|
fetchPolicy: "cache-and-network",
|
|
@@ -363,19 +365,19 @@ function C(a) {
|
|
|
363
365
|
},
|
|
364
366
|
mutate: { errorPolicy: "all" }
|
|
365
367
|
}
|
|
366
|
-
}),
|
|
368
|
+
}), F;
|
|
367
369
|
}
|
|
368
|
-
var
|
|
369
|
-
function
|
|
370
|
+
var C = null, w = null;
|
|
371
|
+
function T(e) {
|
|
370
372
|
let { workspaceBaseUrl: t, globalBaseUrl: n, authToken: r, enableSubscriptions: i = !1, onAuthError: a, debug: o = !1 } = e;
|
|
371
|
-
|
|
373
|
+
C = S({
|
|
372
374
|
gateway: "workspace",
|
|
373
375
|
baseUrl: t,
|
|
374
376
|
authToken: r,
|
|
375
377
|
enableSubscriptions: i,
|
|
376
378
|
onAuthError: a,
|
|
377
379
|
debug: o
|
|
378
|
-
}),
|
|
380
|
+
}), w = S({
|
|
379
381
|
gateway: "global",
|
|
380
382
|
baseUrl: n,
|
|
381
383
|
authToken: r,
|
|
@@ -383,16 +385,16 @@ function E(e) {
|
|
|
383
385
|
debug: o
|
|
384
386
|
});
|
|
385
387
|
}
|
|
388
|
+
function E() {
|
|
389
|
+
if (!C) throw Error("Workspace client not initialized. Call initializeAppClients first.");
|
|
390
|
+
return C;
|
|
391
|
+
}
|
|
386
392
|
function D() {
|
|
387
|
-
if (!w) throw Error("
|
|
393
|
+
if (!w) throw Error("Global client not initialized. Call initializeAppClients first.");
|
|
388
394
|
return w;
|
|
389
395
|
}
|
|
390
396
|
function O() {
|
|
391
|
-
|
|
392
|
-
return T;
|
|
393
|
-
}
|
|
394
|
-
function k() {
|
|
395
|
-
w &&= (w.clearStore(), null), T &&= (T.clearStore(), null);
|
|
397
|
+
C &&= (C.clearStore(), null), w &&= (w.clearStore(), null);
|
|
396
398
|
}
|
|
397
399
|
//#endregion
|
|
398
|
-
export {
|
|
400
|
+
export { S as createGraphQLClient, D as getGlobalClient, E as getWorkspaceClient, T as initializeAppClients, O as resetAppClients };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetch.d.ts","sourceRoot":"","sources":["../../../src/shared/graphql/fetch.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAY,KAAK,OAAO,EAAsB,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"fetch.d.ts","sourceRoot":"","sources":["../../../src/shared/graphql/fetch.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAY,KAAK,OAAO,EAAsB,MAAM,WAAW,CAAC;AAuBvE,MAAM,WAAW,mBAAmB;IAClC,wBAAwB;IACxB,OAAO,EAAE,OAAO,CAAC;IACjB,sCAAsC;IACtC,KAAK,EAAE,MAAM,CAAC;IACd,kCAAkC;IAClC,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACpC,sDAAsD;IACtD,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,wEAAwE;IACxE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;OAIG;IACH,cAAc,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IAClC;;;;;OAKG;IACH,WAAW,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IAC/B;;;OAGG;IACH,cAAc,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IAClC;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IAC5B;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IAC7B,oEAAoE;IACpE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,sEAAsE;IACtE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,mEAAmE;IACnE,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC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