reactjrx 1.87.1 → 1.89.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.d.ts +3 -0
- package/dist/index.js +216 -206
- package/dist/lib/utils/useEffectOnce.d.ts +3 -0
- package/dist/lib/utils/useMount.d.ts +1 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
var Yt = Object.defineProperty;
|
|
2
2
|
var Bt = (s, e, t) => e in s ? Yt(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
|
|
3
|
-
var m = (s, e, t) => (Bt(s, typeof e != "symbol" ? e + "" : e, t), t),
|
|
3
|
+
var m = (s, e, t) => (Bt(s, typeof e != "symbol" ? e + "" : e, t), t), yt = (s, e, t) => {
|
|
4
4
|
if (!e.has(s))
|
|
5
5
|
throw TypeError("Cannot " + t);
|
|
6
6
|
};
|
|
7
|
-
var a = (s, e, t) => (
|
|
7
|
+
var a = (s, e, t) => (yt(s, e, "read from private field"), t ? t.call(s) : e.get(s)), C = (s, e, t) => {
|
|
8
8
|
if (e.has(s))
|
|
9
9
|
throw TypeError("Cannot add the same private member more than once");
|
|
10
10
|
e instanceof WeakSet ? e.add(s) : e.set(s, t);
|
|
11
|
-
}, M = (s, e, t, r) => (
|
|
11
|
+
}, M = (s, e, t, r) => (yt(s, e, "write to private field"), r ? r.call(s, t) : e.set(s, t), t);
|
|
12
12
|
import * as Ge from "react";
|
|
13
|
-
import { useRef as me, useMemo as ut, useCallback as le, useSyncExternalStore as Xt, useEffect as
|
|
14
|
-
import { distinctUntilChanged as Q, tap as E, catchError as
|
|
15
|
-
import { catchError as mt, mergeMap as tt, retryWhen as fs, concatMap as ps, first as
|
|
16
|
-
import { jsxs as
|
|
13
|
+
import { useRef as me, useMemo as ut, useCallback as le, useSyncExternalStore as Xt, useEffect as J, createContext as Zt, memo as es, useContext as ts, useState as jt } from "react";
|
|
14
|
+
import { distinctUntilChanged as Q, tap as E, catchError as X, EMPTY as Z, isObservable as bt, from as Se, of as v, defer as Ae, Subject as I, BehaviorSubject as Y, skip as at, first as Je, map as g, switchMap as x, zip as ss, mergeMap as k, merge as F, filter as O, throttleTime as rs, asyncScheduler as ns, throwError as Oe, timer as Qe, Observable as is, takeWhile as Ye, concatMap as us, last as Ke, takeUntil as ne, identity as Mt, shareReplay as Ue, ignoreElements as he, scan as Be, fromEvent as Ne, noop as N, startWith as ce, pairwise as At, NEVER as qe, delay as ot, interval as as, withLatestFrom as gt, retry as os, iif as cs, concat as ke, toArray as Te, share as de, take as He, combineLatest as ls, endWith as hs, lastValueFrom as ds } from "rxjs";
|
|
15
|
+
import { catchError as mt, mergeMap as tt, retryWhen as fs, concatMap as ps, first as ys, tap as Qt } from "rxjs/operators";
|
|
16
|
+
import { jsxs as bs, jsx as gs } from "react/jsx-runtime";
|
|
17
17
|
const q = (s) => {
|
|
18
18
|
const e = me(s);
|
|
19
19
|
return ut(() => {
|
|
@@ -31,7 +31,7 @@ function Xe(s, e, t) {
|
|
|
31
31
|
"getValue" in s && typeof s.getValue == "function" ? s.getValue() : r.defaultValue
|
|
32
32
|
), i = q(s), c = q(r), l = le(
|
|
33
33
|
(p) => {
|
|
34
|
-
const d = i.current,
|
|
34
|
+
const d = i.current, y = (typeof d == "function" ? d : () => d)().pipe(
|
|
35
35
|
/**
|
|
36
36
|
* @important
|
|
37
37
|
* We only check primitives because underlying subscription might
|
|
@@ -39,13 +39,13 @@ function Xe(s, e, t) {
|
|
|
39
39
|
* properties values
|
|
40
40
|
*/
|
|
41
41
|
Q(ms),
|
|
42
|
-
E((
|
|
43
|
-
u.current =
|
|
42
|
+
E((b) => {
|
|
43
|
+
u.current = b;
|
|
44
44
|
}),
|
|
45
|
-
|
|
45
|
+
X((b) => (console.error(b), Z))
|
|
46
46
|
).subscribe(p);
|
|
47
47
|
return () => {
|
|
48
|
-
c.current.unsubscribeOnUnmount !== !1 &&
|
|
48
|
+
c.current.unsubscribeOnUnmount !== !1 && y.unsubscribe();
|
|
49
49
|
};
|
|
50
50
|
},
|
|
51
51
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
@@ -57,7 +57,7 @@ function St(s) {
|
|
|
57
57
|
return s instanceof Promise || s && typeof s.then == "function" && typeof s.catch == "function";
|
|
58
58
|
}
|
|
59
59
|
function U(s) {
|
|
60
|
-
if (
|
|
60
|
+
if (bt(s))
|
|
61
61
|
return s;
|
|
62
62
|
if (St(s))
|
|
63
63
|
return Se(s);
|
|
@@ -66,12 +66,12 @@ function U(s) {
|
|
|
66
66
|
const e = s;
|
|
67
67
|
return Ae(() => {
|
|
68
68
|
const t = e();
|
|
69
|
-
return St(t) ? Se(t) :
|
|
69
|
+
return St(t) ? Se(t) : bt(t) ? t : v(t);
|
|
70
70
|
});
|
|
71
71
|
}
|
|
72
72
|
function Ut(s, e = []) {
|
|
73
73
|
const t = q(s);
|
|
74
|
-
|
|
74
|
+
J(() => {
|
|
75
75
|
const r = U(t.current).subscribe();
|
|
76
76
|
return () => {
|
|
77
77
|
r.unsubscribe();
|
|
@@ -84,7 +84,7 @@ function Ut(s, e = []) {
|
|
|
84
84
|
}
|
|
85
85
|
const Ze = (s) => {
|
|
86
86
|
const e = me();
|
|
87
|
-
return e.current || (e.current = s()),
|
|
87
|
+
return e.current || (e.current = s()), J(() => {
|
|
88
88
|
process.env.NODE_ENV;
|
|
89
89
|
}, []), e;
|
|
90
90
|
}, It = ({
|
|
@@ -92,14 +92,14 @@ const Ze = (s) => {
|
|
|
92
92
|
completeOnUnmount: e = !0
|
|
93
93
|
} = {}) => {
|
|
94
94
|
const t = Ze(() => new I()), r = me(!1), n = q(s), u = q(e);
|
|
95
|
-
return
|
|
95
|
+
return J(() => (r.current && (t.current = new I(), r.current = !1), () => {
|
|
96
96
|
if (!u.current) {
|
|
97
97
|
r.current = !0;
|
|
98
98
|
return;
|
|
99
99
|
}
|
|
100
100
|
r.current || (n.current != null && n.current(), t.current.complete(), r.current = !0);
|
|
101
101
|
}), [u, n, t]), t;
|
|
102
|
-
},
|
|
102
|
+
}, pr = () => {
|
|
103
103
|
const s = It(), e = q(s.current.asObservable()), t = le(
|
|
104
104
|
(r) => {
|
|
105
105
|
s.current.next(r);
|
|
@@ -109,11 +109,11 @@ const Ze = (s) => {
|
|
|
109
109
|
);
|
|
110
110
|
return [e.current, t];
|
|
111
111
|
}, Vt = (s) => {
|
|
112
|
-
const e = Ze(() => new
|
|
113
|
-
return
|
|
112
|
+
const e = Ze(() => new Y(s)), t = me(!1), r = me(s);
|
|
113
|
+
return J(() => (t.current && (e.current = new Y(r.current), t.current = !1), () => {
|
|
114
114
|
t.current || (e.current.complete(), t.current = !0);
|
|
115
115
|
}), [e]), e;
|
|
116
|
-
},
|
|
116
|
+
}, yr = (s) => {
|
|
117
117
|
const e = Vt(s), t = q(e.current.asObservable()), r = le(
|
|
118
118
|
(n) => {
|
|
119
119
|
e.current.next(n);
|
|
@@ -127,7 +127,7 @@ function br(s = {}) {
|
|
|
127
127
|
const e = {
|
|
128
128
|
default: s.default,
|
|
129
129
|
key: s.key
|
|
130
|
-
}, { default: t } = e ?? {}, r = new
|
|
130
|
+
}, { default: t } = e ?? {}, r = new Y(t), n = (i) => {
|
|
131
131
|
if (typeof i == "function") {
|
|
132
132
|
const c = i(r.getValue());
|
|
133
133
|
if (c === r.getValue())
|
|
@@ -160,7 +160,7 @@ function br(s = {}) {
|
|
|
160
160
|
subject: r
|
|
161
161
|
};
|
|
162
162
|
}
|
|
163
|
-
function
|
|
163
|
+
function gr(s, e) {
|
|
164
164
|
const r = e ?? (() => s.getValue());
|
|
165
165
|
return Xe(
|
|
166
166
|
() => s.subject.pipe(
|
|
@@ -173,7 +173,7 @@ function yr(s, e) {
|
|
|
173
173
|
[]
|
|
174
174
|
);
|
|
175
175
|
}
|
|
176
|
-
const
|
|
176
|
+
const mr = (s) => ({
|
|
177
177
|
getItem: async (e) => {
|
|
178
178
|
const t = await s.getItem(e);
|
|
179
179
|
if (t)
|
|
@@ -236,7 +236,7 @@ function rt(s) {
|
|
|
236
236
|
}
|
|
237
237
|
const vt = (s) => {
|
|
238
238
|
const e = Vt(s);
|
|
239
|
-
return
|
|
239
|
+
return J(() => {
|
|
240
240
|
e.current.next(s);
|
|
241
241
|
}, [s, e]), e;
|
|
242
242
|
}, Ot = ({
|
|
@@ -250,7 +250,7 @@ const vt = (s) => {
|
|
|
250
250
|
migrationVersion: t
|
|
251
251
|
};
|
|
252
252
|
return Se(s.setItem(e.config.key, n)).pipe(
|
|
253
|
-
|
|
253
|
+
X((u) => (console.error(u), v(null)))
|
|
254
254
|
);
|
|
255
255
|
}, ws = ({
|
|
256
256
|
adapter: s,
|
|
@@ -261,7 +261,7 @@ const vt = (s) => {
|
|
|
261
261
|
const n = $s(r);
|
|
262
262
|
return n ? n.migrationVersion !== void 0 && e > n.migrationVersion ? v(r) : (t.setValue(n.value), v(r)) : v(r);
|
|
263
263
|
})
|
|
264
|
-
),
|
|
264
|
+
), Sr = ({
|
|
265
265
|
entries: s = [],
|
|
266
266
|
onReady: e,
|
|
267
267
|
adapter: t
|
|
@@ -294,7 +294,7 @@ const vt = (s) => {
|
|
|
294
294
|
E(() => {
|
|
295
295
|
n.current != null && n.current();
|
|
296
296
|
}),
|
|
297
|
-
|
|
297
|
+
X((p) => (console.error("Unable to hydrate", p), Z))
|
|
298
298
|
);
|
|
299
299
|
})
|
|
300
300
|
);
|
|
@@ -328,7 +328,7 @@ const vt = (s) => {
|
|
|
328
328
|
),
|
|
329
329
|
[c, u]
|
|
330
330
|
), { isHydrated: i };
|
|
331
|
-
},
|
|
331
|
+
}, vr = () => {
|
|
332
332
|
const s = It({
|
|
333
333
|
onBeforeComplete: () => {
|
|
334
334
|
s.current.next();
|
|
@@ -361,31 +361,31 @@ function Pt(s) {
|
|
|
361
361
|
} = l;
|
|
362
362
|
return (d) => Ae(() => {
|
|
363
363
|
let f = 0;
|
|
364
|
-
const
|
|
364
|
+
const y = (b, $) => b < u ? i(b, $) : !1;
|
|
365
365
|
return d.pipe(
|
|
366
|
-
mt((
|
|
366
|
+
mt((b) => {
|
|
367
367
|
var w;
|
|
368
|
-
if (f++, !
|
|
369
|
-
throw
|
|
370
|
-
const $ = (w = s.caughtError) == null ? void 0 : w.call(s, f,
|
|
368
|
+
if (f++, !y(f - 1, b))
|
|
369
|
+
throw b;
|
|
370
|
+
const $ = (w = s.caughtError) == null ? void 0 : w.call(s, f, b);
|
|
371
371
|
if (!$)
|
|
372
|
-
throw
|
|
372
|
+
throw b;
|
|
373
373
|
return $.pipe(
|
|
374
374
|
tt(
|
|
375
375
|
(H) => F(
|
|
376
376
|
v(H),
|
|
377
|
-
Oe(() =>
|
|
377
|
+
Oe(() => b)
|
|
378
378
|
)
|
|
379
379
|
)
|
|
380
380
|
);
|
|
381
381
|
}),
|
|
382
|
-
fs((
|
|
382
|
+
fs((b) => b.pipe(
|
|
383
383
|
ps(($) => {
|
|
384
384
|
const w = f - 1;
|
|
385
385
|
return n().pipe(
|
|
386
|
-
|
|
386
|
+
ys(),
|
|
387
387
|
tt(
|
|
388
|
-
() =>
|
|
388
|
+
() => y(w, $) ? Qe(
|
|
389
389
|
Cs(
|
|
390
390
|
p(w, c),
|
|
391
391
|
h
|
|
@@ -397,10 +397,10 @@ function Pt(s) {
|
|
|
397
397
|
);
|
|
398
398
|
})
|
|
399
399
|
)),
|
|
400
|
-
mt((
|
|
400
|
+
mt((b) => {
|
|
401
401
|
if (s.catchError)
|
|
402
|
-
return s.catchError(f,
|
|
403
|
-
throw
|
|
402
|
+
return s.catchError(f, b);
|
|
403
|
+
throw b;
|
|
404
404
|
}),
|
|
405
405
|
Qt(() => {
|
|
406
406
|
o && (f = 0);
|
|
@@ -408,6 +408,13 @@ function Pt(s) {
|
|
|
408
408
|
);
|
|
409
409
|
});
|
|
410
410
|
}
|
|
411
|
+
const Or = (s, e) => s.length === e.length && s.every((t, r) => t === e[r]), Es = (s) => {
|
|
412
|
+
J(s, []);
|
|
413
|
+
}, $r = (s) => {
|
|
414
|
+
Es(() => {
|
|
415
|
+
s();
|
|
416
|
+
});
|
|
417
|
+
};
|
|
411
418
|
function $t(s) {
|
|
412
419
|
return Object.prototype.toString.call(s) === "[object Object]";
|
|
413
420
|
}
|
|
@@ -453,13 +460,13 @@ const we = (s) => s.pipe(
|
|
|
453
460
|
)
|
|
454
461
|
);
|
|
455
462
|
var ee;
|
|
456
|
-
class
|
|
463
|
+
class xs {
|
|
457
464
|
constructor({
|
|
458
465
|
__queryFinalizeHook: e
|
|
459
466
|
} = {}) {
|
|
460
467
|
C(this, ee, new I());
|
|
461
468
|
m(this, "state$");
|
|
462
|
-
const t = new
|
|
469
|
+
const t = new Y(0), r = t.pipe(
|
|
463
470
|
O((n) => n === 0)
|
|
464
471
|
);
|
|
465
472
|
this.state$ = a(this, ee).pipe(
|
|
@@ -494,7 +501,7 @@ class Es {
|
|
|
494
501
|
*/
|
|
495
502
|
o
|
|
496
503
|
).pipe(
|
|
497
|
-
g((
|
|
504
|
+
g((y) => ({ state: y, mutation: u })),
|
|
498
505
|
e ?? Mt,
|
|
499
506
|
ne(f)
|
|
500
507
|
);
|
|
@@ -540,10 +547,10 @@ const Dt = (s) => s.pipe(
|
|
|
540
547
|
)
|
|
541
548
|
);
|
|
542
549
|
var ie, L;
|
|
543
|
-
class
|
|
550
|
+
class Rs {
|
|
544
551
|
constructor(e, t = {}, r) {
|
|
545
552
|
C(this, ie, void 0);
|
|
546
|
-
C(this, L, new
|
|
553
|
+
C(this, L, new Y(void 0));
|
|
547
554
|
/**
|
|
548
555
|
* @important
|
|
549
556
|
* Used to maintain persistance to latest mutation. This ensure
|
|
@@ -564,7 +571,7 @@ class xs {
|
|
|
564
571
|
reset: this.reset
|
|
565
572
|
}));
|
|
566
573
|
var n;
|
|
567
|
-
this.client = e, this.options = t, this.options.mutationKey = ((n = this.options) == null ? void 0 : n.mutationKey) ?? [ct()], M(this, ie, r ?? new
|
|
574
|
+
this.client = e, this.options = t, this.options.mutationKey = ((n = this.options) == null ? void 0 : n.mutationKey) ?? [ct()], M(this, ie, r ?? new xs(this.options)), this.mutate = this.mutate.bind(this), this.reset = this.reset.bind(this), a(this, L).pipe(
|
|
568
575
|
O(rt),
|
|
569
576
|
k(
|
|
570
577
|
(u) => a(this, ie).state$.pipe(
|
|
@@ -690,13 +697,13 @@ class xs {
|
|
|
690
697
|
}
|
|
691
698
|
}
|
|
692
699
|
ie = new WeakMap(), L = new WeakMap();
|
|
693
|
-
const kt = Zt(void 0),
|
|
700
|
+
const kt = Zt(void 0), js = ({ client: s }) => (J(() => (s.mount(), () => {
|
|
694
701
|
s.unmount();
|
|
695
|
-
}), [s]), null),
|
|
702
|
+
}), [s]), null), wr = es(
|
|
696
703
|
({ children: s, client: e }) => {
|
|
697
704
|
const t = ut(() => e, [e]);
|
|
698
|
-
return /* @__PURE__ */
|
|
699
|
-
/* @__PURE__ */ gs(
|
|
705
|
+
return /* @__PURE__ */ bs(kt.Provider, { value: t, children: [
|
|
706
|
+
/* @__PURE__ */ gs(js, { client: e }),
|
|
700
707
|
s
|
|
701
708
|
] });
|
|
702
709
|
}
|
|
@@ -708,29 +715,29 @@ const kt = Zt(void 0), Rs = ({ client: s }) => (X(() => (s.mount(), () => {
|
|
|
708
715
|
throw new Error("No QueryClient set, use QueryClientProvider to set one");
|
|
709
716
|
return e;
|
|
710
717
|
};
|
|
711
|
-
function
|
|
718
|
+
function Ms() {
|
|
712
719
|
}
|
|
713
|
-
function
|
|
720
|
+
function Cr(s, e) {
|
|
714
721
|
const t = Tt(e), r = q(s), n = Ze(() => [ct()]), u = ve(s.mutationKey ?? n.current), [i] = jt(
|
|
715
|
-
() => new
|
|
722
|
+
() => new Rs(
|
|
716
723
|
t,
|
|
717
724
|
s
|
|
718
725
|
)
|
|
719
726
|
);
|
|
720
|
-
|
|
727
|
+
J(() => {
|
|
721
728
|
i.setOptions(s);
|
|
722
729
|
}, [i, s]);
|
|
723
730
|
const c = ut(() => i.observe(), [u, i]), l = Xe(c.result$) ?? c.lastValue, h = le(
|
|
724
731
|
(o, p) => {
|
|
725
|
-
i.mutate(o, p).catch(
|
|
732
|
+
i.mutate(o, p).catch(Ms);
|
|
726
733
|
},
|
|
727
734
|
[i]
|
|
728
735
|
);
|
|
729
|
-
return
|
|
736
|
+
return J(() => () => {
|
|
730
737
|
r.current.cancelOnUnMount && i.reset();
|
|
731
738
|
}, [i, r]), { ...l, mutate: h, mutateAsync: l.mutate };
|
|
732
739
|
}
|
|
733
|
-
function
|
|
740
|
+
function As(s) {
|
|
734
741
|
return (e) => e.pipe(
|
|
735
742
|
Qt((t) => {
|
|
736
743
|
s.next(t);
|
|
@@ -738,9 +745,9 @@ function Ms(s) {
|
|
|
738
745
|
);
|
|
739
746
|
}
|
|
740
747
|
const pe = typeof window > "u" || "Deno" in window;
|
|
741
|
-
class
|
|
748
|
+
class Qs {
|
|
742
749
|
constructor() {
|
|
743
|
-
m(this, "isOnlineSubject", new
|
|
750
|
+
m(this, "isOnlineSubject", new Y(!0));
|
|
744
751
|
m(this, "online$", this.isOnlineSubject.pipe(Q()));
|
|
745
752
|
m(this, "backToOnline$", this.online$.pipe(
|
|
746
753
|
O((e) => e),
|
|
@@ -749,7 +756,7 @@ class As {
|
|
|
749
756
|
F(
|
|
750
757
|
pe ? Z : Ne(window, "offline").pipe(g(() => !1)),
|
|
751
758
|
pe ? Z : Ne(window, "online").pipe(g(() => !0))
|
|
752
|
-
).pipe(
|
|
759
|
+
).pipe(As(this.isOnlineSubject)).subscribe();
|
|
753
760
|
}
|
|
754
761
|
isOnline() {
|
|
755
762
|
return this.isOnlineSubject.getValue();
|
|
@@ -758,20 +765,20 @@ class As {
|
|
|
758
765
|
this.isOnlineSubject.getValue() !== e && this.isOnlineSubject.next(e);
|
|
759
766
|
}
|
|
760
767
|
}
|
|
761
|
-
const re = new
|
|
768
|
+
const re = new Qs();
|
|
762
769
|
function ht(s, e) {
|
|
763
770
|
return s.isStaleByTime(e.staleTime);
|
|
764
771
|
}
|
|
765
|
-
function
|
|
772
|
+
function Us(s, e) {
|
|
766
773
|
return e.enabled !== !1 && !s.state.dataUpdatedAt && !(s.state.status === "error" && e.retryOnMount === !1) && s.state.fetchStatus !== "fetching";
|
|
767
774
|
}
|
|
768
775
|
function wt(s, e) {
|
|
769
|
-
return
|
|
776
|
+
return Us(s, e) || s.state.dataUpdatedAt > 0 && Kt(s, e, e.refetchOnMount);
|
|
770
777
|
}
|
|
771
778
|
function Ct(s, e, t, r) {
|
|
772
779
|
return s.state.fetchStatus !== "fetching" && t.enabled !== !1 && (s !== e || r.enabled === !1) && (!t.suspense || s.state.status !== "error") && ht(s, t);
|
|
773
780
|
}
|
|
774
|
-
function
|
|
781
|
+
function Is(s, e) {
|
|
775
782
|
return Kt(s, e, e.refetchOnWindowFocus);
|
|
776
783
|
}
|
|
777
784
|
function Kt(s, e, t) {
|
|
@@ -781,7 +788,7 @@ function Kt(s, e, t) {
|
|
|
781
788
|
}
|
|
782
789
|
return !1;
|
|
783
790
|
}
|
|
784
|
-
function
|
|
791
|
+
function Vs(s) {
|
|
785
792
|
return (s ?? "online") === "online" ? re.isOnline() : !0;
|
|
786
793
|
}
|
|
787
794
|
function Ft(s, e) {
|
|
@@ -834,16 +841,16 @@ function xt(s, e) {
|
|
|
834
841
|
}
|
|
835
842
|
return !(typeof c == "boolean" && e.isStale() !== c || typeof n < "u" && n !== e.state.fetchStatus || u && !u(e));
|
|
836
843
|
}
|
|
837
|
-
function
|
|
844
|
+
function Ps(s, e) {
|
|
838
845
|
return Math.max(s + (e ?? 0) - Date.now(), 0);
|
|
839
846
|
}
|
|
840
|
-
function
|
|
847
|
+
function Ds(s, e) {
|
|
841
848
|
return typeof s == "function" ? s(e) : s;
|
|
842
849
|
}
|
|
843
850
|
function Le(s, e, t) {
|
|
844
851
|
return typeof t.structuralSharing == "function" ? t.structuralSharing(s, e) : t.structuralSharing !== !1 ? Nt(s, e) : e;
|
|
845
852
|
}
|
|
846
|
-
const it = Symbol(),
|
|
853
|
+
const it = Symbol(), ks = ({
|
|
847
854
|
getOptions: s,
|
|
848
855
|
getState: e,
|
|
849
856
|
initialState: t
|
|
@@ -855,7 +862,7 @@ const it = Symbol(), Ds = ({
|
|
|
855
862
|
const j = n.status === "pending" ? "pending" : i.status ?? n.status;
|
|
856
863
|
return { ...n, ...i, status: j };
|
|
857
864
|
}
|
|
858
|
-
const c = i.data, l = c !== void 0 && c !== n.data, h = "data" in i, o = i.status === "success", p = n.data !== void 0, d = n.error !== void 0 || n.error !== null, f = i.status ?? n.status,
|
|
865
|
+
const c = i.data, l = c !== void 0 && c !== n.data, h = "data" in i, o = i.status === "success", p = n.data !== void 0, d = n.error !== void 0 || n.error !== null, f = i.status ?? n.status, y = l ? Le(e().data, c, s()) : h ? i.data : n.data, b = n.status === "error" || n.status === "success", $ = i.status === "error" && (n.status === "error" && n.fetchStatus === "fetching" || n.status !== "error") ? n.errorUpdateCount + 1 : n.errorUpdateCount, w = l ? n.dataUpdateCount + 1 : i.dataUpdateCount ?? n.dataUpdateCount, H = i.status === "pending" && b && // (dataUpdateCount !== 0 || errorUpdateCount !== 0)
|
|
859
866
|
(p || d), P = f === "pending" ? null : i.error ?? n.error;
|
|
860
867
|
return {
|
|
861
868
|
...n,
|
|
@@ -866,14 +873,14 @@ const it = Symbol(), Ds = ({
|
|
|
866
873
|
...o && {
|
|
867
874
|
isInvalidated: !1
|
|
868
875
|
},
|
|
869
|
-
data:
|
|
876
|
+
data: y,
|
|
870
877
|
dataUpdateCount: w,
|
|
871
878
|
...H && {
|
|
872
879
|
status: n.status
|
|
873
880
|
}
|
|
874
881
|
};
|
|
875
882
|
}, t)
|
|
876
|
-
),
|
|
883
|
+
), Ts = (s) => s.pipe(
|
|
877
884
|
g(
|
|
878
885
|
({ status: e, fetchStatus: t }) => t === "idle" && (e === "success" || e === "error")
|
|
879
886
|
)
|
|
@@ -881,13 +888,13 @@ const it = Symbol(), Ds = ({
|
|
|
881
888
|
Ye((e) => e.fetchStatus !== "idle", !0)
|
|
882
889
|
);
|
|
883
890
|
var We, te;
|
|
884
|
-
class
|
|
891
|
+
class Ks {
|
|
885
892
|
constructor() {
|
|
886
893
|
C(this, We, F(
|
|
887
894
|
pe ? Z : Ne(document, "visibilitychange"),
|
|
888
895
|
pe ? Z : Ne(window, "visibilitychange")
|
|
889
896
|
).pipe(g(() => document.visibilityState)));
|
|
890
|
-
C(this, te, new
|
|
897
|
+
C(this, te, new Y(
|
|
891
898
|
pe ? !0 : document.visibilityState === "visible"
|
|
892
899
|
));
|
|
893
900
|
// public readonly focused$ = this.#focusedSubject.pipe(distinctUntilChanged())
|
|
@@ -926,7 +933,7 @@ class Ts {
|
|
|
926
933
|
}
|
|
927
934
|
}
|
|
928
935
|
We = new WeakMap(), te = new WeakMap();
|
|
929
|
-
const ze = new
|
|
936
|
+
const ze = new Ks(), Ns = (s) => s.pipe(
|
|
930
937
|
O((e) => e.status === "success"),
|
|
931
938
|
g((e) => ({
|
|
932
939
|
data: e.data,
|
|
@@ -935,10 +942,10 @@ const ze = new Ts(), Ks = (s) => s.pipe(
|
|
|
935
942
|
})),
|
|
936
943
|
Q(V)
|
|
937
944
|
);
|
|
938
|
-
var
|
|
945
|
+
var B, R, Ce, ue, D, ye, Fe;
|
|
939
946
|
class Ht {
|
|
940
947
|
constructor(e, t) {
|
|
941
|
-
C(this,
|
|
948
|
+
C(this, B, void 0);
|
|
942
949
|
C(this, R, void 0);
|
|
943
950
|
C(this, Ce, new I());
|
|
944
951
|
/**
|
|
@@ -958,7 +965,7 @@ class Ht {
|
|
|
958
965
|
C(this, D, void 0);
|
|
959
966
|
// This property keeps track of the last query with defined data.
|
|
960
967
|
// It will be used to pass the previous data and query to the placeholder function between renders.
|
|
961
|
-
C(this,
|
|
968
|
+
C(this, ye, void 0);
|
|
962
969
|
C(this, Fe, 0);
|
|
963
970
|
m(this, "getObserverResultFromQuery", ({
|
|
964
971
|
options: e,
|
|
@@ -974,11 +981,11 @@ class Ht {
|
|
|
974
981
|
}
|
|
975
982
|
}) => {
|
|
976
983
|
var De;
|
|
977
|
-
const o = t.state, p = t.state.status === "pending", d = a(this, R), f = this.options,
|
|
984
|
+
const o = t.state, p = t.state.status === "pending", d = a(this, R), f = this.options, b = t !== d ? t.state : a(this, ue);
|
|
978
985
|
let { errorUpdatedAt: $, fetchStatus: w, error: H } = o;
|
|
979
986
|
if (r) {
|
|
980
987
|
const T = !!a(this, Fe), pt = !T && wt(t, e), Jt = T && Ct(t, d, e, f);
|
|
981
|
-
(pt || Jt) && (w =
|
|
988
|
+
(pt || Jt) && (w = Vs(t.options.networkMode) ? "fetching" : "paused");
|
|
982
989
|
}
|
|
983
990
|
const P = p && w === "fetching";
|
|
984
991
|
let j, S = l, z = c ?? null, W = h;
|
|
@@ -1002,8 +1009,8 @@ class Ht {
|
|
|
1002
1009
|
if (n != null && n.isPlaceholderData && e.placeholderData === (u == null ? void 0 : u.placeholderData))
|
|
1003
1010
|
T = n.data;
|
|
1004
1011
|
else if (T = typeof e.placeholderData == "function" ? e.placeholderData(
|
|
1005
|
-
(De = a(this,
|
|
1006
|
-
a(this,
|
|
1012
|
+
(De = a(this, ye)) == null ? void 0 : De.state.data,
|
|
1013
|
+
a(this, ye)
|
|
1007
1014
|
) : e.placeholderData, e.select && typeof T < "u")
|
|
1008
1015
|
try {
|
|
1009
1016
|
T = e.select(T);
|
|
@@ -1033,7 +1040,7 @@ class Ht {
|
|
|
1033
1040
|
failureReason: o.fetchFailureReason,
|
|
1034
1041
|
errorUpdateCount: o.errorUpdateCount,
|
|
1035
1042
|
isFetched: o.dataUpdateCount > 0 || o.errorUpdateCount > 0,
|
|
1036
|
-
isFetchedAfterMount: o.dataUpdateCount >
|
|
1043
|
+
isFetchedAfterMount: o.dataUpdateCount > b.dataUpdateCount || o.errorUpdateCount > b.errorUpdateCount,
|
|
1037
1044
|
isFetching: Pe,
|
|
1038
1045
|
isRefetching: Pe && !p,
|
|
1039
1046
|
isLoadingError: Ie && o.dataUpdatedAt === 0,
|
|
@@ -1049,7 +1056,7 @@ class Ht {
|
|
|
1049
1056
|
selectResult: W
|
|
1050
1057
|
};
|
|
1051
1058
|
});
|
|
1052
|
-
this.options = t, M(this,
|
|
1059
|
+
this.options = t, M(this, B, e), this.bindMethods(), M(this, R, this.setOptions(t));
|
|
1053
1060
|
const r = a(this, R);
|
|
1054
1061
|
M(this, ue, r.state);
|
|
1055
1062
|
const { result: n, select: u } = this.getObserverResultFromQuery({
|
|
@@ -1072,7 +1079,7 @@ class Ht {
|
|
|
1072
1079
|
}
|
|
1073
1080
|
setOptions(e) {
|
|
1074
1081
|
const t = this.options;
|
|
1075
|
-
if (this.options = a(this,
|
|
1082
|
+
if (this.options = a(this, B).defaultQueryOptions(e), V(this.options, t) || a(this, B).getQueryCache().notify({
|
|
1076
1083
|
type: "observerOptionsUpdated",
|
|
1077
1084
|
query: a(this, R),
|
|
1078
1085
|
observer: this
|
|
@@ -1085,7 +1092,7 @@ class Ht {
|
|
|
1085
1092
|
}), r;
|
|
1086
1093
|
}
|
|
1087
1094
|
buildQuery(e) {
|
|
1088
|
-
const t = a(this,
|
|
1095
|
+
const t = a(this, B).getQueryCache().build(a(this, B), e);
|
|
1089
1096
|
return !t.options.queryFn && this.options.queryFn && t.setOptions(e), t;
|
|
1090
1097
|
}
|
|
1091
1098
|
getCurrentResult() {
|
|
@@ -1105,7 +1112,7 @@ class Ht {
|
|
|
1105
1112
|
optimisticResult: !0,
|
|
1106
1113
|
prevResult: a(this, D)
|
|
1107
1114
|
});
|
|
1108
|
-
return
|
|
1115
|
+
return qs(this, r.result) && this.updateResult({ query: t, ...r }), r.result;
|
|
1109
1116
|
}
|
|
1110
1117
|
updateResult({
|
|
1111
1118
|
query: e,
|
|
@@ -1114,7 +1121,7 @@ class Ht {
|
|
|
1114
1121
|
select: n,
|
|
1115
1122
|
selectResult: u
|
|
1116
1123
|
}) {
|
|
1117
|
-
a(this, D).state = e.state, a(this, D).result = t, a(this, D).selectResult = u, r !== void 0 && (a(this, D).selectError = r), n !== void 0 && (a(this, D).select = n), a(this, D).options = this.options, e.state.data !== void 0 && M(this,
|
|
1124
|
+
a(this, D).state = e.state, a(this, D).result = t, a(this, D).selectResult = u, r !== void 0 && (a(this, D).selectError = r), n !== void 0 && (a(this, D).select = n), a(this, D).options = this.options, e.state.data !== void 0 && M(this, ye, e), a(this, B).getQueryCache().notify({
|
|
1118
1125
|
query: a(this, R),
|
|
1119
1126
|
type: "observerResultsUpdated"
|
|
1120
1127
|
});
|
|
@@ -1193,7 +1200,7 @@ class Ht {
|
|
|
1193
1200
|
), h = a(this, Ce).pipe(
|
|
1194
1201
|
O((S) => S.query === i)
|
|
1195
1202
|
), o = i.state$.pipe(
|
|
1196
|
-
|
|
1203
|
+
Ns,
|
|
1197
1204
|
x(
|
|
1198
1205
|
(S) => this.options.staleTime === 1 / 0 ? qe : (this.options.staleTime ?? 0) <= 0 ? v(S).pipe(ot(1)) : Qe(this.options.staleTime ?? 1)
|
|
1199
1206
|
),
|
|
@@ -1226,21 +1233,21 @@ class Ht {
|
|
|
1226
1233
|
})
|
|
1227
1234
|
) : qe),
|
|
1228
1235
|
he()
|
|
1229
|
-
),
|
|
1236
|
+
), y = l.pipe(
|
|
1230
1237
|
g(({ enabled: S }) => S ?? !0),
|
|
1231
1238
|
Q()
|
|
1232
|
-
),
|
|
1239
|
+
), b = y.pipe(
|
|
1233
1240
|
O((S) => !S),
|
|
1234
1241
|
g(() => i.state)
|
|
1235
|
-
), $ =
|
|
1242
|
+
), $ = y.pipe(
|
|
1236
1243
|
O((S) => S),
|
|
1237
1244
|
x(() => ze.focusRegained$),
|
|
1238
1245
|
gt(l),
|
|
1239
1246
|
E(([, S]) => {
|
|
1240
|
-
|
|
1247
|
+
Is(i, S) && this.fetch({ cancelRefetch: !1 }).catch(N);
|
|
1241
1248
|
}),
|
|
1242
1249
|
he()
|
|
1243
|
-
), w =
|
|
1250
|
+
), w = b.pipe(
|
|
1244
1251
|
g(() => i.state)
|
|
1245
1252
|
), H = (S) => S.pipe(
|
|
1246
1253
|
gt(l),
|
|
@@ -1280,13 +1287,13 @@ class Ht {
|
|
|
1280
1287
|
destroy() {
|
|
1281
1288
|
}
|
|
1282
1289
|
}
|
|
1283
|
-
|
|
1284
|
-
function
|
|
1290
|
+
B = new WeakMap(), R = new WeakMap(), Ce = new WeakMap(), ue = new WeakMap(), D = new WeakMap(), ye = new WeakMap(), Fe = new WeakMap();
|
|
1291
|
+
function qs(s, e) {
|
|
1285
1292
|
return !V(s.getCurrentResult(), e);
|
|
1286
1293
|
}
|
|
1287
|
-
const _t = Ge.createContext(!1),
|
|
1294
|
+
const _t = Ge.createContext(!1), Hs = () => Ge.useContext(_t);
|
|
1288
1295
|
_t.Provider;
|
|
1289
|
-
function
|
|
1296
|
+
function _s() {
|
|
1290
1297
|
let s = !1;
|
|
1291
1298
|
return {
|
|
1292
1299
|
clearReset: () => {
|
|
@@ -1298,22 +1305,22 @@ function Hs() {
|
|
|
1298
1305
|
isReset: () => s
|
|
1299
1306
|
};
|
|
1300
1307
|
}
|
|
1301
|
-
const
|
|
1302
|
-
function
|
|
1308
|
+
const Ls = Ge.createContext(_s()), zs = () => Ge.useContext(Ls);
|
|
1309
|
+
function Ws(s, e) {
|
|
1303
1310
|
return typeof s == "function" ? s(...e) : !!s;
|
|
1304
1311
|
}
|
|
1305
|
-
const
|
|
1312
|
+
const Gs = ({
|
|
1306
1313
|
result: s,
|
|
1307
1314
|
errorResetBoundary: e,
|
|
1308
1315
|
throwOnError: t,
|
|
1309
1316
|
query: r
|
|
1310
|
-
}) => s.isError && !e.isReset() && !s.isFetching && r &&
|
|
1317
|
+
}) => s.isError && !e.isReset() && !s.isFetching && r && Ws(t, [s.error, r]);
|
|
1311
1318
|
function Lt(s, e, t) {
|
|
1312
1319
|
if (process.env.NODE_ENV !== "production" && (typeof s != "object" || Array.isArray(s)))
|
|
1313
1320
|
throw new Error(
|
|
1314
1321
|
'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'
|
|
1315
1322
|
);
|
|
1316
|
-
const r = Tt(t), n =
|
|
1323
|
+
const r = Tt(t), n = Hs(), u = zs(), i = r.defaultQueryOptions(s);
|
|
1317
1324
|
i._optimisticResults = n ? "isRestoring" : "optimistic";
|
|
1318
1325
|
const [c] = jt(
|
|
1319
1326
|
() => new e(
|
|
@@ -1333,11 +1340,11 @@ function Lt(s, e, t) {
|
|
|
1333
1340
|
O((d) => !V(d, h.current))
|
|
1334
1341
|
),
|
|
1335
1342
|
[]
|
|
1336
|
-
),
|
|
1343
|
+
), J(() => {
|
|
1337
1344
|
c.setOptions(i);
|
|
1338
1345
|
}, [i, c]);
|
|
1339
1346
|
const p = o.error;
|
|
1340
|
-
if (p &&
|
|
1347
|
+
if (p && Gs({
|
|
1341
1348
|
result: o,
|
|
1342
1349
|
errorResetBoundary: u,
|
|
1343
1350
|
throwOnError: i.throwOnError,
|
|
@@ -1346,10 +1353,10 @@ function Lt(s, e, t) {
|
|
|
1346
1353
|
throw p;
|
|
1347
1354
|
return h.current;
|
|
1348
1355
|
}
|
|
1349
|
-
function
|
|
1356
|
+
function Fr(s, e) {
|
|
1350
1357
|
return Lt(s, Ht, e);
|
|
1351
1358
|
}
|
|
1352
|
-
function
|
|
1359
|
+
function Er(s, e) {
|
|
1353
1360
|
return Lt(
|
|
1354
1361
|
{
|
|
1355
1362
|
refetchOnMount: "idle",
|
|
@@ -1362,14 +1369,14 @@ function wr(s, e) {
|
|
|
1362
1369
|
e
|
|
1363
1370
|
);
|
|
1364
1371
|
}
|
|
1365
|
-
function
|
|
1372
|
+
function xr(s, e, t = []) {
|
|
1366
1373
|
const r = e != null && !Array.isArray(e) ? e : {}, n = r.retry ?? !0, u = q(
|
|
1367
1374
|
r.onError ?? ((l) => {
|
|
1368
1375
|
console.error(l);
|
|
1369
1376
|
})
|
|
1370
1377
|
), i = le(() => U(s), t), c = le(
|
|
1371
1378
|
() => i().pipe(
|
|
1372
|
-
|
|
1379
|
+
X((l) => {
|
|
1373
1380
|
throw u.current(l), l;
|
|
1374
1381
|
}),
|
|
1375
1382
|
n ? os() : Mt
|
|
@@ -1389,10 +1396,10 @@ const zt = () => (s) => F(
|
|
|
1389
1396
|
)
|
|
1390
1397
|
)
|
|
1391
1398
|
)
|
|
1392
|
-
),
|
|
1399
|
+
), Js = (s) => {
|
|
1393
1400
|
let e = 0;
|
|
1394
1401
|
return s.pipe(
|
|
1395
|
-
|
|
1402
|
+
X((t) => (e++, e <= 1 && !re.isOnline() ? F(
|
|
1396
1403
|
v({
|
|
1397
1404
|
failureCount: e,
|
|
1398
1405
|
failureReason: t
|
|
@@ -1408,7 +1415,7 @@ const zt = () => (s) => F(
|
|
|
1408
1415
|
)
|
|
1409
1416
|
) : Oe(() => t)))
|
|
1410
1417
|
);
|
|
1411
|
-
},
|
|
1418
|
+
}, Ys = ({
|
|
1412
1419
|
variables: s,
|
|
1413
1420
|
state: e,
|
|
1414
1421
|
options: t
|
|
@@ -1423,16 +1430,16 @@ const zt = () => (s) => F(
|
|
|
1423
1430
|
return ((d = t.onMutate) == null ? void 0 : d.call(t, s)) ?? void 0;
|
|
1424
1431
|
}
|
|
1425
1432
|
)
|
|
1426
|
-
).pipe(Ue(1)), l = (d, f,
|
|
1433
|
+
).pipe(Ue(1)), l = (d, f, y) => U(
|
|
1427
1434
|
() => {
|
|
1428
1435
|
var $;
|
|
1429
1436
|
return ($ = t.onError) == null ? void 0 : $.call(t, d, s, f);
|
|
1430
1437
|
}
|
|
1431
1438
|
).pipe(
|
|
1432
|
-
|
|
1439
|
+
X(() => v(d)),
|
|
1433
1440
|
g(
|
|
1434
1441
|
() => ({
|
|
1435
|
-
failureCount:
|
|
1442
|
+
failureCount: y,
|
|
1436
1443
|
error: d,
|
|
1437
1444
|
failureReason: d,
|
|
1438
1445
|
context: f,
|
|
@@ -1441,34 +1448,34 @@ const zt = () => (s) => F(
|
|
|
1441
1448
|
)
|
|
1442
1449
|
), h = c.pipe(
|
|
1443
1450
|
x((d) => {
|
|
1444
|
-
const
|
|
1451
|
+
const y = (typeof u == "function" ? (
|
|
1445
1452
|
// eslint-disable-next-line @typescript-eslint/promise-function-async
|
|
1446
1453
|
U(() => u(s))
|
|
1447
1454
|
) : u).pipe(
|
|
1448
1455
|
g(
|
|
1449
|
-
(
|
|
1456
|
+
(b) => ({
|
|
1450
1457
|
result: {
|
|
1451
|
-
data:
|
|
1458
|
+
data: b
|
|
1452
1459
|
},
|
|
1453
1460
|
error: null,
|
|
1454
1461
|
context: d
|
|
1455
1462
|
})
|
|
1456
1463
|
),
|
|
1457
|
-
|
|
1464
|
+
Js,
|
|
1458
1465
|
Pt({
|
|
1459
1466
|
...t,
|
|
1460
|
-
retry: (
|
|
1467
|
+
retry: (b, $) => {
|
|
1461
1468
|
const w = t.retry ?? 0;
|
|
1462
|
-
return typeof w == "function" ? w(
|
|
1469
|
+
return typeof w == "function" ? w(b, $) : typeof w == "boolean" ? w : b < w;
|
|
1463
1470
|
},
|
|
1464
|
-
caughtError: (
|
|
1471
|
+
caughtError: (b, $) => (
|
|
1465
1472
|
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
1466
1473
|
v({
|
|
1467
|
-
failureCount:
|
|
1474
|
+
failureCount: b,
|
|
1468
1475
|
failureReason: $
|
|
1469
1476
|
})
|
|
1470
1477
|
),
|
|
1471
|
-
catchError: (
|
|
1478
|
+
catchError: (b, $) => l($, d, b).pipe(
|
|
1472
1479
|
g((w) => ({
|
|
1473
1480
|
...w,
|
|
1474
1481
|
result: void 0
|
|
@@ -1476,11 +1483,11 @@ const zt = () => (s) => F(
|
|
|
1476
1483
|
)
|
|
1477
1484
|
}),
|
|
1478
1485
|
Ye(
|
|
1479
|
-
({ result:
|
|
1486
|
+
({ result: b, error: $ }) => (b == null ? void 0 : b.data) === void 0 && $ === void 0,
|
|
1480
1487
|
!0
|
|
1481
1488
|
)
|
|
1482
1489
|
);
|
|
1483
|
-
return re.isOnline() || t.networkMode === "offlineFirst" || t.networkMode === "always" ?
|
|
1490
|
+
return re.isOnline() || t.networkMode === "offlineFirst" || t.networkMode === "always" ? y : y.pipe(zt());
|
|
1484
1491
|
})
|
|
1485
1492
|
), o = v({
|
|
1486
1493
|
...e,
|
|
@@ -1496,19 +1503,19 @@ const zt = () => (s) => F(
|
|
|
1496
1503
|
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
1497
1504
|
c.pipe(g((d) => ({ context: d }))),
|
|
1498
1505
|
h.pipe(
|
|
1499
|
-
x(({ result: d, error: f, ...
|
|
1506
|
+
x(({ result: d, error: f, ...y }) => {
|
|
1500
1507
|
if (!d && !f)
|
|
1501
1508
|
return v({
|
|
1502
|
-
...
|
|
1509
|
+
...y
|
|
1503
1510
|
});
|
|
1504
|
-
const
|
|
1511
|
+
const b = f ? v(null) : U(
|
|
1505
1512
|
() => {
|
|
1506
1513
|
var P;
|
|
1507
1514
|
return (P = t.onSuccess) == null ? void 0 : P.call(
|
|
1508
1515
|
t,
|
|
1509
1516
|
d == null ? void 0 : d.data,
|
|
1510
1517
|
s,
|
|
1511
|
-
|
|
1518
|
+
y.context
|
|
1512
1519
|
);
|
|
1513
1520
|
}
|
|
1514
1521
|
), w = U(
|
|
@@ -1519,20 +1526,20 @@ const zt = () => (s) => F(
|
|
|
1519
1526
|
d == null ? void 0 : d.data,
|
|
1520
1527
|
f,
|
|
1521
1528
|
s,
|
|
1522
|
-
|
|
1529
|
+
y.context
|
|
1523
1530
|
);
|
|
1524
1531
|
}
|
|
1525
1532
|
).pipe(
|
|
1526
|
-
|
|
1533
|
+
X((P) => d ? v(d) : v(P))
|
|
1527
1534
|
);
|
|
1528
|
-
return ke(
|
|
1535
|
+
return ke(b, w).pipe(
|
|
1529
1536
|
Te(),
|
|
1530
1537
|
g(
|
|
1531
1538
|
() => f ? {
|
|
1532
1539
|
error: f,
|
|
1533
1540
|
data: void 0,
|
|
1534
1541
|
variables: s,
|
|
1535
|
-
...
|
|
1542
|
+
...y
|
|
1536
1543
|
} : {
|
|
1537
1544
|
status: "success",
|
|
1538
1545
|
error: f,
|
|
@@ -1540,11 +1547,11 @@ const zt = () => (s) => F(
|
|
|
1540
1547
|
variables: s,
|
|
1541
1548
|
failureCount: 0,
|
|
1542
1549
|
failureReason: null,
|
|
1543
|
-
...
|
|
1550
|
+
...y
|
|
1544
1551
|
}
|
|
1545
1552
|
),
|
|
1546
|
-
|
|
1547
|
-
(P) => l(P,
|
|
1553
|
+
X(
|
|
1554
|
+
(P) => l(P, y.context, 0).pipe(
|
|
1548
1555
|
g((j) => ({
|
|
1549
1556
|
...j,
|
|
1550
1557
|
data: void 0
|
|
@@ -1563,16 +1570,16 @@ const zt = () => (s) => F(
|
|
|
1563
1570
|
}), fe())
|
|
1564
1571
|
);
|
|
1565
1572
|
};
|
|
1566
|
-
var Ee, se,
|
|
1567
|
-
class
|
|
1573
|
+
var Ee, se, be;
|
|
1574
|
+
class Bs {
|
|
1568
1575
|
constructor({
|
|
1569
1576
|
options: e,
|
|
1570
1577
|
mutationCache: t,
|
|
1571
1578
|
state: r
|
|
1572
1579
|
}) {
|
|
1573
|
-
C(this, Ee, new
|
|
1580
|
+
C(this, Ee, new Y(0));
|
|
1574
1581
|
C(this, se, new I());
|
|
1575
|
-
C(this,
|
|
1582
|
+
C(this, be, new I());
|
|
1576
1583
|
m(this, "state", fe());
|
|
1577
1584
|
m(this, "state$");
|
|
1578
1585
|
m(this, "options");
|
|
@@ -1584,24 +1591,24 @@ class Ys {
|
|
|
1584
1591
|
g(() => ({
|
|
1585
1592
|
status: "idle"
|
|
1586
1593
|
}))
|
|
1587
|
-
), u = a(this,
|
|
1594
|
+
), u = a(this, be).pipe(
|
|
1588
1595
|
x(
|
|
1589
|
-
(c) =>
|
|
1596
|
+
(c) => Ys({
|
|
1590
1597
|
options: {
|
|
1591
1598
|
...this.options,
|
|
1592
1599
|
onMutate: (l) => {
|
|
1593
1600
|
const h = U(
|
|
1594
1601
|
() => {
|
|
1595
|
-
var f,
|
|
1596
|
-
return (
|
|
1602
|
+
var f, y;
|
|
1603
|
+
return (y = (f = t.config).onMutate) == null ? void 0 : y.call(
|
|
1597
1604
|
f,
|
|
1598
1605
|
l,
|
|
1599
1606
|
this
|
|
1600
1607
|
);
|
|
1601
1608
|
}
|
|
1602
1609
|
), p = U(() => {
|
|
1603
|
-
var f,
|
|
1604
|
-
return (
|
|
1610
|
+
var f, y;
|
|
1611
|
+
return (y = (f = this.options).onMutate) == null ? void 0 : y.call(f, l);
|
|
1605
1612
|
});
|
|
1606
1613
|
return h.pipe(
|
|
1607
1614
|
k(() => p)
|
|
@@ -1610,8 +1617,8 @@ class Ys {
|
|
|
1610
1617
|
onError: (l, h, o) => {
|
|
1611
1618
|
const p = U(
|
|
1612
1619
|
() => {
|
|
1613
|
-
var f,
|
|
1614
|
-
return (
|
|
1620
|
+
var f, y;
|
|
1621
|
+
return (y = (f = t.config).onError) == null ? void 0 : y.call(
|
|
1615
1622
|
f,
|
|
1616
1623
|
l,
|
|
1617
1624
|
h,
|
|
@@ -1621,8 +1628,8 @@ class Ys {
|
|
|
1621
1628
|
}
|
|
1622
1629
|
), d = U(
|
|
1623
1630
|
() => {
|
|
1624
|
-
var f,
|
|
1625
|
-
return (
|
|
1631
|
+
var f, y;
|
|
1632
|
+
return (y = (f = this.options).onError) == null ? void 0 : y.call(f, l, h, o);
|
|
1626
1633
|
}
|
|
1627
1634
|
);
|
|
1628
1635
|
return ke(p, d).pipe(Te());
|
|
@@ -1630,9 +1637,9 @@ class Ys {
|
|
|
1630
1637
|
onSettled: (l, h, o, p) => {
|
|
1631
1638
|
const d = U(
|
|
1632
1639
|
() => {
|
|
1633
|
-
var
|
|
1634
|
-
return (
|
|
1635
|
-
|
|
1640
|
+
var y, b;
|
|
1641
|
+
return (b = (y = t.config).onSettled) == null ? void 0 : b.call(
|
|
1642
|
+
y,
|
|
1636
1643
|
l,
|
|
1637
1644
|
h,
|
|
1638
1645
|
o,
|
|
@@ -1642,8 +1649,8 @@ class Ys {
|
|
|
1642
1649
|
}
|
|
1643
1650
|
), f = U(
|
|
1644
1651
|
() => {
|
|
1645
|
-
var
|
|
1646
|
-
return (
|
|
1652
|
+
var y, b;
|
|
1653
|
+
return (b = (y = this.options).onSettled) == null ? void 0 : b.call(y, l, h, o, p);
|
|
1647
1654
|
}
|
|
1648
1655
|
);
|
|
1649
1656
|
return ke(d, f).pipe(Te());
|
|
@@ -1651,8 +1658,8 @@ class Ys {
|
|
|
1651
1658
|
onSuccess: (l, h, o) => {
|
|
1652
1659
|
const p = U(
|
|
1653
1660
|
() => {
|
|
1654
|
-
var f,
|
|
1655
|
-
return (
|
|
1661
|
+
var f, y;
|
|
1662
|
+
return (y = (f = t.config).onSuccess) == null ? void 0 : y.call(
|
|
1656
1663
|
f,
|
|
1657
1664
|
l,
|
|
1658
1665
|
h,
|
|
@@ -1662,8 +1669,8 @@ class Ys {
|
|
|
1662
1669
|
}
|
|
1663
1670
|
), d = U(
|
|
1664
1671
|
() => {
|
|
1665
|
-
var f,
|
|
1666
|
-
return (
|
|
1672
|
+
var f, y;
|
|
1673
|
+
return (y = (f = this.options).onSuccess) == null ? void 0 : y.call(f, l, h, o);
|
|
1667
1674
|
}
|
|
1668
1675
|
);
|
|
1669
1676
|
return ke(p, d).pipe(Te());
|
|
@@ -1705,7 +1712,7 @@ class Ys {
|
|
|
1705
1712
|
* is over, unlike the state which can be re-subscribed later.
|
|
1706
1713
|
*/
|
|
1707
1714
|
execute(e) {
|
|
1708
|
-
return a(this,
|
|
1715
|
+
return a(this, be).next(e), a(this, be).complete(), this.state$.pipe(we);
|
|
1709
1716
|
}
|
|
1710
1717
|
continue() {
|
|
1711
1718
|
return this.execute(this.state.variables);
|
|
@@ -1719,7 +1726,7 @@ class Ys {
|
|
|
1719
1726
|
a(this, se).next(), a(this, se).complete();
|
|
1720
1727
|
}
|
|
1721
1728
|
}
|
|
1722
|
-
Ee = new WeakMap(), se = new WeakMap(),
|
|
1729
|
+
Ee = new WeakMap(), se = new WeakMap(), be = new WeakMap();
|
|
1723
1730
|
const Rt = ({
|
|
1724
1731
|
mutationKey: s,
|
|
1725
1732
|
status: e,
|
|
@@ -1732,7 +1739,7 @@ class Wt {
|
|
|
1732
1739
|
* @important
|
|
1733
1740
|
* Query store. Could be turned into a map for more performance.
|
|
1734
1741
|
*/
|
|
1735
|
-
m(this, "entriesSubject", new
|
|
1742
|
+
m(this, "entriesSubject", new Y([]));
|
|
1736
1743
|
m(this, "changeSubject", new I());
|
|
1737
1744
|
m(this, "entries$", this.entriesSubject.pipe(de()));
|
|
1738
1745
|
m(this, "added$", this.changeSubject.pipe(
|
|
@@ -1781,13 +1788,13 @@ class Wt {
|
|
|
1781
1788
|
}
|
|
1782
1789
|
}
|
|
1783
1790
|
var K;
|
|
1784
|
-
class
|
|
1791
|
+
class Xs {
|
|
1785
1792
|
constructor(e = {}) {
|
|
1786
1793
|
C(this, K, new Wt());
|
|
1787
1794
|
this.config = e;
|
|
1788
1795
|
}
|
|
1789
1796
|
build(e, t, r) {
|
|
1790
|
-
const n = new
|
|
1797
|
+
const n = new Bs({
|
|
1791
1798
|
mutationCache: this,
|
|
1792
1799
|
options: e.defaultMutationOptions(t),
|
|
1793
1800
|
state: r
|
|
@@ -1886,7 +1893,7 @@ class Bs {
|
|
|
1886
1893
|
}
|
|
1887
1894
|
}
|
|
1888
1895
|
K = new WeakMap();
|
|
1889
|
-
function
|
|
1896
|
+
function Zs(s) {
|
|
1890
1897
|
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;
|
|
1891
1898
|
return {
|
|
1892
1899
|
data: e,
|
|
@@ -1903,7 +1910,7 @@ function Xs(s) {
|
|
|
1903
1910
|
fetchStatus: "idle"
|
|
1904
1911
|
};
|
|
1905
1912
|
}
|
|
1906
|
-
const
|
|
1913
|
+
const er = (s) => Ae(() => ze.isFocused() ? s : ze.focusRegained$.pipe(k(() => s))), tr = (s) => {
|
|
1907
1914
|
let e = 0;
|
|
1908
1915
|
return (t) => {
|
|
1909
1916
|
const r = re.backToOnline$.pipe(
|
|
@@ -1922,7 +1929,7 @@ const Zs = (s) => Ae(() => ze.isFocused() ? s : ze.focusRegained$.pipe(k(() => s
|
|
|
1922
1929
|
r
|
|
1923
1930
|
) : t));
|
|
1924
1931
|
};
|
|
1925
|
-
},
|
|
1932
|
+
}, sr = (s) => (e) => {
|
|
1926
1933
|
const t = new I(), r = t.pipe(
|
|
1927
1934
|
Je(),
|
|
1928
1935
|
/**
|
|
@@ -1938,7 +1945,7 @@ const Zs = (s) => Ae(() => ze.isFocused() ? s : ze.focusRegained$.pipe(k(() => s
|
|
|
1938
1945
|
}),
|
|
1939
1946
|
ne(r)
|
|
1940
1947
|
);
|
|
1941
|
-
},
|
|
1948
|
+
}, rr = (s) => {
|
|
1942
1949
|
const e = async () => await Promise.reject(new Error("No query found"));
|
|
1943
1950
|
process.env.NODE_ENV !== "production" && s.queryFn === it && console.error(
|
|
1944
1951
|
`Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${s.queryHash}'`
|
|
@@ -1960,7 +1967,7 @@ const Zs = (s) => Ae(() => ze.isFocused() ? s : ze.focusRegained$.pipe(k(() => s
|
|
|
1960
1967
|
() => r(u)
|
|
1961
1968
|
)
|
|
1962
1969
|
) : r).pipe(
|
|
1963
|
-
|
|
1970
|
+
sr(s.observers$),
|
|
1964
1971
|
E({
|
|
1965
1972
|
complete: () => {
|
|
1966
1973
|
t = !0;
|
|
@@ -1972,10 +1979,10 @@ const Zs = (s) => Ae(() => ze.isFocused() ? s : ze.focusRegained$.pipe(k(() => s
|
|
|
1972
1979
|
})
|
|
1973
1980
|
),
|
|
1974
1981
|
// takeUntil(hasDataAndNoObservers$),
|
|
1975
|
-
|
|
1982
|
+
tr(s),
|
|
1976
1983
|
Pt({
|
|
1977
1984
|
...s,
|
|
1978
|
-
retryAfter: () => v(!0).pipe(
|
|
1985
|
+
retryAfter: () => v(!0).pipe(er),
|
|
1979
1986
|
catchError: (o, p) => v({
|
|
1980
1987
|
status: "error",
|
|
1981
1988
|
fetchStatus: "idle",
|
|
@@ -2039,14 +2046,14 @@ const Zs = (s) => Ae(() => ze.isFocused() ? s : ze.focusRegained$.pipe(k(() => s
|
|
|
2039
2046
|
abortController: n
|
|
2040
2047
|
};
|
|
2041
2048
|
};
|
|
2042
|
-
class
|
|
2049
|
+
class nr {
|
|
2043
2050
|
constructor(e) {
|
|
2044
2051
|
m(this, "revert");
|
|
2045
2052
|
m(this, "silent");
|
|
2046
2053
|
this.revert = e == null ? void 0 : e.revert, this.silent = e == null ? void 0 : e.silent;
|
|
2047
2054
|
}
|
|
2048
2055
|
}
|
|
2049
|
-
const
|
|
2056
|
+
const ir = { backgroundColor: "transparent", color: "inherit" };
|
|
2050
2057
|
function Gt(s) {
|
|
2051
2058
|
const e = {
|
|
2052
2059
|
namespaces: [
|
|
@@ -2059,7 +2066,7 @@ function Gt(s) {
|
|
|
2059
2066
|
const n = Gt();
|
|
2060
2067
|
return n.namespaces.push({
|
|
2061
2068
|
name: t,
|
|
2062
|
-
style: r ??
|
|
2069
|
+
style: r ?? ir
|
|
2063
2070
|
}), n;
|
|
2064
2071
|
},
|
|
2065
2072
|
printNamespaces() {
|
|
@@ -2094,9 +2101,9 @@ function Gt(s) {
|
|
|
2094
2101
|
};
|
|
2095
2102
|
return e;
|
|
2096
2103
|
}
|
|
2097
|
-
const
|
|
2104
|
+
const ur = Gt();
|
|
2098
2105
|
var xe, ae;
|
|
2099
|
-
class
|
|
2106
|
+
class ar {
|
|
2100
2107
|
constructor(e) {
|
|
2101
2108
|
m(this, "queryKey");
|
|
2102
2109
|
m(this, "queryHash");
|
|
@@ -2112,12 +2119,12 @@ class ur {
|
|
|
2112
2119
|
m(this, "invalidatedSubject", new I());
|
|
2113
2120
|
m(this, "resetSubject", new I());
|
|
2114
2121
|
m(this, "destroySubject", new I());
|
|
2115
|
-
m(this, "observersSubject", new
|
|
2122
|
+
m(this, "observersSubject", new Y([]));
|
|
2116
2123
|
m(this, "abortSignalConsumed", !1);
|
|
2117
2124
|
m(this, "observerCount$", this.observersSubject.asObservable().pipe(g((e) => e.length)));
|
|
2118
2125
|
m(this, "observers$", this.observersSubject.asObservable());
|
|
2119
2126
|
m(this, "state$");
|
|
2120
|
-
M(this, xe, e.defaultOptions), this.options = this.setOptions(e.options), this.queryKey = e.queryKey, this.queryHash = e.queryHash, M(this, ae, e.state ??
|
|
2127
|
+
M(this, xe, e.defaultOptions), this.options = this.setOptions(e.options), this.queryKey = e.queryKey, this.queryHash = e.queryHash, M(this, ae, e.state ?? Zs(this.options)), this.state = a(this, ae), this.gcTime = this.updateGcTime(this.options.gcTime), this.state$ = F(
|
|
2121
2128
|
this.resetSubject.pipe(
|
|
2122
2129
|
g(() => ({ command: "reset", state: a(this, ae) }))
|
|
2123
2130
|
),
|
|
@@ -2137,7 +2144,7 @@ class ur {
|
|
|
2137
2144
|
state: {
|
|
2138
2145
|
status: t != null && t.revert ? this.state.status : "error",
|
|
2139
2146
|
fetchStatus: "idle",
|
|
2140
|
-
error: new
|
|
2147
|
+
error: new nr(t)
|
|
2141
2148
|
}
|
|
2142
2149
|
}))
|
|
2143
2150
|
),
|
|
@@ -2154,7 +2161,7 @@ class ur {
|
|
|
2154
2161
|
o.length === 0 && h.length > 0 ? t = !0 : t = !1;
|
|
2155
2162
|
}),
|
|
2156
2163
|
he()
|
|
2157
|
-
), { state$: u, abortController: i } =
|
|
2164
|
+
), { state$: u, abortController: i } = rr({
|
|
2158
2165
|
...this.options,
|
|
2159
2166
|
observers$: this.observerCount$,
|
|
2160
2167
|
queryKey: this.queryKey,
|
|
@@ -2201,7 +2208,7 @@ class ur {
|
|
|
2201
2208
|
}))
|
|
2202
2209
|
)
|
|
2203
2210
|
).pipe(
|
|
2204
|
-
|
|
2211
|
+
ks({
|
|
2205
2212
|
initialState: this.state,
|
|
2206
2213
|
getOptions: () => this.options,
|
|
2207
2214
|
getState: () => this.state
|
|
@@ -2211,8 +2218,8 @@ class ur {
|
|
|
2211
2218
|
E((t) => {
|
|
2212
2219
|
this.state = t;
|
|
2213
2220
|
}),
|
|
2214
|
-
|
|
2215
|
-
throw
|
|
2221
|
+
X((t) => {
|
|
2222
|
+
throw ur.error(t), t;
|
|
2216
2223
|
}),
|
|
2217
2224
|
ne(this.destroySubject),
|
|
2218
2225
|
Ue({ bufferSize: 1, refCount: !1 })
|
|
@@ -2282,7 +2289,7 @@ class ur {
|
|
|
2282
2289
|
return this.state.isInvalidated || !this.state.dataUpdatedAt || this.observersSubject.getValue().some((e) => e.getCurrentResult().isStale);
|
|
2283
2290
|
}
|
|
2284
2291
|
isStaleByTime(e = 0) {
|
|
2285
|
-
return this.state.isInvalidated || !this.state.dataUpdatedAt || !
|
|
2292
|
+
return this.state.isInvalidated || !this.state.dataUpdatedAt || !Ps(this.state.dataUpdatedAt, e);
|
|
2286
2293
|
}
|
|
2287
2294
|
async getFetchResultAsPromise() {
|
|
2288
2295
|
return await new Promise((e, t) => {
|
|
@@ -2319,7 +2326,7 @@ class ur {
|
|
|
2319
2326
|
}
|
|
2320
2327
|
xe = new WeakMap(), ae = new WeakMap();
|
|
2321
2328
|
var Re, G;
|
|
2322
|
-
class
|
|
2329
|
+
class or {
|
|
2323
2330
|
// protected mountSubscriptions: Subscription[]
|
|
2324
2331
|
constructor(e = {}) {
|
|
2325
2332
|
// readonly #queries: QueryStore = new Map<string, Query>()
|
|
@@ -2355,7 +2362,7 @@ class ar {
|
|
|
2355
2362
|
build(e, t, r) {
|
|
2356
2363
|
const n = t.queryKey ?? [ct()], u = t.queryHash ?? dt(n, t);
|
|
2357
2364
|
let i = this.get(u);
|
|
2358
|
-
return i || (i = new
|
|
2365
|
+
return i || (i = new ar({
|
|
2359
2366
|
cache: this,
|
|
2360
2367
|
queryKey: n,
|
|
2361
2368
|
queryHash: u,
|
|
@@ -2390,7 +2397,7 @@ class ar {
|
|
|
2390
2397
|
* Once a mutation is finished and there are no more observers than us
|
|
2391
2398
|
* we start the process of cleaning it up based on gc settings
|
|
2392
2399
|
*/
|
|
2393
|
-
|
|
2400
|
+
Ts,
|
|
2394
2401
|
x((r) => r ? t.pipe(
|
|
2395
2402
|
// defaults to 5mn
|
|
2396
2403
|
x(() => e.gcTime === 1 / 0 ? qe : (setTimeout(N, e.gcTime), Qe(e.gcTime)))
|
|
@@ -2452,7 +2459,7 @@ class ar {
|
|
|
2452
2459
|
}
|
|
2453
2460
|
Re = new WeakMap(), G = new WeakMap();
|
|
2454
2461
|
var oe, A, je, Me, ge;
|
|
2455
|
-
class
|
|
2462
|
+
class Rr {
|
|
2456
2463
|
// #destroy = () => {}
|
|
2457
2464
|
constructor({
|
|
2458
2465
|
mutationCache: e,
|
|
@@ -2464,7 +2471,7 @@ class Fr {
|
|
|
2464
2471
|
C(this, je, /* @__PURE__ */ new Map());
|
|
2465
2472
|
C(this, Me, /* @__PURE__ */ new Map());
|
|
2466
2473
|
C(this, ge, void 0);
|
|
2467
|
-
M(this, oe, e ?? new
|
|
2474
|
+
M(this, oe, e ?? new Xs()), M(this, A, t ?? new or()), M(this, ge, r ?? {});
|
|
2468
2475
|
}
|
|
2469
2476
|
mount() {
|
|
2470
2477
|
}
|
|
@@ -2533,7 +2540,7 @@ class Fr {
|
|
|
2533
2540
|
setQueryData(e, t, r) {
|
|
2534
2541
|
const n = this.defaultQueryOptions({ queryKey: e }), u = a(this, A).get(
|
|
2535
2542
|
n.queryHash
|
|
2536
|
-
), i = u == null ? void 0 : u.state.data, c =
|
|
2543
|
+
), i = u == null ? void 0 : u.state.data, c = Ds(t, i);
|
|
2537
2544
|
if (c !== void 0)
|
|
2538
2545
|
return a(this, A).build(this, n).setData(c, { ...r, manual: !0 });
|
|
2539
2546
|
}
|
|
@@ -2604,31 +2611,34 @@ class Fr {
|
|
|
2604
2611
|
}
|
|
2605
2612
|
oe = new WeakMap(), A = new WeakMap(), je = new WeakMap(), Me = new WeakMap(), ge = new WeakMap();
|
|
2606
2613
|
export {
|
|
2607
|
-
|
|
2608
|
-
|
|
2609
|
-
|
|
2610
|
-
|
|
2614
|
+
Xs as MutationCache,
|
|
2615
|
+
or as QueryCache,
|
|
2616
|
+
Rr as QueryClient,
|
|
2617
|
+
wr as QueryClientProvider,
|
|
2611
2618
|
Ss as SIGNAL_RESET,
|
|
2619
|
+
Or as arrayEqual,
|
|
2612
2620
|
Os as createLocalStorageAdapter,
|
|
2613
|
-
|
|
2621
|
+
mr as createLocalforageAdapter,
|
|
2614
2622
|
Fs as exponentialBackoffDelay,
|
|
2615
2623
|
Cs as getDelay,
|
|
2616
2624
|
rt as isDefined,
|
|
2617
2625
|
Pt as retryBackoff,
|
|
2618
2626
|
br as signal,
|
|
2619
2627
|
Vt as useBehaviorSubject,
|
|
2620
|
-
|
|
2628
|
+
Es as useEffectOnce,
|
|
2629
|
+
Er as useForeverQuery,
|
|
2621
2630
|
q as useLiveRef,
|
|
2622
|
-
|
|
2623
|
-
|
|
2631
|
+
$r as useMount,
|
|
2632
|
+
Cr as useMutation,
|
|
2633
|
+
yr as useObservableState,
|
|
2624
2634
|
Xe as useObserve,
|
|
2625
|
-
|
|
2626
|
-
|
|
2627
|
-
|
|
2635
|
+
pr as useObserveCallback,
|
|
2636
|
+
Sr as usePersistSignals,
|
|
2637
|
+
Fr as useQuery,
|
|
2628
2638
|
Tt as useQueryClient,
|
|
2629
|
-
|
|
2639
|
+
gr as useSignalValue,
|
|
2630
2640
|
It as useSubject,
|
|
2631
2641
|
Ut as useSubscribe,
|
|
2632
|
-
|
|
2633
|
-
|
|
2642
|
+
xr as useSubscribeEffect,
|
|
2643
|
+
vr as useUnmountObservable
|
|
2634
2644
|
};
|