reactjrx 1.81.0 → 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 +281 -286
- 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 +1 -1
- 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 +2 -1
- package/dist/lib/state/persistance/getNormalizedPersistanceValue.d.ts +2 -1
- package/dist/lib/state/persistance/types.d.ts +2 -1
- package/dist/lib/state/persistance/usePersistSignals.d.ts +7 -6
- package/dist/lib/state/signal.d.ts +3 -2
- package/dist/lib/state/useSignal.d.ts +3 -2
- package/dist/lib/state/useSignalValue.d.ts +2 -1
- 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,37 +1,36 @@
|
|
|
1
1
|
var Wt = Object.defineProperty;
|
|
2
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),
|
|
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
|
};
|
|
7
|
-
var a = (r, e, t) => (
|
|
7
|
+
var a = (r, e, t) => (dt(r, e, "read from private field"), t ? t.call(r) : e.get(r)), w = (r, e, t) => {
|
|
8
8
|
if (e.has(r))
|
|
9
9
|
throw TypeError("Cannot add the same private member more than once");
|
|
10
10
|
e instanceof WeakSet ? e.add(r) : e.set(r, t);
|
|
11
|
-
}, M = (r, e, t, s) => (
|
|
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
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,
|
|
15
|
-
import { catchError as yt, mergeMap as Ze, retryWhen as
|
|
16
|
-
import { jsxs as
|
|
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
17
|
const H = (r) => {
|
|
18
18
|
const e = ye(r);
|
|
19
19
|
return st(() => {
|
|
20
20
|
e.current = r;
|
|
21
21
|
}, [r]), e;
|
|
22
22
|
};
|
|
23
|
-
function
|
|
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
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 = H(r), l = H(s),
|
|
34
|
-
(
|
|
32
|
+
), i = H(r), l = H(s), f = le(
|
|
33
|
+
(d) => {
|
|
35
34
|
const c = i.current, F = (typeof c == "function" ? c : () => c)().pipe(
|
|
36
35
|
/**
|
|
37
36
|
* @important
|
|
@@ -39,13 +38,12 @@ function Ye(r, e, t) {
|
|
|
39
38
|
* be using objects and keeping same reference but pushing new
|
|
40
39
|
* properties values
|
|
41
40
|
*/
|
|
42
|
-
Q(
|
|
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
|
};
|
|
@@ -53,7 +51,7 @@ function Ye(r, e, t) {
|
|
|
53
51
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
54
52
|
[...n]
|
|
55
53
|
), h = le(() => u.current, []);
|
|
56
|
-
return Jt(
|
|
54
|
+
return Jt(f, h, h);
|
|
57
55
|
}
|
|
58
56
|
function gt(r) {
|
|
59
57
|
return r instanceof Promise || r && typeof r.then == "function" && typeof r.catch == "function";
|
|
@@ -101,7 +99,7 @@ const Be = (r) => {
|
|
|
101
99
|
}
|
|
102
100
|
s.current || (n.current != null && n.current(), t.current.complete(), s.current = !0);
|
|
103
101
|
}), [u, n, t]), t;
|
|
104
|
-
},
|
|
102
|
+
}, hs = () => {
|
|
105
103
|
const r = Qt(), e = H(r.current.asObservable()), t = le(
|
|
106
104
|
(s) => {
|
|
107
105
|
r.current.next(s);
|
|
@@ -124,8 +122,8 @@ const Be = (r) => {
|
|
|
124
122
|
[e.current]
|
|
125
123
|
);
|
|
126
124
|
return [t.current, s, e.current.getValue()];
|
|
127
|
-
},
|
|
128
|
-
function
|
|
125
|
+
}, yr = Symbol("SIGNAL_RESET");
|
|
126
|
+
function ds(r = {}) {
|
|
129
127
|
const e = {
|
|
130
128
|
default: r.default,
|
|
131
129
|
key: r.key
|
|
@@ -137,18 +135,18 @@ function ps(r = {}) {
|
|
|
137
135
|
s.next(l);
|
|
138
136
|
return;
|
|
139
137
|
}
|
|
140
|
-
if (i ===
|
|
138
|
+
if (i === yr) {
|
|
141
139
|
s.next(t ?? void 0);
|
|
142
140
|
return;
|
|
143
141
|
}
|
|
144
142
|
s.next(i);
|
|
145
143
|
}, u = () => s.getValue();
|
|
146
144
|
if ("get" in r) {
|
|
147
|
-
const i = (
|
|
145
|
+
const i = (f) => (f.subject.pipe(nt(1), Ge()).subscribe(() => {
|
|
148
146
|
var o;
|
|
149
147
|
const h = (o = r.get) == null ? void 0 : o.call(r, i);
|
|
150
148
|
n(h);
|
|
151
|
-
}),
|
|
149
|
+
}), f.getValue()), l = r.get(i);
|
|
152
150
|
return n(l), {
|
|
153
151
|
getValue: u,
|
|
154
152
|
config: r,
|
|
@@ -162,7 +160,7 @@ function ps(r = {}) {
|
|
|
162
160
|
subject: s
|
|
163
161
|
};
|
|
164
162
|
}
|
|
165
|
-
function
|
|
163
|
+
function ps(r, e) {
|
|
166
164
|
const s = e ?? (() => r.getValue());
|
|
167
165
|
return Ye(
|
|
168
166
|
() => r.subject.pipe(
|
|
@@ -175,7 +173,7 @@ function bs(r, e) {
|
|
|
175
173
|
[]
|
|
176
174
|
);
|
|
177
175
|
}
|
|
178
|
-
const
|
|
176
|
+
const bs = (r) => ({
|
|
179
177
|
getItem: async (e) => {
|
|
180
178
|
const t = await r.getItem(e);
|
|
181
179
|
if (t)
|
|
@@ -191,7 +189,7 @@ const ys = (r) => ({
|
|
|
191
189
|
}), et = (r) => {
|
|
192
190
|
if (!(!r || typeof r != "object"))
|
|
193
191
|
return r;
|
|
194
|
-
},
|
|
192
|
+
}, gr = ({
|
|
195
193
|
adapter: r,
|
|
196
194
|
key: e
|
|
197
195
|
}) => ({
|
|
@@ -209,10 +207,10 @@ const ys = (r) => ({
|
|
|
209
207
|
const n = await r.getItem(e), u = et(n) ?? {};
|
|
210
208
|
await r.setItem(e, { ...u, [t]: s });
|
|
211
209
|
}
|
|
212
|
-
}),
|
|
210
|
+
}), mr = ({
|
|
213
211
|
key: r
|
|
214
|
-
} = {}) => r ?
|
|
215
|
-
adapter:
|
|
212
|
+
} = {}) => r ? gr({
|
|
213
|
+
adapter: mr(),
|
|
216
214
|
key: r
|
|
217
215
|
}) : {
|
|
218
216
|
clear: async () => {
|
|
@@ -229,7 +227,7 @@ const ys = (r) => ({
|
|
|
229
227
|
setItem: async (e, t) => {
|
|
230
228
|
localStorage.setItem(e, JSON.stringify(t));
|
|
231
229
|
}
|
|
232
|
-
}, ve = "__reactjrx",
|
|
230
|
+
}, ve = "__reactjrx", Sr = (r) => {
|
|
233
231
|
if (typeof r == "object" && r !== null && ve in r && r[ve] === ve)
|
|
234
232
|
return r;
|
|
235
233
|
};
|
|
@@ -254,38 +252,38 @@ const mt = (r) => {
|
|
|
254
252
|
return ge(r.setItem(e.config.key, n)).pipe(
|
|
255
253
|
B((u) => (console.error(u), S(null)))
|
|
256
254
|
);
|
|
257
|
-
},
|
|
255
|
+
}, vr = ({
|
|
258
256
|
adapter: r,
|
|
259
257
|
version: e,
|
|
260
258
|
signal: t
|
|
261
259
|
}) => ge(r.getItem(t.config.key)).pipe(
|
|
262
260
|
x((s) => {
|
|
263
|
-
const n =
|
|
261
|
+
const n = Sr(s);
|
|
264
262
|
return n ? n.migrationVersion !== void 0 && e > n.migrationVersion ? S(s) : (t.setValue(n.value), S(s)) : S(s);
|
|
265
263
|
})
|
|
266
|
-
),
|
|
264
|
+
), ys = ({
|
|
267
265
|
entries: r = [],
|
|
268
266
|
onReady: e,
|
|
269
267
|
adapter: t
|
|
270
268
|
}) => {
|
|
271
269
|
const s = H(r), n = H(e), u = mt(t), i = Ye(
|
|
272
270
|
() => {
|
|
273
|
-
const
|
|
271
|
+
const f = s.current;
|
|
274
272
|
return u.current.pipe(
|
|
275
273
|
x((h) => {
|
|
276
274
|
if (!h)
|
|
277
275
|
return S(!1);
|
|
278
|
-
const o =
|
|
279
|
-
...
|
|
280
|
-
({ signal:
|
|
276
|
+
const o = f.length === 0 ? S(!0) : Zt(
|
|
277
|
+
...f.map(
|
|
278
|
+
({ signal: d, version: c }) => vr({
|
|
281
279
|
adapter: h,
|
|
282
|
-
signal:
|
|
280
|
+
signal: d,
|
|
283
281
|
version: c
|
|
284
282
|
}).pipe(
|
|
285
283
|
T(
|
|
286
284
|
() => St({
|
|
287
285
|
adapter: h,
|
|
288
|
-
signal:
|
|
286
|
+
signal: d,
|
|
289
287
|
version: c
|
|
290
288
|
})
|
|
291
289
|
)
|
|
@@ -296,7 +294,7 @@ const mt = (r) => {
|
|
|
296
294
|
E(() => {
|
|
297
295
|
n.current != null && n.current();
|
|
298
296
|
}),
|
|
299
|
-
B((
|
|
297
|
+
B((d) => (console.error("Unable to hydrate", d), Me))
|
|
300
298
|
);
|
|
301
299
|
})
|
|
302
300
|
);
|
|
@@ -306,19 +304,19 @@ const mt = (r) => {
|
|
|
306
304
|
), l = mt(i);
|
|
307
305
|
return At(
|
|
308
306
|
() => l.current.pipe(
|
|
309
|
-
O((
|
|
307
|
+
O((f) => f),
|
|
310
308
|
x(() => u.current),
|
|
311
309
|
O(tt),
|
|
312
310
|
x(
|
|
313
|
-
(
|
|
311
|
+
(f) => C(
|
|
314
312
|
...s.current.map(
|
|
315
313
|
({ signal: h, version: o }) => h.subject.pipe(
|
|
316
|
-
|
|
314
|
+
er(500, tr, {
|
|
317
315
|
trailing: !0
|
|
318
316
|
}),
|
|
319
317
|
x(() => ge(
|
|
320
318
|
St({
|
|
321
|
-
adapter:
|
|
319
|
+
adapter: f,
|
|
322
320
|
signal: h,
|
|
323
321
|
version: o
|
|
324
322
|
})
|
|
@@ -330,7 +328,7 @@ const mt = (r) => {
|
|
|
330
328
|
),
|
|
331
329
|
[l, u]
|
|
332
330
|
), { isHydrated: i };
|
|
333
|
-
},
|
|
331
|
+
}, gs = () => {
|
|
334
332
|
const r = Qt({
|
|
335
333
|
onBeforeComplete: () => {
|
|
336
334
|
r.current.next();
|
|
@@ -338,10 +336,10 @@ const mt = (r) => {
|
|
|
338
336
|
});
|
|
339
337
|
return r;
|
|
340
338
|
};
|
|
341
|
-
function
|
|
339
|
+
function Or(r, e) {
|
|
342
340
|
return Math.min(r, e);
|
|
343
341
|
}
|
|
344
|
-
function
|
|
342
|
+
function $r(r, e) {
|
|
345
343
|
return Math.pow(2, r) * e;
|
|
346
344
|
}
|
|
347
345
|
function It(r) {
|
|
@@ -353,14 +351,14 @@ function It(r) {
|
|
|
353
351
|
} = r, u = typeof e != "function" ? e === !1 ? 0 : e === !0 ? 1 / 0 : e ?? 1 / 0 : 1 / 0, i = typeof e == "function" ? (
|
|
354
352
|
// ? (attempt: number, error: TError) => of(retry(attempt, error))
|
|
355
353
|
e
|
|
356
|
-
) : () => !0, l = typeof t == "number" ? t : 100,
|
|
354
|
+
) : () => !0, l = typeof t == "number" ? t : 100, f = {
|
|
357
355
|
shouldRetry: i,
|
|
358
356
|
...r
|
|
359
357
|
}, {
|
|
360
358
|
maxInterval: h = 1 / 0,
|
|
361
359
|
resetOnSuccess: o = !1,
|
|
362
|
-
backoffDelay:
|
|
363
|
-
} =
|
|
360
|
+
backoffDelay: d = $r
|
|
361
|
+
} = f;
|
|
364
362
|
return (c) => Ae(() => {
|
|
365
363
|
let y = 0;
|
|
366
364
|
const F = (p, v) => p < u ? i(p, v) : !1;
|
|
@@ -381,15 +379,15 @@ function It(r) {
|
|
|
381
379
|
)
|
|
382
380
|
);
|
|
383
381
|
}),
|
|
384
|
-
|
|
385
|
-
|
|
382
|
+
lr((p) => p.pipe(
|
|
383
|
+
hr((v) => {
|
|
386
384
|
const $ = y - 1;
|
|
387
385
|
return n().pipe(
|
|
388
386
|
fr(),
|
|
389
387
|
Ze(
|
|
390
388
|
() => F($, v) ? Qe(
|
|
391
|
-
|
|
392
|
-
|
|
389
|
+
Or(
|
|
390
|
+
d($, l),
|
|
393
391
|
h
|
|
394
392
|
)
|
|
395
393
|
).pipe(
|
|
@@ -452,7 +450,7 @@ function V(r, e) {
|
|
|
452
450
|
function ct(r) {
|
|
453
451
|
let e = 0;
|
|
454
452
|
return function(s) {
|
|
455
|
-
return new
|
|
453
|
+
return new rr((n) => {
|
|
456
454
|
e++;
|
|
457
455
|
const u = s.subscribe(n);
|
|
458
456
|
return r(e), () => {
|
|
@@ -468,7 +466,7 @@ const $e = (r) => r.pipe(
|
|
|
468
466
|
)
|
|
469
467
|
);
|
|
470
468
|
var ee;
|
|
471
|
-
class
|
|
469
|
+
class wr {
|
|
472
470
|
constructor({
|
|
473
471
|
__queryFinalizeHook: e
|
|
474
472
|
} = {}) {
|
|
@@ -478,15 +476,15 @@ class Cr {
|
|
|
478
476
|
O((n) => n === 0)
|
|
479
477
|
);
|
|
480
478
|
this.state$ = a(this, ee).pipe(
|
|
481
|
-
|
|
482
|
-
const l = i.mapOperator ?? "merge",
|
|
479
|
+
sr(({ args: n, mutation: u, options: i }) => {
|
|
480
|
+
const l = i.mapOperator ?? "merge", f = a(this, ee).pipe(
|
|
483
481
|
O(() => l === "merge")
|
|
484
482
|
), h = a(this, ee).pipe(
|
|
485
483
|
O(() => l === "switch"),
|
|
486
484
|
E(() => {
|
|
487
485
|
u.cancel();
|
|
488
486
|
})
|
|
489
|
-
), o = Ae(() => (u.execute(n), Me)),
|
|
487
|
+
), o = Ae(() => (u.execute(n), Me)), d = u.state$.pipe(
|
|
490
488
|
$e,
|
|
491
489
|
Ke(),
|
|
492
490
|
T(() => u.state$),
|
|
@@ -496,13 +494,13 @@ class Cr {
|
|
|
496
494
|
nt(1)
|
|
497
495
|
), y = C(
|
|
498
496
|
s,
|
|
499
|
-
|
|
497
|
+
f,
|
|
500
498
|
h,
|
|
501
499
|
u.cancelled$
|
|
502
500
|
);
|
|
503
501
|
return C(
|
|
504
502
|
c,
|
|
505
|
-
|
|
503
|
+
d,
|
|
506
504
|
/**
|
|
507
505
|
* We defer execution so that we return at least
|
|
508
506
|
* the current state first (same mechanism is used for query)
|
|
@@ -548,11 +546,11 @@ function Xe(r, e) {
|
|
|
548
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;
|
|
549
547
|
}
|
|
550
548
|
const qe = (r, e, { exact: t = !1 } = {}) => t ? me(r) === me(e) : Xe(r, e);
|
|
551
|
-
var ie,
|
|
552
|
-
class
|
|
549
|
+
var ie, _;
|
|
550
|
+
class Cr {
|
|
553
551
|
constructor(e, t = {}, s) {
|
|
554
552
|
w(this, ie, void 0);
|
|
555
|
-
w(this,
|
|
553
|
+
w(this, _, new J(void 0));
|
|
556
554
|
/**
|
|
557
555
|
* @important
|
|
558
556
|
* Used to maintain persistance to latest mutation. This ensure
|
|
@@ -573,7 +571,7 @@ class Fr {
|
|
|
573
571
|
reset: this.reset
|
|
574
572
|
}));
|
|
575
573
|
var n;
|
|
576
|
-
this.client = e, this.options = t, this.options.mutationKey = ((n = this.options) == null ? void 0 : n.mutationKey) ?? [at()], M(this, ie, s ?? new
|
|
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(
|
|
577
575
|
O(tt),
|
|
578
576
|
T(
|
|
579
577
|
(u) => a(this, ie).state$.pipe(
|
|
@@ -582,7 +580,7 @@ class Fr {
|
|
|
582
580
|
)
|
|
583
581
|
)
|
|
584
582
|
)
|
|
585
|
-
).subscribe(), this.observed$ = a(this,
|
|
583
|
+
).subscribe(), this.observed$ = a(this, _).pipe(
|
|
586
584
|
x((u) => (u == null ? void 0 : u.mutation.state$.pipe(
|
|
587
585
|
// last(),
|
|
588
586
|
g((i) => ({
|
|
@@ -621,7 +619,7 @@ class Fr {
|
|
|
621
619
|
mutationKey: this.options.mutationKey,
|
|
622
620
|
...e
|
|
623
621
|
});
|
|
624
|
-
const s = (n = a(this,
|
|
622
|
+
const s = (n = a(this, _).getValue()) == null ? void 0 : n.mutation;
|
|
625
623
|
this.options.mutationKey && t.mutationKey && !qe(this.options.mutationKey, t.mutationKey, {
|
|
626
624
|
exact: !0
|
|
627
625
|
}) ? this.reset() : s == null || s.setOptions(this.options);
|
|
@@ -629,10 +627,10 @@ class Fr {
|
|
|
629
627
|
observe() {
|
|
630
628
|
var u;
|
|
631
629
|
const e = this.getObserverResultFromState(
|
|
632
|
-
((u = a(this,
|
|
630
|
+
((u = a(this, _).getValue()) == null ? void 0 : u.mutation.state) ?? ne()
|
|
633
631
|
), t = a(this, ie).state$.pipe(
|
|
634
632
|
g((i) => this.getObserverResultFromState(i))
|
|
635
|
-
), s = a(this,
|
|
633
|
+
), s = a(this, _).pipe(
|
|
636
634
|
O(tt),
|
|
637
635
|
x((i) => i.mutation.cancelled$),
|
|
638
636
|
g(() => this.getObserverResultFromState(ne()))
|
|
@@ -657,7 +655,7 @@ class Fr {
|
|
|
657
655
|
}
|
|
658
656
|
async mutate(e, t = {}) {
|
|
659
657
|
const s = this.client.getMutationCache().build(this.client, this.options);
|
|
660
|
-
return a(this,
|
|
658
|
+
return a(this, _).next({ mutation: s, options: t }), a(this, ie).trigger({
|
|
661
659
|
args: e,
|
|
662
660
|
options: this.options,
|
|
663
661
|
mutation: s
|
|
@@ -680,18 +678,18 @@ class Fr {
|
|
|
680
678
|
);
|
|
681
679
|
}
|
|
682
680
|
reset() {
|
|
683
|
-
const { mutation: e } = a(this,
|
|
684
|
-
a(this,
|
|
681
|
+
const { mutation: e } = a(this, _).getValue() ?? {};
|
|
682
|
+
a(this, _).next(void 0), e == null || e.cancel();
|
|
685
683
|
}
|
|
686
684
|
}
|
|
687
|
-
ie = new WeakMap(),
|
|
688
|
-
const Vt = Yt(void 0),
|
|
685
|
+
ie = new WeakMap(), _ = new WeakMap();
|
|
686
|
+
const Vt = Yt(void 0), Fr = ({ client: r }) => (X(() => (r.mount(), () => {
|
|
689
687
|
r.unmount();
|
|
690
|
-
}), [r]), null),
|
|
688
|
+
}), [r]), null), ms = Bt(
|
|
691
689
|
({ children: r, client: e }) => {
|
|
692
690
|
const t = st(() => e, [e]);
|
|
693
|
-
return /* @__PURE__ */
|
|
694
|
-
/* @__PURE__ */
|
|
691
|
+
return /* @__PURE__ */ dr(Vt.Provider, { value: t, children: [
|
|
692
|
+
/* @__PURE__ */ pr(Fr, { client: e }),
|
|
695
693
|
r
|
|
696
694
|
] });
|
|
697
695
|
}
|
|
@@ -703,11 +701,11 @@ const Vt = Yt(void 0), Er = ({ client: r }) => (X(() => (r.mount(), () => {
|
|
|
703
701
|
throw new Error("No QueryClient set, use QueryClientProvider to set one");
|
|
704
702
|
return e;
|
|
705
703
|
};
|
|
706
|
-
function
|
|
704
|
+
function Er() {
|
|
707
705
|
}
|
|
708
|
-
function
|
|
706
|
+
function Ss(r, e) {
|
|
709
707
|
const t = Pt(e), s = H(r), n = Be(() => [at()]), u = me(r.mutationKey ?? n.current), [i] = xt(
|
|
710
|
-
() => new
|
|
708
|
+
() => new Cr(
|
|
711
709
|
t,
|
|
712
710
|
r
|
|
713
711
|
)
|
|
@@ -715,24 +713,24 @@ function vs(r, e) {
|
|
|
715
713
|
X(() => {
|
|
716
714
|
i.setOptions(r);
|
|
717
715
|
}, [i, r]);
|
|
718
|
-
const l = st(() => i.observe(), [u, i]),
|
|
719
|
-
(o,
|
|
720
|
-
i.mutate(o,
|
|
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);
|
|
721
719
|
},
|
|
722
720
|
[i]
|
|
723
721
|
);
|
|
724
722
|
return X(() => () => {
|
|
725
723
|
s.current.cancelOnUnMount && i.reset();
|
|
726
|
-
}, [i, s]), { ...
|
|
724
|
+
}, [i, s]), { ...f, mutate: h, mutateAsync: f.mutate };
|
|
727
725
|
}
|
|
728
|
-
function
|
|
726
|
+
function xr(r) {
|
|
729
727
|
return (e) => e.pipe(
|
|
730
728
|
Mt((t) => {
|
|
731
729
|
r.next(t);
|
|
732
730
|
})
|
|
733
731
|
);
|
|
734
732
|
}
|
|
735
|
-
class
|
|
733
|
+
class Rr {
|
|
736
734
|
constructor() {
|
|
737
735
|
b(this, "isOnlineSubject", new J(!0));
|
|
738
736
|
b(this, "online$", this.isOnlineSubject.pipe(Q()));
|
|
@@ -743,7 +741,7 @@ class jr {
|
|
|
743
741
|
C(
|
|
744
742
|
Ne(window, "offline").pipe(g(() => !1)),
|
|
745
743
|
Ne(window, "online").pipe(g(() => !0))
|
|
746
|
-
).pipe(
|
|
744
|
+
).pipe(xr(this.isOnlineSubject)).subscribe();
|
|
747
745
|
}
|
|
748
746
|
isOnline() {
|
|
749
747
|
return this.isOnlineSubject.getValue();
|
|
@@ -752,20 +750,20 @@ class jr {
|
|
|
752
750
|
this.isOnlineSubject.getValue() !== e && this.isOnlineSubject.next(e);
|
|
753
751
|
}
|
|
754
752
|
}
|
|
755
|
-
const se = new
|
|
753
|
+
const se = new Rr();
|
|
756
754
|
function ot(r, e) {
|
|
757
755
|
return r.isStaleByTime(e.staleTime);
|
|
758
756
|
}
|
|
759
|
-
function
|
|
757
|
+
function jr(r, e) {
|
|
760
758
|
return e.enabled !== !1 && !r.state.dataUpdatedAt && !(r.state.status === "error" && e.retryOnMount === !1) && r.state.fetchStatus !== "fetching";
|
|
761
759
|
}
|
|
762
760
|
function Ot(r, e) {
|
|
763
|
-
return
|
|
761
|
+
return jr(r, e) || r.state.dataUpdatedAt > 0 && Dt(r, e, e.refetchOnMount);
|
|
764
762
|
}
|
|
765
763
|
function $t(r, e, t, s) {
|
|
766
764
|
return r.state.fetchStatus !== "fetching" && t.enabled !== !1 && (r !== e || s.enabled === !1) && (!t.suspense || r.state.status !== "error") && ot(r, t);
|
|
767
765
|
}
|
|
768
|
-
function
|
|
766
|
+
function Mr(r, e) {
|
|
769
767
|
return Dt(r, e, e.refetchOnWindowFocus);
|
|
770
768
|
}
|
|
771
769
|
function Dt(r, e, t) {
|
|
@@ -775,7 +773,7 @@ function Dt(r, e, t) {
|
|
|
775
773
|
}
|
|
776
774
|
return !1;
|
|
777
775
|
}
|
|
778
|
-
function
|
|
776
|
+
function Ar(r) {
|
|
779
777
|
return (r ?? "online") === "online" ? se.isOnline() : !0;
|
|
780
778
|
}
|
|
781
779
|
function wt(r, e) {
|
|
@@ -793,12 +791,12 @@ function Tt(r, e) {
|
|
|
793
791
|
const t = Ct(r) && Ct(e);
|
|
794
792
|
if (t || rt(r) && rt(e)) {
|
|
795
793
|
const s = t ? r : Object.keys(r), n = s.length, u = t ? e : Object.keys(e), i = u.length, l = t ? [] : {};
|
|
796
|
-
let
|
|
794
|
+
let f = 0;
|
|
797
795
|
for (let h = 0; h < i; h++) {
|
|
798
796
|
const o = t ? h : u[h];
|
|
799
|
-
!t && r[o] === void 0 && e[o] === void 0 && s.includes(o) ? (l[o] = void 0,
|
|
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++);
|
|
800
798
|
}
|
|
801
|
-
return n === i &&
|
|
799
|
+
return n === i && f === n ? r : l;
|
|
802
800
|
}
|
|
803
801
|
return e;
|
|
804
802
|
}
|
|
@@ -822,22 +820,22 @@ function Ft(r, e) {
|
|
|
822
820
|
return !1;
|
|
823
821
|
}
|
|
824
822
|
if (t !== "all") {
|
|
825
|
-
const
|
|
826
|
-
if (t === "active" && !
|
|
823
|
+
const f = e.isActive();
|
|
824
|
+
if (t === "active" && !f || t === "inactive" && f)
|
|
827
825
|
return !1;
|
|
828
826
|
}
|
|
829
827
|
return !(typeof l == "boolean" && e.isStale() !== l || typeof n < "u" && n !== e.state.fetchStatus || u && !u(e));
|
|
830
828
|
}
|
|
831
|
-
function
|
|
829
|
+
function Qr(r, e) {
|
|
832
830
|
return Math.max(r + (e ?? 0) - Date.now(), 0);
|
|
833
831
|
}
|
|
834
|
-
function
|
|
832
|
+
function Ur(r, e) {
|
|
835
833
|
return typeof r == "function" ? r(e) : r;
|
|
836
834
|
}
|
|
837
|
-
function
|
|
835
|
+
function Le(r, e, t) {
|
|
838
836
|
return typeof t.structuralSharing == "function" ? t.structuralSharing(r, e) : t.structuralSharing !== !1 ? Tt(r, e) : e;
|
|
839
837
|
}
|
|
840
|
-
const
|
|
838
|
+
const Ir = ({
|
|
841
839
|
getOptions: r,
|
|
842
840
|
getState: e,
|
|
843
841
|
initialState: t
|
|
@@ -849,8 +847,8 @@ const Vr = ({
|
|
|
849
847
|
const j = n.status === "pending" ? "pending" : i.status ?? n.status;
|
|
850
848
|
return { ...n, ...i, status: j };
|
|
851
849
|
}
|
|
852
|
-
const l = i.data,
|
|
853
|
-
(
|
|
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;
|
|
854
852
|
return {
|
|
855
853
|
...n,
|
|
856
854
|
...i,
|
|
@@ -867,17 +865,17 @@ const Vr = ({
|
|
|
867
865
|
}
|
|
868
866
|
};
|
|
869
867
|
}, t)
|
|
870
|
-
),
|
|
868
|
+
), Vr = (r) => r.pipe(
|
|
871
869
|
g(
|
|
872
870
|
({ status: e, fetchStatus: t }) => t === "idle" && (e === "success" || e === "error")
|
|
873
871
|
)
|
|
874
872
|
), kt = (r) => r.pipe(
|
|
875
873
|
Je((e) => e.fetchStatus !== "idle", !0)
|
|
876
874
|
);
|
|
877
|
-
var
|
|
878
|
-
class
|
|
875
|
+
var ze, te;
|
|
876
|
+
class Pr {
|
|
879
877
|
constructor() {
|
|
880
|
-
w(this,
|
|
878
|
+
w(this, ze, C(
|
|
881
879
|
Ne(document, "visibilitychange"),
|
|
882
880
|
Ne(window, "visibilitychange")
|
|
883
881
|
).pipe(g(() => document.visibilityState)));
|
|
@@ -890,7 +888,7 @@ class Dr {
|
|
|
890
888
|
nt(1),
|
|
891
889
|
O((e) => e)
|
|
892
890
|
));
|
|
893
|
-
a(this,
|
|
891
|
+
a(this, ze).pipe(
|
|
894
892
|
E((e) => {
|
|
895
893
|
a(this, te).next(e === "visible");
|
|
896
894
|
})
|
|
@@ -919,8 +917,8 @@ class Dr {
|
|
|
919
917
|
document.dispatchEvent(new Event("visibilitychange"));
|
|
920
918
|
}
|
|
921
919
|
}
|
|
922
|
-
|
|
923
|
-
const
|
|
920
|
+
ze = new WeakMap(), te = new WeakMap();
|
|
921
|
+
const _e = new Pr(), Dr = (r) => r.pipe(
|
|
924
922
|
O((e) => e.status === "success"),
|
|
925
923
|
g((e) => ({
|
|
926
924
|
data: e.data,
|
|
@@ -929,7 +927,7 @@ const Le = new Dr(), Tr = (r) => r.pipe(
|
|
|
929
927
|
})),
|
|
930
928
|
Q(V)
|
|
931
929
|
);
|
|
932
|
-
var Y, R, we, ue, D,
|
|
930
|
+
var Y, R, we, ue, D, de, Ce;
|
|
933
931
|
class Kt {
|
|
934
932
|
constructor(e, t) {
|
|
935
933
|
w(this, Y, void 0);
|
|
@@ -952,7 +950,7 @@ class Kt {
|
|
|
952
950
|
w(this, D, void 0);
|
|
953
951
|
// This property keeps track of the last query with defined data.
|
|
954
952
|
// It will be used to pass the previous data and query to the placeholder function between renders.
|
|
955
|
-
w(this,
|
|
953
|
+
w(this, de, void 0);
|
|
956
954
|
w(this, Ce, 0);
|
|
957
955
|
b(this, "getObserverResultFromQuery", ({
|
|
958
956
|
options: e,
|
|
@@ -963,47 +961,47 @@ class Kt {
|
|
|
963
961
|
options: u,
|
|
964
962
|
state: i,
|
|
965
963
|
select: l,
|
|
966
|
-
selectError:
|
|
964
|
+
selectError: f,
|
|
967
965
|
selectResult: h
|
|
968
966
|
}
|
|
969
967
|
}) => {
|
|
970
968
|
var De;
|
|
971
|
-
const o = t.state,
|
|
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);
|
|
972
970
|
let { errorUpdatedAt: v, fetchStatus: $, error: q } = o;
|
|
973
971
|
if (s) {
|
|
974
|
-
const k = !!a(this, Ce),
|
|
975
|
-
(
|
|
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");
|
|
976
974
|
}
|
|
977
|
-
const P =
|
|
978
|
-
let j, m =
|
|
975
|
+
const P = d && $ === "fetching";
|
|
976
|
+
let j, m = f, z = l ?? null, W = h;
|
|
979
977
|
if (e.select && typeof o.data < "u")
|
|
980
978
|
if (n && o.data === (i == null ? void 0 : i.data) && e.select === l)
|
|
981
979
|
j = h;
|
|
982
980
|
else
|
|
983
981
|
try {
|
|
984
|
-
|
|
982
|
+
z = e.select, j = e.select(o.data), j = Le(n == null ? void 0 : n.data, j, e), W = j, m = null;
|
|
985
983
|
} catch (k) {
|
|
986
984
|
j = h, m = k;
|
|
987
985
|
}
|
|
988
986
|
else
|
|
989
987
|
j = o.data, m = null;
|
|
990
|
-
let
|
|
991
|
-
m && (q = m, j = h, v = (n == null ? void 0 : n.errorUpdatedAt) ?? v,
|
|
992
|
-
const Ie =
|
|
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";
|
|
993
991
|
let Ve = !1;
|
|
994
|
-
if (typeof e.placeholderData < "u" && typeof j > "u" &&
|
|
992
|
+
if (typeof e.placeholderData < "u" && typeof j > "u" && L === "pending") {
|
|
995
993
|
let k;
|
|
996
994
|
if (n != null && n.isPlaceholderData && e.placeholderData === (u == null ? void 0 : u.placeholderData))
|
|
997
995
|
k = n.data;
|
|
998
996
|
else if (k = typeof e.placeholderData == "function" ? e.placeholderData(
|
|
999
|
-
(De = a(this,
|
|
1000
|
-
a(this,
|
|
997
|
+
(De = a(this, de)) == null ? void 0 : De.state.data,
|
|
998
|
+
a(this, de)
|
|
1001
999
|
) : e.placeholderData, e.select && typeof k < "u")
|
|
1002
1000
|
try {
|
|
1003
1001
|
k = e.select(k);
|
|
1004
1002
|
} catch {
|
|
1005
1003
|
}
|
|
1006
|
-
typeof k < "u" && (
|
|
1004
|
+
typeof k < "u" && (L = "success", j = Le(
|
|
1007
1005
|
n == null ? void 0 : n.data,
|
|
1008
1006
|
k,
|
|
1009
1007
|
e
|
|
@@ -1012,10 +1010,10 @@ class Kt {
|
|
|
1012
1010
|
const Pe = $ === "fetching";
|
|
1013
1011
|
return {
|
|
1014
1012
|
result: {
|
|
1015
|
-
status:
|
|
1013
|
+
status: L,
|
|
1016
1014
|
fetchStatus: $,
|
|
1017
|
-
isPending:
|
|
1018
|
-
isSuccess:
|
|
1015
|
+
isPending: d,
|
|
1016
|
+
isSuccess: L === "success",
|
|
1019
1017
|
isError: Ie,
|
|
1020
1018
|
isInitialLoading: P,
|
|
1021
1019
|
isLoading: P,
|
|
@@ -1029,7 +1027,7 @@ class Kt {
|
|
|
1029
1027
|
isFetched: o.dataUpdateCount > 0 || o.errorUpdateCount > 0,
|
|
1030
1028
|
isFetchedAfterMount: o.dataUpdateCount > p.dataUpdateCount || o.errorUpdateCount > p.errorUpdateCount,
|
|
1031
1029
|
isFetching: Pe,
|
|
1032
|
-
isRefetching: Pe && !
|
|
1030
|
+
isRefetching: Pe && !d,
|
|
1033
1031
|
isLoadingError: Ie && o.dataUpdatedAt === 0,
|
|
1034
1032
|
isPaused: $ === "paused",
|
|
1035
1033
|
isPlaceholderData: Ve,
|
|
@@ -1039,7 +1037,7 @@ class Kt {
|
|
|
1039
1037
|
refetch: this.refetch
|
|
1040
1038
|
},
|
|
1041
1039
|
selectError: m,
|
|
1042
|
-
select:
|
|
1040
|
+
select: z,
|
|
1043
1041
|
selectResult: W
|
|
1044
1042
|
};
|
|
1045
1043
|
});
|
|
@@ -1099,7 +1097,7 @@ class Kt {
|
|
|
1099
1097
|
optimisticResult: !0,
|
|
1100
1098
|
prevResult: a(this, D)
|
|
1101
1099
|
});
|
|
1102
|
-
return
|
|
1100
|
+
return Tr(this, s.result) && this.updateResult({ query: t, ...s }), s.result;
|
|
1103
1101
|
}
|
|
1104
1102
|
updateResult({
|
|
1105
1103
|
query: e,
|
|
@@ -1108,7 +1106,7 @@ class Kt {
|
|
|
1108
1106
|
select: n,
|
|
1109
1107
|
selectResult: u
|
|
1110
1108
|
}) {
|
|
1111
|
-
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,
|
|
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({
|
|
1112
1110
|
query: a(this, R),
|
|
1113
1111
|
type: "observerResultsUpdated"
|
|
1114
1112
|
});
|
|
@@ -1160,8 +1158,8 @@ class Kt {
|
|
|
1160
1158
|
}),
|
|
1161
1159
|
jt(),
|
|
1162
1160
|
E(
|
|
1163
|
-
([{ options: i, query: l }, { options:
|
|
1164
|
-
$t(h, l,
|
|
1161
|
+
([{ options: i, query: l }, { options: f, query: h }]) => {
|
|
1162
|
+
$t(h, l, f, i) && this.fetch().catch(N);
|
|
1165
1163
|
}
|
|
1166
1164
|
),
|
|
1167
1165
|
he()
|
|
@@ -1178,7 +1176,7 @@ class Kt {
|
|
|
1178
1176
|
s,
|
|
1179
1177
|
t.pipe(
|
|
1180
1178
|
x((i) => {
|
|
1181
|
-
const l = this.options,
|
|
1179
|
+
const l = this.options, f = this.queryUpdateSubject.pipe(
|
|
1182
1180
|
oe({ query: i, options: l }),
|
|
1183
1181
|
O((m) => m.query === i),
|
|
1184
1182
|
g((m) => m.options),
|
|
@@ -1187,40 +1185,40 @@ class Kt {
|
|
|
1187
1185
|
), h = a(this, we).pipe(
|
|
1188
1186
|
O((m) => m.query === i)
|
|
1189
1187
|
), o = i.state$.pipe(
|
|
1190
|
-
|
|
1188
|
+
Dr,
|
|
1191
1189
|
x(
|
|
1192
1190
|
(m) => this.options.staleTime === 1 / 0 ? Oe : (this.options.staleTime ?? 0) <= 0 ? S(m).pipe(ut(1)) : Qe(this.options.staleTime ?? 1)
|
|
1193
1191
|
),
|
|
1194
1192
|
Je(() => this.options.enabled ?? !0)
|
|
1195
|
-
),
|
|
1196
|
-
const W = l.notifyOnChangeProps,
|
|
1197
|
-
return (Array.isArray(
|
|
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) => {
|
|
1198
1196
|
const ht = wt(
|
|
1199
1197
|
Ve,
|
|
1200
|
-
|
|
1198
|
+
L
|
|
1201
1199
|
), De = wt(
|
|
1202
1200
|
Pe,
|
|
1203
|
-
|
|
1201
|
+
L
|
|
1204
1202
|
);
|
|
1205
1203
|
return V(ht, De);
|
|
1206
|
-
} : V)(m,
|
|
1204
|
+
} : V)(m, z);
|
|
1207
1205
|
}, c = h.pipe(
|
|
1208
1206
|
x(() => i.state$),
|
|
1209
1207
|
kt
|
|
1210
|
-
), y =
|
|
1211
|
-
g(({ refetchInterval: m, refetchIntervalInBackground:
|
|
1208
|
+
), y = f.pipe(
|
|
1209
|
+
g(({ refetchInterval: m, refetchIntervalInBackground: z }) => ({
|
|
1212
1210
|
refetchInterval: (typeof m == "function" ? m(a(this, R)) : m) ?? !1,
|
|
1213
|
-
refetchIntervalInBackground:
|
|
1211
|
+
refetchIntervalInBackground: z
|
|
1214
1212
|
})),
|
|
1215
1213
|
Q(V),
|
|
1216
|
-
x(({ refetchInterval: m, refetchIntervalInBackground:
|
|
1214
|
+
x(({ refetchInterval: m, refetchIntervalInBackground: z }) => m ? nr(m).pipe(
|
|
1217
1215
|
E(() => {
|
|
1218
1216
|
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
|
1219
|
-
(
|
|
1217
|
+
(z || _e.isFocused()) && this.fetch({ cancelRefetch: !1 }).catch(N);
|
|
1220
1218
|
})
|
|
1221
1219
|
) : Oe),
|
|
1222
1220
|
he()
|
|
1223
|
-
), F =
|
|
1221
|
+
), F = f.pipe(
|
|
1224
1222
|
g(({ enabled: m }) => m ?? !0),
|
|
1225
1223
|
Q()
|
|
1226
1224
|
), p = F.pipe(
|
|
@@ -1228,20 +1226,20 @@ class Kt {
|
|
|
1228
1226
|
g(() => i.state)
|
|
1229
1227
|
), v = F.pipe(
|
|
1230
1228
|
O((m) => m),
|
|
1231
|
-
x(() =>
|
|
1232
|
-
bt(
|
|
1229
|
+
x(() => _e.focusRegained$),
|
|
1230
|
+
bt(f),
|
|
1233
1231
|
E(([, m]) => {
|
|
1234
|
-
|
|
1232
|
+
Mr(i, m) && this.fetch({ cancelRefetch: !1 }).catch(N);
|
|
1235
1233
|
}),
|
|
1236
1234
|
he()
|
|
1237
1235
|
), $ = p.pipe(
|
|
1238
1236
|
g(() => i.state)
|
|
1239
1237
|
), q = (m) => m.pipe(
|
|
1240
|
-
bt(
|
|
1241
|
-
g(([,
|
|
1238
|
+
bt(f),
|
|
1239
|
+
g(([, z]) => {
|
|
1242
1240
|
const W = this.getObserverResultFromQuery({
|
|
1243
1241
|
query: i,
|
|
1244
|
-
options:
|
|
1242
|
+
options: z,
|
|
1245
1243
|
prevResult: a(this, D)
|
|
1246
1244
|
});
|
|
1247
1245
|
return this.updateResult({ query: i, ...W }), W.result;
|
|
@@ -1257,7 +1255,7 @@ class Kt {
|
|
|
1257
1255
|
// This one ensure we don't re-trigger same state
|
|
1258
1256
|
Q(V),
|
|
1259
1257
|
// This one make sure we dispatch based on user preference
|
|
1260
|
-
Q(
|
|
1258
|
+
Q(d)
|
|
1261
1259
|
);
|
|
1262
1260
|
return C(y, v, j);
|
|
1263
1261
|
})
|
|
@@ -1274,13 +1272,13 @@ class Kt {
|
|
|
1274
1272
|
destroy() {
|
|
1275
1273
|
}
|
|
1276
1274
|
}
|
|
1277
|
-
Y = new WeakMap(), R = new WeakMap(), we = new WeakMap(), ue = new WeakMap(), D = new WeakMap(),
|
|
1278
|
-
function
|
|
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) {
|
|
1279
1277
|
return !V(r.getCurrentResult(), e);
|
|
1280
1278
|
}
|
|
1281
|
-
const Nt = We.createContext(!1),
|
|
1279
|
+
const Nt = We.createContext(!1), kr = () => We.useContext(Nt);
|
|
1282
1280
|
Nt.Provider;
|
|
1283
|
-
function
|
|
1281
|
+
function Kr() {
|
|
1284
1282
|
let r = !1;
|
|
1285
1283
|
return {
|
|
1286
1284
|
clearReset: () => {
|
|
@@ -1292,8 +1290,8 @@ function Nr() {
|
|
|
1292
1290
|
isReset: () => r
|
|
1293
1291
|
};
|
|
1294
1292
|
}
|
|
1295
|
-
const
|
|
1296
|
-
function
|
|
1293
|
+
const Nr = We.createContext(Kr()), Hr = () => We.useContext(Nr);
|
|
1294
|
+
function qr(r, e) {
|
|
1297
1295
|
return typeof r == "function" ? r(...e) : !!r;
|
|
1298
1296
|
}
|
|
1299
1297
|
const Lr = ({
|
|
@@ -1301,24 +1299,24 @@ const Lr = ({
|
|
|
1301
1299
|
errorResetBoundary: e,
|
|
1302
1300
|
throwOnError: t,
|
|
1303
1301
|
query: s
|
|
1304
|
-
}) => r.isError && !e.isReset() && !r.isFetching && s &&
|
|
1302
|
+
}) => r.isError && !e.isReset() && !r.isFetching && s && qr(t, [r.error, s]);
|
|
1305
1303
|
function Ht(r, e, t) {
|
|
1306
1304
|
if (process.env.NODE_ENV !== "production" && (typeof r != "object" || Array.isArray(r)))
|
|
1307
1305
|
throw new Error(
|
|
1308
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'
|
|
1309
1307
|
);
|
|
1310
|
-
const s = Pt(t), n =
|
|
1308
|
+
const s = Pt(t), n = kr(), u = Hr(), i = s.defaultQueryOptions(r);
|
|
1311
1309
|
i._optimisticResults = n ? "isRestoring" : "optimistic";
|
|
1312
1310
|
const [l] = xt(
|
|
1313
1311
|
() => new e(
|
|
1314
1312
|
s,
|
|
1315
1313
|
i
|
|
1316
1314
|
)
|
|
1317
|
-
),
|
|
1315
|
+
), f = Be(() => l.observe()), h = H(
|
|
1318
1316
|
l.getOptimisticResult(i)
|
|
1319
1317
|
), o = h.current;
|
|
1320
1318
|
Ye(
|
|
1321
|
-
() =>
|
|
1319
|
+
() => f.current.pipe(
|
|
1322
1320
|
/**
|
|
1323
1321
|
* By the time this observer runs the result may have changed (eg: synchronous setData).
|
|
1324
1322
|
* It's important to not skip the first result (even tho most of the time they are equal).
|
|
@@ -1330,8 +1328,8 @@ function Ht(r, e, t) {
|
|
|
1330
1328
|
), X(() => {
|
|
1331
1329
|
l.setOptions(i);
|
|
1332
1330
|
}, [i, l]);
|
|
1333
|
-
const
|
|
1334
|
-
if (
|
|
1331
|
+
const d = o.error;
|
|
1332
|
+
if (d && Lr({
|
|
1335
1333
|
result: o,
|
|
1336
1334
|
errorResetBoundary: u,
|
|
1337
1335
|
throwOnError: i.throwOnError,
|
|
@@ -1339,13 +1337,13 @@ function Ht(r, e, t) {
|
|
|
1339
1337
|
i.queryHash
|
|
1340
1338
|
)
|
|
1341
1339
|
}))
|
|
1342
|
-
throw
|
|
1340
|
+
throw d;
|
|
1343
1341
|
return h.current;
|
|
1344
1342
|
}
|
|
1345
|
-
function
|
|
1343
|
+
function vs(r, e) {
|
|
1346
1344
|
return Ht(r, Kt, e);
|
|
1347
1345
|
}
|
|
1348
|
-
function
|
|
1346
|
+
function Os(r, e) {
|
|
1349
1347
|
return Ht(
|
|
1350
1348
|
{
|
|
1351
1349
|
refetchOnMount: "idle",
|
|
@@ -1358,17 +1356,17 @@ function $s(r, e) {
|
|
|
1358
1356
|
e
|
|
1359
1357
|
);
|
|
1360
1358
|
}
|
|
1361
|
-
function
|
|
1359
|
+
function $s(r, e, t = []) {
|
|
1362
1360
|
const s = e != null && !Array.isArray(e) ? e : {}, n = s.retry ?? !0, u = H(
|
|
1363
|
-
s.onError ?? ((
|
|
1364
|
-
console.error(
|
|
1361
|
+
s.onError ?? ((f) => {
|
|
1362
|
+
console.error(f);
|
|
1365
1363
|
})
|
|
1366
1364
|
), i = le(() => U(r), t), l = le(
|
|
1367
1365
|
() => i().pipe(
|
|
1368
|
-
B((
|
|
1369
|
-
throw u.current(
|
|
1366
|
+
B((f) => {
|
|
1367
|
+
throw u.current(f), f;
|
|
1370
1368
|
}),
|
|
1371
|
-
n ?
|
|
1369
|
+
n ? ir() : Rt
|
|
1372
1370
|
),
|
|
1373
1371
|
[i, n, u]
|
|
1374
1372
|
);
|
|
@@ -1402,12 +1400,12 @@ const qt = () => (r) => C(
|
|
|
1402
1400
|
)
|
|
1403
1401
|
) : Se(() => t)))
|
|
1404
1402
|
);
|
|
1405
|
-
},
|
|
1403
|
+
}, zr = ({
|
|
1406
1404
|
variables: r,
|
|
1407
1405
|
state: e,
|
|
1408
1406
|
options: t
|
|
1409
1407
|
}) => {
|
|
1410
|
-
const s = e.isPaused, n = async () => await Promise.reject(new Error("No mutationFn found")), u = t.mutationFn ?? n, l =
|
|
1408
|
+
const s = e.isPaused, n = async () => await Promise.reject(new Error("No mutationFn found")), u = t.mutationFn ?? n, l = ur(
|
|
1411
1409
|
() => s,
|
|
1412
1410
|
S(e.context),
|
|
1413
1411
|
U(
|
|
@@ -1417,7 +1415,7 @@ const qt = () => (r) => C(
|
|
|
1417
1415
|
return ((c = t.onMutate) == null ? void 0 : c.call(t, r)) ?? void 0;
|
|
1418
1416
|
}
|
|
1419
1417
|
)
|
|
1420
|
-
).pipe(Ue(1)),
|
|
1418
|
+
).pipe(Ue(1)), f = (c, y, F) => U(
|
|
1421
1419
|
() => {
|
|
1422
1420
|
var v;
|
|
1423
1421
|
return (v = t.onError) == null ? void 0 : v.call(t, c, r, y);
|
|
@@ -1462,7 +1460,7 @@ const qt = () => (r) => C(
|
|
|
1462
1460
|
failureReason: v
|
|
1463
1461
|
})
|
|
1464
1462
|
),
|
|
1465
|
-
catchError: (p, v) =>
|
|
1463
|
+
catchError: (p, v) => f(v, c, p).pipe(
|
|
1466
1464
|
g(($) => ({
|
|
1467
1465
|
...$,
|
|
1468
1466
|
result: void 0
|
|
@@ -1538,7 +1536,7 @@ const qt = () => (r) => C(
|
|
|
1538
1536
|
}
|
|
1539
1537
|
),
|
|
1540
1538
|
B(
|
|
1541
|
-
(P) =>
|
|
1539
|
+
(P) => f(P, F.context, 0).pipe(
|
|
1542
1540
|
g((j) => ({
|
|
1543
1541
|
...j,
|
|
1544
1542
|
data: void 0
|
|
@@ -1561,7 +1559,7 @@ const qt = () => (r) => C(
|
|
|
1561
1559
|
);
|
|
1562
1560
|
};
|
|
1563
1561
|
var Fe, re, pe;
|
|
1564
|
-
class
|
|
1562
|
+
class Wr {
|
|
1565
1563
|
constructor({
|
|
1566
1564
|
options: e,
|
|
1567
1565
|
mutationCache: t,
|
|
@@ -1578,48 +1576,48 @@ class Gr {
|
|
|
1578
1576
|
this.options = e, this.state = s ?? this.state;
|
|
1579
1577
|
const n = a(this, pe).pipe(
|
|
1580
1578
|
x(
|
|
1581
|
-
(u) =>
|
|
1579
|
+
(u) => zr({
|
|
1582
1580
|
options: {
|
|
1583
1581
|
...this.options,
|
|
1584
1582
|
onMutate: (i) => {
|
|
1585
1583
|
const l = U(
|
|
1586
1584
|
() => {
|
|
1587
|
-
var
|
|
1588
|
-
return (c = (
|
|
1589
|
-
|
|
1585
|
+
var d, c;
|
|
1586
|
+
return (c = (d = t.config).onMutate) == null ? void 0 : c.call(
|
|
1587
|
+
d,
|
|
1590
1588
|
i,
|
|
1591
1589
|
this
|
|
1592
1590
|
);
|
|
1593
1591
|
}
|
|
1594
1592
|
), h = U(() => {
|
|
1595
|
-
var
|
|
1596
|
-
return (c = (
|
|
1593
|
+
var d, c;
|
|
1594
|
+
return (c = (d = this.options).onMutate) == null ? void 0 : c.call(d, i);
|
|
1597
1595
|
});
|
|
1598
1596
|
return l.pipe(
|
|
1599
1597
|
T(() => h)
|
|
1600
1598
|
);
|
|
1601
1599
|
},
|
|
1602
|
-
onError: (i, l,
|
|
1600
|
+
onError: (i, l, f) => {
|
|
1603
1601
|
const h = U(
|
|
1604
1602
|
() => {
|
|
1605
|
-
var
|
|
1606
|
-
return (c = (
|
|
1607
|
-
|
|
1603
|
+
var d, c;
|
|
1604
|
+
return (c = (d = t.config).onError) == null ? void 0 : c.call(
|
|
1605
|
+
d,
|
|
1608
1606
|
i,
|
|
1609
1607
|
l,
|
|
1610
|
-
|
|
1608
|
+
f,
|
|
1611
1609
|
this
|
|
1612
1610
|
);
|
|
1613
1611
|
}
|
|
1614
1612
|
), o = U(
|
|
1615
1613
|
() => {
|
|
1616
|
-
var
|
|
1617
|
-
return (c = (
|
|
1614
|
+
var d, c;
|
|
1615
|
+
return (c = (d = this.options).onError) == null ? void 0 : c.call(d, i, l, f);
|
|
1618
1616
|
}
|
|
1619
1617
|
);
|
|
1620
1618
|
return Te(h, o).pipe(ke());
|
|
1621
1619
|
},
|
|
1622
|
-
onSettled: (i, l,
|
|
1620
|
+
onSettled: (i, l, f, h) => {
|
|
1623
1621
|
const o = U(
|
|
1624
1622
|
() => {
|
|
1625
1623
|
var c, y;
|
|
@@ -1627,35 +1625,35 @@ class Gr {
|
|
|
1627
1625
|
c,
|
|
1628
1626
|
i,
|
|
1629
1627
|
l,
|
|
1630
|
-
|
|
1628
|
+
f,
|
|
1631
1629
|
h,
|
|
1632
1630
|
this
|
|
1633
1631
|
);
|
|
1634
1632
|
}
|
|
1635
|
-
),
|
|
1633
|
+
), d = U(
|
|
1636
1634
|
() => {
|
|
1637
1635
|
var c, y;
|
|
1638
|
-
return (y = (c = this.options).onSettled) == null ? void 0 : y.call(c, i, l,
|
|
1636
|
+
return (y = (c = this.options).onSettled) == null ? void 0 : y.call(c, i, l, f, h);
|
|
1639
1637
|
}
|
|
1640
1638
|
);
|
|
1641
|
-
return Te(o,
|
|
1639
|
+
return Te(o, d).pipe(ke());
|
|
1642
1640
|
},
|
|
1643
|
-
onSuccess: (i, l,
|
|
1641
|
+
onSuccess: (i, l, f) => {
|
|
1644
1642
|
const h = U(
|
|
1645
1643
|
() => {
|
|
1646
|
-
var
|
|
1647
|
-
return (c = (
|
|
1648
|
-
|
|
1644
|
+
var d, c;
|
|
1645
|
+
return (c = (d = t.config).onSuccess) == null ? void 0 : c.call(
|
|
1646
|
+
d,
|
|
1649
1647
|
i,
|
|
1650
1648
|
l,
|
|
1651
|
-
|
|
1649
|
+
f,
|
|
1652
1650
|
this
|
|
1653
1651
|
);
|
|
1654
1652
|
}
|
|
1655
1653
|
), o = U(
|
|
1656
1654
|
() => {
|
|
1657
|
-
var
|
|
1658
|
-
return (c = (
|
|
1655
|
+
var d, c;
|
|
1656
|
+
return (c = (d = this.options).onSuccess) == null ? void 0 : c.call(d, i, l, f);
|
|
1659
1657
|
}
|
|
1660
1658
|
);
|
|
1661
1659
|
return Te(h, o).pipe(ke());
|
|
@@ -1719,7 +1717,7 @@ const Et = ({
|
|
|
1719
1717
|
predicate: t,
|
|
1720
1718
|
exact: s = !0
|
|
1721
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;
|
|
1722
|
-
class
|
|
1720
|
+
class Lt {
|
|
1723
1721
|
constructor() {
|
|
1724
1722
|
/**
|
|
1725
1723
|
* @important
|
|
@@ -1727,16 +1725,16 @@ class zt {
|
|
|
1727
1725
|
*/
|
|
1728
1726
|
b(this, "entriesSubject", new J([]));
|
|
1729
1727
|
b(this, "changeSubject", new I());
|
|
1730
|
-
b(this, "entries$", this.entriesSubject.pipe(
|
|
1728
|
+
b(this, "entries$", this.entriesSubject.pipe(fe()));
|
|
1731
1729
|
b(this, "added$", this.changeSubject.pipe(
|
|
1732
1730
|
O(({ type: e }) => e === "added"),
|
|
1733
1731
|
g(({ entity: e }) => e),
|
|
1734
|
-
|
|
1732
|
+
fe()
|
|
1735
1733
|
));
|
|
1736
1734
|
b(this, "removed$", this.changeSubject.pipe(
|
|
1737
1735
|
O(({ type: e }) => e === "removed"),
|
|
1738
1736
|
g(({ entity: e }) => e),
|
|
1739
|
-
|
|
1737
|
+
fe()
|
|
1740
1738
|
));
|
|
1741
1739
|
b(this, "stateChange$", C(
|
|
1742
1740
|
this.entriesSubject.pipe(
|
|
@@ -1755,7 +1753,7 @@ class zt {
|
|
|
1755
1753
|
)
|
|
1756
1754
|
)
|
|
1757
1755
|
),
|
|
1758
|
-
|
|
1756
|
+
fe()
|
|
1759
1757
|
));
|
|
1760
1758
|
}
|
|
1761
1759
|
getValues() {
|
|
@@ -1774,13 +1772,13 @@ class zt {
|
|
|
1774
1772
|
}
|
|
1775
1773
|
}
|
|
1776
1774
|
var K;
|
|
1777
|
-
class
|
|
1775
|
+
class Gr {
|
|
1778
1776
|
constructor(e = {}) {
|
|
1779
|
-
w(this, K, new
|
|
1777
|
+
w(this, K, new Lt());
|
|
1780
1778
|
this.config = e;
|
|
1781
1779
|
}
|
|
1782
1780
|
build(e, t, s) {
|
|
1783
|
-
const n = new
|
|
1781
|
+
const n = new Wr({
|
|
1784
1782
|
mutationCache: this,
|
|
1785
1783
|
options: e.defaultMutationOptions(t),
|
|
1786
1784
|
state: s
|
|
@@ -1870,7 +1868,7 @@ class Jr {
|
|
|
1870
1868
|
if (!e.length)
|
|
1871
1869
|
return Me;
|
|
1872
1870
|
const t = e.map((s) => s.continue());
|
|
1873
|
-
return
|
|
1871
|
+
return ar(t);
|
|
1874
1872
|
}
|
|
1875
1873
|
clear() {
|
|
1876
1874
|
this.getAll().forEach((e) => {
|
|
@@ -1879,8 +1877,8 @@ class Jr {
|
|
|
1879
1877
|
}
|
|
1880
1878
|
}
|
|
1881
1879
|
K = new WeakMap();
|
|
1882
|
-
const
|
|
1883
|
-
function
|
|
1880
|
+
const Jr = typeof window > "u" || "Deno" in window;
|
|
1881
|
+
function Yr(r) {
|
|
1884
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;
|
|
1885
1883
|
return {
|
|
1886
1884
|
data: e,
|
|
@@ -1897,7 +1895,7 @@ function Br(r) {
|
|
|
1897
1895
|
fetchStatus: "idle"
|
|
1898
1896
|
};
|
|
1899
1897
|
}
|
|
1900
|
-
const
|
|
1898
|
+
const Br = (r) => Ae(() => _e.isFocused() ? r : _e.focusRegained$.pipe(T(() => r))), Xr = (r) => {
|
|
1901
1899
|
let e = 0;
|
|
1902
1900
|
return (t) => {
|
|
1903
1901
|
const s = se.backToOnline$.pipe(
|
|
@@ -1916,7 +1914,7 @@ const Xr = (r) => Ae(() => Le.isFocused() ? r : Le.focusRegained$.pipe(T(() => r
|
|
|
1916
1914
|
s
|
|
1917
1915
|
) : t));
|
|
1918
1916
|
};
|
|
1919
|
-
},
|
|
1917
|
+
}, Zr = (r) => (e) => {
|
|
1920
1918
|
const t = new I(), s = t.pipe(
|
|
1921
1919
|
Ge(),
|
|
1922
1920
|
/**
|
|
@@ -1932,7 +1930,7 @@ const Xr = (r) => Ae(() => Le.isFocused() ? r : Le.focusRegained$.pipe(T(() => r
|
|
|
1932
1930
|
}),
|
|
1933
1931
|
Z(s)
|
|
1934
1932
|
);
|
|
1935
|
-
},
|
|
1933
|
+
}, es = (r) => {
|
|
1936
1934
|
const e = async () => await Promise.reject(new Error("No query found"));
|
|
1937
1935
|
let t = !1;
|
|
1938
1936
|
const s = r.queryFn ?? e, n = new AbortController(), u = {
|
|
@@ -1945,13 +1943,13 @@ const Xr = (r) => Ae(() => Le.isFocused() ? r : Le.focusRegained$.pipe(T(() => r
|
|
|
1945
1943
|
get: () => (r.onSignalConsumed(), n.signal)
|
|
1946
1944
|
});
|
|
1947
1945
|
})(u);
|
|
1948
|
-
const
|
|
1946
|
+
const f = (typeof s == "function" ? (
|
|
1949
1947
|
// eslint-disable-next-line @typescript-eslint/promise-function-async
|
|
1950
1948
|
U(
|
|
1951
1949
|
() => s(u)
|
|
1952
1950
|
)
|
|
1953
1951
|
) : s).pipe(
|
|
1954
|
-
|
|
1952
|
+
Zr(r.observers$),
|
|
1955
1953
|
E({
|
|
1956
1954
|
complete: () => {
|
|
1957
1955
|
t = !0;
|
|
@@ -1963,22 +1961,22 @@ const Xr = (r) => Ae(() => Le.isFocused() ? r : Le.focusRegained$.pipe(T(() => r
|
|
|
1963
1961
|
})
|
|
1964
1962
|
),
|
|
1965
1963
|
// takeUntil(hasDataAndNoObservers$),
|
|
1966
|
-
|
|
1964
|
+
Xr(r),
|
|
1967
1965
|
It({
|
|
1968
1966
|
...r,
|
|
1969
|
-
retryAfter: () => S(!0).pipe(
|
|
1970
|
-
catchError: (o,
|
|
1967
|
+
retryAfter: () => S(!0).pipe(Br),
|
|
1968
|
+
catchError: (o, d) => S({
|
|
1971
1969
|
status: "error",
|
|
1972
1970
|
fetchStatus: "idle",
|
|
1973
1971
|
fetchFailureCount: o,
|
|
1974
|
-
fetchFailureReason:
|
|
1975
|
-
error:
|
|
1972
|
+
fetchFailureReason: d,
|
|
1973
|
+
error: d
|
|
1976
1974
|
}),
|
|
1977
|
-
caughtError: (o,
|
|
1975
|
+
caughtError: (o, d) => (
|
|
1978
1976
|
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
1979
1977
|
S({
|
|
1980
1978
|
fetchFailureCount: o,
|
|
1981
|
-
fetchFailureReason:
|
|
1979
|
+
fetchFailureReason: d
|
|
1982
1980
|
})
|
|
1983
1981
|
)
|
|
1984
1982
|
}),
|
|
@@ -2007,7 +2005,7 @@ const Xr = (r) => Ae(() => Le.isFocused() ? r : Le.focusRegained$.pipe(T(() => r
|
|
|
2007
2005
|
*/
|
|
2008
2006
|
ut(1),
|
|
2009
2007
|
g(
|
|
2010
|
-
(
|
|
2008
|
+
(d) => t ? d : { ...d, fetchStatus: "fetching" }
|
|
2011
2009
|
)
|
|
2012
2010
|
) : S(o)),
|
|
2013
2011
|
/**
|
|
@@ -2015,8 +2013,8 @@ const Xr = (r) => Ae(() => Le.isFocused() ? r : Le.focusRegained$.pipe(T(() => r
|
|
|
2015
2013
|
* before shallow compare will not update the state, otherwise it's our chance to catch
|
|
2016
2014
|
* the end of observable fn.
|
|
2017
2015
|
*/
|
|
2018
|
-
|
|
2019
|
-
|
|
2016
|
+
cr({ fetchStatus: "idle" }),
|
|
2017
|
+
fe()
|
|
2020
2018
|
), h = S({
|
|
2021
2019
|
status: "pending",
|
|
2022
2020
|
fetchStatus: se.isOnline() ? "fetching" : "paused"
|
|
@@ -2024,21 +2022,21 @@ const Xr = (r) => Ae(() => Le.isFocused() ? r : Le.focusRegained$.pipe(T(() => r
|
|
|
2024
2022
|
return {
|
|
2025
2023
|
state$: C(
|
|
2026
2024
|
h,
|
|
2027
|
-
|
|
2025
|
+
f
|
|
2028
2026
|
// emitOnComplete$
|
|
2029
|
-
).pipe(
|
|
2027
|
+
).pipe(fe()),
|
|
2030
2028
|
abortController: n
|
|
2031
2029
|
};
|
|
2032
2030
|
};
|
|
2033
|
-
class
|
|
2031
|
+
class ts {
|
|
2034
2032
|
constructor(e) {
|
|
2035
2033
|
b(this, "revert");
|
|
2036
2034
|
b(this, "silent");
|
|
2037
2035
|
this.revert = e == null ? void 0 : e.revert, this.silent = e == null ? void 0 : e.silent;
|
|
2038
2036
|
}
|
|
2039
2037
|
}
|
|
2040
|
-
const
|
|
2041
|
-
function
|
|
2038
|
+
const rs = { backgroundColor: "transparent", color: "inherit" };
|
|
2039
|
+
function _t(r) {
|
|
2042
2040
|
const e = {
|
|
2043
2041
|
namespaces: [
|
|
2044
2042
|
{
|
|
@@ -2047,10 +2045,10 @@ function Lt(r) {
|
|
|
2047
2045
|
}
|
|
2048
2046
|
],
|
|
2049
2047
|
namespace(t, s) {
|
|
2050
|
-
const n =
|
|
2048
|
+
const n = _t();
|
|
2051
2049
|
return n.namespaces.push({
|
|
2052
2050
|
name: t,
|
|
2053
|
-
style: s ??
|
|
2051
|
+
style: s ?? rs
|
|
2054
2052
|
}), n;
|
|
2055
2053
|
},
|
|
2056
2054
|
printNamespaces() {
|
|
@@ -2062,14 +2060,10 @@ function Lt(r) {
|
|
|
2062
2060
|
};
|
|
2063
2061
|
},
|
|
2064
2062
|
print(t, ...s) {
|
|
2065
|
-
if (r === "development") {
|
|
2066
|
-
const { namespaces: n, styles: u } = e.printNamespaces();
|
|
2067
|
-
console[t](n, ...u, ...s);
|
|
2068
|
-
}
|
|
2069
2063
|
return e;
|
|
2070
2064
|
},
|
|
2071
2065
|
printWithoutNamespace(t, ...s) {
|
|
2072
|
-
return
|
|
2066
|
+
return e;
|
|
2073
2067
|
},
|
|
2074
2068
|
log(...t) {
|
|
2075
2069
|
return e.print("log", ...t);
|
|
@@ -2084,14 +2078,14 @@ function Lt(r) {
|
|
|
2084
2078
|
return e.print("group", ...t);
|
|
2085
2079
|
},
|
|
2086
2080
|
groupEnd() {
|
|
2087
|
-
return
|
|
2081
|
+
return e;
|
|
2088
2082
|
}
|
|
2089
2083
|
};
|
|
2090
2084
|
return e;
|
|
2091
2085
|
}
|
|
2092
|
-
const
|
|
2086
|
+
const ss = _t();
|
|
2093
2087
|
var Ee, ae;
|
|
2094
|
-
class
|
|
2088
|
+
class ns {
|
|
2095
2089
|
constructor(e) {
|
|
2096
2090
|
b(this, "queryKey");
|
|
2097
2091
|
b(this, "queryHash");
|
|
@@ -2112,7 +2106,7 @@ class is {
|
|
|
2112
2106
|
b(this, "observerCount$", this.observersSubject.asObservable().pipe(g((e) => e.length)));
|
|
2113
2107
|
b(this, "observers$", this.observersSubject.asObservable());
|
|
2114
2108
|
b(this, "state$");
|
|
2115
|
-
M(this, Ee, e.defaultOptions), this.options = this.setOptions(e.options), this.queryKey = e.queryKey, this.queryHash = e.queryHash, M(this, ae, e.state ??
|
|
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(
|
|
2116
2110
|
this.resetSubject.pipe(
|
|
2117
2111
|
g(() => ({ command: "reset", state: a(this, ae) }))
|
|
2118
2112
|
),
|
|
@@ -2132,7 +2126,7 @@ class is {
|
|
|
2132
2126
|
state: {
|
|
2133
2127
|
status: t != null && t.revert ? this.state.status : "error",
|
|
2134
2128
|
fetchStatus: "idle",
|
|
2135
|
-
error: new
|
|
2129
|
+
error: new ts(t)
|
|
2136
2130
|
}
|
|
2137
2131
|
}))
|
|
2138
2132
|
),
|
|
@@ -2149,13 +2143,13 @@ class is {
|
|
|
2149
2143
|
o.length === 0 && h.length > 0 ? t = !0 : t = !1;
|
|
2150
2144
|
}),
|
|
2151
2145
|
he()
|
|
2152
|
-
), { state$: u, abortController: i } =
|
|
2146
|
+
), { state$: u, abortController: i } = es({
|
|
2153
2147
|
...this.options,
|
|
2154
2148
|
observers$: this.observerCount$,
|
|
2155
2149
|
queryKey: this.queryKey,
|
|
2156
2150
|
retry: (h, o) => {
|
|
2157
|
-
const
|
|
2158
|
-
return typeof
|
|
2151
|
+
const d = this.options.retry ?? !0;
|
|
2152
|
+
return typeof d == "function" ? d(h, o) : typeof d == "boolean" ? d : h < d;
|
|
2159
2153
|
},
|
|
2160
2154
|
retryAfterDelay: () => !t,
|
|
2161
2155
|
onSignalConsumed: () => {
|
|
@@ -2166,7 +2160,7 @@ class is {
|
|
|
2166
2160
|
E(() => {
|
|
2167
2161
|
this.cancelSubject.next({ revert: !0 });
|
|
2168
2162
|
})
|
|
2169
|
-
),
|
|
2163
|
+
), f = C(
|
|
2170
2164
|
this.cancelSubject,
|
|
2171
2165
|
s,
|
|
2172
2166
|
this.resetSubject,
|
|
@@ -2181,7 +2175,7 @@ class is {
|
|
|
2181
2175
|
command: "execute",
|
|
2182
2176
|
state: h
|
|
2183
2177
|
})),
|
|
2184
|
-
Z(
|
|
2178
|
+
Z(f)
|
|
2185
2179
|
);
|
|
2186
2180
|
})
|
|
2187
2181
|
),
|
|
@@ -2196,7 +2190,7 @@ class is {
|
|
|
2196
2190
|
}))
|
|
2197
2191
|
)
|
|
2198
2192
|
).pipe(
|
|
2199
|
-
|
|
2193
|
+
Ir({
|
|
2200
2194
|
initialState: this.state,
|
|
2201
2195
|
getOptions: () => this.options,
|
|
2202
2196
|
getState: () => this.state
|
|
@@ -2207,7 +2201,7 @@ class is {
|
|
|
2207
2201
|
this.state = t;
|
|
2208
2202
|
}),
|
|
2209
2203
|
B((t) => {
|
|
2210
|
-
throw
|
|
2204
|
+
throw ss.error(t), t;
|
|
2211
2205
|
}),
|
|
2212
2206
|
Z(this.destroySubject),
|
|
2213
2207
|
Ue({ bufferSize: 1, refCount: !1 })
|
|
@@ -2264,7 +2258,7 @@ class is {
|
|
|
2264
2258
|
updateGcTime(e) {
|
|
2265
2259
|
return this.gcTime = Math.max(
|
|
2266
2260
|
this.gcTime || 0,
|
|
2267
|
-
e ?? (
|
|
2261
|
+
e ?? (Jr ? 1 / 0 : 5 * 60 * 1e3)
|
|
2268
2262
|
), this.gcTime;
|
|
2269
2263
|
}
|
|
2270
2264
|
isActive() {
|
|
@@ -2277,7 +2271,7 @@ class is {
|
|
|
2277
2271
|
return this.state.isInvalidated || !this.state.dataUpdatedAt || this.observersSubject.getValue().some((e) => e.getCurrentResult().isStale);
|
|
2278
2272
|
}
|
|
2279
2273
|
isStaleByTime(e = 0) {
|
|
2280
|
-
return this.state.isInvalidated || !this.state.dataUpdatedAt || !
|
|
2274
|
+
return this.state.isInvalidated || !this.state.dataUpdatedAt || !Qr(this.state.dataUpdatedAt, e);
|
|
2281
2275
|
}
|
|
2282
2276
|
async getFetchResultAsPromise() {
|
|
2283
2277
|
return await new Promise((e, t) => {
|
|
@@ -2294,7 +2288,7 @@ class is {
|
|
|
2294
2288
|
return this.state.fetchStatus !== "idle" && !(!!this.state.dataUpdatedAt && s) ? await this.getFetchResultAsPromise() : (e && this.setOptions(e), this.executeSubject.next(t), await this.getFetchResultAsPromise());
|
|
2295
2289
|
}
|
|
2296
2290
|
setData(e, t) {
|
|
2297
|
-
const s =
|
|
2291
|
+
const s = Le(this.state.data, e, this.options);
|
|
2298
2292
|
return this.setDataSubject.next({ data: s, options: t }), s;
|
|
2299
2293
|
}
|
|
2300
2294
|
invalidate() {
|
|
@@ -2314,12 +2308,12 @@ class is {
|
|
|
2314
2308
|
}
|
|
2315
2309
|
Ee = new WeakMap(), ae = new WeakMap();
|
|
2316
2310
|
var xe, G;
|
|
2317
|
-
class
|
|
2311
|
+
class is {
|
|
2318
2312
|
// protected mountSubscriptions: Subscription[]
|
|
2319
2313
|
constructor(e = {}) {
|
|
2320
2314
|
// readonly #queries: QueryStore = new Map<string, Query>()
|
|
2321
2315
|
w(this, xe, new I());
|
|
2322
|
-
w(this, G, new
|
|
2316
|
+
w(this, G, new Lt());
|
|
2323
2317
|
this.config = e;
|
|
2324
2318
|
}
|
|
2325
2319
|
mount() {
|
|
@@ -2350,7 +2344,7 @@ class us {
|
|
|
2350
2344
|
build(e, t, s) {
|
|
2351
2345
|
const n = t.queryKey ?? [at()], u = t.queryHash ?? lt(n, t);
|
|
2352
2346
|
let i = this.get(u);
|
|
2353
|
-
return i || (i = new
|
|
2347
|
+
return i || (i = new ns({
|
|
2354
2348
|
cache: this,
|
|
2355
2349
|
queryKey: n,
|
|
2356
2350
|
queryHash: u,
|
|
@@ -2385,7 +2379,7 @@ class us {
|
|
|
2385
2379
|
* Once a mutation is finished and there are no more observers than us
|
|
2386
2380
|
* we start the process of cleaning it up based on gc settings
|
|
2387
2381
|
*/
|
|
2388
|
-
|
|
2382
|
+
Vr,
|
|
2389
2383
|
x((s) => s ? t.pipe(
|
|
2390
2384
|
// defaults to 5mn
|
|
2391
2385
|
x(() => e.gcTime === 1 / 0 ? Oe : (setTimeout(N, e.gcTime), Qe(e.gcTime)))
|
|
@@ -2447,7 +2441,7 @@ class us {
|
|
|
2447
2441
|
}
|
|
2448
2442
|
xe = new WeakMap(), G = new WeakMap();
|
|
2449
2443
|
var ce, A, Re, je, be;
|
|
2450
|
-
class
|
|
2444
|
+
class ws {
|
|
2451
2445
|
// #destroy = () => {}
|
|
2452
2446
|
constructor({
|
|
2453
2447
|
mutationCache: e,
|
|
@@ -2459,7 +2453,7 @@ class Cs {
|
|
|
2459
2453
|
w(this, Re, /* @__PURE__ */ new Map());
|
|
2460
2454
|
w(this, je, /* @__PURE__ */ new Map());
|
|
2461
2455
|
w(this, be, void 0);
|
|
2462
|
-
M(this, ce, e ?? new
|
|
2456
|
+
M(this, ce, e ?? new Gr()), M(this, A, t ?? new is()), M(this, be, s ?? {});
|
|
2463
2457
|
}
|
|
2464
2458
|
mount() {
|
|
2465
2459
|
}
|
|
@@ -2526,7 +2520,7 @@ class Cs {
|
|
|
2526
2520
|
return (s = a(this, A).get(t.queryHash)) == null ? void 0 : s.state.data;
|
|
2527
2521
|
}
|
|
2528
2522
|
setQueryData(e, t, s) {
|
|
2529
|
-
const n = a(this, A).find({ queryKey: e }), u = n == null ? void 0 : n.state.data, i =
|
|
2523
|
+
const n = a(this, A).find({ queryKey: e }), u = n == null ? void 0 : n.state.data, i = Ur(t, u);
|
|
2530
2524
|
if (typeof i > "u")
|
|
2531
2525
|
return;
|
|
2532
2526
|
const l = this.defaultQueryOptions({ queryKey: e });
|
|
@@ -2588,7 +2582,7 @@ class Cs {
|
|
|
2588
2582
|
await this.refetchQueries(s, t);
|
|
2589
2583
|
}
|
|
2590
2584
|
async resumePausedMutations() {
|
|
2591
|
-
return await
|
|
2585
|
+
return await or(a(this, ce).resumePausedMutations());
|
|
2592
2586
|
}
|
|
2593
2587
|
isFetching(e) {
|
|
2594
2588
|
return a(this, A).findAll({ ...e, fetchStatus: "fetching" }).length;
|
|
@@ -2599,30 +2593,31 @@ class Cs {
|
|
|
2599
2593
|
}
|
|
2600
2594
|
ce = new WeakMap(), A = new WeakMap(), Re = new WeakMap(), je = new WeakMap(), be = new WeakMap();
|
|
2601
2595
|
export {
|
|
2602
|
-
|
|
2603
|
-
|
|
2604
|
-
|
|
2605
|
-
|
|
2606
|
-
|
|
2607
|
-
|
|
2608
|
-
|
|
2609
|
-
|
|
2610
|
-
|
|
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,
|
|
2611
2605
|
tt as isDefined,
|
|
2612
2606
|
It as retryBackoff,
|
|
2613
|
-
|
|
2607
|
+
ds as signal,
|
|
2614
2608
|
Ut as useBehaviorSubject,
|
|
2615
|
-
|
|
2609
|
+
Os as useForeverQuery,
|
|
2616
2610
|
H as useLiveRef,
|
|
2617
|
-
|
|
2611
|
+
Ss as useMutation,
|
|
2618
2612
|
fs as useObservableState,
|
|
2619
2613
|
Ye as useObserve,
|
|
2620
|
-
|
|
2621
|
-
|
|
2622
|
-
|
|
2623
|
-
|
|
2614
|
+
hs as useObserveCallback,
|
|
2615
|
+
ys as usePersistSignals,
|
|
2616
|
+
vs as useQuery,
|
|
2617
|
+
Pt as useQueryClient,
|
|
2618
|
+
ps as useSignalValue,
|
|
2624
2619
|
Qt as useSubject,
|
|
2625
2620
|
At as useSubscribe,
|
|
2626
|
-
|
|
2627
|
-
|
|
2621
|
+
$s as useSubscribeEffect,
|
|
2622
|
+
gs as useUnmountObservable
|
|
2628
2623
|
};
|