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