reactjrx 1.123.0 → 1.124.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.cjs.map +1 -1
- package/dist/index.js +147 -141
- package/dist/index.js.map +1 -1
- package/dist/lib/queries/useQuery$.d.ts +1 -1
- package/dist/lib/utils/operators/retryBackoff.d.ts +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
var Se = Object.defineProperty;
|
|
2
2
|
var he = (e, t, r) => t in e ? Se(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
|
|
3
|
-
var
|
|
3
|
+
var w = (e, t, r) => he(e, typeof t != "symbol" ? t + "" : t, r);
|
|
4
4
|
import { useRef as N, useMemo as ve, useCallback as h, useSyncExternalStore as be, useEffect as v, useState as T, createContext as Z, memo as B, useContext as ee } from "react";
|
|
5
|
-
import { isObservable as J, from as V, of as
|
|
6
|
-
import { catchError as U, mergeMap as
|
|
5
|
+
import { isObservable as J, from as V, of as p, defer as _, startWith as Ie, identity as te, distinctUntilChanged as re, tap as k, catchError as F, EMPTY as H, BehaviorSubject as E, retry as we, ReplaySubject as Y, merge as M, throwError as A, timer as Ee, map as O, switchMap as C, zip as xe, share as ne, throttleTime as Ve, asyncScheduler as Me, concatMap as Ce, scan as Fe, takeUntil as Ne, fromEvent as se, take as ue, delay as $e, ignoreElements as Re, first as ae, defaultIfEmpty as Ae, filter as Pe, noop as j } from "rxjs";
|
|
6
|
+
import { catchError as U, mergeMap as P, retryWhen as qe, concatMap as Oe, first as De, tap as Qe } from "rxjs/operators";
|
|
7
7
|
import { jsx as ce } from "react/jsx-runtime";
|
|
8
8
|
import { hashKey as oe, useQueryClient as ie, useQuery as Te, useMutation as _e } from "@tanstack/react-query";
|
|
9
9
|
function G(e) {
|
|
@@ -12,11 +12,11 @@ function G(e) {
|
|
|
12
12
|
function K(e) {
|
|
13
13
|
if (J(e)) return () => e;
|
|
14
14
|
if (G(e)) return () => V(e);
|
|
15
|
-
if (typeof e != "function") return () =>
|
|
15
|
+
if (typeof e != "function") return () => p(e);
|
|
16
16
|
const t = e;
|
|
17
17
|
return (r) => _(() => {
|
|
18
18
|
const n = t(r);
|
|
19
|
-
return G(n) ? V(n) : J(n) ? n :
|
|
19
|
+
return G(n) ? V(n) : J(n) ? n : p(n);
|
|
20
20
|
});
|
|
21
21
|
}
|
|
22
22
|
const b = (e) => {
|
|
@@ -32,22 +32,22 @@ function le(e, t, r) {
|
|
|
32
32
|
compareFn: void 0
|
|
33
33
|
}, u = !r && Array.isArray(t) ? t : typeof e == "function" ? r ?? [] : [e], c = N(
|
|
34
34
|
"getValue" in e && typeof e.getValue == "function" ? e.getValue() : n.defaultValue
|
|
35
|
-
), a = b(e),
|
|
36
|
-
(
|
|
37
|
-
const
|
|
38
|
-
|
|
35
|
+
), a = b(e), i = b(n), s = h(() => c.current, []), o = h(
|
|
36
|
+
(y) => {
|
|
37
|
+
const f = a.current, g = K(f)().pipe(
|
|
38
|
+
i.current.defaultValue ? Ie(i.current.defaultValue) : te,
|
|
39
39
|
/**
|
|
40
40
|
* @important there is already a Object.is comparison in place from react
|
|
41
41
|
* so we only add a custom compareFn if provided
|
|
42
42
|
*/
|
|
43
|
-
re((m,
|
|
43
|
+
re((m, d) => i.current.compareFn ? m === void 0 || d === void 0 ? !1 : i.current.compareFn(m, d) : !1),
|
|
44
44
|
k((m) => {
|
|
45
45
|
c.current = m;
|
|
46
46
|
}),
|
|
47
47
|
F((m) => (console.error(m), H))
|
|
48
|
-
).subscribe(
|
|
48
|
+
).subscribe(y);
|
|
49
49
|
return () => {
|
|
50
|
-
|
|
50
|
+
i.current.unsubscribeOnUnmount !== !1 && g.unsubscribe();
|
|
51
51
|
};
|
|
52
52
|
},
|
|
53
53
|
[...u]
|
|
@@ -89,22 +89,22 @@ function it(e, t, r = []) {
|
|
|
89
89
|
n.onError ?? ((s) => {
|
|
90
90
|
console.error(s);
|
|
91
91
|
})
|
|
92
|
-
), a = h(() => K(e)(), r),
|
|
92
|
+
), a = h(() => K(e)(), r), i = h(
|
|
93
93
|
() => a().pipe(
|
|
94
94
|
F((s) => {
|
|
95
95
|
throw c.current(s), s;
|
|
96
96
|
}),
|
|
97
|
-
u ?
|
|
97
|
+
u ? we() : te
|
|
98
98
|
),
|
|
99
99
|
[a, u, c]
|
|
100
100
|
);
|
|
101
|
-
ke(
|
|
101
|
+
ke(i, r);
|
|
102
102
|
}
|
|
103
103
|
const He = Symbol("SIGNAL_RESET");
|
|
104
104
|
class fe extends E {
|
|
105
105
|
constructor(r) {
|
|
106
106
|
super(r.default);
|
|
107
|
-
|
|
107
|
+
w(this, "update", (r) => {
|
|
108
108
|
if (r === He)
|
|
109
109
|
super.next(this.config.default);
|
|
110
110
|
else if (typeof r == "function") {
|
|
@@ -116,7 +116,7 @@ class fe extends E {
|
|
|
116
116
|
/**
|
|
117
117
|
* @deprecated Use `next` instead
|
|
118
118
|
*/
|
|
119
|
-
|
|
119
|
+
w(this, "setValue", this.update.bind(this));
|
|
120
120
|
this.config = r;
|
|
121
121
|
}
|
|
122
122
|
/**
|
|
@@ -129,7 +129,7 @@ class fe extends E {
|
|
|
129
129
|
return this.config.key;
|
|
130
130
|
}
|
|
131
131
|
}
|
|
132
|
-
class
|
|
132
|
+
class D {
|
|
133
133
|
constructor(t) {
|
|
134
134
|
this.config = t;
|
|
135
135
|
}
|
|
@@ -142,7 +142,7 @@ function lt(e = {}) {
|
|
|
142
142
|
});
|
|
143
143
|
}
|
|
144
144
|
function ft(e) {
|
|
145
|
-
return new
|
|
145
|
+
return new D(e);
|
|
146
146
|
}
|
|
147
147
|
const yt = () => {
|
|
148
148
|
const e = z(() => new Y(1)), [t, r] = T(!1);
|
|
@@ -167,60 +167,60 @@ function mt(e) {
|
|
|
167
167
|
retry: t,
|
|
168
168
|
retryDelay: r,
|
|
169
169
|
retryAfterDelay: n,
|
|
170
|
-
retryAfter: u = () =>
|
|
170
|
+
retryAfter: u = () => p(!0)
|
|
171
171
|
} = e, c = typeof t != "function" ? t === !1 ? 0 : t === !0 ? Number.POSITIVE_INFINITY : t ?? Number.POSITIVE_INFINITY : Number.POSITIVE_INFINITY, a = typeof t == "function" ? (
|
|
172
172
|
// ? (attempt: number, error: TError) => of(retry(attempt, error))
|
|
173
173
|
t
|
|
174
|
-
) : () => !0,
|
|
174
|
+
) : () => !0, i = typeof r == "number" ? r : 100, s = {
|
|
175
175
|
...e
|
|
176
176
|
}, {
|
|
177
177
|
maxInterval: o = Number.POSITIVE_INFINITY,
|
|
178
|
-
resetOnSuccess:
|
|
179
|
-
backoffDelay:
|
|
178
|
+
resetOnSuccess: l = !1,
|
|
179
|
+
backoffDelay: y = Le
|
|
180
180
|
} = s;
|
|
181
|
-
return (
|
|
182
|
-
let
|
|
183
|
-
const m = (
|
|
184
|
-
return
|
|
185
|
-
U((
|
|
186
|
-
var
|
|
187
|
-
if (
|
|
188
|
-
const S = (
|
|
189
|
-
if (!S) throw
|
|
181
|
+
return (f) => _(() => {
|
|
182
|
+
let g = 0;
|
|
183
|
+
const m = (d, S) => d < c ? a(d, S) : !1;
|
|
184
|
+
return f.pipe(
|
|
185
|
+
U((d) => {
|
|
186
|
+
var I;
|
|
187
|
+
if (g++, !m(g - 1, d)) throw d;
|
|
188
|
+
const S = (I = e.caughtError) == null ? void 0 : I.call(e, g, d);
|
|
189
|
+
if (!S) throw d;
|
|
190
190
|
return S.pipe(
|
|
191
|
-
|
|
191
|
+
P(
|
|
192
192
|
(R) => M(
|
|
193
|
-
|
|
194
|
-
|
|
193
|
+
p(R),
|
|
194
|
+
A(() => d)
|
|
195
195
|
)
|
|
196
196
|
)
|
|
197
197
|
);
|
|
198
198
|
}),
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
const
|
|
199
|
+
qe((d) => d.pipe(
|
|
200
|
+
Oe((S) => {
|
|
201
|
+
const I = g - 1;
|
|
202
202
|
return u().pipe(
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
() => m(
|
|
203
|
+
De(),
|
|
204
|
+
P(
|
|
205
|
+
() => m(I, S) ? Ee(
|
|
206
206
|
ze(
|
|
207
|
-
|
|
207
|
+
y(I, i),
|
|
208
208
|
o
|
|
209
209
|
)
|
|
210
210
|
).pipe(
|
|
211
|
-
|
|
212
|
-
) :
|
|
211
|
+
P((R) => n && !n(I, S) ? A(() => S) : p(R))
|
|
212
|
+
) : A(() => S)
|
|
213
213
|
)
|
|
214
214
|
);
|
|
215
215
|
})
|
|
216
216
|
)),
|
|
217
|
-
U((
|
|
217
|
+
U((d) => {
|
|
218
218
|
if (e.catchError)
|
|
219
|
-
return e.catchError(
|
|
220
|
-
throw
|
|
219
|
+
return e.catchError(g, d);
|
|
220
|
+
throw d;
|
|
221
221
|
}),
|
|
222
|
-
|
|
223
|
-
|
|
222
|
+
Qe(() => {
|
|
223
|
+
l && (g = 0);
|
|
224
224
|
})
|
|
225
225
|
);
|
|
226
226
|
});
|
|
@@ -229,7 +229,7 @@ function gt(e) {
|
|
|
229
229
|
return e != null;
|
|
230
230
|
}
|
|
231
231
|
const pt = (e, t) => e.length === t.length && e.every((r, n) => r === t[n]), St = typeof window > "u" || "Deno" in window;
|
|
232
|
-
class
|
|
232
|
+
class Q {
|
|
233
233
|
constructor() {
|
|
234
234
|
/**
|
|
235
235
|
* items only get added as they are created. The only time we should cleanup
|
|
@@ -237,8 +237,8 @@ class D {
|
|
|
237
237
|
* return the same persisted state.
|
|
238
238
|
*/
|
|
239
239
|
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
|
|
240
|
-
|
|
241
|
-
|
|
240
|
+
w(this, "signals", new E(/* @__PURE__ */ new Map()));
|
|
241
|
+
w(this, "isDestroyed", !1);
|
|
242
242
|
}
|
|
243
243
|
getOrCreateSignal(t) {
|
|
244
244
|
const r = this.signals.value.get(t);
|
|
@@ -254,13 +254,13 @@ class D {
|
|
|
254
254
|
}
|
|
255
255
|
}
|
|
256
256
|
const ye = Z(
|
|
257
|
-
new
|
|
257
|
+
new Q()
|
|
258
258
|
), ht = B(
|
|
259
259
|
({ children: e }) => {
|
|
260
260
|
const t = z(
|
|
261
|
-
() => new
|
|
261
|
+
() => new Q()
|
|
262
262
|
), r = t.current, [n, u] = T(!1);
|
|
263
|
-
n && (t.current = new
|
|
263
|
+
n && (t.current = new Q(), u(!1));
|
|
264
264
|
const c = r;
|
|
265
265
|
return v(() => () => {
|
|
266
266
|
var a;
|
|
@@ -273,12 +273,12 @@ const ye = Z(
|
|
|
273
273
|
};
|
|
274
274
|
function L(e) {
|
|
275
275
|
const t = de();
|
|
276
|
-
if (e instanceof
|
|
276
|
+
if (e instanceof D && !t)
|
|
277
277
|
throw new Error(
|
|
278
278
|
"useSignalValue must be used within a SignalContextProvider"
|
|
279
279
|
);
|
|
280
280
|
return Je(
|
|
281
|
-
e instanceof
|
|
281
|
+
e instanceof D ? e : void 0
|
|
282
282
|
) ?? e;
|
|
283
283
|
}
|
|
284
284
|
function me(e, t) {
|
|
@@ -287,7 +287,7 @@ function me(e, t) {
|
|
|
287
287
|
() => {
|
|
288
288
|
const u = r.current ?? ((a) => a);
|
|
289
289
|
return n.pipe(
|
|
290
|
-
|
|
290
|
+
O(u),
|
|
291
291
|
re()
|
|
292
292
|
);
|
|
293
293
|
},
|
|
@@ -307,7 +307,7 @@ function vt(e) {
|
|
|
307
307
|
const bt = (e) => {
|
|
308
308
|
const t = $(e);
|
|
309
309
|
return [me(t), t];
|
|
310
|
-
},
|
|
310
|
+
}, It = (e) => ({
|
|
311
311
|
getItem: async (t) => {
|
|
312
312
|
const r = await e.getItem(t);
|
|
313
313
|
if (r)
|
|
@@ -320,7 +320,7 @@ const bt = (e) => {
|
|
|
320
320
|
},
|
|
321
321
|
clear: async () => {
|
|
322
322
|
}
|
|
323
|
-
}),
|
|
323
|
+
}), q = (e) => {
|
|
324
324
|
if (!(!e || typeof e != "object"))
|
|
325
325
|
return e;
|
|
326
326
|
}, je = ({
|
|
@@ -331,17 +331,17 @@ const bt = (e) => {
|
|
|
331
331
|
removeItem: async (r) => {
|
|
332
332
|
const n = await e.getItem(t), { [r]: u, ...c } = (
|
|
333
333
|
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
|
|
334
|
-
|
|
334
|
+
q(n) ?? {}
|
|
335
335
|
);
|
|
336
336
|
await e.setItem(t, c);
|
|
337
337
|
},
|
|
338
338
|
getItem: async (r) => {
|
|
339
|
-
const n = await e.getItem(t), u =
|
|
339
|
+
const n = await e.getItem(t), u = q(n) ?? {};
|
|
340
340
|
if (r in u)
|
|
341
341
|
return u[r];
|
|
342
342
|
},
|
|
343
343
|
setItem: async (r, n) => {
|
|
344
|
-
const u = await e.getItem(t), c =
|
|
344
|
+
const u = await e.getItem(t), c = q(u) ?? {};
|
|
345
345
|
await e.setItem(t, { ...c, [r]: n });
|
|
346
346
|
}
|
|
347
347
|
}), Ue = ({
|
|
@@ -396,7 +396,7 @@ const x = "__reactjrx", We = (e) => {
|
|
|
396
396
|
c,
|
|
397
397
|
`for signal ${r.config.key}`
|
|
398
398
|
), V(e.setItem(r.config.key, c)).pipe(
|
|
399
|
-
F((a) => (console.error(a),
|
|
399
|
+
F((a) => (console.error(a), p(null)))
|
|
400
400
|
);
|
|
401
401
|
};
|
|
402
402
|
function Ze({
|
|
@@ -407,17 +407,17 @@ function Ze({
|
|
|
407
407
|
return V(e.getItem(n.config.key)).pipe(
|
|
408
408
|
C((c) => {
|
|
409
409
|
const a = We(c);
|
|
410
|
-
if (!a) return
|
|
411
|
-
const
|
|
412
|
-
if (
|
|
413
|
-
return
|
|
410
|
+
if (!a) return p(c);
|
|
411
|
+
const i = typeof a.migrationVersion != "number", s = a.migrationVersion !== void 0 && u > a.migrationVersion;
|
|
412
|
+
if (i || s || a.value === void 0)
|
|
413
|
+
return p(c);
|
|
414
414
|
const o = a.value;
|
|
415
415
|
return process.env.NODE_ENV === "development" && console.log(
|
|
416
416
|
"[reactjrx][state][persistance]:",
|
|
417
417
|
"Hydrate value",
|
|
418
418
|
a,
|
|
419
419
|
`for signal ${n.config.key}`
|
|
420
|
-
), n.setValue(r({ value: o, version: u })),
|
|
420
|
+
), n.setValue(r({ value: o, version: u })), p(c);
|
|
421
421
|
})
|
|
422
422
|
);
|
|
423
423
|
}
|
|
@@ -426,7 +426,7 @@ function Be({
|
|
|
426
426
|
onHydrated: t,
|
|
427
427
|
adapter: r
|
|
428
428
|
}) {
|
|
429
|
-
const u = (e.length === 0 ?
|
|
429
|
+
const u = (e.length === 0 ? p([]) : xe(
|
|
430
430
|
...e.map(
|
|
431
431
|
(a) => Ze({
|
|
432
432
|
adapter: r,
|
|
@@ -460,18 +460,18 @@ function Be({
|
|
|
460
460
|
);
|
|
461
461
|
return M(
|
|
462
462
|
u.pipe(
|
|
463
|
-
|
|
463
|
+
O(() => ({
|
|
464
464
|
type: "hydrated"
|
|
465
465
|
}))
|
|
466
466
|
),
|
|
467
467
|
c.pipe(
|
|
468
|
-
|
|
468
|
+
O(() => ({
|
|
469
469
|
type: "persisted"
|
|
470
470
|
}))
|
|
471
471
|
)
|
|
472
472
|
);
|
|
473
473
|
}
|
|
474
|
-
function
|
|
474
|
+
function wt({
|
|
475
475
|
entries: e = [],
|
|
476
476
|
onHydrated: t,
|
|
477
477
|
adapter: r
|
|
@@ -479,12 +479,12 @@ function It({
|
|
|
479
479
|
const n = b(t), u = W(r), c = W(e);
|
|
480
480
|
return le(
|
|
481
481
|
() => u.pipe(
|
|
482
|
-
C((
|
|
483
|
-
|
|
482
|
+
C((i) => i ? M(
|
|
483
|
+
p({ type: "reset" }),
|
|
484
484
|
c.pipe(
|
|
485
485
|
Ce(
|
|
486
486
|
(s) => Be({
|
|
487
|
-
adapter:
|
|
487
|
+
adapter: i,
|
|
488
488
|
entries: s,
|
|
489
489
|
onHydrated: () => {
|
|
490
490
|
var o;
|
|
@@ -493,10 +493,10 @@ function It({
|
|
|
493
493
|
})
|
|
494
494
|
)
|
|
495
495
|
)
|
|
496
|
-
) :
|
|
496
|
+
) : p({ type: "reset" }))
|
|
497
497
|
).pipe(
|
|
498
498
|
Fe(
|
|
499
|
-
(
|
|
499
|
+
(i, s) => s.type === "reset" ? { isHydrated: !1 } : s.type === "hydrated" ? { isHydrated: !0 } : i,
|
|
500
500
|
{ isHydrated: !1 }
|
|
501
501
|
)
|
|
502
502
|
),
|
|
@@ -506,7 +506,7 @@ function It({
|
|
|
506
506
|
}
|
|
507
507
|
class et {
|
|
508
508
|
constructor() {
|
|
509
|
-
|
|
509
|
+
w(this, "queryMap", /* @__PURE__ */ new Map());
|
|
510
510
|
}
|
|
511
511
|
getQuery(t) {
|
|
512
512
|
return this.queryMap.get(t);
|
|
@@ -529,7 +529,7 @@ class et {
|
|
|
529
529
|
lastData: void 0
|
|
530
530
|
};
|
|
531
531
|
this.queryMap.set(u, a);
|
|
532
|
-
const
|
|
532
|
+
const i = c.subscribe({
|
|
533
533
|
next: (s) => {
|
|
534
534
|
const o = this.queryMap.get(u);
|
|
535
535
|
o && (o.lastData = { value: s });
|
|
@@ -538,7 +538,7 @@ class et {
|
|
|
538
538
|
this.deleteQuery(u);
|
|
539
539
|
}
|
|
540
540
|
});
|
|
541
|
-
return a.sub =
|
|
541
|
+
return a.sub = i, a;
|
|
542
542
|
}
|
|
543
543
|
deleteQuery(t) {
|
|
544
544
|
const r = this.queryMap.get(t);
|
|
@@ -573,11 +573,22 @@ function xt(e, t) {
|
|
|
573
573
|
return Te(
|
|
574
574
|
{
|
|
575
575
|
...e,
|
|
576
|
-
queryFn: (a) => new Promise((
|
|
576
|
+
queryFn: (a) => new Promise((i, s) => {
|
|
577
577
|
const o = () => _(
|
|
578
578
|
() => typeof e.queryFn == "function" ? e.queryFn(a) : e.queryFn
|
|
579
|
-
),
|
|
580
|
-
|
|
579
|
+
), l = oe(a.queryKey), y = n.getQuery(l), f = y ?? n.setQuery(a.queryKey, o(), a.signal), g = () => {
|
|
580
|
+
(f == null ? void 0 : f.isCompleted) === !1 && setTimeout(() => {
|
|
581
|
+
r == null || r.refetchQueries({
|
|
582
|
+
queryKey: a.queryKey,
|
|
583
|
+
exact: !0
|
|
584
|
+
});
|
|
585
|
+
});
|
|
586
|
+
};
|
|
587
|
+
if (!y && f.lastData !== void 0) {
|
|
588
|
+
i(f.lastData.value), g();
|
|
589
|
+
return;
|
|
590
|
+
}
|
|
591
|
+
f.query$.pipe(
|
|
581
592
|
ue(1),
|
|
582
593
|
/**
|
|
583
594
|
* If several values are emitted during this delay, we will only
|
|
@@ -586,22 +597,17 @@ function xt(e, t) {
|
|
|
586
597
|
*/
|
|
587
598
|
$e(1)
|
|
588
599
|
).subscribe({
|
|
589
|
-
error: (
|
|
600
|
+
error: (d) => s(d),
|
|
590
601
|
complete: () => {
|
|
591
|
-
if ((
|
|
592
|
-
return
|
|
593
|
-
`cancelled due to stream completing without data for query ${
|
|
594
|
-
|
|
602
|
+
if ((f == null ? void 0 : f.lastData) === void 0)
|
|
603
|
+
return f.signal.aborted || (console.log(
|
|
604
|
+
`cancelled due to stream completing without data for query ${l}`,
|
|
605
|
+
f == null ? void 0 : f.lastData
|
|
595
606
|
), r.cancelQueries({
|
|
596
607
|
queryKey: a.queryKey,
|
|
597
608
|
exact: !0
|
|
598
|
-
})),
|
|
599
|
-
|
|
600
|
-
r == null || r.refetchQueries({
|
|
601
|
-
queryKey: a.queryKey,
|
|
602
|
-
exact: !0
|
|
603
|
-
});
|
|
604
|
-
});
|
|
609
|
+
})), i(void 0);
|
|
610
|
+
i(f.lastData.value), g();
|
|
605
611
|
}
|
|
606
612
|
});
|
|
607
613
|
})
|
|
@@ -622,35 +628,35 @@ function pe(e, t) {
|
|
|
622
628
|
{
|
|
623
629
|
...e,
|
|
624
630
|
mutationFn: (o) => {
|
|
625
|
-
let
|
|
626
|
-
return new Promise((
|
|
631
|
+
let l;
|
|
632
|
+
return new Promise((y, f) => {
|
|
627
633
|
(typeof e.mutationFn == "function" ? e.mutationFn(o) : e.mutationFn).pipe(ue(1)).subscribe({
|
|
628
634
|
next: (m) => {
|
|
629
|
-
|
|
635
|
+
l = { value: m };
|
|
630
636
|
},
|
|
631
637
|
error: (m) => {
|
|
632
|
-
|
|
638
|
+
f(m);
|
|
633
639
|
},
|
|
634
640
|
complete: () => {
|
|
635
|
-
if (
|
|
636
|
-
return
|
|
637
|
-
|
|
641
|
+
if (l === void 0)
|
|
642
|
+
return f(new Error("Stream completed without any data"));
|
|
643
|
+
y(l.value);
|
|
638
644
|
}
|
|
639
645
|
});
|
|
640
646
|
});
|
|
641
647
|
}
|
|
642
648
|
},
|
|
643
649
|
t
|
|
644
|
-
), { status: u, isPending: c, isError: a, isSuccess:
|
|
650
|
+
), { status: u, isPending: c, isError: a, isSuccess: i, isIdle: s } = n;
|
|
645
651
|
return v(() => {
|
|
646
652
|
r.next({
|
|
647
653
|
status: u,
|
|
648
654
|
isPending: c,
|
|
649
655
|
isError: a,
|
|
650
|
-
isSuccess:
|
|
656
|
+
isSuccess: i,
|
|
651
657
|
isIdle: s
|
|
652
658
|
});
|
|
653
|
-
}, [u, c, a,
|
|
659
|
+
}, [u, c, a, i, s, r]), { ...n, state$: r };
|
|
654
660
|
}
|
|
655
661
|
class X extends Error {
|
|
656
662
|
constructor(t = "Mutation canceled") {
|
|
@@ -664,32 +670,32 @@ function Vt(e, t) {
|
|
|
664
670
|
mutationFn: ({ variables: s, abort: o }) => {
|
|
665
671
|
if (o.aborted)
|
|
666
672
|
throw new X();
|
|
667
|
-
const
|
|
673
|
+
const l = typeof e.mutationFn == "function" ? e.mutationFn(s) : e.mutationFn;
|
|
668
674
|
return M(
|
|
669
|
-
|
|
675
|
+
l,
|
|
670
676
|
se(o, "abort").pipe(
|
|
671
677
|
k(() => {
|
|
672
678
|
throw new X();
|
|
673
679
|
}),
|
|
674
680
|
Re()
|
|
675
681
|
)
|
|
676
|
-
).pipe(ae(),
|
|
682
|
+
).pipe(ae(), Ae(null));
|
|
677
683
|
},
|
|
678
684
|
onMutate: ({ variables: s }) => {
|
|
679
685
|
var o;
|
|
680
686
|
return (o = e.onMutate) == null ? void 0 : o.call(e, s);
|
|
681
687
|
},
|
|
682
|
-
onSuccess: (s, { variables: o },
|
|
683
|
-
var
|
|
684
|
-
return (
|
|
688
|
+
onSuccess: (s, { variables: o }, l) => {
|
|
689
|
+
var y;
|
|
690
|
+
return (y = e.onSuccess) == null ? void 0 : y.call(e, s, o, l);
|
|
685
691
|
},
|
|
686
|
-
onError: (s, { variables: o }, ...
|
|
687
|
-
var
|
|
688
|
-
return (
|
|
692
|
+
onError: (s, { variables: o }, ...l) => {
|
|
693
|
+
var y;
|
|
694
|
+
return (y = e.onError) == null ? void 0 : y.call(e, s, o, ...l);
|
|
689
695
|
},
|
|
690
|
-
onSettled: (s, o, { variables:
|
|
691
|
-
var
|
|
692
|
-
return (
|
|
696
|
+
onSettled: (s, o, { variables: l }, y) => {
|
|
697
|
+
var f;
|
|
698
|
+
return (f = e.onSettled) == null ? void 0 : f.call(e, s, o, l, y);
|
|
693
699
|
}
|
|
694
700
|
},
|
|
695
701
|
t
|
|
@@ -699,14 +705,14 @@ function Vt(e, t) {
|
|
|
699
705
|
abort: r.current.signal
|
|
700
706
|
})),
|
|
701
707
|
[n]
|
|
702
|
-
),
|
|
708
|
+
), i = h(
|
|
703
709
|
(s) => (r.current.abort(), r.current = new AbortController(), u({
|
|
704
710
|
variables: s,
|
|
705
711
|
abort: r.current.signal
|
|
706
712
|
})),
|
|
707
713
|
[u]
|
|
708
714
|
);
|
|
709
|
-
return { ...c, mutate: a, mutateAsync:
|
|
715
|
+
return { ...c, mutate: a, mutateAsync: i };
|
|
710
716
|
}
|
|
711
717
|
function Mt(e, t) {
|
|
712
718
|
const r = ie(t), n = e.mutationKey, { mutateAsync: u, ...c } = pe(
|
|
@@ -716,24 +722,24 @@ function Mt(e, t) {
|
|
|
716
722
|
var o;
|
|
717
723
|
return (o = e.onMutate) == null ? void 0 : o.call(e, s);
|
|
718
724
|
},
|
|
719
|
-
onSuccess(s, o,
|
|
720
|
-
var
|
|
721
|
-
return (
|
|
725
|
+
onSuccess(s, o, l) {
|
|
726
|
+
var y;
|
|
727
|
+
return (y = e.onSuccess) == null ? void 0 : y.call(e, s, o.variables, l);
|
|
722
728
|
},
|
|
723
|
-
onError(s, o,
|
|
724
|
-
var
|
|
725
|
-
return (
|
|
729
|
+
onError(s, o, l) {
|
|
730
|
+
var y;
|
|
731
|
+
return (y = e.onError) == null ? void 0 : y.call(e, s, o.variables, l);
|
|
726
732
|
},
|
|
727
|
-
onSettled(s, o,
|
|
728
|
-
var
|
|
729
|
-
return (
|
|
733
|
+
onSettled(s, o, l, y) {
|
|
734
|
+
var f;
|
|
735
|
+
return (f = e.onSettled) == null ? void 0 : f.call(e, s, o, l.variables, y);
|
|
730
736
|
},
|
|
731
737
|
mutationFn: ({ ready$: s, variables: o }) => {
|
|
732
|
-
const
|
|
738
|
+
const l = typeof e.mutationFn == "function" ? e.mutationFn(o) : e.mutationFn;
|
|
733
739
|
return s.pipe(
|
|
734
|
-
|
|
740
|
+
Pe((y) => y),
|
|
735
741
|
ae(),
|
|
736
|
-
C(() =>
|
|
742
|
+
C(() => l)
|
|
737
743
|
);
|
|
738
744
|
}
|
|
739
745
|
},
|
|
@@ -743,21 +749,21 @@ function Mt(e, t) {
|
|
|
743
749
|
const o = r.getMutationCache().findAll({
|
|
744
750
|
mutationKey: n,
|
|
745
751
|
exact: !0
|
|
746
|
-
}),
|
|
752
|
+
}), l = new E(!1), y = u({ variables: s, ready$: l });
|
|
747
753
|
return await Promise.all(
|
|
748
|
-
o.map((
|
|
749
|
-
),
|
|
750
|
-
|
|
754
|
+
o.map((f) => f.continue().catch(j))
|
|
755
|
+
), l.next(!0), await y.finally(() => {
|
|
756
|
+
l.complete();
|
|
751
757
|
});
|
|
752
758
|
},
|
|
753
759
|
[u, r, n]
|
|
754
|
-
),
|
|
760
|
+
), i = h(
|
|
755
761
|
(s) => {
|
|
756
762
|
a(s).catch(j);
|
|
757
763
|
},
|
|
758
764
|
[a]
|
|
759
765
|
);
|
|
760
|
-
return { ...c, mutate:
|
|
766
|
+
return { ...c, mutate: i, mutateAsync: a };
|
|
761
767
|
}
|
|
762
768
|
export {
|
|
763
769
|
ge as Context,
|
|
@@ -768,10 +774,10 @@ export {
|
|
|
768
774
|
ht as SignalContextProvider,
|
|
769
775
|
ye as SignalReactContext,
|
|
770
776
|
X as SwitchMutationCancelError,
|
|
771
|
-
|
|
777
|
+
D as VirtualSignal,
|
|
772
778
|
pt as arrayEqual,
|
|
773
779
|
Ue as createLocalStorageAdapter,
|
|
774
|
-
|
|
780
|
+
It as createLocalforageAdapter,
|
|
775
781
|
Le as exponentialBackoffDelay,
|
|
776
782
|
ze as getDelay,
|
|
777
783
|
gt as isDefined,
|
|
@@ -789,7 +795,7 @@ export {
|
|
|
789
795
|
pe as useMutation$,
|
|
790
796
|
ot as useObservableState,
|
|
791
797
|
le as useObserve,
|
|
792
|
-
|
|
798
|
+
wt as usePersistSignals,
|
|
793
799
|
xt as useQuery$,
|
|
794
800
|
tt as useQueryClient$,
|
|
795
801
|
Ye as useSetSignal,
|