@burdenoff/fe-libs 2026.601.13 → 2026.601.14
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.
|
@@ -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;I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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"}
|
|
@@ -2,28 +2,28 @@ import { GATEWAYS as e, getGatewayUrl as t } from "../../shared-config.js";
|
|
|
2
2
|
import { validateGatewayBaseUrl as n } from "./security.js";
|
|
3
3
|
import { isWorkspaceTokenValidForContext as r } from "./workspaceToken.js";
|
|
4
4
|
import { dispatchBackendErrorEvent as i, markConnectionHealthy as a } from "../utils/backendErrors.js";
|
|
5
|
-
import {
|
|
6
|
-
import { SSELink as
|
|
7
|
-
import { onError as
|
|
8
|
-
import { RetryLink as
|
|
9
|
-
import { setContext as
|
|
10
|
-
import { ApolloClient as ee, ApolloLink as
|
|
11
|
-
import { getMainDefinition as
|
|
12
|
-
import { print as
|
|
5
|
+
import { clearGraphqlFetchResponseCache as o, enqueueGraphQLFetch as s } from "./fetch.js";
|
|
6
|
+
import { SSELink as c } from "./links/sse-link.js";
|
|
7
|
+
import { onError as l } from "@apollo/client/link/error";
|
|
8
|
+
import { RetryLink as u } from "@apollo/client/link/retry";
|
|
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 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
|
-
},
|
|
18
|
+
}, v = 5, y = 3e4;
|
|
19
19
|
function re() {
|
|
20
|
-
return
|
|
21
|
-
}
|
|
22
|
-
function y() {
|
|
23
|
-
g.consecutiveFailures = 0, g.isOpen = !1, a();
|
|
20
|
+
return _.consecutiveFailures++, _.lastFailureTime = Date.now(), _.consecutiveFailures >= v && (_.isOpen = !0), _.isOpen;
|
|
24
21
|
}
|
|
25
22
|
function ie() {
|
|
26
|
-
|
|
23
|
+
_.consecutiveFailures = 0, _.isOpen = !1, a();
|
|
24
|
+
}
|
|
25
|
+
function b() {
|
|
26
|
+
return _.isOpen ? Date.now() - _.lastFailureTime > y ? (_.isOpen = !1, _.consecutiveFailures = 0, !1) : !0 : !1;
|
|
27
27
|
}
|
|
28
28
|
function ae(e) {
|
|
29
29
|
if (!e || typeof e != "object") return null;
|
|
@@ -36,37 +36,37 @@ function oe(e) {
|
|
|
36
36
|
return typeof t == "string" && t.trim() ? t : null;
|
|
37
37
|
}
|
|
38
38
|
function se(e) {
|
|
39
|
-
let t =
|
|
39
|
+
let t = h(e);
|
|
40
40
|
return t.kind === "OperationDefinition" && t.operation === "mutation";
|
|
41
41
|
}
|
|
42
42
|
function ce(e) {
|
|
43
43
|
let t = e.errors;
|
|
44
44
|
return Array.isArray(t) && t.length > 0;
|
|
45
45
|
}
|
|
46
|
-
function
|
|
46
|
+
function x(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 S(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
59
|
function le({ uri: e, batchMax: t, batchInterval: n }) {
|
|
60
|
-
return new
|
|
61
|
-
let a = r.getContext(),
|
|
62
|
-
r.operationName && (
|
|
60
|
+
return new f((r) => new p((i) => {
|
|
61
|
+
let a = r.getContext(), o = { query: g(r.query) };
|
|
62
|
+
r.operationName && (o.operationName = r.operationName);
|
|
63
63
|
let c = r.variables ?? {}, l = r.extensions ?? {};
|
|
64
|
-
Object.keys(c).length > 0 && (
|
|
64
|
+
Object.keys(c).length > 0 && (o.variables = c), Object.keys(l).length > 0 && (o.extensions = l);
|
|
65
65
|
let u = !1;
|
|
66
|
-
return
|
|
66
|
+
return s(e, {
|
|
67
67
|
"content-type": "application/json",
|
|
68
|
-
...
|
|
69
|
-
},
|
|
68
|
+
...x(a)
|
|
69
|
+
}, o, S(a), {
|
|
70
70
|
batchMax: t,
|
|
71
71
|
batchInterval: n
|
|
72
72
|
}).then((e) => {
|
|
@@ -78,83 +78,83 @@ function le({ uri: e, batchMax: t, batchInterval: n }) {
|
|
|
78
78
|
};
|
|
79
79
|
}));
|
|
80
80
|
}
|
|
81
|
-
function
|
|
82
|
-
let { gateway:
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
gateway:
|
|
81
|
+
function C(a) {
|
|
82
|
+
let { gateway: s, baseUrl: g, authToken: v, workspaceToken: y, locale: x, geography: S, organizationId: C, productId: w, workspaceId: T, projectId: E, tenantId: D, cache: O, enableSubscriptions: k = !1, sseUrl: ue, onAuthError: A, onRefreshToken: j, onNetworkError: M, onNetworkStatusChange: N, onMutationSuccess: P, maxRetryAttempts: de = 3, batchMax: fe = 10, batchInterval: pe, debug: F = !1 } = a, I = null, L = null, me = (e) => {
|
|
83
|
+
L ||= setTimeout(() => {
|
|
84
|
+
L = null, I && I.refetchQueries({ include: "active" }).catch((t) => {
|
|
85
|
+
F && console.warn("[GraphQL] Active query refresh failed after mutation:", {
|
|
86
|
+
gateway: s,
|
|
87
87
|
operationName: e,
|
|
88
88
|
error: t
|
|
89
89
|
});
|
|
90
90
|
});
|
|
91
91
|
}, 0);
|
|
92
|
-
},
|
|
93
|
-
uri: n(t(
|
|
92
|
+
}, R = e[s], z = le({
|
|
93
|
+
uri: n(t(g, s)),
|
|
94
94
|
batchMax: fe,
|
|
95
95
|
batchInterval: pe
|
|
96
|
-
}),
|
|
97
|
-
let n = t.headers ?? {}, r = typeof
|
|
96
|
+
}), B = d((e, t) => {
|
|
97
|
+
let n = t.headers ?? {}, r = typeof v == "function" ? v() : v;
|
|
98
98
|
return { headers: {
|
|
99
99
|
...n,
|
|
100
100
|
...r ? { authorization: `Bearer ${r}` } : {}
|
|
101
101
|
} };
|
|
102
|
-
}),
|
|
103
|
-
let n = t.headers ?? {}, r = typeof
|
|
102
|
+
}), V = d((e, t) => {
|
|
103
|
+
let n = t.headers ?? {}, r = typeof x == "function" ? x() : x;
|
|
104
104
|
return { headers: {
|
|
105
105
|
...n,
|
|
106
106
|
...r ? { "accept-language": r } : {}
|
|
107
107
|
} };
|
|
108
|
-
}),
|
|
109
|
-
let n = t.headers ?? {}, r = typeof
|
|
108
|
+
}), H = d((e, t) => {
|
|
109
|
+
let n = t.headers ?? {}, r = typeof S == "function" ? S() : null;
|
|
110
110
|
return { headers: {
|
|
111
111
|
...n,
|
|
112
112
|
...r?.country ? { "x-geo-country": r.country } : {},
|
|
113
113
|
...r?.currency ? { "x-geo-currency": r.currency } : {},
|
|
114
114
|
...r?.timezone ? { "x-geo-timezone": r.timezone } : {}
|
|
115
115
|
} };
|
|
116
|
-
}),
|
|
117
|
-
let n = t.headers ?? {}, r = typeof
|
|
116
|
+
}), U = d((e, t) => {
|
|
117
|
+
let n = t.headers ?? {}, r = typeof C == "function" ? C() : C;
|
|
118
118
|
return { headers: {
|
|
119
119
|
...n,
|
|
120
120
|
...r ? { "x-org-id": r } : {}
|
|
121
121
|
} };
|
|
122
|
-
}),
|
|
123
|
-
let n = t.headers ?? {}, r = typeof
|
|
122
|
+
}), W = d((e, t) => {
|
|
123
|
+
let n = t.headers ?? {}, r = typeof w == "function" ? w() : w;
|
|
124
124
|
return { headers: {
|
|
125
125
|
...n,
|
|
126
126
|
...r ? { "x-product-id": r } : {}
|
|
127
127
|
} };
|
|
128
|
-
}),
|
|
129
|
-
let n = t.headers ?? {}, r = (typeof
|
|
128
|
+
}), G = d((e, t) => {
|
|
129
|
+
let n = t.headers ?? {}, r = (typeof T == "function" ? T() : T) || ae(e.variables);
|
|
130
130
|
return { headers: {
|
|
131
131
|
...n,
|
|
132
132
|
...r ? { "x-workspace-id": r } : {}
|
|
133
133
|
} };
|
|
134
|
-
}),
|
|
135
|
-
let n = t.headers ?? {}, r = (typeof
|
|
134
|
+
}), K = d((e, t) => {
|
|
135
|
+
let n = t.headers ?? {}, r = (typeof E == "function" ? E() : E) || oe(e.variables);
|
|
136
136
|
return { headers: {
|
|
137
137
|
...n,
|
|
138
138
|
...r ? { "x-project-id": r } : {}
|
|
139
139
|
} };
|
|
140
|
-
}),
|
|
141
|
-
let n = t.headers ?? {}, r = typeof
|
|
140
|
+
}), q = d((e, t) => {
|
|
141
|
+
let n = t.headers ?? {}, r = typeof D == "function" ? D() : D;
|
|
142
142
|
return { headers: {
|
|
143
143
|
...n,
|
|
144
144
|
...r ? { "x-tenant-id": r } : {}
|
|
145
145
|
} };
|
|
146
|
-
}),
|
|
147
|
-
let n = t.headers ?? {}, i = typeof
|
|
148
|
-
workspaceId: typeof
|
|
149
|
-
organizationId: typeof
|
|
150
|
-
tenantId: typeof
|
|
151
|
-
projectId: typeof
|
|
146
|
+
}), J = d((e, t) => {
|
|
147
|
+
let n = t.headers ?? {}, i = typeof y == "function" ? y() : y, a = r(i, {
|
|
148
|
+
workspaceId: typeof T == "function" ? T() : T,
|
|
149
|
+
organizationId: typeof C == "function" ? C() : C,
|
|
150
|
+
tenantId: typeof D == "function" ? D() : D,
|
|
151
|
+
projectId: typeof E == "function" ? E() : E
|
|
152
152
|
}) ? i : null;
|
|
153
153
|
return { headers: {
|
|
154
154
|
...n,
|
|
155
155
|
...a ? { "x-workspace-authorization": `Bearer ${a}` } : {}
|
|
156
156
|
} };
|
|
157
|
-
}),
|
|
157
|
+
}), Y = new u({
|
|
158
158
|
delay: {
|
|
159
159
|
initial: 1e3,
|
|
160
160
|
max: 8e3,
|
|
@@ -163,23 +163,23 @@ function S(a) {
|
|
|
163
163
|
attempts: {
|
|
164
164
|
max: de,
|
|
165
165
|
retryIf: (e) => {
|
|
166
|
-
if (
|
|
166
|
+
if (b() || !e) return !1;
|
|
167
167
|
let t = e.message?.toLowerCase?.() ?? "";
|
|
168
168
|
return !(t.includes("401") || t.includes("403") || t.includes("unauthorized") || t.includes("forbidden") || t.includes("unauthenticated"));
|
|
169
169
|
}
|
|
170
170
|
}
|
|
171
|
-
}),
|
|
172
|
-
if (
|
|
173
|
-
|
|
171
|
+
}), he = new f((e, t) => {
|
|
172
|
+
if (b()) {
|
|
173
|
+
F && console.warn("[CircuitBreaker] Circuit is open, blocking request:", e.operationName);
|
|
174
174
|
let t = /* @__PURE__ */ Error("Network circuit breaker is open — backend appears unreachable. Retrying in 30 seconds.");
|
|
175
|
-
return
|
|
175
|
+
return M?.(t), new p((e) => {
|
|
176
176
|
e.error(t);
|
|
177
177
|
});
|
|
178
178
|
}
|
|
179
|
-
return new
|
|
179
|
+
return new p((n) => {
|
|
180
180
|
let r = t(e).subscribe({
|
|
181
181
|
next: (e) => {
|
|
182
|
-
|
|
182
|
+
ie(), _.consecutiveFailures === 0 && N?.(!1), n.next(e);
|
|
183
183
|
},
|
|
184
184
|
error: (e) => {
|
|
185
185
|
n.error(e);
|
|
@@ -196,11 +196,11 @@ function S(a) {
|
|
|
196
196
|
function Q(e) {
|
|
197
197
|
Z.forEach(({ resolve: t }) => t(e)), Z = [];
|
|
198
198
|
}
|
|
199
|
-
let
|
|
199
|
+
let ge = l(({ error: e, operation: t, forward: n }) => {
|
|
200
200
|
let r = e.errors;
|
|
201
201
|
if (r) {
|
|
202
202
|
let a = r.some((e) => e.extensions?.code === "UNAUTHENTICATED" || e.message.includes("Unauthorized") || e.message.includes("Unauthenticated"));
|
|
203
|
-
for (let e of r)
|
|
203
|
+
for (let e of r) F && console.error("[GraphQL Error]:", e.message);
|
|
204
204
|
i({ errors: r }, { operationName: t.operationName });
|
|
205
205
|
let o = new Set(["STORAGE_QUOTA_EXCEEDED", "RESOURCE_CAP_EXCEEDED"]);
|
|
206
206
|
for (let e of r) {
|
|
@@ -210,111 +210,111 @@ function S(a) {
|
|
|
210
210
|
break;
|
|
211
211
|
}
|
|
212
212
|
}
|
|
213
|
-
if (a &&
|
|
213
|
+
if (a && j) return new p((r) => {
|
|
214
214
|
(async () => {
|
|
215
215
|
if (X) if (await new Promise((e) => {
|
|
216
216
|
Z.push({ resolve: e });
|
|
217
217
|
})) {
|
|
218
218
|
let e = n(t).subscribe(r);
|
|
219
219
|
return () => e.unsubscribe();
|
|
220
|
-
} else return
|
|
220
|
+
} else return A?.(), r.error(e), () => {};
|
|
221
221
|
X = !0;
|
|
222
222
|
try {
|
|
223
|
-
let i = await
|
|
223
|
+
let i = await j();
|
|
224
224
|
if (X = !1, i) {
|
|
225
225
|
Q(!0);
|
|
226
226
|
let e = n(t).subscribe(r);
|
|
227
227
|
return () => e.unsubscribe();
|
|
228
|
-
} else return Q(!1),
|
|
228
|
+
} else return Q(!1), A?.(), r.error(e), () => {};
|
|
229
229
|
} catch {
|
|
230
|
-
return X = !1, Q(!1),
|
|
230
|
+
return X = !1, Q(!1), A?.(), r.error(e), () => {};
|
|
231
231
|
}
|
|
232
232
|
})();
|
|
233
233
|
});
|
|
234
|
-
a &&
|
|
235
|
-
} else if (
|
|
234
|
+
a && A?.(), ie();
|
|
235
|
+
} else if (F && console.error("[Network Error]:", e), re() && N?.(!0), e instanceof Error) M?.(e), i(e, {
|
|
236
236
|
operationName: t.operationName,
|
|
237
237
|
fallbackMessage: "We could not reach the server. Please check your connection and try again."
|
|
238
238
|
});
|
|
239
239
|
else {
|
|
240
240
|
let n = Error(String(e));
|
|
241
|
-
|
|
241
|
+
M?.(n), i(n, {
|
|
242
242
|
operationName: t.operationName,
|
|
243
243
|
fallbackMessage: "We could not reach the server. Please check your connection and try again."
|
|
244
244
|
});
|
|
245
245
|
}
|
|
246
|
-
}),
|
|
247
|
-
let n = se(e.query) && e.getContext().autoRefreshAfterMutation !== !1 && e.getContext().skipMutationAutoRefresh !== !0;
|
|
248
|
-
return new
|
|
249
|
-
let
|
|
246
|
+
}), _e = new f((e, t) => {
|
|
247
|
+
let n = se(e.query), r = n && e.getContext().autoRefreshAfterMutation !== !1 && e.getContext().skipMutationAutoRefresh !== !0;
|
|
248
|
+
return new p((i) => {
|
|
249
|
+
let a = t(e).subscribe({
|
|
250
250
|
next: (t) => {
|
|
251
|
-
if (
|
|
252
|
-
let
|
|
253
|
-
|
|
254
|
-
gateway:
|
|
255
|
-
operationName:
|
|
251
|
+
if (i.next(t), ce(t) || (n && o(), !r)) return;
|
|
252
|
+
let a = e.operationName || "anonymous mutation";
|
|
253
|
+
P ? Promise.resolve(P({
|
|
254
|
+
gateway: s,
|
|
255
|
+
operationName: a
|
|
256
256
|
})).catch((e) => {
|
|
257
|
-
|
|
258
|
-
gateway:
|
|
259
|
-
operationName:
|
|
257
|
+
F && console.warn("[GraphQL] Mutation refresh callback failed:", {
|
|
258
|
+
gateway: s,
|
|
259
|
+
operationName: a,
|
|
260
260
|
error: e
|
|
261
261
|
});
|
|
262
|
-
}) : me(
|
|
262
|
+
}) : me(a);
|
|
263
263
|
},
|
|
264
264
|
error: (e) => {
|
|
265
|
-
|
|
265
|
+
i.error(e);
|
|
266
266
|
},
|
|
267
267
|
complete: () => {
|
|
268
|
-
|
|
268
|
+
i.complete();
|
|
269
269
|
}
|
|
270
270
|
});
|
|
271
271
|
return () => {
|
|
272
|
-
|
|
272
|
+
a.unsubscribe();
|
|
273
273
|
};
|
|
274
274
|
});
|
|
275
|
-
}), $ =
|
|
276
|
-
J,
|
|
275
|
+
}), $ = m([
|
|
277
276
|
Y,
|
|
278
277
|
he,
|
|
279
278
|
ge,
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
279
|
+
_e,
|
|
280
|
+
B,
|
|
281
|
+
J,
|
|
283
282
|
U,
|
|
284
283
|
W,
|
|
285
284
|
G,
|
|
286
285
|
K,
|
|
287
|
-
|
|
286
|
+
q,
|
|
288
287
|
V,
|
|
289
|
-
|
|
288
|
+
H,
|
|
289
|
+
z
|
|
290
290
|
]);
|
|
291
|
-
if (
|
|
292
|
-
let e = ue || n(
|
|
293
|
-
e && ($ =
|
|
294
|
-
J,
|
|
291
|
+
if (k) {
|
|
292
|
+
let e = ue || n(g || R.defaultBaseUrl) + R.sse;
|
|
293
|
+
e && ($ = m([
|
|
295
294
|
Y,
|
|
296
295
|
he,
|
|
297
296
|
ge,
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
297
|
+
_e,
|
|
298
|
+
B,
|
|
299
|
+
J,
|
|
301
300
|
U,
|
|
302
301
|
W,
|
|
303
302
|
G,
|
|
304
303
|
K,
|
|
305
|
-
|
|
304
|
+
q,
|
|
306
305
|
V,
|
|
306
|
+
H,
|
|
307
307
|
ne(({ query: e }) => {
|
|
308
|
-
let t =
|
|
308
|
+
let t = h(e);
|
|
309
309
|
return t.kind === "OperationDefinition" && t.operation === "subscription";
|
|
310
|
-
}, new
|
|
310
|
+
}, new c({
|
|
311
311
|
url: e,
|
|
312
312
|
headers: {},
|
|
313
|
-
debug:
|
|
314
|
-
}),
|
|
313
|
+
debug: F
|
|
314
|
+
}), z)
|
|
315
315
|
]));
|
|
316
316
|
}
|
|
317
|
-
let
|
|
317
|
+
let ve = new te({ typePolicies: {
|
|
318
318
|
File: { keyFields: ["id"] },
|
|
319
319
|
Folder: { keyFields: ["id"] },
|
|
320
320
|
Tag: { keyFields: ["id"] },
|
|
@@ -349,9 +349,9 @@ function S(a) {
|
|
|
349
349
|
VibecontrolsAgent: { keyFields: ["id"] },
|
|
350
350
|
Query: { fields: { vibes: { keyArgs: ["filter"] } } }
|
|
351
351
|
} });
|
|
352
|
-
return
|
|
352
|
+
return I = new ee({
|
|
353
353
|
link: $,
|
|
354
|
-
cache:
|
|
354
|
+
cache: O ?? ve,
|
|
355
355
|
defaultOptions: {
|
|
356
356
|
watchQuery: {
|
|
357
357
|
fetchPolicy: "cache-and-network",
|
|
@@ -363,19 +363,19 @@ function S(a) {
|
|
|
363
363
|
},
|
|
364
364
|
mutate: { errorPolicy: "all" }
|
|
365
365
|
}
|
|
366
|
-
}),
|
|
366
|
+
}), I;
|
|
367
367
|
}
|
|
368
|
-
var
|
|
369
|
-
function
|
|
368
|
+
var w = null, T = null;
|
|
369
|
+
function E(e) {
|
|
370
370
|
let { workspaceBaseUrl: t, globalBaseUrl: n, authToken: r, enableSubscriptions: i = !1, onAuthError: a, debug: o = !1 } = e;
|
|
371
|
-
|
|
371
|
+
w = C({
|
|
372
372
|
gateway: "workspace",
|
|
373
373
|
baseUrl: t,
|
|
374
374
|
authToken: r,
|
|
375
375
|
enableSubscriptions: i,
|
|
376
376
|
onAuthError: a,
|
|
377
377
|
debug: o
|
|
378
|
-
}),
|
|
378
|
+
}), T = C({
|
|
379
379
|
gateway: "global",
|
|
380
380
|
baseUrl: n,
|
|
381
381
|
authToken: r,
|
|
@@ -383,16 +383,16 @@ function T(e) {
|
|
|
383
383
|
debug: o
|
|
384
384
|
});
|
|
385
385
|
}
|
|
386
|
-
function E() {
|
|
387
|
-
if (!C) throw Error("Workspace client not initialized. Call initializeAppClients first.");
|
|
388
|
-
return C;
|
|
389
|
-
}
|
|
390
386
|
function D() {
|
|
391
|
-
if (!w) throw Error("
|
|
387
|
+
if (!w) throw Error("Workspace client not initialized. Call initializeAppClients first.");
|
|
392
388
|
return w;
|
|
393
389
|
}
|
|
394
390
|
function O() {
|
|
395
|
-
|
|
391
|
+
if (!T) throw Error("Global client not initialized. Call initializeAppClients first.");
|
|
392
|
+
return T;
|
|
393
|
+
}
|
|
394
|
+
function k() {
|
|
395
|
+
w &&= (w.clearStore(), null), T &&= (T.clearStore(), null);
|
|
396
396
|
}
|
|
397
397
|
//#endregion
|
|
398
|
-
export {
|
|
398
|
+
export { C as createGraphQLClient, O as getGlobalClient, D as getWorkspaceClient, E as initializeAppClients, k as resetAppClients };
|
|
@@ -106,6 +106,29 @@ export interface EnqueueGraphQLFetchOptions {
|
|
|
106
106
|
batchMax?: number;
|
|
107
107
|
batchInterval?: number;
|
|
108
108
|
}
|
|
109
|
+
/**
|
|
110
|
+
* Drop the short-lived GraphQL read caches so the next read of any operation
|
|
111
|
+
* hits the network.
|
|
112
|
+
*
|
|
113
|
+
* `enqueueGraphQLFetch` keeps two read-side maps so a page-load burst of
|
|
114
|
+
* identical reads coalesces into one request:
|
|
115
|
+
* - `__graphqlFetchResponseCache` — RESOLVED responses, kept for
|
|
116
|
+
* `RECENT_QUERY_CACHE_TTL_MS`.
|
|
117
|
+
* - `__graphqlFetchPendingResponses` — IN-FLIGHT promises, deduped by key.
|
|
118
|
+
*
|
|
119
|
+
* Both would otherwise serve a STALE result to a refetch issued right after a
|
|
120
|
+
* mutation (same operationName + variables): the resolved cache returns the
|
|
121
|
+
* pre-mutation response directly, and the pending map can coalesce the refetch
|
|
122
|
+
* onto a read that was already on the wire before the write committed. Either
|
|
123
|
+
* one makes created/updated/deleted rows invisible until a full page reload.
|
|
124
|
+
* Callers that perform a write clear both so every follow-up read is fresh.
|
|
125
|
+
*
|
|
126
|
+
* Clearing `__graphqlFetchPendingResponses` only stops FUTURE callers from
|
|
127
|
+
* coalescing onto those in-flight requests — it does not abort them. The
|
|
128
|
+
* original awaiters still hold their promise references and resolve normally,
|
|
129
|
+
* and the `.finally` cleanup deletes a key that is already gone (a safe no-op).
|
|
130
|
+
*/
|
|
131
|
+
export declare function clearGraphqlFetchResponseCache(): void;
|
|
109
132
|
export declare function enqueueGraphQLFetch(url: string, headers: Record<string, string>, body: Record<string, unknown>, signal?: AbortSignal, options?: EnqueueGraphQLFetchOptions): Promise<unknown>;
|
|
110
133
|
/**
|
|
111
134
|
* Make a GraphQL request with automatic auth + locale headers.
|
|
@@ -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,EAAE,MAAM,WAAW,CAAC;AAsBnD,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;IACtC,mCAAmC;IACnC,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB;;;;;;;;OAQG;IACH,wBAA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;AAED,6EAA6E;AAC7E,wBAAgB,uBAAuB,IAAI,MAAM,GAAG,IAAI,CAEvD;AAED,uEAAuE;AACvE,wBAAgB,iBAAiB,IAAI,MAAM,GAAG,IAAI,CAEjD;AAED,wEAAwE;AACxE,wBAAgB,kBAAkB,IAAI,MAAM,GAAG,IAAI,CAElD;AAgKD,uCAAuC;AACvC,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAK5E;AAmBD,MAAM,WAAW,0BAA0B;IACzC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAqCD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,8BAA8B,IAAI,IAAI,CAGrD;AAoMD,wBAAgB,mBAAmB,CACjC,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC/B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,MAAM,CAAC,EAAE,WAAW,EACpB,OAAO,CAAC,EAAE,0BAA0B,GACnC,OAAO,CAAC,OAAO,CAAC,CAyElB;AAgBD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,wBAAsB,YAAY,CAAC,CAAC,GAAG,OAAO,EAC5C,OAAO,EAAE,mBAAmB,GAC3B,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,CA8I7B"}
|
|
@@ -159,51 +159,54 @@ function P() {
|
|
|
159
159
|
let e = j();
|
|
160
160
|
return e.__graphqlFetchPendingResponses ||= /* @__PURE__ */ new Map(), e.__graphqlFetchPendingResponses;
|
|
161
161
|
}
|
|
162
|
-
|
|
162
|
+
function F() {
|
|
163
|
+
N().clear(), P().clear();
|
|
164
|
+
}
|
|
165
|
+
var I = 10, L = 600, R = 100, z = 1e4, B = 15e3, V = new Set([
|
|
163
166
|
"traceparent",
|
|
164
167
|
"tracestate",
|
|
165
168
|
"baggage"
|
|
166
169
|
]);
|
|
167
|
-
function
|
|
168
|
-
if (typeof performance > "u") return
|
|
170
|
+
function H() {
|
|
171
|
+
if (typeof performance > "u") return R;
|
|
169
172
|
let e = j();
|
|
170
|
-
return e.__graphqlFetchBurstStartedAt ??= performance.now(), performance.now() - e.__graphqlFetchBurstStartedAt <
|
|
173
|
+
return e.__graphqlFetchBurstStartedAt ??= performance.now(), performance.now() - e.__graphqlFetchBurstStartedAt < z ? L : R;
|
|
171
174
|
}
|
|
172
|
-
function
|
|
175
|
+
function U(e) {
|
|
173
176
|
return typeof e.query == "string" ? /^\s*query\b/.test(e.query) : !1;
|
|
174
177
|
}
|
|
175
|
-
function
|
|
178
|
+
function W(e) {
|
|
176
179
|
return typeof e.operationName == "string" && e.operationName.length > 0 ? {
|
|
177
180
|
operationName: e.operationName,
|
|
178
181
|
variables: e.variables ?? null
|
|
179
182
|
} : e;
|
|
180
183
|
}
|
|
181
|
-
function
|
|
184
|
+
function G(e) {
|
|
182
185
|
let t = /* @__PURE__ */ new Map();
|
|
183
186
|
for (let [n, r] of Object.entries(e)) {
|
|
184
187
|
let e = n.toLowerCase();
|
|
185
|
-
|
|
188
|
+
V.has(e) || t.set(e, r);
|
|
186
189
|
}
|
|
187
190
|
return Object.fromEntries(Array.from(t.entries()).sort(([e], [t]) => e.localeCompare(t)));
|
|
188
191
|
}
|
|
189
|
-
function
|
|
192
|
+
function K(t) {
|
|
190
193
|
let n = e();
|
|
191
194
|
return {
|
|
192
195
|
...t,
|
|
193
196
|
traceparent: n.traceparent
|
|
194
197
|
};
|
|
195
198
|
}
|
|
196
|
-
function K(e) {
|
|
197
|
-
return J(e) && Array.isArray(e.errors);
|
|
198
|
-
}
|
|
199
199
|
function q(e) {
|
|
200
|
+
return Y(e) && Array.isArray(e.errors);
|
|
201
|
+
}
|
|
202
|
+
function J(e) {
|
|
200
203
|
let t = e.status;
|
|
201
204
|
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.";
|
|
202
205
|
}
|
|
203
|
-
function
|
|
206
|
+
function Y(e) {
|
|
204
207
|
return typeof e == "object" && !!e && !Array.isArray(e);
|
|
205
208
|
}
|
|
206
|
-
async function
|
|
209
|
+
async function X(e) {
|
|
207
210
|
let t = await e.text();
|
|
208
211
|
if (!t) return null;
|
|
209
212
|
try {
|
|
@@ -212,21 +215,21 @@ async function Y(e) {
|
|
|
212
215
|
return t;
|
|
213
216
|
}
|
|
214
217
|
}
|
|
215
|
-
async function
|
|
218
|
+
async function Z(e, t, n) {
|
|
216
219
|
if (n.length === 1) {
|
|
217
220
|
let r = n[0];
|
|
218
221
|
try {
|
|
219
222
|
let n = await fetch(e, {
|
|
220
223
|
method: "POST",
|
|
221
|
-
headers:
|
|
224
|
+
headers: K(t),
|
|
222
225
|
credentials: "include",
|
|
223
226
|
body: JSON.stringify(r.body),
|
|
224
227
|
signal: r.signal
|
|
225
|
-
}), i = await
|
|
226
|
-
if (!n.ok && !
|
|
228
|
+
}), i = await X(n);
|
|
229
|
+
if (!n.ok && !q(i)) throw Error(J(n));
|
|
227
230
|
r.cacheKey && N().set(r.cacheKey, {
|
|
228
231
|
value: i,
|
|
229
|
-
expiresAt: Date.now() +
|
|
232
|
+
expiresAt: Date.now() + B
|
|
230
233
|
}), r.resolve(i);
|
|
231
234
|
} catch (e) {
|
|
232
235
|
r.reject(e);
|
|
@@ -237,29 +240,29 @@ async function X(e, t, n) {
|
|
|
237
240
|
try {
|
|
238
241
|
let i = await fetch(e, {
|
|
239
242
|
method: "POST",
|
|
240
|
-
headers:
|
|
243
|
+
headers: K(t),
|
|
241
244
|
credentials: "include",
|
|
242
245
|
body: JSON.stringify(r)
|
|
243
|
-
}), a = await
|
|
244
|
-
if (!i.ok && !
|
|
246
|
+
}), a = await X(i);
|
|
247
|
+
if (!i.ok && !q(a)) throw Error(J(i));
|
|
245
248
|
Array.isArray(a) ? a.forEach((e, t) => {
|
|
246
249
|
let r = n[t];
|
|
247
250
|
r && (r.cacheKey && N().set(r.cacheKey, {
|
|
248
251
|
value: e,
|
|
249
|
-
expiresAt: Date.now() +
|
|
252
|
+
expiresAt: Date.now() + B
|
|
250
253
|
}), r.resolve(e));
|
|
251
254
|
}) : n.forEach((e) => {
|
|
252
255
|
e.cacheKey && N().set(e.cacheKey, {
|
|
253
256
|
value: a,
|
|
254
|
-
expiresAt: Date.now() +
|
|
257
|
+
expiresAt: Date.now() + B
|
|
255
258
|
}), e.resolve(a);
|
|
256
259
|
});
|
|
257
260
|
} catch (e) {
|
|
258
261
|
n.forEach((t) => t.reject(e));
|
|
259
262
|
}
|
|
260
263
|
}
|
|
261
|
-
function
|
|
262
|
-
let a =
|
|
264
|
+
function Q(e, t, n, r, i) {
|
|
265
|
+
let a = G(t), o = Math.max(1, i?.batchMax ?? I), s = Math.max(0, i?.batchInterval ?? H()), c = `${e}|${JSON.stringify(a)}`, l = U(n) ? `${c}|${JSON.stringify(W(n))}` : void 0;
|
|
263
266
|
if (l) {
|
|
264
267
|
let e = N(), t = e.get(l);
|
|
265
268
|
if (t) {
|
|
@@ -271,7 +274,7 @@ function Z(e, t, n, r, i) {
|
|
|
271
274
|
}
|
|
272
275
|
let u = new Promise((t, i) => {
|
|
273
276
|
if (o <= 1) {
|
|
274
|
-
|
|
277
|
+
Z(e, a, [{
|
|
275
278
|
body: n,
|
|
276
279
|
resolve: t,
|
|
277
280
|
reject: i,
|
|
@@ -293,20 +296,20 @@ function Z(e, t, n, r, i) {
|
|
|
293
296
|
signal: r,
|
|
294
297
|
cacheKey: l
|
|
295
298
|
}), d.requests.length >= d.batchMax) {
|
|
296
|
-
|
|
299
|
+
$(e, a, c);
|
|
297
300
|
return;
|
|
298
301
|
}
|
|
299
|
-
d.timer ||= setTimeout(() =>
|
|
302
|
+
d.timer ||= setTimeout(() => $(e, a, c), d.batchInterval);
|
|
300
303
|
});
|
|
301
304
|
return l && (P().set(l, u), u.finally(() => {
|
|
302
305
|
P().delete(l);
|
|
303
306
|
}).catch(() => {})), u;
|
|
304
307
|
}
|
|
305
|
-
function
|
|
308
|
+
function $(e, t, n) {
|
|
306
309
|
let r = M(), i = r.get(n);
|
|
307
|
-
i && (r.delete(n), i.timer &&= (clearTimeout(i.timer), null),
|
|
310
|
+
i && (r.delete(n), i.timer &&= (clearTimeout(i.timer), null), Z(e, t, i.requests));
|
|
308
311
|
}
|
|
309
|
-
async function
|
|
312
|
+
async function ee(e) {
|
|
310
313
|
let { gateway: t, query: n, variables: r, operationName: i, authToken: a, workspaceToken: o, workspaceId: c, organizationId: p, tenantId: m, projectId: _, locale: v, baseUrl: S, extraHeaders: C, signal: T, suppressGlobalErrorEvent: E } = e, O = l(A(t, S)), j = a && !y(a) ? a : h(), M = v ?? x(), N = D({
|
|
311
314
|
workspaceId: c,
|
|
312
315
|
organizationId: p,
|
|
@@ -349,7 +352,7 @@ async function $(e) {
|
|
|
349
352
|
let L = { query: n };
|
|
350
353
|
r && (L.variables = r), i && (L.operationName = i);
|
|
351
354
|
try {
|
|
352
|
-
let e = await
|
|
355
|
+
let e = await Q(O, P, L, T);
|
|
353
356
|
return f(), e.errors?.length && !E && d({ errors: e.errors }, { operationName: i }), e;
|
|
354
357
|
} catch (e) {
|
|
355
358
|
throw E || d(e, {
|
|
@@ -359,4 +362,4 @@ async function $(e) {
|
|
|
359
362
|
}
|
|
360
363
|
}
|
|
361
364
|
//#endregion
|
|
362
|
-
export {
|
|
365
|
+
export { F as clearGraphqlFetchResponseCache, Q as enqueueGraphQLFetch, h as getStoredAuthToken, x as getStoredLocale, C as getStoredOrganizationId, T as getStoredProjectId, S as getStoredWorkspaceId, g as getStoredWorkspaceToken, ee as graphqlFetch, A as resolveGatewayUrl };
|