reactjrx 1.88.0 → 1.90.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +322 -318
- package/dist/lib/state/persistance/types.d.ts +12 -0
- package/dist/lib/state/persistance/usePersistSignals.d.ts +9 -10
- package/dist/lib/utils/useEffectOnce.d.ts +3 -0
- package/dist/lib/utils/useMount.d.ts +1 -0
- package/package.json +1 -1
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
|
|
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,11 +38,11 @@ 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
|
}),
|
|
45
|
-
|
|
45
|
+
X((b) => (console.error(b), Z))
|
|
46
46
|
).subscribe(p);
|
|
47
47
|
return () => {
|
|
48
48
|
c.current.unsubscribeOnUnmount !== !1 && y.unsubscribe();
|
|
@@ -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,9 +69,9 @@ 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();
|
|
76
76
|
return () => {
|
|
77
77
|
r.unsubscribe();
|
|
@@ -84,23 +84,23 @@ function Ut(s, e = []) {
|
|
|
84
84
|
}
|
|
85
85
|
const Ze = (s) => {
|
|
86
86
|
const e = me();
|
|
87
|
-
return e.current || (e.current = s()),
|
|
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
|
} = {}) => {
|
|
94
94
|
const t = Ze(() => new I()), r = me(!1), n = q(s), u = q(e);
|
|
95
|
-
return
|
|
95
|
+
return J(() => (r.current && (t.current = new I(), r.current = !1), () => {
|
|
96
96
|
if (!u.current) {
|
|
97
97
|
r.current = !0;
|
|
98
98
|
return;
|
|
99
99
|
}
|
|
100
100
|
r.current || (n.current != null && n.current(), t.current.complete(), r.current = !0);
|
|
101
101
|
}), [u, n, t]), t;
|
|
102
|
-
},
|
|
103
|
-
const s =
|
|
102
|
+
}, pr = () => {
|
|
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
|
-
},
|
|
112
|
-
const e = Ze(() => new
|
|
113
|
-
return
|
|
111
|
+
}, It = (s) => {
|
|
112
|
+
const e = Ze(() => new Y(s)), t = me(!1), r = me(s);
|
|
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
|
-
},
|
|
117
|
-
const e =
|
|
116
|
+
}, yr = (s) => {
|
|
117
|
+
const e = It(s), t = q(e.current.asObservable()), r = le(
|
|
118
118
|
(n) => {
|
|
119
119
|
e.current.next(n);
|
|
120
120
|
},
|
|
@@ -122,12 +122,12 @@ const Ze = (s) => {
|
|
|
122
122
|
[e.current]
|
|
123
123
|
);
|
|
124
124
|
return [t.current, r, e.current.getValue()];
|
|
125
|
-
},
|
|
126
|
-
function
|
|
125
|
+
}, ms = Symbol("SIGNAL_RESET");
|
|
126
|
+
function br(s = {}) {
|
|
127
127
|
const e = {
|
|
128
128
|
default: s.default,
|
|
129
129
|
key: s.key
|
|
130
|
-
}, { default: t } = e ?? {}, r = new
|
|
130
|
+
}, { default: t } = e ?? {}, r = new Y(t), n = (i) => {
|
|
131
131
|
if (typeof i == "function") {
|
|
132
132
|
const c = i(r.getValue());
|
|
133
133
|
if (c === r.getValue())
|
|
@@ -135,7 +135,7 @@ function yr(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
|
}
|
|
@@ -160,7 +160,7 @@ function yr(s = {}) {
|
|
|
160
160
|
subject: r
|
|
161
161
|
};
|
|
162
162
|
}
|
|
163
|
-
function
|
|
163
|
+
function gr(s, e) {
|
|
164
164
|
const r = e ?? (() => s.getValue());
|
|
165
165
|
return Xe(
|
|
166
166
|
() => s.subject.pipe(
|
|
@@ -173,7 +173,7 @@ function br(s, e) {
|
|
|
173
173
|
[]
|
|
174
174
|
);
|
|
175
175
|
}
|
|
176
|
-
const
|
|
176
|
+
const mr = (s) => ({
|
|
177
177
|
getItem: async (e) => {
|
|
178
178
|
const t = await s.getItem(e);
|
|
179
179
|
if (t)
|
|
@@ -189,7 +189,7 @@ const gr = (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 gr = (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 gr = (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 =
|
|
239
|
-
return
|
|
238
|
+
const e = It(s);
|
|
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
|
-
|
|
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
|
-
B((p) => (console.error("Unable to hydrate", p), Z))
|
|
298
|
-
);
|
|
299
|
-
})
|
|
281
|
+
x((h) => (l.length === 0 ? 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,24 +398,30 @@ 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
|
);
|
|
409
405
|
});
|
|
410
406
|
}
|
|
411
|
-
const
|
|
412
|
-
|
|
407
|
+
const Or = (s, e) => s.length === e.length && s.every((t, r) => t === e[r]), Es = (s) => {
|
|
408
|
+
J(s, []);
|
|
409
|
+
}, $r = (s) => {
|
|
410
|
+
Es(() => {
|
|
411
|
+
s();
|
|
412
|
+
});
|
|
413
|
+
};
|
|
414
|
+
function Ot(s) {
|
|
413
415
|
return Object.prototype.toString.call(s) === "[object Object]";
|
|
414
416
|
}
|
|
415
417
|
function nt(s) {
|
|
416
|
-
if (
|
|
418
|
+
if (!Ot(s))
|
|
417
419
|
return !1;
|
|
418
420
|
const e = s.constructor;
|
|
419
421
|
if (typeof e > "u")
|
|
420
422
|
return !0;
|
|
421
423
|
const t = e.prototype;
|
|
422
|
-
return !(
|
|
424
|
+
return !(!Ot(t) || !t.hasOwnProperty("isPrototypeOf"));
|
|
423
425
|
}
|
|
424
426
|
const ve = (s) => JSON.stringify(
|
|
425
427
|
s,
|
|
@@ -438,7 +440,7 @@ const ve = (s) => JSON.stringify(
|
|
|
438
440
|
function lt(s) {
|
|
439
441
|
let e = 0;
|
|
440
442
|
return function(r) {
|
|
441
|
-
return new
|
|
443
|
+
return new ns((n) => {
|
|
442
444
|
e++;
|
|
443
445
|
const u = r.subscribe(n);
|
|
444
446
|
return s(e), () => {
|
|
@@ -454,17 +456,17 @@ const we = (s) => s.pipe(
|
|
|
454
456
|
)
|
|
455
457
|
);
|
|
456
458
|
var ee;
|
|
457
|
-
class
|
|
459
|
+
class xs {
|
|
458
460
|
constructor({
|
|
459
461
|
__queryFinalizeHook: e
|
|
460
462
|
} = {}) {
|
|
461
463
|
C(this, ee, new I());
|
|
462
464
|
m(this, "state$");
|
|
463
|
-
const t = new
|
|
465
|
+
const t = new Y(0), r = t.pipe(
|
|
464
466
|
O((n) => n === 0)
|
|
465
467
|
);
|
|
466
468
|
this.state$ = a(this, ee).pipe(
|
|
467
|
-
|
|
469
|
+
is(({ args: n, mutation: u, options: i }) => {
|
|
468
470
|
const c = i.mapOperator ?? "merge", l = a(this, ee).pipe(
|
|
469
471
|
O(() => c === "merge")
|
|
470
472
|
), h = a(this, ee).pipe(
|
|
@@ -475,7 +477,7 @@ class Es {
|
|
|
475
477
|
), o = Ae(() => (u.execute(n), Z)), p = u.state$.pipe(
|
|
476
478
|
we,
|
|
477
479
|
Ke(),
|
|
478
|
-
|
|
480
|
+
N(() => u.state$),
|
|
479
481
|
ne(a(this, ee))
|
|
480
482
|
), d = u.state$.pipe(
|
|
481
483
|
we,
|
|
@@ -496,7 +498,7 @@ class Es {
|
|
|
496
498
|
o
|
|
497
499
|
).pipe(
|
|
498
500
|
g((y) => ({ state: y, mutation: u })),
|
|
499
|
-
e ??
|
|
501
|
+
e ?? jt,
|
|
500
502
|
ne(f)
|
|
501
503
|
);
|
|
502
504
|
}),
|
|
@@ -535,16 +537,16 @@ function V(s, e) {
|
|
|
535
537
|
return !1;
|
|
536
538
|
return !0;
|
|
537
539
|
}
|
|
538
|
-
const
|
|
540
|
+
const Pt = (s) => s.pipe(
|
|
539
541
|
Q(
|
|
540
542
|
({ data: e, ...t }, { data: r, ...n }) => V(t, n) && V(e, r)
|
|
541
543
|
)
|
|
542
544
|
);
|
|
543
545
|
var ie, L;
|
|
544
|
-
class
|
|
546
|
+
class Rs {
|
|
545
547
|
constructor(e, t = {}, r) {
|
|
546
548
|
C(this, ie, void 0);
|
|
547
|
-
C(this, L, new
|
|
549
|
+
C(this, L, new Y(void 0));
|
|
548
550
|
/**
|
|
549
551
|
* @important
|
|
550
552
|
* Used to maintain persistance to latest mutation. This ensure
|
|
@@ -565,9 +567,9 @@ class xs {
|
|
|
565
567
|
reset: this.reset
|
|
566
568
|
}));
|
|
567
569
|
var n;
|
|
568
|
-
this.client = e, this.options = t, this.options.mutationKey = ((n = this.options) == null ? void 0 : n.mutationKey) ?? [ct()], M(this, ie, r ?? new
|
|
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(
|
|
569
571
|
O(rt),
|
|
570
|
-
|
|
572
|
+
N(
|
|
571
573
|
(u) => a(this, ie).state$.pipe(
|
|
572
574
|
ne(
|
|
573
575
|
u.mutation.state$.pipe(we, Ke())
|
|
@@ -647,7 +649,7 @@ class xs {
|
|
|
647
649
|
this.observed$,
|
|
648
650
|
t,
|
|
649
651
|
r
|
|
650
|
-
).pipe(
|
|
652
|
+
).pipe(Pt), lastValue: e };
|
|
651
653
|
}
|
|
652
654
|
/**
|
|
653
655
|
* @important
|
|
@@ -691,57 +693,57 @@ class xs {
|
|
|
691
693
|
}
|
|
692
694
|
}
|
|
693
695
|
ie = new WeakMap(), L = new WeakMap();
|
|
694
|
-
const
|
|
696
|
+
const Dt = Xt(void 0), js = ({ client: s }) => (J(() => (s.mount(), () => {
|
|
695
697
|
s.unmount();
|
|
696
|
-
}), [s]), null),
|
|
698
|
+
}), [s]), null), wr = Zt(
|
|
697
699
|
({ children: s, client: e }) => {
|
|
698
700
|
const t = ut(() => e, [e]);
|
|
699
|
-
return /* @__PURE__ */
|
|
700
|
-
/* @__PURE__ */
|
|
701
|
+
return /* @__PURE__ */ ys(Dt.Provider, { value: t, children: [
|
|
702
|
+
/* @__PURE__ */ bs(js, { client: e }),
|
|
701
703
|
s
|
|
702
704
|
] });
|
|
703
705
|
}
|
|
704
|
-
),
|
|
705
|
-
const e =
|
|
706
|
+
), kt = (s) => {
|
|
707
|
+
const e = es(Dt);
|
|
706
708
|
if (s)
|
|
707
709
|
return s;
|
|
708
710
|
if (!e)
|
|
709
711
|
throw new Error("No QueryClient set, use QueryClientProvider to set one");
|
|
710
712
|
return e;
|
|
711
713
|
};
|
|
712
|
-
function
|
|
714
|
+
function Ms() {
|
|
713
715
|
}
|
|
714
|
-
function
|
|
715
|
-
const t =
|
|
716
|
-
() => new
|
|
716
|
+
function Cr(s, e) {
|
|
717
|
+
const t = kt(e), r = q(s), n = Ze(() => [ct()]), u = ve(s.mutationKey ?? n.current), [i] = Rt(
|
|
718
|
+
() => new Rs(
|
|
717
719
|
t,
|
|
718
720
|
s
|
|
719
721
|
)
|
|
720
722
|
);
|
|
721
|
-
|
|
723
|
+
J(() => {
|
|
722
724
|
i.setOptions(s);
|
|
723
725
|
}, [i, s]);
|
|
724
726
|
const c = ut(() => i.observe(), [u, i]), l = Xe(c.result$) ?? c.lastValue, h = le(
|
|
725
727
|
(o, p) => {
|
|
726
|
-
i.mutate(o, p).catch(
|
|
728
|
+
i.mutate(o, p).catch(Ms);
|
|
727
729
|
},
|
|
728
730
|
[i]
|
|
729
731
|
);
|
|
730
|
-
return
|
|
732
|
+
return J(() => () => {
|
|
731
733
|
r.current.cancelOnUnMount && i.reset();
|
|
732
734
|
}, [i, r]), { ...l, mutate: h, mutateAsync: l.mutate };
|
|
733
735
|
}
|
|
734
|
-
function
|
|
736
|
+
function As(s) {
|
|
735
737
|
return (e) => e.pipe(
|
|
736
|
-
|
|
738
|
+
At((t) => {
|
|
737
739
|
s.next(t);
|
|
738
740
|
})
|
|
739
741
|
);
|
|
740
742
|
}
|
|
741
743
|
const pe = typeof window > "u" || "Deno" in window;
|
|
742
|
-
class
|
|
744
|
+
class Qs {
|
|
743
745
|
constructor() {
|
|
744
|
-
m(this, "isOnlineSubject", new
|
|
746
|
+
m(this, "isOnlineSubject", new Y(!0));
|
|
745
747
|
m(this, "online$", this.isOnlineSubject.pipe(Q()));
|
|
746
748
|
m(this, "backToOnline$", this.online$.pipe(
|
|
747
749
|
O((e) => e),
|
|
@@ -750,7 +752,7 @@ class As {
|
|
|
750
752
|
F(
|
|
751
753
|
pe ? Z : Ne(window, "offline").pipe(g(() => !1)),
|
|
752
754
|
pe ? Z : Ne(window, "online").pipe(g(() => !0))
|
|
753
|
-
).pipe(
|
|
755
|
+
).pipe(As(this.isOnlineSubject)).subscribe();
|
|
754
756
|
}
|
|
755
757
|
isOnline() {
|
|
756
758
|
return this.isOnlineSubject.getValue();
|
|
@@ -759,51 +761,51 @@ class As {
|
|
|
759
761
|
this.isOnlineSubject.getValue() !== e && this.isOnlineSubject.next(e);
|
|
760
762
|
}
|
|
761
763
|
}
|
|
762
|
-
const re = new
|
|
764
|
+
const re = new Qs();
|
|
763
765
|
function ht(s, e) {
|
|
764
766
|
return s.isStaleByTime(e.staleTime);
|
|
765
767
|
}
|
|
766
|
-
function
|
|
768
|
+
function Us(s, e) {
|
|
767
769
|
return e.enabled !== !1 && !s.state.dataUpdatedAt && !(s.state.status === "error" && e.retryOnMount === !1) && s.state.fetchStatus !== "fetching";
|
|
768
770
|
}
|
|
769
|
-
function
|
|
770
|
-
return
|
|
771
|
+
function $t(s, e) {
|
|
772
|
+
return Us(s, e) || s.state.dataUpdatedAt > 0 && Tt(s, e, e.refetchOnMount);
|
|
771
773
|
}
|
|
772
|
-
function
|
|
774
|
+
function wt(s, e, t, r) {
|
|
773
775
|
return s.state.fetchStatus !== "fetching" && t.enabled !== !1 && (s !== e || r.enabled === !1) && (!t.suspense || s.state.status !== "error") && ht(s, t);
|
|
774
776
|
}
|
|
775
|
-
function
|
|
776
|
-
return
|
|
777
|
+
function Is(s, e) {
|
|
778
|
+
return Tt(s, e, e.refetchOnWindowFocus);
|
|
777
779
|
}
|
|
778
|
-
function
|
|
780
|
+
function Tt(s, e, t) {
|
|
779
781
|
if (e.enabled !== !1) {
|
|
780
782
|
const r = typeof t == "function" ? t(s) : t;
|
|
781
783
|
return r === "idle" ? s.state.fetchStatus === "idle" : r === "always" || r !== !1 && ht(s, e);
|
|
782
784
|
}
|
|
783
785
|
return !1;
|
|
784
786
|
}
|
|
785
|
-
function
|
|
787
|
+
function Vs(s) {
|
|
786
788
|
return (s ?? "online") === "online" ? re.isOnline() : !0;
|
|
787
789
|
}
|
|
788
|
-
function
|
|
790
|
+
function Ct(s, e) {
|
|
789
791
|
return e.reduce(
|
|
790
792
|
(t, r) => r in s ? { ...t, [r]: s[r] } : t,
|
|
791
793
|
{}
|
|
792
794
|
);
|
|
793
795
|
}
|
|
794
|
-
function
|
|
796
|
+
function Ft(s) {
|
|
795
797
|
return Array.isArray(s) && s.length === Object.keys(s).length;
|
|
796
798
|
}
|
|
797
|
-
function
|
|
799
|
+
function Kt(s, e) {
|
|
798
800
|
if (s === e)
|
|
799
801
|
return s;
|
|
800
|
-
const t =
|
|
802
|
+
const t = Ft(s) && Ft(e);
|
|
801
803
|
if (t || nt(s) && nt(e)) {
|
|
802
804
|
const r = t ? s : Object.keys(s), n = r.length, u = t ? e : Object.keys(e), i = u.length, c = t ? [] : {};
|
|
803
805
|
let l = 0;
|
|
804
806
|
for (let h = 0; h < i; h++) {
|
|
805
807
|
const o = t ? h : u[h];
|
|
806
|
-
!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++);
|
|
807
809
|
}
|
|
808
810
|
return n === i && l === n ? s : c;
|
|
809
811
|
}
|
|
@@ -812,7 +814,7 @@ function Nt(s, e) {
|
|
|
812
814
|
function dt(s, e) {
|
|
813
815
|
return ((e == null ? void 0 : e.queryKeyHashFn) ?? ve)(s);
|
|
814
816
|
}
|
|
815
|
-
function
|
|
817
|
+
function Et(s, e) {
|
|
816
818
|
const {
|
|
817
819
|
type: t = "all",
|
|
818
820
|
exact: r,
|
|
@@ -835,16 +837,16 @@ function xt(s, e) {
|
|
|
835
837
|
}
|
|
836
838
|
return !(typeof c == "boolean" && e.isStale() !== c || typeof n < "u" && n !== e.state.fetchStatus || u && !u(e));
|
|
837
839
|
}
|
|
838
|
-
function
|
|
840
|
+
function Ps(s, e) {
|
|
839
841
|
return Math.max(s + (e ?? 0) - Date.now(), 0);
|
|
840
842
|
}
|
|
841
|
-
function
|
|
843
|
+
function Ds(s, e) {
|
|
842
844
|
return typeof s == "function" ? s(e) : s;
|
|
843
845
|
}
|
|
844
846
|
function Le(s, e, t) {
|
|
845
|
-
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;
|
|
846
848
|
}
|
|
847
|
-
const it = Symbol(),
|
|
849
|
+
const it = Symbol(), ks = ({
|
|
848
850
|
getOptions: s,
|
|
849
851
|
getState: e,
|
|
850
852
|
initialState: t
|
|
@@ -874,21 +876,21 @@ const it = Symbol(), Ds = ({
|
|
|
874
876
|
}
|
|
875
877
|
};
|
|
876
878
|
}, t)
|
|
877
|
-
),
|
|
879
|
+
), Ts = (s) => s.pipe(
|
|
878
880
|
g(
|
|
879
881
|
({ status: e, fetchStatus: t }) => t === "idle" && (e === "success" || e === "error")
|
|
880
882
|
)
|
|
881
|
-
),
|
|
883
|
+
), Nt = (s) => s.pipe(
|
|
882
884
|
Ye((e) => e.fetchStatus !== "idle", !0)
|
|
883
885
|
);
|
|
884
886
|
var We, te;
|
|
885
|
-
class
|
|
887
|
+
class Ks {
|
|
886
888
|
constructor() {
|
|
887
889
|
C(this, We, F(
|
|
888
890
|
pe ? Z : Ne(document, "visibilitychange"),
|
|
889
891
|
pe ? Z : Ne(window, "visibilitychange")
|
|
890
892
|
).pipe(g(() => document.visibilityState)));
|
|
891
|
-
C(this, te, new
|
|
893
|
+
C(this, te, new Y(
|
|
892
894
|
pe ? !0 : document.visibilityState === "visible"
|
|
893
895
|
));
|
|
894
896
|
// public readonly focused$ = this.#focusedSubject.pipe(distinctUntilChanged())
|
|
@@ -927,7 +929,7 @@ class Ts {
|
|
|
927
929
|
}
|
|
928
930
|
}
|
|
929
931
|
We = new WeakMap(), te = new WeakMap();
|
|
930
|
-
const ze = new
|
|
932
|
+
const ze = new Ks(), Ns = (s) => s.pipe(
|
|
931
933
|
O((e) => e.status === "success"),
|
|
932
934
|
g((e) => ({
|
|
933
935
|
data: e.data,
|
|
@@ -936,10 +938,10 @@ const ze = new Ts(), Ks = (s) => s.pipe(
|
|
|
936
938
|
})),
|
|
937
939
|
Q(V)
|
|
938
940
|
);
|
|
939
|
-
var
|
|
940
|
-
class
|
|
941
|
+
var B, R, Ce, ue, D, ye, Fe;
|
|
942
|
+
class qt {
|
|
941
943
|
constructor(e, t) {
|
|
942
|
-
C(this,
|
|
944
|
+
C(this, B, void 0);
|
|
943
945
|
C(this, R, void 0);
|
|
944
946
|
C(this, Ce, new I());
|
|
945
947
|
/**
|
|
@@ -978,8 +980,8 @@ class Ht {
|
|
|
978
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);
|
|
979
981
|
let { errorUpdatedAt: $, fetchStatus: w, error: H } = o;
|
|
980
982
|
if (r) {
|
|
981
|
-
const
|
|
982
|
-
(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");
|
|
983
985
|
}
|
|
984
986
|
const P = p && w === "fetching";
|
|
985
987
|
let j, S = l, z = c ?? null, W = h;
|
|
@@ -989,8 +991,8 @@ class Ht {
|
|
|
989
991
|
else
|
|
990
992
|
try {
|
|
991
993
|
z = e.select, j = e.select(o.data), j = Le(n == null ? void 0 : n.data, j, e), W = j, S = null;
|
|
992
|
-
} catch (
|
|
993
|
-
j = h, S =
|
|
994
|
+
} catch (k) {
|
|
995
|
+
j = h, S = k;
|
|
994
996
|
}
|
|
995
997
|
else
|
|
996
998
|
j = o.data, S = null;
|
|
@@ -999,20 +1001,20 @@ class Ht {
|
|
|
999
1001
|
const Ie = _ === "error";
|
|
1000
1002
|
let Ve = !1;
|
|
1001
1003
|
if (typeof e.placeholderData < "u" && typeof j > "u" && _ === "pending") {
|
|
1002
|
-
let
|
|
1004
|
+
let k;
|
|
1003
1005
|
if (n != null && n.isPlaceholderData && e.placeholderData === (u == null ? void 0 : u.placeholderData))
|
|
1004
|
-
|
|
1005
|
-
else if (
|
|
1006
|
+
k = n.data;
|
|
1007
|
+
else if (k = typeof e.placeholderData == "function" ? e.placeholderData(
|
|
1006
1008
|
(De = a(this, ye)) == null ? void 0 : De.state.data,
|
|
1007
1009
|
a(this, ye)
|
|
1008
|
-
) : e.placeholderData, e.select && typeof
|
|
1010
|
+
) : e.placeholderData, e.select && typeof k < "u")
|
|
1009
1011
|
try {
|
|
1010
|
-
|
|
1012
|
+
k = e.select(k);
|
|
1011
1013
|
} catch {
|
|
1012
1014
|
}
|
|
1013
|
-
typeof
|
|
1015
|
+
typeof k < "u" && (_ = "success", j = Le(
|
|
1014
1016
|
n == null ? void 0 : n.data,
|
|
1015
|
-
|
|
1017
|
+
k,
|
|
1016
1018
|
e
|
|
1017
1019
|
), Ve = !0);
|
|
1018
1020
|
}
|
|
@@ -1050,7 +1052,7 @@ class Ht {
|
|
|
1050
1052
|
selectResult: W
|
|
1051
1053
|
};
|
|
1052
1054
|
});
|
|
1053
|
-
this.options = t, M(this,
|
|
1055
|
+
this.options = t, M(this, B, e), this.bindMethods(), M(this, R, this.setOptions(t));
|
|
1054
1056
|
const r = a(this, R);
|
|
1055
1057
|
M(this, ue, r.state);
|
|
1056
1058
|
const { result: n, select: u } = this.getObserverResultFromQuery({
|
|
@@ -1073,7 +1075,7 @@ class Ht {
|
|
|
1073
1075
|
}
|
|
1074
1076
|
setOptions(e) {
|
|
1075
1077
|
const t = this.options;
|
|
1076
|
-
if (this.options = a(this,
|
|
1078
|
+
if (this.options = a(this, B).defaultQueryOptions(e), V(this.options, t) || a(this, B).getQueryCache().notify({
|
|
1077
1079
|
type: "observerOptionsUpdated",
|
|
1078
1080
|
query: a(this, R),
|
|
1079
1081
|
observer: this
|
|
@@ -1086,7 +1088,7 @@ class Ht {
|
|
|
1086
1088
|
}), r;
|
|
1087
1089
|
}
|
|
1088
1090
|
buildQuery(e) {
|
|
1089
|
-
const t = a(this,
|
|
1091
|
+
const t = a(this, B).getQueryCache().build(a(this, B), e);
|
|
1090
1092
|
return !t.options.queryFn && this.options.queryFn && t.setOptions(e), t;
|
|
1091
1093
|
}
|
|
1092
1094
|
getCurrentResult() {
|
|
@@ -1106,7 +1108,7 @@ class Ht {
|
|
|
1106
1108
|
optimisticResult: !0,
|
|
1107
1109
|
prevResult: a(this, D)
|
|
1108
1110
|
});
|
|
1109
|
-
return
|
|
1111
|
+
return qs(this, r.result) && this.updateResult({ query: t, ...r }), r.result;
|
|
1110
1112
|
}
|
|
1111
1113
|
updateResult({
|
|
1112
1114
|
query: e,
|
|
@@ -1115,7 +1117,7 @@ class Ht {
|
|
|
1115
1117
|
select: n,
|
|
1116
1118
|
selectResult: u
|
|
1117
1119
|
}) {
|
|
1118
|
-
a(this, D).state = e.state, a(this, D).result = t, a(this, D).selectResult = u, r !== void 0 && (a(this, D).selectError = r), n !== void 0 && (a(this, D).select = n), a(this, D).options = this.options, e.state.data !== void 0 && M(this, ye, e), a(this,
|
|
1120
|
+
a(this, D).state = e.state, a(this, D).result = t, a(this, D).selectResult = u, r !== void 0 && (a(this, D).selectError = r), n !== void 0 && (a(this, D).select = n), a(this, D).options = this.options, e.state.data !== void 0 && M(this, ye, e), a(this, B).getQueryCache().notify({
|
|
1119
1121
|
query: a(this, R),
|
|
1120
1122
|
type: "observerResultsUpdated"
|
|
1121
1123
|
});
|
|
@@ -1135,7 +1137,7 @@ class Ht {
|
|
|
1135
1137
|
...e,
|
|
1136
1138
|
cancelRefetch: (e == null ? void 0 : e.cancelRefetch) ?? !0
|
|
1137
1139
|
};
|
|
1138
|
-
a(this, R).fetch(this.options, r).catch(
|
|
1140
|
+
a(this, R).fetch(this.options, r).catch(K), a(this, Ce).next({
|
|
1139
1141
|
query: t,
|
|
1140
1142
|
fetchOptions: r
|
|
1141
1143
|
}), await t.getFetchResultAsPromise();
|
|
@@ -1165,10 +1167,10 @@ class Ht {
|
|
|
1165
1167
|
query: a(this, R),
|
|
1166
1168
|
options: this.options
|
|
1167
1169
|
}),
|
|
1168
|
-
|
|
1170
|
+
Mt(),
|
|
1169
1171
|
E(
|
|
1170
1172
|
([{ options: i, query: c }, { options: l, query: h }]) => {
|
|
1171
|
-
|
|
1173
|
+
wt(h, c, l, i) && this.fetch().catch(K);
|
|
1172
1174
|
}
|
|
1173
1175
|
),
|
|
1174
1176
|
he()
|
|
@@ -1194,7 +1196,7 @@ class Ht {
|
|
|
1194
1196
|
), h = a(this, Ce).pipe(
|
|
1195
1197
|
O((S) => S.query === i)
|
|
1196
1198
|
), o = i.state$.pipe(
|
|
1197
|
-
|
|
1199
|
+
Ns,
|
|
1198
1200
|
x(
|
|
1199
1201
|
(S) => this.options.staleTime === 1 / 0 ? qe : (this.options.staleTime ?? 0) <= 0 ? v(S).pipe(ot(1)) : Qe(this.options.staleTime ?? 1)
|
|
1200
1202
|
),
|
|
@@ -1202,10 +1204,10 @@ class Ht {
|
|
|
1202
1204
|
), p = (S, z) => {
|
|
1203
1205
|
const W = c.notifyOnChangeProps, _ = typeof W == "function" ? W() : W;
|
|
1204
1206
|
return (Array.isArray(_) ? _.length === 0 ? () => !0 : (Ve, Pe) => {
|
|
1205
|
-
const ft =
|
|
1207
|
+
const ft = Ct(
|
|
1206
1208
|
Ve,
|
|
1207
1209
|
_
|
|
1208
|
-
), De =
|
|
1210
|
+
), De = Ct(
|
|
1209
1211
|
Pe,
|
|
1210
1212
|
_
|
|
1211
1213
|
);
|
|
@@ -1213,17 +1215,17 @@ class Ht {
|
|
|
1213
1215
|
} : V)(S, z);
|
|
1214
1216
|
}, d = h.pipe(
|
|
1215
1217
|
x(() => i.state$),
|
|
1216
|
-
|
|
1218
|
+
Nt
|
|
1217
1219
|
), f = l.pipe(
|
|
1218
1220
|
g(({ refetchInterval: S, refetchIntervalInBackground: z }) => ({
|
|
1219
1221
|
refetchInterval: (typeof S == "function" ? S(a(this, R)) : S) ?? !1,
|
|
1220
1222
|
refetchIntervalInBackground: z
|
|
1221
1223
|
})),
|
|
1222
1224
|
Q(V),
|
|
1223
|
-
x(({ refetchInterval: S, refetchIntervalInBackground: z }) => S ?
|
|
1225
|
+
x(({ refetchInterval: S, refetchIntervalInBackground: z }) => S ? us(S).pipe(
|
|
1224
1226
|
E(() => {
|
|
1225
1227
|
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
|
1226
|
-
(z || ze.isFocused()) && this.fetch({ cancelRefetch: !1 }).catch(
|
|
1228
|
+
(z || ze.isFocused()) && this.fetch({ cancelRefetch: !1 }).catch(K);
|
|
1227
1229
|
})
|
|
1228
1230
|
) : qe),
|
|
1229
1231
|
he()
|
|
@@ -1238,7 +1240,7 @@ class Ht {
|
|
|
1238
1240
|
x(() => ze.focusRegained$),
|
|
1239
1241
|
gt(l),
|
|
1240
1242
|
E(([, S]) => {
|
|
1241
|
-
|
|
1243
|
+
Is(i, S) && this.fetch({ cancelRefetch: !1 }).catch(K);
|
|
1242
1244
|
}),
|
|
1243
1245
|
he()
|
|
1244
1246
|
), w = b.pipe(
|
|
@@ -1272,7 +1274,7 @@ class Ht {
|
|
|
1272
1274
|
lt((i) => M(this, Fe, i)),
|
|
1273
1275
|
E({
|
|
1274
1276
|
subscribe: () => {
|
|
1275
|
-
|
|
1277
|
+
$t(e, this.options) && this.fetch().catch(K);
|
|
1276
1278
|
}
|
|
1277
1279
|
})
|
|
1278
1280
|
)
|
|
@@ -1281,13 +1283,13 @@ class Ht {
|
|
|
1281
1283
|
destroy() {
|
|
1282
1284
|
}
|
|
1283
1285
|
}
|
|
1284
|
-
|
|
1285
|
-
function
|
|
1286
|
+
B = new WeakMap(), R = new WeakMap(), Ce = new WeakMap(), ue = new WeakMap(), D = new WeakMap(), ye = new WeakMap(), Fe = new WeakMap();
|
|
1287
|
+
function qs(s, e) {
|
|
1286
1288
|
return !V(s.getCurrentResult(), e);
|
|
1287
1289
|
}
|
|
1288
|
-
const
|
|
1289
|
-
|
|
1290
|
-
function
|
|
1290
|
+
const Ht = Ge.createContext(!1), Hs = () => Ge.useContext(Ht);
|
|
1291
|
+
Ht.Provider;
|
|
1292
|
+
function _s() {
|
|
1291
1293
|
let s = !1;
|
|
1292
1294
|
return {
|
|
1293
1295
|
clearReset: () => {
|
|
@@ -1299,24 +1301,24 @@ function Hs() {
|
|
|
1299
1301
|
isReset: () => s
|
|
1300
1302
|
};
|
|
1301
1303
|
}
|
|
1302
|
-
const
|
|
1303
|
-
function
|
|
1304
|
+
const Ls = Ge.createContext(_s()), zs = () => Ge.useContext(Ls);
|
|
1305
|
+
function Ws(s, e) {
|
|
1304
1306
|
return typeof s == "function" ? s(...e) : !!s;
|
|
1305
1307
|
}
|
|
1306
|
-
const
|
|
1308
|
+
const Gs = ({
|
|
1307
1309
|
result: s,
|
|
1308
1310
|
errorResetBoundary: e,
|
|
1309
1311
|
throwOnError: t,
|
|
1310
1312
|
query: r
|
|
1311
|
-
}) => s.isError && !e.isReset() && !s.isFetching && r &&
|
|
1312
|
-
function
|
|
1313
|
+
}) => s.isError && !e.isReset() && !s.isFetching && r && Ws(t, [s.error, r]);
|
|
1314
|
+
function _t(s, e, t) {
|
|
1313
1315
|
if (process.env.NODE_ENV !== "production" && (typeof s != "object" || Array.isArray(s)))
|
|
1314
1316
|
throw new Error(
|
|
1315
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'
|
|
1316
1318
|
);
|
|
1317
|
-
const r =
|
|
1319
|
+
const r = kt(t), n = Hs(), u = zs(), i = r.defaultQueryOptions(s);
|
|
1318
1320
|
i._optimisticResults = n ? "isRestoring" : "optimistic";
|
|
1319
|
-
const [c] =
|
|
1321
|
+
const [c] = Rt(
|
|
1320
1322
|
() => new e(
|
|
1321
1323
|
r,
|
|
1322
1324
|
i
|
|
@@ -1334,11 +1336,11 @@ function Lt(s, e, t) {
|
|
|
1334
1336
|
O((d) => !V(d, h.current))
|
|
1335
1337
|
),
|
|
1336
1338
|
[]
|
|
1337
|
-
),
|
|
1339
|
+
), J(() => {
|
|
1338
1340
|
c.setOptions(i);
|
|
1339
1341
|
}, [i, c]);
|
|
1340
1342
|
const p = o.error;
|
|
1341
|
-
if (p &&
|
|
1343
|
+
if (p && Gs({
|
|
1342
1344
|
result: o,
|
|
1343
1345
|
errorResetBoundary: u,
|
|
1344
1346
|
throwOnError: i.throwOnError,
|
|
@@ -1347,11 +1349,11 @@ function Lt(s, e, t) {
|
|
|
1347
1349
|
throw p;
|
|
1348
1350
|
return h.current;
|
|
1349
1351
|
}
|
|
1350
|
-
function
|
|
1351
|
-
return
|
|
1352
|
+
function Fr(s, e) {
|
|
1353
|
+
return _t(s, qt, e);
|
|
1352
1354
|
}
|
|
1353
|
-
function
|
|
1354
|
-
return
|
|
1355
|
+
function Er(s, e) {
|
|
1356
|
+
return _t(
|
|
1355
1357
|
{
|
|
1356
1358
|
refetchOnMount: "idle",
|
|
1357
1359
|
refetchOnReconnect: !1,
|
|
@@ -1359,41 +1361,41 @@ function Cr(s, e) {
|
|
|
1359
1361
|
refetchOnWindowFocus: !1,
|
|
1360
1362
|
...s
|
|
1361
1363
|
},
|
|
1362
|
-
|
|
1364
|
+
qt,
|
|
1363
1365
|
e
|
|
1364
1366
|
);
|
|
1365
1367
|
}
|
|
1366
|
-
function
|
|
1368
|
+
function xr(s, e, t = []) {
|
|
1367
1369
|
const r = e != null && !Array.isArray(e) ? e : {}, n = r.retry ?? !0, u = q(
|
|
1368
1370
|
r.onError ?? ((l) => {
|
|
1369
1371
|
console.error(l);
|
|
1370
1372
|
})
|
|
1371
1373
|
), i = le(() => U(s), t), c = le(
|
|
1372
1374
|
() => i().pipe(
|
|
1373
|
-
|
|
1375
|
+
X((l) => {
|
|
1374
1376
|
throw u.current(l), l;
|
|
1375
1377
|
}),
|
|
1376
|
-
n ?
|
|
1378
|
+
n ? as() : jt
|
|
1377
1379
|
),
|
|
1378
1380
|
[i, n, u]
|
|
1379
1381
|
);
|
|
1380
|
-
|
|
1382
|
+
Qt(c, t);
|
|
1381
1383
|
}
|
|
1382
|
-
const
|
|
1384
|
+
const Lt = () => (s) => F(
|
|
1383
1385
|
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
1384
1386
|
v({ isPaused: !0 }),
|
|
1385
1387
|
re.backToOnline$.pipe(
|
|
1386
|
-
|
|
1388
|
+
N(
|
|
1387
1389
|
() => (
|
|
1388
1390
|
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
1389
1391
|
F(v({ isPaused: !1 }), s)
|
|
1390
1392
|
)
|
|
1391
1393
|
)
|
|
1392
1394
|
)
|
|
1393
|
-
),
|
|
1395
|
+
), Js = (s) => {
|
|
1394
1396
|
let e = 0;
|
|
1395
1397
|
return s.pipe(
|
|
1396
|
-
|
|
1398
|
+
X((t) => (e++, e <= 1 && !re.isOnline() ? F(
|
|
1397
1399
|
v({
|
|
1398
1400
|
failureCount: e,
|
|
1399
1401
|
failureReason: t
|
|
@@ -1403,18 +1405,18 @@ const zt = () => (s) => F(
|
|
|
1403
1405
|
* timer needed to be iso RQ, so the state returned by mutation include both previous and next one
|
|
1404
1406
|
*/
|
|
1405
1407
|
Qe(1).pipe(
|
|
1406
|
-
|
|
1407
|
-
() => Oe(() => t).pipe(
|
|
1408
|
+
N(
|
|
1409
|
+
() => Oe(() => t).pipe(Lt())
|
|
1408
1410
|
)
|
|
1409
1411
|
)
|
|
1410
1412
|
) : Oe(() => t)))
|
|
1411
1413
|
);
|
|
1412
|
-
},
|
|
1414
|
+
}, Ys = ({
|
|
1413
1415
|
variables: s,
|
|
1414
1416
|
state: e,
|
|
1415
1417
|
options: t
|
|
1416
1418
|
}) => {
|
|
1417
|
-
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(
|
|
1418
1420
|
() => r,
|
|
1419
1421
|
v(e.context),
|
|
1420
1422
|
U(
|
|
@@ -1430,7 +1432,7 @@ const zt = () => (s) => F(
|
|
|
1430
1432
|
return ($ = t.onError) == null ? void 0 : $.call(t, d, s, f);
|
|
1431
1433
|
}
|
|
1432
1434
|
).pipe(
|
|
1433
|
-
|
|
1435
|
+
X(() => v(d)),
|
|
1434
1436
|
g(
|
|
1435
1437
|
() => ({
|
|
1436
1438
|
failureCount: y,
|
|
@@ -1455,8 +1457,8 @@ const zt = () => (s) => F(
|
|
|
1455
1457
|
context: d
|
|
1456
1458
|
})
|
|
1457
1459
|
),
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
+
Js,
|
|
1461
|
+
Vt({
|
|
1460
1462
|
...t,
|
|
1461
1463
|
retry: (b, $) => {
|
|
1462
1464
|
const w = t.retry ?? 0;
|
|
@@ -1481,7 +1483,7 @@ const zt = () => (s) => F(
|
|
|
1481
1483
|
!0
|
|
1482
1484
|
)
|
|
1483
1485
|
);
|
|
1484
|
-
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());
|
|
1485
1487
|
})
|
|
1486
1488
|
), o = v({
|
|
1487
1489
|
...e,
|
|
@@ -1524,7 +1526,7 @@ const zt = () => (s) => F(
|
|
|
1524
1526
|
);
|
|
1525
1527
|
}
|
|
1526
1528
|
).pipe(
|
|
1527
|
-
|
|
1529
|
+
X((P) => d ? v(d) : v(P))
|
|
1528
1530
|
);
|
|
1529
1531
|
return ke(b, w).pipe(
|
|
1530
1532
|
Te(),
|
|
@@ -1544,7 +1546,7 @@ const zt = () => (s) => F(
|
|
|
1544
1546
|
...y
|
|
1545
1547
|
}
|
|
1546
1548
|
),
|
|
1547
|
-
|
|
1549
|
+
X(
|
|
1548
1550
|
(P) => l(P, y.context, 0).pipe(
|
|
1549
1551
|
g((j) => ({
|
|
1550
1552
|
...j,
|
|
@@ -1565,13 +1567,13 @@ const zt = () => (s) => F(
|
|
|
1565
1567
|
);
|
|
1566
1568
|
};
|
|
1567
1569
|
var Ee, se, be;
|
|
1568
|
-
class
|
|
1570
|
+
class Bs {
|
|
1569
1571
|
constructor({
|
|
1570
1572
|
options: e,
|
|
1571
1573
|
mutationCache: t,
|
|
1572
1574
|
state: r
|
|
1573
1575
|
}) {
|
|
1574
|
-
C(this, Ee, new
|
|
1576
|
+
C(this, Ee, new Y(0));
|
|
1575
1577
|
C(this, se, new I());
|
|
1576
1578
|
C(this, be, new I());
|
|
1577
1579
|
m(this, "state", fe());
|
|
@@ -1587,7 +1589,7 @@ class Ys {
|
|
|
1587
1589
|
}))
|
|
1588
1590
|
), u = a(this, be).pipe(
|
|
1589
1591
|
x(
|
|
1590
|
-
(c) =>
|
|
1592
|
+
(c) => Ys({
|
|
1591
1593
|
options: {
|
|
1592
1594
|
...this.options,
|
|
1593
1595
|
onMutate: (l) => {
|
|
@@ -1605,7 +1607,7 @@ class Ys {
|
|
|
1605
1607
|
return (y = (f = this.options).onMutate) == null ? void 0 : y.call(f, l);
|
|
1606
1608
|
});
|
|
1607
1609
|
return h.pipe(
|
|
1608
|
-
|
|
1610
|
+
N(() => p)
|
|
1609
1611
|
);
|
|
1610
1612
|
},
|
|
1611
1613
|
onError: (l, h, o) => {
|
|
@@ -1684,7 +1686,7 @@ class Ys {
|
|
|
1684
1686
|
}),
|
|
1685
1687
|
this.state
|
|
1686
1688
|
),
|
|
1687
|
-
|
|
1689
|
+
Pt,
|
|
1688
1690
|
E((c) => {
|
|
1689
1691
|
this.state = c;
|
|
1690
1692
|
}),
|
|
@@ -1721,19 +1723,19 @@ class Ys {
|
|
|
1721
1723
|
}
|
|
1722
1724
|
}
|
|
1723
1725
|
Ee = new WeakMap(), se = new WeakMap(), be = new WeakMap();
|
|
1724
|
-
const
|
|
1726
|
+
const xt = ({
|
|
1725
1727
|
mutationKey: s,
|
|
1726
1728
|
status: e,
|
|
1727
1729
|
predicate: t,
|
|
1728
1730
|
exact: r = !0
|
|
1729
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;
|
|
1730
|
-
class
|
|
1732
|
+
class zt {
|
|
1731
1733
|
constructor() {
|
|
1732
1734
|
/**
|
|
1733
1735
|
* @important
|
|
1734
1736
|
* Query store. Could be turned into a map for more performance.
|
|
1735
1737
|
*/
|
|
1736
|
-
m(this, "entriesSubject", new
|
|
1738
|
+
m(this, "entriesSubject", new Y([]));
|
|
1737
1739
|
m(this, "changeSubject", new I());
|
|
1738
1740
|
m(this, "entries$", this.entriesSubject.pipe(de()));
|
|
1739
1741
|
m(this, "added$", this.changeSubject.pipe(
|
|
@@ -1749,11 +1751,11 @@ class Wt {
|
|
|
1749
1751
|
m(this, "stateChange$", F(
|
|
1750
1752
|
this.entriesSubject.pipe(
|
|
1751
1753
|
Je(),
|
|
1752
|
-
|
|
1754
|
+
N((e) => Se(e))
|
|
1753
1755
|
),
|
|
1754
1756
|
this.added$
|
|
1755
1757
|
).pipe(
|
|
1756
|
-
|
|
1758
|
+
N(
|
|
1757
1759
|
(e) => e.state$.pipe(
|
|
1758
1760
|
g(() => e),
|
|
1759
1761
|
ne(
|
|
@@ -1781,14 +1783,14 @@ class Wt {
|
|
|
1781
1783
|
return this.entriesSubject.getValue().find(e);
|
|
1782
1784
|
}
|
|
1783
1785
|
}
|
|
1784
|
-
var
|
|
1785
|
-
class
|
|
1786
|
+
var T;
|
|
1787
|
+
class Xs {
|
|
1786
1788
|
constructor(e = {}) {
|
|
1787
|
-
C(this,
|
|
1789
|
+
C(this, T, new zt());
|
|
1788
1790
|
this.config = e;
|
|
1789
1791
|
}
|
|
1790
1792
|
build(e, t, r) {
|
|
1791
|
-
const n = new
|
|
1793
|
+
const n = new Bs({
|
|
1792
1794
|
mutationCache: this,
|
|
1793
1795
|
options: e.defaultMutationOptions(t),
|
|
1794
1796
|
state: r
|
|
@@ -1812,25 +1814,25 @@ class Bs {
|
|
|
1812
1814
|
complete: () => {
|
|
1813
1815
|
this.remove(n);
|
|
1814
1816
|
}
|
|
1815
|
-
}), a(this,
|
|
1817
|
+
}), a(this, T).add(n), n;
|
|
1816
1818
|
}
|
|
1817
1819
|
getAll() {
|
|
1818
1820
|
return this.findAll();
|
|
1819
1821
|
}
|
|
1820
1822
|
remove(e) {
|
|
1821
|
-
const t = a(this,
|
|
1822
|
-
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);
|
|
1823
1825
|
}
|
|
1824
1826
|
find(e) {
|
|
1825
|
-
const t = { exact: !0, ...e }, r =
|
|
1826
|
-
return a(this,
|
|
1827
|
+
const t = { exact: !0, ...e }, r = xt(t);
|
|
1828
|
+
return a(this, T).getValues().find((n) => r(n));
|
|
1827
1829
|
}
|
|
1828
1830
|
findAll(e = {}) {
|
|
1829
|
-
const t = { exact: !0, ...e }, r =
|
|
1830
|
-
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);
|
|
1831
1833
|
}
|
|
1832
1834
|
observe() {
|
|
1833
|
-
return a(this,
|
|
1835
|
+
return a(this, T).stateChange$.pipe(ce());
|
|
1834
1836
|
}
|
|
1835
1837
|
/**
|
|
1836
1838
|
* @important
|
|
@@ -1838,7 +1840,7 @@ class Bs {
|
|
|
1838
1840
|
*/
|
|
1839
1841
|
subscribe(e) {
|
|
1840
1842
|
const t = F(
|
|
1841
|
-
a(this,
|
|
1843
|
+
a(this, T).added$.pipe(
|
|
1842
1844
|
E((r) => {
|
|
1843
1845
|
e({
|
|
1844
1846
|
type: "added",
|
|
@@ -1846,7 +1848,7 @@ class Bs {
|
|
|
1846
1848
|
});
|
|
1847
1849
|
})
|
|
1848
1850
|
),
|
|
1849
|
-
a(this,
|
|
1851
|
+
a(this, T).removed$.pipe(
|
|
1850
1852
|
E((r) => {
|
|
1851
1853
|
e({
|
|
1852
1854
|
type: "removed",
|
|
@@ -1854,7 +1856,7 @@ class Bs {
|
|
|
1854
1856
|
});
|
|
1855
1857
|
})
|
|
1856
1858
|
),
|
|
1857
|
-
a(this,
|
|
1859
|
+
a(this, T).stateChange$.pipe(
|
|
1858
1860
|
E((r) => {
|
|
1859
1861
|
e({
|
|
1860
1862
|
type: "updated",
|
|
@@ -1878,7 +1880,7 @@ class Bs {
|
|
|
1878
1880
|
if (!e.length)
|
|
1879
1881
|
return Z;
|
|
1880
1882
|
const t = e.map((r) => r.continue());
|
|
1881
|
-
return
|
|
1883
|
+
return cs(t);
|
|
1882
1884
|
}
|
|
1883
1885
|
clear() {
|
|
1884
1886
|
this.getAll().forEach((e) => {
|
|
@@ -1886,8 +1888,8 @@ class Bs {
|
|
|
1886
1888
|
});
|
|
1887
1889
|
}
|
|
1888
1890
|
}
|
|
1889
|
-
|
|
1890
|
-
function
|
|
1891
|
+
T = new WeakMap();
|
|
1892
|
+
function Zs(s) {
|
|
1891
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;
|
|
1892
1894
|
return {
|
|
1893
1895
|
data: e,
|
|
@@ -1904,11 +1906,11 @@ function Xs(s) {
|
|
|
1904
1906
|
fetchStatus: "idle"
|
|
1905
1907
|
};
|
|
1906
1908
|
}
|
|
1907
|
-
const
|
|
1909
|
+
const er = (s) => Ae(() => ze.isFocused() ? s : ze.focusRegained$.pipe(N(() => s))), tr = (s) => {
|
|
1908
1910
|
let e = 0;
|
|
1909
1911
|
return (t) => {
|
|
1910
1912
|
const r = re.backToOnline$.pipe(
|
|
1911
|
-
|
|
1913
|
+
N(
|
|
1912
1914
|
() => F(
|
|
1913
1915
|
v({ fetchStatus: "fetching" }),
|
|
1914
1916
|
t
|
|
@@ -1923,7 +1925,7 @@ const Zs = (s) => Ae(() => ze.isFocused() ? s : ze.focusRegained$.pipe(k(() => s
|
|
|
1923
1925
|
r
|
|
1924
1926
|
) : t));
|
|
1925
1927
|
};
|
|
1926
|
-
},
|
|
1928
|
+
}, sr = (s) => (e) => {
|
|
1927
1929
|
const t = new I(), r = t.pipe(
|
|
1928
1930
|
Je(),
|
|
1929
1931
|
/**
|
|
@@ -1931,7 +1933,7 @@ const Zs = (s) => Ae(() => ze.isFocused() ? s : ze.focusRegained$.pipe(k(() => s
|
|
|
1931
1933
|
* for the next tick to make sure observable chain received this data at least
|
|
1932
1934
|
*/
|
|
1933
1935
|
ot(1),
|
|
1934
|
-
|
|
1936
|
+
N(() => s.pipe(O((n) => n === 0)))
|
|
1935
1937
|
);
|
|
1936
1938
|
return e.pipe(
|
|
1937
1939
|
E(() => {
|
|
@@ -1939,7 +1941,7 @@ const Zs = (s) => Ae(() => ze.isFocused() ? s : ze.focusRegained$.pipe(k(() => s
|
|
|
1939
1941
|
}),
|
|
1940
1942
|
ne(r)
|
|
1941
1943
|
);
|
|
1942
|
-
},
|
|
1944
|
+
}, rr = (s) => {
|
|
1943
1945
|
const e = async () => await Promise.reject(new Error("No query found"));
|
|
1944
1946
|
process.env.NODE_ENV !== "production" && s.queryFn === it && console.error(
|
|
1945
1947
|
`Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${s.queryHash}'`
|
|
@@ -1961,7 +1963,7 @@ const Zs = (s) => Ae(() => ze.isFocused() ? s : ze.focusRegained$.pipe(k(() => s
|
|
|
1961
1963
|
() => r(u)
|
|
1962
1964
|
)
|
|
1963
1965
|
) : r).pipe(
|
|
1964
|
-
|
|
1966
|
+
sr(s.observers$),
|
|
1965
1967
|
E({
|
|
1966
1968
|
complete: () => {
|
|
1967
1969
|
t = !0;
|
|
@@ -1973,10 +1975,10 @@ const Zs = (s) => Ae(() => ze.isFocused() ? s : ze.focusRegained$.pipe(k(() => s
|
|
|
1973
1975
|
})
|
|
1974
1976
|
),
|
|
1975
1977
|
// takeUntil(hasDataAndNoObservers$),
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
+
tr(s),
|
|
1979
|
+
Vt({
|
|
1978
1980
|
...s,
|
|
1979
|
-
retryAfter: () => v(!0).pipe(
|
|
1981
|
+
retryAfter: () => v(!0).pipe(er),
|
|
1980
1982
|
catchError: (o, p) => v({
|
|
1981
1983
|
status: "error",
|
|
1982
1984
|
fetchStatus: "idle",
|
|
@@ -1992,7 +1994,7 @@ const Zs = (s) => Ae(() => ze.isFocused() ? s : ze.focusRegained$.pipe(k(() => s
|
|
|
1992
1994
|
})
|
|
1993
1995
|
)
|
|
1994
1996
|
}),
|
|
1995
|
-
|
|
1997
|
+
N((o) => "data" in o ? v({
|
|
1996
1998
|
...o,
|
|
1997
1999
|
status: "success",
|
|
1998
2000
|
fetchStatus: "idle",
|
|
@@ -2025,7 +2027,7 @@ const Zs = (s) => Ae(() => ze.isFocused() ? s : ze.focusRegained$.pipe(k(() => s
|
|
|
2025
2027
|
* before shallow compare will not update the state, otherwise it's our chance to catch
|
|
2026
2028
|
* the end of observable fn.
|
|
2027
2029
|
*/
|
|
2028
|
-
|
|
2030
|
+
ls({ fetchStatus: "idle" }),
|
|
2029
2031
|
de()
|
|
2030
2032
|
), h = v({
|
|
2031
2033
|
status: "pending",
|
|
@@ -2040,15 +2042,15 @@ const Zs = (s) => Ae(() => ze.isFocused() ? s : ze.focusRegained$.pipe(k(() => s
|
|
|
2040
2042
|
abortController: n
|
|
2041
2043
|
};
|
|
2042
2044
|
};
|
|
2043
|
-
class
|
|
2045
|
+
class nr {
|
|
2044
2046
|
constructor(e) {
|
|
2045
2047
|
m(this, "revert");
|
|
2046
2048
|
m(this, "silent");
|
|
2047
2049
|
this.revert = e == null ? void 0 : e.revert, this.silent = e == null ? void 0 : e.silent;
|
|
2048
2050
|
}
|
|
2049
2051
|
}
|
|
2050
|
-
const
|
|
2051
|
-
function
|
|
2052
|
+
const ir = { backgroundColor: "transparent", color: "inherit" };
|
|
2053
|
+
function Wt(s) {
|
|
2052
2054
|
const e = {
|
|
2053
2055
|
namespaces: [
|
|
2054
2056
|
{
|
|
@@ -2057,10 +2059,10 @@ function Gt(s) {
|
|
|
2057
2059
|
}
|
|
2058
2060
|
],
|
|
2059
2061
|
namespace(t, r) {
|
|
2060
|
-
const n =
|
|
2062
|
+
const n = Wt();
|
|
2061
2063
|
return n.namespaces.push({
|
|
2062
2064
|
name: t,
|
|
2063
|
-
style: r ??
|
|
2065
|
+
style: r ?? ir
|
|
2064
2066
|
}), n;
|
|
2065
2067
|
},
|
|
2066
2068
|
printNamespaces() {
|
|
@@ -2095,9 +2097,9 @@ function Gt(s) {
|
|
|
2095
2097
|
};
|
|
2096
2098
|
return e;
|
|
2097
2099
|
}
|
|
2098
|
-
const
|
|
2100
|
+
const ur = Wt();
|
|
2099
2101
|
var xe, ae;
|
|
2100
|
-
class
|
|
2102
|
+
class ar {
|
|
2101
2103
|
constructor(e) {
|
|
2102
2104
|
m(this, "queryKey");
|
|
2103
2105
|
m(this, "queryHash");
|
|
@@ -2113,12 +2115,12 @@ class ur {
|
|
|
2113
2115
|
m(this, "invalidatedSubject", new I());
|
|
2114
2116
|
m(this, "resetSubject", new I());
|
|
2115
2117
|
m(this, "destroySubject", new I());
|
|
2116
|
-
m(this, "observersSubject", new
|
|
2118
|
+
m(this, "observersSubject", new Y([]));
|
|
2117
2119
|
m(this, "abortSignalConsumed", !1);
|
|
2118
2120
|
m(this, "observerCount$", this.observersSubject.asObservable().pipe(g((e) => e.length)));
|
|
2119
2121
|
m(this, "observers$", this.observersSubject.asObservable());
|
|
2120
2122
|
m(this, "state$");
|
|
2121
|
-
M(this, xe, e.defaultOptions), this.options = this.setOptions(e.options), this.queryKey = e.queryKey, this.queryHash = e.queryHash, M(this, ae, e.state ??
|
|
2123
|
+
M(this, xe, e.defaultOptions), this.options = this.setOptions(e.options), this.queryKey = e.queryKey, this.queryHash = e.queryHash, M(this, ae, e.state ?? Zs(this.options)), this.state = a(this, ae), this.gcTime = this.updateGcTime(this.options.gcTime), this.state$ = F(
|
|
2122
2124
|
this.resetSubject.pipe(
|
|
2123
2125
|
g(() => ({ command: "reset", state: a(this, ae) }))
|
|
2124
2126
|
),
|
|
@@ -2138,24 +2140,24 @@ class ur {
|
|
|
2138
2140
|
state: {
|
|
2139
2141
|
status: t != null && t.revert ? this.state.status : "error",
|
|
2140
2142
|
fetchStatus: "idle",
|
|
2141
|
-
error: new
|
|
2143
|
+
error: new nr(t)
|
|
2142
2144
|
}
|
|
2143
2145
|
}))
|
|
2144
2146
|
),
|
|
2145
2147
|
this.executeSubject.pipe(
|
|
2146
|
-
|
|
2148
|
+
N(() => {
|
|
2147
2149
|
let t = !1;
|
|
2148
2150
|
const r = this.executeSubject.pipe(
|
|
2149
2151
|
// should not be needed since the fetch return current promise
|
|
2150
2152
|
// in case we don't cancel
|
|
2151
2153
|
O((h) => (h == null ? void 0 : h.cancelRefetch) !== !1)
|
|
2152
2154
|
), n = this.observers$.pipe(
|
|
2153
|
-
|
|
2155
|
+
Mt(),
|
|
2154
2156
|
E(([h, o]) => {
|
|
2155
2157
|
o.length === 0 && h.length > 0 ? t = !0 : t = !1;
|
|
2156
2158
|
}),
|
|
2157
2159
|
he()
|
|
2158
|
-
), { state$: u, abortController: i } =
|
|
2160
|
+
), { state$: u, abortController: i } = rr({
|
|
2159
2161
|
...this.options,
|
|
2160
2162
|
observers$: this.observerCount$,
|
|
2161
2163
|
queryKey: this.queryKey,
|
|
@@ -2202,7 +2204,7 @@ class ur {
|
|
|
2202
2204
|
}))
|
|
2203
2205
|
)
|
|
2204
2206
|
).pipe(
|
|
2205
|
-
|
|
2207
|
+
ks({
|
|
2206
2208
|
initialState: this.state,
|
|
2207
2209
|
getOptions: () => this.options,
|
|
2208
2210
|
getState: () => this.state
|
|
@@ -2212,8 +2214,8 @@ class ur {
|
|
|
2212
2214
|
E((t) => {
|
|
2213
2215
|
this.state = t;
|
|
2214
2216
|
}),
|
|
2215
|
-
|
|
2216
|
-
throw
|
|
2217
|
+
X((t) => {
|
|
2218
|
+
throw ur.error(t), t;
|
|
2217
2219
|
}),
|
|
2218
2220
|
ne(this.destroySubject),
|
|
2219
2221
|
Ue({ bufferSize: 1, refCount: !1 })
|
|
@@ -2283,11 +2285,11 @@ class ur {
|
|
|
2283
2285
|
return this.state.isInvalidated || !this.state.dataUpdatedAt || this.observersSubject.getValue().some((e) => e.getCurrentResult().isStale);
|
|
2284
2286
|
}
|
|
2285
2287
|
isStaleByTime(e = 0) {
|
|
2286
|
-
return this.state.isInvalidated || !this.state.dataUpdatedAt || !
|
|
2288
|
+
return this.state.isInvalidated || !this.state.dataUpdatedAt || !Ps(this.state.dataUpdatedAt, e);
|
|
2287
2289
|
}
|
|
2288
2290
|
async getFetchResultAsPromise() {
|
|
2289
2291
|
return await new Promise((e, t) => {
|
|
2290
|
-
this.state$.pipe(
|
|
2292
|
+
this.state$.pipe(Nt, Ke()).subscribe({
|
|
2291
2293
|
error: t,
|
|
2292
2294
|
next: (r) => {
|
|
2293
2295
|
r.error ? t(r.error) : e(r.data);
|
|
@@ -2320,12 +2322,12 @@ class ur {
|
|
|
2320
2322
|
}
|
|
2321
2323
|
xe = new WeakMap(), ae = new WeakMap();
|
|
2322
2324
|
var Re, G;
|
|
2323
|
-
class
|
|
2325
|
+
class or {
|
|
2324
2326
|
// protected mountSubscriptions: Subscription[]
|
|
2325
2327
|
constructor(e = {}) {
|
|
2326
2328
|
// readonly #queries: QueryStore = new Map<string, Query>()
|
|
2327
2329
|
C(this, Re, new I());
|
|
2328
|
-
C(this, G, new
|
|
2330
|
+
C(this, G, new zt());
|
|
2329
2331
|
this.config = e;
|
|
2330
2332
|
}
|
|
2331
2333
|
mount() {
|
|
@@ -2351,12 +2353,12 @@ class ar {
|
|
|
2351
2353
|
}
|
|
2352
2354
|
findAll(e = {}) {
|
|
2353
2355
|
const t = this.getAll();
|
|
2354
|
-
return Object.keys(e).length > 0 ? t.filter((r) =>
|
|
2356
|
+
return Object.keys(e).length > 0 ? t.filter((r) => Et(e, r)) : t;
|
|
2355
2357
|
}
|
|
2356
2358
|
build(e, t, r) {
|
|
2357
2359
|
const n = t.queryKey ?? [ct()], u = t.queryHash ?? dt(n, t);
|
|
2358
2360
|
let i = this.get(u);
|
|
2359
|
-
return i || (i = new
|
|
2361
|
+
return i || (i = new ar({
|
|
2360
2362
|
cache: this,
|
|
2361
2363
|
queryKey: n,
|
|
2362
2364
|
queryHash: u,
|
|
@@ -2391,10 +2393,10 @@ class ar {
|
|
|
2391
2393
|
* Once a mutation is finished and there are no more observers than us
|
|
2392
2394
|
* we start the process of cleaning it up based on gc settings
|
|
2393
2395
|
*/
|
|
2394
|
-
|
|
2396
|
+
Ts,
|
|
2395
2397
|
x((r) => r ? t.pipe(
|
|
2396
2398
|
// defaults to 5mn
|
|
2397
|
-
x(() => e.gcTime === 1 / 0 ? qe : (setTimeout(
|
|
2399
|
+
x(() => e.gcTime === 1 / 0 ? qe : (setTimeout(K, e.gcTime), Qe(e.gcTime)))
|
|
2398
2400
|
) : qe),
|
|
2399
2401
|
He(1)
|
|
2400
2402
|
).subscribe({
|
|
@@ -2410,7 +2412,7 @@ class ar {
|
|
|
2410
2412
|
find(e) {
|
|
2411
2413
|
const t = { exact: !0, ...e };
|
|
2412
2414
|
return this.getAll().find(
|
|
2413
|
-
(r) =>
|
|
2415
|
+
(r) => Et(t, r)
|
|
2414
2416
|
);
|
|
2415
2417
|
}
|
|
2416
2418
|
subscribe(e) {
|
|
@@ -2453,7 +2455,7 @@ class ar {
|
|
|
2453
2455
|
}
|
|
2454
2456
|
Re = new WeakMap(), G = new WeakMap();
|
|
2455
2457
|
var oe, A, je, Me, ge;
|
|
2456
|
-
class
|
|
2458
|
+
class Rr {
|
|
2457
2459
|
// #destroy = () => {}
|
|
2458
2460
|
constructor({
|
|
2459
2461
|
mutationCache: e,
|
|
@@ -2465,7 +2467,7 @@ class Er {
|
|
|
2465
2467
|
C(this, je, /* @__PURE__ */ new Map());
|
|
2466
2468
|
C(this, Me, /* @__PURE__ */ new Map());
|
|
2467
2469
|
C(this, ge, void 0);
|
|
2468
|
-
M(this, oe, e ?? new
|
|
2470
|
+
M(this, oe, e ?? new Xs()), M(this, A, t ?? new or()), M(this, ge, r ?? {});
|
|
2469
2471
|
}
|
|
2470
2472
|
mount() {
|
|
2471
2473
|
}
|
|
@@ -2505,7 +2507,7 @@ class Er {
|
|
|
2505
2507
|
return r.isStaleByTime(t.staleTime) ? await r.fetch(t) : await Promise.resolve(r.state.data);
|
|
2506
2508
|
}
|
|
2507
2509
|
async prefetchQuery(e) {
|
|
2508
|
-
await this.fetchQuery(e).then(
|
|
2510
|
+
await this.fetchQuery(e).then(K).catch(K);
|
|
2509
2511
|
}
|
|
2510
2512
|
async resetQueries(e, t) {
|
|
2511
2513
|
const r = a(this, A), n = {
|
|
@@ -2522,9 +2524,9 @@ class Er {
|
|
|
2522
2524
|
cancelRefetch: (t == null ? void 0 : t.cancelRefetch) ?? !0
|
|
2523
2525
|
}, n = a(this, A).findAll(e).filter((u) => !u.isDisabled()).map(async (u) => {
|
|
2524
2526
|
let i = u.fetch(void 0, r);
|
|
2525
|
-
return r.throwOnError || (i = i.catch(
|
|
2527
|
+
return r.throwOnError || (i = i.catch(K)), u.state.fetchStatus === "paused" ? void 0 : await i;
|
|
2526
2528
|
});
|
|
2527
|
-
await Promise.all(n).then(
|
|
2529
|
+
await Promise.all(n).then(K);
|
|
2528
2530
|
}
|
|
2529
2531
|
getQueryData(e) {
|
|
2530
2532
|
var r;
|
|
@@ -2534,7 +2536,7 @@ class Er {
|
|
|
2534
2536
|
setQueryData(e, t, r) {
|
|
2535
2537
|
const n = this.defaultQueryOptions({ queryKey: e }), u = a(this, A).get(
|
|
2536
2538
|
n.queryHash
|
|
2537
|
-
), i = u == null ? void 0 : u.state.data, c =
|
|
2539
|
+
), i = u == null ? void 0 : u.state.data, c = Ds(t, i);
|
|
2538
2540
|
if (c !== void 0)
|
|
2539
2541
|
return a(this, A).build(this, n).setData(c, { ...r, manual: !0 });
|
|
2540
2542
|
}
|
|
@@ -2578,7 +2580,7 @@ class Er {
|
|
|
2578
2580
|
const r = { revert: !0, ...t }, n = a(this, A).findAll(e).map(async (u) => {
|
|
2579
2581
|
await u.cancel(r);
|
|
2580
2582
|
});
|
|
2581
|
-
await Promise.all(n).then(
|
|
2583
|
+
await Promise.all(n).then(K).catch(K);
|
|
2582
2584
|
}
|
|
2583
2585
|
async invalidateQueries(e = {}, t = {}) {
|
|
2584
2586
|
if (a(this, A).findAll(e).forEach((n) => {
|
|
@@ -2594,7 +2596,7 @@ class Er {
|
|
|
2594
2596
|
await this.refetchQueries(r, t);
|
|
2595
2597
|
}
|
|
2596
2598
|
async resumePausedMutations() {
|
|
2597
|
-
return await
|
|
2599
|
+
return await hs(a(this, oe).resumePausedMutations());
|
|
2598
2600
|
}
|
|
2599
2601
|
isFetching(e) {
|
|
2600
2602
|
return a(this, A).findAll({ ...e, fetchStatus: "fetching" }).length;
|
|
@@ -2605,32 +2607,34 @@ class Er {
|
|
|
2605
2607
|
}
|
|
2606
2608
|
oe = new WeakMap(), A = new WeakMap(), je = new WeakMap(), Me = new WeakMap(), ge = new WeakMap();
|
|
2607
2609
|
export {
|
|
2608
|
-
|
|
2609
|
-
|
|
2610
|
-
|
|
2611
|
-
|
|
2612
|
-
|
|
2613
|
-
|
|
2614
|
-
|
|
2615
|
-
|
|
2610
|
+
Xs as MutationCache,
|
|
2611
|
+
or as QueryCache,
|
|
2612
|
+
Rr as QueryClient,
|
|
2613
|
+
wr as QueryClientProvider,
|
|
2614
|
+
ms as SIGNAL_RESET,
|
|
2615
|
+
Or as arrayEqual,
|
|
2616
|
+
vs as createLocalStorageAdapter,
|
|
2617
|
+
mr as createLocalforageAdapter,
|
|
2616
2618
|
Fs as exponentialBackoffDelay,
|
|
2617
2619
|
Cs as getDelay,
|
|
2618
2620
|
rt as isDefined,
|
|
2619
|
-
|
|
2620
|
-
|
|
2621
|
-
|
|
2622
|
-
|
|
2621
|
+
Vt as retryBackoff,
|
|
2622
|
+
br as signal,
|
|
2623
|
+
It as useBehaviorSubject,
|
|
2624
|
+
Es as useEffectOnce,
|
|
2625
|
+
Er as useForeverQuery,
|
|
2623
2626
|
q as useLiveRef,
|
|
2624
|
-
$r as
|
|
2625
|
-
|
|
2627
|
+
$r as useMount,
|
|
2628
|
+
Cr as useMutation,
|
|
2629
|
+
yr as useObservableState,
|
|
2626
2630
|
Xe as useObserve,
|
|
2627
|
-
|
|
2628
|
-
|
|
2629
|
-
|
|
2630
|
-
|
|
2631
|
-
|
|
2632
|
-
|
|
2633
|
-
|
|
2634
|
-
|
|
2635
|
-
|
|
2631
|
+
pr as useObserveCallback,
|
|
2632
|
+
Sr as usePersistSignals,
|
|
2633
|
+
Fr as useQuery,
|
|
2634
|
+
kt as useQueryClient,
|
|
2635
|
+
gr as useSignalValue,
|
|
2636
|
+
Ut as useSubject,
|
|
2637
|
+
Qt as useSubscribe,
|
|
2638
|
+
xr as useSubscribeEffect,
|
|
2639
|
+
vr as useUnmountObservable
|
|
2636
2640
|
};
|