reactjrx 1.74.0 → 1.74.2
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.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
var zt = Object.defineProperty;
|
|
2
2
|
var Lt = (s, e, t) => e in s ? zt(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
|
|
3
|
-
var y = (s, e, t) => (Lt(s, typeof e != "symbol" ? e + "" : e, t), t),
|
|
3
|
+
var y = (s, e, t) => (Lt(s, typeof e != "symbol" ? e + "" : e, t), t), lt = (s, e, t) => {
|
|
4
4
|
if (!e.has(s))
|
|
5
5
|
throw TypeError("Cannot " + t);
|
|
6
6
|
};
|
|
7
|
-
var a = (s, e, t) => (
|
|
7
|
+
var a = (s, e, t) => (lt(s, e, "read from private field"), t ? t.call(s) : e.get(s)), w = (s, e, t) => {
|
|
8
8
|
if (e.has(s))
|
|
9
9
|
throw TypeError("Cannot add the same private member more than once");
|
|
10
10
|
e instanceof WeakSet ? e.add(s) : e.set(s, t);
|
|
11
|
-
}, M = (s, e, t, r) => (
|
|
11
|
+
}, M = (s, e, t, r) => (lt(s, e, "write to private field"), r ? r.call(s, t) : e.set(s, t), t);
|
|
12
12
|
import * as We from "react";
|
|
13
|
-
import { useRef as ye, useMemo as et, useCallback as le, useSyncExternalStore as _t, useEffect as re, createContext as Wt, memo as Gt, useContext as Jt, useState as
|
|
14
|
-
import { distinctUntilChanged as
|
|
15
|
-
import { catchError as
|
|
13
|
+
import { useRef as ye, useMemo as et, useCallback as le, useSyncExternalStore as _t, useEffect as re, createContext as Wt, memo as Gt, useContext as Jt, useState as Ct } from "react";
|
|
14
|
+
import { distinctUntilChanged as A, tap as E, finalize as Yt, catchError as te, EMPTY as be, isObservable as ht, from as ve, of as S, defer as Ae, Subject as P, BehaviorSubject as J, map as g, zip as Bt, merge as C, throttleTime as Xt, asyncScheduler as Zt, switchMap as Q, throwError as me, timer as Qe, Observable as es, takeWhile as Ge, filter as $, concatMap as ts, last as Ke, mergeMap as H, takeUntil as B, skip as Ft, identity as Et, scan as tt, shareReplay as Ue, ignoreElements as he, first as st, fromEvent as Ne, noop as N, startWith as oe, pairwise as xt, NEVER as Oe, delay as rt, interval as ss, withLatestFrom as ft, retry as rs, iif as ns, concat as Te, toArray as ke, share as fe, take as He, combineLatest as is, endWith as us, lastValueFrom as as } from "rxjs";
|
|
15
|
+
import { catchError as dt, mergeMap as Xe, retryWhen as cs, concatMap as os, first as ls, tap as Rt } from "rxjs/operators";
|
|
16
16
|
import { jsxs as hs, jsx as fs } from "react/jsx-runtime";
|
|
17
|
-
const
|
|
17
|
+
const T = (s) => {
|
|
18
18
|
const e = ye(s);
|
|
19
19
|
return et(() => {
|
|
20
20
|
e.current = s;
|
|
@@ -30,7 +30,7 @@ function Je(s, e, t) {
|
|
|
30
30
|
unsubscribeOnUnmount: !0
|
|
31
31
|
}, n = t == null && Array.isArray(e) ? e : typeof s == "function" ? t ?? [] : [s], u = ye(
|
|
32
32
|
"getValue" in s && typeof s.getValue == "function" ? s.getValue() : r.defaultValue
|
|
33
|
-
), i =
|
|
33
|
+
), i = T(s), l = T(r), f = le(
|
|
34
34
|
(d) => {
|
|
35
35
|
const c = i.current, F = (typeof c == "function" ? c : () => c)().pipe(
|
|
36
36
|
/**
|
|
@@ -39,7 +39,7 @@ function Je(s, e, t) {
|
|
|
39
39
|
* be using objects and keeping same reference but pushing new
|
|
40
40
|
* properties values
|
|
41
41
|
*/
|
|
42
|
-
|
|
42
|
+
A(ds),
|
|
43
43
|
E((p) => {
|
|
44
44
|
u.current = p;
|
|
45
45
|
}),
|
|
@@ -55,26 +55,26 @@ function Je(s, e, t) {
|
|
|
55
55
|
), h = le(() => u.current, []);
|
|
56
56
|
return _t(f, h, h);
|
|
57
57
|
}
|
|
58
|
-
function
|
|
58
|
+
function pt(s) {
|
|
59
59
|
return s instanceof Promise || s && typeof s.then == "function" && typeof s.catch == "function";
|
|
60
60
|
}
|
|
61
|
-
function
|
|
62
|
-
if (
|
|
61
|
+
function U(s) {
|
|
62
|
+
if (ht(s))
|
|
63
63
|
return s;
|
|
64
|
-
if (
|
|
64
|
+
if (pt(s))
|
|
65
65
|
return ve(s);
|
|
66
66
|
if (typeof s != "function")
|
|
67
|
-
return
|
|
67
|
+
return S(s);
|
|
68
68
|
const e = s;
|
|
69
|
-
return
|
|
69
|
+
return Ae(() => {
|
|
70
70
|
const t = e();
|
|
71
|
-
return
|
|
71
|
+
return pt(t) ? ve(t) : ht(t) ? t : S(t);
|
|
72
72
|
});
|
|
73
73
|
}
|
|
74
74
|
function Mt(s, e = []) {
|
|
75
|
-
const t =
|
|
75
|
+
const t = T(s);
|
|
76
76
|
re(() => {
|
|
77
|
-
const r =
|
|
77
|
+
const r = U(t.current).subscribe();
|
|
78
78
|
return () => {
|
|
79
79
|
r.unsubscribe();
|
|
80
80
|
};
|
|
@@ -93,7 +93,7 @@ const Ye = (s) => {
|
|
|
93
93
|
onBeforeComplete: s,
|
|
94
94
|
completeOnUnmount: e = !0
|
|
95
95
|
} = {}) => {
|
|
96
|
-
const t = Ye(() => new P()), r = ye(!1), n =
|
|
96
|
+
const t = Ye(() => new P()), r = ye(!1), n = T(s), u = T(e);
|
|
97
97
|
return re(() => (r.current && (t.current = new P(), r.current = !1), () => {
|
|
98
98
|
if (!u.current) {
|
|
99
99
|
r.current = !0;
|
|
@@ -101,8 +101,8 @@ const Ye = (s) => {
|
|
|
101
101
|
}
|
|
102
102
|
r.current || (n.current != null && n.current(), t.current.complete(), r.current = !0);
|
|
103
103
|
}), [u, n, t]), t;
|
|
104
|
-
},
|
|
105
|
-
const s = jt(), e =
|
|
104
|
+
}, lr = () => {
|
|
105
|
+
const s = jt(), e = T(s.current.asObservable()), t = le(
|
|
106
106
|
(r) => {
|
|
107
107
|
s.current.next(r);
|
|
108
108
|
},
|
|
@@ -115,8 +115,8 @@ const Ye = (s) => {
|
|
|
115
115
|
return re(() => (t.current && (e.current = new J(r.current), t.current = !1), () => {
|
|
116
116
|
t.current || (e.current.complete(), t.current = !0);
|
|
117
117
|
}), [e]), e;
|
|
118
|
-
},
|
|
119
|
-
const e = ps(s), t =
|
|
118
|
+
}, hr = (s) => {
|
|
119
|
+
const e = ps(s), t = T(e.current.asObservable()), r = le(
|
|
120
120
|
(n) => {
|
|
121
121
|
e.current.next(n);
|
|
122
122
|
},
|
|
@@ -125,7 +125,7 @@ const Ye = (s) => {
|
|
|
125
125
|
);
|
|
126
126
|
return [t.current, r, e.current.getValue()];
|
|
127
127
|
}, ys = Symbol("SIGNAL_RESET");
|
|
128
|
-
function
|
|
128
|
+
function fr(s) {
|
|
129
129
|
const { default: e } = s ?? {}, t = new J(e);
|
|
130
130
|
return {
|
|
131
131
|
setValue: (u) => {
|
|
@@ -147,12 +147,12 @@ function hr(s) {
|
|
|
147
147
|
subject: t
|
|
148
148
|
};
|
|
149
149
|
}
|
|
150
|
-
function
|
|
150
|
+
function dr(s, e) {
|
|
151
151
|
const t = e ?? ((r) => r);
|
|
152
152
|
return Je(
|
|
153
153
|
() => s.subject.pipe(
|
|
154
154
|
g((r) => t(r)),
|
|
155
|
-
|
|
155
|
+
A()
|
|
156
156
|
),
|
|
157
157
|
{
|
|
158
158
|
defaultValue: t(s.getValue())
|
|
@@ -160,23 +160,23 @@ function fr(s, e) {
|
|
|
160
160
|
[]
|
|
161
161
|
);
|
|
162
162
|
}
|
|
163
|
-
const
|
|
163
|
+
const yt = (s) => {
|
|
164
164
|
if (!(!s || typeof s != "object"))
|
|
165
165
|
return s;
|
|
166
|
-
},
|
|
166
|
+
}, pr = ({
|
|
167
167
|
adapter: s,
|
|
168
168
|
key: e
|
|
169
169
|
}) => ({
|
|
170
170
|
getItem: async (t) => {
|
|
171
|
-
const r = await s.getItem(e), n =
|
|
171
|
+
const r = await s.getItem(e), n = yt(r) ?? {};
|
|
172
172
|
if (t in n)
|
|
173
173
|
return n[t];
|
|
174
174
|
},
|
|
175
175
|
setItem: async (t, r) => {
|
|
176
|
-
const n = await s.getItem(e), u =
|
|
176
|
+
const n = await s.getItem(e), u = yt(n) ?? {};
|
|
177
177
|
await s.setItem(e, { ...u, [t]: r });
|
|
178
178
|
}
|
|
179
|
-
}),
|
|
179
|
+
}), yr = (s) => ({
|
|
180
180
|
getItem: async (e) => {
|
|
181
181
|
const t = await s.getItem(e);
|
|
182
182
|
if (t)
|
|
@@ -215,17 +215,17 @@ const pt = (s) => {
|
|
|
215
215
|
}) => ve(s.getItem(t.config.key)).pipe(
|
|
216
216
|
Q((r) => {
|
|
217
217
|
const n = gs(r);
|
|
218
|
-
return n ? n.migrationVersion !== void 0 && e > n.migrationVersion ?
|
|
218
|
+
return n ? n.migrationVersion !== void 0 && e > n.migrationVersion ? S(r) : (t.setValue(r.value), S(r)) : S(r);
|
|
219
219
|
})
|
|
220
|
-
),
|
|
220
|
+
), br = ({
|
|
221
221
|
entries: s = [],
|
|
222
222
|
onReady: e,
|
|
223
223
|
adapter: t = bs(localStorage)
|
|
224
224
|
}) => {
|
|
225
|
-
const r =
|
|
225
|
+
const r = T(s), n = T(e), u = T(t), i = Je(
|
|
226
226
|
() => {
|
|
227
227
|
const l = r.current;
|
|
228
|
-
return (l.length === 0 ?
|
|
228
|
+
return (l.length === 0 ? S(!0) : Bt(
|
|
229
229
|
...l.map(
|
|
230
230
|
({ signal: h, version: o }) => Ss({
|
|
231
231
|
adapter: u.current,
|
|
@@ -257,7 +257,7 @@ const pt = (s) => {
|
|
|
257
257
|
)
|
|
258
258
|
)
|
|
259
259
|
) : be, [i, u]), { isHydrated: i };
|
|
260
|
-
},
|
|
260
|
+
}, gr = () => {
|
|
261
261
|
const s = jt({
|
|
262
262
|
onBeforeComplete: () => {
|
|
263
263
|
s.current.next();
|
|
@@ -271,12 +271,12 @@ function vs(s, e) {
|
|
|
271
271
|
function Os(s, e) {
|
|
272
272
|
return Math.pow(2, s) * e;
|
|
273
273
|
}
|
|
274
|
-
function
|
|
274
|
+
function At(s) {
|
|
275
275
|
const {
|
|
276
276
|
retry: e,
|
|
277
277
|
retryDelay: t,
|
|
278
278
|
retryAfterDelay: r,
|
|
279
|
-
retryAfter: n = () =>
|
|
279
|
+
retryAfter: n = () => S(!0)
|
|
280
280
|
} = s, u = typeof e != "function" ? e === !1 ? 0 : e === !0 ? 1 / 0 : e ?? 1 / 0 : 1 / 0, i = typeof e == "function" ? (
|
|
281
281
|
// ? (attempt: number, error: TError) => of(retry(attempt, error))
|
|
282
282
|
e
|
|
@@ -288,45 +288,45 @@ function Qt(s) {
|
|
|
288
288
|
resetOnSuccess: o = !1,
|
|
289
289
|
backoffDelay: d = Os
|
|
290
290
|
} = f;
|
|
291
|
-
return (c) =>
|
|
291
|
+
return (c) => Ae(() => {
|
|
292
292
|
let b = 0;
|
|
293
|
-
const F = (p,
|
|
293
|
+
const F = (p, v) => p < u ? i(p, v) : !1;
|
|
294
294
|
return c.pipe(
|
|
295
|
-
|
|
295
|
+
dt((p) => {
|
|
296
296
|
var O;
|
|
297
297
|
if (b++, !F(b - 1, p))
|
|
298
298
|
throw p;
|
|
299
|
-
const
|
|
300
|
-
if (!
|
|
299
|
+
const v = (O = s.caughtError) == null ? void 0 : O.call(s, b, p);
|
|
300
|
+
if (!v)
|
|
301
301
|
throw p;
|
|
302
|
-
return
|
|
302
|
+
return v.pipe(
|
|
303
303
|
Xe(
|
|
304
304
|
(q) => C(
|
|
305
|
-
|
|
305
|
+
S(q),
|
|
306
306
|
me(() => p)
|
|
307
307
|
)
|
|
308
308
|
)
|
|
309
309
|
);
|
|
310
310
|
}),
|
|
311
311
|
cs((p) => p.pipe(
|
|
312
|
-
os((
|
|
312
|
+
os((v) => {
|
|
313
313
|
const O = b - 1;
|
|
314
314
|
return n().pipe(
|
|
315
315
|
ls(),
|
|
316
316
|
Xe(
|
|
317
|
-
() => F(O,
|
|
317
|
+
() => F(O, v) ? Qe(
|
|
318
318
|
vs(
|
|
319
319
|
d(O, l),
|
|
320
320
|
h
|
|
321
321
|
)
|
|
322
322
|
).pipe(
|
|
323
|
-
Xe((q) => r && !r(O,
|
|
324
|
-
) : me(() =>
|
|
323
|
+
Xe((q) => r && !r(O, v) ? me(() => v) : S(q))
|
|
324
|
+
) : me(() => v)
|
|
325
325
|
)
|
|
326
326
|
);
|
|
327
327
|
})
|
|
328
328
|
)),
|
|
329
|
-
|
|
329
|
+
dt((p) => {
|
|
330
330
|
if (s.catchError)
|
|
331
331
|
return s.catchError(b, p);
|
|
332
332
|
throw p;
|
|
@@ -337,25 +337,25 @@ function Qt(s) {
|
|
|
337
337
|
);
|
|
338
338
|
});
|
|
339
339
|
}
|
|
340
|
-
function
|
|
340
|
+
function bt(s) {
|
|
341
341
|
return s != null;
|
|
342
342
|
}
|
|
343
|
-
function
|
|
343
|
+
function gt(s) {
|
|
344
344
|
return Object.prototype.toString.call(s) === "[object Object]";
|
|
345
345
|
}
|
|
346
346
|
function Ze(s) {
|
|
347
|
-
if (!
|
|
347
|
+
if (!gt(s))
|
|
348
348
|
return !1;
|
|
349
349
|
const e = s.constructor;
|
|
350
350
|
if (typeof e > "u")
|
|
351
351
|
return !0;
|
|
352
352
|
const t = e.prototype;
|
|
353
|
-
return !(!
|
|
353
|
+
return !(!gt(t) || !t.hasOwnProperty("isPrototypeOf"));
|
|
354
354
|
}
|
|
355
355
|
const ge = (s) => JSON.stringify(
|
|
356
356
|
s,
|
|
357
357
|
(e, t) => Ze(t) ? Object.keys(t).sort().reduce((r, n) => (r[n] = t[n], r), {}) : t
|
|
358
|
-
),
|
|
358
|
+
), nt = (s = 21) => crypto.getRandomValues(new Uint8Array(s)).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 = () => ({
|
|
359
359
|
context: void 0,
|
|
360
360
|
data: void 0,
|
|
361
361
|
error: null,
|
|
@@ -366,7 +366,7 @@ const ge = (s) => JSON.stringify(
|
|
|
366
366
|
failureReason: null,
|
|
367
367
|
isPaused: !1
|
|
368
368
|
});
|
|
369
|
-
function
|
|
369
|
+
function I(s, e) {
|
|
370
370
|
if (s == null || e === void 0 || typeof s != "object" || typeof e != "object")
|
|
371
371
|
return s === e;
|
|
372
372
|
if (s.constructor !== (e == null ? void 0 : e.constructor))
|
|
@@ -379,7 +379,7 @@ function V(s, e) {
|
|
|
379
379
|
return !1;
|
|
380
380
|
return !0;
|
|
381
381
|
}
|
|
382
|
-
function
|
|
382
|
+
function it(s) {
|
|
383
383
|
let e = 0;
|
|
384
384
|
return function(r) {
|
|
385
385
|
return new es((n) => {
|
|
@@ -416,14 +416,14 @@ class $s {
|
|
|
416
416
|
E(() => {
|
|
417
417
|
u.cancel();
|
|
418
418
|
})
|
|
419
|
-
), o =
|
|
419
|
+
), o = Ae(() => (u.execute(n), be)), d = u.state$.pipe(
|
|
420
420
|
$e,
|
|
421
421
|
Ke(),
|
|
422
422
|
H(() => u.state$),
|
|
423
423
|
B(a(this, X))
|
|
424
424
|
), c = u.state$.pipe(
|
|
425
425
|
$e,
|
|
426
|
-
|
|
426
|
+
Ft(1)
|
|
427
427
|
), b = C(
|
|
428
428
|
r,
|
|
429
429
|
f,
|
|
@@ -439,7 +439,7 @@ class $s {
|
|
|
439
439
|
*/
|
|
440
440
|
o
|
|
441
441
|
).pipe(
|
|
442
|
-
e ??
|
|
442
|
+
e ?? Et,
|
|
443
443
|
B(b)
|
|
444
444
|
);
|
|
445
445
|
}),
|
|
@@ -453,14 +453,14 @@ class $s {
|
|
|
453
453
|
error: u.error ?? n.error
|
|
454
454
|
}
|
|
455
455
|
}), ne()),
|
|
456
|
-
|
|
457
|
-
({ data: n, ...u }, { data: i, ...l }) =>
|
|
456
|
+
A(
|
|
457
|
+
({ data: n, ...u }, { data: i, ...l }) => I(u, l) && I(n, i)
|
|
458
458
|
),
|
|
459
459
|
Ue({
|
|
460
460
|
refCount: !0,
|
|
461
461
|
bufferSize: 1
|
|
462
462
|
}),
|
|
463
|
-
|
|
463
|
+
it((n) => {
|
|
464
464
|
t.next(n);
|
|
465
465
|
})
|
|
466
466
|
);
|
|
@@ -503,8 +503,8 @@ class ws {
|
|
|
503
503
|
reset: this.reset
|
|
504
504
|
}));
|
|
505
505
|
var n;
|
|
506
|
-
this.client = e, this.options = t, this.options.mutationKey = ((n = this.options) == null ? void 0 : n.mutationKey) ?? [
|
|
507
|
-
$(
|
|
506
|
+
this.client = e, this.options = t, this.options.mutationKey = ((n = this.options) == null ? void 0 : n.mutationKey) ?? [nt()], M(this, ie, r ?? new $s(this.options)), this.mutate = this.mutate.bind(this), this.reset = this.reset.bind(this), a(this, L).pipe(
|
|
507
|
+
$(bt),
|
|
508
508
|
H(
|
|
509
509
|
(u) => a(this, ie).state$.pipe(
|
|
510
510
|
B(
|
|
@@ -563,7 +563,7 @@ class ws {
|
|
|
563
563
|
), t = a(this, ie).state$.pipe(
|
|
564
564
|
g((i) => this.getObserverResultFromState(i))
|
|
565
565
|
), r = a(this, L).pipe(
|
|
566
|
-
$(
|
|
566
|
+
$(bt),
|
|
567
567
|
Q((i) => i.mutation.cancelled$),
|
|
568
568
|
g(() => this.getObserverResultFromState(ne()))
|
|
569
569
|
);
|
|
@@ -615,18 +615,18 @@ class ws {
|
|
|
615
615
|
}
|
|
616
616
|
}
|
|
617
617
|
ie = new WeakMap(), L = new WeakMap();
|
|
618
|
-
const
|
|
618
|
+
const Qt = Wt(void 0), Cs = ({ client: s }) => (re(() => (s.mount(), () => {
|
|
619
619
|
s.unmount();
|
|
620
|
-
}), [s]), null),
|
|
620
|
+
}), [s]), null), mr = Gt(
|
|
621
621
|
({ children: s, client: e }) => {
|
|
622
622
|
const t = et(() => e, [e]);
|
|
623
|
-
return /* @__PURE__ */ hs(
|
|
623
|
+
return /* @__PURE__ */ hs(Qt.Provider, { value: t, children: [
|
|
624
624
|
/* @__PURE__ */ fs(Cs, { client: e }),
|
|
625
625
|
s
|
|
626
626
|
] });
|
|
627
627
|
}
|
|
628
628
|
), Ut = (s) => {
|
|
629
|
-
const e = Jt(
|
|
629
|
+
const e = Jt(Qt);
|
|
630
630
|
if (s)
|
|
631
631
|
return s;
|
|
632
632
|
if (!e)
|
|
@@ -635,8 +635,8 @@ const At = Wt(void 0), Cs = ({ client: s }) => (re(() => (s.mount(), () => {
|
|
|
635
635
|
};
|
|
636
636
|
function Fs() {
|
|
637
637
|
}
|
|
638
|
-
function
|
|
639
|
-
const t = Ut(e), r =
|
|
638
|
+
function Sr(s, e) {
|
|
639
|
+
const t = Ut(e), r = T(s), n = Ye(() => [nt()]), u = ge(s.mutationKey ?? n.current), [i] = Ct(
|
|
640
640
|
() => new ws(
|
|
641
641
|
t,
|
|
642
642
|
s
|
|
@@ -665,7 +665,7 @@ function Es(s) {
|
|
|
665
665
|
class xs {
|
|
666
666
|
constructor() {
|
|
667
667
|
y(this, "isOnlineSubject", new J(!0));
|
|
668
|
-
y(this, "online$", this.isOnlineSubject.pipe(
|
|
668
|
+
y(this, "online$", this.isOnlineSubject.pipe(A()));
|
|
669
669
|
y(this, "backToOnline$", this.online$.pipe(
|
|
670
670
|
$((e) => e),
|
|
671
671
|
st()
|
|
@@ -683,17 +683,17 @@ class xs {
|
|
|
683
683
|
}
|
|
684
684
|
}
|
|
685
685
|
const se = new xs();
|
|
686
|
-
function
|
|
686
|
+
function ut(s, e) {
|
|
687
687
|
return s.isStaleByTime(e.staleTime);
|
|
688
688
|
}
|
|
689
689
|
function Rs(s, e) {
|
|
690
690
|
return e.enabled !== !1 && !s.state.dataUpdatedAt && !(s.state.status === "error" && e.retryOnMount === !1) && s.state.fetchStatus !== "fetching";
|
|
691
691
|
}
|
|
692
|
-
function
|
|
692
|
+
function mt(s, e) {
|
|
693
693
|
return Rs(s, e) || s.state.dataUpdatedAt > 0 && Pt(s, e, e.refetchOnMount);
|
|
694
694
|
}
|
|
695
|
-
function
|
|
696
|
-
return s.state.fetchStatus !== "fetching" && t.enabled !== !1 && (s !== e || r.enabled === !1) && (!t.suspense || s.state.status !== "error") &&
|
|
695
|
+
function St(s, e, t, r) {
|
|
696
|
+
return s.state.fetchStatus !== "fetching" && t.enabled !== !1 && (s !== e || r.enabled === !1) && (!t.suspense || s.state.status !== "error") && ut(s, t);
|
|
697
697
|
}
|
|
698
698
|
function Ms(s, e) {
|
|
699
699
|
return Pt(s, e, e.refetchOnWindowFocus);
|
|
@@ -701,26 +701,26 @@ function Ms(s, e) {
|
|
|
701
701
|
function Pt(s, e, t) {
|
|
702
702
|
if (e.enabled !== !1) {
|
|
703
703
|
const r = typeof t == "function" ? t(s) : t;
|
|
704
|
-
return r === "idle" ? s.state.fetchStatus === "idle" : r === "always" || r !== !1 &&
|
|
704
|
+
return r === "idle" ? s.state.fetchStatus === "idle" : r === "always" || r !== !1 && ut(s, e);
|
|
705
705
|
}
|
|
706
706
|
return !1;
|
|
707
707
|
}
|
|
708
708
|
function js(s) {
|
|
709
709
|
return (s ?? "online") === "online" ? se.isOnline() : !0;
|
|
710
710
|
}
|
|
711
|
-
function
|
|
711
|
+
function vt(s, e) {
|
|
712
712
|
return e.reduce(
|
|
713
713
|
(t, r) => r in s ? { ...t, [r]: s[r] } : t,
|
|
714
714
|
{}
|
|
715
715
|
);
|
|
716
716
|
}
|
|
717
|
-
function
|
|
717
|
+
function Ot(s) {
|
|
718
718
|
return Array.isArray(s) && s.length === Object.keys(s).length;
|
|
719
719
|
}
|
|
720
720
|
function It(s, e) {
|
|
721
721
|
if (s === e)
|
|
722
722
|
return s;
|
|
723
|
-
const t =
|
|
723
|
+
const t = Ot(s) && Ot(e);
|
|
724
724
|
if (t || Ze(s) && Ze(e)) {
|
|
725
725
|
const r = t ? s : Object.keys(s), n = r.length, u = t ? e : Object.keys(e), i = u.length, l = t ? [] : {};
|
|
726
726
|
let f = 0;
|
|
@@ -732,10 +732,10 @@ function It(s, e) {
|
|
|
732
732
|
}
|
|
733
733
|
return e;
|
|
734
734
|
}
|
|
735
|
-
function
|
|
735
|
+
function at(s, e) {
|
|
736
736
|
return ((e == null ? void 0 : e.queryKeyHashFn) ?? ge)(s);
|
|
737
737
|
}
|
|
738
|
-
function
|
|
738
|
+
function $t(s, e) {
|
|
739
739
|
const {
|
|
740
740
|
type: t = "all",
|
|
741
741
|
exact: r,
|
|
@@ -746,7 +746,7 @@ function Ot(s, e) {
|
|
|
746
746
|
} = s;
|
|
747
747
|
if (i) {
|
|
748
748
|
if (r) {
|
|
749
|
-
if (e.queryHash !==
|
|
749
|
+
if (e.queryHash !== at(i, e.options))
|
|
750
750
|
return !1;
|
|
751
751
|
} else if (!Be(e.queryKey, i))
|
|
752
752
|
return !1;
|
|
@@ -758,10 +758,10 @@ function Ot(s, e) {
|
|
|
758
758
|
}
|
|
759
759
|
return !(typeof l == "boolean" && e.isStale() !== l || typeof n < "u" && n !== e.state.fetchStatus || u && !u(e));
|
|
760
760
|
}
|
|
761
|
-
function
|
|
761
|
+
function As(s, e) {
|
|
762
762
|
return Math.max(s + (e ?? 0) - Date.now(), 0);
|
|
763
763
|
}
|
|
764
|
-
function
|
|
764
|
+
function Qs(s, e) {
|
|
765
765
|
return typeof s == "function" ? s(e) : s;
|
|
766
766
|
}
|
|
767
767
|
function ze(s, e, t) {
|
|
@@ -779,14 +779,14 @@ const Us = ({
|
|
|
779
779
|
const R = n.status === "pending" ? "pending" : i.status ?? n.status;
|
|
780
780
|
return { ...n, ...i, status: R };
|
|
781
781
|
}
|
|
782
|
-
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, b = i.status ?? n.status, F = f ? ze(e().data, l, s()) : h ? i.data : n.data, p = n.status === "error" || n.status === "success",
|
|
783
|
-
(d || c),
|
|
782
|
+
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, b = i.status ?? n.status, F = f ? ze(e().data, l, s()) : 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, O = f ? n.dataUpdateCount + 1 : i.dataUpdateCount ?? n.dataUpdateCount, q = i.status === "pending" && p && // (dataUpdateCount !== 0 || errorUpdateCount !== 0)
|
|
783
|
+
(d || c), V = b === "pending" ? null : i.error ?? n.error;
|
|
784
784
|
return {
|
|
785
785
|
...n,
|
|
786
786
|
...i,
|
|
787
787
|
status: b,
|
|
788
|
-
error:
|
|
789
|
-
errorUpdateCount:
|
|
788
|
+
error: V,
|
|
789
|
+
errorUpdateCount: v,
|
|
790
790
|
...o && {
|
|
791
791
|
isInvalidated: !1
|
|
792
792
|
},
|
|
@@ -817,7 +817,7 @@ class Is {
|
|
|
817
817
|
// public readonly focused$ = this.#focusedSubject.pipe(distinctUntilChanged())
|
|
818
818
|
y(this, "focused$", a(this, Z));
|
|
819
819
|
y(this, "focusRegained$", this.focused$.pipe(
|
|
820
|
-
|
|
820
|
+
Ft(1),
|
|
821
821
|
$((e) => e)
|
|
822
822
|
));
|
|
823
823
|
a(this, _e).pipe(
|
|
@@ -850,7 +850,15 @@ class Is {
|
|
|
850
850
|
}
|
|
851
851
|
}
|
|
852
852
|
_e = new WeakMap(), Z = new WeakMap();
|
|
853
|
-
const Le = new Is()
|
|
853
|
+
const Le = new Is(), Vs = (s) => s.pipe(
|
|
854
|
+
$((e) => e.status === "success"),
|
|
855
|
+
g((e) => ({
|
|
856
|
+
data: e.data,
|
|
857
|
+
status: e.status,
|
|
858
|
+
dataUpdatedAt: e.dataUpdatedAt
|
|
859
|
+
})),
|
|
860
|
+
A(I)
|
|
861
|
+
);
|
|
854
862
|
var Y, x, we, ue, D, de, Ce;
|
|
855
863
|
class Dt {
|
|
856
864
|
constructor(e, t) {
|
|
@@ -891,12 +899,12 @@ class Dt {
|
|
|
891
899
|
}) => {
|
|
892
900
|
var De;
|
|
893
901
|
const o = t.state, d = t.state.status === "pending", c = a(this, x), b = this.options, p = t !== c ? t.state : a(this, ue);
|
|
894
|
-
let { errorUpdatedAt:
|
|
902
|
+
let { errorUpdatedAt: v, fetchStatus: O, error: q } = o;
|
|
895
903
|
if (r) {
|
|
896
|
-
const
|
|
897
|
-
(
|
|
904
|
+
const k = !!a(this, Ce), ot = !k && mt(t, e), qt = k && St(t, c, e, b);
|
|
905
|
+
(ot || qt) && (O = js(t.options.networkMode) ? "fetching" : "paused");
|
|
898
906
|
}
|
|
899
|
-
const
|
|
907
|
+
const V = d && O === "fetching";
|
|
900
908
|
let R, m = f, _ = l ?? null, W = h;
|
|
901
909
|
if (e.select && typeof o.data < "u")
|
|
902
910
|
if (n && o.data === (i == null ? void 0 : i.data) && e.select === l)
|
|
@@ -904,30 +912,30 @@ class Dt {
|
|
|
904
912
|
else
|
|
905
913
|
try {
|
|
906
914
|
_ = e.select, R = e.select(o.data), R = ze(n == null ? void 0 : n.data, R, e), W = R, m = null;
|
|
907
|
-
} catch (
|
|
908
|
-
R = h, m =
|
|
915
|
+
} catch (k) {
|
|
916
|
+
R = h, m = k;
|
|
909
917
|
}
|
|
910
918
|
else
|
|
911
919
|
R = o.data, m = null;
|
|
912
920
|
let z = O !== "idle" && !o.dataUpdatedAt ? "pending" : o.status;
|
|
913
|
-
m && (q = m, R = h,
|
|
921
|
+
m && (q = m, R = h, v = (n == null ? void 0 : n.errorUpdatedAt) ?? v, z = "error");
|
|
914
922
|
const Pe = z === "error";
|
|
915
923
|
let Ie = !1;
|
|
916
924
|
if (typeof e.placeholderData < "u" && typeof R > "u" && z === "pending") {
|
|
917
|
-
let
|
|
925
|
+
let k;
|
|
918
926
|
if (n != null && n.isPlaceholderData && e.placeholderData === (u == null ? void 0 : u.placeholderData))
|
|
919
|
-
|
|
920
|
-
else if (
|
|
927
|
+
k = n.data;
|
|
928
|
+
else if (k = typeof e.placeholderData == "function" ? e.placeholderData(
|
|
921
929
|
(De = a(this, de)) == null ? void 0 : De.state.data,
|
|
922
930
|
a(this, de)
|
|
923
|
-
) : e.placeholderData, e.select && typeof
|
|
931
|
+
) : e.placeholderData, e.select && typeof k < "u")
|
|
924
932
|
try {
|
|
925
|
-
|
|
933
|
+
k = e.select(k);
|
|
926
934
|
} catch {
|
|
927
935
|
}
|
|
928
|
-
typeof
|
|
936
|
+
typeof k < "u" && (z = "success", R = ze(
|
|
929
937
|
n == null ? void 0 : n.data,
|
|
930
|
-
|
|
938
|
+
k,
|
|
931
939
|
e
|
|
932
940
|
), Ie = !0);
|
|
933
941
|
}
|
|
@@ -939,12 +947,12 @@ class Dt {
|
|
|
939
947
|
isPending: d,
|
|
940
948
|
isSuccess: z === "success",
|
|
941
949
|
isError: Pe,
|
|
942
|
-
isInitialLoading:
|
|
943
|
-
isLoading:
|
|
950
|
+
isInitialLoading: V,
|
|
951
|
+
isLoading: V,
|
|
944
952
|
data: R,
|
|
945
953
|
dataUpdatedAt: o.dataUpdatedAt,
|
|
946
954
|
error: q,
|
|
947
|
-
errorUpdatedAt:
|
|
955
|
+
errorUpdatedAt: v,
|
|
948
956
|
failureCount: o.fetchFailureCount,
|
|
949
957
|
failureReason: o.fetchFailureReason,
|
|
950
958
|
errorUpdateCount: o.errorUpdateCount,
|
|
@@ -956,7 +964,7 @@ class Dt {
|
|
|
956
964
|
isPaused: O === "paused",
|
|
957
965
|
isPlaceholderData: Ie,
|
|
958
966
|
isRefetchError: Pe && o.dataUpdatedAt !== 0,
|
|
959
|
-
isStale:
|
|
967
|
+
isStale: ut(t, e),
|
|
960
968
|
// eslint-disable-next-line @typescript-eslint/unbound-method
|
|
961
969
|
refetch: this.refetch
|
|
962
970
|
},
|
|
@@ -988,7 +996,7 @@ class Dt {
|
|
|
988
996
|
}
|
|
989
997
|
setOptions(e) {
|
|
990
998
|
const t = this.options;
|
|
991
|
-
if (this.options = a(this, Y).defaultQueryOptions(e),
|
|
999
|
+
if (this.options = a(this, Y).defaultQueryOptions(e), I(this.options, t) || a(this, Y).getQueryCache().notify({
|
|
992
1000
|
type: "observerOptionsUpdated",
|
|
993
1001
|
query: a(this, x),
|
|
994
1002
|
observer: this
|
|
@@ -1021,7 +1029,7 @@ class Dt {
|
|
|
1021
1029
|
optimisticResult: !0,
|
|
1022
1030
|
prevResult: a(this, D)
|
|
1023
1031
|
});
|
|
1024
|
-
return
|
|
1032
|
+
return Ds(this, r.result) && this.updateResult({ query: t, ...r }), r.result;
|
|
1025
1033
|
}
|
|
1026
1034
|
updateResult({
|
|
1027
1035
|
query: e,
|
|
@@ -1074,16 +1082,16 @@ class Dt {
|
|
|
1074
1082
|
const e = a(this, x), t = this.queryUpdateSubject.pipe(
|
|
1075
1083
|
g(({ query: i }) => i),
|
|
1076
1084
|
oe(a(this, x)),
|
|
1077
|
-
|
|
1085
|
+
A()
|
|
1078
1086
|
), r = this.queryUpdateSubject.pipe(
|
|
1079
1087
|
oe({
|
|
1080
1088
|
query: a(this, x),
|
|
1081
1089
|
options: this.options
|
|
1082
1090
|
}),
|
|
1083
|
-
|
|
1091
|
+
xt(),
|
|
1084
1092
|
E(
|
|
1085
1093
|
([{ options: i, query: l }, { options: f, query: h }]) => {
|
|
1086
|
-
|
|
1094
|
+
St(h, l, f, i) && this.fetch().catch(N);
|
|
1087
1095
|
}
|
|
1088
1096
|
),
|
|
1089
1097
|
he()
|
|
@@ -1104,28 +1112,28 @@ class Dt {
|
|
|
1104
1112
|
oe({ query: i, options: l }),
|
|
1105
1113
|
$((m) => m.query === i),
|
|
1106
1114
|
g((m) => m.options),
|
|
1107
|
-
|
|
1115
|
+
A(),
|
|
1108
1116
|
Ue(1)
|
|
1109
1117
|
), h = a(this, we).pipe(
|
|
1110
1118
|
$((m) => m.query === i)
|
|
1111
1119
|
), o = i.state$.pipe(
|
|
1112
|
-
|
|
1120
|
+
Vs,
|
|
1113
1121
|
Q(
|
|
1114
|
-
(m) => this.options.staleTime === 1 / 0 ? Oe :
|
|
1122
|
+
(m) => this.options.staleTime === 1 / 0 ? Oe : (this.options.staleTime ?? 0) <= 0 ? S(m).pipe(rt(1)) : Qe(this.options.staleTime ?? 1)
|
|
1115
1123
|
),
|
|
1116
1124
|
Ge(() => this.options.enabled ?? !0)
|
|
1117
1125
|
), d = (m, _) => {
|
|
1118
1126
|
const W = l.notifyOnChangeProps, z = typeof W == "function" ? W() : W;
|
|
1119
1127
|
return (Array.isArray(z) ? z.length === 0 ? () => !0 : (Ie, Ve) => {
|
|
1120
|
-
const
|
|
1128
|
+
const ct = vt(
|
|
1121
1129
|
Ie,
|
|
1122
1130
|
z
|
|
1123
|
-
), De =
|
|
1131
|
+
), De = vt(
|
|
1124
1132
|
Ve,
|
|
1125
1133
|
z
|
|
1126
1134
|
);
|
|
1127
|
-
return
|
|
1128
|
-
} :
|
|
1135
|
+
return I(ct, De);
|
|
1136
|
+
} : I)(m, _);
|
|
1129
1137
|
}, c = h.pipe(
|
|
1130
1138
|
Q(() => i.state$),
|
|
1131
1139
|
Vt
|
|
@@ -1134,7 +1142,7 @@ class Dt {
|
|
|
1134
1142
|
refetchInterval: (typeof m == "function" ? m(a(this, x)) : m) ?? !1,
|
|
1135
1143
|
refetchIntervalInBackground: _
|
|
1136
1144
|
})),
|
|
1137
|
-
|
|
1145
|
+
A(I),
|
|
1138
1146
|
Q(({ refetchInterval: m, refetchIntervalInBackground: _ }) => m ? ss(m).pipe(
|
|
1139
1147
|
E(() => {
|
|
1140
1148
|
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
|
@@ -1144,14 +1152,14 @@ class Dt {
|
|
|
1144
1152
|
he()
|
|
1145
1153
|
), F = f.pipe(
|
|
1146
1154
|
g(({ enabled: m }) => m ?? !0),
|
|
1147
|
-
|
|
1155
|
+
A()
|
|
1148
1156
|
), p = F.pipe(
|
|
1149
1157
|
$((m) => !m),
|
|
1150
1158
|
g(() => i.state)
|
|
1151
|
-
),
|
|
1159
|
+
), v = F.pipe(
|
|
1152
1160
|
$((m) => m),
|
|
1153
1161
|
Q(() => Le.focusRegained$),
|
|
1154
|
-
|
|
1162
|
+
ft(f),
|
|
1155
1163
|
E(([, m]) => {
|
|
1156
1164
|
Ms(i, m) && this.fetch({ cancelRefetch: !1 }).catch(N);
|
|
1157
1165
|
}),
|
|
@@ -1159,7 +1167,7 @@ class Dt {
|
|
|
1159
1167
|
), O = p.pipe(
|
|
1160
1168
|
g(() => i.state)
|
|
1161
1169
|
), q = (m) => m.pipe(
|
|
1162
|
-
|
|
1170
|
+
ft(f),
|
|
1163
1171
|
g(([, _]) => {
|
|
1164
1172
|
const W = this.getObserverResultFromQuery({
|
|
1165
1173
|
query: i,
|
|
@@ -1177,17 +1185,17 @@ class Dt {
|
|
|
1177
1185
|
).pipe(
|
|
1178
1186
|
q,
|
|
1179
1187
|
// This one ensure we don't re-trigger same state
|
|
1180
|
-
|
|
1188
|
+
A(I),
|
|
1181
1189
|
// This one make sure we dispatch based on user preference
|
|
1182
|
-
|
|
1190
|
+
A(d)
|
|
1183
1191
|
);
|
|
1184
|
-
return C(b,
|
|
1192
|
+
return C(b, v, R);
|
|
1185
1193
|
})
|
|
1186
1194
|
).pipe(
|
|
1187
|
-
|
|
1195
|
+
it((i) => M(this, Ce, i)),
|
|
1188
1196
|
E({
|
|
1189
1197
|
subscribe: () => {
|
|
1190
|
-
|
|
1198
|
+
mt(e, this.options) && this.fetch().catch(N);
|
|
1191
1199
|
}
|
|
1192
1200
|
})
|
|
1193
1201
|
)
|
|
@@ -1197,11 +1205,11 @@ class Dt {
|
|
|
1197
1205
|
}
|
|
1198
1206
|
}
|
|
1199
1207
|
Y = new WeakMap(), x = new WeakMap(), we = new WeakMap(), ue = new WeakMap(), D = new WeakMap(), de = new WeakMap(), Ce = new WeakMap();
|
|
1200
|
-
function
|
|
1201
|
-
return !
|
|
1208
|
+
function Ds(s, e) {
|
|
1209
|
+
return !I(s.getCurrentResult(), e);
|
|
1202
1210
|
}
|
|
1203
|
-
const
|
|
1204
|
-
|
|
1211
|
+
const Tt = We.createContext(!1), Ts = () => We.useContext(Tt);
|
|
1212
|
+
Tt.Provider;
|
|
1205
1213
|
function ks() {
|
|
1206
1214
|
let s = !1;
|
|
1207
1215
|
return {
|
|
@@ -1214,29 +1222,29 @@ function ks() {
|
|
|
1214
1222
|
isReset: () => s
|
|
1215
1223
|
};
|
|
1216
1224
|
}
|
|
1217
|
-
const
|
|
1218
|
-
function
|
|
1225
|
+
const Ks = We.createContext(ks()), Ns = () => We.useContext(Ks);
|
|
1226
|
+
function Hs(s, e) {
|
|
1219
1227
|
return typeof s == "function" ? s(...e) : !!s;
|
|
1220
1228
|
}
|
|
1221
|
-
const
|
|
1229
|
+
const qs = ({
|
|
1222
1230
|
result: s,
|
|
1223
1231
|
errorResetBoundary: e,
|
|
1224
1232
|
throwOnError: t,
|
|
1225
1233
|
query: r
|
|
1226
|
-
}) => s.isError && !e.isReset() && !s.isFetching && r &&
|
|
1227
|
-
function
|
|
1234
|
+
}) => s.isError && !e.isReset() && !s.isFetching && r && Hs(t, [s.error, r]);
|
|
1235
|
+
function kt(s, e, t) {
|
|
1228
1236
|
if (process.env.NODE_ENV !== "production" && (typeof s != "object" || Array.isArray(s)))
|
|
1229
1237
|
throw new Error(
|
|
1230
1238
|
'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'
|
|
1231
1239
|
);
|
|
1232
|
-
const r = Ut(t), n =
|
|
1240
|
+
const r = Ut(t), n = Ts(), u = Ns(), i = r.defaultQueryOptions(s);
|
|
1233
1241
|
i._optimisticResults = n ? "isRestoring" : "optimistic";
|
|
1234
|
-
const [l] =
|
|
1242
|
+
const [l] = Ct(
|
|
1235
1243
|
() => new e(
|
|
1236
1244
|
r,
|
|
1237
1245
|
i
|
|
1238
1246
|
)
|
|
1239
|
-
), f = Ye(() => l.observe()), h =
|
|
1247
|
+
), f = Ye(() => l.observe()), h = T(
|
|
1240
1248
|
l.getOptimisticResult(i)
|
|
1241
1249
|
), o = h.current;
|
|
1242
1250
|
Je(
|
|
@@ -1246,14 +1254,14 @@ function Tt(s, e, t) {
|
|
|
1246
1254
|
* It's important to not skip the first result (even tho most of the time they are equal).
|
|
1247
1255
|
* We only skip if they are the same.
|
|
1248
1256
|
*/
|
|
1249
|
-
$((c) => !
|
|
1257
|
+
$((c) => !I(c, h.current))
|
|
1250
1258
|
),
|
|
1251
1259
|
[]
|
|
1252
1260
|
), re(() => {
|
|
1253
1261
|
l.setOptions(i);
|
|
1254
1262
|
}, [i, l]);
|
|
1255
1263
|
const d = o.error;
|
|
1256
|
-
if (d &&
|
|
1264
|
+
if (d && qs({
|
|
1257
1265
|
result: o,
|
|
1258
1266
|
errorResetBoundary: u,
|
|
1259
1267
|
throwOnError: i.throwOnError,
|
|
@@ -1264,11 +1272,11 @@ function Tt(s, e, t) {
|
|
|
1264
1272
|
throw d;
|
|
1265
1273
|
return h.current;
|
|
1266
1274
|
}
|
|
1267
|
-
function Sr(s, e) {
|
|
1268
|
-
return Tt(s, Dt, e);
|
|
1269
|
-
}
|
|
1270
1275
|
function vr(s, e) {
|
|
1271
|
-
return
|
|
1276
|
+
return kt(s, Dt, e);
|
|
1277
|
+
}
|
|
1278
|
+
function Or(s, e) {
|
|
1279
|
+
return kt(
|
|
1272
1280
|
{
|
|
1273
1281
|
refetchOnMount: "idle",
|
|
1274
1282
|
refetchOnReconnect: !1,
|
|
@@ -1280,17 +1288,17 @@ function vr(s, e) {
|
|
|
1280
1288
|
e
|
|
1281
1289
|
);
|
|
1282
1290
|
}
|
|
1283
|
-
function
|
|
1284
|
-
const r = e != null && !Array.isArray(e) ? e : {}, n = r.retry ?? !0, u =
|
|
1291
|
+
function $r(s, e, t = []) {
|
|
1292
|
+
const r = e != null && !Array.isArray(e) ? e : {}, n = r.retry ?? !0, u = T(
|
|
1285
1293
|
r.onError ?? ((f) => {
|
|
1286
1294
|
console.error(f);
|
|
1287
1295
|
})
|
|
1288
|
-
), i = le(() =>
|
|
1296
|
+
), i = le(() => U(s), t), l = le(
|
|
1289
1297
|
() => i().pipe(
|
|
1290
1298
|
te((f) => {
|
|
1291
1299
|
throw u.current(f), f;
|
|
1292
1300
|
}),
|
|
1293
|
-
n ? rs() :
|
|
1301
|
+
n ? rs() : Et
|
|
1294
1302
|
),
|
|
1295
1303
|
[i, n, u]
|
|
1296
1304
|
);
|
|
@@ -1298,20 +1306,20 @@ function Or(s, e, t = []) {
|
|
|
1298
1306
|
}
|
|
1299
1307
|
const Kt = () => (s) => C(
|
|
1300
1308
|
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
1301
|
-
|
|
1309
|
+
S({ isPaused: !0 }),
|
|
1302
1310
|
se.backToOnline$.pipe(
|
|
1303
1311
|
H(
|
|
1304
1312
|
() => (
|
|
1305
1313
|
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
1306
|
-
C(
|
|
1314
|
+
C(S({ isPaused: !1 }), s)
|
|
1307
1315
|
)
|
|
1308
1316
|
)
|
|
1309
1317
|
)
|
|
1310
|
-
),
|
|
1318
|
+
), zs = (s) => {
|
|
1311
1319
|
let e = 0;
|
|
1312
1320
|
return s.pipe(
|
|
1313
1321
|
te((t) => (e++, e <= 1 && !se.isOnline() ? C(
|
|
1314
|
-
|
|
1322
|
+
S({
|
|
1315
1323
|
failureCount: e,
|
|
1316
1324
|
failureReason: t
|
|
1317
1325
|
}),
|
|
@@ -1319,33 +1327,33 @@ const Kt = () => (s) => C(
|
|
|
1319
1327
|
* @important
|
|
1320
1328
|
* timer needed to be iso RQ, so the state returned by mutation include both previous and next one
|
|
1321
1329
|
*/
|
|
1322
|
-
|
|
1330
|
+
Qe(1).pipe(
|
|
1323
1331
|
H(() => me(() => t).pipe(Kt()))
|
|
1324
1332
|
)
|
|
1325
1333
|
) : me(() => t)))
|
|
1326
1334
|
);
|
|
1327
|
-
},
|
|
1335
|
+
}, Ls = ({
|
|
1328
1336
|
variables: s,
|
|
1329
1337
|
state: e,
|
|
1330
1338
|
options: t
|
|
1331
1339
|
}) => {
|
|
1332
1340
|
const r = e.isPaused, n = async () => await Promise.reject(new Error("No mutationFn found")), u = t.mutationFn ?? n, l = ns(
|
|
1333
1341
|
() => r,
|
|
1334
|
-
|
|
1335
|
-
|
|
1342
|
+
S(e.context),
|
|
1343
|
+
U(
|
|
1336
1344
|
// eslint-disable-next-line @typescript-eslint/promise-function-async
|
|
1337
1345
|
() => {
|
|
1338
1346
|
var c;
|
|
1339
1347
|
return ((c = t.onMutate) == null ? void 0 : c.call(t, s)) ?? void 0;
|
|
1340
1348
|
}
|
|
1341
1349
|
)
|
|
1342
|
-
).pipe(Ue(1)), f = (c, b, F) => (console.error(c),
|
|
1350
|
+
).pipe(Ue(1)), f = (c, b, F) => (console.error(c), U(
|
|
1343
1351
|
() => {
|
|
1344
|
-
var
|
|
1345
|
-
return (
|
|
1352
|
+
var v;
|
|
1353
|
+
return (v = t.onError) == null ? void 0 : v.call(t, c, s, b);
|
|
1346
1354
|
}
|
|
1347
1355
|
).pipe(
|
|
1348
|
-
te(() =>
|
|
1356
|
+
te(() => S(c)),
|
|
1349
1357
|
g(
|
|
1350
1358
|
() => ({
|
|
1351
1359
|
failureCount: F,
|
|
@@ -1359,7 +1367,7 @@ const Kt = () => (s) => C(
|
|
|
1359
1367
|
Q((c) => {
|
|
1360
1368
|
const F = (typeof u == "function" ? (
|
|
1361
1369
|
// eslint-disable-next-line @typescript-eslint/promise-function-async
|
|
1362
|
-
|
|
1370
|
+
U(() => u(s))
|
|
1363
1371
|
) : u).pipe(
|
|
1364
1372
|
g(
|
|
1365
1373
|
(p) => ({
|
|
@@ -1370,21 +1378,21 @@ const Kt = () => (s) => C(
|
|
|
1370
1378
|
context: c
|
|
1371
1379
|
})
|
|
1372
1380
|
),
|
|
1373
|
-
|
|
1374
|
-
|
|
1381
|
+
zs,
|
|
1382
|
+
At({
|
|
1375
1383
|
...t,
|
|
1376
|
-
retry: (p,
|
|
1384
|
+
retry: (p, v) => {
|
|
1377
1385
|
const O = t.retry ?? 0;
|
|
1378
|
-
return typeof O == "function" ? O(p,
|
|
1386
|
+
return typeof O == "function" ? O(p, v) : typeof O == "boolean" ? O : p < O;
|
|
1379
1387
|
},
|
|
1380
|
-
caughtError: (p,
|
|
1388
|
+
caughtError: (p, v) => (
|
|
1381
1389
|
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
1382
|
-
|
|
1390
|
+
S({
|
|
1383
1391
|
failureCount: p,
|
|
1384
|
-
failureReason:
|
|
1392
|
+
failureReason: v
|
|
1385
1393
|
})
|
|
1386
1394
|
),
|
|
1387
|
-
catchError: (p,
|
|
1395
|
+
catchError: (p, v) => f(v, c, p).pipe(
|
|
1388
1396
|
g((O) => ({
|
|
1389
1397
|
...O,
|
|
1390
1398
|
result: void 0
|
|
@@ -1392,13 +1400,13 @@ const Kt = () => (s) => C(
|
|
|
1392
1400
|
)
|
|
1393
1401
|
}),
|
|
1394
1402
|
Ge(
|
|
1395
|
-
({ result: p, error:
|
|
1403
|
+
({ result: p, error: v }) => (p == null ? void 0 : p.data) === void 0 && v === void 0,
|
|
1396
1404
|
!0
|
|
1397
1405
|
)
|
|
1398
1406
|
);
|
|
1399
1407
|
return se.isOnline() || t.networkMode === "offlineFirst" ? F : F.pipe(Kt());
|
|
1400
1408
|
})
|
|
1401
|
-
), o =
|
|
1409
|
+
), o = S({
|
|
1402
1410
|
...e,
|
|
1403
1411
|
variables: s,
|
|
1404
1412
|
status: "pending",
|
|
@@ -1414,23 +1422,23 @@ const Kt = () => (s) => C(
|
|
|
1414
1422
|
h.pipe(
|
|
1415
1423
|
Q(({ result: c, error: b, ...F }) => {
|
|
1416
1424
|
if (!c && !b)
|
|
1417
|
-
return
|
|
1425
|
+
return S({
|
|
1418
1426
|
...F
|
|
1419
1427
|
});
|
|
1420
|
-
const p = b ?
|
|
1428
|
+
const p = b ? S(null) : U(
|
|
1421
1429
|
() => {
|
|
1422
|
-
var
|
|
1423
|
-
return (
|
|
1430
|
+
var V;
|
|
1431
|
+
return (V = t.onSuccess) == null ? void 0 : V.call(
|
|
1424
1432
|
t,
|
|
1425
1433
|
c == null ? void 0 : c.data,
|
|
1426
1434
|
s,
|
|
1427
1435
|
F.context
|
|
1428
1436
|
);
|
|
1429
1437
|
}
|
|
1430
|
-
), O =
|
|
1438
|
+
), O = U(
|
|
1431
1439
|
() => {
|
|
1432
|
-
var
|
|
1433
|
-
return (
|
|
1440
|
+
var V;
|
|
1441
|
+
return (V = t.onSettled) == null ? void 0 : V.call(
|
|
1434
1442
|
t,
|
|
1435
1443
|
c == null ? void 0 : c.data,
|
|
1436
1444
|
b,
|
|
@@ -1439,10 +1447,10 @@ const Kt = () => (s) => C(
|
|
|
1439
1447
|
);
|
|
1440
1448
|
}
|
|
1441
1449
|
).pipe(
|
|
1442
|
-
te((
|
|
1450
|
+
te((V) => c ? S(c) : S(V))
|
|
1443
1451
|
);
|
|
1444
|
-
return
|
|
1445
|
-
|
|
1452
|
+
return Te(p, O).pipe(
|
|
1453
|
+
ke(),
|
|
1446
1454
|
g(
|
|
1447
1455
|
() => b ? {
|
|
1448
1456
|
error: b,
|
|
@@ -1460,7 +1468,7 @@ const Kt = () => (s) => C(
|
|
|
1460
1468
|
}
|
|
1461
1469
|
),
|
|
1462
1470
|
te(
|
|
1463
|
-
(
|
|
1471
|
+
(V) => f(V, F.context, 0).pipe(
|
|
1464
1472
|
g((R) => ({
|
|
1465
1473
|
...R,
|
|
1466
1474
|
data: void 0
|
|
@@ -1477,13 +1485,13 @@ const Kt = () => (s) => C(
|
|
|
1477
1485
|
data: b.data ?? c.data,
|
|
1478
1486
|
error: b.error ?? c.error
|
|
1479
1487
|
}), ne()),
|
|
1480
|
-
|
|
1481
|
-
({ data: c, ...b }, { data: F, ...p }) =>
|
|
1488
|
+
A(
|
|
1489
|
+
({ data: c, ...b }, { data: F, ...p }) => I(b, p) && I(c, F)
|
|
1482
1490
|
)
|
|
1483
1491
|
);
|
|
1484
1492
|
};
|
|
1485
1493
|
var Fe, ee, pe;
|
|
1486
|
-
class
|
|
1494
|
+
class _s {
|
|
1487
1495
|
constructor({
|
|
1488
1496
|
options: e,
|
|
1489
1497
|
mutationCache: t,
|
|
@@ -1500,11 +1508,11 @@ class Ls {
|
|
|
1500
1508
|
this.options = e, this.state = r ?? this.state;
|
|
1501
1509
|
const n = a(this, pe).pipe(
|
|
1502
1510
|
Q(
|
|
1503
|
-
(u) =>
|
|
1511
|
+
(u) => Ls({
|
|
1504
1512
|
options: {
|
|
1505
1513
|
...this.options,
|
|
1506
1514
|
onMutate: (i) => {
|
|
1507
|
-
const l =
|
|
1515
|
+
const l = U(
|
|
1508
1516
|
() => {
|
|
1509
1517
|
var d, c;
|
|
1510
1518
|
return (c = (d = t.config).onMutate) == null ? void 0 : c.call(
|
|
@@ -1513,7 +1521,7 @@ class Ls {
|
|
|
1513
1521
|
this
|
|
1514
1522
|
);
|
|
1515
1523
|
}
|
|
1516
|
-
), h =
|
|
1524
|
+
), h = U(() => {
|
|
1517
1525
|
var d, c;
|
|
1518
1526
|
return (c = (d = this.options).onMutate) == null ? void 0 : c.call(d, i);
|
|
1519
1527
|
});
|
|
@@ -1522,7 +1530,7 @@ class Ls {
|
|
|
1522
1530
|
);
|
|
1523
1531
|
},
|
|
1524
1532
|
onError: (i, l, f) => {
|
|
1525
|
-
const h =
|
|
1533
|
+
const h = U(
|
|
1526
1534
|
() => {
|
|
1527
1535
|
var d, c;
|
|
1528
1536
|
return (c = (d = t.config).onError) == null ? void 0 : c.call(
|
|
@@ -1533,16 +1541,16 @@ class Ls {
|
|
|
1533
1541
|
this
|
|
1534
1542
|
);
|
|
1535
1543
|
}
|
|
1536
|
-
), o =
|
|
1544
|
+
), o = U(
|
|
1537
1545
|
() => {
|
|
1538
1546
|
var d, c;
|
|
1539
1547
|
return (c = (d = this.options).onError) == null ? void 0 : c.call(d, i, l, f);
|
|
1540
1548
|
}
|
|
1541
1549
|
);
|
|
1542
|
-
return
|
|
1550
|
+
return Te(h, o).pipe(ke());
|
|
1543
1551
|
},
|
|
1544
1552
|
onSettled: (i, l, f, h) => {
|
|
1545
|
-
const o =
|
|
1553
|
+
const o = U(
|
|
1546
1554
|
() => {
|
|
1547
1555
|
var c, b;
|
|
1548
1556
|
return (b = (c = t.config).onSettled) == null ? void 0 : b.call(
|
|
@@ -1554,16 +1562,16 @@ class Ls {
|
|
|
1554
1562
|
this
|
|
1555
1563
|
);
|
|
1556
1564
|
}
|
|
1557
|
-
), d =
|
|
1565
|
+
), d = U(
|
|
1558
1566
|
() => {
|
|
1559
1567
|
var c, b;
|
|
1560
1568
|
return (b = (c = this.options).onSettled) == null ? void 0 : b.call(c, i, l, f, h);
|
|
1561
1569
|
}
|
|
1562
1570
|
);
|
|
1563
|
-
return
|
|
1571
|
+
return Te(o, d).pipe(ke());
|
|
1564
1572
|
},
|
|
1565
1573
|
onSuccess: (i, l, f) => {
|
|
1566
|
-
const h =
|
|
1574
|
+
const h = U(
|
|
1567
1575
|
() => {
|
|
1568
1576
|
var d, c;
|
|
1569
1577
|
return (c = (d = t.config).onSuccess) == null ? void 0 : c.call(
|
|
@@ -1574,13 +1582,13 @@ class Ls {
|
|
|
1574
1582
|
this
|
|
1575
1583
|
);
|
|
1576
1584
|
}
|
|
1577
|
-
), o =
|
|
1585
|
+
), o = U(
|
|
1578
1586
|
() => {
|
|
1579
1587
|
var d, c;
|
|
1580
1588
|
return (c = (d = this.options).onSuccess) == null ? void 0 : c.call(d, i, l, f);
|
|
1581
1589
|
}
|
|
1582
1590
|
);
|
|
1583
|
-
return
|
|
1591
|
+
return Te(h, o).pipe(ke());
|
|
1584
1592
|
}
|
|
1585
1593
|
},
|
|
1586
1594
|
state: this.state,
|
|
@@ -1607,7 +1615,7 @@ class Ls {
|
|
|
1607
1615
|
* why we still cancel the observable when we remove it from cache)
|
|
1608
1616
|
*/
|
|
1609
1617
|
Ue({ bufferSize: 1, refCount: !1 }),
|
|
1610
|
-
|
|
1618
|
+
it((u) => {
|
|
1611
1619
|
a(this, Fe).next(u);
|
|
1612
1620
|
})
|
|
1613
1621
|
);
|
|
@@ -1635,7 +1643,7 @@ class Ls {
|
|
|
1635
1643
|
}
|
|
1636
1644
|
}
|
|
1637
1645
|
Fe = new WeakMap(), ee = new WeakMap(), pe = new WeakMap();
|
|
1638
|
-
const
|
|
1646
|
+
const wt = ({
|
|
1639
1647
|
mutationKey: s,
|
|
1640
1648
|
status: e,
|
|
1641
1649
|
predicate: t,
|
|
@@ -1696,13 +1704,13 @@ class Nt {
|
|
|
1696
1704
|
}
|
|
1697
1705
|
}
|
|
1698
1706
|
var K;
|
|
1699
|
-
class
|
|
1707
|
+
class Ws {
|
|
1700
1708
|
constructor(e = {}) {
|
|
1701
1709
|
w(this, K, new Nt());
|
|
1702
1710
|
this.config = e;
|
|
1703
1711
|
}
|
|
1704
1712
|
build(e, t, r) {
|
|
1705
|
-
const n = new
|
|
1713
|
+
const n = new _s({
|
|
1706
1714
|
mutationCache: this,
|
|
1707
1715
|
options: e.defaultMutationOptions(t),
|
|
1708
1716
|
state: r
|
|
@@ -1720,7 +1728,7 @@ class _s {
|
|
|
1720
1728
|
)
|
|
1721
1729
|
),
|
|
1722
1730
|
// defaults to 5mn
|
|
1723
|
-
Q(() =>
|
|
1731
|
+
Q(() => Qe(n.options.gcTime ?? 5 * 60 * 1e3)),
|
|
1724
1732
|
He(1)
|
|
1725
1733
|
).subscribe({
|
|
1726
1734
|
complete: () => {
|
|
@@ -1736,11 +1744,11 @@ class _s {
|
|
|
1736
1744
|
t == null || t.cancel(), a(this, K).remove(e);
|
|
1737
1745
|
}
|
|
1738
1746
|
find(e) {
|
|
1739
|
-
const t = { exact: !0, ...e }, r =
|
|
1747
|
+
const t = { exact: !0, ...e }, r = wt(t);
|
|
1740
1748
|
return a(this, K).getValues().find((n) => r(n));
|
|
1741
1749
|
}
|
|
1742
1750
|
findAll(e = {}) {
|
|
1743
|
-
const t = { exact: !0, ...e }, r =
|
|
1751
|
+
const t = { exact: !0, ...e }, r = wt(t);
|
|
1744
1752
|
return a(this, K).getValues().filter((n) => r(n)).map((n) => n);
|
|
1745
1753
|
}
|
|
1746
1754
|
observe() {
|
|
@@ -1801,8 +1809,8 @@ class _s {
|
|
|
1801
1809
|
}
|
|
1802
1810
|
}
|
|
1803
1811
|
K = new WeakMap();
|
|
1804
|
-
const
|
|
1805
|
-
function
|
|
1812
|
+
const Gs = typeof window > "u" || "Deno" in window;
|
|
1813
|
+
function Js(s) {
|
|
1806
1814
|
const e = typeof s.initialData == "function" ? s.initialData() : s.initialData, t = typeof e < "u", r = t ? typeof s.initialDataUpdatedAt == "function" ? s.initialDataUpdatedAt() : s.initialDataUpdatedAt : 0;
|
|
1807
1815
|
return {
|
|
1808
1816
|
data: e,
|
|
@@ -1819,33 +1827,33 @@ function Gs(s) {
|
|
|
1819
1827
|
fetchStatus: "idle"
|
|
1820
1828
|
};
|
|
1821
1829
|
}
|
|
1822
|
-
const
|
|
1830
|
+
const Ys = (s) => Ae(() => Le.isFocused() ? s : Le.focusRegained$.pipe(H(() => s))), Bs = (s) => {
|
|
1823
1831
|
let e = 0;
|
|
1824
1832
|
return (t) => {
|
|
1825
1833
|
const r = se.backToOnline$.pipe(
|
|
1826
1834
|
H(
|
|
1827
1835
|
() => C(
|
|
1828
|
-
|
|
1836
|
+
S({ fetchStatus: "fetching" }),
|
|
1829
1837
|
t
|
|
1830
1838
|
)
|
|
1831
1839
|
)
|
|
1832
1840
|
);
|
|
1833
|
-
return
|
|
1834
|
-
|
|
1841
|
+
return Ae(() => (e++, !se.isOnline() && s.networkMode === "offlineFirst" && e > 1 ? C(
|
|
1842
|
+
S({ fetchStatus: "paused" }),
|
|
1835
1843
|
r
|
|
1836
1844
|
) : !se.isOnline() && s.networkMode !== "always" && s.networkMode !== "offlineFirst" ? C(
|
|
1837
|
-
|
|
1845
|
+
S({ fetchStatus: "paused" }),
|
|
1838
1846
|
r
|
|
1839
1847
|
) : t));
|
|
1840
1848
|
};
|
|
1841
|
-
},
|
|
1849
|
+
}, Xs = (s) => (e) => {
|
|
1842
1850
|
const t = new P(), r = t.pipe(
|
|
1843
1851
|
st(),
|
|
1844
1852
|
/**
|
|
1845
1853
|
* Since we set hasDataSubject synchronously, we need to wait
|
|
1846
1854
|
* for the next tick to make sure observable chain received this data at least
|
|
1847
1855
|
*/
|
|
1848
|
-
|
|
1856
|
+
rt(1),
|
|
1849
1857
|
H(() => s.pipe($((n) => n === 0)))
|
|
1850
1858
|
);
|
|
1851
1859
|
return e.pipe(
|
|
@@ -1854,7 +1862,7 @@ const Js = (s) => Qe(() => Le.isFocused() ? s : Le.focusRegained$.pipe(H(() => s
|
|
|
1854
1862
|
}),
|
|
1855
1863
|
B(r)
|
|
1856
1864
|
);
|
|
1857
|
-
},
|
|
1865
|
+
}, Zs = (s) => {
|
|
1858
1866
|
const e = async () => await Promise.reject(new Error("No query found"));
|
|
1859
1867
|
let t = !1;
|
|
1860
1868
|
const r = s.queryFn ?? e, n = new AbortController(), u = {
|
|
@@ -1869,14 +1877,14 @@ const Js = (s) => Qe(() => Le.isFocused() ? s : Le.focusRegained$.pipe(H(() => s
|
|
|
1869
1877
|
})(u);
|
|
1870
1878
|
const f = (typeof r == "function" ? (
|
|
1871
1879
|
// eslint-disable-next-line @typescript-eslint/promise-function-async
|
|
1872
|
-
|
|
1880
|
+
U(
|
|
1873
1881
|
() => r(u)
|
|
1874
1882
|
)
|
|
1875
1883
|
) : r).pipe(
|
|
1876
|
-
|
|
1884
|
+
Xs(s.observers$),
|
|
1877
1885
|
E({
|
|
1878
1886
|
complete: () => {
|
|
1879
|
-
|
|
1887
|
+
t = !0;
|
|
1880
1888
|
}
|
|
1881
1889
|
}),
|
|
1882
1890
|
g(
|
|
@@ -1885,11 +1893,11 @@ const Js = (s) => Qe(() => Le.isFocused() ? s : Le.focusRegained$.pipe(H(() => s
|
|
|
1885
1893
|
})
|
|
1886
1894
|
),
|
|
1887
1895
|
// takeUntil(hasDataAndNoObservers$),
|
|
1888
|
-
|
|
1889
|
-
|
|
1896
|
+
Bs(s),
|
|
1897
|
+
At({
|
|
1890
1898
|
...s,
|
|
1891
|
-
retryAfter: () =>
|
|
1892
|
-
catchError: (o, d) =>
|
|
1899
|
+
retryAfter: () => S(!0).pipe(Ys),
|
|
1900
|
+
catchError: (o, d) => S({
|
|
1893
1901
|
status: "error",
|
|
1894
1902
|
fetchStatus: "idle",
|
|
1895
1903
|
fetchFailureCount: o,
|
|
@@ -1898,13 +1906,13 @@ const Js = (s) => Qe(() => Le.isFocused() ? s : Le.focusRegained$.pipe(H(() => s
|
|
|
1898
1906
|
}),
|
|
1899
1907
|
caughtError: (o, d) => (
|
|
1900
1908
|
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
1901
|
-
|
|
1909
|
+
S({
|
|
1902
1910
|
fetchFailureCount: o,
|
|
1903
1911
|
fetchFailureReason: d
|
|
1904
1912
|
})
|
|
1905
1913
|
)
|
|
1906
1914
|
}),
|
|
1907
|
-
H((o) => "data" in o ?
|
|
1915
|
+
H((o) => "data" in o ? S({
|
|
1908
1916
|
...o,
|
|
1909
1917
|
status: "success",
|
|
1910
1918
|
fetchStatus: "idle",
|
|
@@ -1927,11 +1935,11 @@ const Js = (s) => Qe(() => Le.isFocused() ? s : Le.focusRegained$.pipe(H(() => s
|
|
|
1927
1935
|
*
|
|
1928
1936
|
* There is in theory no problem associated to that.
|
|
1929
1937
|
*/
|
|
1930
|
-
|
|
1938
|
+
rt(1),
|
|
1931
1939
|
g(
|
|
1932
1940
|
(d) => t ? d : { ...d, fetchStatus: "fetching" }
|
|
1933
1941
|
)
|
|
1934
|
-
) :
|
|
1942
|
+
) : S(o)),
|
|
1935
1943
|
/**
|
|
1936
1944
|
* When the fn complete we can release the fetch status, if it was already released
|
|
1937
1945
|
* before shallow compare will not update the state, otherwise it's our chance to catch
|
|
@@ -1939,7 +1947,7 @@ const Js = (s) => Qe(() => Le.isFocused() ? s : Le.focusRegained$.pipe(H(() => s
|
|
|
1939
1947
|
*/
|
|
1940
1948
|
us({ fetchStatus: "idle" }),
|
|
1941
1949
|
fe()
|
|
1942
|
-
), h =
|
|
1950
|
+
), h = S({
|
|
1943
1951
|
status: "pending",
|
|
1944
1952
|
fetchStatus: se.isOnline() ? "fetching" : "paused"
|
|
1945
1953
|
});
|
|
@@ -1952,14 +1960,14 @@ const Js = (s) => Qe(() => Le.isFocused() ? s : Le.focusRegained$.pipe(H(() => s
|
|
|
1952
1960
|
abortController: n
|
|
1953
1961
|
};
|
|
1954
1962
|
};
|
|
1955
|
-
class
|
|
1963
|
+
class er {
|
|
1956
1964
|
constructor(e) {
|
|
1957
1965
|
y(this, "revert");
|
|
1958
1966
|
y(this, "silent");
|
|
1959
1967
|
this.revert = e == null ? void 0 : e.revert, this.silent = e == null ? void 0 : e.silent;
|
|
1960
1968
|
}
|
|
1961
1969
|
}
|
|
1962
|
-
const
|
|
1970
|
+
const tr = { backgroundColor: "transparent", color: "inherit" };
|
|
1963
1971
|
function Ht(s) {
|
|
1964
1972
|
const e = {
|
|
1965
1973
|
namespaces: [
|
|
@@ -1972,7 +1980,7 @@ function Ht(s) {
|
|
|
1972
1980
|
const n = Ht(s);
|
|
1973
1981
|
return n.namespaces.push({
|
|
1974
1982
|
name: t,
|
|
1975
|
-
style: r ??
|
|
1983
|
+
style: r ?? tr
|
|
1976
1984
|
}), n;
|
|
1977
1985
|
},
|
|
1978
1986
|
printNamespaces() {
|
|
@@ -2011,9 +2019,9 @@ function Ht(s) {
|
|
|
2011
2019
|
};
|
|
2012
2020
|
return e;
|
|
2013
2021
|
}
|
|
2014
|
-
const
|
|
2022
|
+
const sr = Ht("production");
|
|
2015
2023
|
var Ee, ae;
|
|
2016
|
-
class
|
|
2024
|
+
class rr {
|
|
2017
2025
|
constructor(e) {
|
|
2018
2026
|
y(this, "queryKey");
|
|
2019
2027
|
y(this, "queryHash");
|
|
@@ -2034,7 +2042,7 @@ class sr {
|
|
|
2034
2042
|
y(this, "observerCount$", this.observersSubject.asObservable().pipe(g((e) => e.length)));
|
|
2035
2043
|
y(this, "observers$", this.observersSubject.asObservable());
|
|
2036
2044
|
y(this, "state$");
|
|
2037
|
-
M(this, Ee, e.defaultOptions), this.options = this.setOptions(e.options), this.queryKey = e.queryKey, this.queryHash = e.queryHash, M(this, ae, e.state ??
|
|
2045
|
+
M(this, Ee, e.defaultOptions), this.options = this.setOptions(e.options), this.queryKey = e.queryKey, this.queryHash = e.queryHash, M(this, ae, e.state ?? Js(this.options)), this.state = a(this, ae), this.gcTime = this.updateGcTime(this.options.gcTime), this.state$ = C(
|
|
2038
2046
|
this.resetSubject.pipe(
|
|
2039
2047
|
g(() => ({ command: "reset", state: a(this, ae) }))
|
|
2040
2048
|
),
|
|
@@ -2054,7 +2062,7 @@ class sr {
|
|
|
2054
2062
|
state: {
|
|
2055
2063
|
status: t != null && t.revert ? this.state.status : "error",
|
|
2056
2064
|
fetchStatus: "idle",
|
|
2057
|
-
error: new
|
|
2065
|
+
error: new er(t)
|
|
2058
2066
|
}
|
|
2059
2067
|
}))
|
|
2060
2068
|
),
|
|
@@ -2066,12 +2074,12 @@ class sr {
|
|
|
2066
2074
|
// in case we don't cancel
|
|
2067
2075
|
$((h) => (h == null ? void 0 : h.cancelRefetch) !== !1)
|
|
2068
2076
|
), n = this.observers$.pipe(
|
|
2069
|
-
|
|
2077
|
+
xt(),
|
|
2070
2078
|
E(([h, o]) => {
|
|
2071
2079
|
o.length === 0 && h.length > 0 ? t = !0 : t = !1;
|
|
2072
2080
|
}),
|
|
2073
2081
|
he()
|
|
2074
|
-
), { state$: u, abortController: i } =
|
|
2082
|
+
), { state$: u, abortController: i } = Zs({
|
|
2075
2083
|
...this.options,
|
|
2076
2084
|
observers$: this.observerCount$,
|
|
2077
2085
|
queryKey: this.queryKey,
|
|
@@ -2124,12 +2132,12 @@ class sr {
|
|
|
2124
2132
|
getState: () => this.state
|
|
2125
2133
|
}),
|
|
2126
2134
|
oe(a(this, ae)),
|
|
2127
|
-
|
|
2135
|
+
A(I),
|
|
2128
2136
|
E((t) => {
|
|
2129
2137
|
this.state = t;
|
|
2130
2138
|
}),
|
|
2131
2139
|
te((t) => {
|
|
2132
|
-
throw
|
|
2140
|
+
throw sr.error(t), t;
|
|
2133
2141
|
}),
|
|
2134
2142
|
B(this.destroySubject),
|
|
2135
2143
|
Ue({ bufferSize: 1, refCount: !1 })
|
|
@@ -2144,21 +2152,21 @@ class sr {
|
|
|
2144
2152
|
get success$() {
|
|
2145
2153
|
return this.state$.pipe(
|
|
2146
2154
|
g(({ data: e, status: t }) => ({ data: e, status: t })),
|
|
2147
|
-
|
|
2155
|
+
A(I),
|
|
2148
2156
|
$(({ status: e }) => e === "success")
|
|
2149
2157
|
);
|
|
2150
2158
|
}
|
|
2151
2159
|
get error$() {
|
|
2152
2160
|
return this.state$.pipe(
|
|
2153
2161
|
g(({ error: e, status: t }) => ({ error: e, status: t })),
|
|
2154
|
-
|
|
2162
|
+
A(I),
|
|
2155
2163
|
$(({ status: e }) => e === "error")
|
|
2156
2164
|
);
|
|
2157
2165
|
}
|
|
2158
2166
|
get settled$() {
|
|
2159
2167
|
return this.state$.pipe(
|
|
2160
2168
|
g(({ status: e }) => ({ status: e })),
|
|
2161
|
-
|
|
2169
|
+
A(I),
|
|
2162
2170
|
$(({ status: e }) => e === "success" || e === "error")
|
|
2163
2171
|
);
|
|
2164
2172
|
}
|
|
@@ -2186,7 +2194,7 @@ class sr {
|
|
|
2186
2194
|
updateGcTime(e) {
|
|
2187
2195
|
return this.gcTime = Math.max(
|
|
2188
2196
|
this.gcTime || 0,
|
|
2189
|
-
e ?? (
|
|
2197
|
+
e ?? (Gs ? 1 / 0 : 5 * 60 * 1e3)
|
|
2190
2198
|
), this.gcTime;
|
|
2191
2199
|
}
|
|
2192
2200
|
isActive() {
|
|
@@ -2199,7 +2207,7 @@ class sr {
|
|
|
2199
2207
|
return this.state.isInvalidated || !this.state.dataUpdatedAt || this.observersSubject.getValue().some((e) => e.getCurrentResult().isStale);
|
|
2200
2208
|
}
|
|
2201
2209
|
isStaleByTime(e = 0) {
|
|
2202
|
-
return this.state.isInvalidated || !this.state.dataUpdatedAt || !
|
|
2210
|
+
return this.state.isInvalidated || !this.state.dataUpdatedAt || !As(this.state.dataUpdatedAt, e);
|
|
2203
2211
|
}
|
|
2204
2212
|
async getFetchResultAsPromise() {
|
|
2205
2213
|
return await new Promise((e, t) => {
|
|
@@ -2236,7 +2244,7 @@ class sr {
|
|
|
2236
2244
|
}
|
|
2237
2245
|
Ee = new WeakMap(), ae = new WeakMap();
|
|
2238
2246
|
var xe, G;
|
|
2239
|
-
class
|
|
2247
|
+
class nr {
|
|
2240
2248
|
// protected mountSubscriptions: Subscription[]
|
|
2241
2249
|
constructor(e = {}) {
|
|
2242
2250
|
// readonly #queries: QueryStore = new Map<string, Query>()
|
|
@@ -2259,7 +2267,7 @@ class rr {
|
|
|
2259
2267
|
...e,
|
|
2260
2268
|
fetchStatus: "fetching"
|
|
2261
2269
|
}).length),
|
|
2262
|
-
|
|
2270
|
+
A()
|
|
2263
2271
|
);
|
|
2264
2272
|
}
|
|
2265
2273
|
getAll() {
|
|
@@ -2267,12 +2275,12 @@ class rr {
|
|
|
2267
2275
|
}
|
|
2268
2276
|
findAll(e = {}) {
|
|
2269
2277
|
const t = this.getAll();
|
|
2270
|
-
return Object.keys(e).length > 0 ? t.filter((r) =>
|
|
2278
|
+
return Object.keys(e).length > 0 ? t.filter((r) => $t(e, r)) : t;
|
|
2271
2279
|
}
|
|
2272
2280
|
build(e, t, r) {
|
|
2273
|
-
const n = t.queryKey ?? [
|
|
2281
|
+
const n = t.queryKey ?? [nt()], u = t.queryHash ?? at(n, t);
|
|
2274
2282
|
let i = this.get(u);
|
|
2275
|
-
return i || (i = new
|
|
2283
|
+
return i || (i = new rr({
|
|
2276
2284
|
cache: this,
|
|
2277
2285
|
queryKey: n,
|
|
2278
2286
|
queryHash: u,
|
|
@@ -2310,7 +2318,7 @@ class rr {
|
|
|
2310
2318
|
Ps,
|
|
2311
2319
|
Q((r) => r ? t.pipe(
|
|
2312
2320
|
// defaults to 5mn
|
|
2313
|
-
Q(() => e.gcTime === 1 / 0 ? Oe : (setTimeout(N, e.gcTime),
|
|
2321
|
+
Q(() => e.gcTime === 1 / 0 ? Oe : (setTimeout(N, e.gcTime), Qe(e.gcTime)))
|
|
2314
2322
|
) : Oe),
|
|
2315
2323
|
He(1)
|
|
2316
2324
|
).subscribe({
|
|
@@ -2326,7 +2334,7 @@ class rr {
|
|
|
2326
2334
|
find(e) {
|
|
2327
2335
|
const t = { exact: !0, ...e };
|
|
2328
2336
|
return this.getAll().find(
|
|
2329
|
-
(r) =>
|
|
2337
|
+
(r) => $t(t, r)
|
|
2330
2338
|
);
|
|
2331
2339
|
}
|
|
2332
2340
|
subscribe(e) {
|
|
@@ -2369,7 +2377,7 @@ class rr {
|
|
|
2369
2377
|
}
|
|
2370
2378
|
xe = new WeakMap(), G = new WeakMap();
|
|
2371
2379
|
var ce, j, Re, Me, je;
|
|
2372
|
-
class
|
|
2380
|
+
class wr {
|
|
2373
2381
|
// #destroy = () => {}
|
|
2374
2382
|
constructor({
|
|
2375
2383
|
mutationCache: e,
|
|
@@ -2381,7 +2389,7 @@ class $r {
|
|
|
2381
2389
|
w(this, Re, /* @__PURE__ */ new Map());
|
|
2382
2390
|
w(this, Me, /* @__PURE__ */ new Map());
|
|
2383
2391
|
w(this, je, void 0);
|
|
2384
|
-
M(this, ce, e ?? new
|
|
2392
|
+
M(this, ce, e ?? new Ws()), M(this, j, t ?? new nr()), M(this, je, r ?? {});
|
|
2385
2393
|
}
|
|
2386
2394
|
mount() {
|
|
2387
2395
|
}
|
|
@@ -2408,7 +2416,7 @@ class $r {
|
|
|
2408
2416
|
...e,
|
|
2409
2417
|
_defaulted: !0
|
|
2410
2418
|
};
|
|
2411
|
-
return t.queryHash || (t.queryHash =
|
|
2419
|
+
return t.queryHash || (t.queryHash = at(
|
|
2412
2420
|
t.queryKey,
|
|
2413
2421
|
t
|
|
2414
2422
|
)), 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;
|
|
@@ -2447,7 +2455,7 @@ class $r {
|
|
|
2447
2455
|
return (r = a(this, j).get(t.queryHash)) == null ? void 0 : r.state.data;
|
|
2448
2456
|
}
|
|
2449
2457
|
setQueryData(e, t, r) {
|
|
2450
|
-
const n = a(this, j).find({ queryKey: e }), u = n == null ? void 0 : n.state.data, i =
|
|
2458
|
+
const n = a(this, j).find({ queryKey: e }), u = n == null ? void 0 : n.state.data, i = Qs(t, u);
|
|
2451
2459
|
if (typeof i > "u")
|
|
2452
2460
|
return;
|
|
2453
2461
|
const l = this.defaultQueryOptions({ queryKey: e });
|
|
@@ -2520,30 +2528,30 @@ class $r {
|
|
|
2520
2528
|
}
|
|
2521
2529
|
ce = new WeakMap(), j = new WeakMap(), Re = new WeakMap(), Me = new WeakMap(), je = new WeakMap();
|
|
2522
2530
|
export {
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
|
|
2526
|
-
|
|
2531
|
+
Ws as MutationCache,
|
|
2532
|
+
nr as QueryCache,
|
|
2533
|
+
wr as QueryClient,
|
|
2534
|
+
mr as QueryClientProvider,
|
|
2527
2535
|
ys as SIGNAL_RESET,
|
|
2528
|
-
|
|
2529
|
-
|
|
2536
|
+
yr as createLocalforageAdapter,
|
|
2537
|
+
pr as createSharedStoreAdapter,
|
|
2530
2538
|
Os as exponentialBackoffDelay,
|
|
2531
2539
|
vs as getDelay,
|
|
2532
|
-
|
|
2533
|
-
|
|
2534
|
-
|
|
2540
|
+
bt as isDefined,
|
|
2541
|
+
At as retryBackoff,
|
|
2542
|
+
fr as signal,
|
|
2535
2543
|
ps as useBehaviorSubject,
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
|
|
2544
|
+
Or as useForeverQuery,
|
|
2545
|
+
T as useLiveRef,
|
|
2546
|
+
Sr as useMutation,
|
|
2547
|
+
hr as useObservableState,
|
|
2540
2548
|
Je as useObserve,
|
|
2541
|
-
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
|
|
2549
|
+
lr as useObserveCallback,
|
|
2550
|
+
br as usePersistSignals,
|
|
2551
|
+
vr as useQuery,
|
|
2552
|
+
dr as useSignalValue,
|
|
2545
2553
|
jt as useSubject,
|
|
2546
2554
|
Mt as useSubscribe,
|
|
2547
|
-
|
|
2548
|
-
|
|
2555
|
+
$r as useSubscribeEffect,
|
|
2556
|
+
gr as useUnmountObservable
|
|
2549
2557
|
};
|