reactjrx 1.67.4 → 1.68.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.js +458 -455
- package/dist/lib/queries/client/mutations/observers/MutationObserver.d.ts +7 -4
- package/dist/lib/queries/client/mutations/runner/MutationRunner.d.ts +1 -3
- package/dist/lib/queries/react/mutations/useMutation.switch.test.d.ts +1 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
var ze = Object.defineProperty;
|
|
2
2
|
var Je = (t, e, r) => e in t ? ze(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r;
|
|
3
|
-
var
|
|
3
|
+
var $ = (t, e, r) => (Je(t, typeof e != "symbol" ? e + "" : e, r), r), We = (t, e, r) => {
|
|
4
4
|
if (!e.has(t))
|
|
5
5
|
throw TypeError("Cannot " + r);
|
|
6
6
|
};
|
|
7
|
-
var
|
|
7
|
+
var P = (t, e, r) => (We(t, e, "read from private field"), r ? r.call(t) : e.get(t)), he = (t, e, r) => {
|
|
8
8
|
if (e.has(t))
|
|
9
9
|
throw TypeError("Cannot add the same private member more than once");
|
|
10
10
|
e instanceof WeakSet ? e.add(t) : e.set(t, r);
|
|
11
11
|
};
|
|
12
|
-
import { useRef as
|
|
13
|
-
import { distinctUntilChanged as
|
|
14
|
-
import { catchError as
|
|
12
|
+
import { useRef as G, useMemo as ye, useCallback as Y, useSyncExternalStore as Ye, useEffect as A, createContext as Ge, memo as He, useContext as De, useState as Xe } from "react";
|
|
13
|
+
import { distinctUntilChanged as C, tap as x, finalize as le, catchError as j, EMPTY as M, Subject as Q, identity as pe, BehaviorSubject as F, map as p, of as S, zip as Ze, merge as w, throttleTime as Ve, asyncScheduler as qe, switchMap as E, from as re, defer as ne, throwError as Ce, iif as Te, timer as se, Observable as Me, filter as y, concatMap as Be, last as ie, mergeMap as K, takeUntil as L, skip as oe, scan as fe, shareReplay as $e, fromEvent as me, withLatestFrom as H, retry as et, endWith as tt, delay as rt, take as be, share as J, startWith as Ie, pairwise as ae, NEVER as Qe, combineLatest as Fe, takeWhile as ve, concat as ue, toArray as ce, lastValueFrom as nt } from "rxjs";
|
|
14
|
+
import { catchError as Re, retryWhen as st, concatMap as it, tap as ut } from "rxjs/operators";
|
|
15
15
|
import { jsxs as ct, jsx as ot } from "react/jsx-runtime";
|
|
16
|
-
const
|
|
17
|
-
const e =
|
|
16
|
+
const k = (t) => {
|
|
17
|
+
const e = G(t);
|
|
18
18
|
return ye(() => {
|
|
19
19
|
e.current = t;
|
|
20
20
|
}, [t]), e;
|
|
@@ -22,45 +22,45 @@ const U = (t) => {
|
|
|
22
22
|
function at(t, e) {
|
|
23
23
|
return typeof t == "string" && t === e || typeof t == "number" && t === e || typeof t == "boolean" && t === e || typeof t == "symbol" && t === e || typeof t == "bigint" && t === e || typeof t > "u" && t === e || t === null && t === e;
|
|
24
24
|
}
|
|
25
|
-
function
|
|
25
|
+
function de(t, e, r) {
|
|
26
26
|
const n = e != null && !Array.isArray(e) ? e : {
|
|
27
27
|
defaultValue: void 0,
|
|
28
28
|
key: "",
|
|
29
29
|
unsubscribeOnUnmount: !0
|
|
30
|
-
}, s = r == null && Array.isArray(e) ? e : typeof t == "function" ? r ?? [] : [t], i =
|
|
30
|
+
}, s = r == null && Array.isArray(e) ? e : typeof t == "function" ? r ?? [] : [t], i = G(
|
|
31
31
|
"getValue" in t && typeof t.getValue == "function" ? t.getValue() : n.defaultValue
|
|
32
|
-
), u =
|
|
33
|
-
(
|
|
34
|
-
const
|
|
32
|
+
), u = k(t), a = k(n), f = Y(
|
|
33
|
+
(h) => {
|
|
34
|
+
const l = u.current, o = (typeof l == "function" ? l : () => l)().pipe(
|
|
35
35
|
/**
|
|
36
36
|
* @important
|
|
37
37
|
* We only check primitives because underlying subscription might
|
|
38
38
|
* be using objects and keeping same reference but pushing new
|
|
39
39
|
* properties values
|
|
40
40
|
*/
|
|
41
|
-
|
|
41
|
+
C(at),
|
|
42
42
|
x((m) => {
|
|
43
43
|
i.current = m;
|
|
44
44
|
}),
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
).subscribe(
|
|
45
|
+
le(h),
|
|
46
|
+
j((m) => (console.error(m), i.current = void 0, M))
|
|
47
|
+
).subscribe(h);
|
|
48
48
|
return () => {
|
|
49
|
-
|
|
49
|
+
a.current.unsubscribeOnUnmount !== !1 && o.unsubscribe();
|
|
50
50
|
};
|
|
51
51
|
},
|
|
52
52
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
53
53
|
[...s]
|
|
54
|
-
),
|
|
55
|
-
return Ye(f,
|
|
54
|
+
), g = Y(() => i.current, []);
|
|
55
|
+
return Ye(f, g, g);
|
|
56
56
|
}
|
|
57
57
|
function Se(t, e = []) {
|
|
58
|
-
const r =
|
|
59
|
-
|
|
58
|
+
const r = k(t), n = typeof t == "function" ? void 0 : t;
|
|
59
|
+
A(() => {
|
|
60
60
|
const s = r.current, u = (typeof s == "function" ? s : () => s)().pipe(
|
|
61
|
-
|
|
61
|
+
j((a) => (console.error(
|
|
62
62
|
"Uncaught error at useSubscribe. Please consider adding a catchError or other handling."
|
|
63
|
-
), console.error(
|
|
63
|
+
), console.error(a), M))
|
|
64
64
|
).subscribe();
|
|
65
65
|
return () => {
|
|
66
66
|
u.unsubscribe();
|
|
@@ -73,16 +73,16 @@ function Se(t, e = []) {
|
|
|
73
73
|
]);
|
|
74
74
|
}
|
|
75
75
|
const we = (t) => {
|
|
76
|
-
const e =
|
|
77
|
-
return e.current || (e.current = t()),
|
|
76
|
+
const e = G();
|
|
77
|
+
return e.current || (e.current = t()), A(() => {
|
|
78
78
|
process.env.NODE_ENV;
|
|
79
79
|
}, []), e;
|
|
80
|
-
},
|
|
80
|
+
}, Ee = ({
|
|
81
81
|
onBeforeComplete: t,
|
|
82
82
|
completeOnUnmount: e = !0
|
|
83
83
|
} = {}) => {
|
|
84
|
-
const r = we(() => new
|
|
85
|
-
return
|
|
84
|
+
const r = we(() => new Q()), n = G(!1), s = k(t), i = k(e);
|
|
85
|
+
return A(() => (n.current && (r.current = new Q(), n.current = !1), () => {
|
|
86
86
|
if (!i.current) {
|
|
87
87
|
n.current = !0;
|
|
88
88
|
return;
|
|
@@ -90,13 +90,13 @@ const we = (t) => {
|
|
|
90
90
|
n.current || (s.current != null && s.current(), r.current.complete(), n.current = !0);
|
|
91
91
|
}), [i, s, r]), r;
|
|
92
92
|
}, ar = (t, e) => {
|
|
93
|
-
const r =
|
|
93
|
+
const r = Ee();
|
|
94
94
|
return Se(() => t(r.current), [r, ...e]), [Y((s) => {
|
|
95
95
|
r.current.next(s);
|
|
96
96
|
}, [r]), r];
|
|
97
97
|
};
|
|
98
|
-
function lr(t =
|
|
99
|
-
const e = new
|
|
98
|
+
function lr(t = pe) {
|
|
99
|
+
const e = new Q();
|
|
100
100
|
return [
|
|
101
101
|
e.asObservable(),
|
|
102
102
|
(...r) => {
|
|
@@ -105,13 +105,13 @@ function lr(t = le) {
|
|
|
105
105
|
];
|
|
106
106
|
}
|
|
107
107
|
const lt = (t) => {
|
|
108
|
-
const e = we(() => new
|
|
109
|
-
return
|
|
108
|
+
const e = we(() => new F(t)), r = G(!1), n = G(t);
|
|
109
|
+
return A(() => (r.current && (e.current = new F(n.current), r.current = !1), () => {
|
|
110
110
|
r.current || (e.current.complete(), r.current = !0);
|
|
111
111
|
}), [e]), e;
|
|
112
112
|
}, pt = Symbol("SIGNAL_RESET");
|
|
113
113
|
function pr(t) {
|
|
114
|
-
const { default: e } = t ?? {}, r = new
|
|
114
|
+
const { default: e } = t ?? {}, r = new F(e);
|
|
115
115
|
return {
|
|
116
116
|
setValue: (i) => {
|
|
117
117
|
if (typeof i == "function") {
|
|
@@ -134,10 +134,10 @@ function pr(t) {
|
|
|
134
134
|
}
|
|
135
135
|
function fr(t, e) {
|
|
136
136
|
const r = e ?? ((n) => n);
|
|
137
|
-
return
|
|
137
|
+
return de(
|
|
138
138
|
() => t.subject.pipe(
|
|
139
139
|
p((n) => r(n)),
|
|
140
|
-
|
|
140
|
+
C()
|
|
141
141
|
),
|
|
142
142
|
{
|
|
143
143
|
defaultValue: r(t.getValue())
|
|
@@ -197,8 +197,8 @@ const xe = (t) => {
|
|
|
197
197
|
adapter: t,
|
|
198
198
|
version: e,
|
|
199
199
|
signal: r
|
|
200
|
-
}) =>
|
|
201
|
-
|
|
200
|
+
}) => re(t.getItem(r.config.key)).pipe(
|
|
201
|
+
E((n) => {
|
|
202
202
|
const s = dt(n);
|
|
203
203
|
return s ? s.migrationVersion !== void 0 && e > s.migrationVersion ? S(n) : (r.setValue(n.value), S(n)) : S(n);
|
|
204
204
|
})
|
|
@@ -207,43 +207,43 @@ const xe = (t) => {
|
|
|
207
207
|
onReady: e,
|
|
208
208
|
adapter: r = ft(localStorage)
|
|
209
209
|
}) => {
|
|
210
|
-
const n =
|
|
210
|
+
const n = k(t), s = k(e), i = k(r), u = de(
|
|
211
211
|
() => {
|
|
212
|
-
const
|
|
213
|
-
return (
|
|
214
|
-
...
|
|
215
|
-
({ signal:
|
|
212
|
+
const a = n.current;
|
|
213
|
+
return (a.length === 0 ? S(!0) : Ze(
|
|
214
|
+
...a.map(
|
|
215
|
+
({ signal: g, version: d }) => gt({
|
|
216
216
|
adapter: i.current,
|
|
217
|
-
signal:
|
|
218
|
-
version:
|
|
217
|
+
signal: g,
|
|
218
|
+
version: d
|
|
219
219
|
})
|
|
220
220
|
)
|
|
221
221
|
).pipe(p(() => !0))).pipe(
|
|
222
222
|
x(() => {
|
|
223
223
|
s.current != null && s.current();
|
|
224
224
|
}),
|
|
225
|
-
|
|
225
|
+
j((g) => (console.error("Unable to hydrate", g), M))
|
|
226
226
|
);
|
|
227
227
|
},
|
|
228
228
|
{ defaultValue: !1 },
|
|
229
229
|
[]
|
|
230
230
|
);
|
|
231
|
-
return Se(() => u ?
|
|
231
|
+
return Se(() => u ? w(
|
|
232
232
|
...n.current.map(
|
|
233
|
-
({ signal:
|
|
233
|
+
({ signal: a, version: f }) => a.subject.pipe(
|
|
234
234
|
Ve(500, qe, {
|
|
235
235
|
trailing: !0
|
|
236
236
|
}),
|
|
237
|
-
|
|
238
|
-
() =>
|
|
239
|
-
ht({ adapter: i.current, signal:
|
|
237
|
+
E(
|
|
238
|
+
() => re(
|
|
239
|
+
ht({ adapter: i.current, signal: a, version: f })
|
|
240
240
|
)
|
|
241
241
|
)
|
|
242
242
|
)
|
|
243
243
|
)
|
|
244
244
|
) : M, [u, i]), { isHydrated: u };
|
|
245
245
|
}, mr = () => {
|
|
246
|
-
const t =
|
|
246
|
+
const t = Ee({
|
|
247
247
|
onBeforeComplete: () => {
|
|
248
248
|
t.current.next();
|
|
249
249
|
}
|
|
@@ -265,38 +265,38 @@ function yt(t) {
|
|
|
265
265
|
resetOnSuccess: i = !1,
|
|
266
266
|
backoffDelay: u = bt
|
|
267
267
|
} = t;
|
|
268
|
-
return (
|
|
268
|
+
return (a) => ne(() => {
|
|
269
269
|
let f = 0;
|
|
270
|
-
const
|
|
271
|
-
return
|
|
272
|
-
|
|
273
|
-
var
|
|
274
|
-
if (f++, !
|
|
275
|
-
throw
|
|
276
|
-
const
|
|
277
|
-
if (!
|
|
278
|
-
throw
|
|
279
|
-
return
|
|
280
|
-
|
|
281
|
-
|
|
270
|
+
const g = (d, h) => d < r && s(d, h);
|
|
271
|
+
return a.pipe(
|
|
272
|
+
Re((d) => {
|
|
273
|
+
var l;
|
|
274
|
+
if (f++, !g(f - 1, d))
|
|
275
|
+
throw d;
|
|
276
|
+
const h = (l = t.caughtError) == null ? void 0 : l.call(t, f, d);
|
|
277
|
+
if (!h)
|
|
278
|
+
throw d;
|
|
279
|
+
return w(
|
|
280
|
+
h,
|
|
281
|
+
Ce(() => d)
|
|
282
282
|
);
|
|
283
283
|
}),
|
|
284
|
-
st((
|
|
285
|
-
it((
|
|
286
|
-
const
|
|
284
|
+
st((d) => d.pipe(
|
|
285
|
+
it((h) => {
|
|
286
|
+
const l = f - 1;
|
|
287
287
|
return Te(
|
|
288
|
-
() =>
|
|
289
|
-
|
|
290
|
-
mt(u(
|
|
288
|
+
() => g(l, h),
|
|
289
|
+
se(
|
|
290
|
+
mt(u(l, e), n)
|
|
291
291
|
),
|
|
292
|
-
|
|
292
|
+
Ce(() => h)
|
|
293
293
|
);
|
|
294
294
|
})
|
|
295
295
|
)),
|
|
296
|
-
|
|
296
|
+
Re((d) => {
|
|
297
297
|
if (t.catchError)
|
|
298
|
-
return t.catchError(f,
|
|
299
|
-
throw
|
|
298
|
+
return t.catchError(f, d);
|
|
299
|
+
throw d;
|
|
300
300
|
}),
|
|
301
301
|
ut(() => {
|
|
302
302
|
i && (f = 0);
|
|
@@ -306,7 +306,7 @@ function yt(t) {
|
|
|
306
306
|
}
|
|
307
307
|
const _e = Ge({
|
|
308
308
|
client: null
|
|
309
|
-
}), $t = ({ client: t }) => (
|
|
309
|
+
}), $t = ({ client: t }) => (A(() => {
|
|
310
310
|
const e = t.mount();
|
|
311
311
|
return () => {
|
|
312
312
|
e();
|
|
@@ -326,7 +326,7 @@ const _e = Ge({
|
|
|
326
326
|
if (!t && e.client === null)
|
|
327
327
|
throw new Error("You forgot to register the provider");
|
|
328
328
|
return e.client;
|
|
329
|
-
},
|
|
329
|
+
}, B = (t) => Array.isArray(t) ? t.reduce((e, r, n) => n === t.length - 1 ? `${e}${B(r)}]` : `${e}${B(r)},`, "[") : t === void 0 ? "" : JSON.stringify(t, Object.keys(t).sort()), _ = (t) => t.length === 0 ? "[]" : B(t), Ne = (t = 21) => crypto.getRandomValues(new Uint8Array(t)).reduce((e, r) => (r &= 63, r < 36 ? e += r.toString(36) : r < 62 ? e += (r - 26).toString(36).toUpperCase() : r > 62 ? e += "-" : e += "_", e), ""), W = () => ({
|
|
330
330
|
context: void 0,
|
|
331
331
|
data: void 0,
|
|
332
332
|
error: null,
|
|
@@ -337,9 +337,6 @@ const _e = Ge({
|
|
|
337
337
|
failureReason: null,
|
|
338
338
|
isPaused: !1
|
|
339
339
|
});
|
|
340
|
-
function G(t) {
|
|
341
|
-
return t != null;
|
|
342
|
-
}
|
|
343
340
|
function T(t, e) {
|
|
344
341
|
if (t == null || e === void 0 || typeof t != "object" || typeof e != "object")
|
|
345
342
|
return t === e;
|
|
@@ -369,71 +366,75 @@ class vt {
|
|
|
369
366
|
constructor({
|
|
370
367
|
__queryFinalizeHook: e
|
|
371
368
|
} = {}) {
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
$((i) => i === 0)
|
|
377
|
-
), s = this.mapOperator$.pipe(
|
|
378
|
-
$(G),
|
|
379
|
-
R()
|
|
369
|
+
$(this, "trigger$", new Q());
|
|
370
|
+
$(this, "state$");
|
|
371
|
+
const r = new F(0), n = r.pipe(
|
|
372
|
+
y((s) => s === 0)
|
|
380
373
|
);
|
|
381
|
-
this.state$ =
|
|
382
|
-
|
|
383
|
-
const
|
|
384
|
-
|
|
385
|
-
)
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
}),
|
|
399
|
-
pe((f, d) => ({
|
|
400
|
-
...f,
|
|
401
|
-
...d,
|
|
402
|
-
...d.status === "pending" && {
|
|
403
|
-
data: d.data ?? f.data
|
|
404
|
-
},
|
|
405
|
-
...d.status === "pending" && {
|
|
406
|
-
error: d.error ?? f.error
|
|
407
|
-
}
|
|
408
|
-
}), W()),
|
|
409
|
-
R(
|
|
410
|
-
({ data: f, ...d }, { data: h, ...g }) => T(d, g) && T(f, h)
|
|
411
|
-
)
|
|
374
|
+
this.state$ = this.trigger$.pipe(
|
|
375
|
+
Be(({ args: s, mutation: i, options: u }) => {
|
|
376
|
+
const a = u.mapOperator ?? "merge", f = this.trigger$.pipe(
|
|
377
|
+
y(() => a === "merge")
|
|
378
|
+
), g = this.trigger$.pipe(
|
|
379
|
+
y(() => a === "switch"),
|
|
380
|
+
x(() => {
|
|
381
|
+
i.reset();
|
|
382
|
+
})
|
|
383
|
+
), d = ne(() => (i.execute(s), M)), h = i.observeTillFinished().pipe(
|
|
384
|
+
ie(),
|
|
385
|
+
K(() => i.state$),
|
|
386
|
+
L(this.trigger$)
|
|
387
|
+
), l = i.observeTillFinished().pipe(oe(1));
|
|
388
|
+
return w(l, h, d).pipe(
|
|
389
|
+
e ?? pe,
|
|
390
|
+
L(w(n, f, g))
|
|
412
391
|
);
|
|
413
392
|
}),
|
|
393
|
+
fe((s, i) => ({
|
|
394
|
+
...s,
|
|
395
|
+
...i,
|
|
396
|
+
...i.status === "pending" && {
|
|
397
|
+
data: i.data ?? s.data
|
|
398
|
+
},
|
|
399
|
+
...i.status === "pending" && {
|
|
400
|
+
error: i.error ?? s.error
|
|
401
|
+
}
|
|
402
|
+
}), W()),
|
|
403
|
+
C(
|
|
404
|
+
({ data: s, ...i }, { data: u, ...a }) => T(i, a) && T(s, u)
|
|
405
|
+
),
|
|
414
406
|
$e({
|
|
415
407
|
refCount: !0,
|
|
416
408
|
bufferSize: 1
|
|
417
409
|
}),
|
|
418
|
-
ke((
|
|
419
|
-
r.next(
|
|
410
|
+
ke((s) => {
|
|
411
|
+
r.next(s);
|
|
420
412
|
})
|
|
421
413
|
);
|
|
422
414
|
}
|
|
423
415
|
trigger({ args: e, options: r, mutation: n }) {
|
|
424
|
-
|
|
416
|
+
this.trigger$.next({ args: e, options: r, mutation: n });
|
|
425
417
|
}
|
|
426
418
|
}
|
|
427
|
-
|
|
428
|
-
|
|
419
|
+
function X(t) {
|
|
420
|
+
return t != null;
|
|
421
|
+
}
|
|
422
|
+
const ee = (t, e, { exact: r = !1 } = {}) => r ? _(t) === _(e) : t.reduce((n, s, i) => n ? s === void 0 && !t.slice(i, t.length - 1).some((a) => a !== void 0) ? !0 : B(s) === B(e[i]) : !1, !0);
|
|
423
|
+
var N;
|
|
429
424
|
class St {
|
|
430
425
|
constructor(e, r = {}, n) {
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
426
|
+
$(this, "numberOfObservers", 0);
|
|
427
|
+
$(this, "mutationRunner");
|
|
428
|
+
he(this, N, new F(void 0));
|
|
429
|
+
/**
|
|
430
|
+
* @important
|
|
431
|
+
* Used to maintain persistance to latest mutation. This ensure
|
|
432
|
+
* - mutation does not get garbage collected
|
|
433
|
+
* - mutation mutate options are run on finish
|
|
434
|
+
*/
|
|
435
|
+
$(this, "observed$");
|
|
436
|
+
$(this, "result$");
|
|
437
|
+
$(this, "getObserverResultFromState", (e) => ({
|
|
437
438
|
...W(),
|
|
438
439
|
...e,
|
|
439
440
|
isSuccess: e.status === "success",
|
|
@@ -449,23 +450,24 @@ class St {
|
|
|
449
450
|
state: this.getObserverResultFromState(i),
|
|
450
451
|
options: {}
|
|
451
452
|
}))
|
|
452
|
-
),
|
|
453
|
-
|
|
454
|
-
|
|
453
|
+
), P(this, N).pipe(
|
|
454
|
+
y(X),
|
|
455
|
+
K(
|
|
455
456
|
(i) => this.mutationRunner.state$.pipe(
|
|
456
|
-
|
|
457
|
+
L(i.mutation.observeTillFinished().pipe(ie()))
|
|
457
458
|
)
|
|
458
459
|
)
|
|
459
|
-
).subscribe(), this.observed$ =
|
|
460
|
-
|
|
461
|
-
(i) => (i == null ? void 0 : i.mutation.
|
|
460
|
+
).subscribe(), this.observed$ = P(this, N).pipe(
|
|
461
|
+
E(
|
|
462
|
+
(i) => (i == null ? void 0 : i.mutation.observeTillFinished().pipe(
|
|
463
|
+
ie(),
|
|
462
464
|
p((u) => ({
|
|
463
|
-
state:
|
|
465
|
+
state: u,
|
|
464
466
|
options: i.options
|
|
465
467
|
}))
|
|
466
468
|
)) ?? M
|
|
467
469
|
),
|
|
468
|
-
|
|
470
|
+
K(({ state: i, options: u }) => (i.status === "error" && (u != null && u.onError && (u == null || u.onError(
|
|
469
471
|
i.error,
|
|
470
472
|
i.variables,
|
|
471
473
|
i.context
|
|
@@ -492,17 +494,18 @@ class St {
|
|
|
492
494
|
this.options = this.client.defaultMutationOptions({
|
|
493
495
|
mutationKey: this.options.mutationKey,
|
|
494
496
|
...e
|
|
495
|
-
}), (n =
|
|
497
|
+
}), (n = P(this, N).getValue()) == null || n.mutation.setOptions(this.options), this.options.mutationKey && r.mutationKey && !ee(this.options.mutationKey, r.mutationKey, {
|
|
496
498
|
exact: !0
|
|
497
499
|
}) && this.reset();
|
|
498
500
|
}
|
|
499
501
|
observe() {
|
|
500
502
|
var n;
|
|
501
503
|
const e = this.getObserverResultFromState(
|
|
502
|
-
((n =
|
|
504
|
+
((n = P(this, N).getValue()) == null ? void 0 : n.mutation.state) ?? W()
|
|
503
505
|
);
|
|
504
|
-
return { result$:
|
|
505
|
-
|
|
506
|
+
return { result$: w(
|
|
507
|
+
this.observed$,
|
|
508
|
+
this.result$.pipe(p(({ state: s }) => s))
|
|
506
509
|
), lastValue: e };
|
|
507
510
|
}
|
|
508
511
|
/**
|
|
@@ -519,12 +522,12 @@ class St {
|
|
|
519
522
|
}
|
|
520
523
|
async mutate(e, r = {}) {
|
|
521
524
|
const n = this.client.getMutationCache().build(this.client, this.options);
|
|
522
|
-
return
|
|
525
|
+
return P(this, N).next({ mutation: n, options: r }), this.mutationRunner.trigger({
|
|
523
526
|
args: e,
|
|
524
527
|
options: this.options,
|
|
525
528
|
mutation: n
|
|
526
529
|
}), await new Promise((s, i) => {
|
|
527
|
-
n.observeTillFinished().pipe(
|
|
530
|
+
n.observeTillFinished().pipe(ie()).subscribe({
|
|
528
531
|
error: (u) => {
|
|
529
532
|
i(u);
|
|
530
533
|
},
|
|
@@ -543,38 +546,38 @@ class St {
|
|
|
543
546
|
}
|
|
544
547
|
reset() {
|
|
545
548
|
var e;
|
|
546
|
-
(e =
|
|
549
|
+
(e = P(this, N).getValue()) == null || e.mutation.reset();
|
|
547
550
|
}
|
|
548
551
|
}
|
|
549
|
-
|
|
552
|
+
N = new WeakMap();
|
|
550
553
|
function wt() {
|
|
551
554
|
}
|
|
552
555
|
function yr(t, e) {
|
|
553
|
-
const r = Pe({ unsafe: !!e }), n = e ?? r, s =
|
|
556
|
+
const r = Pe({ unsafe: !!e }), n = e ?? r, s = k(t), i = we(() => [Ne()]), u = _(t.mutationKey ?? i.current), [a] = Xe(
|
|
554
557
|
() => new St(
|
|
555
558
|
n,
|
|
556
559
|
t
|
|
557
560
|
)
|
|
558
561
|
);
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
}, [
|
|
562
|
-
const f = ye(() =>
|
|
563
|
-
(
|
|
564
|
-
|
|
562
|
+
A(() => {
|
|
563
|
+
a.setOptions(t);
|
|
564
|
+
}, [a, t]);
|
|
565
|
+
const f = ye(() => a.observe(), [u, a]), g = de(f.result$) ?? f.lastValue, d = Y(
|
|
566
|
+
(h, l) => {
|
|
567
|
+
a.mutate(h, l).catch(wt);
|
|
565
568
|
},
|
|
566
|
-
[
|
|
569
|
+
[a]
|
|
567
570
|
);
|
|
568
|
-
return
|
|
569
|
-
s.current.cancelOnUnMount &&
|
|
570
|
-
}, [
|
|
571
|
+
return A(() => () => {
|
|
572
|
+
s.current.cancelOnUnMount && a.reset();
|
|
573
|
+
}, [a, s]), { ...g, mutate: d, mutateAsync: g.mutate };
|
|
571
574
|
}
|
|
572
|
-
const Le = (t, e) => t.length === e.length && t.every((r, n) => r === e[n]),
|
|
573
|
-
|
|
575
|
+
const Le = (t, e) => t.length === e.length && t.every((r, n) => r === e[n]), Et = (t) => t.pipe(
|
|
576
|
+
E(({ options: { refetchOnWindowFocus: e = !0 } }) => {
|
|
574
577
|
const r = typeof e == "function" ? e({}) : e;
|
|
575
|
-
return r !== !1 ?
|
|
578
|
+
return r !== !1 ? w(
|
|
576
579
|
me(document, "visibilitychange").pipe(
|
|
577
|
-
|
|
580
|
+
y(() => !document.hidden),
|
|
578
581
|
p(() => ({
|
|
579
582
|
type: "refetch",
|
|
580
583
|
ignoreStale: r === "always"
|
|
@@ -588,8 +591,8 @@ const Le = (t, e) => t.length === e.length && t.every((r, n) => r === e[n]), Ot
|
|
|
588
591
|
)
|
|
589
592
|
) : M;
|
|
590
593
|
})
|
|
591
|
-
),
|
|
592
|
-
|
|
594
|
+
), Ot = (t) => t.pipe(
|
|
595
|
+
E(({ options: { refetchOnReconnect: e = !0 } }) => {
|
|
593
596
|
const r = typeof e == "function" ? e({}) : e;
|
|
594
597
|
return r !== !1 ? me(window, "online").pipe(
|
|
595
598
|
p(() => ({
|
|
@@ -598,20 +601,20 @@ const Le = (t, e) => t.length === e.length && t.every((r, n) => r === e[n]), Ot
|
|
|
598
601
|
}))
|
|
599
602
|
) : M;
|
|
600
603
|
})
|
|
601
|
-
),
|
|
604
|
+
), Ct = ({
|
|
602
605
|
queryKey: t,
|
|
603
606
|
queryFn: e,
|
|
604
607
|
...r
|
|
605
608
|
}) => {
|
|
606
609
|
const n = lt({ queryKey: t, options: r, queryFn: e });
|
|
607
|
-
return
|
|
610
|
+
return A(() => {
|
|
608
611
|
n.current.next({
|
|
609
612
|
queryKey: t,
|
|
610
613
|
options: r,
|
|
611
614
|
queryFn: e
|
|
612
615
|
});
|
|
613
616
|
}, [t, r, e, n]), n;
|
|
614
|
-
},
|
|
617
|
+
}, Rt = {
|
|
615
618
|
data: void 0,
|
|
616
619
|
isLoading: !0,
|
|
617
620
|
error: void 0,
|
|
@@ -623,43 +626,43 @@ function $r({
|
|
|
623
626
|
queryFn: e,
|
|
624
627
|
...r
|
|
625
628
|
}) {
|
|
626
|
-
const n =
|
|
629
|
+
const n = Ee(), s = Pe(), i = Ct({ queryFn: e, queryKey: t, ...r }), u = de(
|
|
627
630
|
() => {
|
|
628
|
-
const f = i.current.pipe(p(({ queryKey: v }) => v ?? [])),
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
),
|
|
631
|
+
const f = i.current.pipe(p(({ queryKey: v }) => v ?? [])), g = S(null), d = f.pipe(
|
|
632
|
+
C(Le),
|
|
633
|
+
oe(1)
|
|
634
|
+
), h = (v) => !!v && typeof v != "function", l = i.current.pipe(
|
|
632
635
|
p(({ queryFn: v }) => v),
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
+
y(h),
|
|
637
|
+
C(T),
|
|
638
|
+
h(i.current.getValue().queryFn) ? oe(1) : pe
|
|
636
639
|
), c = i.current.pipe(
|
|
637
640
|
p(({ queryFn: v }) => v),
|
|
638
|
-
|
|
639
|
-
), o = i.current.pipe(p(({ options: v }) => v)), m =
|
|
641
|
+
y(X)
|
|
642
|
+
), o = i.current.pipe(p(({ options: v }) => v)), m = Et(i.current), R = Ot(i.current), b = w(
|
|
643
|
+
g,
|
|
640
644
|
d,
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
), j = O(
|
|
645
|
+
l
|
|
646
|
+
), U = w(
|
|
644
647
|
n.current,
|
|
645
|
-
|
|
648
|
+
w(m, R).pipe(Ve(500))
|
|
646
649
|
);
|
|
647
650
|
return b.pipe(
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
const { result$:
|
|
651
|
+
H(f),
|
|
652
|
+
E(([, v]) => {
|
|
653
|
+
const { result$: O } = s.client.query({
|
|
651
654
|
key: v,
|
|
652
655
|
fn$: c,
|
|
653
656
|
options$: o,
|
|
654
|
-
trigger$:
|
|
657
|
+
trigger$: U
|
|
655
658
|
});
|
|
656
|
-
return
|
|
657
|
-
|
|
658
|
-
(
|
|
659
|
+
return O.pipe(
|
|
660
|
+
fe(
|
|
661
|
+
(I, { data: z, ...Oe }) => ({
|
|
659
662
|
data: void 0,
|
|
660
|
-
...
|
|
661
|
-
...
|
|
662
|
-
isLoading:
|
|
663
|
+
...I,
|
|
664
|
+
...Oe,
|
|
665
|
+
isLoading: Oe.status === "loading",
|
|
663
666
|
...z && {
|
|
664
667
|
data: z.result
|
|
665
668
|
}
|
|
@@ -681,30 +684,30 @@ function $r({
|
|
|
681
684
|
},
|
|
682
685
|
{
|
|
683
686
|
defaultValue: {
|
|
684
|
-
...
|
|
687
|
+
...Rt,
|
|
685
688
|
isLoading: i.current.getValue().options.enabled !== !1
|
|
686
689
|
}
|
|
687
690
|
},
|
|
688
691
|
[s]
|
|
689
|
-
),
|
|
692
|
+
), a = Y(() => {
|
|
690
693
|
n.current.next({ type: "refetch", ignoreStale: !0 });
|
|
691
694
|
}, [n]);
|
|
692
|
-
return { ...u, refetch:
|
|
695
|
+
return { ...u, refetch: a };
|
|
693
696
|
}
|
|
694
697
|
function vr(t, e, r = []) {
|
|
695
698
|
const s = (e != null && !Array.isArray(e) ? e : {}).retry ?? !0, i = typeof t == "function", u = Y(
|
|
696
699
|
i ? t : () => t,
|
|
697
700
|
i ? r : [t]
|
|
698
|
-
),
|
|
701
|
+
), a = Y(
|
|
699
702
|
() => u().pipe(
|
|
700
|
-
|
|
703
|
+
j((f) => {
|
|
701
704
|
throw console.error(f), f;
|
|
702
705
|
}),
|
|
703
|
-
s ? et() :
|
|
706
|
+
s ? et() : pe
|
|
704
707
|
),
|
|
705
708
|
[u, s]
|
|
706
709
|
);
|
|
707
|
-
Se(
|
|
710
|
+
Se(a, r);
|
|
708
711
|
}
|
|
709
712
|
const Ue = ({
|
|
710
713
|
retryDelay: t,
|
|
@@ -719,7 +722,7 @@ const Ue = ({
|
|
|
719
722
|
},
|
|
720
723
|
...r
|
|
721
724
|
}), xt = (t) => t.pipe(
|
|
722
|
-
|
|
725
|
+
fe(
|
|
723
726
|
(e, r) => ({
|
|
724
727
|
...e,
|
|
725
728
|
...r
|
|
@@ -731,7 +734,7 @@ const Ue = ({
|
|
|
731
734
|
status: "loading"
|
|
732
735
|
}
|
|
733
736
|
),
|
|
734
|
-
|
|
737
|
+
C(
|
|
735
738
|
({ data: e, ...r }, { data: n, ...s }) => T(r, s) && T(e, n)
|
|
736
739
|
)
|
|
737
740
|
), Vt = { backgroundColor: "transparent", color: "inherit" };
|
|
@@ -786,53 +789,53 @@ function je(t) {
|
|
|
786
789
|
};
|
|
787
790
|
return e;
|
|
788
791
|
}
|
|
789
|
-
const
|
|
792
|
+
const D = je("production"), Tt = D.namespace("store"), Mt = (t) => t.pipe(
|
|
790
793
|
p(
|
|
791
794
|
(e) => [...e.keys()].reduce((r, n) => {
|
|
792
795
|
var s;
|
|
793
796
|
return r[n] = (s = e.get(n)) == null ? void 0 : s.getValue(), r;
|
|
794
797
|
}, {})
|
|
795
798
|
),
|
|
796
|
-
|
|
799
|
+
C(T)
|
|
797
800
|
).subscribe((e) => {
|
|
798
801
|
Tt.log("store", "update", e);
|
|
799
802
|
}), It = () => {
|
|
800
|
-
const t = /* @__PURE__ */ new Map(), e = new
|
|
803
|
+
const t = /* @__PURE__ */ new Map(), e = new F(t), r = new Q(), n = new Q(), s = () => {
|
|
801
804
|
e.next(t);
|
|
802
805
|
}, i = (c, o) => {
|
|
803
|
-
t.set(c, new
|
|
806
|
+
t.set(c, new F(o)), s();
|
|
804
807
|
}, u = (c) => {
|
|
805
808
|
var o;
|
|
806
809
|
return (o = t.get(c)) == null ? void 0 : o.getValue();
|
|
807
|
-
},
|
|
810
|
+
}, a = (c) => e.pipe(
|
|
808
811
|
p(() => t.get(c)),
|
|
809
|
-
|
|
812
|
+
y(X),
|
|
810
813
|
p((o) => o.getValue()),
|
|
811
|
-
|
|
814
|
+
C(T)
|
|
812
815
|
), f = (c, o) => {
|
|
813
816
|
const m = t.get(c);
|
|
814
817
|
m && (typeof o == "function" ? m.next({
|
|
815
818
|
...m.getValue(),
|
|
816
819
|
...o(m.getValue())
|
|
817
820
|
}) : m.next({ ...m.getValue(), ...o }), e.next(t));
|
|
818
|
-
},
|
|
821
|
+
}, g = (c, o = () => !0) => {
|
|
819
822
|
t.forEach((m) => {
|
|
820
|
-
const
|
|
821
|
-
o(
|
|
823
|
+
const R = m.getValue();
|
|
824
|
+
o(R) && m.next({ ...R, ...c });
|
|
822
825
|
}), e.next(t);
|
|
823
|
-
},
|
|
826
|
+
}, d = (c) => {
|
|
824
827
|
t.delete(c), e.next(t);
|
|
825
|
-
},
|
|
828
|
+
}, h = (c, o) => (f(c, (m) => ({
|
|
826
829
|
...m,
|
|
827
830
|
runners: [...m.runners, o]
|
|
828
831
|
})), () => {
|
|
829
|
-
var
|
|
830
|
-
const m = ((
|
|
832
|
+
var R;
|
|
833
|
+
const m = ((R = t.get(c)) == null ? void 0 : R.getValue().runners.filter((b) => b !== o)) ?? [];
|
|
831
834
|
f(c, (b) => ({
|
|
832
835
|
...b,
|
|
833
836
|
runners: m
|
|
834
837
|
}));
|
|
835
|
-
}),
|
|
838
|
+
}), l = () => {
|
|
836
839
|
const c = Mt(e);
|
|
837
840
|
return () => {
|
|
838
841
|
c.unsubscribe();
|
|
@@ -841,12 +844,12 @@ const X = je("production"), Tt = X.namespace("store"), Mt = (t) => t.pipe(
|
|
|
841
844
|
return {
|
|
842
845
|
set: i,
|
|
843
846
|
get: u,
|
|
844
|
-
get$:
|
|
845
|
-
delete:
|
|
847
|
+
get$: a,
|
|
848
|
+
delete: d,
|
|
846
849
|
update: f,
|
|
847
850
|
keys: () => t.keys(),
|
|
848
|
-
updateMany:
|
|
849
|
-
addRunner:
|
|
851
|
+
updateMany: g,
|
|
852
|
+
addRunner: h,
|
|
850
853
|
store$: e,
|
|
851
854
|
queryEvent$: r.asObservable(),
|
|
852
855
|
dispatchQueryEvent: (c) => {
|
|
@@ -857,7 +860,7 @@ const X = je("production"), Tt = X.namespace("store"), Mt = (t) => t.pipe(
|
|
|
857
860
|
n.next(c);
|
|
858
861
|
},
|
|
859
862
|
size: () => t.size,
|
|
860
|
-
start:
|
|
863
|
+
start: l
|
|
861
864
|
};
|
|
862
865
|
}, Qt = ({
|
|
863
866
|
options$: t,
|
|
@@ -866,14 +869,14 @@ const X = je("production"), Tt = X.namespace("store"), Mt = (t) => t.pipe(
|
|
|
866
869
|
}) => {
|
|
867
870
|
const s = t.pipe(
|
|
868
871
|
p(({ enabled: i = !0 }) => i),
|
|
869
|
-
|
|
872
|
+
C()
|
|
870
873
|
).pipe(
|
|
871
|
-
|
|
872
|
-
|
|
874
|
+
oe(1),
|
|
875
|
+
y((i) => i)
|
|
873
876
|
);
|
|
874
|
-
return
|
|
877
|
+
return w(
|
|
875
878
|
e.queryTrigger$.pipe(
|
|
876
|
-
|
|
879
|
+
y((i) => r === i.key),
|
|
877
880
|
p(({ trigger: i }) => i)
|
|
878
881
|
),
|
|
879
882
|
s.pipe(
|
|
@@ -883,15 +886,15 @@ const X = je("production"), Tt = X.namespace("store"), Mt = (t) => t.pipe(
|
|
|
883
886
|
}))
|
|
884
887
|
)
|
|
885
888
|
);
|
|
886
|
-
}, Ft = (t, e) => (r) => t ===
|
|
889
|
+
}, Ft = (t, e) => (r) => t === _([]) ? r : ne(() => {
|
|
887
890
|
var u;
|
|
888
891
|
const n = (u = e.get(t)) == null ? void 0 : u.deduplication_fn;
|
|
889
892
|
if (n)
|
|
890
893
|
return n;
|
|
891
894
|
let s;
|
|
892
895
|
const i = () => {
|
|
893
|
-
var
|
|
894
|
-
((
|
|
896
|
+
var a;
|
|
897
|
+
((a = e.get(t)) == null ? void 0 : a.deduplication_fn) === s && e.update(t, {
|
|
895
898
|
deduplication_fn: void 0
|
|
896
899
|
});
|
|
897
900
|
};
|
|
@@ -909,7 +912,7 @@ const X = je("production"), Tt = X.namespace("store"), Mt = (t) => t.pipe(
|
|
|
909
912
|
/**
|
|
910
913
|
* Because tap is not called on unsubscription we still need to handle the case.
|
|
911
914
|
*/
|
|
912
|
-
|
|
915
|
+
le(i),
|
|
913
916
|
$e({
|
|
914
917
|
refCount: !0,
|
|
915
918
|
bufferSize: 1
|
|
@@ -918,7 +921,7 @@ const X = je("production"), Tt = X.namespace("store"), Mt = (t) => t.pipe(
|
|
|
918
921
|
deduplication_fn: s
|
|
919
922
|
}), s;
|
|
920
923
|
}), _t = (t) => (e) => e.pipe(
|
|
921
|
-
|
|
924
|
+
H(t),
|
|
922
925
|
p(([r, n]) => {
|
|
923
926
|
var s, i;
|
|
924
927
|
return r.error ? (s = n.onError) == null || s.call(n, r.error) : (i = n.onSuccess) == null || i.call(n, r), r;
|
|
@@ -949,13 +952,13 @@ const X = je("production"), Tt = X.namespace("store"), Mt = (t) => t.pipe(
|
|
|
949
952
|
}) => {
|
|
950
953
|
const f = t.pipe(
|
|
951
954
|
p(({ enabled: b = !0 }) => b),
|
|
952
|
-
|
|
955
|
+
C()
|
|
953
956
|
).pipe(
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
),
|
|
957
|
+
C(),
|
|
958
|
+
y((b) => !b)
|
|
959
|
+
), d = ne(() => {
|
|
957
960
|
const b = typeof r == "function" ? r() : r;
|
|
958
|
-
return
|
|
961
|
+
return re(b);
|
|
959
962
|
}).pipe(
|
|
960
963
|
Ue(e),
|
|
961
964
|
Ft(s, n),
|
|
@@ -975,7 +978,7 @@ const X = je("production"), Tt = X.namespace("store"), Mt = (t) => t.pipe(
|
|
|
975
978
|
tt({
|
|
976
979
|
fetchStatus: "idle"
|
|
977
980
|
}),
|
|
978
|
-
|
|
981
|
+
j((b) => (n.dispatchQueryEvent({
|
|
979
982
|
key: s,
|
|
980
983
|
type: "fetchError"
|
|
981
984
|
}), S({
|
|
@@ -986,15 +989,15 @@ const X = je("production"), Tt = X.namespace("store"), Mt = (t) => t.pipe(
|
|
|
986
989
|
}))),
|
|
987
990
|
_t(t),
|
|
988
991
|
Pt({ serializedKey: s, options: e, queryStore: n })
|
|
989
|
-
),
|
|
990
|
-
|
|
992
|
+
), h = n.queryEvent$.pipe(
|
|
993
|
+
y(
|
|
991
994
|
(b) => b.key === s && b.type === "queryDataSet"
|
|
992
995
|
),
|
|
993
996
|
p(() => {
|
|
994
|
-
var b,
|
|
995
|
-
return (
|
|
997
|
+
var b, U;
|
|
998
|
+
return (U = (b = n.get(s)) == null ? void 0 : b.cache_fnResult) == null ? void 0 : U.result;
|
|
996
999
|
}),
|
|
997
|
-
|
|
1000
|
+
y(X),
|
|
998
1001
|
p((b) => ({
|
|
999
1002
|
status: "success",
|
|
1000
1003
|
data: { result: b }
|
|
@@ -1006,34 +1009,34 @@ const X = je("production"), Tt = X.namespace("store"), Mt = (t) => t.pipe(
|
|
|
1006
1009
|
* a small delay to ensure it happens after.
|
|
1007
1010
|
*/
|
|
1008
1011
|
rt(1)
|
|
1009
|
-
),
|
|
1012
|
+
), l = w(
|
|
1010
1013
|
f.pipe(
|
|
1011
1014
|
be(1),
|
|
1012
1015
|
p(() => ({
|
|
1013
1016
|
fetchStatus: "idle"
|
|
1014
1017
|
}))
|
|
1015
1018
|
),
|
|
1016
|
-
|
|
1019
|
+
w(
|
|
1017
1020
|
S({ fetchStatus: "fetching", error: void 0 }),
|
|
1018
|
-
|
|
1019
|
-
).pipe(
|
|
1020
|
-
|
|
1021
|
-
).pipe(
|
|
1022
|
-
return m ? !(c != null && c.isStale) && !
|
|
1021
|
+
d
|
|
1022
|
+
).pipe(L(f)),
|
|
1023
|
+
h
|
|
1024
|
+
).pipe(L(u)), c = n.get(s), o = c == null ? void 0 : c.cache_fnResult, m = !!o, R = i.type === "refetch" && i.ignoreStale;
|
|
1025
|
+
return m ? !(c != null && c.isStale) && !R ? S({
|
|
1023
1026
|
fetchStatus: "idle",
|
|
1024
1027
|
status: "success",
|
|
1025
1028
|
data: { result: o.result },
|
|
1026
1029
|
error: void 0
|
|
1027
|
-
}) :
|
|
1030
|
+
}) : w(
|
|
1028
1031
|
S({
|
|
1029
1032
|
fetchStatus: "fetching",
|
|
1030
1033
|
status: "success",
|
|
1031
1034
|
data: { result: o.result },
|
|
1032
1035
|
error: void 0
|
|
1033
1036
|
}),
|
|
1034
|
-
|
|
1035
|
-
) :
|
|
1036
|
-
}, q =
|
|
1037
|
+
l
|
|
1038
|
+
) : l;
|
|
1039
|
+
}, q = D.namespace("invalidation"), kt = ({
|
|
1037
1040
|
queryStore: t
|
|
1038
1041
|
}) => ({
|
|
1039
1042
|
invalidateQueries: ({
|
|
@@ -1043,11 +1046,11 @@ const X = je("production"), Tt = X.namespace("store"), Mt = (t) => t.pipe(
|
|
|
1043
1046
|
} = {}) => {
|
|
1044
1047
|
let i = [];
|
|
1045
1048
|
r ? (q.log("invalidation requested for", r), t.updateMany({ isStale: !0 }, (u) => {
|
|
1046
|
-
const
|
|
1047
|
-
return
|
|
1049
|
+
const a = ee(r, u.queryKey, { exact: n });
|
|
1050
|
+
return a && i.push(_(u.queryKey)), a;
|
|
1048
1051
|
})) : s ? t.updateMany({ isStale: !0 }, (u) => {
|
|
1049
|
-
const
|
|
1050
|
-
return
|
|
1052
|
+
const a = s(u);
|
|
1053
|
+
return a && i.push(_(u.queryKey)), a;
|
|
1051
1054
|
}) : (q.log("Invalidation requested for all queries"), t.updateMany({ isStale: !0 }), i = Array.from(t.keys())), i.forEach((u) => {
|
|
1052
1055
|
t.update(u, {
|
|
1053
1056
|
deduplication_fn: void 0
|
|
@@ -1062,22 +1065,22 @@ const X = je("production"), Tt = X.namespace("store"), Mt = (t) => t.pipe(
|
|
|
1062
1065
|
options$: n
|
|
1063
1066
|
}) => (s) => {
|
|
1064
1067
|
const i = s.pipe(J());
|
|
1065
|
-
return
|
|
1068
|
+
return w(
|
|
1066
1069
|
i,
|
|
1067
1070
|
i.pipe(
|
|
1068
|
-
|
|
1071
|
+
y(
|
|
1069
1072
|
(u) => !!u.data && u.fetchStatus !== "fetching"
|
|
1070
1073
|
),
|
|
1071
|
-
|
|
1072
|
-
|
|
1074
|
+
C((u, a) => u.data === a.data),
|
|
1075
|
+
H(n),
|
|
1073
1076
|
p(([, { refetchInterval: u }]) => u),
|
|
1074
|
-
|
|
1075
|
-
|
|
1077
|
+
y(X),
|
|
1078
|
+
E((u) => typeof u == "number" ? se(u).pipe(
|
|
1076
1079
|
p(() => ({
|
|
1077
1080
|
type: "refetch",
|
|
1078
1081
|
ignoreStale: !0
|
|
1079
1082
|
})),
|
|
1080
|
-
|
|
1083
|
+
E(() => M)
|
|
1081
1084
|
) : M)
|
|
1082
1085
|
)
|
|
1083
1086
|
);
|
|
@@ -1087,28 +1090,28 @@ const X = je("production"), Tt = X.namespace("store"), Mt = (t) => t.pipe(
|
|
|
1087
1090
|
}), Ut = (t, e) => t.filter((r) => !e.includes(r)), jt = (t, e) => t.store$.pipe(
|
|
1088
1091
|
p((r) => [...r.keys()]),
|
|
1089
1092
|
Ie([]),
|
|
1090
|
-
|
|
1091
|
-
|
|
1093
|
+
ae(),
|
|
1094
|
+
K(([r, n]) => {
|
|
1092
1095
|
const s = Ut(n, r);
|
|
1093
|
-
return
|
|
1096
|
+
return w(
|
|
1094
1097
|
...s.map((i) => {
|
|
1095
1098
|
const u = t.store$.pipe(
|
|
1096
1099
|
p(() => t.get(i)),
|
|
1097
|
-
|
|
1100
|
+
y((a) => a === void 0)
|
|
1098
1101
|
);
|
|
1099
|
-
return
|
|
1102
|
+
return w(Qe, S(i)).pipe(
|
|
1100
1103
|
x(() => {
|
|
1101
1104
|
}),
|
|
1102
1105
|
e,
|
|
1103
|
-
|
|
1106
|
+
le(() => {
|
|
1104
1107
|
}),
|
|
1105
|
-
|
|
1108
|
+
L(u)
|
|
1106
1109
|
);
|
|
1107
1110
|
})
|
|
1108
1111
|
);
|
|
1109
1112
|
})
|
|
1110
1113
|
), Ae = (t) => t.pipe(
|
|
1111
|
-
|
|
1114
|
+
E((e) => Fe(e.runners)),
|
|
1112
1115
|
p((e) => e.map(({ options: r }) => r))
|
|
1113
1116
|
), At = (t) => t.pipe(
|
|
1114
1117
|
p(
|
|
@@ -1123,19 +1126,19 @@ const X = je("production"), Tt = X.namespace("store"), Mt = (t) => t.pipe(
|
|
|
1123
1126
|
{ lowestStaleTime: void 0 }
|
|
1124
1127
|
)
|
|
1125
1128
|
),
|
|
1126
|
-
|
|
1129
|
+
C(T)
|
|
1127
1130
|
), Kt = (t) => (e) => e.pipe(
|
|
1128
|
-
|
|
1131
|
+
y(
|
|
1129
1132
|
(r) => r.key === t && (r.type === "fetchError" || r.type === "fetchSuccess")
|
|
1130
1133
|
)
|
|
1131
1134
|
), zt = ({
|
|
1132
1135
|
queryStore: t
|
|
1133
1136
|
}) => (e) => e.pipe(
|
|
1134
|
-
|
|
1137
|
+
E((r) => {
|
|
1135
1138
|
const n = t.get$(r);
|
|
1136
1139
|
return t.queryEvent$.pipe(
|
|
1137
1140
|
Kt(r),
|
|
1138
|
-
|
|
1141
|
+
E(
|
|
1139
1142
|
() => n.pipe(
|
|
1140
1143
|
Ae,
|
|
1141
1144
|
At,
|
|
@@ -1147,10 +1150,10 @@ const X = je("production"), Tt = X.namespace("store"), Mt = (t) => t.pipe(
|
|
|
1147
1150
|
staleTime: s
|
|
1148
1151
|
}), t.update(r, { isStale: !1 }));
|
|
1149
1152
|
}),
|
|
1150
|
-
|
|
1153
|
+
y(
|
|
1151
1154
|
({ lowestStaleTime: s }) => s !== 1 / 0 && s !== 0
|
|
1152
1155
|
),
|
|
1153
|
-
|
|
1156
|
+
E(({ lowestStaleTime: s = 0 }) => se(s)),
|
|
1154
1157
|
x(() => {
|
|
1155
1158
|
var s;
|
|
1156
1159
|
(s = t.get(r)) != null && s.isStale || (q.log(r, "marked as stale!"), t.update(r, { isStale: !0 }));
|
|
@@ -1173,26 +1176,26 @@ const X = je("production"), Tt = X.namespace("store"), Mt = (t) => t.pipe(
|
|
|
1173
1176
|
{ lowestCacheTime: void 0 }
|
|
1174
1177
|
)
|
|
1175
1178
|
),
|
|
1176
|
-
|
|
1179
|
+
C(T)
|
|
1177
1180
|
), Wt = (t) => t.pipe(
|
|
1178
1181
|
p((e) => e.cache_fnResult),
|
|
1179
|
-
|
|
1182
|
+
C(T)
|
|
1180
1183
|
), Yt = ({
|
|
1181
1184
|
queryStore: t
|
|
1182
1185
|
}) => (e) => e.pipe(
|
|
1183
|
-
|
|
1186
|
+
E((r) => {
|
|
1184
1187
|
const n = t.get$(r);
|
|
1185
1188
|
return n.pipe(
|
|
1186
1189
|
Wt,
|
|
1187
|
-
|
|
1190
|
+
E(
|
|
1188
1191
|
() => n.pipe(
|
|
1189
1192
|
Ae,
|
|
1190
1193
|
Jt,
|
|
1191
|
-
|
|
1194
|
+
E(
|
|
1192
1195
|
({
|
|
1193
1196
|
lowestCacheTime: i = 5 * 60 * 1e3
|
|
1194
1197
|
/* 5mn */
|
|
1195
|
-
}) =>
|
|
1198
|
+
}) => se(i).pipe(
|
|
1196
1199
|
x(() => {
|
|
1197
1200
|
t.update(r, { cache_fnResult: void 0 });
|
|
1198
1201
|
})
|
|
@@ -1205,11 +1208,11 @@ const X = je("production"), Tt = X.namespace("store"), Mt = (t) => t.pipe(
|
|
|
1205
1208
|
), Gt = ({
|
|
1206
1209
|
queryStore: t
|
|
1207
1210
|
}) => (e) => e.pipe(
|
|
1208
|
-
|
|
1209
|
-
|
|
1211
|
+
E((r) => t.get$(r).pipe(
|
|
1212
|
+
y((s) => !s.cache_fnResult),
|
|
1210
1213
|
p((s) => s.runners.length > 0),
|
|
1211
|
-
|
|
1212
|
-
|
|
1214
|
+
ae(),
|
|
1215
|
+
y(([s, i]) => s && !i),
|
|
1213
1216
|
x(() => {
|
|
1214
1217
|
t.delete(r);
|
|
1215
1218
|
}),
|
|
@@ -1226,22 +1229,22 @@ const X = je("production"), Tt = X.namespace("store"), Mt = (t) => t.pipe(
|
|
|
1226
1229
|
options$: n,
|
|
1227
1230
|
key: s
|
|
1228
1231
|
}) => (i) => i.pipe(
|
|
1229
|
-
|
|
1230
|
-
p(([u,
|
|
1232
|
+
H(n),
|
|
1233
|
+
p(([u, a]) => s.length === 0 ? [u, void 0] : u.type !== "initial" ? [u, void 0] : (t.get(e) ? t.update(e, {
|
|
1231
1234
|
queryKey: s,
|
|
1232
|
-
...
|
|
1235
|
+
...a.markStale && {
|
|
1233
1236
|
isStale: !0
|
|
1234
1237
|
}
|
|
1235
1238
|
}) : t.set(e, Ke({ key: s })), [u, t.addRunner(e, r)]))
|
|
1236
|
-
), Dt =
|
|
1239
|
+
), Dt = D.namespace("cache"), Xt = ({
|
|
1237
1240
|
queryStore: t
|
|
1238
1241
|
}) => ({
|
|
1239
1242
|
setQueryData: ({
|
|
1240
1243
|
queryKey: r,
|
|
1241
1244
|
updater: n
|
|
1242
1245
|
}) => {
|
|
1243
|
-
const s =
|
|
1244
|
-
r.length !== 0 && (Dt.log("set cache for query",
|
|
1246
|
+
const s = _(r);
|
|
1247
|
+
r.length !== 0 && (Dt.log("set cache for query", _), t.get(s) || t.set(s, Ke({ key: r })), t.update(s, (i) => {
|
|
1245
1248
|
var u;
|
|
1246
1249
|
return typeof n == "function" ? {
|
|
1247
1250
|
...i,
|
|
@@ -1261,7 +1264,7 @@ const X = je("production"), Tt = X.namespace("store"), Mt = (t) => t.pipe(
|
|
|
1261
1264
|
type: "queryDataSet"
|
|
1262
1265
|
}));
|
|
1263
1266
|
}
|
|
1264
|
-
}), Zt =
|
|
1267
|
+
}), Zt = D.namespace("refetch"), qt = ({
|
|
1265
1268
|
key: t,
|
|
1266
1269
|
serializedKey: e,
|
|
1267
1270
|
queryStore: r
|
|
@@ -1286,43 +1289,43 @@ const X = je("production"), Tt = X.namespace("store"), Mt = (t) => t.pipe(
|
|
|
1286
1289
|
trigger: n
|
|
1287
1290
|
}));
|
|
1288
1291
|
}),
|
|
1289
|
-
|
|
1290
|
-
), V = (t) =>
|
|
1292
|
+
y((n) => n.type !== "refetch")
|
|
1293
|
+
), V = (t) => ne(() => {
|
|
1291
1294
|
const e = t();
|
|
1292
|
-
return e instanceof Promise ?
|
|
1295
|
+
return e instanceof Promise ? re(e) : e instanceof Me ? e : S(e);
|
|
1293
1296
|
}), er = ({
|
|
1294
1297
|
variables: t,
|
|
1295
1298
|
state: e,
|
|
1296
1299
|
options: r
|
|
1297
1300
|
}) => {
|
|
1298
|
-
const n = e.isPaused, s = async () => await Promise.reject(new Error("No mutationFn found")), i = r.mutationFn ?? s,
|
|
1301
|
+
const n = e.isPaused, s = async () => await Promise.reject(new Error("No mutationFn found")), i = r.mutationFn ?? s, a = Te(
|
|
1299
1302
|
() => n,
|
|
1300
1303
|
S(e.context),
|
|
1301
1304
|
V(
|
|
1302
1305
|
// eslint-disable-next-line @typescript-eslint/promise-function-async
|
|
1303
1306
|
() => {
|
|
1304
|
-
var
|
|
1305
|
-
return ((
|
|
1307
|
+
var l;
|
|
1308
|
+
return ((l = r.onMutate) == null ? void 0 : l.call(r, t)) ?? void 0;
|
|
1306
1309
|
}
|
|
1307
1310
|
)
|
|
1308
|
-
).pipe(J()), f = (
|
|
1311
|
+
).pipe(J()), f = (l, c, o) => (console.error(l), V(
|
|
1309
1312
|
() => {
|
|
1310
|
-
var
|
|
1311
|
-
return (
|
|
1313
|
+
var R;
|
|
1314
|
+
return (R = r.onError) == null ? void 0 : R.call(r, l, t, c);
|
|
1312
1315
|
}
|
|
1313
1316
|
).pipe(
|
|
1314
|
-
|
|
1317
|
+
j(() => S(l)),
|
|
1315
1318
|
p(
|
|
1316
1319
|
() => ({
|
|
1317
1320
|
failureCount: o,
|
|
1318
|
-
error:
|
|
1319
|
-
failureReason:
|
|
1321
|
+
error: l,
|
|
1322
|
+
failureReason: l,
|
|
1320
1323
|
context: c,
|
|
1321
1324
|
status: "error"
|
|
1322
1325
|
})
|
|
1323
1326
|
)
|
|
1324
|
-
)),
|
|
1325
|
-
|
|
1327
|
+
)), g = a.pipe(
|
|
1328
|
+
E((l) => (typeof i == "function" ? (
|
|
1326
1329
|
// eslint-disable-next-line @typescript-eslint/promise-function-async
|
|
1327
1330
|
V(() => i(t))
|
|
1328
1331
|
) : i).pipe(
|
|
@@ -1332,7 +1335,7 @@ const X = je("production"), Tt = X.namespace("store"), Mt = (t) => t.pipe(
|
|
|
1332
1335
|
data: o
|
|
1333
1336
|
},
|
|
1334
1337
|
error: null,
|
|
1335
|
-
context:
|
|
1338
|
+
context: l
|
|
1336
1339
|
})
|
|
1337
1340
|
),
|
|
1338
1341
|
Ue({
|
|
@@ -1341,9 +1344,9 @@ const X = je("production"), Tt = X.namespace("store"), Mt = (t) => t.pipe(
|
|
|
1341
1344
|
failureCount: o,
|
|
1342
1345
|
failureReason: m
|
|
1343
1346
|
}),
|
|
1344
|
-
catchError: (o, m) => f(m,
|
|
1345
|
-
p((
|
|
1346
|
-
...
|
|
1347
|
+
catchError: (o, m) => f(m, l, o).pipe(
|
|
1348
|
+
p((R) => ({
|
|
1349
|
+
...R,
|
|
1347
1350
|
result: void 0
|
|
1348
1351
|
}))
|
|
1349
1352
|
)
|
|
@@ -1353,7 +1356,7 @@ const X = je("production"), Tt = X.namespace("store"), Mt = (t) => t.pipe(
|
|
|
1353
1356
|
!0
|
|
1354
1357
|
)
|
|
1355
1358
|
))
|
|
1356
|
-
),
|
|
1359
|
+
), d = S({
|
|
1357
1360
|
...e,
|
|
1358
1361
|
variables: t,
|
|
1359
1362
|
status: "pending",
|
|
@@ -1362,13 +1365,13 @@ const X = je("production"), Tt = X.namespace("store"), Mt = (t) => t.pipe(
|
|
|
1362
1365
|
failureReason: null,
|
|
1363
1366
|
submittedAt: e.submittedAt ?? (/* @__PURE__ */ new Date()).getTime()
|
|
1364
1367
|
});
|
|
1365
|
-
return
|
|
1366
|
-
|
|
1368
|
+
return w(
|
|
1369
|
+
d,
|
|
1367
1370
|
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
if (!
|
|
1371
|
+
a.pipe(p((l) => ({ context: l }))),
|
|
1372
|
+
g.pipe(
|
|
1373
|
+
E(({ result: l, error: c, ...o }) => {
|
|
1374
|
+
if (!l && !c)
|
|
1372
1375
|
return S({
|
|
1373
1376
|
...o
|
|
1374
1377
|
});
|
|
@@ -1377,7 +1380,7 @@ const X = je("production"), Tt = X.namespace("store"), Mt = (t) => t.pipe(
|
|
|
1377
1380
|
var v;
|
|
1378
1381
|
return (v = r.onSuccess) == null ? void 0 : v.call(
|
|
1379
1382
|
r,
|
|
1380
|
-
|
|
1383
|
+
l == null ? void 0 : l.data,
|
|
1381
1384
|
t,
|
|
1382
1385
|
o.context
|
|
1383
1386
|
);
|
|
@@ -1387,14 +1390,14 @@ const X = je("production"), Tt = X.namespace("store"), Mt = (t) => t.pipe(
|
|
|
1387
1390
|
var v;
|
|
1388
1391
|
return (v = r.onSettled) == null ? void 0 : v.call(
|
|
1389
1392
|
r,
|
|
1390
|
-
|
|
1393
|
+
l == null ? void 0 : l.data,
|
|
1391
1394
|
c,
|
|
1392
1395
|
t,
|
|
1393
1396
|
o.context
|
|
1394
1397
|
);
|
|
1395
1398
|
}
|
|
1396
1399
|
).pipe(
|
|
1397
|
-
|
|
1400
|
+
j((v) => l ? S(l) : S(v))
|
|
1398
1401
|
);
|
|
1399
1402
|
return ue(m, b).pipe(
|
|
1400
1403
|
ce(),
|
|
@@ -1407,15 +1410,15 @@ const X = je("production"), Tt = X.namespace("store"), Mt = (t) => t.pipe(
|
|
|
1407
1410
|
} : {
|
|
1408
1411
|
status: "success",
|
|
1409
1412
|
error: c,
|
|
1410
|
-
data:
|
|
1413
|
+
data: l == null ? void 0 : l.data,
|
|
1411
1414
|
variables: t,
|
|
1412
1415
|
...o
|
|
1413
1416
|
}
|
|
1414
1417
|
),
|
|
1415
|
-
|
|
1418
|
+
j(
|
|
1416
1419
|
(v) => f(v, o.context, 0).pipe(
|
|
1417
|
-
p((
|
|
1418
|
-
...
|
|
1420
|
+
p((O) => ({
|
|
1421
|
+
...O,
|
|
1419
1422
|
data: void 0
|
|
1420
1423
|
}))
|
|
1421
1424
|
)
|
|
@@ -1424,14 +1427,14 @@ const X = je("production"), Tt = X.namespace("store"), Mt = (t) => t.pipe(
|
|
|
1424
1427
|
})
|
|
1425
1428
|
)
|
|
1426
1429
|
).pipe(
|
|
1427
|
-
|
|
1428
|
-
...
|
|
1430
|
+
fe((l, c) => ({
|
|
1431
|
+
...l,
|
|
1429
1432
|
...c,
|
|
1430
|
-
data: c.data ??
|
|
1431
|
-
error: c.error ??
|
|
1433
|
+
data: c.data ?? l.data,
|
|
1434
|
+
error: c.error ?? l.error
|
|
1432
1435
|
}), W()),
|
|
1433
|
-
|
|
1434
|
-
({ data:
|
|
1436
|
+
C(
|
|
1437
|
+
({ data: l, ...c }, { data: o, ...m }) => T(c, m) && T(l, o)
|
|
1435
1438
|
)
|
|
1436
1439
|
);
|
|
1437
1440
|
};
|
|
@@ -1441,124 +1444,124 @@ class tr {
|
|
|
1441
1444
|
mutationCache: r,
|
|
1442
1445
|
state: n
|
|
1443
1446
|
}) {
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1447
|
+
$(this, "mutationCache");
|
|
1448
|
+
$(this, "observerCount", new F(0));
|
|
1449
|
+
$(this, "destroySubject", new Q());
|
|
1450
|
+
$(this, "resetSubject", new Q());
|
|
1451
|
+
$(this, "executeSubject", new Q());
|
|
1452
|
+
$(this, "state", W());
|
|
1453
|
+
$(this, "state$");
|
|
1454
|
+
$(this, "options");
|
|
1455
|
+
$(this, "observerCount$", this.observerCount.asObservable());
|
|
1456
|
+
$(this, "destroyed$", this.destroySubject.asObservable());
|
|
1454
1457
|
this.options = e, this.mutationCache = r, this.state = n ?? this.state;
|
|
1455
1458
|
const s = S(this.state), i = this.resetSubject.pipe(
|
|
1456
1459
|
p(() => W())
|
|
1457
1460
|
), u = this.executeSubject.pipe(
|
|
1458
|
-
|
|
1459
|
-
(
|
|
1461
|
+
E(
|
|
1462
|
+
(a) => er({
|
|
1460
1463
|
options: {
|
|
1461
1464
|
...this.options,
|
|
1462
1465
|
onMutate: (f) => {
|
|
1463
|
-
const
|
|
1466
|
+
const g = V(
|
|
1464
1467
|
() => {
|
|
1465
|
-
var
|
|
1466
|
-
return (
|
|
1467
|
-
|
|
1468
|
+
var h, l;
|
|
1469
|
+
return (l = (h = r.config).onMutate) == null ? void 0 : l.call(
|
|
1470
|
+
h,
|
|
1468
1471
|
f,
|
|
1469
1472
|
this
|
|
1470
1473
|
);
|
|
1471
1474
|
}
|
|
1472
|
-
),
|
|
1475
|
+
), d = V(
|
|
1473
1476
|
// eslint-disable-next-line @typescript-eslint/promise-function-async
|
|
1474
1477
|
() => {
|
|
1475
|
-
var
|
|
1476
|
-
return ((
|
|
1478
|
+
var h, l;
|
|
1479
|
+
return ((l = (h = this.options).onMutate) == null ? void 0 : l.call(h, f)) ?? void 0;
|
|
1477
1480
|
}
|
|
1478
1481
|
);
|
|
1479
|
-
return
|
|
1482
|
+
return g.pipe(K(() => d));
|
|
1480
1483
|
},
|
|
1481
|
-
onError: (f,
|
|
1482
|
-
const
|
|
1484
|
+
onError: (f, g, d) => {
|
|
1485
|
+
const h = V(
|
|
1483
1486
|
() => {
|
|
1484
1487
|
var c, o;
|
|
1485
1488
|
return (o = (c = r.config).onError) == null ? void 0 : o.call(
|
|
1486
1489
|
c,
|
|
1487
1490
|
f,
|
|
1491
|
+
g,
|
|
1488
1492
|
d,
|
|
1489
|
-
h,
|
|
1490
1493
|
this
|
|
1491
1494
|
);
|
|
1492
1495
|
}
|
|
1493
|
-
),
|
|
1496
|
+
), l = V(
|
|
1494
1497
|
() => {
|
|
1495
1498
|
var c, o;
|
|
1496
|
-
return (o = (c = this.options).onError) == null ? void 0 : o.call(c, f,
|
|
1499
|
+
return (o = (c = this.options).onError) == null ? void 0 : o.call(c, f, g, d);
|
|
1497
1500
|
}
|
|
1498
1501
|
);
|
|
1499
|
-
return ue(
|
|
1502
|
+
return ue(h, l).pipe(ce());
|
|
1500
1503
|
},
|
|
1501
|
-
onSettled: (f, d, h
|
|
1502
|
-
const
|
|
1504
|
+
onSettled: (f, g, d, h) => {
|
|
1505
|
+
const l = V(
|
|
1503
1506
|
() => {
|
|
1504
1507
|
var o, m;
|
|
1505
1508
|
return (m = (o = r.config).onSettled) == null ? void 0 : m.call(
|
|
1506
1509
|
o,
|
|
1507
1510
|
f,
|
|
1511
|
+
g,
|
|
1508
1512
|
d,
|
|
1509
1513
|
h,
|
|
1510
|
-
g,
|
|
1511
1514
|
this
|
|
1512
1515
|
);
|
|
1513
1516
|
}
|
|
1514
1517
|
), c = V(
|
|
1515
1518
|
() => {
|
|
1516
1519
|
var o, m;
|
|
1517
|
-
return (m = (o = this.options).onSettled) == null ? void 0 : m.call(o, f, d, h
|
|
1520
|
+
return (m = (o = this.options).onSettled) == null ? void 0 : m.call(o, f, g, d, h);
|
|
1518
1521
|
}
|
|
1519
1522
|
);
|
|
1520
|
-
return ue(
|
|
1523
|
+
return ue(l, c).pipe(ce());
|
|
1521
1524
|
},
|
|
1522
|
-
onSuccess: (f,
|
|
1523
|
-
const
|
|
1525
|
+
onSuccess: (f, g, d) => {
|
|
1526
|
+
const h = V(
|
|
1524
1527
|
() => {
|
|
1525
1528
|
var c, o;
|
|
1526
1529
|
return (o = (c = r.config).onSuccess) == null ? void 0 : o.call(
|
|
1527
1530
|
c,
|
|
1528
1531
|
f,
|
|
1532
|
+
g,
|
|
1529
1533
|
d,
|
|
1530
|
-
h,
|
|
1531
1534
|
this
|
|
1532
1535
|
);
|
|
1533
1536
|
}
|
|
1534
|
-
),
|
|
1537
|
+
), l = V(
|
|
1535
1538
|
() => {
|
|
1536
1539
|
var c, o;
|
|
1537
|
-
return (o = (c = this.options).onSuccess) == null ? void 0 : o.call(c, f,
|
|
1540
|
+
return (o = (c = this.options).onSuccess) == null ? void 0 : o.call(c, f, g, d);
|
|
1538
1541
|
}
|
|
1539
1542
|
);
|
|
1540
|
-
return ue(
|
|
1543
|
+
return ue(h, l).pipe(ce());
|
|
1541
1544
|
}
|
|
1542
1545
|
},
|
|
1543
1546
|
state: this.state,
|
|
1544
|
-
variables:
|
|
1547
|
+
variables: a
|
|
1545
1548
|
})
|
|
1546
1549
|
),
|
|
1547
|
-
x((
|
|
1548
|
-
this.state = { ...this.state, ...
|
|
1550
|
+
x((a) => {
|
|
1551
|
+
this.state = { ...this.state, ...a };
|
|
1549
1552
|
}),
|
|
1550
|
-
|
|
1553
|
+
L(this.destroySubject)
|
|
1551
1554
|
);
|
|
1552
|
-
this.state$ =
|
|
1555
|
+
this.state$ = w(s, u, i).pipe(
|
|
1553
1556
|
/**
|
|
1554
1557
|
* refCount as true somewhat make NEVER complete when there are
|
|
1555
1558
|
* no more observers. I thought I should have to complete manually (which is
|
|
1556
1559
|
* why we still cancel the observable when we remove it from cache)
|
|
1557
1560
|
*/
|
|
1558
1561
|
$e({ bufferSize: 1, refCount: !1 }),
|
|
1559
|
-
|
|
1560
|
-
ke((
|
|
1561
|
-
this.observerCount.next(
|
|
1562
|
+
L(this.destroySubject),
|
|
1563
|
+
ke((a) => {
|
|
1564
|
+
this.observerCount.next(a);
|
|
1562
1565
|
})
|
|
1563
1566
|
);
|
|
1564
1567
|
}
|
|
@@ -1594,43 +1597,43 @@ class tr {
|
|
|
1594
1597
|
this.resetSubject.next(), this.resetSubject.complete(), this.destroy();
|
|
1595
1598
|
}
|
|
1596
1599
|
}
|
|
1597
|
-
const
|
|
1600
|
+
const ge = ({
|
|
1598
1601
|
mutationKey: t,
|
|
1599
1602
|
status: e,
|
|
1600
1603
|
predicate: r,
|
|
1601
1604
|
exact: n = !0
|
|
1602
|
-
} = {}) => (i) => n && t !== void 0 && i.options.mutationKey !== void 0 && !
|
|
1605
|
+
} = {}) => (i) => n && t !== void 0 && i.options.mutationKey !== void 0 && !ee(i.options.mutationKey, t, { exact: n }) || !n && t !== void 0 && i.options.mutationKey !== void 0 && !ee(t, i.options.mutationKey, { exact: n }) || e && i.state.status !== e ? !1 : r ? r(i) : !0;
|
|
1603
1606
|
class rr {
|
|
1604
1607
|
constructor(e = {}) {
|
|
1605
|
-
|
|
1606
|
-
|
|
1608
|
+
$(this, "mutationsSubject", new F([]));
|
|
1609
|
+
$(this, "mutations$", this.mutationsSubject.pipe(
|
|
1607
1610
|
p((e) => e.map((r) => r)),
|
|
1608
|
-
|
|
1611
|
+
C(Le),
|
|
1609
1612
|
J()
|
|
1610
1613
|
));
|
|
1611
|
-
|
|
1612
|
-
|
|
1614
|
+
$(this, "added$", this.mutations$.pipe(
|
|
1615
|
+
ae(),
|
|
1613
1616
|
p(
|
|
1614
1617
|
([e, r]) => r.filter((n) => !e.includes(n))[0]
|
|
1615
1618
|
),
|
|
1616
|
-
|
|
1619
|
+
y(X),
|
|
1617
1620
|
J()
|
|
1618
1621
|
));
|
|
1619
|
-
|
|
1620
|
-
|
|
1622
|
+
$(this, "removed$", this.mutations$.pipe(
|
|
1623
|
+
ae(),
|
|
1621
1624
|
p(
|
|
1622
1625
|
([e, r]) => e.filter((n) => !r.includes(n))
|
|
1623
1626
|
),
|
|
1624
|
-
|
|
1627
|
+
K((e) => re(e)),
|
|
1625
1628
|
J()
|
|
1626
1629
|
));
|
|
1627
|
-
|
|
1628
|
-
|
|
1630
|
+
$(this, "stateChange$", this.added$.pipe(
|
|
1631
|
+
K(
|
|
1629
1632
|
(e) => e.state$.pipe(
|
|
1630
1633
|
p(() => e),
|
|
1631
|
-
|
|
1634
|
+
L(
|
|
1632
1635
|
this.removed$.pipe(
|
|
1633
|
-
|
|
1636
|
+
y((r) => r === e)
|
|
1634
1637
|
)
|
|
1635
1638
|
)
|
|
1636
1639
|
)
|
|
@@ -1650,15 +1653,15 @@ class rr {
|
|
|
1650
1653
|
* Once a mutation is finished and there are no more observers than us
|
|
1651
1654
|
* we start the process of cleaning it up based on gc settings
|
|
1652
1655
|
*/
|
|
1653
|
-
|
|
1654
|
-
|
|
1656
|
+
y(({ status: i }) => i === "success" || i === "error"),
|
|
1657
|
+
E(
|
|
1655
1658
|
() => s.observerCount$.pipe(
|
|
1656
|
-
|
|
1659
|
+
y((i) => i <= 1),
|
|
1657
1660
|
be(1)
|
|
1658
1661
|
)
|
|
1659
1662
|
),
|
|
1660
1663
|
// defaults to 5mn
|
|
1661
|
-
|
|
1664
|
+
E(() => se(s.options.gcTime ?? 5 * 60 * 1e3)),
|
|
1662
1665
|
be(1)
|
|
1663
1666
|
).subscribe({
|
|
1664
1667
|
complete: () => {
|
|
@@ -1676,22 +1679,22 @@ class rr {
|
|
|
1676
1679
|
r == null || r.destroy();
|
|
1677
1680
|
}
|
|
1678
1681
|
find(e) {
|
|
1679
|
-
const r = { exact: !0, ...e }, n =
|
|
1682
|
+
const r = { exact: !0, ...e }, n = ge(r);
|
|
1680
1683
|
return this.mutationsSubject.getValue().find((s) => n(s));
|
|
1681
1684
|
}
|
|
1682
1685
|
findAll(e = {}) {
|
|
1683
|
-
const r = { exact: !0, ...e }, n =
|
|
1686
|
+
const r = { exact: !0, ...e }, n = ge(r);
|
|
1684
1687
|
return this.mutationsSubject.getValue().filter((s) => n(s)).map((s) => s);
|
|
1685
1688
|
}
|
|
1686
1689
|
observe({
|
|
1687
1690
|
filters: e,
|
|
1688
1691
|
select: r
|
|
1689
1692
|
} = {}) {
|
|
1690
|
-
const n =
|
|
1693
|
+
const n = ge(e), s = r ?? ((a) => a.state), i = this.getAll().reduce((a, f) => [...a, f], []).filter(n).map((a) => s(a));
|
|
1691
1694
|
return { value$: this.stateChange$.pipe(
|
|
1692
1695
|
Ie(),
|
|
1693
1696
|
p(() => this.getAll().filter(n).map(s)),
|
|
1694
|
-
|
|
1697
|
+
C(T)
|
|
1695
1698
|
), lastValue: i };
|
|
1696
1699
|
}
|
|
1697
1700
|
/**
|
|
@@ -1699,7 +1702,7 @@ class rr {
|
|
|
1699
1702
|
* ISO api react-query
|
|
1700
1703
|
*/
|
|
1701
1704
|
subscribe(e) {
|
|
1702
|
-
const r =
|
|
1705
|
+
const r = w(
|
|
1703
1706
|
this.added$.pipe(
|
|
1704
1707
|
x((n) => {
|
|
1705
1708
|
e({
|
|
@@ -1752,21 +1755,21 @@ const nr = () => {
|
|
|
1752
1755
|
const t = It(), e = kt({ queryStore: t }), r = Xt({ queryStore: t }), n = Lt();
|
|
1753
1756
|
let s = !1;
|
|
1754
1757
|
const i = ({
|
|
1755
|
-
key:
|
|
1756
|
-
fn$:
|
|
1757
|
-
fn:
|
|
1758
|
-
trigger$:
|
|
1759
|
-
options$: c = new
|
|
1758
|
+
key: g,
|
|
1759
|
+
fn$: d,
|
|
1760
|
+
fn: h,
|
|
1761
|
+
trigger$: l = new Q(),
|
|
1762
|
+
options$: c = new F({})
|
|
1760
1763
|
}) => {
|
|
1761
1764
|
if (!s)
|
|
1762
1765
|
throw new Error("You forgot to start client");
|
|
1763
|
-
const o =
|
|
1764
|
-
|
|
1765
|
-
const
|
|
1766
|
+
const o = _(g), m = d ?? (h ? S(h) : Qe);
|
|
1767
|
+
D.log("query$)", o);
|
|
1768
|
+
const R = c.pipe(p((O) => ({ options: O })));
|
|
1766
1769
|
let b = () => {
|
|
1767
1770
|
};
|
|
1768
|
-
const
|
|
1769
|
-
|
|
1771
|
+
const U = w(
|
|
1772
|
+
l.pipe(
|
|
1770
1773
|
Bt({
|
|
1771
1774
|
queryStore: t,
|
|
1772
1775
|
serializedKey: o
|
|
@@ -1779,68 +1782,68 @@ const nr = () => {
|
|
|
1779
1782
|
})
|
|
1780
1783
|
).pipe(J());
|
|
1781
1784
|
return {
|
|
1782
|
-
result$:
|
|
1785
|
+
result$: w(
|
|
1783
1786
|
S({
|
|
1784
1787
|
type: "initial"
|
|
1785
1788
|
}),
|
|
1786
|
-
|
|
1789
|
+
U
|
|
1787
1790
|
).pipe(
|
|
1788
1791
|
Ht({
|
|
1789
|
-
key:
|
|
1792
|
+
key: g,
|
|
1790
1793
|
queryStore: t,
|
|
1791
|
-
runner$:
|
|
1794
|
+
runner$: R,
|
|
1792
1795
|
serializedKey: o,
|
|
1793
1796
|
options$: c
|
|
1794
1797
|
}),
|
|
1795
|
-
p(([
|
|
1798
|
+
p(([O, I]) => (I && (b = I), O)),
|
|
1796
1799
|
qt({
|
|
1797
|
-
key:
|
|
1800
|
+
key: g,
|
|
1798
1801
|
options$: c,
|
|
1799
1802
|
queryStore: t,
|
|
1800
1803
|
serializedKey: o
|
|
1801
1804
|
}),
|
|
1802
|
-
|
|
1803
|
-
p(([
|
|
1804
|
-
p((
|
|
1805
|
-
trigger:
|
|
1806
|
-
options:
|
|
1807
|
-
}),
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
({ fn:
|
|
1805
|
+
H(m, c),
|
|
1806
|
+
p(([O, I, z]) => ({ trigger: O, fn: I, options: z })),
|
|
1807
|
+
p((O) => (D.log(o, "query trigger", {
|
|
1808
|
+
trigger: O.trigger,
|
|
1809
|
+
options: O.options
|
|
1810
|
+
}), O)),
|
|
1811
|
+
y(({ options: O }) => O.enabled !== !1),
|
|
1812
|
+
K(
|
|
1813
|
+
({ fn: O, options: I, trigger: z }) => Nt({
|
|
1811
1814
|
options$: c,
|
|
1812
|
-
options:
|
|
1813
|
-
fn:
|
|
1815
|
+
options: I,
|
|
1816
|
+
fn: O,
|
|
1814
1817
|
queryStore: t,
|
|
1815
1818
|
serializedKey: o,
|
|
1816
1819
|
trigger: z,
|
|
1817
|
-
trigger$:
|
|
1820
|
+
trigger$: U
|
|
1818
1821
|
})
|
|
1819
1822
|
),
|
|
1820
1823
|
xt,
|
|
1821
|
-
|
|
1822
|
-
ve(([
|
|
1823
|
-
p(([
|
|
1824
|
-
|
|
1824
|
+
H(c),
|
|
1825
|
+
ve(([O, I]) => !(O.data !== void 0 && I.terminateOnFirstResult), !0),
|
|
1826
|
+
p(([O]) => O),
|
|
1827
|
+
le(() => {
|
|
1825
1828
|
b();
|
|
1826
1829
|
})
|
|
1827
1830
|
)
|
|
1828
1831
|
};
|
|
1829
1832
|
}, u = jt(
|
|
1830
1833
|
t,
|
|
1831
|
-
(
|
|
1832
|
-
|
|
1833
|
-
const
|
|
1834
|
-
return
|
|
1834
|
+
(g) => g.pipe(
|
|
1835
|
+
E((d) => {
|
|
1836
|
+
const h = S(d);
|
|
1837
|
+
return w(
|
|
1835
1838
|
Yt({
|
|
1836
1839
|
queryStore: t
|
|
1837
|
-
})(
|
|
1840
|
+
})(h),
|
|
1838
1841
|
zt({
|
|
1839
1842
|
queryStore: t
|
|
1840
|
-
})(
|
|
1843
|
+
})(h),
|
|
1841
1844
|
Gt({
|
|
1842
1845
|
queryStore: t
|
|
1843
|
-
})(
|
|
1846
|
+
})(h)
|
|
1844
1847
|
);
|
|
1845
1848
|
})
|
|
1846
1849
|
)
|
|
@@ -1848,11 +1851,11 @@ const nr = () => {
|
|
|
1848
1851
|
return {
|
|
1849
1852
|
start: () => {
|
|
1850
1853
|
s = !0;
|
|
1851
|
-
const
|
|
1854
|
+
const g = u.subscribe(), d = [t.start()];
|
|
1852
1855
|
return () => {
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
}),
|
|
1856
|
+
d.forEach((h) => {
|
|
1857
|
+
h();
|
|
1858
|
+
}), g.unsubscribe();
|
|
1856
1859
|
};
|
|
1857
1860
|
},
|
|
1858
1861
|
query: i,
|
|
@@ -1864,14 +1867,14 @@ const nr = () => {
|
|
|
1864
1867
|
}
|
|
1865
1868
|
};
|
|
1866
1869
|
};
|
|
1867
|
-
var
|
|
1870
|
+
var te;
|
|
1868
1871
|
class Sr {
|
|
1869
1872
|
constructor({ mutationCache: e } = {
|
|
1870
1873
|
mutationCache: new rr()
|
|
1871
1874
|
}) {
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
+
$(this, "client");
|
|
1876
|
+
$(this, "mutationCache");
|
|
1877
|
+
he(this, te, /* @__PURE__ */ new Map());
|
|
1875
1878
|
this.mutationCache = e, this.client = nr();
|
|
1876
1879
|
}
|
|
1877
1880
|
mount() {
|
|
@@ -1890,14 +1893,14 @@ class Sr {
|
|
|
1890
1893
|
};
|
|
1891
1894
|
}
|
|
1892
1895
|
getMutationDefaults(e) {
|
|
1893
|
-
const r = [...
|
|
1896
|
+
const r = [...P(this, te).values()];
|
|
1894
1897
|
let n = {};
|
|
1895
1898
|
return r.forEach((s) => {
|
|
1896
|
-
|
|
1899
|
+
ee(e, s.mutationKey) && (n = { ...n, ...s.defaultOptions });
|
|
1897
1900
|
}), n;
|
|
1898
1901
|
}
|
|
1899
1902
|
setMutationDefaults(e, r) {
|
|
1900
|
-
|
|
1903
|
+
P(this, te).set(_(e), {
|
|
1901
1904
|
mutationKey: e,
|
|
1902
1905
|
defaultOptions: r
|
|
1903
1906
|
});
|
|
@@ -1908,7 +1911,7 @@ class Sr {
|
|
|
1908
1911
|
clear() {
|
|
1909
1912
|
}
|
|
1910
1913
|
}
|
|
1911
|
-
|
|
1914
|
+
te = new WeakMap();
|
|
1912
1915
|
export {
|
|
1913
1916
|
rr as MutationCache,
|
|
1914
1917
|
Sr as QueryClient,
|
|
@@ -1923,15 +1926,15 @@ export {
|
|
|
1923
1926
|
pr as signal,
|
|
1924
1927
|
lr as trigger,
|
|
1925
1928
|
lt as useBehaviorSubject,
|
|
1926
|
-
|
|
1929
|
+
k as useLiveRef,
|
|
1927
1930
|
yr as useMutation,
|
|
1928
|
-
|
|
1931
|
+
de as useObserve,
|
|
1929
1932
|
ar as useObserveCallback,
|
|
1930
1933
|
gr as usePersistSignals,
|
|
1931
1934
|
$r as useQuery,
|
|
1932
1935
|
Pe as useQueryClient,
|
|
1933
1936
|
fr as useSignalValue,
|
|
1934
|
-
|
|
1937
|
+
Ee as useSubject,
|
|
1935
1938
|
Se as useSubscribe,
|
|
1936
1939
|
vr as useSubscribeEffect,
|
|
1937
1940
|
mr as useUnmountObservable
|