reactjrx 1.89.0 → 1.90.1
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,6 +1,6 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var m = (s, e, t) => (
|
|
1
|
+
var Jt = Object.defineProperty;
|
|
2
|
+
var Yt = (s, e, t) => e in s ? Jt(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
|
|
3
|
+
var m = (s, e, t) => (Yt(s, typeof e != "symbol" ? e + "" : e, t), t), yt = (s, e, t) => {
|
|
4
4
|
if (!e.has(s))
|
|
5
5
|
throw TypeError("Cannot " + t);
|
|
6
6
|
};
|
|
@@ -10,17 +10,17 @@ var a = (s, e, t) => (yt(s, e, "read from private field"), t ? t.call(s) : e.get
|
|
|
10
10
|
e instanceof WeakSet ? e.add(s) : e.set(s, t);
|
|
11
11
|
}, M = (s, e, t, r) => (yt(s, e, "write to private field"), r ? r.call(s, t) : e.set(s, t), t);
|
|
12
12
|
import * as Ge from "react";
|
|
13
|
-
import { useRef as me, useMemo as ut, useCallback as le, useSyncExternalStore as
|
|
14
|
-
import { distinctUntilChanged as Q, tap as E, catchError as X, EMPTY as Z, isObservable as bt, from as Se, of as v, defer as Ae, Subject as I, BehaviorSubject as Y, skip as at, first as Je, map as g, switchMap as x, zip as
|
|
15
|
-
import { catchError as mt, mergeMap as tt, retryWhen as
|
|
16
|
-
import { jsxs as
|
|
13
|
+
import { useRef as me, useMemo as ut, useCallback as le, useSyncExternalStore as Bt, useEffect as J, createContext as Xt, memo as Zt, useContext as es, useState as Rt } from "react";
|
|
14
|
+
import { distinctUntilChanged as Q, tap as E, catchError as X, EMPTY as Z, isObservable as bt, from as Se, of as v, defer as Ae, Subject as I, BehaviorSubject as Y, skip as at, first as Je, map as g, switchMap as x, zip as ts, filter as O, merge as F, throttleTime as ss, asyncScheduler as rs, throwError as Oe, timer as Qe, Observable as ns, takeWhile as Ye, concatMap as is, last as Ke, mergeMap as N, takeUntil as ne, identity as jt, shareReplay as Ue, ignoreElements as he, scan as Be, fromEvent as Ne, noop as K, startWith as ce, pairwise as Mt, NEVER as qe, delay as ot, interval as us, withLatestFrom as gt, retry as as, iif as os, concat as ke, toArray as Te, share as de, take as He, combineLatest as cs, endWith as ls, lastValueFrom as hs } from "rxjs";
|
|
15
|
+
import { catchError as mt, mergeMap as tt, retryWhen as ds, concatMap as fs, first as ps, tap as At } from "rxjs/operators";
|
|
16
|
+
import { jsxs as ys, jsx as bs } from "react/jsx-runtime";
|
|
17
17
|
const q = (s) => {
|
|
18
18
|
const e = me(s);
|
|
19
19
|
return ut(() => {
|
|
20
20
|
e.current = s;
|
|
21
21
|
}, [s]), e;
|
|
22
22
|
};
|
|
23
|
-
function
|
|
23
|
+
function gs(s, e) {
|
|
24
24
|
return typeof s == "string" && s === e || typeof s == "number" && s === e || typeof s == "boolean" && s === e || typeof s == "symbol" && s === e || typeof s == "bigint" && s === e || typeof s > "u" && s === e || s === null && s === e;
|
|
25
25
|
}
|
|
26
26
|
function Xe(s, e, t) {
|
|
@@ -38,7 +38,7 @@ function Xe(s, e, t) {
|
|
|
38
38
|
* be using objects and keeping same reference but pushing new
|
|
39
39
|
* properties values
|
|
40
40
|
*/
|
|
41
|
-
Q(
|
|
41
|
+
Q(gs),
|
|
42
42
|
E((b) => {
|
|
43
43
|
u.current = b;
|
|
44
44
|
}),
|
|
@@ -51,7 +51,7 @@ function Xe(s, e, t) {
|
|
|
51
51
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
52
52
|
[...n]
|
|
53
53
|
), h = le(() => u.current, []);
|
|
54
|
-
return
|
|
54
|
+
return Bt(l, h, h);
|
|
55
55
|
}
|
|
56
56
|
function St(s) {
|
|
57
57
|
return s instanceof Promise || s && typeof s.then == "function" && typeof s.catch == "function";
|
|
@@ -69,7 +69,7 @@ function U(s) {
|
|
|
69
69
|
return St(t) ? Se(t) : bt(t) ? t : v(t);
|
|
70
70
|
});
|
|
71
71
|
}
|
|
72
|
-
function
|
|
72
|
+
function Qt(s, e = []) {
|
|
73
73
|
const t = q(s);
|
|
74
74
|
J(() => {
|
|
75
75
|
const r = U(t.current).subscribe();
|
|
@@ -87,7 +87,7 @@ const Ze = (s) => {
|
|
|
87
87
|
return e.current || (e.current = s()), J(() => {
|
|
88
88
|
process.env.NODE_ENV;
|
|
89
89
|
}, []), e;
|
|
90
|
-
},
|
|
90
|
+
}, Ut = ({
|
|
91
91
|
onBeforeComplete: s,
|
|
92
92
|
completeOnUnmount: e = !0
|
|
93
93
|
} = {}) => {
|
|
@@ -100,7 +100,7 @@ const Ze = (s) => {
|
|
|
100
100
|
r.current || (n.current != null && n.current(), t.current.complete(), r.current = !0);
|
|
101
101
|
}), [u, n, t]), t;
|
|
102
102
|
}, pr = () => {
|
|
103
|
-
const s =
|
|
103
|
+
const s = Ut(), e = q(s.current.asObservable()), t = le(
|
|
104
104
|
(r) => {
|
|
105
105
|
s.current.next(r);
|
|
106
106
|
},
|
|
@@ -108,13 +108,13 @@ const Ze = (s) => {
|
|
|
108
108
|
[]
|
|
109
109
|
);
|
|
110
110
|
return [e.current, t];
|
|
111
|
-
},
|
|
111
|
+
}, It = (s) => {
|
|
112
112
|
const e = Ze(() => new Y(s)), t = me(!1), r = me(s);
|
|
113
113
|
return J(() => (t.current && (e.current = new Y(r.current), t.current = !1), () => {
|
|
114
114
|
t.current || (e.current.complete(), t.current = !0);
|
|
115
115
|
}), [e]), e;
|
|
116
116
|
}, yr = (s) => {
|
|
117
|
-
const e =
|
|
117
|
+
const e = It(s), t = q(e.current.asObservable()), r = le(
|
|
118
118
|
(n) => {
|
|
119
119
|
e.current.next(n);
|
|
120
120
|
},
|
|
@@ -122,7 +122,7 @@ const Ze = (s) => {
|
|
|
122
122
|
[e.current]
|
|
123
123
|
);
|
|
124
124
|
return [t.current, r, e.current.getValue()];
|
|
125
|
-
},
|
|
125
|
+
}, ms = Symbol("SIGNAL_RESET");
|
|
126
126
|
function br(s = {}) {
|
|
127
127
|
const e = {
|
|
128
128
|
default: s.default,
|
|
@@ -135,7 +135,7 @@ function br(s = {}) {
|
|
|
135
135
|
r.next(c);
|
|
136
136
|
return;
|
|
137
137
|
}
|
|
138
|
-
if (i ===
|
|
138
|
+
if (i === ms) {
|
|
139
139
|
r.next(t ?? void 0);
|
|
140
140
|
return;
|
|
141
141
|
}
|
|
@@ -189,7 +189,7 @@ const mr = (s) => ({
|
|
|
189
189
|
}), st = (s) => {
|
|
190
190
|
if (!(!s || typeof s != "object"))
|
|
191
191
|
return s;
|
|
192
|
-
},
|
|
192
|
+
}, Ss = ({
|
|
193
193
|
adapter: s,
|
|
194
194
|
key: e
|
|
195
195
|
}) => ({
|
|
@@ -207,10 +207,10 @@ const mr = (s) => ({
|
|
|
207
207
|
const n = await s.getItem(e), u = st(n) ?? {};
|
|
208
208
|
await s.setItem(e, { ...u, [t]: r });
|
|
209
209
|
}
|
|
210
|
-
}),
|
|
210
|
+
}), vs = ({
|
|
211
211
|
key: s
|
|
212
|
-
} = {}) => s ?
|
|
213
|
-
adapter:
|
|
212
|
+
} = {}) => s ? Ss({
|
|
213
|
+
adapter: vs(),
|
|
214
214
|
key: s
|
|
215
215
|
}) : {
|
|
216
216
|
clear: async () => {
|
|
@@ -227,7 +227,7 @@ const mr = (s) => ({
|
|
|
227
227
|
setItem: async (e, t) => {
|
|
228
228
|
localStorage.setItem(e, JSON.stringify(t));
|
|
229
229
|
}
|
|
230
|
-
}, $e = "__reactjrx",
|
|
230
|
+
}, $e = "__reactjrx", Os = (s) => {
|
|
231
231
|
if (typeof s == "object" && s !== null && $e in s && s[$e] === $e)
|
|
232
232
|
return s;
|
|
233
233
|
};
|
|
@@ -235,74 +235,68 @@ function rt(s) {
|
|
|
235
235
|
return s != null;
|
|
236
236
|
}
|
|
237
237
|
const vt = (s) => {
|
|
238
|
-
const e =
|
|
238
|
+
const e = It(s);
|
|
239
239
|
return J(() => {
|
|
240
240
|
e.current.next(s);
|
|
241
241
|
}, [s, e]), e;
|
|
242
|
-
},
|
|
242
|
+
}, $s = ({
|
|
243
243
|
adapter: s,
|
|
244
|
-
|
|
245
|
-
version: t
|
|
244
|
+
config: e
|
|
246
245
|
}) => {
|
|
247
|
-
const
|
|
248
|
-
value:
|
|
246
|
+
const { signal: t, version: r } = e, u = {
|
|
247
|
+
value: t.getValue(),
|
|
249
248
|
[$e]: $e,
|
|
250
|
-
migrationVersion:
|
|
249
|
+
migrationVersion: r
|
|
251
250
|
};
|
|
252
|
-
return Se(s.setItem(
|
|
253
|
-
X((
|
|
251
|
+
return Se(s.setItem(t.config.key, u)).pipe(
|
|
252
|
+
X((i) => (console.error(i), v(null)))
|
|
254
253
|
);
|
|
255
|
-
}
|
|
254
|
+
};
|
|
255
|
+
function ws({
|
|
256
256
|
adapter: s,
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
}) =>
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
257
|
+
config: e
|
|
258
|
+
}) {
|
|
259
|
+
const { hydrate: t = ({ value: u }) => u, signal: r, version: n } = e;
|
|
260
|
+
return Se(s.getItem(r.config.key)).pipe(
|
|
261
|
+
x((u) => {
|
|
262
|
+
const i = Os(u);
|
|
263
|
+
if (!i)
|
|
264
|
+
return v(u);
|
|
265
|
+
if (i.migrationVersion !== void 0 && n > i.migrationVersion || i.value === void 0)
|
|
266
|
+
return v(u);
|
|
267
|
+
const c = i.value;
|
|
268
|
+
return r.setValue(t({ value: c, version: n })), v(u);
|
|
269
|
+
})
|
|
270
|
+
);
|
|
271
|
+
}
|
|
272
|
+
function Sr({
|
|
265
273
|
entries: s = [],
|
|
266
274
|
onReady: e,
|
|
267
275
|
adapter: t
|
|
268
|
-
})
|
|
276
|
+
}) {
|
|
269
277
|
const r = q(s), n = q(e), u = vt(t), i = Xe(
|
|
270
278
|
() => {
|
|
271
279
|
const l = r.current;
|
|
272
280
|
return u.current.pipe(
|
|
273
|
-
x((h) =>
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
signal: p,
|
|
287
|
-
version: d
|
|
288
|
-
})
|
|
289
|
-
)
|
|
290
|
-
)
|
|
291
|
-
)
|
|
292
|
-
).pipe(g(() => !0));
|
|
293
|
-
return F(v(!1), o).pipe(
|
|
294
|
-
E(() => {
|
|
295
|
-
n.current != null && n.current();
|
|
296
|
-
}),
|
|
297
|
-
X((p) => (console.error("Unable to hydrate", p), Z))
|
|
298
|
-
);
|
|
299
|
-
})
|
|
281
|
+
x((h) => (l.length === 0 || !h ? v(!0) : ts(
|
|
282
|
+
...l.map(
|
|
283
|
+
(p) => ws({
|
|
284
|
+
adapter: h,
|
|
285
|
+
config: p
|
|
286
|
+
})
|
|
287
|
+
)
|
|
288
|
+
).pipe(g(() => !0))).pipe(
|
|
289
|
+
E(() => {
|
|
290
|
+
n.current != null && n.current();
|
|
291
|
+
}),
|
|
292
|
+
X((p) => (console.error("Unable to hydrate", p), Z))
|
|
293
|
+
))
|
|
300
294
|
);
|
|
301
295
|
},
|
|
302
296
|
{ defaultValue: !1 },
|
|
303
297
|
[u, r]
|
|
304
298
|
), c = vt(i);
|
|
305
|
-
return
|
|
299
|
+
return Qt(
|
|
306
300
|
() => c.current.pipe(
|
|
307
301
|
O((l) => l),
|
|
308
302
|
x(() => u.current),
|
|
@@ -310,17 +304,18 @@ const vt = (s) => {
|
|
|
310
304
|
x(
|
|
311
305
|
(l) => F(
|
|
312
306
|
...r.current.map(
|
|
313
|
-
(
|
|
314
|
-
|
|
307
|
+
(h) => h.signal.subject.pipe(
|
|
308
|
+
ss(500, rs, {
|
|
315
309
|
trailing: !0
|
|
316
310
|
}),
|
|
317
|
-
x(
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
311
|
+
x(
|
|
312
|
+
() => Se(
|
|
313
|
+
$s({
|
|
314
|
+
adapter: l,
|
|
315
|
+
config: h
|
|
316
|
+
})
|
|
317
|
+
)
|
|
318
|
+
)
|
|
324
319
|
)
|
|
325
320
|
)
|
|
326
321
|
)
|
|
@@ -328,8 +323,9 @@ const vt = (s) => {
|
|
|
328
323
|
),
|
|
329
324
|
[c, u]
|
|
330
325
|
), { isHydrated: i };
|
|
331
|
-
}
|
|
332
|
-
|
|
326
|
+
}
|
|
327
|
+
const vr = () => {
|
|
328
|
+
const s = Ut({
|
|
333
329
|
onBeforeComplete: () => {
|
|
334
330
|
s.current.next();
|
|
335
331
|
}
|
|
@@ -342,7 +338,7 @@ function Cs(s, e) {
|
|
|
342
338
|
function Fs(s, e) {
|
|
343
339
|
return Math.pow(2, s) * e;
|
|
344
340
|
}
|
|
345
|
-
function
|
|
341
|
+
function Vt(s) {
|
|
346
342
|
const {
|
|
347
343
|
retry: e,
|
|
348
344
|
retryDelay: t,
|
|
@@ -379,11 +375,11 @@ function Pt(s) {
|
|
|
379
375
|
)
|
|
380
376
|
);
|
|
381
377
|
}),
|
|
382
|
-
|
|
383
|
-
|
|
378
|
+
ds((b) => b.pipe(
|
|
379
|
+
fs(($) => {
|
|
384
380
|
const w = f - 1;
|
|
385
381
|
return n().pipe(
|
|
386
|
-
|
|
382
|
+
ps(),
|
|
387
383
|
tt(
|
|
388
384
|
() => y(w, $) ? Qe(
|
|
389
385
|
Cs(
|
|
@@ -402,7 +398,7 @@ function Pt(s) {
|
|
|
402
398
|
return s.catchError(f, b);
|
|
403
399
|
throw b;
|
|
404
400
|
}),
|
|
405
|
-
|
|
401
|
+
At(() => {
|
|
406
402
|
o && (f = 0);
|
|
407
403
|
})
|
|
408
404
|
);
|
|
@@ -415,17 +411,17 @@ const Or = (s, e) => s.length === e.length && s.every((t, r) => t === e[r]), Es
|
|
|
415
411
|
s();
|
|
416
412
|
});
|
|
417
413
|
};
|
|
418
|
-
function
|
|
414
|
+
function Ot(s) {
|
|
419
415
|
return Object.prototype.toString.call(s) === "[object Object]";
|
|
420
416
|
}
|
|
421
417
|
function nt(s) {
|
|
422
|
-
if (
|
|
418
|
+
if (!Ot(s))
|
|
423
419
|
return !1;
|
|
424
420
|
const e = s.constructor;
|
|
425
421
|
if (typeof e > "u")
|
|
426
422
|
return !0;
|
|
427
423
|
const t = e.prototype;
|
|
428
|
-
return !(
|
|
424
|
+
return !(!Ot(t) || !t.hasOwnProperty("isPrototypeOf"));
|
|
429
425
|
}
|
|
430
426
|
const ve = (s) => JSON.stringify(
|
|
431
427
|
s,
|
|
@@ -444,7 +440,7 @@ const ve = (s) => JSON.stringify(
|
|
|
444
440
|
function lt(s) {
|
|
445
441
|
let e = 0;
|
|
446
442
|
return function(r) {
|
|
447
|
-
return new
|
|
443
|
+
return new ns((n) => {
|
|
448
444
|
e++;
|
|
449
445
|
const u = r.subscribe(n);
|
|
450
446
|
return s(e), () => {
|
|
@@ -470,7 +466,7 @@ class xs {
|
|
|
470
466
|
O((n) => n === 0)
|
|
471
467
|
);
|
|
472
468
|
this.state$ = a(this, ee).pipe(
|
|
473
|
-
|
|
469
|
+
is(({ args: n, mutation: u, options: i }) => {
|
|
474
470
|
const c = i.mapOperator ?? "merge", l = a(this, ee).pipe(
|
|
475
471
|
O(() => c === "merge")
|
|
476
472
|
), h = a(this, ee).pipe(
|
|
@@ -481,7 +477,7 @@ class xs {
|
|
|
481
477
|
), o = Ae(() => (u.execute(n), Z)), p = u.state$.pipe(
|
|
482
478
|
we,
|
|
483
479
|
Ke(),
|
|
484
|
-
|
|
480
|
+
N(() => u.state$),
|
|
485
481
|
ne(a(this, ee))
|
|
486
482
|
), d = u.state$.pipe(
|
|
487
483
|
we,
|
|
@@ -502,7 +498,7 @@ class xs {
|
|
|
502
498
|
o
|
|
503
499
|
).pipe(
|
|
504
500
|
g((y) => ({ state: y, mutation: u })),
|
|
505
|
-
e ??
|
|
501
|
+
e ?? jt,
|
|
506
502
|
ne(f)
|
|
507
503
|
);
|
|
508
504
|
}),
|
|
@@ -541,7 +537,7 @@ function V(s, e) {
|
|
|
541
537
|
return !1;
|
|
542
538
|
return !0;
|
|
543
539
|
}
|
|
544
|
-
const
|
|
540
|
+
const Pt = (s) => s.pipe(
|
|
545
541
|
Q(
|
|
546
542
|
({ data: e, ...t }, { data: r, ...n }) => V(t, n) && V(e, r)
|
|
547
543
|
)
|
|
@@ -573,7 +569,7 @@ class Rs {
|
|
|
573
569
|
var n;
|
|
574
570
|
this.client = e, this.options = t, this.options.mutationKey = ((n = this.options) == null ? void 0 : n.mutationKey) ?? [ct()], M(this, ie, r ?? new xs(this.options)), this.mutate = this.mutate.bind(this), this.reset = this.reset.bind(this), a(this, L).pipe(
|
|
575
571
|
O(rt),
|
|
576
|
-
|
|
572
|
+
N(
|
|
577
573
|
(u) => a(this, ie).state$.pipe(
|
|
578
574
|
ne(
|
|
579
575
|
u.mutation.state$.pipe(we, Ke())
|
|
@@ -653,7 +649,7 @@ class Rs {
|
|
|
653
649
|
this.observed$,
|
|
654
650
|
t,
|
|
655
651
|
r
|
|
656
|
-
).pipe(
|
|
652
|
+
).pipe(Pt), lastValue: e };
|
|
657
653
|
}
|
|
658
654
|
/**
|
|
659
655
|
* @important
|
|
@@ -697,18 +693,18 @@ class Rs {
|
|
|
697
693
|
}
|
|
698
694
|
}
|
|
699
695
|
ie = new WeakMap(), L = new WeakMap();
|
|
700
|
-
const
|
|
696
|
+
const Dt = Xt(void 0), js = ({ client: s }) => (J(() => (s.mount(), () => {
|
|
701
697
|
s.unmount();
|
|
702
|
-
}), [s]), null), wr =
|
|
698
|
+
}), [s]), null), wr = Zt(
|
|
703
699
|
({ children: s, client: e }) => {
|
|
704
700
|
const t = ut(() => e, [e]);
|
|
705
|
-
return /* @__PURE__ */
|
|
706
|
-
/* @__PURE__ */
|
|
701
|
+
return /* @__PURE__ */ ys(Dt.Provider, { value: t, children: [
|
|
702
|
+
/* @__PURE__ */ bs(js, { client: e }),
|
|
707
703
|
s
|
|
708
704
|
] });
|
|
709
705
|
}
|
|
710
|
-
),
|
|
711
|
-
const e =
|
|
706
|
+
), kt = (s) => {
|
|
707
|
+
const e = es(Dt);
|
|
712
708
|
if (s)
|
|
713
709
|
return s;
|
|
714
710
|
if (!e)
|
|
@@ -718,7 +714,7 @@ const kt = Zt(void 0), js = ({ client: s }) => (J(() => (s.mount(), () => {
|
|
|
718
714
|
function Ms() {
|
|
719
715
|
}
|
|
720
716
|
function Cr(s, e) {
|
|
721
|
-
const t =
|
|
717
|
+
const t = kt(e), r = q(s), n = Ze(() => [ct()]), u = ve(s.mutationKey ?? n.current), [i] = Rt(
|
|
722
718
|
() => new Rs(
|
|
723
719
|
t,
|
|
724
720
|
s
|
|
@@ -739,7 +735,7 @@ function Cr(s, e) {
|
|
|
739
735
|
}
|
|
740
736
|
function As(s) {
|
|
741
737
|
return (e) => e.pipe(
|
|
742
|
-
|
|
738
|
+
At((t) => {
|
|
743
739
|
s.next(t);
|
|
744
740
|
})
|
|
745
741
|
);
|
|
@@ -772,16 +768,16 @@ function ht(s, e) {
|
|
|
772
768
|
function Us(s, e) {
|
|
773
769
|
return e.enabled !== !1 && !s.state.dataUpdatedAt && !(s.state.status === "error" && e.retryOnMount === !1) && s.state.fetchStatus !== "fetching";
|
|
774
770
|
}
|
|
775
|
-
function
|
|
776
|
-
return Us(s, e) || s.state.dataUpdatedAt > 0 &&
|
|
771
|
+
function $t(s, e) {
|
|
772
|
+
return Us(s, e) || s.state.dataUpdatedAt > 0 && Tt(s, e, e.refetchOnMount);
|
|
777
773
|
}
|
|
778
|
-
function
|
|
774
|
+
function wt(s, e, t, r) {
|
|
779
775
|
return s.state.fetchStatus !== "fetching" && t.enabled !== !1 && (s !== e || r.enabled === !1) && (!t.suspense || s.state.status !== "error") && ht(s, t);
|
|
780
776
|
}
|
|
781
777
|
function Is(s, e) {
|
|
782
|
-
return
|
|
778
|
+
return Tt(s, e, e.refetchOnWindowFocus);
|
|
783
779
|
}
|
|
784
|
-
function
|
|
780
|
+
function Tt(s, e, t) {
|
|
785
781
|
if (e.enabled !== !1) {
|
|
786
782
|
const r = typeof t == "function" ? t(s) : t;
|
|
787
783
|
return r === "idle" ? s.state.fetchStatus === "idle" : r === "always" || r !== !1 && ht(s, e);
|
|
@@ -791,25 +787,25 @@ function Kt(s, e, t) {
|
|
|
791
787
|
function Vs(s) {
|
|
792
788
|
return (s ?? "online") === "online" ? re.isOnline() : !0;
|
|
793
789
|
}
|
|
794
|
-
function
|
|
790
|
+
function Ct(s, e) {
|
|
795
791
|
return e.reduce(
|
|
796
792
|
(t, r) => r in s ? { ...t, [r]: s[r] } : t,
|
|
797
793
|
{}
|
|
798
794
|
);
|
|
799
795
|
}
|
|
800
|
-
function
|
|
796
|
+
function Ft(s) {
|
|
801
797
|
return Array.isArray(s) && s.length === Object.keys(s).length;
|
|
802
798
|
}
|
|
803
|
-
function
|
|
799
|
+
function Kt(s, e) {
|
|
804
800
|
if (s === e)
|
|
805
801
|
return s;
|
|
806
|
-
const t =
|
|
802
|
+
const t = Ft(s) && Ft(e);
|
|
807
803
|
if (t || nt(s) && nt(e)) {
|
|
808
804
|
const r = t ? s : Object.keys(s), n = r.length, u = t ? e : Object.keys(e), i = u.length, c = t ? [] : {};
|
|
809
805
|
let l = 0;
|
|
810
806
|
for (let h = 0; h < i; h++) {
|
|
811
807
|
const o = t ? h : u[h];
|
|
812
|
-
!t && s[o] === void 0 && e[o] === void 0 && r.includes(o) ? (c[o] = void 0, l++) : (c[o] =
|
|
808
|
+
!t && s[o] === void 0 && e[o] === void 0 && r.includes(o) ? (c[o] = void 0, l++) : (c[o] = Kt(s[o], e[o]), c[o] === s[o] && s[o] !== void 0 && l++);
|
|
813
809
|
}
|
|
814
810
|
return n === i && l === n ? s : c;
|
|
815
811
|
}
|
|
@@ -818,7 +814,7 @@ function Nt(s, e) {
|
|
|
818
814
|
function dt(s, e) {
|
|
819
815
|
return ((e == null ? void 0 : e.queryKeyHashFn) ?? ve)(s);
|
|
820
816
|
}
|
|
821
|
-
function
|
|
817
|
+
function Et(s, e) {
|
|
822
818
|
const {
|
|
823
819
|
type: t = "all",
|
|
824
820
|
exact: r,
|
|
@@ -848,7 +844,7 @@ function Ds(s, e) {
|
|
|
848
844
|
return typeof s == "function" ? s(e) : s;
|
|
849
845
|
}
|
|
850
846
|
function Le(s, e, t) {
|
|
851
|
-
return typeof t.structuralSharing == "function" ? t.structuralSharing(s, e) : t.structuralSharing !== !1 ?
|
|
847
|
+
return typeof t.structuralSharing == "function" ? t.structuralSharing(s, e) : t.structuralSharing !== !1 ? Kt(s, e) : e;
|
|
852
848
|
}
|
|
853
849
|
const it = Symbol(), ks = ({
|
|
854
850
|
getOptions: s,
|
|
@@ -884,7 +880,7 @@ const it = Symbol(), ks = ({
|
|
|
884
880
|
g(
|
|
885
881
|
({ status: e, fetchStatus: t }) => t === "idle" && (e === "success" || e === "error")
|
|
886
882
|
)
|
|
887
|
-
),
|
|
883
|
+
), Nt = (s) => s.pipe(
|
|
888
884
|
Ye((e) => e.fetchStatus !== "idle", !0)
|
|
889
885
|
);
|
|
890
886
|
var We, te;
|
|
@@ -943,7 +939,7 @@ const ze = new Ks(), Ns = (s) => s.pipe(
|
|
|
943
939
|
Q(V)
|
|
944
940
|
);
|
|
945
941
|
var B, R, Ce, ue, D, ye, Fe;
|
|
946
|
-
class
|
|
942
|
+
class qt {
|
|
947
943
|
constructor(e, t) {
|
|
948
944
|
C(this, B, void 0);
|
|
949
945
|
C(this, R, void 0);
|
|
@@ -984,8 +980,8 @@ class Ht {
|
|
|
984
980
|
const o = t.state, p = t.state.status === "pending", d = a(this, R), f = this.options, b = t !== d ? t.state : a(this, ue);
|
|
985
981
|
let { errorUpdatedAt: $, fetchStatus: w, error: H } = o;
|
|
986
982
|
if (r) {
|
|
987
|
-
const
|
|
988
|
-
(pt ||
|
|
983
|
+
const k = !!a(this, Fe), pt = !k && $t(t, e), Gt = k && wt(t, d, e, f);
|
|
984
|
+
(pt || Gt) && (w = Vs(t.options.networkMode) ? "fetching" : "paused");
|
|
989
985
|
}
|
|
990
986
|
const P = p && w === "fetching";
|
|
991
987
|
let j, S = l, z = c ?? null, W = h;
|
|
@@ -995,8 +991,8 @@ class Ht {
|
|
|
995
991
|
else
|
|
996
992
|
try {
|
|
997
993
|
z = e.select, j = e.select(o.data), j = Le(n == null ? void 0 : n.data, j, e), W = j, S = null;
|
|
998
|
-
} catch (
|
|
999
|
-
j = h, S =
|
|
994
|
+
} catch (k) {
|
|
995
|
+
j = h, S = k;
|
|
1000
996
|
}
|
|
1001
997
|
else
|
|
1002
998
|
j = o.data, S = null;
|
|
@@ -1005,20 +1001,20 @@ class Ht {
|
|
|
1005
1001
|
const Ie = _ === "error";
|
|
1006
1002
|
let Ve = !1;
|
|
1007
1003
|
if (typeof e.placeholderData < "u" && typeof j > "u" && _ === "pending") {
|
|
1008
|
-
let
|
|
1004
|
+
let k;
|
|
1009
1005
|
if (n != null && n.isPlaceholderData && e.placeholderData === (u == null ? void 0 : u.placeholderData))
|
|
1010
|
-
|
|
1011
|
-
else if (
|
|
1006
|
+
k = n.data;
|
|
1007
|
+
else if (k = typeof e.placeholderData == "function" ? e.placeholderData(
|
|
1012
1008
|
(De = a(this, ye)) == null ? void 0 : De.state.data,
|
|
1013
1009
|
a(this, ye)
|
|
1014
|
-
) : e.placeholderData, e.select && typeof
|
|
1010
|
+
) : e.placeholderData, e.select && typeof k < "u")
|
|
1015
1011
|
try {
|
|
1016
|
-
|
|
1012
|
+
k = e.select(k);
|
|
1017
1013
|
} catch {
|
|
1018
1014
|
}
|
|
1019
|
-
typeof
|
|
1015
|
+
typeof k < "u" && (_ = "success", j = Le(
|
|
1020
1016
|
n == null ? void 0 : n.data,
|
|
1021
|
-
|
|
1017
|
+
k,
|
|
1022
1018
|
e
|
|
1023
1019
|
), Ve = !0);
|
|
1024
1020
|
}
|
|
@@ -1141,7 +1137,7 @@ class Ht {
|
|
|
1141
1137
|
...e,
|
|
1142
1138
|
cancelRefetch: (e == null ? void 0 : e.cancelRefetch) ?? !0
|
|
1143
1139
|
};
|
|
1144
|
-
a(this, R).fetch(this.options, r).catch(
|
|
1140
|
+
a(this, R).fetch(this.options, r).catch(K), a(this, Ce).next({
|
|
1145
1141
|
query: t,
|
|
1146
1142
|
fetchOptions: r
|
|
1147
1143
|
}), await t.getFetchResultAsPromise();
|
|
@@ -1171,10 +1167,10 @@ class Ht {
|
|
|
1171
1167
|
query: a(this, R),
|
|
1172
1168
|
options: this.options
|
|
1173
1169
|
}),
|
|
1174
|
-
|
|
1170
|
+
Mt(),
|
|
1175
1171
|
E(
|
|
1176
1172
|
([{ options: i, query: c }, { options: l, query: h }]) => {
|
|
1177
|
-
|
|
1173
|
+
wt(h, c, l, i) && this.fetch().catch(K);
|
|
1178
1174
|
}
|
|
1179
1175
|
),
|
|
1180
1176
|
he()
|
|
@@ -1208,10 +1204,10 @@ class Ht {
|
|
|
1208
1204
|
), p = (S, z) => {
|
|
1209
1205
|
const W = c.notifyOnChangeProps, _ = typeof W == "function" ? W() : W;
|
|
1210
1206
|
return (Array.isArray(_) ? _.length === 0 ? () => !0 : (Ve, Pe) => {
|
|
1211
|
-
const ft =
|
|
1207
|
+
const ft = Ct(
|
|
1212
1208
|
Ve,
|
|
1213
1209
|
_
|
|
1214
|
-
), De =
|
|
1210
|
+
), De = Ct(
|
|
1215
1211
|
Pe,
|
|
1216
1212
|
_
|
|
1217
1213
|
);
|
|
@@ -1219,17 +1215,17 @@ class Ht {
|
|
|
1219
1215
|
} : V)(S, z);
|
|
1220
1216
|
}, d = h.pipe(
|
|
1221
1217
|
x(() => i.state$),
|
|
1222
|
-
|
|
1218
|
+
Nt
|
|
1223
1219
|
), f = l.pipe(
|
|
1224
1220
|
g(({ refetchInterval: S, refetchIntervalInBackground: z }) => ({
|
|
1225
1221
|
refetchInterval: (typeof S == "function" ? S(a(this, R)) : S) ?? !1,
|
|
1226
1222
|
refetchIntervalInBackground: z
|
|
1227
1223
|
})),
|
|
1228
1224
|
Q(V),
|
|
1229
|
-
x(({ refetchInterval: S, refetchIntervalInBackground: z }) => S ?
|
|
1225
|
+
x(({ refetchInterval: S, refetchIntervalInBackground: z }) => S ? us(S).pipe(
|
|
1230
1226
|
E(() => {
|
|
1231
1227
|
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
|
1232
|
-
(z || ze.isFocused()) && this.fetch({ cancelRefetch: !1 }).catch(
|
|
1228
|
+
(z || ze.isFocused()) && this.fetch({ cancelRefetch: !1 }).catch(K);
|
|
1233
1229
|
})
|
|
1234
1230
|
) : qe),
|
|
1235
1231
|
he()
|
|
@@ -1244,7 +1240,7 @@ class Ht {
|
|
|
1244
1240
|
x(() => ze.focusRegained$),
|
|
1245
1241
|
gt(l),
|
|
1246
1242
|
E(([, S]) => {
|
|
1247
|
-
Is(i, S) && this.fetch({ cancelRefetch: !1 }).catch(
|
|
1243
|
+
Is(i, S) && this.fetch({ cancelRefetch: !1 }).catch(K);
|
|
1248
1244
|
}),
|
|
1249
1245
|
he()
|
|
1250
1246
|
), w = b.pipe(
|
|
@@ -1278,7 +1274,7 @@ class Ht {
|
|
|
1278
1274
|
lt((i) => M(this, Fe, i)),
|
|
1279
1275
|
E({
|
|
1280
1276
|
subscribe: () => {
|
|
1281
|
-
|
|
1277
|
+
$t(e, this.options) && this.fetch().catch(K);
|
|
1282
1278
|
}
|
|
1283
1279
|
})
|
|
1284
1280
|
)
|
|
@@ -1291,8 +1287,8 @@ B = new WeakMap(), R = new WeakMap(), Ce = new WeakMap(), ue = new WeakMap(), D
|
|
|
1291
1287
|
function qs(s, e) {
|
|
1292
1288
|
return !V(s.getCurrentResult(), e);
|
|
1293
1289
|
}
|
|
1294
|
-
const
|
|
1295
|
-
|
|
1290
|
+
const Ht = Ge.createContext(!1), Hs = () => Ge.useContext(Ht);
|
|
1291
|
+
Ht.Provider;
|
|
1296
1292
|
function _s() {
|
|
1297
1293
|
let s = !1;
|
|
1298
1294
|
return {
|
|
@@ -1315,14 +1311,14 @@ const Gs = ({
|
|
|
1315
1311
|
throwOnError: t,
|
|
1316
1312
|
query: r
|
|
1317
1313
|
}) => s.isError && !e.isReset() && !s.isFetching && r && Ws(t, [s.error, r]);
|
|
1318
|
-
function
|
|
1314
|
+
function _t(s, e, t) {
|
|
1319
1315
|
if (process.env.NODE_ENV !== "production" && (typeof s != "object" || Array.isArray(s)))
|
|
1320
1316
|
throw new Error(
|
|
1321
1317
|
'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'
|
|
1322
1318
|
);
|
|
1323
|
-
const r =
|
|
1319
|
+
const r = kt(t), n = Hs(), u = zs(), i = r.defaultQueryOptions(s);
|
|
1324
1320
|
i._optimisticResults = n ? "isRestoring" : "optimistic";
|
|
1325
|
-
const [c] =
|
|
1321
|
+
const [c] = Rt(
|
|
1326
1322
|
() => new e(
|
|
1327
1323
|
r,
|
|
1328
1324
|
i
|
|
@@ -1354,10 +1350,10 @@ function Lt(s, e, t) {
|
|
|
1354
1350
|
return h.current;
|
|
1355
1351
|
}
|
|
1356
1352
|
function Fr(s, e) {
|
|
1357
|
-
return
|
|
1353
|
+
return _t(s, qt, e);
|
|
1358
1354
|
}
|
|
1359
1355
|
function Er(s, e) {
|
|
1360
|
-
return
|
|
1356
|
+
return _t(
|
|
1361
1357
|
{
|
|
1362
1358
|
refetchOnMount: "idle",
|
|
1363
1359
|
refetchOnReconnect: !1,
|
|
@@ -1365,7 +1361,7 @@ function Er(s, e) {
|
|
|
1365
1361
|
refetchOnWindowFocus: !1,
|
|
1366
1362
|
...s
|
|
1367
1363
|
},
|
|
1368
|
-
|
|
1364
|
+
qt,
|
|
1369
1365
|
e
|
|
1370
1366
|
);
|
|
1371
1367
|
}
|
|
@@ -1379,17 +1375,17 @@ function xr(s, e, t = []) {
|
|
|
1379
1375
|
X((l) => {
|
|
1380
1376
|
throw u.current(l), l;
|
|
1381
1377
|
}),
|
|
1382
|
-
n ?
|
|
1378
|
+
n ? as() : jt
|
|
1383
1379
|
),
|
|
1384
1380
|
[i, n, u]
|
|
1385
1381
|
);
|
|
1386
|
-
|
|
1382
|
+
Qt(c, t);
|
|
1387
1383
|
}
|
|
1388
|
-
const
|
|
1384
|
+
const Lt = () => (s) => F(
|
|
1389
1385
|
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
1390
1386
|
v({ isPaused: !0 }),
|
|
1391
1387
|
re.backToOnline$.pipe(
|
|
1392
|
-
|
|
1388
|
+
N(
|
|
1393
1389
|
() => (
|
|
1394
1390
|
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
1395
1391
|
F(v({ isPaused: !1 }), s)
|
|
@@ -1409,8 +1405,8 @@ const zt = () => (s) => F(
|
|
|
1409
1405
|
* timer needed to be iso RQ, so the state returned by mutation include both previous and next one
|
|
1410
1406
|
*/
|
|
1411
1407
|
Qe(1).pipe(
|
|
1412
|
-
|
|
1413
|
-
() => Oe(() => t).pipe(
|
|
1408
|
+
N(
|
|
1409
|
+
() => Oe(() => t).pipe(Lt())
|
|
1414
1410
|
)
|
|
1415
1411
|
)
|
|
1416
1412
|
) : Oe(() => t)))
|
|
@@ -1420,7 +1416,7 @@ const zt = () => (s) => F(
|
|
|
1420
1416
|
state: e,
|
|
1421
1417
|
options: t
|
|
1422
1418
|
}) => {
|
|
1423
|
-
const r = e.isPaused, n = async () => await Promise.reject(new Error("No mutationFn found")), u = t.mutationFn ?? n, c =
|
|
1419
|
+
const r = e.isPaused, n = async () => await Promise.reject(new Error("No mutationFn found")), u = t.mutationFn ?? n, c = os(
|
|
1424
1420
|
() => r,
|
|
1425
1421
|
v(e.context),
|
|
1426
1422
|
U(
|
|
@@ -1462,7 +1458,7 @@ const zt = () => (s) => F(
|
|
|
1462
1458
|
})
|
|
1463
1459
|
),
|
|
1464
1460
|
Js,
|
|
1465
|
-
|
|
1461
|
+
Vt({
|
|
1466
1462
|
...t,
|
|
1467
1463
|
retry: (b, $) => {
|
|
1468
1464
|
const w = t.retry ?? 0;
|
|
@@ -1487,7 +1483,7 @@ const zt = () => (s) => F(
|
|
|
1487
1483
|
!0
|
|
1488
1484
|
)
|
|
1489
1485
|
);
|
|
1490
|
-
return re.isOnline() || t.networkMode === "offlineFirst" || t.networkMode === "always" ? y : y.pipe(
|
|
1486
|
+
return re.isOnline() || t.networkMode === "offlineFirst" || t.networkMode === "always" ? y : y.pipe(Lt());
|
|
1491
1487
|
})
|
|
1492
1488
|
), o = v({
|
|
1493
1489
|
...e,
|
|
@@ -1611,7 +1607,7 @@ class Bs {
|
|
|
1611
1607
|
return (y = (f = this.options).onMutate) == null ? void 0 : y.call(f, l);
|
|
1612
1608
|
});
|
|
1613
1609
|
return h.pipe(
|
|
1614
|
-
|
|
1610
|
+
N(() => p)
|
|
1615
1611
|
);
|
|
1616
1612
|
},
|
|
1617
1613
|
onError: (l, h, o) => {
|
|
@@ -1690,7 +1686,7 @@ class Bs {
|
|
|
1690
1686
|
}),
|
|
1691
1687
|
this.state
|
|
1692
1688
|
),
|
|
1693
|
-
|
|
1689
|
+
Pt,
|
|
1694
1690
|
E((c) => {
|
|
1695
1691
|
this.state = c;
|
|
1696
1692
|
}),
|
|
@@ -1727,13 +1723,13 @@ class Bs {
|
|
|
1727
1723
|
}
|
|
1728
1724
|
}
|
|
1729
1725
|
Ee = new WeakMap(), se = new WeakMap(), be = new WeakMap();
|
|
1730
|
-
const
|
|
1726
|
+
const xt = ({
|
|
1731
1727
|
mutationKey: s,
|
|
1732
1728
|
status: e,
|
|
1733
1729
|
predicate: t,
|
|
1734
1730
|
exact: r = !0
|
|
1735
1731
|
} = {}) => (u) => r && s !== void 0 && u.options.mutationKey !== void 0 && !_e(u.options.mutationKey, s, { exact: r }) || !r && s !== void 0 && u.options.mutationKey !== void 0 && !_e(u.options.mutationKey, s, { exact: r }) || e && u.state.status !== e ? !1 : t ? t(u) : !0;
|
|
1736
|
-
class
|
|
1732
|
+
class zt {
|
|
1737
1733
|
constructor() {
|
|
1738
1734
|
/**
|
|
1739
1735
|
* @important
|
|
@@ -1755,11 +1751,11 @@ class Wt {
|
|
|
1755
1751
|
m(this, "stateChange$", F(
|
|
1756
1752
|
this.entriesSubject.pipe(
|
|
1757
1753
|
Je(),
|
|
1758
|
-
|
|
1754
|
+
N((e) => Se(e))
|
|
1759
1755
|
),
|
|
1760
1756
|
this.added$
|
|
1761
1757
|
).pipe(
|
|
1762
|
-
|
|
1758
|
+
N(
|
|
1763
1759
|
(e) => e.state$.pipe(
|
|
1764
1760
|
g(() => e),
|
|
1765
1761
|
ne(
|
|
@@ -1787,10 +1783,10 @@ class Wt {
|
|
|
1787
1783
|
return this.entriesSubject.getValue().find(e);
|
|
1788
1784
|
}
|
|
1789
1785
|
}
|
|
1790
|
-
var
|
|
1786
|
+
var T;
|
|
1791
1787
|
class Xs {
|
|
1792
1788
|
constructor(e = {}) {
|
|
1793
|
-
C(this,
|
|
1789
|
+
C(this, T, new zt());
|
|
1794
1790
|
this.config = e;
|
|
1795
1791
|
}
|
|
1796
1792
|
build(e, t, r) {
|
|
@@ -1818,25 +1814,25 @@ class Xs {
|
|
|
1818
1814
|
complete: () => {
|
|
1819
1815
|
this.remove(n);
|
|
1820
1816
|
}
|
|
1821
|
-
}), a(this,
|
|
1817
|
+
}), a(this, T).add(n), n;
|
|
1822
1818
|
}
|
|
1823
1819
|
getAll() {
|
|
1824
1820
|
return this.findAll();
|
|
1825
1821
|
}
|
|
1826
1822
|
remove(e) {
|
|
1827
|
-
const t = a(this,
|
|
1828
|
-
t == null || t.cancel(), a(this,
|
|
1823
|
+
const t = a(this, T).getValues().find((r) => r === e);
|
|
1824
|
+
t == null || t.cancel(), a(this, T).remove(e);
|
|
1829
1825
|
}
|
|
1830
1826
|
find(e) {
|
|
1831
|
-
const t = { exact: !0, ...e }, r =
|
|
1832
|
-
return a(this,
|
|
1827
|
+
const t = { exact: !0, ...e }, r = xt(t);
|
|
1828
|
+
return a(this, T).getValues().find((n) => r(n));
|
|
1833
1829
|
}
|
|
1834
1830
|
findAll(e = {}) {
|
|
1835
|
-
const t = { exact: !0, ...e }, r =
|
|
1836
|
-
return a(this,
|
|
1831
|
+
const t = { exact: !0, ...e }, r = xt(t);
|
|
1832
|
+
return a(this, T).getValues().filter((n) => r(n)).map((n) => n);
|
|
1837
1833
|
}
|
|
1838
1834
|
observe() {
|
|
1839
|
-
return a(this,
|
|
1835
|
+
return a(this, T).stateChange$.pipe(ce());
|
|
1840
1836
|
}
|
|
1841
1837
|
/**
|
|
1842
1838
|
* @important
|
|
@@ -1844,7 +1840,7 @@ class Xs {
|
|
|
1844
1840
|
*/
|
|
1845
1841
|
subscribe(e) {
|
|
1846
1842
|
const t = F(
|
|
1847
|
-
a(this,
|
|
1843
|
+
a(this, T).added$.pipe(
|
|
1848
1844
|
E((r) => {
|
|
1849
1845
|
e({
|
|
1850
1846
|
type: "added",
|
|
@@ -1852,7 +1848,7 @@ class Xs {
|
|
|
1852
1848
|
});
|
|
1853
1849
|
})
|
|
1854
1850
|
),
|
|
1855
|
-
a(this,
|
|
1851
|
+
a(this, T).removed$.pipe(
|
|
1856
1852
|
E((r) => {
|
|
1857
1853
|
e({
|
|
1858
1854
|
type: "removed",
|
|
@@ -1860,7 +1856,7 @@ class Xs {
|
|
|
1860
1856
|
});
|
|
1861
1857
|
})
|
|
1862
1858
|
),
|
|
1863
|
-
a(this,
|
|
1859
|
+
a(this, T).stateChange$.pipe(
|
|
1864
1860
|
E((r) => {
|
|
1865
1861
|
e({
|
|
1866
1862
|
type: "updated",
|
|
@@ -1884,7 +1880,7 @@ class Xs {
|
|
|
1884
1880
|
if (!e.length)
|
|
1885
1881
|
return Z;
|
|
1886
1882
|
const t = e.map((r) => r.continue());
|
|
1887
|
-
return
|
|
1883
|
+
return cs(t);
|
|
1888
1884
|
}
|
|
1889
1885
|
clear() {
|
|
1890
1886
|
this.getAll().forEach((e) => {
|
|
@@ -1892,7 +1888,7 @@ class Xs {
|
|
|
1892
1888
|
});
|
|
1893
1889
|
}
|
|
1894
1890
|
}
|
|
1895
|
-
|
|
1891
|
+
T = new WeakMap();
|
|
1896
1892
|
function Zs(s) {
|
|
1897
1893
|
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;
|
|
1898
1894
|
return {
|
|
@@ -1910,11 +1906,11 @@ function Zs(s) {
|
|
|
1910
1906
|
fetchStatus: "idle"
|
|
1911
1907
|
};
|
|
1912
1908
|
}
|
|
1913
|
-
const er = (s) => Ae(() => ze.isFocused() ? s : ze.focusRegained$.pipe(
|
|
1909
|
+
const er = (s) => Ae(() => ze.isFocused() ? s : ze.focusRegained$.pipe(N(() => s))), tr = (s) => {
|
|
1914
1910
|
let e = 0;
|
|
1915
1911
|
return (t) => {
|
|
1916
1912
|
const r = re.backToOnline$.pipe(
|
|
1917
|
-
|
|
1913
|
+
N(
|
|
1918
1914
|
() => F(
|
|
1919
1915
|
v({ fetchStatus: "fetching" }),
|
|
1920
1916
|
t
|
|
@@ -1937,7 +1933,7 @@ const er = (s) => Ae(() => ze.isFocused() ? s : ze.focusRegained$.pipe(k(() => s
|
|
|
1937
1933
|
* for the next tick to make sure observable chain received this data at least
|
|
1938
1934
|
*/
|
|
1939
1935
|
ot(1),
|
|
1940
|
-
|
|
1936
|
+
N(() => s.pipe(O((n) => n === 0)))
|
|
1941
1937
|
);
|
|
1942
1938
|
return e.pipe(
|
|
1943
1939
|
E(() => {
|
|
@@ -1980,7 +1976,7 @@ const er = (s) => Ae(() => ze.isFocused() ? s : ze.focusRegained$.pipe(k(() => s
|
|
|
1980
1976
|
),
|
|
1981
1977
|
// takeUntil(hasDataAndNoObservers$),
|
|
1982
1978
|
tr(s),
|
|
1983
|
-
|
|
1979
|
+
Vt({
|
|
1984
1980
|
...s,
|
|
1985
1981
|
retryAfter: () => v(!0).pipe(er),
|
|
1986
1982
|
catchError: (o, p) => v({
|
|
@@ -1998,7 +1994,7 @@ const er = (s) => Ae(() => ze.isFocused() ? s : ze.focusRegained$.pipe(k(() => s
|
|
|
1998
1994
|
})
|
|
1999
1995
|
)
|
|
2000
1996
|
}),
|
|
2001
|
-
|
|
1997
|
+
N((o) => "data" in o ? v({
|
|
2002
1998
|
...o,
|
|
2003
1999
|
status: "success",
|
|
2004
2000
|
fetchStatus: "idle",
|
|
@@ -2031,7 +2027,7 @@ const er = (s) => Ae(() => ze.isFocused() ? s : ze.focusRegained$.pipe(k(() => s
|
|
|
2031
2027
|
* before shallow compare will not update the state, otherwise it's our chance to catch
|
|
2032
2028
|
* the end of observable fn.
|
|
2033
2029
|
*/
|
|
2034
|
-
|
|
2030
|
+
ls({ fetchStatus: "idle" }),
|
|
2035
2031
|
de()
|
|
2036
2032
|
), h = v({
|
|
2037
2033
|
status: "pending",
|
|
@@ -2054,7 +2050,7 @@ class nr {
|
|
|
2054
2050
|
}
|
|
2055
2051
|
}
|
|
2056
2052
|
const ir = { backgroundColor: "transparent", color: "inherit" };
|
|
2057
|
-
function
|
|
2053
|
+
function Wt(s) {
|
|
2058
2054
|
const e = {
|
|
2059
2055
|
namespaces: [
|
|
2060
2056
|
{
|
|
@@ -2063,7 +2059,7 @@ function Gt(s) {
|
|
|
2063
2059
|
}
|
|
2064
2060
|
],
|
|
2065
2061
|
namespace(t, r) {
|
|
2066
|
-
const n =
|
|
2062
|
+
const n = Wt();
|
|
2067
2063
|
return n.namespaces.push({
|
|
2068
2064
|
name: t,
|
|
2069
2065
|
style: r ?? ir
|
|
@@ -2101,7 +2097,7 @@ function Gt(s) {
|
|
|
2101
2097
|
};
|
|
2102
2098
|
return e;
|
|
2103
2099
|
}
|
|
2104
|
-
const ur =
|
|
2100
|
+
const ur = Wt();
|
|
2105
2101
|
var xe, ae;
|
|
2106
2102
|
class ar {
|
|
2107
2103
|
constructor(e) {
|
|
@@ -2149,14 +2145,14 @@ class ar {
|
|
|
2149
2145
|
}))
|
|
2150
2146
|
),
|
|
2151
2147
|
this.executeSubject.pipe(
|
|
2152
|
-
|
|
2148
|
+
N(() => {
|
|
2153
2149
|
let t = !1;
|
|
2154
2150
|
const r = this.executeSubject.pipe(
|
|
2155
2151
|
// should not be needed since the fetch return current promise
|
|
2156
2152
|
// in case we don't cancel
|
|
2157
2153
|
O((h) => (h == null ? void 0 : h.cancelRefetch) !== !1)
|
|
2158
2154
|
), n = this.observers$.pipe(
|
|
2159
|
-
|
|
2155
|
+
Mt(),
|
|
2160
2156
|
E(([h, o]) => {
|
|
2161
2157
|
o.length === 0 && h.length > 0 ? t = !0 : t = !1;
|
|
2162
2158
|
}),
|
|
@@ -2293,7 +2289,7 @@ class ar {
|
|
|
2293
2289
|
}
|
|
2294
2290
|
async getFetchResultAsPromise() {
|
|
2295
2291
|
return await new Promise((e, t) => {
|
|
2296
|
-
this.state$.pipe(
|
|
2292
|
+
this.state$.pipe(Nt, Ke()).subscribe({
|
|
2297
2293
|
error: t,
|
|
2298
2294
|
next: (r) => {
|
|
2299
2295
|
r.error ? t(r.error) : e(r.data);
|
|
@@ -2331,7 +2327,7 @@ class or {
|
|
|
2331
2327
|
constructor(e = {}) {
|
|
2332
2328
|
// readonly #queries: QueryStore = new Map<string, Query>()
|
|
2333
2329
|
C(this, Re, new I());
|
|
2334
|
-
C(this, G, new
|
|
2330
|
+
C(this, G, new zt());
|
|
2335
2331
|
this.config = e;
|
|
2336
2332
|
}
|
|
2337
2333
|
mount() {
|
|
@@ -2357,7 +2353,7 @@ class or {
|
|
|
2357
2353
|
}
|
|
2358
2354
|
findAll(e = {}) {
|
|
2359
2355
|
const t = this.getAll();
|
|
2360
|
-
return Object.keys(e).length > 0 ? t.filter((r) =>
|
|
2356
|
+
return Object.keys(e).length > 0 ? t.filter((r) => Et(e, r)) : t;
|
|
2361
2357
|
}
|
|
2362
2358
|
build(e, t, r) {
|
|
2363
2359
|
const n = t.queryKey ?? [ct()], u = t.queryHash ?? dt(n, t);
|
|
@@ -2400,7 +2396,7 @@ class or {
|
|
|
2400
2396
|
Ts,
|
|
2401
2397
|
x((r) => r ? t.pipe(
|
|
2402
2398
|
// defaults to 5mn
|
|
2403
|
-
x(() => e.gcTime === 1 / 0 ? qe : (setTimeout(
|
|
2399
|
+
x(() => e.gcTime === 1 / 0 ? qe : (setTimeout(K, e.gcTime), Qe(e.gcTime)))
|
|
2404
2400
|
) : qe),
|
|
2405
2401
|
He(1)
|
|
2406
2402
|
).subscribe({
|
|
@@ -2416,7 +2412,7 @@ class or {
|
|
|
2416
2412
|
find(e) {
|
|
2417
2413
|
const t = { exact: !0, ...e };
|
|
2418
2414
|
return this.getAll().find(
|
|
2419
|
-
(r) =>
|
|
2415
|
+
(r) => Et(t, r)
|
|
2420
2416
|
);
|
|
2421
2417
|
}
|
|
2422
2418
|
subscribe(e) {
|
|
@@ -2511,7 +2507,7 @@ class Rr {
|
|
|
2511
2507
|
return r.isStaleByTime(t.staleTime) ? await r.fetch(t) : await Promise.resolve(r.state.data);
|
|
2512
2508
|
}
|
|
2513
2509
|
async prefetchQuery(e) {
|
|
2514
|
-
await this.fetchQuery(e).then(
|
|
2510
|
+
await this.fetchQuery(e).then(K).catch(K);
|
|
2515
2511
|
}
|
|
2516
2512
|
async resetQueries(e, t) {
|
|
2517
2513
|
const r = a(this, A), n = {
|
|
@@ -2528,9 +2524,9 @@ class Rr {
|
|
|
2528
2524
|
cancelRefetch: (t == null ? void 0 : t.cancelRefetch) ?? !0
|
|
2529
2525
|
}, n = a(this, A).findAll(e).filter((u) => !u.isDisabled()).map(async (u) => {
|
|
2530
2526
|
let i = u.fetch(void 0, r);
|
|
2531
|
-
return r.throwOnError || (i = i.catch(
|
|
2527
|
+
return r.throwOnError || (i = i.catch(K)), u.state.fetchStatus === "paused" ? void 0 : await i;
|
|
2532
2528
|
});
|
|
2533
|
-
await Promise.all(n).then(
|
|
2529
|
+
await Promise.all(n).then(K);
|
|
2534
2530
|
}
|
|
2535
2531
|
getQueryData(e) {
|
|
2536
2532
|
var r;
|
|
@@ -2584,7 +2580,7 @@ class Rr {
|
|
|
2584
2580
|
const r = { revert: !0, ...t }, n = a(this, A).findAll(e).map(async (u) => {
|
|
2585
2581
|
await u.cancel(r);
|
|
2586
2582
|
});
|
|
2587
|
-
await Promise.all(n).then(
|
|
2583
|
+
await Promise.all(n).then(K).catch(K);
|
|
2588
2584
|
}
|
|
2589
2585
|
async invalidateQueries(e = {}, t = {}) {
|
|
2590
2586
|
if (a(this, A).findAll(e).forEach((n) => {
|
|
@@ -2600,7 +2596,7 @@ class Rr {
|
|
|
2600
2596
|
await this.refetchQueries(r, t);
|
|
2601
2597
|
}
|
|
2602
2598
|
async resumePausedMutations() {
|
|
2603
|
-
return await
|
|
2599
|
+
return await hs(a(this, oe).resumePausedMutations());
|
|
2604
2600
|
}
|
|
2605
2601
|
isFetching(e) {
|
|
2606
2602
|
return a(this, A).findAll({ ...e, fetchStatus: "fetching" }).length;
|
|
@@ -2615,16 +2611,16 @@ export {
|
|
|
2615
2611
|
or as QueryCache,
|
|
2616
2612
|
Rr as QueryClient,
|
|
2617
2613
|
wr as QueryClientProvider,
|
|
2618
|
-
|
|
2614
|
+
ms as SIGNAL_RESET,
|
|
2619
2615
|
Or as arrayEqual,
|
|
2620
|
-
|
|
2616
|
+
vs as createLocalStorageAdapter,
|
|
2621
2617
|
mr as createLocalforageAdapter,
|
|
2622
2618
|
Fs as exponentialBackoffDelay,
|
|
2623
2619
|
Cs as getDelay,
|
|
2624
2620
|
rt as isDefined,
|
|
2625
|
-
|
|
2621
|
+
Vt as retryBackoff,
|
|
2626
2622
|
br as signal,
|
|
2627
|
-
|
|
2623
|
+
It as useBehaviorSubject,
|
|
2628
2624
|
Es as useEffectOnce,
|
|
2629
2625
|
Er as useForeverQuery,
|
|
2630
2626
|
q as useLiveRef,
|
|
@@ -2635,10 +2631,10 @@ export {
|
|
|
2635
2631
|
pr as useObserveCallback,
|
|
2636
2632
|
Sr as usePersistSignals,
|
|
2637
2633
|
Fr as useQuery,
|
|
2638
|
-
|
|
2634
|
+
kt as useQueryClient,
|
|
2639
2635
|
gr as useSignalValue,
|
|
2640
|
-
|
|
2641
|
-
|
|
2636
|
+
Ut as useSubject,
|
|
2637
|
+
Qt as useSubscribe,
|
|
2642
2638
|
xr as useSubscribeEffect,
|
|
2643
2639
|
vr as useUnmountObservable
|
|
2644
2640
|
};
|