reactjrx 1.96.1 → 1.98.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 +190 -189
- package/dist/lib/binding/types.d.ts +0 -1
- package/dist/lib/binding/useBehaviorSubject.d.ts +0 -1
- package/dist/lib/binding/useObservableState.d.ts +0 -1
- package/dist/lib/binding/useObserve.d.ts +1 -1
- package/dist/lib/binding/useSubject.d.ts +2 -3
- package/dist/lib/binding/useSubscribe.d.ts +0 -1
- package/dist/lib/binding/useSubscribeEffect.d.ts +0 -1
- package/dist/lib/queries/client/QueryClient.d.ts +0 -1
- package/dist/lib/queries/client/focusManager.d.ts +0 -1
- package/dist/lib/queries/client/keys/hashKey.d.ts +0 -1
- package/dist/lib/queries/client/keys/matchKey.d.ts +1 -2
- package/dist/lib/queries/client/keys/partialMatchKey.d.ts +0 -1
- package/dist/lib/queries/client/mutations/cache/MutationCache.d.ts +0 -1
- package/dist/lib/queries/client/mutations/cache/types.d.ts +0 -1
- package/dist/lib/queries/client/mutations/mutation/Mutation.d.ts +0 -1
- package/dist/lib/queries/client/mutations/mutation/delayWhenNetworkOnline.d.ts +1 -2
- package/dist/lib/queries/client/mutations/mutation/executeMutation.d.ts +0 -1
- package/dist/lib/queries/client/mutations/mutation/observeUntilFinished.d.ts +0 -1
- package/dist/lib/queries/client/mutations/mutation/types.d.ts +0 -1
- package/dist/lib/queries/client/mutations/mutation/waitForNetworkOnError.d.ts +2 -3
- package/dist/lib/queries/client/mutations/observers/MutationObserver.d.ts +0 -1
- package/dist/lib/queries/client/mutations/observers/types.d.ts +0 -1
- package/dist/lib/queries/client/mutations/runner/MutationRunner.d.ts +0 -1
- package/dist/lib/queries/client/mutations/types.d.ts +0 -1
- package/dist/lib/queries/client/mutations/utils/defaultMutationState.d.ts +0 -1
- package/dist/lib/queries/client/mutations/utils/distinctUntilStateChanged.d.ts +0 -1
- package/dist/lib/queries/client/mutations/utils/filters.d.ts +0 -1
- package/dist/lib/queries/client/onlineManager.d.ts +0 -1
- package/dist/lib/queries/client/queries/cache/QueryCache.d.ts +0 -1
- package/dist/lib/queries/client/queries/cache/types.d.ts +0 -1
- package/dist/lib/queries/client/queries/observer/QueryObserver.d.ts +1 -2
- package/dist/lib/queries/client/queries/observer/queryStateHelpers.d.ts +0 -1
- package/dist/lib/queries/client/queries/observer/types.d.ts +0 -1
- package/dist/lib/queries/client/queries/query/Query.d.ts +2 -3
- package/dist/lib/queries/client/queries/query/delayOnNetworkMode.d.ts +1 -2
- package/dist/lib/queries/client/queries/query/delayUntilFocus.d.ts +0 -1
- package/dist/lib/queries/client/queries/query/execution/completeFnIfNotMoreObservers.d.ts +0 -1
- package/dist/lib/queries/client/queries/query/execution/executeQuery.d.ts +1 -2
- package/dist/lib/queries/client/queries/query/getDefaultState.d.ts +0 -1
- package/dist/lib/queries/client/queries/query/operators.d.ts +1 -2
- package/dist/lib/queries/client/queries/query/state/whenNewData.d.ts +0 -1
- package/dist/lib/queries/client/queries/query/types.d.ts +0 -1
- package/dist/lib/queries/client/queries/retryer/CancelledError.d.ts +0 -1
- package/dist/lib/queries/client/queries/retryer/utils.d.ts +0 -1
- package/dist/lib/queries/client/queries/types.d.ts +0 -1
- package/dist/lib/queries/client/queries/utils.d.ts +0 -1
- package/dist/lib/queries/client/store.d.ts +0 -1
- package/dist/lib/queries/client/tests/utils.d.ts +0 -1
- package/dist/lib/queries/client/types.d.ts +0 -1
- package/dist/lib/queries/client/utils/makeObservable.d.ts +0 -1
- package/dist/lib/queries/react/QueryClientProvider.d.ts +0 -1
- package/dist/lib/queries/react/mutations/types.d.ts +0 -1
- package/dist/lib/queries/react/mutations/useIsMutating.d.ts +1 -2
- package/dist/lib/queries/react/mutations/useMutation.d.ts +0 -1
- package/dist/lib/queries/react/mutations/useMutationState.d.ts +0 -1
- package/dist/lib/queries/react/queries/errorBoundaryUtils.d.ts +0 -1
- package/dist/lib/queries/react/queries/queryOptions.d.ts +0 -1
- package/dist/lib/queries/react/queries/types.d.ts +0 -1
- package/dist/lib/queries/react/queries/useBaseQuery.d.ts +0 -1
- package/dist/lib/queries/react/queries/useForeverQuery.d.ts +0 -1
- package/dist/lib/queries/react/queries/useIsFetching.d.ts +0 -1
- package/dist/lib/queries/react/queries/useQuery.d.ts +0 -1
- package/dist/lib/queries/react/useQueryClient.d.ts +0 -1
- package/dist/lib/state/persistance/adapters/createLocalStorageAdapter.d.ts +1 -2
- package/dist/lib/state/persistance/adapters/createLocalforageAdapter.d.ts +0 -1
- package/dist/lib/state/persistance/getNormalizedPersistanceValue.d.ts +0 -1
- package/dist/lib/state/persistance/types.d.ts +0 -1
- package/dist/lib/state/persistance/usePersistSignals.d.ts +0 -1
- package/dist/lib/state/signal.d.ts +0 -1
- package/dist/lib/state/useSignal.d.ts +1 -4
- package/dist/lib/state/useSignalValue.d.ts +0 -1
- package/dist/lib/utils/operators/emitToSubject.d.ts +0 -1
- package/dist/lib/utils/operators/retryBackoff.d.ts +0 -1
- package/dist/lib/utils/operators/trackSubscriptions.d.ts +0 -1
- package/dist/lib/utils/useEffectOnce.d.ts +0 -1
- package/dist/lib/utils/useLiveRef.d.ts +0 -1
- package/dist/tests/utils.d.ts +0 -1
- package/package.json +12 -11
package/dist/index.js
CHANGED
|
@@ -3,11 +3,11 @@ var bt = (s) => {
|
|
|
3
3
|
throw TypeError(s);
|
|
4
4
|
};
|
|
5
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
|
|
6
|
+
var b = (s, e, t) => Bt(s, typeof e != "symbol" ? e + "" : e, t), gt = (s, e, t) => e.has(s) || bt("Cannot " + t);
|
|
7
7
|
var a = (s, e, t) => (gt(s, e, "read from private field"), t ? t.call(s) : e.get(s)), w = (s, e, t) => e.has(s) ? bt("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(s) : e.set(s, t), A = (s, e, t, r) => (gt(s, e, "write to private field"), r ? r.call(s, t) : e.set(s, t), t);
|
|
8
8
|
import * as Ge from "react";
|
|
9
9
|
import { useRef as me, useMemo as ut, useCallback as de, useSyncExternalStore as Xt, useEffect as Y, useState as at, createContext as Zt, memo as es, useContext as ts } from "react";
|
|
10
|
-
import {
|
|
10
|
+
import { isObservable as mt, from as Se, of as v, defer as Ae, distinctUntilChanged as V, tap as R, catchError as J, EMPTY as B, Subject as I, BehaviorSubject as X, skip as ot, first as Je, map as y, 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 ct, interval as as, withLatestFrom as St, 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
11
|
import { catchError as vt, mergeMap as tt, retryWhen as ps, concatMap as ys, first as bs, tap as Qt } from "rxjs/operators";
|
|
12
12
|
import { jsxs as gs, jsx as ms } from "react/jsx-runtime";
|
|
13
13
|
const H = (s) => {
|
|
@@ -19,6 +19,19 @@ const H = (s) => {
|
|
|
19
19
|
function Ss(s, e) {
|
|
20
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;
|
|
21
21
|
}
|
|
22
|
+
function Ot(s) {
|
|
23
|
+
return s instanceof Promise || s && typeof s.then == "function" && typeof s.catch == "function";
|
|
24
|
+
}
|
|
25
|
+
function U(s) {
|
|
26
|
+
if (mt(s)) return s;
|
|
27
|
+
if (Ot(s)) return Se(s);
|
|
28
|
+
if (typeof s != "function") return v(s);
|
|
29
|
+
const e = s;
|
|
30
|
+
return Ae(() => {
|
|
31
|
+
const t = e();
|
|
32
|
+
return Ot(t) ? Se(t) : mt(t) ? t : v(t);
|
|
33
|
+
});
|
|
34
|
+
}
|
|
22
35
|
function Xe(s, e, t) {
|
|
23
36
|
const r = e != null && !Array.isArray(e) ? e : {
|
|
24
37
|
defaultValue: void 0,
|
|
@@ -27,21 +40,21 @@ function Xe(s, e, t) {
|
|
|
27
40
|
"getValue" in s && typeof s.getValue == "function" ? s.getValue() : r.defaultValue
|
|
28
41
|
), i = H(s), c = H(r), l = de(
|
|
29
42
|
(p) => {
|
|
30
|
-
const
|
|
43
|
+
const E = i.current, d = U(E).pipe(
|
|
31
44
|
/**
|
|
32
45
|
* @important
|
|
33
46
|
* We only check primitives because underlying subscription might
|
|
34
47
|
* be using objects and keeping same reference but pushing new
|
|
35
48
|
* properties values
|
|
36
49
|
*/
|
|
37
|
-
|
|
38
|
-
R((
|
|
39
|
-
u.current =
|
|
50
|
+
V(Ss),
|
|
51
|
+
R((f) => {
|
|
52
|
+
u.current = f;
|
|
40
53
|
}),
|
|
41
|
-
J((
|
|
54
|
+
J((f) => (console.error(f), B))
|
|
42
55
|
).subscribe(p);
|
|
43
56
|
return () => {
|
|
44
|
-
c.current.unsubscribeOnUnmount !== !1 &&
|
|
57
|
+
c.current.unsubscribeOnUnmount !== !1 && d.unsubscribe();
|
|
45
58
|
};
|
|
46
59
|
},
|
|
47
60
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
@@ -49,23 +62,10 @@ function Xe(s, e, t) {
|
|
|
49
62
|
), h = de(() => u.current, []);
|
|
50
63
|
return Xt(l, h, h);
|
|
51
64
|
}
|
|
52
|
-
function Ot(s) {
|
|
53
|
-
return s instanceof Promise || s && typeof s.then == "function" && typeof s.catch == "function";
|
|
54
|
-
}
|
|
55
|
-
function V(s) {
|
|
56
|
-
if (mt(s)) return s;
|
|
57
|
-
if (Ot(s)) return Se(s);
|
|
58
|
-
if (typeof s != "function") return v(s);
|
|
59
|
-
const e = s;
|
|
60
|
-
return Ae(() => {
|
|
61
|
-
const t = e();
|
|
62
|
-
return Ot(t) ? Se(t) : mt(t) ? t : v(t);
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
65
|
function Ut(s, e = []) {
|
|
66
66
|
const t = H(s);
|
|
67
67
|
Y(() => {
|
|
68
|
-
const r =
|
|
68
|
+
const r = U(t.current).pipe(
|
|
69
69
|
J((n) => (console.error(n), B))
|
|
70
70
|
).subscribe();
|
|
71
71
|
return () => {
|
|
@@ -158,8 +158,8 @@ function $s(s, e) {
|
|
|
158
158
|
const r = e ?? (() => s.getValue());
|
|
159
159
|
return Xe(
|
|
160
160
|
() => s.subject.pipe(
|
|
161
|
-
|
|
162
|
-
|
|
161
|
+
y((u) => r(u)),
|
|
162
|
+
V()
|
|
163
163
|
),
|
|
164
164
|
{
|
|
165
165
|
defaultValue: r(s.getValue())
|
|
@@ -179,6 +179,7 @@ const vr = (s) => {
|
|
|
179
179
|
setItem: async (e, t) => {
|
|
180
180
|
await s.setItem(e, JSON.stringify(t));
|
|
181
181
|
},
|
|
182
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
182
183
|
removeItem: async (e) => {
|
|
183
184
|
},
|
|
184
185
|
clear: async () => {
|
|
@@ -281,7 +282,7 @@ function $r({
|
|
|
281
282
|
config: p
|
|
282
283
|
})
|
|
283
284
|
)
|
|
284
|
-
).pipe(
|
|
285
|
+
).pipe(y(() => !0))).pipe(
|
|
285
286
|
R(() => {
|
|
286
287
|
n.current != null && n.current();
|
|
287
288
|
}),
|
|
@@ -351,46 +352,46 @@ function Pt(s) {
|
|
|
351
352
|
resetOnSuccess: o = !1,
|
|
352
353
|
backoffDelay: p = js
|
|
353
354
|
} = l;
|
|
354
|
-
return (
|
|
355
|
+
return (E) => Ae(() => {
|
|
355
356
|
let d = 0;
|
|
356
|
-
const f = (
|
|
357
|
-
return
|
|
358
|
-
vt((
|
|
359
|
-
var
|
|
360
|
-
if (d++, !f(d - 1,
|
|
361
|
-
const x = (
|
|
362
|
-
if (!x) throw
|
|
357
|
+
const f = (g, x) => g < u ? i(g, x) : !1;
|
|
358
|
+
return E.pipe(
|
|
359
|
+
vt((g) => {
|
|
360
|
+
var F;
|
|
361
|
+
if (d++, !f(d - 1, g)) throw g;
|
|
362
|
+
const x = (F = s.caughtError) == null ? void 0 : F.call(s, d, g);
|
|
363
|
+
if (!x) throw g;
|
|
363
364
|
return x.pipe(
|
|
364
365
|
tt(
|
|
365
366
|
($) => C(
|
|
366
367
|
v($),
|
|
367
|
-
Oe(() =>
|
|
368
|
+
Oe(() => g)
|
|
368
369
|
)
|
|
369
370
|
)
|
|
370
371
|
);
|
|
371
372
|
}),
|
|
372
|
-
ps((
|
|
373
|
+
ps((g) => g.pipe(
|
|
373
374
|
ys((x) => {
|
|
374
|
-
const
|
|
375
|
+
const F = d - 1;
|
|
375
376
|
return n().pipe(
|
|
376
377
|
bs(),
|
|
377
378
|
tt(
|
|
378
|
-
() => f(
|
|
379
|
+
() => f(F, x) ? Qe(
|
|
379
380
|
Rs(
|
|
380
|
-
p(
|
|
381
|
+
p(F, c),
|
|
381
382
|
h
|
|
382
383
|
)
|
|
383
384
|
).pipe(
|
|
384
|
-
tt(($) => r && !r(
|
|
385
|
+
tt(($) => r && !r(F, x) ? Oe(() => x) : v($))
|
|
385
386
|
) : Oe(() => x)
|
|
386
387
|
)
|
|
387
388
|
);
|
|
388
389
|
})
|
|
389
390
|
)),
|
|
390
|
-
vt((
|
|
391
|
+
vt((g) => {
|
|
391
392
|
if (s.catchError)
|
|
392
|
-
return s.catchError(d,
|
|
393
|
-
throw
|
|
393
|
+
return s.catchError(d, g);
|
|
394
|
+
throw g;
|
|
394
395
|
}),
|
|
395
396
|
Qt(() => {
|
|
396
397
|
o && (d = 0);
|
|
@@ -455,7 +456,7 @@ class As {
|
|
|
455
456
|
__queryFinalizeHook: e
|
|
456
457
|
} = {}) {
|
|
457
458
|
w(this, ee, new I());
|
|
458
|
-
|
|
459
|
+
b(this, "state$");
|
|
459
460
|
const t = new X(0), r = t.pipe(
|
|
460
461
|
O((n) => n === 0)
|
|
461
462
|
);
|
|
@@ -473,7 +474,7 @@ class As {
|
|
|
473
474
|
Ke(),
|
|
474
475
|
q(() => u.state$),
|
|
475
476
|
ne(a(this, ee))
|
|
476
|
-
),
|
|
477
|
+
), E = u.state$.pipe(
|
|
477
478
|
we,
|
|
478
479
|
ot(1)
|
|
479
480
|
), d = C(
|
|
@@ -483,7 +484,7 @@ class As {
|
|
|
483
484
|
u.cancelled$
|
|
484
485
|
);
|
|
485
486
|
return C(
|
|
486
|
-
|
|
487
|
+
E,
|
|
487
488
|
p,
|
|
488
489
|
/**
|
|
489
490
|
* We defer execution so that we return at least
|
|
@@ -491,7 +492,7 @@ class As {
|
|
|
491
492
|
*/
|
|
492
493
|
o
|
|
493
494
|
).pipe(
|
|
494
|
-
|
|
495
|
+
y((f) => ({ state: f, mutation: u })),
|
|
495
496
|
e ?? Mt,
|
|
496
497
|
ne(d)
|
|
497
498
|
);
|
|
@@ -532,7 +533,7 @@ function P(s, e) {
|
|
|
532
533
|
return !0;
|
|
533
534
|
}
|
|
534
535
|
const Dt = (s) => s.pipe(
|
|
535
|
-
|
|
536
|
+
V(
|
|
536
537
|
({ data: e, ...t }, { data: r, ...n }) => P(t, n) && P(e, r)
|
|
537
538
|
)
|
|
538
539
|
);
|
|
@@ -547,8 +548,8 @@ class Qs {
|
|
|
547
548
|
* - mutation does not get garbage collected
|
|
548
549
|
* - mutation mutate options are run on finish
|
|
549
550
|
*/
|
|
550
|
-
|
|
551
|
-
|
|
551
|
+
b(this, "observed$");
|
|
552
|
+
b(this, "getObserverResultFromState", (e) => ({
|
|
552
553
|
...fe(),
|
|
553
554
|
...e,
|
|
554
555
|
isSuccess: e.status === "success",
|
|
@@ -573,7 +574,7 @@ class Qs {
|
|
|
573
574
|
).subscribe(), this.observed$ = a(this, L).pipe(
|
|
574
575
|
j((u) => (u == null ? void 0 : u.mutation.state$.pipe(
|
|
575
576
|
// last(),
|
|
576
|
-
|
|
577
|
+
y((i) => ({
|
|
577
578
|
state: i,
|
|
578
579
|
options: u.options
|
|
579
580
|
}))
|
|
@@ -619,10 +620,10 @@ class Qs {
|
|
|
619
620
|
const e = this.getObserverResultFromState(
|
|
620
621
|
((u = a(this, L).getValue()) == null ? void 0 : u.mutation.state) ?? fe()
|
|
621
622
|
), t = a(this, ae).state$.pipe(
|
|
622
|
-
|
|
623
|
+
V(
|
|
623
624
|
({ mutation: i, state: { data: c, ...l } }, { mutation: h, state: { data: o, ...p } }) => i === h && P(l, p) && P(c, o)
|
|
624
625
|
),
|
|
625
|
-
|
|
626
|
+
y(({ state: i }) => i),
|
|
626
627
|
Be((i, c) => ({
|
|
627
628
|
...i,
|
|
628
629
|
...c,
|
|
@@ -633,11 +634,11 @@ class Qs {
|
|
|
633
634
|
error: c.error ?? i.error
|
|
634
635
|
}
|
|
635
636
|
})),
|
|
636
|
-
|
|
637
|
+
y((i) => this.getObserverResultFromState(i))
|
|
637
638
|
), r = a(this, L).pipe(
|
|
638
639
|
O(rt),
|
|
639
640
|
j((i) => i.mutation.cancelled$),
|
|
640
|
-
|
|
641
|
+
y(() => this.getObserverResultFromState(fe()))
|
|
641
642
|
);
|
|
642
643
|
return { result$: C(
|
|
643
644
|
this.observed$,
|
|
@@ -737,15 +738,15 @@ function Is(s) {
|
|
|
737
738
|
const pe = typeof window > "u" || "Deno" in window;
|
|
738
739
|
class Ps {
|
|
739
740
|
constructor() {
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
741
|
+
b(this, "isOnlineSubject", new X(!0));
|
|
742
|
+
b(this, "online$", this.isOnlineSubject.pipe(V()));
|
|
743
|
+
b(this, "backToOnline$", this.online$.pipe(
|
|
743
744
|
O((e) => e),
|
|
744
745
|
Je()
|
|
745
746
|
));
|
|
746
747
|
C(
|
|
747
|
-
pe ? B : Ne(window, "offline").pipe(
|
|
748
|
-
pe ? B : Ne(window, "online").pipe(
|
|
748
|
+
pe ? B : Ne(window, "offline").pipe(y(() => !1)),
|
|
749
|
+
pe ? B : Ne(window, "online").pipe(y(() => !0))
|
|
749
750
|
).pipe(Is(this.isOnlineSubject)).subscribe();
|
|
750
751
|
}
|
|
751
752
|
isOnline() {
|
|
@@ -851,8 +852,8 @@ const it = Symbol(), qs = ({
|
|
|
851
852
|
const S = n.status === "pending" ? "pending" : i.status ?? n.status;
|
|
852
853
|
return { ...n, ...i, status: S };
|
|
853
854
|
}
|
|
854
|
-
const c = i.data, l = c !== void 0 && c !== n.data, h = "data" in i, o = i.status === "success", p = n.data !== void 0,
|
|
855
|
-
(p ||
|
|
855
|
+
const c = i.data, l = c !== void 0 && c !== n.data, h = "data" in i, o = i.status === "success", p = n.data !== void 0, E = n.error !== void 0 || n.error !== null, d = i.status ?? n.status, f = l ? Le(e().data, c, s()) : h ? i.data : n.data, g = n.status === "error" || n.status === "success", x = i.status === "error" && (n.status === "error" && n.fetchStatus === "fetching" || n.status !== "error") ? n.errorUpdateCount + 1 : n.errorUpdateCount, F = l ? n.dataUpdateCount + 1 : i.dataUpdateCount ?? n.dataUpdateCount, $ = i.status === "pending" && g && // (dataUpdateCount !== 0 || errorUpdateCount !== 0)
|
|
856
|
+
(p || E), D = d === "pending" ? null : i.error ?? n.error;
|
|
856
857
|
return {
|
|
857
858
|
...n,
|
|
858
859
|
...i,
|
|
@@ -863,14 +864,14 @@ const it = Symbol(), qs = ({
|
|
|
863
864
|
isInvalidated: !1
|
|
864
865
|
},
|
|
865
866
|
data: f,
|
|
866
|
-
dataUpdateCount:
|
|
867
|
+
dataUpdateCount: F,
|
|
867
868
|
...$ && {
|
|
868
869
|
status: n.status
|
|
869
870
|
}
|
|
870
871
|
};
|
|
871
872
|
}, t)
|
|
872
873
|
), Hs = (s) => s.pipe(
|
|
873
|
-
|
|
874
|
+
y(
|
|
874
875
|
({ status: e, fetchStatus: t }) => t === "idle" && (e === "success" || e === "error")
|
|
875
876
|
)
|
|
876
877
|
), qt = (s) => s.pipe(
|
|
@@ -882,13 +883,13 @@ class _s {
|
|
|
882
883
|
w(this, We, C(
|
|
883
884
|
pe ? B : Ne(document, "visibilitychange"),
|
|
884
885
|
pe ? B : Ne(window, "visibilitychange")
|
|
885
|
-
).pipe(
|
|
886
|
+
).pipe(y(() => document.visibilityState)));
|
|
886
887
|
w(this, te, new X(
|
|
887
888
|
pe ? !0 : document.visibilityState === "visible"
|
|
888
889
|
));
|
|
889
890
|
// public readonly focused$ = this.#focusedSubject.pipe(distinctUntilChanged())
|
|
890
|
-
|
|
891
|
-
|
|
891
|
+
b(this, "focused$", a(this, te));
|
|
892
|
+
b(this, "focusRegained$", this.focused$.pipe(
|
|
892
893
|
ot(1),
|
|
893
894
|
O((e) => e)
|
|
894
895
|
));
|
|
@@ -924,12 +925,12 @@ class _s {
|
|
|
924
925
|
We = new WeakMap(), te = new WeakMap();
|
|
925
926
|
const ze = new _s(), Ls = (s) => s.pipe(
|
|
926
927
|
O((e) => e.status === "success"),
|
|
927
|
-
|
|
928
|
+
y((e) => ({
|
|
928
929
|
data: e.data,
|
|
929
930
|
status: e.status,
|
|
930
931
|
dataUpdatedAt: e.dataUpdatedAt
|
|
931
932
|
})),
|
|
932
|
-
|
|
933
|
+
V(P)
|
|
933
934
|
);
|
|
934
935
|
var Z, M, Ce, oe, T, ye, Fe;
|
|
935
936
|
class Ht {
|
|
@@ -942,7 +943,7 @@ class Ht {
|
|
|
942
943
|
* We need to be able to track change to both of them at the same time
|
|
943
944
|
* in order to react accordingly and in order (such as refetch on options change)
|
|
944
945
|
*/
|
|
945
|
-
|
|
946
|
+
b(this, "queryUpdateSubject", new I());
|
|
946
947
|
/**
|
|
947
948
|
* Mostly used to compare the state before and after mount
|
|
948
949
|
*/
|
|
@@ -956,7 +957,7 @@ class Ht {
|
|
|
956
957
|
// It will be used to pass the previous data and query to the placeholder function between renders.
|
|
957
958
|
w(this, ye);
|
|
958
959
|
w(this, Fe, 0);
|
|
959
|
-
|
|
960
|
+
b(this, "getObserverResultFromQuery", ({
|
|
960
961
|
options: e,
|
|
961
962
|
query: t,
|
|
962
963
|
optimisticResult: r,
|
|
@@ -970,13 +971,13 @@ class Ht {
|
|
|
970
971
|
}
|
|
971
972
|
}) => {
|
|
972
973
|
var De;
|
|
973
|
-
const o = t.state, p = t.state.status === "pending",
|
|
974
|
-
let { errorUpdatedAt: x, fetchStatus:
|
|
974
|
+
const o = t.state, p = t.state.status === "pending", E = a(this, M), d = this.options, g = t !== E ? t.state : a(this, oe);
|
|
975
|
+
let { errorUpdatedAt: x, fetchStatus: F, error: $ } = o;
|
|
975
976
|
if (r) {
|
|
976
|
-
const k = !!a(this, Fe), yt = !k && Ct(t, e), Jt = k && Ft(t,
|
|
977
|
-
(yt || Jt) && (
|
|
977
|
+
const k = !!a(this, Fe), yt = !k && Ct(t, e), Jt = k && Ft(t, E, e, d);
|
|
978
|
+
(yt || Jt) && (F = ks(t.options.networkMode) ? "fetching" : "paused");
|
|
978
979
|
}
|
|
979
|
-
const D = p &&
|
|
980
|
+
const D = p && F === "fetching";
|
|
980
981
|
let S, m = l, z = c ?? null, W = h;
|
|
981
982
|
if (e.select && typeof o.data < "u")
|
|
982
983
|
if (n && o.data === (i == null ? void 0 : i.data) && e.select === c)
|
|
@@ -989,7 +990,7 @@ class Ht {
|
|
|
989
990
|
}
|
|
990
991
|
else
|
|
991
992
|
S = o.data, m = null;
|
|
992
|
-
let _ =
|
|
993
|
+
let _ = F !== "idle" && !o.dataUpdatedAt ? "pending" : o.status;
|
|
993
994
|
m && ($ = m, S = h, x = (n == null ? void 0 : n.errorUpdatedAt) ?? x, _ = "error");
|
|
994
995
|
const Ve = _ === "error";
|
|
995
996
|
let Ie = !1;
|
|
@@ -1011,11 +1012,11 @@ class Ht {
|
|
|
1011
1012
|
e
|
|
1012
1013
|
), Ie = !0);
|
|
1013
1014
|
}
|
|
1014
|
-
const Pe =
|
|
1015
|
+
const Pe = F === "fetching";
|
|
1015
1016
|
return {
|
|
1016
1017
|
result: {
|
|
1017
1018
|
status: _,
|
|
1018
|
-
fetchStatus:
|
|
1019
|
+
fetchStatus: F,
|
|
1019
1020
|
isPending: p,
|
|
1020
1021
|
isSuccess: _ === "success",
|
|
1021
1022
|
isError: Ve,
|
|
@@ -1029,11 +1030,11 @@ class Ht {
|
|
|
1029
1030
|
failureReason: o.fetchFailureReason,
|
|
1030
1031
|
errorUpdateCount: o.errorUpdateCount,
|
|
1031
1032
|
isFetched: o.dataUpdateCount > 0 || o.errorUpdateCount > 0,
|
|
1032
|
-
isFetchedAfterMount: o.dataUpdateCount >
|
|
1033
|
+
isFetchedAfterMount: o.dataUpdateCount > g.dataUpdateCount || o.errorUpdateCount > g.errorUpdateCount,
|
|
1033
1034
|
isFetching: Pe,
|
|
1034
1035
|
isRefetching: Pe && !p,
|
|
1035
1036
|
isLoadingError: Ve && o.dataUpdatedAt === 0,
|
|
1036
|
-
isPaused:
|
|
1037
|
+
isPaused: F === "paused",
|
|
1037
1038
|
isPlaceholderData: Ie,
|
|
1038
1039
|
isRefetchError: Ve && o.dataUpdatedAt !== 0,
|
|
1039
1040
|
isStale: dt(t, e),
|
|
@@ -1152,9 +1153,9 @@ class Ht {
|
|
|
1152
1153
|
}
|
|
1153
1154
|
observe() {
|
|
1154
1155
|
const e = a(this, M), t = this.queryUpdateSubject.pipe(
|
|
1155
|
-
|
|
1156
|
+
y(({ query: i }) => i),
|
|
1156
1157
|
he(a(this, M)),
|
|
1157
|
-
|
|
1158
|
+
V()
|
|
1158
1159
|
), r = this.queryUpdateSubject.pipe(
|
|
1159
1160
|
he({
|
|
1160
1161
|
query: a(this, M),
|
|
@@ -1183,8 +1184,8 @@ class Ht {
|
|
|
1183
1184
|
const c = this.options, l = this.queryUpdateSubject.pipe(
|
|
1184
1185
|
he({ query: i, options: c }),
|
|
1185
1186
|
O((m) => m.query === i),
|
|
1186
|
-
|
|
1187
|
-
|
|
1187
|
+
y((m) => m.options),
|
|
1188
|
+
V(),
|
|
1188
1189
|
Ue(1)
|
|
1189
1190
|
), h = a(this, Ce).pipe(
|
|
1190
1191
|
O((m) => m.query === i)
|
|
@@ -1206,15 +1207,15 @@ class Ht {
|
|
|
1206
1207
|
);
|
|
1207
1208
|
return P(pt, De);
|
|
1208
1209
|
} : P)(m, z);
|
|
1209
|
-
},
|
|
1210
|
+
}, E = h.pipe(
|
|
1210
1211
|
j(() => i.state$),
|
|
1211
1212
|
qt
|
|
1212
1213
|
), d = l.pipe(
|
|
1213
|
-
|
|
1214
|
+
y(({ refetchInterval: m, refetchIntervalInBackground: z }) => ({
|
|
1214
1215
|
refetchInterval: (typeof m == "function" ? m(a(this, M)) : m) ?? !1,
|
|
1215
1216
|
refetchIntervalInBackground: z
|
|
1216
1217
|
})),
|
|
1217
|
-
|
|
1218
|
+
V(P),
|
|
1218
1219
|
j(({ refetchInterval: m, refetchIntervalInBackground: z }) => m ? as(m).pipe(
|
|
1219
1220
|
R(() => {
|
|
1220
1221
|
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
|
@@ -1223,11 +1224,11 @@ class Ht {
|
|
|
1223
1224
|
) : qe),
|
|
1224
1225
|
ie()
|
|
1225
1226
|
), f = l.pipe(
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
),
|
|
1227
|
+
y(({ enabled: m }) => m ?? !0),
|
|
1228
|
+
V()
|
|
1229
|
+
), g = f.pipe(
|
|
1229
1230
|
O((m) => !m),
|
|
1230
|
-
|
|
1231
|
+
y(() => i.state)
|
|
1231
1232
|
), x = f.pipe(
|
|
1232
1233
|
O((m) => m),
|
|
1233
1234
|
j(() => ze.focusRegained$),
|
|
@@ -1236,11 +1237,11 @@ class Ht {
|
|
|
1236
1237
|
Ts(i, m) && this.fetch({ cancelRefetch: !1 }).catch(N);
|
|
1237
1238
|
}),
|
|
1238
1239
|
ie()
|
|
1239
|
-
),
|
|
1240
|
-
|
|
1240
|
+
), F = g.pipe(
|
|
1241
|
+
y(() => i.state)
|
|
1241
1242
|
), $ = (m) => m.pipe(
|
|
1242
1243
|
St(l),
|
|
1243
|
-
|
|
1244
|
+
y(([, z]) => {
|
|
1244
1245
|
const W = this.getObserverResultFromQuery({
|
|
1245
1246
|
query: i,
|
|
1246
1247
|
options: z,
|
|
@@ -1249,17 +1250,17 @@ class Ht {
|
|
|
1249
1250
|
return this.updateResult({ query: i, ...W }), W.result;
|
|
1250
1251
|
})
|
|
1251
1252
|
), S = C(
|
|
1252
|
-
E,
|
|
1253
1253
|
F,
|
|
1254
|
+
E,
|
|
1254
1255
|
i.state$,
|
|
1255
1256
|
// options$,
|
|
1256
1257
|
o
|
|
1257
1258
|
).pipe(
|
|
1258
1259
|
$,
|
|
1259
1260
|
// This one ensure we don't re-trigger same state
|
|
1260
|
-
|
|
1261
|
+
V(P),
|
|
1261
1262
|
// This one make sure we dispatch based on user preference
|
|
1262
|
-
|
|
1263
|
+
V(p)
|
|
1263
1264
|
);
|
|
1264
1265
|
return C(d, x, S);
|
|
1265
1266
|
})
|
|
@@ -1326,7 +1327,7 @@ function Lt(s, e, t) {
|
|
|
1326
1327
|
* It's important to not skip the first result (even tho most of the time they are equal).
|
|
1327
1328
|
* We only skip if they are the same.
|
|
1328
1329
|
*/
|
|
1329
|
-
O((
|
|
1330
|
+
O((E) => !P(E, h.current))
|
|
1330
1331
|
),
|
|
1331
1332
|
[]
|
|
1332
1333
|
), Y(() => {
|
|
@@ -1363,7 +1364,7 @@ function Mr(s, e, t = []) {
|
|
|
1363
1364
|
r.onError ?? ((l) => {
|
|
1364
1365
|
console.error(l);
|
|
1365
1366
|
})
|
|
1366
|
-
), i = de(() =>
|
|
1367
|
+
), i = de(() => U(s), t), c = de(
|
|
1367
1368
|
() => i().pipe(
|
|
1368
1369
|
J((l) => {
|
|
1369
1370
|
throw u.current(l), l;
|
|
@@ -1409,7 +1410,7 @@ const zt = () => (s) => C(
|
|
|
1409
1410
|
state: e,
|
|
1410
1411
|
options: t
|
|
1411
1412
|
}) => {
|
|
1412
|
-
const r = e.isPaused, n = async () => await Promise.reject(new Error("No mutationFn found")), u = t.mutationFn ?? n, i =
|
|
1413
|
+
const r = e.isPaused, n = async () => await Promise.reject(new Error("No mutationFn found")), u = t.mutationFn ?? n, i = U(
|
|
1413
1414
|
// eslint-disable-next-line @typescript-eslint/promise-function-async
|
|
1414
1415
|
() => {
|
|
1415
1416
|
var d;
|
|
@@ -1417,16 +1418,16 @@ const zt = () => (s) => C(
|
|
|
1417
1418
|
}
|
|
1418
1419
|
), c = v(e.context), l = cs(() => r, c, i).pipe(
|
|
1419
1420
|
Ue(1)
|
|
1420
|
-
), h = (d, f,
|
|
1421
|
+
), h = (d, f, g) => U(
|
|
1421
1422
|
() => {
|
|
1422
|
-
var
|
|
1423
|
-
return (
|
|
1423
|
+
var F;
|
|
1424
|
+
return (F = t.onError) == null ? void 0 : F.call(t, d, s, f);
|
|
1424
1425
|
}
|
|
1425
1426
|
).pipe(
|
|
1426
1427
|
J(() => v(d)),
|
|
1427
|
-
|
|
1428
|
+
y(
|
|
1428
1429
|
() => ({
|
|
1429
|
-
failureCount:
|
|
1430
|
+
failureCount: g,
|
|
1430
1431
|
error: d,
|
|
1431
1432
|
failureReason: d,
|
|
1432
1433
|
context: f,
|
|
@@ -1435,18 +1436,18 @@ const zt = () => (s) => C(
|
|
|
1435
1436
|
)
|
|
1436
1437
|
), o = l.pipe(
|
|
1437
1438
|
j((d) => {
|
|
1438
|
-
const
|
|
1439
|
+
const g = (typeof u == "function" ? (
|
|
1439
1440
|
// eslint-disable-next-line @typescript-eslint/promise-function-async
|
|
1440
|
-
|
|
1441
|
-
) : u).pipe(ue()), x =
|
|
1441
|
+
U(() => u(s))
|
|
1442
|
+
) : u).pipe(ue()), x = g.pipe(
|
|
1442
1443
|
ls(),
|
|
1443
1444
|
R(($) => {
|
|
1444
1445
|
if ($)
|
|
1445
1446
|
throw new Error("Mutation completed without any emission (EMPTY)");
|
|
1446
1447
|
}),
|
|
1447
1448
|
ie()
|
|
1448
|
-
),
|
|
1449
|
-
|
|
1449
|
+
), F = C(g, x).pipe(
|
|
1450
|
+
y(
|
|
1450
1451
|
($) => ({
|
|
1451
1452
|
result: {
|
|
1452
1453
|
data: $
|
|
@@ -1470,7 +1471,7 @@ const zt = () => (s) => C(
|
|
|
1470
1471
|
})
|
|
1471
1472
|
),
|
|
1472
1473
|
catchError: ($, D) => h(D, d, $).pipe(
|
|
1473
|
-
|
|
1474
|
+
y((S) => ({
|
|
1474
1475
|
...S,
|
|
1475
1476
|
result: void 0
|
|
1476
1477
|
}))
|
|
@@ -1481,7 +1482,7 @@ const zt = () => (s) => C(
|
|
|
1481
1482
|
!0
|
|
1482
1483
|
)
|
|
1483
1484
|
);
|
|
1484
|
-
return re.isOnline() || t.networkMode === "offlineFirst" || t.networkMode === "always" ?
|
|
1485
|
+
return re.isOnline() || t.networkMode === "offlineFirst" || t.networkMode === "always" ? F : F.pipe(zt());
|
|
1485
1486
|
})
|
|
1486
1487
|
), p = v({
|
|
1487
1488
|
...e,
|
|
@@ -1495,24 +1496,24 @@ const zt = () => (s) => C(
|
|
|
1495
1496
|
return C(
|
|
1496
1497
|
p,
|
|
1497
1498
|
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
1498
|
-
l.pipe(
|
|
1499
|
+
l.pipe(y((d) => ({ context: d }))),
|
|
1499
1500
|
o.pipe(
|
|
1500
|
-
j(({ result: d, error: f, ...
|
|
1501
|
+
j(({ result: d, error: f, ...g }) => {
|
|
1501
1502
|
if (!d && !f)
|
|
1502
1503
|
return v({
|
|
1503
|
-
...
|
|
1504
|
+
...g
|
|
1504
1505
|
});
|
|
1505
|
-
const x = f ? v(null) :
|
|
1506
|
+
const x = f ? v(null) : U(
|
|
1506
1507
|
() => {
|
|
1507
1508
|
var S;
|
|
1508
1509
|
return (S = t.onSuccess) == null ? void 0 : S.call(
|
|
1509
1510
|
t,
|
|
1510
1511
|
d == null ? void 0 : d.data,
|
|
1511
1512
|
s,
|
|
1512
|
-
|
|
1513
|
+
g.context
|
|
1513
1514
|
);
|
|
1514
1515
|
}
|
|
1515
|
-
), $ =
|
|
1516
|
+
), $ = U(
|
|
1516
1517
|
() => {
|
|
1517
1518
|
var S;
|
|
1518
1519
|
return (S = t.onSettled) == null ? void 0 : S.call(
|
|
@@ -1520,7 +1521,7 @@ const zt = () => (s) => C(
|
|
|
1520
1521
|
d == null ? void 0 : d.data,
|
|
1521
1522
|
f,
|
|
1522
1523
|
s,
|
|
1523
|
-
|
|
1524
|
+
g.context
|
|
1524
1525
|
);
|
|
1525
1526
|
}
|
|
1526
1527
|
).pipe(
|
|
@@ -1528,12 +1529,12 @@ const zt = () => (s) => C(
|
|
|
1528
1529
|
);
|
|
1529
1530
|
return Te(x, $).pipe(
|
|
1530
1531
|
ke(),
|
|
1531
|
-
|
|
1532
|
+
y(
|
|
1532
1533
|
() => f ? {
|
|
1533
1534
|
error: f,
|
|
1534
1535
|
data: void 0,
|
|
1535
1536
|
variables: s,
|
|
1536
|
-
...
|
|
1537
|
+
...g
|
|
1537
1538
|
} : {
|
|
1538
1539
|
status: "success",
|
|
1539
1540
|
error: f,
|
|
@@ -1541,12 +1542,12 @@ const zt = () => (s) => C(
|
|
|
1541
1542
|
variables: s,
|
|
1542
1543
|
failureCount: 0,
|
|
1543
1544
|
failureReason: null,
|
|
1544
|
-
...
|
|
1545
|
+
...g
|
|
1545
1546
|
}
|
|
1546
1547
|
),
|
|
1547
1548
|
J(
|
|
1548
|
-
(S) => h(S,
|
|
1549
|
-
|
|
1549
|
+
(S) => h(S, g.context, 0).pipe(
|
|
1550
|
+
y((m) => ({
|
|
1550
1551
|
...m,
|
|
1551
1552
|
data: void 0
|
|
1552
1553
|
}))
|
|
@@ -1574,15 +1575,15 @@ class tr {
|
|
|
1574
1575
|
w(this, Ee, new X(0));
|
|
1575
1576
|
w(this, se, new I());
|
|
1576
1577
|
w(this, be, new I());
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1578
|
+
b(this, "state", fe());
|
|
1579
|
+
b(this, "state$");
|
|
1580
|
+
b(this, "options");
|
|
1581
|
+
b(this, "observerCount$", a(this, Ee).asObservable());
|
|
1582
|
+
b(this, "cancelled$", a(this, se).asObservable());
|
|
1582
1583
|
this.options = e, this.state = r ?? this.state;
|
|
1583
1584
|
const n = a(this, se).pipe(
|
|
1584
1585
|
O(() => this.state.status === "pending"),
|
|
1585
|
-
|
|
1586
|
+
y(() => ({
|
|
1586
1587
|
status: "idle"
|
|
1587
1588
|
}))
|
|
1588
1589
|
), u = a(this, be).pipe(
|
|
@@ -1591,7 +1592,7 @@ class tr {
|
|
|
1591
1592
|
options: {
|
|
1592
1593
|
...this.options,
|
|
1593
1594
|
onMutate: (l) => {
|
|
1594
|
-
const h =
|
|
1595
|
+
const h = U(
|
|
1595
1596
|
() => {
|
|
1596
1597
|
var d, f;
|
|
1597
1598
|
return (f = (d = t.config).onMutate) == null ? void 0 : f.call(
|
|
@@ -1600,7 +1601,7 @@ class tr {
|
|
|
1600
1601
|
this
|
|
1601
1602
|
);
|
|
1602
1603
|
}
|
|
1603
|
-
), p =
|
|
1604
|
+
), p = U(() => {
|
|
1604
1605
|
var d, f;
|
|
1605
1606
|
return (f = (d = this.options).onMutate) == null ? void 0 : f.call(d, l);
|
|
1606
1607
|
});
|
|
@@ -1609,7 +1610,7 @@ class tr {
|
|
|
1609
1610
|
);
|
|
1610
1611
|
},
|
|
1611
1612
|
onError: (l, h, o) => {
|
|
1612
|
-
const p =
|
|
1613
|
+
const p = U(
|
|
1613
1614
|
() => {
|
|
1614
1615
|
var d, f;
|
|
1615
1616
|
return (f = (d = t.config).onError) == null ? void 0 : f.call(
|
|
@@ -1620,19 +1621,19 @@ class tr {
|
|
|
1620
1621
|
this
|
|
1621
1622
|
);
|
|
1622
1623
|
}
|
|
1623
|
-
),
|
|
1624
|
+
), E = U(
|
|
1624
1625
|
() => {
|
|
1625
1626
|
var d, f;
|
|
1626
1627
|
return (f = (d = this.options).onError) == null ? void 0 : f.call(d, l, h, o);
|
|
1627
1628
|
}
|
|
1628
1629
|
);
|
|
1629
|
-
return Te(p,
|
|
1630
|
+
return Te(p, E).pipe(ke());
|
|
1630
1631
|
},
|
|
1631
1632
|
onSettled: (l, h, o, p) => {
|
|
1632
|
-
const
|
|
1633
|
+
const E = U(
|
|
1633
1634
|
() => {
|
|
1634
|
-
var f,
|
|
1635
|
-
return (
|
|
1635
|
+
var f, g;
|
|
1636
|
+
return (g = (f = t.config).onSettled) == null ? void 0 : g.call(
|
|
1636
1637
|
f,
|
|
1637
1638
|
l,
|
|
1638
1639
|
h,
|
|
@@ -1641,16 +1642,16 @@ class tr {
|
|
|
1641
1642
|
this
|
|
1642
1643
|
);
|
|
1643
1644
|
}
|
|
1644
|
-
), d =
|
|
1645
|
+
), d = U(
|
|
1645
1646
|
() => {
|
|
1646
|
-
var f,
|
|
1647
|
-
return (
|
|
1647
|
+
var f, g;
|
|
1648
|
+
return (g = (f = this.options).onSettled) == null ? void 0 : g.call(f, l, h, o, p);
|
|
1648
1649
|
}
|
|
1649
1650
|
);
|
|
1650
|
-
return Te(
|
|
1651
|
+
return Te(E, d).pipe(ke());
|
|
1651
1652
|
},
|
|
1652
1653
|
onSuccess: (l, h, o) => {
|
|
1653
|
-
const p =
|
|
1654
|
+
const p = U(
|
|
1654
1655
|
() => {
|
|
1655
1656
|
var d, f;
|
|
1656
1657
|
return (f = (d = t.config).onSuccess) == null ? void 0 : f.call(
|
|
@@ -1661,13 +1662,13 @@ class tr {
|
|
|
1661
1662
|
this
|
|
1662
1663
|
);
|
|
1663
1664
|
}
|
|
1664
|
-
),
|
|
1665
|
+
), E = U(
|
|
1665
1666
|
() => {
|
|
1666
1667
|
var d, f;
|
|
1667
1668
|
return (f = (d = this.options).onSuccess) == null ? void 0 : f.call(d, l, h, o);
|
|
1668
1669
|
}
|
|
1669
1670
|
);
|
|
1670
|
-
return Te(p,
|
|
1671
|
+
return Te(p, E).pipe(ke());
|
|
1671
1672
|
}
|
|
1672
1673
|
},
|
|
1673
1674
|
state: this.state,
|
|
@@ -1733,20 +1734,20 @@ class Wt {
|
|
|
1733
1734
|
* @important
|
|
1734
1735
|
* Query store. Could be turned into a map for more performance.
|
|
1735
1736
|
*/
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1737
|
+
b(this, "entriesSubject", new X([]));
|
|
1738
|
+
b(this, "changeSubject", new I());
|
|
1739
|
+
b(this, "entries$", this.entriesSubject.pipe(ue()));
|
|
1740
|
+
b(this, "added$", this.changeSubject.pipe(
|
|
1740
1741
|
O(({ type: e }) => e === "added"),
|
|
1741
|
-
|
|
1742
|
+
y(({ entity: e }) => e),
|
|
1742
1743
|
ue()
|
|
1743
1744
|
));
|
|
1744
|
-
|
|
1745
|
+
b(this, "removed$", this.changeSubject.pipe(
|
|
1745
1746
|
O(({ type: e }) => e === "removed"),
|
|
1746
|
-
|
|
1747
|
+
y(({ entity: e }) => e),
|
|
1747
1748
|
ue()
|
|
1748
1749
|
));
|
|
1749
|
-
|
|
1750
|
+
b(this, "stateChange$", C(
|
|
1750
1751
|
this.entriesSubject.pipe(
|
|
1751
1752
|
Je(),
|
|
1752
1753
|
q((e) => Se(e))
|
|
@@ -1755,7 +1756,7 @@ class Wt {
|
|
|
1755
1756
|
).pipe(
|
|
1756
1757
|
q(
|
|
1757
1758
|
(e) => e.state$.pipe(
|
|
1758
|
-
|
|
1759
|
+
y(() => e),
|
|
1759
1760
|
ne(
|
|
1760
1761
|
this.removed$.pipe(
|
|
1761
1762
|
O((t) => t === e)
|
|
@@ -1956,7 +1957,7 @@ const nr = (s) => Ae(() => ze.isFocused() ? s : ze.focusRegained$.pipe(q(() => s
|
|
|
1956
1957
|
})(u);
|
|
1957
1958
|
const l = (typeof r == "function" ? (
|
|
1958
1959
|
// eslint-disable-next-line @typescript-eslint/promise-function-async
|
|
1959
|
-
|
|
1960
|
+
U(
|
|
1960
1961
|
() => r(u)
|
|
1961
1962
|
)
|
|
1962
1963
|
) : r).pipe(
|
|
@@ -1966,7 +1967,7 @@ const nr = (s) => Ae(() => ze.isFocused() ? s : ze.focusRegained$.pipe(q(() => s
|
|
|
1966
1967
|
t = !0;
|
|
1967
1968
|
}
|
|
1968
1969
|
}),
|
|
1969
|
-
|
|
1970
|
+
y(
|
|
1970
1971
|
(o) => ({
|
|
1971
1972
|
data: o
|
|
1972
1973
|
})
|
|
@@ -2015,7 +2016,7 @@ const nr = (s) => Ae(() => ze.isFocused() ? s : ze.focusRegained$.pipe(q(() => s
|
|
|
2015
2016
|
* There is in theory no problem associated to that.
|
|
2016
2017
|
*/
|
|
2017
2018
|
ct(1),
|
|
2018
|
-
|
|
2019
|
+
y(
|
|
2019
2020
|
(p) => t ? p : { ...p, fetchStatus: "fetching" }
|
|
2020
2021
|
)
|
|
2021
2022
|
) : v(o)),
|
|
@@ -2041,8 +2042,8 @@ const nr = (s) => Ae(() => ze.isFocused() ? s : ze.focusRegained$.pipe(q(() => s
|
|
|
2041
2042
|
};
|
|
2042
2043
|
class or {
|
|
2043
2044
|
constructor(e) {
|
|
2044
|
-
|
|
2045
|
-
|
|
2045
|
+
b(this, "revert");
|
|
2046
|
+
b(this, "silent");
|
|
2046
2047
|
this.revert = e == null ? void 0 : e.revert, this.silent = e == null ? void 0 : e.silent;
|
|
2047
2048
|
}
|
|
2048
2049
|
}
|
|
@@ -2098,32 +2099,32 @@ const lr = Gt();
|
|
|
2098
2099
|
var xe, ce;
|
|
2099
2100
|
class hr {
|
|
2100
2101
|
constructor(e) {
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2102
|
+
b(this, "queryKey");
|
|
2103
|
+
b(this, "queryHash");
|
|
2104
|
+
b(this, "gcTime");
|
|
2105
|
+
b(this, "options");
|
|
2105
2106
|
w(this, xe);
|
|
2106
2107
|
w(this, ce);
|
|
2107
|
-
|
|
2108
|
+
b(this, "state");
|
|
2108
2109
|
// @todo to share with mutation
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2110
|
+
b(this, "executeSubject", new I());
|
|
2111
|
+
b(this, "cancelSubject", new I());
|
|
2112
|
+
b(this, "setDataSubject", new I());
|
|
2113
|
+
b(this, "invalidatedSubject", new I());
|
|
2114
|
+
b(this, "resetSubject", new I());
|
|
2115
|
+
b(this, "destroySubject", new I());
|
|
2116
|
+
b(this, "observersSubject", new X([]));
|
|
2117
|
+
b(this, "abortSignalConsumed", !1);
|
|
2118
|
+
b(this, "observerCount$", this.observersSubject.asObservable().pipe(y((e) => e.length)));
|
|
2119
|
+
b(this, "observers$", this.observersSubject.asObservable());
|
|
2120
|
+
b(this, "state$");
|
|
2120
2121
|
A(this, xe, e.defaultOptions), this.options = this.setOptions(e.options), this.queryKey = e.queryKey, this.queryHash = e.queryHash, A(this, ce, e.state ?? rr(this.options)), this.state = a(this, ce), this.gcTime = this.updateGcTime(this.options.gcTime), this.state$ = C(
|
|
2121
2122
|
this.resetSubject.pipe(
|
|
2122
|
-
|
|
2123
|
+
y(() => ({ command: "reset", state: a(this, ce) }))
|
|
2123
2124
|
),
|
|
2124
2125
|
this.invalidatedSubject.pipe(
|
|
2125
2126
|
O(() => !this.state.isInvalidated),
|
|
2126
|
-
|
|
2127
|
+
y(() => ({
|
|
2127
2128
|
command: "invalidate",
|
|
2128
2129
|
state: {
|
|
2129
2130
|
isInvalidated: !0
|
|
@@ -2132,7 +2133,7 @@ class hr {
|
|
|
2132
2133
|
),
|
|
2133
2134
|
this.cancelSubject.pipe(
|
|
2134
2135
|
O(() => !(this.state.error && this.state.status === "error")),
|
|
2135
|
-
|
|
2136
|
+
y((t) => ({
|
|
2136
2137
|
command: "cancel",
|
|
2137
2138
|
state: {
|
|
2138
2139
|
status: t != null && t.revert ? this.state.status : "error",
|
|
@@ -2182,7 +2183,7 @@ class hr {
|
|
|
2182
2183
|
})
|
|
2183
2184
|
);
|
|
2184
2185
|
return C(u, n).pipe(
|
|
2185
|
-
|
|
2186
|
+
y((h) => ({
|
|
2186
2187
|
command: "execute",
|
|
2187
2188
|
state: h
|
|
2188
2189
|
})),
|
|
@@ -2191,7 +2192,7 @@ class hr {
|
|
|
2191
2192
|
})
|
|
2192
2193
|
),
|
|
2193
2194
|
this.setDataSubject.pipe(
|
|
2194
|
-
|
|
2195
|
+
y(({ data: t, options: r }) => ({
|
|
2195
2196
|
command: "setData",
|
|
2196
2197
|
state: {
|
|
2197
2198
|
status: "success",
|
|
@@ -2207,7 +2208,7 @@ class hr {
|
|
|
2207
2208
|
getState: () => this.state
|
|
2208
2209
|
}),
|
|
2209
2210
|
he(a(this, ce)),
|
|
2210
|
-
|
|
2211
|
+
V(P),
|
|
2211
2212
|
R((t) => {
|
|
2212
2213
|
this.state = t;
|
|
2213
2214
|
}),
|
|
@@ -2226,22 +2227,22 @@ class hr {
|
|
|
2226
2227
|
}
|
|
2227
2228
|
get success$() {
|
|
2228
2229
|
return this.state$.pipe(
|
|
2229
|
-
|
|
2230
|
-
|
|
2230
|
+
y(({ data: e, status: t }) => ({ data: e, status: t })),
|
|
2231
|
+
V(P),
|
|
2231
2232
|
O(({ status: e }) => e === "success")
|
|
2232
2233
|
);
|
|
2233
2234
|
}
|
|
2234
2235
|
get error$() {
|
|
2235
2236
|
return this.state$.pipe(
|
|
2236
|
-
|
|
2237
|
-
|
|
2237
|
+
y(({ error: e, status: t }) => ({ error: e, status: t })),
|
|
2238
|
+
V(P),
|
|
2238
2239
|
O(({ status: e }) => e === "error")
|
|
2239
2240
|
);
|
|
2240
2241
|
}
|
|
2241
2242
|
get settled$() {
|
|
2242
2243
|
return this.state$.pipe(
|
|
2243
|
-
|
|
2244
|
-
|
|
2244
|
+
y(({ status: e }) => ({ status: e })),
|
|
2245
|
+
V(P),
|
|
2245
2246
|
O(({ status: e }) => e === "success" || e === "error")
|
|
2246
2247
|
);
|
|
2247
2248
|
}
|
|
@@ -2338,11 +2339,11 @@ class dr {
|
|
|
2338
2339
|
return a(this, G).stateChange$.pipe(
|
|
2339
2340
|
// we force a first result
|
|
2340
2341
|
he(),
|
|
2341
|
-
|
|
2342
|
+
y(() => this.findAll({
|
|
2342
2343
|
...e,
|
|
2343
2344
|
fetchStatus: "fetching"
|
|
2344
2345
|
}).length),
|
|
2345
|
-
|
|
2346
|
+
V()
|
|
2346
2347
|
);
|
|
2347
2348
|
}
|
|
2348
2349
|
getAll() {
|