reactjrx 1.91.0 → 1.93.0
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/index.cjs +1 -1
- package/dist/index.js +673 -681
- package/dist/lib/binding/useObserve.d.ts +1 -1
- package/dist/lib/binding/useSubscribe.d.ts +1 -1
- package/dist/lib/binding/useSubscribeEffect.d.ts +1 -1
- package/dist/lib/queries/client/QueryClient.d.ts +11 -11
- package/dist/lib/queries/client/keys/hashKey.d.ts +1 -1
- package/dist/lib/queries/client/mutations/cache/MutationCache.d.ts +5 -5
- package/dist/lib/queries/client/mutations/cache/types.d.ts +2 -2
- package/dist/lib/queries/client/mutations/mutation/Mutation.d.ts +3 -3
- package/dist/lib/queries/client/mutations/mutation/observeUntilFinished.d.ts +1 -1
- package/dist/lib/queries/client/mutations/mutation/types.d.ts +3 -3
- package/dist/lib/queries/client/mutations/observers/MutationObserver.d.ts +6 -6
- package/dist/lib/queries/client/mutations/observers/types.d.ts +2 -2
- package/dist/lib/queries/client/mutations/runner/MutationRunner.d.ts +4 -4
- package/dist/lib/queries/client/mutations/types.d.ts +3 -3
- package/dist/lib/queries/client/mutations/utils/distinctUntilStateChanged.d.ts +1 -1
- package/dist/lib/queries/client/queries/cache/QueryCache.d.ts +7 -7
- package/dist/lib/queries/client/queries/cache/types.d.ts +4 -4
- package/dist/lib/queries/client/queries/observer/QueryObserver.d.ts +7 -7
- package/dist/lib/queries/client/queries/observer/queryStateHelpers.d.ts +2 -2
- package/dist/lib/queries/client/queries/observer/types.d.ts +4 -4
- package/dist/lib/queries/client/queries/query/Query.d.ts +7 -7
- package/dist/lib/queries/client/queries/query/delayOnNetworkMode.d.ts +2 -2
- package/dist/lib/queries/client/queries/query/execution/executeQuery.d.ts +3 -3
- package/dist/lib/queries/client/queries/query/getDefaultState.d.ts +2 -2
- package/dist/lib/queries/client/queries/query/operators.d.ts +2 -2
- package/dist/lib/queries/client/queries/query/state/whenNewData.d.ts +1 -1
- package/dist/lib/queries/client/queries/query/types.d.ts +4 -4
- package/dist/lib/queries/client/queries/types.d.ts +6 -6
- package/dist/lib/queries/client/queries/utils.d.ts +2 -2
- package/dist/lib/queries/client/tests/utils.d.ts +2 -2
- package/dist/lib/queries/client/types.d.ts +2 -2
- package/dist/lib/queries/react/QueryClientProvider.d.ts +1 -1
- package/dist/lib/queries/react/mutations/types.d.ts +2 -2
- package/dist/lib/queries/react/mutations/useIsMutating.d.ts +1 -1
- package/dist/lib/queries/react/mutations/useMutation.d.ts +2 -2
- package/dist/lib/queries/react/mutations/useMutationState.d.ts +3 -3
- package/dist/lib/queries/react/queries/errorBoundaryUtils.d.ts +4 -4
- package/dist/lib/queries/react/queries/queryOptions.d.ts +3 -3
- package/dist/lib/queries/react/queries/types.d.ts +3 -3
- package/dist/lib/queries/react/queries/useBaseQuery.d.ts +4 -4
- package/dist/lib/queries/react/queries/useForeverQuery.d.ts +4 -4
- package/dist/lib/queries/react/queries/useIsFetching.d.ts +1 -1
- package/dist/lib/queries/react/queries/useQuery.d.ts +4 -4
- package/dist/lib/state/persistance/types.d.ts +5 -5
- package/dist/lib/state/signal.d.ts +1 -1
- package/dist/tests/utils.d.ts +2 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,26 +1,22 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
if (!e.has(s))
|
|
5
|
-
throw TypeError("Cannot " + t);
|
|
1
|
+
var Yt = Object.defineProperty;
|
|
2
|
+
var yt = (s) => {
|
|
3
|
+
throw TypeError(s);
|
|
6
4
|
};
|
|
7
|
-
var
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
e instanceof WeakSet ? e.add(s) : e.set(s, t);
|
|
11
|
-
}, M = (s, e, t, r) => (yt(s, e, "write to private field"), r ? r.call(s, t) : e.set(s, t), t);
|
|
5
|
+
var Bt = (s, e, t) => e in s ? Yt(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
|
|
6
|
+
var g = (s, e, t) => Bt(s, typeof e != "symbol" ? e + "" : e, t), bt = (s, e, t) => e.has(s) || yt("Cannot " + t);
|
|
7
|
+
var a = (s, e, t) => (bt(s, e, "read from private field"), t ? t.call(s) : e.get(s)), w = (s, e, t) => e.has(s) ? yt("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(s) : e.set(s, t), A = (s, e, t, r) => (bt(s, e, "write to private field"), r ? r.call(s, t) : e.set(s, t), t);
|
|
12
8
|
import * as Ge from "react";
|
|
13
|
-
import { useRef as me, useMemo as ut, useCallback as
|
|
14
|
-
import { distinctUntilChanged as
|
|
15
|
-
import { catchError as
|
|
16
|
-
import { jsxs as
|
|
17
|
-
const
|
|
9
|
+
import { useRef as me, useMemo as ut, useCallback as de, useSyncExternalStore as Xt, useEffect as J, createContext as Zt, memo as es, useContext as ts, useState as jt } from "react";
|
|
10
|
+
import { distinctUntilChanged as U, tap as R, catchError as X, EMPTY as Z, isObservable as gt, from as Se, of as v, defer as Ae, Subject as I, BehaviorSubject as Y, skip as at, first as Je, map as b, switchMap as j, zip as ss, filter as O, merge as C, throttleTime as rs, asyncScheduler as ns, throwError as Oe, timer as Qe, Observable as is, takeWhile as Ye, concatMap as us, last as Ke, mergeMap as q, takeUntil as ne, identity as Mt, shareReplay as Ue, ignoreElements as ie, scan as Be, fromEvent as Ne, noop as N, startWith as he, pairwise as At, NEVER as qe, delay as ot, interval as as, withLatestFrom as mt, retry as os, iif as cs, share as ue, isEmpty as ls, concat as Te, toArray as ke, take as He, combineLatest as hs, endWith as ds, lastValueFrom as fs } from "rxjs";
|
|
11
|
+
import { catchError as St, mergeMap as tt, retryWhen as ps, concatMap as ys, first as bs, tap as Qt } from "rxjs/operators";
|
|
12
|
+
import { jsxs as gs, jsx as ms } from "react/jsx-runtime";
|
|
13
|
+
const H = (s) => {
|
|
18
14
|
const e = me(s);
|
|
19
15
|
return ut(() => {
|
|
20
16
|
e.current = s;
|
|
21
17
|
}, [s]), e;
|
|
22
18
|
};
|
|
23
|
-
function
|
|
19
|
+
function Ss(s, e) {
|
|
24
20
|
return typeof s == "string" && s === e || typeof s == "number" && s === e || typeof s == "boolean" && s === e || typeof s == "symbol" && s === e || typeof s == "bigint" && s === e || typeof s > "u" && s === e || s === null && s === e;
|
|
25
21
|
}
|
|
26
22
|
function Xe(s, e, t) {
|
|
@@ -29,50 +25,47 @@ function Xe(s, e, t) {
|
|
|
29
25
|
unsubscribeOnUnmount: !0
|
|
30
26
|
}, n = !t && Array.isArray(e) ? e : typeof s == "function" ? t ?? [] : [s], u = me(
|
|
31
27
|
"getValue" in s && typeof s.getValue == "function" ? s.getValue() : r.defaultValue
|
|
32
|
-
), i =
|
|
28
|
+
), i = H(s), c = H(r), l = de(
|
|
33
29
|
(p) => {
|
|
34
|
-
const
|
|
30
|
+
const F = i.current, f = (typeof F == "function" ? F : () => F)().pipe(
|
|
35
31
|
/**
|
|
36
32
|
* @important
|
|
37
33
|
* We only check primitives because underlying subscription might
|
|
38
34
|
* be using objects and keeping same reference but pushing new
|
|
39
35
|
* properties values
|
|
40
36
|
*/
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
u.current =
|
|
37
|
+
U(Ss),
|
|
38
|
+
R((y) => {
|
|
39
|
+
u.current = y;
|
|
44
40
|
}),
|
|
45
|
-
X((
|
|
41
|
+
X((y) => (console.error(y), Z))
|
|
46
42
|
).subscribe(p);
|
|
47
43
|
return () => {
|
|
48
|
-
c.current.unsubscribeOnUnmount !== !1 &&
|
|
44
|
+
c.current.unsubscribeOnUnmount !== !1 && f.unsubscribe();
|
|
49
45
|
};
|
|
50
46
|
},
|
|
51
47
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
52
48
|
[...n]
|
|
53
|
-
), h =
|
|
54
|
-
return
|
|
49
|
+
), h = de(() => u.current, []);
|
|
50
|
+
return Xt(l, h, h);
|
|
55
51
|
}
|
|
56
|
-
function
|
|
52
|
+
function vt(s) {
|
|
57
53
|
return s instanceof Promise || s && typeof s.then == "function" && typeof s.catch == "function";
|
|
58
54
|
}
|
|
59
|
-
function
|
|
60
|
-
if (
|
|
61
|
-
|
|
62
|
-
if (
|
|
63
|
-
return Se(s);
|
|
64
|
-
if (typeof s != "function")
|
|
65
|
-
return v(s);
|
|
55
|
+
function V(s) {
|
|
56
|
+
if (gt(s)) return s;
|
|
57
|
+
if (vt(s)) return Se(s);
|
|
58
|
+
if (typeof s != "function") return v(s);
|
|
66
59
|
const e = s;
|
|
67
60
|
return Ae(() => {
|
|
68
61
|
const t = e();
|
|
69
|
-
return
|
|
62
|
+
return vt(t) ? Se(t) : gt(t) ? t : v(t);
|
|
70
63
|
});
|
|
71
64
|
}
|
|
72
|
-
function
|
|
73
|
-
const t =
|
|
65
|
+
function Ut(s, e = []) {
|
|
66
|
+
const t = H(s);
|
|
74
67
|
J(() => {
|
|
75
|
-
const r =
|
|
68
|
+
const r = V(t.current).subscribe();
|
|
76
69
|
return () => {
|
|
77
70
|
r.unsubscribe();
|
|
78
71
|
};
|
|
@@ -87,11 +80,11 @@ const Ze = (s) => {
|
|
|
87
80
|
return e.current || (e.current = s()), J(() => {
|
|
88
81
|
process.env.NODE_ENV;
|
|
89
82
|
}, []), e;
|
|
90
|
-
},
|
|
83
|
+
}, Vt = ({
|
|
91
84
|
onBeforeComplete: s,
|
|
92
85
|
completeOnUnmount: e = !0
|
|
93
86
|
} = {}) => {
|
|
94
|
-
const t = Ze(() => new I()), r = me(!1), n =
|
|
87
|
+
const t = Ze(() => new I()), r = me(!1), n = H(s), u = H(e);
|
|
95
88
|
return J(() => (r.current && (t.current = new I(), r.current = !1), () => {
|
|
96
89
|
if (!u.current) {
|
|
97
90
|
r.current = !0;
|
|
@@ -99,8 +92,8 @@ const Ze = (s) => {
|
|
|
99
92
|
}
|
|
100
93
|
r.current || (n.current != null && n.current(), t.current.complete(), r.current = !0);
|
|
101
94
|
}), [u, n, t]), t;
|
|
102
|
-
},
|
|
103
|
-
const s =
|
|
95
|
+
}, br = () => {
|
|
96
|
+
const s = Vt(), e = H(s.current.asObservable()), t = de(
|
|
104
97
|
(r) => {
|
|
105
98
|
s.current.next(r);
|
|
106
99
|
},
|
|
@@ -113,8 +106,8 @@ const Ze = (s) => {
|
|
|
113
106
|
return J(() => (t.current && (e.current = new Y(r.current), t.current = !1), () => {
|
|
114
107
|
t.current || (e.current.complete(), t.current = !0);
|
|
115
108
|
}), [e]), e;
|
|
116
|
-
},
|
|
117
|
-
const e = It(s), t =
|
|
109
|
+
}, gr = (s) => {
|
|
110
|
+
const e = It(s), t = H(e.current.asObservable()), r = de(
|
|
118
111
|
(n) => {
|
|
119
112
|
e.current.next(n);
|
|
120
113
|
},
|
|
@@ -122,20 +115,19 @@ const Ze = (s) => {
|
|
|
122
115
|
[e.current]
|
|
123
116
|
);
|
|
124
117
|
return [t.current, r, e.current.getValue()];
|
|
125
|
-
},
|
|
126
|
-
function
|
|
118
|
+
}, vs = Symbol("SIGNAL_RESET");
|
|
119
|
+
function mr(s = {}) {
|
|
127
120
|
const e = {
|
|
128
121
|
default: s.default,
|
|
129
122
|
key: s.key
|
|
130
123
|
}, { default: t } = e ?? {}, r = new Y(t), n = (i) => {
|
|
131
124
|
if (typeof i == "function") {
|
|
132
125
|
const c = i(r.getValue());
|
|
133
|
-
if (c === r.getValue())
|
|
134
|
-
return;
|
|
126
|
+
if (c === r.getValue()) return;
|
|
135
127
|
r.next(c);
|
|
136
128
|
return;
|
|
137
129
|
}
|
|
138
|
-
if (i ===
|
|
130
|
+
if (i === vs) {
|
|
139
131
|
r.next(t ?? void 0);
|
|
140
132
|
return;
|
|
141
133
|
}
|
|
@@ -160,12 +152,12 @@ function br(s = {}) {
|
|
|
160
152
|
subject: r
|
|
161
153
|
};
|
|
162
154
|
}
|
|
163
|
-
function
|
|
155
|
+
function Sr(s, e) {
|
|
164
156
|
const r = e ?? (() => s.getValue());
|
|
165
157
|
return Xe(
|
|
166
158
|
() => s.subject.pipe(
|
|
167
|
-
|
|
168
|
-
|
|
159
|
+
b((u) => r(u)),
|
|
160
|
+
U()
|
|
169
161
|
),
|
|
170
162
|
{
|
|
171
163
|
defaultValue: r(s.getValue())
|
|
@@ -173,7 +165,7 @@ function gr(s, e) {
|
|
|
173
165
|
[]
|
|
174
166
|
);
|
|
175
167
|
}
|
|
176
|
-
const
|
|
168
|
+
const vr = (s) => ({
|
|
177
169
|
getItem: async (e) => {
|
|
178
170
|
const t = await s.getItem(e);
|
|
179
171
|
if (t)
|
|
@@ -189,7 +181,7 @@ const mr = (s) => ({
|
|
|
189
181
|
}), st = (s) => {
|
|
190
182
|
if (!(!s || typeof s != "object"))
|
|
191
183
|
return s;
|
|
192
|
-
},
|
|
184
|
+
}, Os = ({
|
|
193
185
|
adapter: s,
|
|
194
186
|
key: e
|
|
195
187
|
}) => ({
|
|
@@ -207,10 +199,10 @@ const mr = (s) => ({
|
|
|
207
199
|
const n = await s.getItem(e), u = st(n) ?? {};
|
|
208
200
|
await s.setItem(e, { ...u, [t]: r });
|
|
209
201
|
}
|
|
210
|
-
}),
|
|
202
|
+
}), $s = ({
|
|
211
203
|
key: s
|
|
212
|
-
} = {}) => s ?
|
|
213
|
-
adapter:
|
|
204
|
+
} = {}) => s ? Os({
|
|
205
|
+
adapter: $s(),
|
|
214
206
|
key: s
|
|
215
207
|
}) : {
|
|
216
208
|
clear: async () => {
|
|
@@ -227,19 +219,19 @@ const mr = (s) => ({
|
|
|
227
219
|
setItem: async (e, t) => {
|
|
228
220
|
localStorage.setItem(e, JSON.stringify(t));
|
|
229
221
|
}
|
|
230
|
-
}, $e = "__reactjrx",
|
|
222
|
+
}, $e = "__reactjrx", ws = (s) => {
|
|
231
223
|
if (typeof s == "object" && s !== null && $e in s && s[$e] === $e)
|
|
232
224
|
return s;
|
|
233
225
|
};
|
|
234
226
|
function rt(s) {
|
|
235
227
|
return s != null;
|
|
236
228
|
}
|
|
237
|
-
const
|
|
229
|
+
const Ot = (s) => {
|
|
238
230
|
const e = It(s);
|
|
239
231
|
return J(() => {
|
|
240
232
|
e.current.next(s);
|
|
241
233
|
}, [s, e]), e;
|
|
242
|
-
},
|
|
234
|
+
}, Cs = ({
|
|
243
235
|
adapter: s,
|
|
244
236
|
config: e
|
|
245
237
|
}) => {
|
|
@@ -252,16 +244,15 @@ const vt = (s) => {
|
|
|
252
244
|
X((i) => (console.error(i), v(null)))
|
|
253
245
|
);
|
|
254
246
|
};
|
|
255
|
-
function
|
|
247
|
+
function Fs({
|
|
256
248
|
adapter: s,
|
|
257
249
|
config: e
|
|
258
250
|
}) {
|
|
259
251
|
const { hydrate: t = ({ value: u }) => u, signal: r, version: n } = e;
|
|
260
252
|
return Se(s.getItem(r.config.key)).pipe(
|
|
261
|
-
|
|
262
|
-
const i =
|
|
263
|
-
if (!i)
|
|
264
|
-
return v(u);
|
|
253
|
+
j((u) => {
|
|
254
|
+
const i = ws(u);
|
|
255
|
+
if (!i) return v(u);
|
|
265
256
|
if (i.migrationVersion !== void 0 && n > i.migrationVersion || i.value === void 0)
|
|
266
257
|
return v(u);
|
|
267
258
|
const c = i.value;
|
|
@@ -269,24 +260,24 @@ function ws({
|
|
|
269
260
|
})
|
|
270
261
|
);
|
|
271
262
|
}
|
|
272
|
-
function
|
|
263
|
+
function Or({
|
|
273
264
|
entries: s = [],
|
|
274
265
|
onReady: e,
|
|
275
266
|
adapter: t
|
|
276
267
|
}) {
|
|
277
|
-
const r =
|
|
268
|
+
const r = H(s), n = H(e), u = Ot(t), i = Xe(
|
|
278
269
|
() => {
|
|
279
270
|
const l = r.current;
|
|
280
271
|
return u.current.pipe(
|
|
281
|
-
|
|
272
|
+
j((h) => (l.length === 0 || !h ? v(!0) : ss(
|
|
282
273
|
...l.map(
|
|
283
|
-
(p) =>
|
|
274
|
+
(p) => Fs({
|
|
284
275
|
adapter: h,
|
|
285
276
|
config: p
|
|
286
277
|
})
|
|
287
278
|
)
|
|
288
|
-
).pipe(
|
|
289
|
-
|
|
279
|
+
).pipe(b(() => !0))).pipe(
|
|
280
|
+
R(() => {
|
|
290
281
|
n.current != null && n.current();
|
|
291
282
|
}),
|
|
292
283
|
X((p) => (console.error("Unable to hydrate", p), Z))
|
|
@@ -295,22 +286,22 @@ function Sr({
|
|
|
295
286
|
},
|
|
296
287
|
{ defaultValue: !1 },
|
|
297
288
|
[u, r]
|
|
298
|
-
), c =
|
|
299
|
-
return
|
|
289
|
+
), c = Ot(i);
|
|
290
|
+
return Ut(
|
|
300
291
|
() => c.current.pipe(
|
|
301
292
|
O((l) => l),
|
|
302
|
-
|
|
293
|
+
j(() => u.current),
|
|
303
294
|
O(rt),
|
|
304
|
-
|
|
305
|
-
(l) =>
|
|
295
|
+
j(
|
|
296
|
+
(l) => C(
|
|
306
297
|
...r.current.map(
|
|
307
298
|
(h) => h.signal.subject.pipe(
|
|
308
|
-
|
|
299
|
+
rs(500, ns, {
|
|
309
300
|
trailing: !0
|
|
310
301
|
}),
|
|
311
|
-
|
|
302
|
+
j(
|
|
312
303
|
() => Se(
|
|
313
|
-
|
|
304
|
+
Cs({
|
|
314
305
|
adapter: l,
|
|
315
306
|
config: h
|
|
316
307
|
})
|
|
@@ -324,21 +315,21 @@ function Sr({
|
|
|
324
315
|
[c, u]
|
|
325
316
|
), { isHydrated: i };
|
|
326
317
|
}
|
|
327
|
-
const
|
|
328
|
-
const s =
|
|
318
|
+
const $r = () => {
|
|
319
|
+
const s = Vt({
|
|
329
320
|
onBeforeComplete: () => {
|
|
330
321
|
s.current.next();
|
|
331
322
|
}
|
|
332
323
|
});
|
|
333
324
|
return s;
|
|
334
325
|
};
|
|
335
|
-
function
|
|
326
|
+
function Es(s, e) {
|
|
336
327
|
return Math.min(s, e);
|
|
337
328
|
}
|
|
338
|
-
function
|
|
329
|
+
function xs(s, e) {
|
|
339
330
|
return Math.pow(2, s) * e;
|
|
340
331
|
}
|
|
341
|
-
function
|
|
332
|
+
function Pt(s) {
|
|
342
333
|
const {
|
|
343
334
|
retry: e,
|
|
344
335
|
retryDelay: t,
|
|
@@ -353,75 +344,73 @@ function Vt(s) {
|
|
|
353
344
|
}, {
|
|
354
345
|
maxInterval: h = 1 / 0,
|
|
355
346
|
resetOnSuccess: o = !1,
|
|
356
|
-
backoffDelay: p =
|
|
347
|
+
backoffDelay: p = xs
|
|
357
348
|
} = l;
|
|
358
|
-
return (
|
|
359
|
-
let
|
|
360
|
-
const
|
|
361
|
-
return
|
|
362
|
-
|
|
363
|
-
var
|
|
364
|
-
if (
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
throw b;
|
|
369
|
-
return $.pipe(
|
|
349
|
+
return (F) => Ae(() => {
|
|
350
|
+
let d = 0;
|
|
351
|
+
const f = (y, x) => y < u ? i(y, x) : !1;
|
|
352
|
+
return F.pipe(
|
|
353
|
+
St((y) => {
|
|
354
|
+
var E;
|
|
355
|
+
if (d++, !f(d - 1, y)) throw y;
|
|
356
|
+
const x = (E = s.caughtError) == null ? void 0 : E.call(s, d, y);
|
|
357
|
+
if (!x) throw y;
|
|
358
|
+
return x.pipe(
|
|
370
359
|
tt(
|
|
371
|
-
(
|
|
372
|
-
v(
|
|
373
|
-
Oe(() =>
|
|
360
|
+
($) => C(
|
|
361
|
+
v($),
|
|
362
|
+
Oe(() => y)
|
|
374
363
|
)
|
|
375
364
|
)
|
|
376
365
|
);
|
|
377
366
|
}),
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
const
|
|
367
|
+
ps((y) => y.pipe(
|
|
368
|
+
ys((x) => {
|
|
369
|
+
const E = d - 1;
|
|
381
370
|
return n().pipe(
|
|
382
|
-
|
|
371
|
+
bs(),
|
|
383
372
|
tt(
|
|
384
|
-
() =>
|
|
385
|
-
|
|
386
|
-
p(
|
|
373
|
+
() => f(E, x) ? Qe(
|
|
374
|
+
Es(
|
|
375
|
+
p(E, c),
|
|
387
376
|
h
|
|
388
377
|
)
|
|
389
378
|
).pipe(
|
|
390
|
-
tt((
|
|
391
|
-
) : Oe(() =>
|
|
379
|
+
tt(($) => r && !r(E, x) ? Oe(() => x) : v($))
|
|
380
|
+
) : Oe(() => x)
|
|
392
381
|
)
|
|
393
382
|
);
|
|
394
383
|
})
|
|
395
384
|
)),
|
|
396
|
-
|
|
385
|
+
St((y) => {
|
|
397
386
|
if (s.catchError)
|
|
398
|
-
return s.catchError(
|
|
399
|
-
throw
|
|
387
|
+
return s.catchError(d, y);
|
|
388
|
+
throw y;
|
|
400
389
|
}),
|
|
401
|
-
|
|
402
|
-
o && (
|
|
390
|
+
Qt(() => {
|
|
391
|
+
o && (d = 0);
|
|
403
392
|
})
|
|
404
393
|
);
|
|
405
394
|
});
|
|
406
395
|
}
|
|
407
|
-
const
|
|
396
|
+
const wr = (s, e) => s.length === e.length && s.every((t, r) => t === e[r]), Rs = (s) => {
|
|
408
397
|
J(s, []);
|
|
409
|
-
},
|
|
410
|
-
|
|
398
|
+
}, Cr = (s) => {
|
|
399
|
+
Rs(() => {
|
|
411
400
|
s();
|
|
412
401
|
});
|
|
413
402
|
};
|
|
414
|
-
function
|
|
403
|
+
function $t(s) {
|
|
415
404
|
return Object.prototype.toString.call(s) === "[object Object]";
|
|
416
405
|
}
|
|
417
406
|
function nt(s) {
|
|
418
|
-
if (
|
|
407
|
+
if (!$t(s))
|
|
419
408
|
return !1;
|
|
420
409
|
const e = s.constructor;
|
|
421
410
|
if (typeof e > "u")
|
|
422
411
|
return !0;
|
|
423
412
|
const t = e.prototype;
|
|
424
|
-
return !(
|
|
413
|
+
return !(!$t(t) || !t.hasOwnProperty("isPrototypeOf"));
|
|
425
414
|
}
|
|
426
415
|
const ve = (s) => JSON.stringify(
|
|
427
416
|
s,
|
|
@@ -440,7 +429,7 @@ const ve = (s) => JSON.stringify(
|
|
|
440
429
|
function lt(s) {
|
|
441
430
|
let e = 0;
|
|
442
431
|
return function(r) {
|
|
443
|
-
return new
|
|
432
|
+
return new is((n) => {
|
|
444
433
|
e++;
|
|
445
434
|
const u = r.subscribe(n);
|
|
446
435
|
return s(e), () => {
|
|
@@ -456,40 +445,40 @@ const we = (s) => s.pipe(
|
|
|
456
445
|
)
|
|
457
446
|
);
|
|
458
447
|
var ee;
|
|
459
|
-
class
|
|
448
|
+
class js {
|
|
460
449
|
constructor({
|
|
461
450
|
__queryFinalizeHook: e
|
|
462
451
|
} = {}) {
|
|
463
|
-
|
|
464
|
-
|
|
452
|
+
w(this, ee, new I());
|
|
453
|
+
g(this, "state$");
|
|
465
454
|
const t = new Y(0), r = t.pipe(
|
|
466
455
|
O((n) => n === 0)
|
|
467
456
|
);
|
|
468
457
|
this.state$ = a(this, ee).pipe(
|
|
469
|
-
|
|
458
|
+
us(({ args: n, mutation: u, options: i }) => {
|
|
470
459
|
const c = i.mapOperator ?? "merge", l = a(this, ee).pipe(
|
|
471
460
|
O(() => c === "merge")
|
|
472
461
|
), h = a(this, ee).pipe(
|
|
473
462
|
O(() => c === "switch"),
|
|
474
|
-
|
|
463
|
+
R(() => {
|
|
475
464
|
u.cancel();
|
|
476
465
|
})
|
|
477
466
|
), o = Ae(() => (u.execute(n), Z)), p = u.state$.pipe(
|
|
478
467
|
we,
|
|
479
468
|
Ke(),
|
|
480
|
-
|
|
469
|
+
q(() => u.state$),
|
|
481
470
|
ne(a(this, ee))
|
|
482
|
-
),
|
|
471
|
+
), F = u.state$.pipe(
|
|
483
472
|
we,
|
|
484
473
|
at(1)
|
|
485
|
-
),
|
|
474
|
+
), d = C(
|
|
486
475
|
r,
|
|
487
476
|
l,
|
|
488
477
|
h,
|
|
489
478
|
u.cancelled$
|
|
490
479
|
);
|
|
491
|
-
return
|
|
492
|
-
|
|
480
|
+
return C(
|
|
481
|
+
F,
|
|
493
482
|
p,
|
|
494
483
|
/**
|
|
495
484
|
* We defer execution so that we return at least
|
|
@@ -497,9 +486,9 @@ class xs {
|
|
|
497
486
|
*/
|
|
498
487
|
o
|
|
499
488
|
).pipe(
|
|
500
|
-
|
|
501
|
-
e ??
|
|
502
|
-
ne(
|
|
489
|
+
b((f) => ({ state: f, mutation: u })),
|
|
490
|
+
e ?? Mt,
|
|
491
|
+
ne(d)
|
|
503
492
|
);
|
|
504
493
|
}),
|
|
505
494
|
Ue({
|
|
@@ -524,7 +513,7 @@ function et(s, e) {
|
|
|
524
513
|
return s === e ? !0 : typeof s != typeof e ? !1 : s && e && typeof s == "object" && typeof e == "object" ? !Object.keys(e).some((t) => !et(s[t], e[t])) : !1;
|
|
525
514
|
}
|
|
526
515
|
const _e = (s, e, { exact: t = !1 } = {}) => t ? ve(s) === ve(e) : et(s, e);
|
|
527
|
-
function
|
|
516
|
+
function P(s, e) {
|
|
528
517
|
if (s == null || e === void 0 || typeof s != "object" || typeof e != "object")
|
|
529
518
|
return s === e;
|
|
530
519
|
if (s.constructor !== (e == null ? void 0 : e.constructor))
|
|
@@ -537,24 +526,24 @@ function V(s, e) {
|
|
|
537
526
|
return !1;
|
|
538
527
|
return !0;
|
|
539
528
|
}
|
|
540
|
-
const
|
|
541
|
-
|
|
542
|
-
({ data: e, ...t }, { data: r, ...n }) =>
|
|
529
|
+
const Dt = (s) => s.pipe(
|
|
530
|
+
U(
|
|
531
|
+
({ data: e, ...t }, { data: r, ...n }) => P(t, n) && P(e, r)
|
|
543
532
|
)
|
|
544
533
|
);
|
|
545
|
-
var
|
|
546
|
-
class
|
|
534
|
+
var ae, L;
|
|
535
|
+
class Ms {
|
|
547
536
|
constructor(e, t = {}, r) {
|
|
548
|
-
|
|
549
|
-
|
|
537
|
+
w(this, ae);
|
|
538
|
+
w(this, L, new Y(void 0));
|
|
550
539
|
/**
|
|
551
540
|
* @important
|
|
552
541
|
* Used to maintain persistance to latest mutation. This ensure
|
|
553
542
|
* - mutation does not get garbage collected
|
|
554
543
|
* - mutation mutate options are run on finish
|
|
555
544
|
*/
|
|
556
|
-
|
|
557
|
-
|
|
545
|
+
g(this, "observed$");
|
|
546
|
+
g(this, "getObserverResultFromState", (e) => ({
|
|
558
547
|
...fe(),
|
|
559
548
|
...e,
|
|
560
549
|
isSuccess: e.status === "success",
|
|
@@ -567,24 +556,24 @@ class Rs {
|
|
|
567
556
|
reset: this.reset
|
|
568
557
|
}));
|
|
569
558
|
var n;
|
|
570
|
-
this.client = e, this.options = t, this.options.mutationKey = ((n = this.options) == null ? void 0 : n.mutationKey) ?? [ct()],
|
|
559
|
+
this.client = e, this.options = t, this.options.mutationKey = ((n = this.options) == null ? void 0 : n.mutationKey) ?? [ct()], A(this, ae, r ?? new js(this.options)), this.mutate = this.mutate.bind(this), this.reset = this.reset.bind(this), a(this, L).pipe(
|
|
571
560
|
O(rt),
|
|
572
|
-
|
|
573
|
-
(u) => a(this,
|
|
561
|
+
q(
|
|
562
|
+
(u) => a(this, ae).state$.pipe(
|
|
574
563
|
ne(
|
|
575
564
|
u.mutation.state$.pipe(we, Ke())
|
|
576
565
|
)
|
|
577
566
|
)
|
|
578
567
|
)
|
|
579
568
|
).subscribe(), this.observed$ = a(this, L).pipe(
|
|
580
|
-
|
|
569
|
+
j((u) => (u == null ? void 0 : u.mutation.state$.pipe(
|
|
581
570
|
// last(),
|
|
582
|
-
|
|
571
|
+
b((i) => ({
|
|
583
572
|
state: i,
|
|
584
573
|
options: u.options
|
|
585
574
|
}))
|
|
586
575
|
)) ?? Z),
|
|
587
|
-
|
|
576
|
+
R(({ state: u, options: i }) => {
|
|
588
577
|
u.status === "error" && (i != null && i.onError && (i == null || i.onError(
|
|
589
578
|
u.error,
|
|
590
579
|
u.variables,
|
|
@@ -605,7 +594,7 @@ class Rs {
|
|
|
605
594
|
u.context
|
|
606
595
|
)));
|
|
607
596
|
}),
|
|
608
|
-
|
|
597
|
+
ie()
|
|
609
598
|
);
|
|
610
599
|
}
|
|
611
600
|
setOptions(e) {
|
|
@@ -624,11 +613,11 @@ class Rs {
|
|
|
624
613
|
var u;
|
|
625
614
|
const e = this.getObserverResultFromState(
|
|
626
615
|
((u = a(this, L).getValue()) == null ? void 0 : u.mutation.state) ?? fe()
|
|
627
|
-
), t = a(this,
|
|
628
|
-
|
|
629
|
-
({ mutation: i, state: { data: c, ...l } }, { mutation: h, state: { data: o, ...p } }) => i === h &&
|
|
616
|
+
), t = a(this, ae).state$.pipe(
|
|
617
|
+
U(
|
|
618
|
+
({ mutation: i, state: { data: c, ...l } }, { mutation: h, state: { data: o, ...p } }) => i === h && P(l, p) && P(c, o)
|
|
630
619
|
),
|
|
631
|
-
|
|
620
|
+
b(({ state: i }) => i),
|
|
632
621
|
Be((i, c) => ({
|
|
633
622
|
...i,
|
|
634
623
|
...c,
|
|
@@ -639,17 +628,17 @@ class Rs {
|
|
|
639
628
|
error: c.error ?? i.error
|
|
640
629
|
}
|
|
641
630
|
})),
|
|
642
|
-
|
|
631
|
+
b((i) => this.getObserverResultFromState(i))
|
|
643
632
|
), r = a(this, L).pipe(
|
|
644
633
|
O(rt),
|
|
645
|
-
|
|
646
|
-
|
|
634
|
+
j((i) => i.mutation.cancelled$),
|
|
635
|
+
b(() => this.getObserverResultFromState(fe()))
|
|
647
636
|
);
|
|
648
|
-
return { result$:
|
|
637
|
+
return { result$: C(
|
|
649
638
|
this.observed$,
|
|
650
639
|
t,
|
|
651
640
|
r
|
|
652
|
-
).pipe(
|
|
641
|
+
).pipe(Dt), lastValue: e };
|
|
653
642
|
}
|
|
654
643
|
/**
|
|
655
644
|
* @important
|
|
@@ -665,7 +654,7 @@ class Rs {
|
|
|
665
654
|
}
|
|
666
655
|
async mutate(e, t = {}) {
|
|
667
656
|
const r = this.client.getMutationCache().build(this.client, this.options);
|
|
668
|
-
return a(this, L).next({ mutation: r, options: t }), a(this,
|
|
657
|
+
return a(this, L).next({ mutation: r, options: t }), a(this, ae).trigger({
|
|
669
658
|
args: e,
|
|
670
659
|
options: this.options,
|
|
671
660
|
mutation: r
|
|
@@ -692,30 +681,30 @@ class Rs {
|
|
|
692
681
|
a(this, L).next(void 0), e == null || e.cancel();
|
|
693
682
|
}
|
|
694
683
|
}
|
|
695
|
-
|
|
696
|
-
const
|
|
684
|
+
ae = new WeakMap(), L = new WeakMap();
|
|
685
|
+
const Tt = Zt(void 0), As = ({ client: s }) => (J(() => (s.mount(), () => {
|
|
697
686
|
s.unmount();
|
|
698
|
-
}), [s]), null),
|
|
687
|
+
}), [s]), null), Fr = es(
|
|
699
688
|
({ children: s, client: e }) => {
|
|
700
689
|
const t = ut(() => e, [e]);
|
|
701
|
-
return /* @__PURE__ */
|
|
702
|
-
/* @__PURE__ */
|
|
690
|
+
return /* @__PURE__ */ gs(Tt.Provider, { value: t, children: [
|
|
691
|
+
/* @__PURE__ */ ms(As, { client: e }),
|
|
703
692
|
s
|
|
704
693
|
] });
|
|
705
694
|
}
|
|
706
695
|
), kt = (s) => {
|
|
707
|
-
const e =
|
|
696
|
+
const e = ts(Tt);
|
|
708
697
|
if (s)
|
|
709
698
|
return s;
|
|
710
699
|
if (!e)
|
|
711
700
|
throw new Error("No QueryClient set, use QueryClientProvider to set one");
|
|
712
701
|
return e;
|
|
713
702
|
};
|
|
714
|
-
function
|
|
703
|
+
function Qs() {
|
|
715
704
|
}
|
|
716
|
-
function
|
|
717
|
-
const t = kt(e), r =
|
|
718
|
-
() => new
|
|
705
|
+
function Er(s, e) {
|
|
706
|
+
const t = kt(e), r = H(s), n = Ze(() => [ct()]), u = ve(s.mutationKey ?? n.current), [i] = jt(
|
|
707
|
+
() => new Ms(
|
|
719
708
|
t,
|
|
720
709
|
s
|
|
721
710
|
)
|
|
@@ -723,9 +712,9 @@ function Cr(s, e) {
|
|
|
723
712
|
J(() => {
|
|
724
713
|
i.setOptions(s);
|
|
725
714
|
}, [i, s]);
|
|
726
|
-
const c = ut(() => i.observe(), [u, i]), l = Xe(c.result$) ?? c.lastValue, h =
|
|
715
|
+
const c = ut(() => i.observe(), [u, i]), l = Xe(c.result$) ?? c.lastValue, h = de(
|
|
727
716
|
(o, p) => {
|
|
728
|
-
i.mutate(o, p).catch(
|
|
717
|
+
i.mutate(o, p).catch(Qs);
|
|
729
718
|
},
|
|
730
719
|
[i]
|
|
731
720
|
);
|
|
@@ -733,26 +722,26 @@ function Cr(s, e) {
|
|
|
733
722
|
r.current.cancelOnUnMount && i.reset();
|
|
734
723
|
}, [i, r]), { ...l, mutate: h, mutateAsync: l.mutate };
|
|
735
724
|
}
|
|
736
|
-
function
|
|
725
|
+
function Us(s) {
|
|
737
726
|
return (e) => e.pipe(
|
|
738
|
-
|
|
727
|
+
Qt((t) => {
|
|
739
728
|
s.next(t);
|
|
740
729
|
})
|
|
741
730
|
);
|
|
742
731
|
}
|
|
743
732
|
const pe = typeof window > "u" || "Deno" in window;
|
|
744
|
-
class
|
|
733
|
+
class Vs {
|
|
745
734
|
constructor() {
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
735
|
+
g(this, "isOnlineSubject", new Y(!0));
|
|
736
|
+
g(this, "online$", this.isOnlineSubject.pipe(U()));
|
|
737
|
+
g(this, "backToOnline$", this.online$.pipe(
|
|
749
738
|
O((e) => e),
|
|
750
739
|
Je()
|
|
751
740
|
));
|
|
752
|
-
|
|
753
|
-
pe ? Z : Ne(window, "offline").pipe(
|
|
754
|
-
pe ? Z : Ne(window, "online").pipe(
|
|
755
|
-
).pipe(
|
|
741
|
+
C(
|
|
742
|
+
pe ? Z : Ne(window, "offline").pipe(b(() => !1)),
|
|
743
|
+
pe ? Z : Ne(window, "online").pipe(b(() => !0))
|
|
744
|
+
).pipe(Us(this.isOnlineSubject)).subscribe();
|
|
756
745
|
}
|
|
757
746
|
isOnline() {
|
|
758
747
|
return this.isOnlineSubject.getValue();
|
|
@@ -761,51 +750,51 @@ class Qs {
|
|
|
761
750
|
this.isOnlineSubject.getValue() !== e && this.isOnlineSubject.next(e);
|
|
762
751
|
}
|
|
763
752
|
}
|
|
764
|
-
const re = new
|
|
753
|
+
const re = new Vs();
|
|
765
754
|
function ht(s, e) {
|
|
766
755
|
return s.isStaleByTime(e.staleTime);
|
|
767
756
|
}
|
|
768
|
-
function
|
|
757
|
+
function Is(s, e) {
|
|
769
758
|
return e.enabled !== !1 && !s.state.dataUpdatedAt && !(s.state.status === "error" && e.retryOnMount === !1) && s.state.fetchStatus !== "fetching";
|
|
770
759
|
}
|
|
771
|
-
function
|
|
772
|
-
return
|
|
760
|
+
function wt(s, e) {
|
|
761
|
+
return Is(s, e) || s.state.dataUpdatedAt > 0 && Kt(s, e, e.refetchOnMount);
|
|
773
762
|
}
|
|
774
|
-
function
|
|
763
|
+
function Ct(s, e, t, r) {
|
|
775
764
|
return s.state.fetchStatus !== "fetching" && t.enabled !== !1 && (s !== e || r.enabled === !1) && (!t.suspense || s.state.status !== "error") && ht(s, t);
|
|
776
765
|
}
|
|
777
|
-
function
|
|
778
|
-
return
|
|
766
|
+
function Ps(s, e) {
|
|
767
|
+
return Kt(s, e, e.refetchOnWindowFocus);
|
|
779
768
|
}
|
|
780
|
-
function
|
|
769
|
+
function Kt(s, e, t) {
|
|
781
770
|
if (e.enabled !== !1) {
|
|
782
771
|
const r = typeof t == "function" ? t(s) : t;
|
|
783
772
|
return r === "idle" ? s.state.fetchStatus === "idle" : r === "always" || r !== !1 && ht(s, e);
|
|
784
773
|
}
|
|
785
774
|
return !1;
|
|
786
775
|
}
|
|
787
|
-
function
|
|
776
|
+
function Ds(s) {
|
|
788
777
|
return (s ?? "online") === "online" ? re.isOnline() : !0;
|
|
789
778
|
}
|
|
790
|
-
function
|
|
779
|
+
function Ft(s, e) {
|
|
791
780
|
return e.reduce(
|
|
792
781
|
(t, r) => r in s ? { ...t, [r]: s[r] } : t,
|
|
793
782
|
{}
|
|
794
783
|
);
|
|
795
784
|
}
|
|
796
|
-
function
|
|
785
|
+
function Et(s) {
|
|
797
786
|
return Array.isArray(s) && s.length === Object.keys(s).length;
|
|
798
787
|
}
|
|
799
|
-
function
|
|
788
|
+
function Nt(s, e) {
|
|
800
789
|
if (s === e)
|
|
801
790
|
return s;
|
|
802
|
-
const t =
|
|
791
|
+
const t = Et(s) && Et(e);
|
|
803
792
|
if (t || nt(s) && nt(e)) {
|
|
804
793
|
const r = t ? s : Object.keys(s), n = r.length, u = t ? e : Object.keys(e), i = u.length, c = t ? [] : {};
|
|
805
794
|
let l = 0;
|
|
806
795
|
for (let h = 0; h < i; h++) {
|
|
807
796
|
const o = t ? h : u[h];
|
|
808
|
-
!t && s[o] === void 0 && e[o] === void 0 && r.includes(o) ? (c[o] = void 0, l++) : (c[o] =
|
|
797
|
+
!t && s[o] === void 0 && e[o] === void 0 && r.includes(o) ? (c[o] = void 0, l++) : (c[o] = Nt(s[o], e[o]), c[o] === s[o] && s[o] !== void 0 && l++);
|
|
809
798
|
}
|
|
810
799
|
return n === i && l === n ? s : c;
|
|
811
800
|
}
|
|
@@ -814,7 +803,7 @@ function Kt(s, e) {
|
|
|
814
803
|
function dt(s, e) {
|
|
815
804
|
return ((e == null ? void 0 : e.queryKeyHashFn) ?? ve)(s);
|
|
816
805
|
}
|
|
817
|
-
function
|
|
806
|
+
function xt(s, e) {
|
|
818
807
|
const {
|
|
819
808
|
type: t = "all",
|
|
820
809
|
exact: r,
|
|
@@ -837,70 +826,69 @@ function Et(s, e) {
|
|
|
837
826
|
}
|
|
838
827
|
return !(typeof c == "boolean" && e.isStale() !== c || typeof n < "u" && n !== e.state.fetchStatus || u && !u(e));
|
|
839
828
|
}
|
|
840
|
-
function
|
|
829
|
+
function Ts(s, e) {
|
|
841
830
|
return Math.max(s + (e ?? 0) - Date.now(), 0);
|
|
842
831
|
}
|
|
843
|
-
function
|
|
832
|
+
function ks(s, e) {
|
|
844
833
|
return typeof s == "function" ? s(e) : s;
|
|
845
834
|
}
|
|
846
835
|
function Le(s, e, t) {
|
|
847
|
-
return typeof t.structuralSharing == "function" ? t.structuralSharing(s, e) : t.structuralSharing !== !1 ?
|
|
836
|
+
return typeof t.structuralSharing == "function" ? t.structuralSharing(s, e) : t.structuralSharing !== !1 ? Nt(s, e) : e;
|
|
848
837
|
}
|
|
849
|
-
const it = Symbol(),
|
|
838
|
+
const it = Symbol(), Ks = ({
|
|
850
839
|
getOptions: s,
|
|
851
840
|
getState: e,
|
|
852
841
|
initialState: t
|
|
853
842
|
}) => (r) => r.pipe(
|
|
854
843
|
Be((n, { command: u, state: i }) => {
|
|
855
|
-
if (u === "reset")
|
|
856
|
-
return { ...n, ...i };
|
|
844
|
+
if (u === "reset") return { ...n, ...i };
|
|
857
845
|
if (u === "cancel") {
|
|
858
|
-
const
|
|
859
|
-
return { ...n, ...i, status:
|
|
846
|
+
const S = n.status === "pending" ? "pending" : i.status ?? n.status;
|
|
847
|
+
return { ...n, ...i, status: S };
|
|
860
848
|
}
|
|
861
|
-
const c = i.data, l = c !== void 0 && c !== n.data, h = "data" in i, o = i.status === "success", p = n.data !== void 0,
|
|
862
|
-
(p ||
|
|
849
|
+
const c = i.data, l = c !== void 0 && c !== n.data, h = "data" in i, o = i.status === "success", p = n.data !== void 0, F = n.error !== void 0 || n.error !== null, d = i.status ?? n.status, f = l ? Le(e().data, c, s()) : h ? i.data : n.data, y = n.status === "error" || n.status === "success", x = i.status === "error" && (n.status === "error" && n.fetchStatus === "fetching" || n.status !== "error") ? n.errorUpdateCount + 1 : n.errorUpdateCount, E = l ? n.dataUpdateCount + 1 : i.dataUpdateCount ?? n.dataUpdateCount, $ = i.status === "pending" && y && // (dataUpdateCount !== 0 || errorUpdateCount !== 0)
|
|
850
|
+
(p || F), D = d === "pending" ? null : i.error ?? n.error;
|
|
863
851
|
return {
|
|
864
852
|
...n,
|
|
865
853
|
...i,
|
|
866
|
-
status:
|
|
867
|
-
error:
|
|
868
|
-
errorUpdateCount:
|
|
854
|
+
status: d,
|
|
855
|
+
error: D,
|
|
856
|
+
errorUpdateCount: x,
|
|
869
857
|
...o && {
|
|
870
858
|
isInvalidated: !1
|
|
871
859
|
},
|
|
872
|
-
data:
|
|
873
|
-
dataUpdateCount:
|
|
874
|
-
|
|
860
|
+
data: f,
|
|
861
|
+
dataUpdateCount: E,
|
|
862
|
+
...$ && {
|
|
875
863
|
status: n.status
|
|
876
864
|
}
|
|
877
865
|
};
|
|
878
866
|
}, t)
|
|
879
|
-
),
|
|
880
|
-
|
|
867
|
+
), Ns = (s) => s.pipe(
|
|
868
|
+
b(
|
|
881
869
|
({ status: e, fetchStatus: t }) => t === "idle" && (e === "success" || e === "error")
|
|
882
870
|
)
|
|
883
|
-
),
|
|
871
|
+
), qt = (s) => s.pipe(
|
|
884
872
|
Ye((e) => e.fetchStatus !== "idle", !0)
|
|
885
873
|
);
|
|
886
874
|
var We, te;
|
|
887
|
-
class
|
|
875
|
+
class qs {
|
|
888
876
|
constructor() {
|
|
889
|
-
|
|
877
|
+
w(this, We, C(
|
|
890
878
|
pe ? Z : Ne(document, "visibilitychange"),
|
|
891
879
|
pe ? Z : Ne(window, "visibilitychange")
|
|
892
|
-
).pipe(
|
|
893
|
-
|
|
880
|
+
).pipe(b(() => document.visibilityState)));
|
|
881
|
+
w(this, te, new Y(
|
|
894
882
|
pe ? !0 : document.visibilityState === "visible"
|
|
895
883
|
));
|
|
896
884
|
// public readonly focused$ = this.#focusedSubject.pipe(distinctUntilChanged())
|
|
897
|
-
|
|
898
|
-
|
|
885
|
+
g(this, "focused$", a(this, te));
|
|
886
|
+
g(this, "focusRegained$", this.focused$.pipe(
|
|
899
887
|
at(1),
|
|
900
888
|
O((e) => e)
|
|
901
889
|
));
|
|
902
890
|
a(this, We).pipe(
|
|
903
|
-
|
|
891
|
+
R((e) => {
|
|
904
892
|
a(this, te).next(e === "visible");
|
|
905
893
|
})
|
|
906
894
|
).subscribe();
|
|
@@ -929,41 +917,41 @@ class Ks {
|
|
|
929
917
|
}
|
|
930
918
|
}
|
|
931
919
|
We = new WeakMap(), te = new WeakMap();
|
|
932
|
-
const ze = new
|
|
920
|
+
const ze = new qs(), Hs = (s) => s.pipe(
|
|
933
921
|
O((e) => e.status === "success"),
|
|
934
|
-
|
|
922
|
+
b((e) => ({
|
|
935
923
|
data: e.data,
|
|
936
924
|
status: e.status,
|
|
937
925
|
dataUpdatedAt: e.dataUpdatedAt
|
|
938
926
|
})),
|
|
939
|
-
|
|
927
|
+
U(P)
|
|
940
928
|
);
|
|
941
|
-
var B,
|
|
942
|
-
class
|
|
929
|
+
var B, M, Ce, oe, T, ye, Fe;
|
|
930
|
+
class Ht {
|
|
943
931
|
constructor(e, t) {
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
932
|
+
w(this, B);
|
|
933
|
+
w(this, M);
|
|
934
|
+
w(this, Ce, new I());
|
|
947
935
|
/**
|
|
948
936
|
* Used to subscribe to changes in either query or options (or both).
|
|
949
937
|
* We need to be able to track change to both of them at the same time
|
|
950
938
|
* in order to react accordingly and in order (such as refetch on options change)
|
|
951
939
|
*/
|
|
952
|
-
|
|
940
|
+
g(this, "queryUpdateSubject", new I());
|
|
953
941
|
/**
|
|
954
942
|
* Mostly used to compare the state before and after mount
|
|
955
943
|
*/
|
|
956
|
-
|
|
944
|
+
w(this, oe);
|
|
957
945
|
/**
|
|
958
946
|
* Mostly used for internal optimization such as not
|
|
959
947
|
* running selectors twice, etc
|
|
960
948
|
*/
|
|
961
|
-
|
|
949
|
+
w(this, T);
|
|
962
950
|
// This property keeps track of the last query with defined data.
|
|
963
951
|
// It will be used to pass the previous data and query to the placeholder function between renders.
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
952
|
+
w(this, ye);
|
|
953
|
+
w(this, Fe, 0);
|
|
954
|
+
g(this, "getObserverResultFromQuery", ({
|
|
967
955
|
options: e,
|
|
968
956
|
query: t,
|
|
969
957
|
optimisticResult: r,
|
|
@@ -977,30 +965,30 @@ class qt {
|
|
|
977
965
|
}
|
|
978
966
|
}) => {
|
|
979
967
|
var De;
|
|
980
|
-
const o = t.state, p = t.state.status === "pending",
|
|
981
|
-
let { errorUpdatedAt:
|
|
968
|
+
const o = t.state, p = t.state.status === "pending", F = a(this, M), d = this.options, y = t !== F ? t.state : a(this, oe);
|
|
969
|
+
let { errorUpdatedAt: x, fetchStatus: E, error: $ } = o;
|
|
982
970
|
if (r) {
|
|
983
|
-
const k = !!a(this, Fe), pt = !k &&
|
|
984
|
-
(pt ||
|
|
971
|
+
const k = !!a(this, Fe), pt = !k && wt(t, e), Jt = k && Ct(t, F, e, d);
|
|
972
|
+
(pt || Jt) && (E = Ds(t.options.networkMode) ? "fetching" : "paused");
|
|
985
973
|
}
|
|
986
|
-
const
|
|
987
|
-
let
|
|
974
|
+
const D = p && E === "fetching";
|
|
975
|
+
let S, m = l, z = c ?? null, W = h;
|
|
988
976
|
if (e.select && typeof o.data < "u")
|
|
989
977
|
if (n && o.data === (i == null ? void 0 : i.data) && e.select === c)
|
|
990
|
-
|
|
978
|
+
S = h;
|
|
991
979
|
else
|
|
992
980
|
try {
|
|
993
|
-
z = e.select,
|
|
981
|
+
z = e.select, S = e.select(o.data), S = Le(n == null ? void 0 : n.data, S, e), W = S, m = null;
|
|
994
982
|
} catch (k) {
|
|
995
|
-
|
|
983
|
+
S = h, m = k;
|
|
996
984
|
}
|
|
997
985
|
else
|
|
998
|
-
|
|
999
|
-
let _ =
|
|
1000
|
-
|
|
1001
|
-
const
|
|
1002
|
-
let
|
|
1003
|
-
if (typeof e.placeholderData < "u" && typeof
|
|
986
|
+
S = o.data, m = null;
|
|
987
|
+
let _ = E !== "idle" && !o.dataUpdatedAt ? "pending" : o.status;
|
|
988
|
+
m && ($ = m, S = h, x = (n == null ? void 0 : n.errorUpdatedAt) ?? x, _ = "error");
|
|
989
|
+
const Ve = _ === "error";
|
|
990
|
+
let Ie = !1;
|
|
991
|
+
if (typeof e.placeholderData < "u" && typeof S > "u" && _ === "pending") {
|
|
1004
992
|
let k;
|
|
1005
993
|
if (n != null && n.isPlaceholderData && e.placeholderData === (u == null ? void 0 : u.placeholderData))
|
|
1006
994
|
k = n.data;
|
|
@@ -1012,49 +1000,49 @@ class qt {
|
|
|
1012
1000
|
k = e.select(k);
|
|
1013
1001
|
} catch {
|
|
1014
1002
|
}
|
|
1015
|
-
typeof k < "u" && (_ = "success",
|
|
1003
|
+
typeof k < "u" && (_ = "success", S = Le(
|
|
1016
1004
|
n == null ? void 0 : n.data,
|
|
1017
1005
|
k,
|
|
1018
1006
|
e
|
|
1019
|
-
),
|
|
1007
|
+
), Ie = !0);
|
|
1020
1008
|
}
|
|
1021
|
-
const Pe =
|
|
1009
|
+
const Pe = E === "fetching";
|
|
1022
1010
|
return {
|
|
1023
1011
|
result: {
|
|
1024
1012
|
status: _,
|
|
1025
|
-
fetchStatus:
|
|
1013
|
+
fetchStatus: E,
|
|
1026
1014
|
isPending: p,
|
|
1027
1015
|
isSuccess: _ === "success",
|
|
1028
|
-
isError:
|
|
1029
|
-
isInitialLoading:
|
|
1030
|
-
isLoading:
|
|
1031
|
-
data:
|
|
1016
|
+
isError: Ve,
|
|
1017
|
+
isInitialLoading: D,
|
|
1018
|
+
isLoading: D,
|
|
1019
|
+
data: S,
|
|
1032
1020
|
dataUpdatedAt: o.dataUpdatedAt,
|
|
1033
|
-
error:
|
|
1034
|
-
errorUpdatedAt:
|
|
1021
|
+
error: $,
|
|
1022
|
+
errorUpdatedAt: x,
|
|
1035
1023
|
failureCount: o.fetchFailureCount,
|
|
1036
1024
|
failureReason: o.fetchFailureReason,
|
|
1037
1025
|
errorUpdateCount: o.errorUpdateCount,
|
|
1038
1026
|
isFetched: o.dataUpdateCount > 0 || o.errorUpdateCount > 0,
|
|
1039
|
-
isFetchedAfterMount: o.dataUpdateCount >
|
|
1027
|
+
isFetchedAfterMount: o.dataUpdateCount > y.dataUpdateCount || o.errorUpdateCount > y.errorUpdateCount,
|
|
1040
1028
|
isFetching: Pe,
|
|
1041
1029
|
isRefetching: Pe && !p,
|
|
1042
|
-
isLoadingError:
|
|
1043
|
-
isPaused:
|
|
1044
|
-
isPlaceholderData:
|
|
1045
|
-
isRefetchError:
|
|
1030
|
+
isLoadingError: Ve && o.dataUpdatedAt === 0,
|
|
1031
|
+
isPaused: E === "paused",
|
|
1032
|
+
isPlaceholderData: Ie,
|
|
1033
|
+
isRefetchError: Ve && o.dataUpdatedAt !== 0,
|
|
1046
1034
|
isStale: ht(t, e),
|
|
1047
1035
|
// eslint-disable-next-line @typescript-eslint/unbound-method
|
|
1048
1036
|
refetch: this.refetch
|
|
1049
1037
|
},
|
|
1050
|
-
selectError:
|
|
1038
|
+
selectError: m,
|
|
1051
1039
|
select: z,
|
|
1052
1040
|
selectResult: W
|
|
1053
1041
|
};
|
|
1054
1042
|
});
|
|
1055
|
-
this.options = t,
|
|
1056
|
-
const r = a(this,
|
|
1057
|
-
|
|
1043
|
+
this.options = t, A(this, B, e), this.bindMethods(), A(this, M, this.setOptions(t));
|
|
1044
|
+
const r = a(this, M);
|
|
1045
|
+
A(this, oe, r.state);
|
|
1058
1046
|
const { result: n, select: u } = this.getObserverResultFromQuery({
|
|
1059
1047
|
query: r,
|
|
1060
1048
|
options: this.options,
|
|
@@ -1063,7 +1051,7 @@ class qt {
|
|
|
1063
1051
|
state: r.state
|
|
1064
1052
|
}
|
|
1065
1053
|
});
|
|
1066
|
-
|
|
1054
|
+
A(this, T, {
|
|
1067
1055
|
state: r.state,
|
|
1068
1056
|
options: t,
|
|
1069
1057
|
result: n,
|
|
@@ -1075,14 +1063,14 @@ class qt {
|
|
|
1075
1063
|
}
|
|
1076
1064
|
setOptions(e) {
|
|
1077
1065
|
const t = this.options;
|
|
1078
|
-
if (this.options = a(this, B).defaultQueryOptions(e),
|
|
1066
|
+
if (this.options = a(this, B).defaultQueryOptions(e), P(this.options, t) || a(this, B).getQueryCache().notify({
|
|
1079
1067
|
type: "observerOptionsUpdated",
|
|
1080
|
-
query: a(this,
|
|
1068
|
+
query: a(this, M),
|
|
1081
1069
|
observer: this
|
|
1082
1070
|
}), typeof this.options.enabled < "u" && typeof this.options.enabled != "boolean")
|
|
1083
1071
|
throw new Error("Expected enabled to be a boolean");
|
|
1084
1072
|
const r = this.buildQuery(this.options);
|
|
1085
|
-
return r !== a(this,
|
|
1073
|
+
return r !== a(this, M) && (A(this, oe, r.state), A(this, M, r)), this.queryUpdateSubject.next({
|
|
1086
1074
|
options: this.options,
|
|
1087
1075
|
query: r
|
|
1088
1076
|
}), r;
|
|
@@ -1094,21 +1082,21 @@ class qt {
|
|
|
1094
1082
|
getCurrentResult() {
|
|
1095
1083
|
return this.getObserverResultFromQuery({
|
|
1096
1084
|
options: this.options,
|
|
1097
|
-
prevResult: a(this,
|
|
1098
|
-
query: a(this,
|
|
1085
|
+
prevResult: a(this, T),
|
|
1086
|
+
query: a(this, M)
|
|
1099
1087
|
}).result;
|
|
1100
1088
|
}
|
|
1101
1089
|
getCurrentQuery() {
|
|
1102
|
-
return a(this,
|
|
1090
|
+
return a(this, M);
|
|
1103
1091
|
}
|
|
1104
1092
|
getOptimisticResult(e) {
|
|
1105
1093
|
const t = this.buildQuery(e), r = this.getObserverResultFromQuery({
|
|
1106
1094
|
query: t,
|
|
1107
1095
|
options: e,
|
|
1108
1096
|
optimisticResult: !0,
|
|
1109
|
-
prevResult: a(this,
|
|
1097
|
+
prevResult: a(this, T)
|
|
1110
1098
|
});
|
|
1111
|
-
return
|
|
1099
|
+
return _s(this, r.result) && this.updateResult({ query: t, ...r }), r.result;
|
|
1112
1100
|
}
|
|
1113
1101
|
updateResult({
|
|
1114
1102
|
query: e,
|
|
@@ -1117,8 +1105,8 @@ class qt {
|
|
|
1117
1105
|
select: n,
|
|
1118
1106
|
selectResult: u
|
|
1119
1107
|
}) {
|
|
1120
|
-
a(this,
|
|
1121
|
-
query: a(this,
|
|
1108
|
+
a(this, T).state = e.state, a(this, T).result = t, a(this, T).selectResult = u, r !== void 0 && (a(this, T).selectError = r), n !== void 0 && (a(this, T).select = n), a(this, T).options = this.options, e.state.data !== void 0 && A(this, ye, e), a(this, B).getQueryCache().notify({
|
|
1109
|
+
query: a(this, M),
|
|
1122
1110
|
type: "observerResultsUpdated"
|
|
1123
1111
|
});
|
|
1124
1112
|
}
|
|
@@ -1129,7 +1117,7 @@ class qt {
|
|
|
1129
1117
|
}
|
|
1130
1118
|
async fetch(e) {
|
|
1131
1119
|
const t = this.buildQuery(this.options);
|
|
1132
|
-
t !== a(this,
|
|
1120
|
+
t !== a(this, M) && (A(this, M, t), A(this, oe, t.state), this.queryUpdateSubject.next({
|
|
1133
1121
|
options: this.options,
|
|
1134
1122
|
query: t
|
|
1135
1123
|
}));
|
|
@@ -1137,14 +1125,14 @@ class qt {
|
|
|
1137
1125
|
...e,
|
|
1138
1126
|
cancelRefetch: (e == null ? void 0 : e.cancelRefetch) ?? !0
|
|
1139
1127
|
};
|
|
1140
|
-
a(this,
|
|
1128
|
+
a(this, M).fetch(this.options, r).catch(N), a(this, Ce).next({
|
|
1141
1129
|
query: t,
|
|
1142
1130
|
fetchOptions: r
|
|
1143
1131
|
}), await t.getFetchResultAsPromise();
|
|
1144
1132
|
const { result: n } = this.getObserverResultFromQuery({
|
|
1145
1133
|
query: t,
|
|
1146
1134
|
options: this.options,
|
|
1147
|
-
prevResult: a(this,
|
|
1135
|
+
prevResult: a(this, T)
|
|
1148
1136
|
});
|
|
1149
1137
|
return n;
|
|
1150
1138
|
}
|
|
@@ -1158,27 +1146,27 @@ class qt {
|
|
|
1158
1146
|
};
|
|
1159
1147
|
}
|
|
1160
1148
|
observe() {
|
|
1161
|
-
const e = a(this,
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1149
|
+
const e = a(this, M), t = this.queryUpdateSubject.pipe(
|
|
1150
|
+
b(({ query: i }) => i),
|
|
1151
|
+
he(a(this, M)),
|
|
1152
|
+
U()
|
|
1165
1153
|
), r = this.queryUpdateSubject.pipe(
|
|
1166
|
-
|
|
1167
|
-
query: a(this,
|
|
1154
|
+
he({
|
|
1155
|
+
query: a(this, M),
|
|
1168
1156
|
options: this.options
|
|
1169
1157
|
}),
|
|
1170
|
-
|
|
1171
|
-
|
|
1158
|
+
At(),
|
|
1159
|
+
R(
|
|
1172
1160
|
([{ options: i, query: c }, { options: l, query: h }]) => {
|
|
1173
|
-
|
|
1161
|
+
Ct(h, c, l, i) && this.fetch().catch(N);
|
|
1174
1162
|
}
|
|
1175
1163
|
),
|
|
1176
|
-
|
|
1164
|
+
ie()
|
|
1177
1165
|
), n = t.pipe(
|
|
1178
|
-
|
|
1179
|
-
|
|
1166
|
+
j((i) => i.observe(this)),
|
|
1167
|
+
ie()
|
|
1180
1168
|
);
|
|
1181
|
-
return
|
|
1169
|
+
return C(
|
|
1182
1170
|
/**
|
|
1183
1171
|
* It's important to observe the query before we subscribe to its result
|
|
1184
1172
|
* later in the chain of merge to get the first result right after fetch
|
|
@@ -1186,95 +1174,95 @@ class qt {
|
|
|
1186
1174
|
n,
|
|
1187
1175
|
r,
|
|
1188
1176
|
t.pipe(
|
|
1189
|
-
|
|
1177
|
+
j((i) => {
|
|
1190
1178
|
const c = this.options, l = this.queryUpdateSubject.pipe(
|
|
1191
|
-
|
|
1192
|
-
O((
|
|
1193
|
-
|
|
1194
|
-
|
|
1179
|
+
he({ query: i, options: c }),
|
|
1180
|
+
O((m) => m.query === i),
|
|
1181
|
+
b((m) => m.options),
|
|
1182
|
+
U(),
|
|
1195
1183
|
Ue(1)
|
|
1196
1184
|
), h = a(this, Ce).pipe(
|
|
1197
|
-
O((
|
|
1185
|
+
O((m) => m.query === i)
|
|
1198
1186
|
), o = i.state$.pipe(
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
(
|
|
1187
|
+
Hs,
|
|
1188
|
+
j(
|
|
1189
|
+
(m) => this.options.staleTime === 1 / 0 ? qe : (this.options.staleTime ?? 0) <= 0 ? v(m).pipe(ot(1)) : Qe(this.options.staleTime ?? 1)
|
|
1202
1190
|
),
|
|
1203
1191
|
Ye(() => this.options.enabled ?? !0)
|
|
1204
|
-
), p = (
|
|
1192
|
+
), p = (m, z) => {
|
|
1205
1193
|
const W = c.notifyOnChangeProps, _ = typeof W == "function" ? W() : W;
|
|
1206
|
-
return (Array.isArray(_) ? _.length === 0 ? () => !0 : (
|
|
1207
|
-
const ft =
|
|
1208
|
-
|
|
1194
|
+
return (Array.isArray(_) ? _.length === 0 ? () => !0 : (Ie, Pe) => {
|
|
1195
|
+
const ft = Ft(
|
|
1196
|
+
Ie,
|
|
1209
1197
|
_
|
|
1210
|
-
), De =
|
|
1198
|
+
), De = Ft(
|
|
1211
1199
|
Pe,
|
|
1212
1200
|
_
|
|
1213
1201
|
);
|
|
1214
|
-
return
|
|
1215
|
-
} :
|
|
1216
|
-
},
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
),
|
|
1220
|
-
|
|
1221
|
-
refetchInterval: (typeof
|
|
1202
|
+
return P(ft, De);
|
|
1203
|
+
} : P)(m, z);
|
|
1204
|
+
}, F = h.pipe(
|
|
1205
|
+
j(() => i.state$),
|
|
1206
|
+
qt
|
|
1207
|
+
), d = l.pipe(
|
|
1208
|
+
b(({ refetchInterval: m, refetchIntervalInBackground: z }) => ({
|
|
1209
|
+
refetchInterval: (typeof m == "function" ? m(a(this, M)) : m) ?? !1,
|
|
1222
1210
|
refetchIntervalInBackground: z
|
|
1223
1211
|
})),
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1212
|
+
U(P),
|
|
1213
|
+
j(({ refetchInterval: m, refetchIntervalInBackground: z }) => m ? as(m).pipe(
|
|
1214
|
+
R(() => {
|
|
1227
1215
|
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
|
1228
|
-
(z || ze.isFocused()) && this.fetch({ cancelRefetch: !1 }).catch(
|
|
1216
|
+
(z || ze.isFocused()) && this.fetch({ cancelRefetch: !1 }).catch(N);
|
|
1229
1217
|
})
|
|
1230
1218
|
) : qe),
|
|
1231
|
-
|
|
1232
|
-
),
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
),
|
|
1236
|
-
O((
|
|
1237
|
-
|
|
1238
|
-
),
|
|
1239
|
-
O((
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1219
|
+
ie()
|
|
1220
|
+
), f = l.pipe(
|
|
1221
|
+
b(({ enabled: m }) => m ?? !0),
|
|
1222
|
+
U()
|
|
1223
|
+
), y = f.pipe(
|
|
1224
|
+
O((m) => !m),
|
|
1225
|
+
b(() => i.state)
|
|
1226
|
+
), x = f.pipe(
|
|
1227
|
+
O((m) => m),
|
|
1228
|
+
j(() => ze.focusRegained$),
|
|
1229
|
+
mt(l),
|
|
1230
|
+
R(([, m]) => {
|
|
1231
|
+
Ps(i, m) && this.fetch({ cancelRefetch: !1 }).catch(N);
|
|
1244
1232
|
}),
|
|
1245
|
-
|
|
1246
|
-
),
|
|
1247
|
-
|
|
1248
|
-
),
|
|
1249
|
-
|
|
1250
|
-
|
|
1233
|
+
ie()
|
|
1234
|
+
), E = y.pipe(
|
|
1235
|
+
b(() => i.state)
|
|
1236
|
+
), $ = (m) => m.pipe(
|
|
1237
|
+
mt(l),
|
|
1238
|
+
b(([, z]) => {
|
|
1251
1239
|
const W = this.getObserverResultFromQuery({
|
|
1252
1240
|
query: i,
|
|
1253
1241
|
options: z,
|
|
1254
|
-
prevResult: a(this,
|
|
1242
|
+
prevResult: a(this, T)
|
|
1255
1243
|
});
|
|
1256
1244
|
return this.updateResult({ query: i, ...W }), W.result;
|
|
1257
1245
|
})
|
|
1258
|
-
),
|
|
1259
|
-
|
|
1260
|
-
|
|
1246
|
+
), S = C(
|
|
1247
|
+
E,
|
|
1248
|
+
F,
|
|
1261
1249
|
i.state$,
|
|
1262
1250
|
// options$,
|
|
1263
1251
|
o
|
|
1264
1252
|
).pipe(
|
|
1265
|
-
|
|
1253
|
+
$,
|
|
1266
1254
|
// This one ensure we don't re-trigger same state
|
|
1267
|
-
|
|
1255
|
+
U(P),
|
|
1268
1256
|
// This one make sure we dispatch based on user preference
|
|
1269
|
-
|
|
1257
|
+
U(p)
|
|
1270
1258
|
);
|
|
1271
|
-
return
|
|
1259
|
+
return C(d, x, S);
|
|
1272
1260
|
})
|
|
1273
1261
|
).pipe(
|
|
1274
|
-
lt((i) =>
|
|
1275
|
-
|
|
1262
|
+
lt((i) => A(this, Fe, i)),
|
|
1263
|
+
R({
|
|
1276
1264
|
subscribe: () => {
|
|
1277
|
-
|
|
1265
|
+
wt(e, this.options) && this.fetch().catch(N);
|
|
1278
1266
|
}
|
|
1279
1267
|
})
|
|
1280
1268
|
)
|
|
@@ -1283,13 +1271,13 @@ class qt {
|
|
|
1283
1271
|
destroy() {
|
|
1284
1272
|
}
|
|
1285
1273
|
}
|
|
1286
|
-
B = new WeakMap(),
|
|
1287
|
-
function
|
|
1288
|
-
return !
|
|
1274
|
+
B = new WeakMap(), M = new WeakMap(), Ce = new WeakMap(), oe = new WeakMap(), T = new WeakMap(), ye = new WeakMap(), Fe = new WeakMap();
|
|
1275
|
+
function _s(s, e) {
|
|
1276
|
+
return !P(s.getCurrentResult(), e);
|
|
1289
1277
|
}
|
|
1290
|
-
const
|
|
1291
|
-
|
|
1292
|
-
function
|
|
1278
|
+
const _t = Ge.createContext(!1), Ls = () => Ge.useContext(_t);
|
|
1279
|
+
_t.Provider;
|
|
1280
|
+
function zs() {
|
|
1293
1281
|
let s = !1;
|
|
1294
1282
|
return {
|
|
1295
1283
|
clearReset: () => {
|
|
@@ -1301,29 +1289,29 @@ function _s() {
|
|
|
1301
1289
|
isReset: () => s
|
|
1302
1290
|
};
|
|
1303
1291
|
}
|
|
1304
|
-
const
|
|
1305
|
-
function
|
|
1292
|
+
const Ws = Ge.createContext(zs()), Gs = () => Ge.useContext(Ws);
|
|
1293
|
+
function Js(s, e) {
|
|
1306
1294
|
return typeof s == "function" ? s(...e) : !!s;
|
|
1307
1295
|
}
|
|
1308
|
-
const
|
|
1296
|
+
const Ys = ({
|
|
1309
1297
|
result: s,
|
|
1310
1298
|
errorResetBoundary: e,
|
|
1311
1299
|
throwOnError: t,
|
|
1312
1300
|
query: r
|
|
1313
|
-
}) => s.isError && !e.isReset() && !s.isFetching && r &&
|
|
1314
|
-
function
|
|
1301
|
+
}) => s.isError && !e.isReset() && !s.isFetching && r && Js(t, [s.error, r]);
|
|
1302
|
+
function Lt(s, e, t) {
|
|
1315
1303
|
if (process.env.NODE_ENV !== "production" && (typeof s != "object" || Array.isArray(s)))
|
|
1316
1304
|
throw new Error(
|
|
1317
1305
|
'Bad argument type. Starting with v5, only the "Object" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object'
|
|
1318
1306
|
);
|
|
1319
|
-
const r = kt(t), n =
|
|
1307
|
+
const r = kt(t), n = Ls(), u = Gs(), i = r.defaultQueryOptions(s);
|
|
1320
1308
|
i._optimisticResults = n ? "isRestoring" : "optimistic";
|
|
1321
|
-
const [c] =
|
|
1309
|
+
const [c] = jt(
|
|
1322
1310
|
() => new e(
|
|
1323
1311
|
r,
|
|
1324
1312
|
i
|
|
1325
1313
|
)
|
|
1326
|
-
), l = Ze(() => c.observe()), h =
|
|
1314
|
+
), l = Ze(() => c.observe()), h = H(
|
|
1327
1315
|
c.getOptimisticResult(i)
|
|
1328
1316
|
), o = h.current;
|
|
1329
1317
|
Xe(
|
|
@@ -1333,14 +1321,14 @@ function _t(s, e, t) {
|
|
|
1333
1321
|
* It's important to not skip the first result (even tho most of the time they are equal).
|
|
1334
1322
|
* We only skip if they are the same.
|
|
1335
1323
|
*/
|
|
1336
|
-
O((
|
|
1324
|
+
O((F) => !P(F, h.current))
|
|
1337
1325
|
),
|
|
1338
1326
|
[]
|
|
1339
1327
|
), J(() => {
|
|
1340
1328
|
c.setOptions(i);
|
|
1341
1329
|
}, [i, c]);
|
|
1342
1330
|
const p = o.error;
|
|
1343
|
-
if (p &&
|
|
1331
|
+
if (p && Ys({
|
|
1344
1332
|
result: o,
|
|
1345
1333
|
errorResetBoundary: u,
|
|
1346
1334
|
throwOnError: i.throwOnError,
|
|
@@ -1349,11 +1337,11 @@ function _t(s, e, t) {
|
|
|
1349
1337
|
throw p;
|
|
1350
1338
|
return h.current;
|
|
1351
1339
|
}
|
|
1352
|
-
function
|
|
1353
|
-
return
|
|
1340
|
+
function xr(s, e) {
|
|
1341
|
+
return Lt(s, Ht, e);
|
|
1354
1342
|
}
|
|
1355
|
-
function
|
|
1356
|
-
return
|
|
1343
|
+
function Rr(s, e) {
|
|
1344
|
+
return Lt(
|
|
1357
1345
|
{
|
|
1358
1346
|
refetchOnMount: "idle",
|
|
1359
1347
|
refetchOnReconnect: !1,
|
|
@@ -1361,41 +1349,41 @@ function Er(s, e) {
|
|
|
1361
1349
|
refetchOnWindowFocus: !1,
|
|
1362
1350
|
...s
|
|
1363
1351
|
},
|
|
1364
|
-
|
|
1352
|
+
Ht,
|
|
1365
1353
|
e
|
|
1366
1354
|
);
|
|
1367
1355
|
}
|
|
1368
|
-
function
|
|
1369
|
-
const r = e != null && !Array.isArray(e) ? e : {}, n = r.retry ?? !0, u =
|
|
1356
|
+
function jr(s, e, t = []) {
|
|
1357
|
+
const r = e != null && !Array.isArray(e) ? e : {}, n = r.retry ?? !0, u = H(
|
|
1370
1358
|
r.onError ?? ((l) => {
|
|
1371
1359
|
console.error(l);
|
|
1372
1360
|
})
|
|
1373
|
-
), i =
|
|
1361
|
+
), i = de(() => V(s), t), c = de(
|
|
1374
1362
|
() => i().pipe(
|
|
1375
1363
|
X((l) => {
|
|
1376
1364
|
throw u.current(l), l;
|
|
1377
1365
|
}),
|
|
1378
|
-
n ?
|
|
1366
|
+
n ? os() : Mt
|
|
1379
1367
|
),
|
|
1380
1368
|
[i, n, u]
|
|
1381
1369
|
);
|
|
1382
|
-
|
|
1370
|
+
Ut(c, t);
|
|
1383
1371
|
}
|
|
1384
|
-
const
|
|
1372
|
+
const zt = () => (s) => C(
|
|
1385
1373
|
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
1386
1374
|
v({ isPaused: !0 }),
|
|
1387
1375
|
re.backToOnline$.pipe(
|
|
1388
|
-
|
|
1376
|
+
q(
|
|
1389
1377
|
() => (
|
|
1390
1378
|
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
1391
|
-
|
|
1379
|
+
C(v({ isPaused: !1 }), s)
|
|
1392
1380
|
)
|
|
1393
1381
|
)
|
|
1394
1382
|
)
|
|
1395
|
-
),
|
|
1383
|
+
), Bs = (s) => {
|
|
1396
1384
|
let e = 0;
|
|
1397
1385
|
return s.pipe(
|
|
1398
|
-
X((t) => (e++, e <= 1 && !re.isOnline() ?
|
|
1386
|
+
X((t) => (e++, e <= 1 && !re.isOnline() ? C(
|
|
1399
1387
|
v({
|
|
1400
1388
|
failureCount: e,
|
|
1401
1389
|
failureReason: t
|
|
@@ -1405,35 +1393,33 @@ const Lt = () => (s) => F(
|
|
|
1405
1393
|
* timer needed to be iso RQ, so the state returned by mutation include both previous and next one
|
|
1406
1394
|
*/
|
|
1407
1395
|
Qe(1).pipe(
|
|
1408
|
-
|
|
1409
|
-
() => Oe(() => t).pipe(
|
|
1396
|
+
q(
|
|
1397
|
+
() => Oe(() => t).pipe(zt())
|
|
1410
1398
|
)
|
|
1411
1399
|
)
|
|
1412
1400
|
) : Oe(() => t)))
|
|
1413
1401
|
);
|
|
1414
|
-
},
|
|
1402
|
+
}, Xs = ({
|
|
1415
1403
|
variables: s,
|
|
1416
1404
|
state: e,
|
|
1417
1405
|
options: t
|
|
1418
1406
|
}) => {
|
|
1419
|
-
const r = e.isPaused, n = async () => await Promise.reject(new Error("No mutationFn found")), u = t.mutationFn ?? n,
|
|
1420
|
-
|
|
1421
|
-
v(e.context),
|
|
1422
|
-
U(
|
|
1423
|
-
// eslint-disable-next-line @typescript-eslint/promise-function-async
|
|
1424
|
-
() => {
|
|
1425
|
-
var d;
|
|
1426
|
-
return ((d = t.onMutate) == null ? void 0 : d.call(t, s)) ?? void 0;
|
|
1427
|
-
}
|
|
1428
|
-
)
|
|
1429
|
-
).pipe(Ue(1)), l = (d, f, y) => U(
|
|
1407
|
+
const r = e.isPaused, n = async () => await Promise.reject(new Error("No mutationFn found")), u = t.mutationFn ?? n, i = V(
|
|
1408
|
+
// eslint-disable-next-line @typescript-eslint/promise-function-async
|
|
1430
1409
|
() => {
|
|
1431
|
-
var
|
|
1432
|
-
return (
|
|
1410
|
+
var d;
|
|
1411
|
+
return ((d = t.onMutate) == null ? void 0 : d.call(t, s)) ?? void 0;
|
|
1412
|
+
}
|
|
1413
|
+
), c = v(e.context), l = cs(() => r, c, i).pipe(
|
|
1414
|
+
Ue(1)
|
|
1415
|
+
), h = (d, f, y) => V(
|
|
1416
|
+
() => {
|
|
1417
|
+
var E;
|
|
1418
|
+
return (E = t.onError) == null ? void 0 : E.call(t, d, s, f);
|
|
1433
1419
|
}
|
|
1434
1420
|
).pipe(
|
|
1435
1421
|
X(() => v(d)),
|
|
1436
|
-
|
|
1422
|
+
b(
|
|
1437
1423
|
() => ({
|
|
1438
1424
|
failureCount: y,
|
|
1439
1425
|
error: d,
|
|
@@ -1442,50 +1428,57 @@ const Lt = () => (s) => F(
|
|
|
1442
1428
|
status: "error"
|
|
1443
1429
|
})
|
|
1444
1430
|
)
|
|
1445
|
-
),
|
|
1446
|
-
|
|
1431
|
+
), o = l.pipe(
|
|
1432
|
+
j((d) => {
|
|
1447
1433
|
const y = (typeof u == "function" ? (
|
|
1448
1434
|
// eslint-disable-next-line @typescript-eslint/promise-function-async
|
|
1449
|
-
|
|
1450
|
-
) : u).pipe(
|
|
1451
|
-
|
|
1452
|
-
|
|
1435
|
+
V(() => u(s))
|
|
1436
|
+
) : u).pipe(ue()), x = y.pipe(
|
|
1437
|
+
ls(),
|
|
1438
|
+
R(($) => {
|
|
1439
|
+
if ($)
|
|
1440
|
+
throw new Error("Mutation completed without any emission (EMPTY)");
|
|
1441
|
+
}),
|
|
1442
|
+
ie()
|
|
1443
|
+
), E = C(y, x).pipe(
|
|
1444
|
+
b(
|
|
1445
|
+
($) => ({
|
|
1453
1446
|
result: {
|
|
1454
|
-
data:
|
|
1447
|
+
data: $
|
|
1455
1448
|
},
|
|
1456
1449
|
error: null,
|
|
1457
1450
|
context: d
|
|
1458
1451
|
})
|
|
1459
1452
|
),
|
|
1460
|
-
|
|
1461
|
-
|
|
1453
|
+
Bs,
|
|
1454
|
+
Pt({
|
|
1462
1455
|
...t,
|
|
1463
|
-
retry: (
|
|
1464
|
-
const
|
|
1465
|
-
return typeof
|
|
1456
|
+
retry: ($, D) => {
|
|
1457
|
+
const S = t.retry ?? 0;
|
|
1458
|
+
return typeof S == "function" ? S($, D) : typeof S == "boolean" ? S : $ < S;
|
|
1466
1459
|
},
|
|
1467
|
-
caughtError: (
|
|
1460
|
+
caughtError: ($, D) => (
|
|
1468
1461
|
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
1469
1462
|
v({
|
|
1470
|
-
failureCount:
|
|
1471
|
-
failureReason:
|
|
1463
|
+
failureCount: $,
|
|
1464
|
+
failureReason: D
|
|
1472
1465
|
})
|
|
1473
1466
|
),
|
|
1474
|
-
catchError: (
|
|
1475
|
-
|
|
1476
|
-
...
|
|
1467
|
+
catchError: ($, D) => h(D, d, $).pipe(
|
|
1468
|
+
b((S) => ({
|
|
1469
|
+
...S,
|
|
1477
1470
|
result: void 0
|
|
1478
1471
|
}))
|
|
1479
1472
|
)
|
|
1480
1473
|
}),
|
|
1481
1474
|
Ye(
|
|
1482
|
-
({ result:
|
|
1475
|
+
({ result: $, error: D }) => ($ == null ? void 0 : $.data) === void 0 && D === void 0,
|
|
1483
1476
|
!0
|
|
1484
1477
|
)
|
|
1485
1478
|
);
|
|
1486
|
-
return re.isOnline() || t.networkMode === "offlineFirst" || t.networkMode === "always" ?
|
|
1479
|
+
return re.isOnline() || t.networkMode === "offlineFirst" || t.networkMode === "always" ? E : E.pipe(zt());
|
|
1487
1480
|
})
|
|
1488
|
-
),
|
|
1481
|
+
), p = v({
|
|
1489
1482
|
...e,
|
|
1490
1483
|
variables: s,
|
|
1491
1484
|
status: "pending",
|
|
@@ -1494,30 +1487,30 @@ const Lt = () => (s) => F(
|
|
|
1494
1487
|
failureReason: null,
|
|
1495
1488
|
submittedAt: e.submittedAt ?? (/* @__PURE__ */ new Date()).getTime()
|
|
1496
1489
|
});
|
|
1497
|
-
return
|
|
1498
|
-
|
|
1490
|
+
return C(
|
|
1491
|
+
p,
|
|
1499
1492
|
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1493
|
+
l.pipe(b((d) => ({ context: d }))),
|
|
1494
|
+
o.pipe(
|
|
1495
|
+
j(({ result: d, error: f, ...y }) => {
|
|
1503
1496
|
if (!d && !f)
|
|
1504
1497
|
return v({
|
|
1505
1498
|
...y
|
|
1506
1499
|
});
|
|
1507
|
-
const
|
|
1500
|
+
const x = f ? v(null) : V(
|
|
1508
1501
|
() => {
|
|
1509
|
-
var
|
|
1510
|
-
return (
|
|
1502
|
+
var S;
|
|
1503
|
+
return (S = t.onSuccess) == null ? void 0 : S.call(
|
|
1511
1504
|
t,
|
|
1512
1505
|
d == null ? void 0 : d.data,
|
|
1513
1506
|
s,
|
|
1514
1507
|
y.context
|
|
1515
1508
|
);
|
|
1516
1509
|
}
|
|
1517
|
-
),
|
|
1510
|
+
), $ = V(
|
|
1518
1511
|
() => {
|
|
1519
|
-
var
|
|
1520
|
-
return (
|
|
1512
|
+
var S;
|
|
1513
|
+
return (S = t.onSettled) == null ? void 0 : S.call(
|
|
1521
1514
|
t,
|
|
1522
1515
|
d == null ? void 0 : d.data,
|
|
1523
1516
|
f,
|
|
@@ -1526,11 +1519,11 @@ const Lt = () => (s) => F(
|
|
|
1526
1519
|
);
|
|
1527
1520
|
}
|
|
1528
1521
|
).pipe(
|
|
1529
|
-
X((
|
|
1522
|
+
X((S) => d ? v(d) : v(S))
|
|
1530
1523
|
);
|
|
1531
|
-
return
|
|
1532
|
-
|
|
1533
|
-
|
|
1524
|
+
return Te(x, $).pipe(
|
|
1525
|
+
ke(),
|
|
1526
|
+
b(
|
|
1534
1527
|
() => f ? {
|
|
1535
1528
|
error: f,
|
|
1536
1529
|
data: void 0,
|
|
@@ -1547,9 +1540,9 @@ const Lt = () => (s) => F(
|
|
|
1547
1540
|
}
|
|
1548
1541
|
),
|
|
1549
1542
|
X(
|
|
1550
|
-
(
|
|
1551
|
-
|
|
1552
|
-
...
|
|
1543
|
+
(S) => h(S, y.context, 0).pipe(
|
|
1544
|
+
b((m) => ({
|
|
1545
|
+
...m,
|
|
1553
1546
|
data: void 0
|
|
1554
1547
|
}))
|
|
1555
1548
|
)
|
|
@@ -1567,75 +1560,75 @@ const Lt = () => (s) => F(
|
|
|
1567
1560
|
);
|
|
1568
1561
|
};
|
|
1569
1562
|
var Ee, se, be;
|
|
1570
|
-
class
|
|
1563
|
+
class Zs {
|
|
1571
1564
|
constructor({
|
|
1572
1565
|
options: e,
|
|
1573
1566
|
mutationCache: t,
|
|
1574
1567
|
state: r
|
|
1575
1568
|
}) {
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1569
|
+
w(this, Ee, new Y(0));
|
|
1570
|
+
w(this, se, new I());
|
|
1571
|
+
w(this, be, new I());
|
|
1572
|
+
g(this, "state", fe());
|
|
1573
|
+
g(this, "state$");
|
|
1574
|
+
g(this, "options");
|
|
1575
|
+
g(this, "observerCount$", a(this, Ee).asObservable());
|
|
1576
|
+
g(this, "cancelled$", a(this, se).asObservable());
|
|
1584
1577
|
this.options = e, this.state = r ?? this.state;
|
|
1585
1578
|
const n = a(this, se).pipe(
|
|
1586
1579
|
O(() => this.state.status === "pending"),
|
|
1587
|
-
|
|
1580
|
+
b(() => ({
|
|
1588
1581
|
status: "idle"
|
|
1589
1582
|
}))
|
|
1590
1583
|
), u = a(this, be).pipe(
|
|
1591
|
-
|
|
1592
|
-
(c) =>
|
|
1584
|
+
j(
|
|
1585
|
+
(c) => Xs({
|
|
1593
1586
|
options: {
|
|
1594
1587
|
...this.options,
|
|
1595
1588
|
onMutate: (l) => {
|
|
1596
|
-
const h =
|
|
1589
|
+
const h = V(
|
|
1597
1590
|
() => {
|
|
1598
|
-
var
|
|
1599
|
-
return (
|
|
1600
|
-
|
|
1591
|
+
var d, f;
|
|
1592
|
+
return (f = (d = t.config).onMutate) == null ? void 0 : f.call(
|
|
1593
|
+
d,
|
|
1601
1594
|
l,
|
|
1602
1595
|
this
|
|
1603
1596
|
);
|
|
1604
1597
|
}
|
|
1605
|
-
), p =
|
|
1606
|
-
var
|
|
1607
|
-
return (
|
|
1598
|
+
), p = V(() => {
|
|
1599
|
+
var d, f;
|
|
1600
|
+
return (f = (d = this.options).onMutate) == null ? void 0 : f.call(d, l);
|
|
1608
1601
|
});
|
|
1609
1602
|
return h.pipe(
|
|
1610
|
-
|
|
1603
|
+
q(() => p)
|
|
1611
1604
|
);
|
|
1612
1605
|
},
|
|
1613
1606
|
onError: (l, h, o) => {
|
|
1614
|
-
const p =
|
|
1607
|
+
const p = V(
|
|
1615
1608
|
() => {
|
|
1616
|
-
var
|
|
1617
|
-
return (
|
|
1618
|
-
|
|
1609
|
+
var d, f;
|
|
1610
|
+
return (f = (d = t.config).onError) == null ? void 0 : f.call(
|
|
1611
|
+
d,
|
|
1619
1612
|
l,
|
|
1620
1613
|
h,
|
|
1621
1614
|
o,
|
|
1622
1615
|
this
|
|
1623
1616
|
);
|
|
1624
1617
|
}
|
|
1625
|
-
),
|
|
1618
|
+
), F = V(
|
|
1626
1619
|
() => {
|
|
1627
|
-
var
|
|
1628
|
-
return (
|
|
1620
|
+
var d, f;
|
|
1621
|
+
return (f = (d = this.options).onError) == null ? void 0 : f.call(d, l, h, o);
|
|
1629
1622
|
}
|
|
1630
1623
|
);
|
|
1631
|
-
return
|
|
1624
|
+
return Te(p, F).pipe(ke());
|
|
1632
1625
|
},
|
|
1633
1626
|
onSettled: (l, h, o, p) => {
|
|
1634
|
-
const
|
|
1627
|
+
const F = V(
|
|
1635
1628
|
() => {
|
|
1636
|
-
var
|
|
1637
|
-
return (
|
|
1638
|
-
|
|
1629
|
+
var f, y;
|
|
1630
|
+
return (y = (f = t.config).onSettled) == null ? void 0 : y.call(
|
|
1631
|
+
f,
|
|
1639
1632
|
l,
|
|
1640
1633
|
h,
|
|
1641
1634
|
o,
|
|
@@ -1643,42 +1636,42 @@ class Bs {
|
|
|
1643
1636
|
this
|
|
1644
1637
|
);
|
|
1645
1638
|
}
|
|
1646
|
-
),
|
|
1639
|
+
), d = V(
|
|
1647
1640
|
() => {
|
|
1648
|
-
var
|
|
1649
|
-
return (
|
|
1641
|
+
var f, y;
|
|
1642
|
+
return (y = (f = this.options).onSettled) == null ? void 0 : y.call(f, l, h, o, p);
|
|
1650
1643
|
}
|
|
1651
1644
|
);
|
|
1652
|
-
return
|
|
1645
|
+
return Te(F, d).pipe(ke());
|
|
1653
1646
|
},
|
|
1654
1647
|
onSuccess: (l, h, o) => {
|
|
1655
|
-
const p =
|
|
1648
|
+
const p = V(
|
|
1656
1649
|
() => {
|
|
1657
|
-
var
|
|
1658
|
-
return (
|
|
1659
|
-
|
|
1650
|
+
var d, f;
|
|
1651
|
+
return (f = (d = t.config).onSuccess) == null ? void 0 : f.call(
|
|
1652
|
+
d,
|
|
1660
1653
|
l,
|
|
1661
1654
|
h,
|
|
1662
1655
|
o,
|
|
1663
1656
|
this
|
|
1664
1657
|
);
|
|
1665
1658
|
}
|
|
1666
|
-
),
|
|
1659
|
+
), F = V(
|
|
1667
1660
|
() => {
|
|
1668
|
-
var
|
|
1669
|
-
return (
|
|
1661
|
+
var d, f;
|
|
1662
|
+
return (f = (d = this.options).onSuccess) == null ? void 0 : f.call(d, l, h, o);
|
|
1670
1663
|
}
|
|
1671
1664
|
);
|
|
1672
|
-
return
|
|
1665
|
+
return Te(p, F).pipe(ke());
|
|
1673
1666
|
}
|
|
1674
1667
|
},
|
|
1675
1668
|
state: this.state,
|
|
1676
1669
|
variables: c
|
|
1677
1670
|
}).pipe(ne(a(this, se)))
|
|
1678
1671
|
)
|
|
1679
|
-
), i =
|
|
1672
|
+
), i = C(n, u);
|
|
1680
1673
|
this.state$ = i.pipe(
|
|
1681
|
-
|
|
1674
|
+
he(this.state),
|
|
1682
1675
|
Be(
|
|
1683
1676
|
(c, l) => ({
|
|
1684
1677
|
...c,
|
|
@@ -1686,8 +1679,8 @@ class Bs {
|
|
|
1686
1679
|
}),
|
|
1687
1680
|
this.state
|
|
1688
1681
|
),
|
|
1689
|
-
|
|
1690
|
-
|
|
1682
|
+
Dt,
|
|
1683
|
+
R((c) => {
|
|
1691
1684
|
this.state = c;
|
|
1692
1685
|
}),
|
|
1693
1686
|
Ue(1),
|
|
@@ -1723,41 +1716,41 @@ class Bs {
|
|
|
1723
1716
|
}
|
|
1724
1717
|
}
|
|
1725
1718
|
Ee = new WeakMap(), se = new WeakMap(), be = new WeakMap();
|
|
1726
|
-
const
|
|
1719
|
+
const Rt = ({
|
|
1727
1720
|
mutationKey: s,
|
|
1728
1721
|
status: e,
|
|
1729
1722
|
predicate: t,
|
|
1730
1723
|
exact: r = !0
|
|
1731
1724
|
} = {}) => (u) => r && s !== void 0 && u.options.mutationKey !== void 0 && !_e(u.options.mutationKey, s, { exact: r }) || !r && s !== void 0 && u.options.mutationKey !== void 0 && !_e(u.options.mutationKey, s, { exact: r }) || e && u.state.status !== e ? !1 : t ? t(u) : !0;
|
|
1732
|
-
class
|
|
1725
|
+
class Wt {
|
|
1733
1726
|
constructor() {
|
|
1734
1727
|
/**
|
|
1735
1728
|
* @important
|
|
1736
1729
|
* Query store. Could be turned into a map for more performance.
|
|
1737
1730
|
*/
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1731
|
+
g(this, "entriesSubject", new Y([]));
|
|
1732
|
+
g(this, "changeSubject", new I());
|
|
1733
|
+
g(this, "entries$", this.entriesSubject.pipe(ue()));
|
|
1734
|
+
g(this, "added$", this.changeSubject.pipe(
|
|
1742
1735
|
O(({ type: e }) => e === "added"),
|
|
1743
|
-
|
|
1744
|
-
|
|
1736
|
+
b(({ entity: e }) => e),
|
|
1737
|
+
ue()
|
|
1745
1738
|
));
|
|
1746
|
-
|
|
1739
|
+
g(this, "removed$", this.changeSubject.pipe(
|
|
1747
1740
|
O(({ type: e }) => e === "removed"),
|
|
1748
|
-
|
|
1749
|
-
|
|
1741
|
+
b(({ entity: e }) => e),
|
|
1742
|
+
ue()
|
|
1750
1743
|
));
|
|
1751
|
-
|
|
1744
|
+
g(this, "stateChange$", C(
|
|
1752
1745
|
this.entriesSubject.pipe(
|
|
1753
1746
|
Je(),
|
|
1754
|
-
|
|
1747
|
+
q((e) => Se(e))
|
|
1755
1748
|
),
|
|
1756
1749
|
this.added$
|
|
1757
1750
|
).pipe(
|
|
1758
|
-
|
|
1751
|
+
q(
|
|
1759
1752
|
(e) => e.state$.pipe(
|
|
1760
|
-
|
|
1753
|
+
b(() => e),
|
|
1761
1754
|
ne(
|
|
1762
1755
|
this.removed$.pipe(
|
|
1763
1756
|
O((t) => t === e)
|
|
@@ -1765,7 +1758,7 @@ class zt {
|
|
|
1765
1758
|
)
|
|
1766
1759
|
)
|
|
1767
1760
|
),
|
|
1768
|
-
|
|
1761
|
+
ue()
|
|
1769
1762
|
));
|
|
1770
1763
|
}
|
|
1771
1764
|
getValues() {
|
|
@@ -1783,14 +1776,14 @@ class zt {
|
|
|
1783
1776
|
return this.entriesSubject.getValue().find(e);
|
|
1784
1777
|
}
|
|
1785
1778
|
}
|
|
1786
|
-
var
|
|
1787
|
-
class
|
|
1779
|
+
var K;
|
|
1780
|
+
class er {
|
|
1788
1781
|
constructor(e = {}) {
|
|
1789
|
-
|
|
1782
|
+
w(this, K, new Wt());
|
|
1790
1783
|
this.config = e;
|
|
1791
1784
|
}
|
|
1792
1785
|
build(e, t, r) {
|
|
1793
|
-
const n = new
|
|
1786
|
+
const n = new Zs({
|
|
1794
1787
|
mutationCache: this,
|
|
1795
1788
|
options: e.defaultMutationOptions(t),
|
|
1796
1789
|
state: r
|
|
@@ -1801,63 +1794,63 @@ class Xs {
|
|
|
1801
1794
|
* we start the process of cleaning it up based on gc settings
|
|
1802
1795
|
*/
|
|
1803
1796
|
O(({ status: u }) => u === "success" || u === "error"),
|
|
1804
|
-
|
|
1797
|
+
j(
|
|
1805
1798
|
() => n.observerCount$.pipe(
|
|
1806
1799
|
O((u) => u <= 1),
|
|
1807
1800
|
He(1)
|
|
1808
1801
|
)
|
|
1809
1802
|
),
|
|
1810
1803
|
// defaults to 5mn
|
|
1811
|
-
|
|
1804
|
+
j(() => Qe(n.options.gcTime ?? 5 * 60 * 1e3)),
|
|
1812
1805
|
He(1)
|
|
1813
1806
|
).subscribe({
|
|
1814
1807
|
complete: () => {
|
|
1815
1808
|
this.remove(n);
|
|
1816
1809
|
}
|
|
1817
|
-
}), a(this,
|
|
1810
|
+
}), a(this, K).add(n), n;
|
|
1818
1811
|
}
|
|
1819
1812
|
getAll() {
|
|
1820
1813
|
return this.findAll();
|
|
1821
1814
|
}
|
|
1822
1815
|
remove(e) {
|
|
1823
|
-
const t = a(this,
|
|
1824
|
-
t == null || t.cancel(), a(this,
|
|
1816
|
+
const t = a(this, K).getValues().find((r) => r === e);
|
|
1817
|
+
t == null || t.cancel(), a(this, K).remove(e);
|
|
1825
1818
|
}
|
|
1826
1819
|
find(e) {
|
|
1827
|
-
const t = { exact: !0, ...e }, r =
|
|
1828
|
-
return a(this,
|
|
1820
|
+
const t = { exact: !0, ...e }, r = Rt(t);
|
|
1821
|
+
return a(this, K).getValues().find((n) => r(n));
|
|
1829
1822
|
}
|
|
1830
1823
|
findAll(e = {}) {
|
|
1831
|
-
const t = { exact: !0, ...e }, r =
|
|
1832
|
-
return a(this,
|
|
1824
|
+
const t = { exact: !0, ...e }, r = Rt(t);
|
|
1825
|
+
return a(this, K).getValues().filter((n) => r(n)).map((n) => n);
|
|
1833
1826
|
}
|
|
1834
1827
|
observe() {
|
|
1835
|
-
return a(this,
|
|
1828
|
+
return a(this, K).stateChange$.pipe(he());
|
|
1836
1829
|
}
|
|
1837
1830
|
/**
|
|
1838
1831
|
* @important
|
|
1839
1832
|
* ISO api react-query
|
|
1840
1833
|
*/
|
|
1841
1834
|
subscribe(e) {
|
|
1842
|
-
const t =
|
|
1843
|
-
a(this,
|
|
1844
|
-
|
|
1835
|
+
const t = C(
|
|
1836
|
+
a(this, K).added$.pipe(
|
|
1837
|
+
R((r) => {
|
|
1845
1838
|
e({
|
|
1846
1839
|
type: "added",
|
|
1847
1840
|
mutation: r
|
|
1848
1841
|
});
|
|
1849
1842
|
})
|
|
1850
1843
|
),
|
|
1851
|
-
a(this,
|
|
1852
|
-
|
|
1844
|
+
a(this, K).removed$.pipe(
|
|
1845
|
+
R((r) => {
|
|
1853
1846
|
e({
|
|
1854
1847
|
type: "removed",
|
|
1855
1848
|
mutation: r
|
|
1856
1849
|
});
|
|
1857
1850
|
})
|
|
1858
1851
|
),
|
|
1859
|
-
a(this,
|
|
1860
|
-
|
|
1852
|
+
a(this, K).stateChange$.pipe(
|
|
1853
|
+
R((r) => {
|
|
1861
1854
|
e({
|
|
1862
1855
|
type: "updated",
|
|
1863
1856
|
action: {
|
|
@@ -1877,10 +1870,9 @@ class Xs {
|
|
|
1877
1870
|
const e = this.findAll({
|
|
1878
1871
|
predicate: (r) => r.state.isPaused
|
|
1879
1872
|
});
|
|
1880
|
-
if (!e.length)
|
|
1881
|
-
return Z;
|
|
1873
|
+
if (!e.length) return Z;
|
|
1882
1874
|
const t = e.map((r) => r.continue());
|
|
1883
|
-
return
|
|
1875
|
+
return hs(t);
|
|
1884
1876
|
}
|
|
1885
1877
|
clear() {
|
|
1886
1878
|
this.getAll().forEach((e) => {
|
|
@@ -1888,8 +1880,8 @@ class Xs {
|
|
|
1888
1880
|
});
|
|
1889
1881
|
}
|
|
1890
1882
|
}
|
|
1891
|
-
|
|
1892
|
-
function
|
|
1883
|
+
K = new WeakMap();
|
|
1884
|
+
function tr(s) {
|
|
1893
1885
|
const e = typeof s.initialData == "function" ? s.initialData() : s.initialData, t = typeof e < "u", r = t ? typeof s.initialDataUpdatedAt == "function" ? s.initialDataUpdatedAt() : s.initialDataUpdatedAt : 0;
|
|
1894
1886
|
return {
|
|
1895
1887
|
data: e,
|
|
@@ -1906,26 +1898,26 @@ function Zs(s) {
|
|
|
1906
1898
|
fetchStatus: "idle"
|
|
1907
1899
|
};
|
|
1908
1900
|
}
|
|
1909
|
-
const
|
|
1901
|
+
const sr = (s) => Ae(() => ze.isFocused() ? s : ze.focusRegained$.pipe(q(() => s))), rr = (s) => {
|
|
1910
1902
|
let e = 0;
|
|
1911
1903
|
return (t) => {
|
|
1912
1904
|
const r = re.backToOnline$.pipe(
|
|
1913
|
-
|
|
1914
|
-
() =>
|
|
1905
|
+
q(
|
|
1906
|
+
() => C(
|
|
1915
1907
|
v({ fetchStatus: "fetching" }),
|
|
1916
1908
|
t
|
|
1917
1909
|
)
|
|
1918
1910
|
)
|
|
1919
1911
|
);
|
|
1920
|
-
return Ae(() => (e++, !re.isOnline() && s.networkMode === "offlineFirst" && e > 1 ?
|
|
1912
|
+
return Ae(() => (e++, !re.isOnline() && s.networkMode === "offlineFirst" && e > 1 ? C(
|
|
1921
1913
|
v({ fetchStatus: "paused" }),
|
|
1922
1914
|
r
|
|
1923
|
-
) : !re.isOnline() && s.networkMode !== "always" && s.networkMode !== "offlineFirst" ?
|
|
1915
|
+
) : !re.isOnline() && s.networkMode !== "always" && s.networkMode !== "offlineFirst" ? C(
|
|
1924
1916
|
v({ fetchStatus: "paused" }),
|
|
1925
1917
|
r
|
|
1926
1918
|
) : t));
|
|
1927
1919
|
};
|
|
1928
|
-
},
|
|
1920
|
+
}, nr = (s) => (e) => {
|
|
1929
1921
|
const t = new I(), r = t.pipe(
|
|
1930
1922
|
Je(),
|
|
1931
1923
|
/**
|
|
@@ -1933,15 +1925,15 @@ const er = (s) => Ae(() => ze.isFocused() ? s : ze.focusRegained$.pipe(N(() => s
|
|
|
1933
1925
|
* for the next tick to make sure observable chain received this data at least
|
|
1934
1926
|
*/
|
|
1935
1927
|
ot(1),
|
|
1936
|
-
|
|
1928
|
+
q(() => s.pipe(O((n) => n === 0)))
|
|
1937
1929
|
);
|
|
1938
1930
|
return e.pipe(
|
|
1939
|
-
|
|
1931
|
+
R(() => {
|
|
1940
1932
|
t.next();
|
|
1941
1933
|
}),
|
|
1942
1934
|
ne(r)
|
|
1943
1935
|
);
|
|
1944
|
-
},
|
|
1936
|
+
}, ir = (s) => {
|
|
1945
1937
|
const e = async () => await Promise.reject(new Error("No query found"));
|
|
1946
1938
|
process.env.NODE_ENV !== "production" && s.queryFn === it && console.error(
|
|
1947
1939
|
`Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${s.queryHash}'`
|
|
@@ -1959,26 +1951,26 @@ const er = (s) => Ae(() => ze.isFocused() ? s : ze.focusRegained$.pipe(N(() => s
|
|
|
1959
1951
|
})(u);
|
|
1960
1952
|
const l = (typeof r == "function" ? (
|
|
1961
1953
|
// eslint-disable-next-line @typescript-eslint/promise-function-async
|
|
1962
|
-
|
|
1954
|
+
V(
|
|
1963
1955
|
() => r(u)
|
|
1964
1956
|
)
|
|
1965
1957
|
) : r).pipe(
|
|
1966
|
-
|
|
1967
|
-
|
|
1958
|
+
nr(s.observers$),
|
|
1959
|
+
R({
|
|
1968
1960
|
complete: () => {
|
|
1969
1961
|
t = !0;
|
|
1970
1962
|
}
|
|
1971
1963
|
}),
|
|
1972
|
-
|
|
1964
|
+
b(
|
|
1973
1965
|
(o) => ({
|
|
1974
1966
|
data: o
|
|
1975
1967
|
})
|
|
1976
1968
|
),
|
|
1977
1969
|
// takeUntil(hasDataAndNoObservers$),
|
|
1978
|
-
|
|
1979
|
-
|
|
1970
|
+
rr(s),
|
|
1971
|
+
Pt({
|
|
1980
1972
|
...s,
|
|
1981
|
-
retryAfter: () => v(!0).pipe(
|
|
1973
|
+
retryAfter: () => v(!0).pipe(sr),
|
|
1982
1974
|
catchError: (o, p) => v({
|
|
1983
1975
|
status: "error",
|
|
1984
1976
|
fetchStatus: "idle",
|
|
@@ -1994,7 +1986,7 @@ const er = (s) => Ae(() => ze.isFocused() ? s : ze.focusRegained$.pipe(N(() => s
|
|
|
1994
1986
|
})
|
|
1995
1987
|
)
|
|
1996
1988
|
}),
|
|
1997
|
-
|
|
1989
|
+
q((o) => "data" in o ? v({
|
|
1998
1990
|
...o,
|
|
1999
1991
|
status: "success",
|
|
2000
1992
|
fetchStatus: "idle",
|
|
@@ -2018,7 +2010,7 @@ const er = (s) => Ae(() => ze.isFocused() ? s : ze.focusRegained$.pipe(N(() => s
|
|
|
2018
2010
|
* There is in theory no problem associated to that.
|
|
2019
2011
|
*/
|
|
2020
2012
|
ot(1),
|
|
2021
|
-
|
|
2013
|
+
b(
|
|
2022
2014
|
(p) => t ? p : { ...p, fetchStatus: "fetching" }
|
|
2023
2015
|
)
|
|
2024
2016
|
) : v(o)),
|
|
@@ -2027,30 +2019,30 @@ const er = (s) => Ae(() => ze.isFocused() ? s : ze.focusRegained$.pipe(N(() => s
|
|
|
2027
2019
|
* before shallow compare will not update the state, otherwise it's our chance to catch
|
|
2028
2020
|
* the end of observable fn.
|
|
2029
2021
|
*/
|
|
2030
|
-
|
|
2031
|
-
|
|
2022
|
+
ds({ fetchStatus: "idle" }),
|
|
2023
|
+
ue()
|
|
2032
2024
|
), h = v({
|
|
2033
2025
|
status: "pending",
|
|
2034
2026
|
fetchStatus: re.isOnline() ? "fetching" : "paused"
|
|
2035
2027
|
});
|
|
2036
2028
|
return {
|
|
2037
|
-
state$:
|
|
2029
|
+
state$: C(
|
|
2038
2030
|
h,
|
|
2039
2031
|
l
|
|
2040
2032
|
// emitOnComplete$
|
|
2041
|
-
).pipe(
|
|
2033
|
+
).pipe(ue()),
|
|
2042
2034
|
abortController: n
|
|
2043
2035
|
};
|
|
2044
2036
|
};
|
|
2045
|
-
class
|
|
2037
|
+
class ur {
|
|
2046
2038
|
constructor(e) {
|
|
2047
|
-
|
|
2048
|
-
|
|
2039
|
+
g(this, "revert");
|
|
2040
|
+
g(this, "silent");
|
|
2049
2041
|
this.revert = e == null ? void 0 : e.revert, this.silent = e == null ? void 0 : e.silent;
|
|
2050
2042
|
}
|
|
2051
2043
|
}
|
|
2052
|
-
const
|
|
2053
|
-
function
|
|
2044
|
+
const ar = { backgroundColor: "transparent", color: "inherit" };
|
|
2045
|
+
function Gt(s) {
|
|
2054
2046
|
const e = {
|
|
2055
2047
|
namespaces: [
|
|
2056
2048
|
{
|
|
@@ -2059,10 +2051,10 @@ function Wt(s) {
|
|
|
2059
2051
|
}
|
|
2060
2052
|
],
|
|
2061
2053
|
namespace(t, r) {
|
|
2062
|
-
const n =
|
|
2054
|
+
const n = Gt();
|
|
2063
2055
|
return n.namespaces.push({
|
|
2064
2056
|
name: t,
|
|
2065
|
-
style: r ??
|
|
2057
|
+
style: r ?? ar
|
|
2066
2058
|
}), n;
|
|
2067
2059
|
},
|
|
2068
2060
|
printNamespaces() {
|
|
@@ -2097,36 +2089,36 @@ function Wt(s) {
|
|
|
2097
2089
|
};
|
|
2098
2090
|
return e;
|
|
2099
2091
|
}
|
|
2100
|
-
const
|
|
2101
|
-
var xe,
|
|
2102
|
-
class
|
|
2092
|
+
const or = Gt();
|
|
2093
|
+
var xe, ce;
|
|
2094
|
+
class cr {
|
|
2103
2095
|
constructor(e) {
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2096
|
+
g(this, "queryKey");
|
|
2097
|
+
g(this, "queryHash");
|
|
2098
|
+
g(this, "gcTime");
|
|
2099
|
+
g(this, "options");
|
|
2100
|
+
w(this, xe);
|
|
2101
|
+
w(this, ce);
|
|
2102
|
+
g(this, "state");
|
|
2111
2103
|
// @todo to share with mutation
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2104
|
+
g(this, "executeSubject", new I());
|
|
2105
|
+
g(this, "cancelSubject", new I());
|
|
2106
|
+
g(this, "setDataSubject", new I());
|
|
2107
|
+
g(this, "invalidatedSubject", new I());
|
|
2108
|
+
g(this, "resetSubject", new I());
|
|
2109
|
+
g(this, "destroySubject", new I());
|
|
2110
|
+
g(this, "observersSubject", new Y([]));
|
|
2111
|
+
g(this, "abortSignalConsumed", !1);
|
|
2112
|
+
g(this, "observerCount$", this.observersSubject.asObservable().pipe(b((e) => e.length)));
|
|
2113
|
+
g(this, "observers$", this.observersSubject.asObservable());
|
|
2114
|
+
g(this, "state$");
|
|
2115
|
+
A(this, xe, e.defaultOptions), this.options = this.setOptions(e.options), this.queryKey = e.queryKey, this.queryHash = e.queryHash, A(this, ce, e.state ?? tr(this.options)), this.state = a(this, ce), this.gcTime = this.updateGcTime(this.options.gcTime), this.state$ = C(
|
|
2124
2116
|
this.resetSubject.pipe(
|
|
2125
|
-
|
|
2117
|
+
b(() => ({ command: "reset", state: a(this, ce) }))
|
|
2126
2118
|
),
|
|
2127
2119
|
this.invalidatedSubject.pipe(
|
|
2128
2120
|
O(() => !this.state.isInvalidated),
|
|
2129
|
-
|
|
2121
|
+
b(() => ({
|
|
2130
2122
|
command: "invalidate",
|
|
2131
2123
|
state: {
|
|
2132
2124
|
isInvalidated: !0
|
|
@@ -2135,29 +2127,29 @@ class ar {
|
|
|
2135
2127
|
),
|
|
2136
2128
|
this.cancelSubject.pipe(
|
|
2137
2129
|
O(() => !(this.state.error && this.state.status === "error")),
|
|
2138
|
-
|
|
2130
|
+
b((t) => ({
|
|
2139
2131
|
command: "cancel",
|
|
2140
2132
|
state: {
|
|
2141
2133
|
status: t != null && t.revert ? this.state.status : "error",
|
|
2142
2134
|
fetchStatus: "idle",
|
|
2143
|
-
error: new
|
|
2135
|
+
error: new ur(t)
|
|
2144
2136
|
}
|
|
2145
2137
|
}))
|
|
2146
2138
|
),
|
|
2147
2139
|
this.executeSubject.pipe(
|
|
2148
|
-
|
|
2140
|
+
q(() => {
|
|
2149
2141
|
let t = !1;
|
|
2150
2142
|
const r = this.executeSubject.pipe(
|
|
2151
2143
|
// should not be needed since the fetch return current promise
|
|
2152
2144
|
// in case we don't cancel
|
|
2153
2145
|
O((h) => (h == null ? void 0 : h.cancelRefetch) !== !1)
|
|
2154
2146
|
), n = this.observers$.pipe(
|
|
2155
|
-
|
|
2156
|
-
|
|
2147
|
+
At(),
|
|
2148
|
+
R(([h, o]) => {
|
|
2157
2149
|
o.length === 0 && h.length > 0 ? t = !0 : t = !1;
|
|
2158
2150
|
}),
|
|
2159
|
-
|
|
2160
|
-
), { state$: u, abortController: i } =
|
|
2151
|
+
ie()
|
|
2152
|
+
), { state$: u, abortController: i } = ir({
|
|
2161
2153
|
...this.options,
|
|
2162
2154
|
observers$: this.observerCount$,
|
|
2163
2155
|
queryKey: this.queryKey,
|
|
@@ -2171,21 +2163,21 @@ class ar {
|
|
|
2171
2163
|
}
|
|
2172
2164
|
}), c = this.observerCount$.pipe(
|
|
2173
2165
|
O((h) => h === 0 && this.abortSignalConsumed),
|
|
2174
|
-
|
|
2166
|
+
R(() => {
|
|
2175
2167
|
this.cancelSubject.next({ revert: !0 });
|
|
2176
2168
|
})
|
|
2177
|
-
), l =
|
|
2169
|
+
), l = C(
|
|
2178
2170
|
this.cancelSubject,
|
|
2179
2171
|
r,
|
|
2180
2172
|
this.resetSubject,
|
|
2181
2173
|
c
|
|
2182
2174
|
).pipe(
|
|
2183
|
-
|
|
2175
|
+
R(() => {
|
|
2184
2176
|
this.abortSignalConsumed && i.abort();
|
|
2185
2177
|
})
|
|
2186
2178
|
);
|
|
2187
|
-
return
|
|
2188
|
-
|
|
2179
|
+
return C(u, n).pipe(
|
|
2180
|
+
b((h) => ({
|
|
2189
2181
|
command: "execute",
|
|
2190
2182
|
state: h
|
|
2191
2183
|
})),
|
|
@@ -2194,7 +2186,7 @@ class ar {
|
|
|
2194
2186
|
})
|
|
2195
2187
|
),
|
|
2196
2188
|
this.setDataSubject.pipe(
|
|
2197
|
-
|
|
2189
|
+
b(({ data: t, options: r }) => ({
|
|
2198
2190
|
command: "setData",
|
|
2199
2191
|
state: {
|
|
2200
2192
|
status: "success",
|
|
@@ -2204,18 +2196,18 @@ class ar {
|
|
|
2204
2196
|
}))
|
|
2205
2197
|
)
|
|
2206
2198
|
).pipe(
|
|
2207
|
-
|
|
2199
|
+
Ks({
|
|
2208
2200
|
initialState: this.state,
|
|
2209
2201
|
getOptions: () => this.options,
|
|
2210
2202
|
getState: () => this.state
|
|
2211
2203
|
}),
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2204
|
+
he(a(this, ce)),
|
|
2205
|
+
U(P),
|
|
2206
|
+
R((t) => {
|
|
2215
2207
|
this.state = t;
|
|
2216
2208
|
}),
|
|
2217
2209
|
X((t) => {
|
|
2218
|
-
throw
|
|
2210
|
+
throw or.error(t), t;
|
|
2219
2211
|
}),
|
|
2220
2212
|
ne(this.destroySubject),
|
|
2221
2213
|
Ue({ bufferSize: 1, refCount: !1 })
|
|
@@ -2229,28 +2221,28 @@ class ar {
|
|
|
2229
2221
|
}
|
|
2230
2222
|
get success$() {
|
|
2231
2223
|
return this.state$.pipe(
|
|
2232
|
-
|
|
2233
|
-
|
|
2224
|
+
b(({ data: e, status: t }) => ({ data: e, status: t })),
|
|
2225
|
+
U(P),
|
|
2234
2226
|
O(({ status: e }) => e === "success")
|
|
2235
2227
|
);
|
|
2236
2228
|
}
|
|
2237
2229
|
get error$() {
|
|
2238
2230
|
return this.state$.pipe(
|
|
2239
|
-
|
|
2240
|
-
|
|
2231
|
+
b(({ error: e, status: t }) => ({ error: e, status: t })),
|
|
2232
|
+
U(P),
|
|
2241
2233
|
O(({ status: e }) => e === "error")
|
|
2242
2234
|
);
|
|
2243
2235
|
}
|
|
2244
2236
|
get settled$() {
|
|
2245
2237
|
return this.state$.pipe(
|
|
2246
|
-
|
|
2247
|
-
|
|
2238
|
+
b(({ status: e }) => ({ status: e })),
|
|
2239
|
+
U(P),
|
|
2248
2240
|
O(({ status: e }) => e === "success" || e === "error")
|
|
2249
2241
|
);
|
|
2250
2242
|
}
|
|
2251
2243
|
observe(e) {
|
|
2252
2244
|
return this.state$.pipe(
|
|
2253
|
-
|
|
2245
|
+
R({
|
|
2254
2246
|
subscribe: () => {
|
|
2255
2247
|
this.observersSubject.next([
|
|
2256
2248
|
e,
|
|
@@ -2285,11 +2277,11 @@ class ar {
|
|
|
2285
2277
|
return this.state.isInvalidated || !this.state.dataUpdatedAt || this.observersSubject.getValue().some((e) => e.getCurrentResult().isStale);
|
|
2286
2278
|
}
|
|
2287
2279
|
isStaleByTime(e = 0) {
|
|
2288
|
-
return this.state.isInvalidated || !this.state.dataUpdatedAt || !
|
|
2280
|
+
return this.state.isInvalidated || !this.state.dataUpdatedAt || !Ts(this.state.dataUpdatedAt, e);
|
|
2289
2281
|
}
|
|
2290
2282
|
async getFetchResultAsPromise() {
|
|
2291
2283
|
return await new Promise((e, t) => {
|
|
2292
|
-
this.state$.pipe(
|
|
2284
|
+
this.state$.pipe(qt, Ke()).subscribe({
|
|
2293
2285
|
error: t,
|
|
2294
2286
|
next: (r) => {
|
|
2295
2287
|
r.error ? t(r.error) : e(r.data);
|
|
@@ -2320,14 +2312,14 @@ class ar {
|
|
|
2320
2312
|
this.resetSubject.next();
|
|
2321
2313
|
}
|
|
2322
2314
|
}
|
|
2323
|
-
xe = new WeakMap(),
|
|
2315
|
+
xe = new WeakMap(), ce = new WeakMap();
|
|
2324
2316
|
var Re, G;
|
|
2325
|
-
class
|
|
2317
|
+
class lr {
|
|
2326
2318
|
// protected mountSubscriptions: Subscription[]
|
|
2327
2319
|
constructor(e = {}) {
|
|
2328
2320
|
// readonly #queries: QueryStore = new Map<string, Query>()
|
|
2329
|
-
|
|
2330
|
-
|
|
2321
|
+
w(this, Re, new I());
|
|
2322
|
+
w(this, G, new Wt());
|
|
2331
2323
|
this.config = e;
|
|
2332
2324
|
}
|
|
2333
2325
|
mount() {
|
|
@@ -2340,12 +2332,12 @@ class or {
|
|
|
2340
2332
|
observeIsFetching(e) {
|
|
2341
2333
|
return a(this, G).stateChange$.pipe(
|
|
2342
2334
|
// we force a first result
|
|
2343
|
-
|
|
2344
|
-
|
|
2335
|
+
he(),
|
|
2336
|
+
b(() => this.findAll({
|
|
2345
2337
|
...e,
|
|
2346
2338
|
fetchStatus: "fetching"
|
|
2347
2339
|
}).length),
|
|
2348
|
-
|
|
2340
|
+
U()
|
|
2349
2341
|
);
|
|
2350
2342
|
}
|
|
2351
2343
|
getAll() {
|
|
@@ -2353,12 +2345,12 @@ class or {
|
|
|
2353
2345
|
}
|
|
2354
2346
|
findAll(e = {}) {
|
|
2355
2347
|
const t = this.getAll();
|
|
2356
|
-
return Object.keys(e).length > 0 ? t.filter((r) =>
|
|
2348
|
+
return Object.keys(e).length > 0 ? t.filter((r) => xt(e, r)) : t;
|
|
2357
2349
|
}
|
|
2358
2350
|
build(e, t, r) {
|
|
2359
2351
|
const n = t.queryKey ?? [ct()], u = t.queryHash ?? dt(n, t);
|
|
2360
2352
|
let i = this.get(u);
|
|
2361
|
-
return i || (i = new
|
|
2353
|
+
return i || (i = new cr({
|
|
2362
2354
|
cache: this,
|
|
2363
2355
|
queryKey: n,
|
|
2364
2356
|
queryHash: u,
|
|
@@ -2393,10 +2385,10 @@ class or {
|
|
|
2393
2385
|
* Once a mutation is finished and there are no more observers than us
|
|
2394
2386
|
* we start the process of cleaning it up based on gc settings
|
|
2395
2387
|
*/
|
|
2396
|
-
|
|
2397
|
-
|
|
2388
|
+
Ns,
|
|
2389
|
+
j((r) => r ? t.pipe(
|
|
2398
2390
|
// defaults to 5mn
|
|
2399
|
-
|
|
2391
|
+
j(() => e.gcTime === 1 / 0 ? qe : (setTimeout(N, e.gcTime), Qe(e.gcTime)))
|
|
2400
2392
|
) : qe),
|
|
2401
2393
|
He(1)
|
|
2402
2394
|
).subscribe({
|
|
@@ -2412,12 +2404,12 @@ class or {
|
|
|
2412
2404
|
find(e) {
|
|
2413
2405
|
const t = { exact: !0, ...e };
|
|
2414
2406
|
return this.getAll().find(
|
|
2415
|
-
(r) =>
|
|
2407
|
+
(r) => xt(t, r)
|
|
2416
2408
|
);
|
|
2417
2409
|
}
|
|
2418
2410
|
subscribe(e) {
|
|
2419
|
-
const t =
|
|
2420
|
-
a(this, Re).pipe(
|
|
2411
|
+
const t = C(
|
|
2412
|
+
a(this, Re).pipe(R(e))
|
|
2421
2413
|
// this.#store.added$.pipe(
|
|
2422
2414
|
// mergeMap((query) => {
|
|
2423
2415
|
// fn({
|
|
@@ -2454,30 +2446,30 @@ class or {
|
|
|
2454
2446
|
}
|
|
2455
2447
|
}
|
|
2456
2448
|
Re = new WeakMap(), G = new WeakMap();
|
|
2457
|
-
var
|
|
2458
|
-
class
|
|
2449
|
+
var le, Q, je, Me, ge;
|
|
2450
|
+
class Mr {
|
|
2459
2451
|
// #destroy = () => {}
|
|
2460
2452
|
constructor({
|
|
2461
2453
|
mutationCache: e,
|
|
2462
2454
|
queryCache: t,
|
|
2463
2455
|
defaultOptions: r
|
|
2464
2456
|
} = {}) {
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2457
|
+
w(this, le);
|
|
2458
|
+
w(this, Q);
|
|
2459
|
+
w(this, je, /* @__PURE__ */ new Map());
|
|
2460
|
+
w(this, Me, /* @__PURE__ */ new Map());
|
|
2461
|
+
w(this, ge);
|
|
2462
|
+
A(this, le, e ?? new er()), A(this, Q, t ?? new lr()), A(this, ge, r ?? {});
|
|
2471
2463
|
}
|
|
2472
2464
|
mount() {
|
|
2473
2465
|
}
|
|
2474
2466
|
unmount() {
|
|
2475
2467
|
}
|
|
2476
2468
|
getMutationCache() {
|
|
2477
|
-
return a(this,
|
|
2469
|
+
return a(this, le);
|
|
2478
2470
|
}
|
|
2479
2471
|
getQueryCache() {
|
|
2480
|
-
return a(this,
|
|
2472
|
+
return a(this, Q);
|
|
2481
2473
|
}
|
|
2482
2474
|
defaultMutationOptions(e) {
|
|
2483
2475
|
return {
|
|
@@ -2503,14 +2495,14 @@ class Rr {
|
|
|
2503
2495
|
async fetchQuery(e) {
|
|
2504
2496
|
const t = this.defaultQueryOptions(e);
|
|
2505
2497
|
typeof t.retry > "u" && (t.retry = !1);
|
|
2506
|
-
const r = a(this,
|
|
2498
|
+
const r = a(this, Q).build(this, t);
|
|
2507
2499
|
return r.isStaleByTime(t.staleTime) ? await r.fetch(t) : await Promise.resolve(r.state.data);
|
|
2508
2500
|
}
|
|
2509
2501
|
async prefetchQuery(e) {
|
|
2510
|
-
await this.fetchQuery(e).then(
|
|
2502
|
+
await this.fetchQuery(e).then(N).catch(N);
|
|
2511
2503
|
}
|
|
2512
2504
|
async resetQueries(e, t) {
|
|
2513
|
-
const r = a(this,
|
|
2505
|
+
const r = a(this, Q), n = {
|
|
2514
2506
|
type: "active",
|
|
2515
2507
|
...e
|
|
2516
2508
|
};
|
|
@@ -2522,23 +2514,23 @@ class Rr {
|
|
|
2522
2514
|
const r = {
|
|
2523
2515
|
...t,
|
|
2524
2516
|
cancelRefetch: (t == null ? void 0 : t.cancelRefetch) ?? !0
|
|
2525
|
-
}, n = a(this,
|
|
2517
|
+
}, n = a(this, Q).findAll(e).filter((u) => !u.isDisabled()).map(async (u) => {
|
|
2526
2518
|
let i = u.fetch(void 0, r);
|
|
2527
|
-
return r.throwOnError || (i = i.catch(
|
|
2519
|
+
return r.throwOnError || (i = i.catch(N)), u.state.fetchStatus === "paused" ? void 0 : await i;
|
|
2528
2520
|
});
|
|
2529
|
-
await Promise.all(n).then(
|
|
2521
|
+
await Promise.all(n).then(N);
|
|
2530
2522
|
}
|
|
2531
2523
|
getQueryData(e) {
|
|
2532
2524
|
var r;
|
|
2533
2525
|
const t = this.defaultQueryOptions({ queryKey: e });
|
|
2534
|
-
return (r = a(this,
|
|
2526
|
+
return (r = a(this, Q).get(t.queryHash)) == null ? void 0 : r.state.data;
|
|
2535
2527
|
}
|
|
2536
2528
|
setQueryData(e, t, r) {
|
|
2537
|
-
const n = this.defaultQueryOptions({ queryKey: e }), u = a(this,
|
|
2529
|
+
const n = this.defaultQueryOptions({ queryKey: e }), u = a(this, Q).get(
|
|
2538
2530
|
n.queryHash
|
|
2539
|
-
), i = u == null ? void 0 : u.state.data, c =
|
|
2531
|
+
), i = u == null ? void 0 : u.state.data, c = ks(t, i);
|
|
2540
2532
|
if (c !== void 0)
|
|
2541
|
-
return a(this,
|
|
2533
|
+
return a(this, Q).build(this, n).setData(c, { ...r, manual: !0 });
|
|
2542
2534
|
}
|
|
2543
2535
|
getMutationDefaults(e) {
|
|
2544
2536
|
const t = [...a(this, je).values()];
|
|
@@ -2549,7 +2541,7 @@ class Rr {
|
|
|
2549
2541
|
}
|
|
2550
2542
|
getQueryState(e) {
|
|
2551
2543
|
var t;
|
|
2552
|
-
return (t = a(this,
|
|
2544
|
+
return (t = a(this, Q).find({ queryKey: e })) == null ? void 0 : t.state;
|
|
2553
2545
|
}
|
|
2554
2546
|
setMutationDefaults(e, t) {
|
|
2555
2547
|
a(this, je).set(ve(e), {
|
|
@@ -2571,19 +2563,19 @@ class Rr {
|
|
|
2571
2563
|
}), r;
|
|
2572
2564
|
}
|
|
2573
2565
|
removeQueries(e) {
|
|
2574
|
-
const t = a(this,
|
|
2566
|
+
const t = a(this, Q);
|
|
2575
2567
|
t.findAll(e).forEach((r) => {
|
|
2576
2568
|
t.remove(r);
|
|
2577
2569
|
});
|
|
2578
2570
|
}
|
|
2579
2571
|
async cancelQueries(e = {}, t = {}) {
|
|
2580
|
-
const r = { revert: !0, ...t }, n = a(this,
|
|
2572
|
+
const r = { revert: !0, ...t }, n = a(this, Q).findAll(e).map(async (u) => {
|
|
2581
2573
|
await u.cancel(r);
|
|
2582
2574
|
});
|
|
2583
|
-
await Promise.all(n).then(
|
|
2575
|
+
await Promise.all(n).then(N).catch(N);
|
|
2584
2576
|
}
|
|
2585
2577
|
async invalidateQueries(e = {}, t = {}) {
|
|
2586
|
-
if (a(this,
|
|
2578
|
+
if (a(this, Q).findAll(e).forEach((n) => {
|
|
2587
2579
|
n.invalidate();
|
|
2588
2580
|
}), e.refetchType === "none") {
|
|
2589
2581
|
await Promise.resolve();
|
|
@@ -2596,45 +2588,45 @@ class Rr {
|
|
|
2596
2588
|
await this.refetchQueries(r, t);
|
|
2597
2589
|
}
|
|
2598
2590
|
async resumePausedMutations() {
|
|
2599
|
-
return await
|
|
2591
|
+
return await fs(a(this, le).resumePausedMutations());
|
|
2600
2592
|
}
|
|
2601
2593
|
isFetching(e) {
|
|
2602
|
-
return a(this,
|
|
2594
|
+
return a(this, Q).findAll({ ...e, fetchStatus: "fetching" }).length;
|
|
2603
2595
|
}
|
|
2604
2596
|
clear() {
|
|
2605
|
-
a(this,
|
|
2597
|
+
a(this, Q).clear(), a(this, le).clear();
|
|
2606
2598
|
}
|
|
2607
2599
|
}
|
|
2608
|
-
|
|
2600
|
+
le = new WeakMap(), Q = new WeakMap(), je = new WeakMap(), Me = new WeakMap(), ge = new WeakMap();
|
|
2609
2601
|
export {
|
|
2610
|
-
|
|
2611
|
-
|
|
2612
|
-
|
|
2613
|
-
|
|
2614
|
-
|
|
2615
|
-
|
|
2616
|
-
|
|
2617
|
-
|
|
2618
|
-
|
|
2619
|
-
|
|
2602
|
+
er as MutationCache,
|
|
2603
|
+
lr as QueryCache,
|
|
2604
|
+
Mr as QueryClient,
|
|
2605
|
+
Fr as QueryClientProvider,
|
|
2606
|
+
vs as SIGNAL_RESET,
|
|
2607
|
+
wr as arrayEqual,
|
|
2608
|
+
$s as createLocalStorageAdapter,
|
|
2609
|
+
vr as createLocalforageAdapter,
|
|
2610
|
+
xs as exponentialBackoffDelay,
|
|
2611
|
+
Es as getDelay,
|
|
2620
2612
|
rt as isDefined,
|
|
2621
|
-
|
|
2622
|
-
|
|
2613
|
+
Pt as retryBackoff,
|
|
2614
|
+
mr as signal,
|
|
2623
2615
|
It as useBehaviorSubject,
|
|
2624
|
-
|
|
2625
|
-
|
|
2626
|
-
|
|
2627
|
-
|
|
2628
|
-
|
|
2629
|
-
|
|
2616
|
+
Rs as useEffectOnce,
|
|
2617
|
+
Rr as useForeverQuery,
|
|
2618
|
+
H as useLiveRef,
|
|
2619
|
+
Cr as useMount,
|
|
2620
|
+
Er as useMutation,
|
|
2621
|
+
gr as useObservableState,
|
|
2630
2622
|
Xe as useObserve,
|
|
2631
|
-
|
|
2632
|
-
|
|
2633
|
-
|
|
2623
|
+
br as useObserveCallback,
|
|
2624
|
+
Or as usePersistSignals,
|
|
2625
|
+
xr as useQuery,
|
|
2634
2626
|
kt as useQueryClient,
|
|
2635
|
-
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
|
|
2639
|
-
|
|
2627
|
+
Sr as useSignalValue,
|
|
2628
|
+
Vt as useSubject,
|
|
2629
|
+
Ut as useSubscribe,
|
|
2630
|
+
jr as useSubscribeEffect,
|
|
2631
|
+
$r as useUnmountObservable
|
|
2640
2632
|
};
|