mhz-helpers 1.3.6 → 1.3.9
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/api/index.js +1 -1
- package/dist/query/index.js +198 -210
- package/package.json +13 -13
package/dist/api/index.js
CHANGED
|
@@ -1395,7 +1395,7 @@ function $e(e) {
|
|
|
1395
1395
|
), r.response.headers = T.from(r.response.headers))), Promise.reject(r);
|
|
1396
1396
|
});
|
|
1397
1397
|
}
|
|
1398
|
-
const ft = "1.13.
|
|
1398
|
+
const ft = "1.13.2", ae = {};
|
|
1399
1399
|
["object", "boolean", "number", "function", "string", "symbol"].forEach((e, t) => {
|
|
1400
1400
|
ae[e] = function(r) {
|
|
1401
1401
|
return typeof r === e || "a" + (t < 1 ? "n " : " ") + e;
|
package/dist/query/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { isRef as
|
|
2
|
-
import { logout as
|
|
3
|
-
import { handleError as ce, deleteAuthHeader as
|
|
1
|
+
import { isRef as Ee, unref as ze, hasInjectionContext as Ye, inject as Je, ref as Xe, nextTick as Ze, getCurrentScope as Qe, computed as Ae, shallowReactive as Re, reactive as Pe, watch as k, onScopeDispose as Ie, shallowReadonly as Te, readonly as De, toRefs as Fe } from "vue";
|
|
2
|
+
import { logout as et } from "../useAuth/index.js";
|
|
3
|
+
import { handleError as ce, deleteAuthHeader as tt } from "../api/index.js";
|
|
4
4
|
var N = class {
|
|
5
5
|
constructor() {
|
|
6
6
|
this.listeners = /* @__PURE__ */ new Set(), this.subscribe = this.subscribe.bind(this);
|
|
@@ -17,7 +17,7 @@ var N = class {
|
|
|
17
17
|
}
|
|
18
18
|
onUnsubscribe() {
|
|
19
19
|
}
|
|
20
|
-
},
|
|
20
|
+
}, st = {
|
|
21
21
|
// We need the wrapper function syntax below instead of direct references to
|
|
22
22
|
// global setTimeout etc.
|
|
23
23
|
//
|
|
@@ -32,14 +32,14 @@ var N = class {
|
|
|
32
32
|
clearTimeout: (e) => clearTimeout(e),
|
|
33
33
|
setInterval: (e, t) => setInterval(e, t),
|
|
34
34
|
clearInterval: (e) => clearInterval(e)
|
|
35
|
-
},
|
|
35
|
+
}, rt = class {
|
|
36
36
|
// We cannot have TimeoutManager<T> as we must instantiate it with a concrete
|
|
37
37
|
// type at app boot; and if we leave that type, then any new timer provider
|
|
38
38
|
// would need to support ReturnType<typeof setTimeout>, which is infeasible.
|
|
39
39
|
//
|
|
40
40
|
// We settle for type safety for the TimeoutProvider type, and accept that
|
|
41
41
|
// this class is unsafe internally to allow for extension.
|
|
42
|
-
#e =
|
|
42
|
+
#e = st;
|
|
43
43
|
#t = !1;
|
|
44
44
|
setTimeoutProvider(e) {
|
|
45
45
|
process.env.NODE_ENV !== "production" && this.#t && e !== this.#e && console.error(
|
|
@@ -59,20 +59,20 @@ var N = class {
|
|
|
59
59
|
clearInterval(e) {
|
|
60
60
|
this.#e.clearInterval(e);
|
|
61
61
|
}
|
|
62
|
-
},
|
|
63
|
-
function
|
|
62
|
+
}, D = new rt();
|
|
63
|
+
function it(e) {
|
|
64
64
|
setTimeout(e, 0);
|
|
65
65
|
}
|
|
66
66
|
var M = typeof window > "u" || "Deno" in globalThis;
|
|
67
67
|
function w() {
|
|
68
68
|
}
|
|
69
|
-
function
|
|
69
|
+
function nt(e, t) {
|
|
70
70
|
return typeof e == "function" ? e(t) : e;
|
|
71
71
|
}
|
|
72
72
|
function z(e) {
|
|
73
73
|
return typeof e == "number" && e >= 0 && e !== 1 / 0;
|
|
74
74
|
}
|
|
75
|
-
function
|
|
75
|
+
function Me(e, t) {
|
|
76
76
|
return Math.max(e + (t || 0) - Date.now(), 0);
|
|
77
77
|
}
|
|
78
78
|
function P(e, t) {
|
|
@@ -129,7 +129,7 @@ function U(e) {
|
|
|
129
129
|
function j(e, t) {
|
|
130
130
|
return e === t ? !0 : typeof e != typeof t ? !1 : e && t && typeof e == "object" && typeof t == "object" ? Object.keys(t).every((s) => j(e[s], t[s])) : !1;
|
|
131
131
|
}
|
|
132
|
-
var
|
|
132
|
+
var at = Object.prototype.hasOwnProperty;
|
|
133
133
|
function Y(e, t) {
|
|
134
134
|
if (e === t)
|
|
135
135
|
return e;
|
|
@@ -140,7 +140,7 @@ function Y(e, t) {
|
|
|
140
140
|
for (let d = 0; d < a; d++) {
|
|
141
141
|
const c = s ? d : n[d], l = e[c], f = t[c];
|
|
142
142
|
if (l === f) {
|
|
143
|
-
o[c] = l, (s ? d < i :
|
|
143
|
+
o[c] = l, (s ? d < i : at.call(e, c)) && u++;
|
|
144
144
|
continue;
|
|
145
145
|
}
|
|
146
146
|
if (l === null || f === null || typeof l != "object" || typeof f != "object") {
|
|
@@ -175,9 +175,9 @@ function J(e) {
|
|
|
175
175
|
function de(e) {
|
|
176
176
|
return Object.prototype.toString.call(e) === "[object Object]";
|
|
177
177
|
}
|
|
178
|
-
function
|
|
178
|
+
function ot(e) {
|
|
179
179
|
return new Promise((t) => {
|
|
180
|
-
|
|
180
|
+
D.setTimeout(t, e);
|
|
181
181
|
});
|
|
182
182
|
}
|
|
183
183
|
function X(e, t, s) {
|
|
@@ -196,16 +196,16 @@ function X(e, t, s) {
|
|
|
196
196
|
}
|
|
197
197
|
return t;
|
|
198
198
|
}
|
|
199
|
-
function
|
|
199
|
+
function ut(e, t, s = 0) {
|
|
200
200
|
const r = [...e, t];
|
|
201
201
|
return s && r.length > s ? r.slice(1) : r;
|
|
202
202
|
}
|
|
203
|
-
function
|
|
203
|
+
function ct(e, t, s = 0) {
|
|
204
204
|
const r = [t, ...e];
|
|
205
205
|
return s && r.length > s ? r.slice(0, -1) : r;
|
|
206
206
|
}
|
|
207
207
|
var G = Symbol();
|
|
208
|
-
function
|
|
208
|
+
function Ue(e, t) {
|
|
209
209
|
return process.env.NODE_ENV !== "production" && e.queryFn === G && console.error(
|
|
210
210
|
`Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${e.queryHash}'`
|
|
211
211
|
), !e.queryFn && t?.initialPromise ? () => t.initialPromise : !e.queryFn || e.queryFn === G ? () => Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)) : e.queryFn;
|
|
@@ -213,7 +213,7 @@ function Me(e, t) {
|
|
|
213
213
|
function Z(e, t) {
|
|
214
214
|
return typeof e == "function" ? e(...t) : !!e;
|
|
215
215
|
}
|
|
216
|
-
var
|
|
216
|
+
var ht = class extends N {
|
|
217
217
|
#e;
|
|
218
218
|
#t;
|
|
219
219
|
#s;
|
|
@@ -250,7 +250,7 @@ var ct = class extends N {
|
|
|
250
250
|
isFocused() {
|
|
251
251
|
return typeof this.#e == "boolean" ? this.#e : globalThis.document?.visibilityState !== "hidden";
|
|
252
252
|
}
|
|
253
|
-
}, oe = new
|
|
253
|
+
}, oe = new ht();
|
|
254
254
|
function ee() {
|
|
255
255
|
let e, t;
|
|
256
256
|
const s = new Promise((i, n) => {
|
|
@@ -273,13 +273,13 @@ function ee() {
|
|
|
273
273
|
}), t(i);
|
|
274
274
|
}, s;
|
|
275
275
|
}
|
|
276
|
-
var
|
|
277
|
-
function
|
|
276
|
+
var lt = it;
|
|
277
|
+
function ft() {
|
|
278
278
|
let e = [], t = 0, s = (o) => {
|
|
279
279
|
o();
|
|
280
280
|
}, r = (o) => {
|
|
281
281
|
o();
|
|
282
|
-
}, i =
|
|
282
|
+
}, i = lt;
|
|
283
283
|
const n = (o) => {
|
|
284
284
|
t ? e.push(o) : i(() => {
|
|
285
285
|
s(o);
|
|
@@ -333,7 +333,7 @@ function lt() {
|
|
|
333
333
|
}
|
|
334
334
|
};
|
|
335
335
|
}
|
|
336
|
-
var b =
|
|
336
|
+
var b = ft(), dt = class extends N {
|
|
337
337
|
#e = !0;
|
|
338
338
|
#t;
|
|
339
339
|
#s;
|
|
@@ -364,11 +364,11 @@ var b = lt(), ft = class extends N {
|
|
|
364
364
|
isOnline() {
|
|
365
365
|
return this.#e;
|
|
366
366
|
}
|
|
367
|
-
}, x = new
|
|
368
|
-
function
|
|
367
|
+
}, x = new dt();
|
|
368
|
+
function pt(e) {
|
|
369
369
|
return Math.min(1e3 * 2 ** e, 3e4);
|
|
370
370
|
}
|
|
371
|
-
function
|
|
371
|
+
function qe(e) {
|
|
372
372
|
return (e ?? "online") === "online" ? x.isOnline() : !0;
|
|
373
373
|
}
|
|
374
374
|
var te = class extends Error {
|
|
@@ -376,7 +376,7 @@ var te = class extends Error {
|
|
|
376
376
|
super("CancelledError"), this.revert = e?.revert, this.silent = e?.silent;
|
|
377
377
|
}
|
|
378
378
|
};
|
|
379
|
-
function
|
|
379
|
+
function _e(e) {
|
|
380
380
|
let t = !1, s = 0, r;
|
|
381
381
|
const i = ee(), n = () => i.status !== "pending", a = (y) => {
|
|
382
382
|
if (!n()) {
|
|
@@ -387,7 +387,7 @@ function qe(e) {
|
|
|
387
387
|
t = !0;
|
|
388
388
|
}, u = () => {
|
|
389
389
|
t = !1;
|
|
390
|
-
}, d = () => oe.isFocused() && (e.networkMode === "always" || x.isOnline()) && e.canRun(), c = () =>
|
|
390
|
+
}, d = () => oe.isFocused() && (e.networkMode === "always" || x.isOnline()) && e.canRun(), c = () => qe(e.networkMode) && e.canRun(), l = (y) => {
|
|
391
391
|
n() || (r?.(), i.resolve(y));
|
|
392
392
|
}, f = (y) => {
|
|
393
393
|
n() || (r?.(), i.reject(y));
|
|
@@ -410,12 +410,12 @@ function qe(e) {
|
|
|
410
410
|
Promise.resolve(y).then(l).catch((v) => {
|
|
411
411
|
if (n())
|
|
412
412
|
return;
|
|
413
|
-
const O = e.retry ?? (M ? 0 : 3), A = e.retryDelay ??
|
|
414
|
-
if (t || !
|
|
413
|
+
const O = e.retry ?? (M ? 0 : 3), A = e.retryDelay ?? pt, I = typeof A == "function" ? A(s, v) : A, T = O === !0 || typeof O == "number" && s < O || typeof O == "function" && O(s, v);
|
|
414
|
+
if (t || !T) {
|
|
415
415
|
f(v);
|
|
416
416
|
return;
|
|
417
417
|
}
|
|
418
|
-
s++, e.onFail?.(s, v),
|
|
418
|
+
s++, e.onFail?.(s, v), ot(I).then(() => d() ? void 0 : p()).then(() => {
|
|
419
419
|
t ? f(v) : g();
|
|
420
420
|
});
|
|
421
421
|
});
|
|
@@ -431,13 +431,13 @@ function qe(e) {
|
|
|
431
431
|
start: () => (c() ? g() : p().then(g), i)
|
|
432
432
|
};
|
|
433
433
|
}
|
|
434
|
-
var
|
|
434
|
+
var ke = class {
|
|
435
435
|
#e;
|
|
436
436
|
destroy() {
|
|
437
437
|
this.clearGcTimeout();
|
|
438
438
|
}
|
|
439
439
|
scheduleGc() {
|
|
440
|
-
this.clearGcTimeout(), z(this.gcTime) && (this.#e =
|
|
440
|
+
this.clearGcTimeout(), z(this.gcTime) && (this.#e = D.setTimeout(() => {
|
|
441
441
|
this.optionalRemove();
|
|
442
442
|
}, this.gcTime));
|
|
443
443
|
}
|
|
@@ -448,9 +448,9 @@ var _e = class {
|
|
|
448
448
|
);
|
|
449
449
|
}
|
|
450
450
|
clearGcTimeout() {
|
|
451
|
-
this.#e && (
|
|
451
|
+
this.#e && (D.clearTimeout(this.#e), this.#e = void 0);
|
|
452
452
|
}
|
|
453
|
-
},
|
|
453
|
+
}, yt = class extends ke {
|
|
454
454
|
#e;
|
|
455
455
|
#t;
|
|
456
456
|
#s;
|
|
@@ -459,7 +459,7 @@ var _e = class {
|
|
|
459
459
|
#a;
|
|
460
460
|
#o;
|
|
461
461
|
constructor(e) {
|
|
462
|
-
super(), this.#o = !1, this.#a = e.defaultOptions, this.setOptions(e.options), this.observers = [], this.#i = e.client, this.#s = this.#i.getQueryCache(), this.queryKey = e.queryKey, this.queryHash = e.queryHash, this.#e =
|
|
462
|
+
super(), this.#o = !1, this.#a = e.defaultOptions, this.setOptions(e.options), this.observers = [], this.#i = e.client, this.#s = this.#i.getQueryCache(), this.queryKey = e.queryKey, this.queryHash = e.queryHash, this.#e = ye(this.options), this.state = e.state ?? this.#e, this.scheduleGc();
|
|
463
463
|
}
|
|
464
464
|
get meta() {
|
|
465
465
|
return this.options.meta;
|
|
@@ -469,11 +469,10 @@ var _e = class {
|
|
|
469
469
|
}
|
|
470
470
|
setOptions(e) {
|
|
471
471
|
if (this.options = { ...this.#a, ...e }, this.updateGcTime(this.options.gcTime), this.state && this.state.data === void 0) {
|
|
472
|
-
const t =
|
|
473
|
-
t.data !== void 0 && (this.
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
}), this.#e = t);
|
|
472
|
+
const t = ye(this.options);
|
|
473
|
+
t.data !== void 0 && (this.setState(
|
|
474
|
+
pe(t.data, t.dataUpdatedAt)
|
|
475
|
+
), this.#e = t);
|
|
477
476
|
}
|
|
478
477
|
}
|
|
479
478
|
optionalRemove() {
|
|
@@ -520,7 +519,7 @@ var _e = class {
|
|
|
520
519
|
) : this.state.data === void 0 || this.state.isInvalidated;
|
|
521
520
|
}
|
|
522
521
|
isStaleByTime(e = 0) {
|
|
523
|
-
return this.state.data === void 0 ? !0 : e === "static" ? !1 : this.state.isInvalidated ? !0 : !
|
|
522
|
+
return this.state.data === void 0 ? !0 : e === "static" ? !1 : this.state.isInvalidated ? !0 : !Me(this.state.dataUpdatedAt, e);
|
|
524
523
|
}
|
|
525
524
|
onFocus() {
|
|
526
525
|
this.observers.find((t) => t.shouldFetchOnWindowFocus())?.refetch({ cancelRefetch: !1 }), this.#r?.continue();
|
|
@@ -563,7 +562,7 @@ var _e = class {
|
|
|
563
562
|
get: () => (this.#o = !0, s.signal)
|
|
564
563
|
});
|
|
565
564
|
}, i = () => {
|
|
566
|
-
const o =
|
|
565
|
+
const o = Ue(this.options, t), d = (() => {
|
|
567
566
|
const c = {
|
|
568
567
|
client: this.#i,
|
|
569
568
|
queryKey: this.queryKey,
|
|
@@ -587,7 +586,7 @@ var _e = class {
|
|
|
587
586
|
};
|
|
588
587
|
return r(o), o;
|
|
589
588
|
})();
|
|
590
|
-
this.options.behavior?.onFetch(a, this), this.#t = this.state, (this.state.fetchStatus === "idle" || this.state.fetchMeta !== a.fetchOptions?.meta) && this.#n({ type: "fetch", meta: a.fetchOptions?.meta }), this.#r =
|
|
589
|
+
this.options.behavior?.onFetch(a, this), this.#t = this.state, (this.state.fetchStatus === "idle" || this.state.fetchMeta !== a.fetchOptions?.meta) && this.#n({ type: "fetch", meta: a.fetchOptions?.meta }), this.#r = _e({
|
|
591
590
|
initialPromise: t?.initialPromise,
|
|
592
591
|
fn: a.fetchFn,
|
|
593
592
|
onCancel: (o) => {
|
|
@@ -668,18 +667,14 @@ var _e = class {
|
|
|
668
667
|
case "fetch":
|
|
669
668
|
return {
|
|
670
669
|
...s,
|
|
671
|
-
...
|
|
670
|
+
...xe(s.data, this.options),
|
|
672
671
|
fetchMeta: e.meta ?? null
|
|
673
672
|
};
|
|
674
673
|
case "success":
|
|
675
674
|
const r = {
|
|
676
675
|
...s,
|
|
677
|
-
data
|
|
676
|
+
...pe(e.data, e.dataUpdatedAt),
|
|
678
677
|
dataUpdateCount: s.dataUpdateCount + 1,
|
|
679
|
-
dataUpdatedAt: e.dataUpdatedAt ?? Date.now(),
|
|
680
|
-
error: null,
|
|
681
|
-
isInvalidated: !1,
|
|
682
|
-
status: "success",
|
|
683
678
|
...!e.manual && {
|
|
684
679
|
fetchStatus: "idle",
|
|
685
680
|
fetchFailureCount: 0,
|
|
@@ -718,18 +713,27 @@ var _e = class {
|
|
|
718
713
|
});
|
|
719
714
|
}
|
|
720
715
|
};
|
|
721
|
-
function
|
|
716
|
+
function xe(e, t) {
|
|
722
717
|
return {
|
|
723
718
|
fetchFailureCount: 0,
|
|
724
719
|
fetchFailureReason: null,
|
|
725
|
-
fetchStatus:
|
|
720
|
+
fetchStatus: qe(t.networkMode) ? "fetching" : "paused",
|
|
726
721
|
...e === void 0 && {
|
|
727
722
|
error: null,
|
|
728
723
|
status: "pending"
|
|
729
724
|
}
|
|
730
725
|
};
|
|
731
726
|
}
|
|
732
|
-
function pe(e) {
|
|
727
|
+
function pe(e, t) {
|
|
728
|
+
return {
|
|
729
|
+
data: e,
|
|
730
|
+
dataUpdatedAt: t ?? Date.now(),
|
|
731
|
+
error: null,
|
|
732
|
+
isInvalidated: !1,
|
|
733
|
+
status: "success"
|
|
734
|
+
};
|
|
735
|
+
}
|
|
736
|
+
function ye(e) {
|
|
733
737
|
const t = typeof e.initialData == "function" ? e.initialData() : e.initialData, s = t !== void 0, r = s ? typeof e.initialDataUpdatedAt == "function" ? e.initialDataUpdatedAt() : e.initialDataUpdatedAt : 0;
|
|
734
738
|
return {
|
|
735
739
|
data: t,
|
|
@@ -746,7 +750,7 @@ function pe(e) {
|
|
|
746
750
|
fetchStatus: "idle"
|
|
747
751
|
};
|
|
748
752
|
}
|
|
749
|
-
var
|
|
753
|
+
var gt = class extends N {
|
|
750
754
|
constructor(e, t) {
|
|
751
755
|
super(), this.options = t, this.#e = e, this.#n = null, this.#o = ee(), this.bindMethods(), this.setOptions(t);
|
|
752
756
|
}
|
|
@@ -771,7 +775,7 @@ var yt = class extends N {
|
|
|
771
775
|
this.refetch = this.refetch.bind(this);
|
|
772
776
|
}
|
|
773
777
|
onSubscribe() {
|
|
774
|
-
this.listeners.size === 1 && (this.#t.addObserver(this),
|
|
778
|
+
this.listeners.size === 1 && (this.#t.addObserver(this), ge(this.#t, this.options) ? this.#l() : this.updateResult(), this.#b());
|
|
775
779
|
}
|
|
776
780
|
onUnsubscribe() {
|
|
777
781
|
this.hasListeners() || this.destroy();
|
|
@@ -805,7 +809,7 @@ var yt = class extends N {
|
|
|
805
809
|
observer: this
|
|
806
810
|
});
|
|
807
811
|
const r = this.hasListeners();
|
|
808
|
-
r &&
|
|
812
|
+
r && me(
|
|
809
813
|
this.#t,
|
|
810
814
|
s,
|
|
811
815
|
this.options,
|
|
@@ -816,7 +820,7 @@ var yt = class extends N {
|
|
|
816
820
|
}
|
|
817
821
|
getOptimisticResult(e) {
|
|
818
822
|
const t = this.#e.getQueryCache().build(this.#e, e), s = this.createResult(t, e);
|
|
819
|
-
return
|
|
823
|
+
return vt(this, s) && (this.#i = s, this.#a = this.options, this.#r = this.#t.state), s;
|
|
820
824
|
}
|
|
821
825
|
getCurrentResult() {
|
|
822
826
|
return this.#i;
|
|
@@ -867,8 +871,8 @@ var yt = class extends N {
|
|
|
867
871
|
);
|
|
868
872
|
if (M || this.#i.isStale || !z(e))
|
|
869
873
|
return;
|
|
870
|
-
const s =
|
|
871
|
-
this.#c =
|
|
874
|
+
const s = Me(this.#i.dataUpdatedAt, e) + 1;
|
|
875
|
+
this.#c = D.setTimeout(() => {
|
|
872
876
|
this.#i.isStale || this.updateResult();
|
|
873
877
|
}, s);
|
|
874
878
|
}
|
|
@@ -876,7 +880,7 @@ var yt = class extends N {
|
|
|
876
880
|
return (typeof this.options.refetchInterval == "function" ? this.options.refetchInterval(this.#t) : this.options.refetchInterval) ?? !1;
|
|
877
881
|
}
|
|
878
882
|
#v(e) {
|
|
879
|
-
this.#S(), this.#u = e, !(M || E(this.options.enabled, this.#t) === !1 || !z(this.#u) || this.#u === 0) && (this.#h =
|
|
883
|
+
this.#S(), this.#u = e, !(M || E(this.options.enabled, this.#t) === !1 || !z(this.#u) || this.#u === 0) && (this.#h = D.setInterval(() => {
|
|
880
884
|
(this.options.refetchIntervalInBackground || oe.isFocused()) && this.#l();
|
|
881
885
|
}, this.#u));
|
|
882
886
|
}
|
|
@@ -884,19 +888,19 @@ var yt = class extends N {
|
|
|
884
888
|
this.#g(), this.#v(this.#m());
|
|
885
889
|
}
|
|
886
890
|
#O() {
|
|
887
|
-
this.#c && (
|
|
891
|
+
this.#c && (D.clearTimeout(this.#c), this.#c = void 0);
|
|
888
892
|
}
|
|
889
893
|
#S() {
|
|
890
|
-
this.#h && (
|
|
894
|
+
this.#h && (D.clearInterval(this.#h), this.#h = void 0);
|
|
891
895
|
}
|
|
892
896
|
createResult(e, t) {
|
|
893
897
|
const s = this.#t, r = this.options, i = this.#i, n = this.#r, a = this.#a, u = e !== s ? e.state : this.#s, { state: d } = e;
|
|
894
898
|
let c = { ...d }, l = !1, f;
|
|
895
899
|
if (t._optimisticResults) {
|
|
896
|
-
const C = this.hasListeners(), H = !C &&
|
|
900
|
+
const C = this.hasListeners(), H = !C && ge(e, t), q = C && me(e, s, t, r);
|
|
897
901
|
(H || q) && (c = {
|
|
898
902
|
...c,
|
|
899
|
-
...
|
|
903
|
+
...xe(d.data, e.options)
|
|
900
904
|
}), t._optimisticResults === "isRestoring" && (c.fetchStatus = "idle");
|
|
901
905
|
}
|
|
902
906
|
let { error: p, errorUpdatedAt: g, status: y } = c;
|
|
@@ -923,7 +927,7 @@ var yt = class extends N {
|
|
|
923
927
|
this.#n = C;
|
|
924
928
|
}
|
|
925
929
|
this.#n && (p = this.#n, f = this.#f, g = Date.now(), y = "error");
|
|
926
|
-
const v = c.fetchStatus === "fetching", O = y === "pending", A = y === "error", I = O && v,
|
|
930
|
+
const v = c.fetchStatus === "fetching", O = y === "pending", A = y === "error", I = O && v, T = f !== void 0, Q = {
|
|
927
931
|
status: y,
|
|
928
932
|
fetchStatus: c.fetchStatus,
|
|
929
933
|
isPending: O,
|
|
@@ -942,10 +946,10 @@ var yt = class extends N {
|
|
|
942
946
|
isFetchedAfterMount: c.dataUpdateCount > u.dataUpdateCount || c.errorUpdateCount > u.errorUpdateCount,
|
|
943
947
|
isFetching: v,
|
|
944
948
|
isRefetching: v && !O,
|
|
945
|
-
isLoadingError: A && !
|
|
949
|
+
isLoadingError: A && !T,
|
|
946
950
|
isPaused: c.fetchStatus === "paused",
|
|
947
951
|
isPlaceholderData: l,
|
|
948
|
-
isRefetchError: A &&
|
|
952
|
+
isRefetchError: A && T,
|
|
949
953
|
isStale: ue(e, t),
|
|
950
954
|
refetch: this.refetch,
|
|
951
955
|
promise: this.#o,
|
|
@@ -1014,11 +1018,11 @@ var yt = class extends N {
|
|
|
1014
1018
|
});
|
|
1015
1019
|
}
|
|
1016
1020
|
};
|
|
1017
|
-
function
|
|
1021
|
+
function mt(e, t) {
|
|
1018
1022
|
return E(t.enabled, e) !== !1 && e.state.data === void 0 && !(e.state.status === "error" && t.retryOnMount === !1);
|
|
1019
1023
|
}
|
|
1020
|
-
function
|
|
1021
|
-
return
|
|
1024
|
+
function ge(e, t) {
|
|
1025
|
+
return mt(e, t) || e.state.data !== void 0 && se(e, t, t.refetchOnMount);
|
|
1022
1026
|
}
|
|
1023
1027
|
function se(e, t, s) {
|
|
1024
1028
|
if (E(t.enabled, e) !== !1 && P(t.staleTime, e) !== "static") {
|
|
@@ -1027,16 +1031,16 @@ function se(e, t, s) {
|
|
|
1027
1031
|
}
|
|
1028
1032
|
return !1;
|
|
1029
1033
|
}
|
|
1030
|
-
function
|
|
1034
|
+
function me(e, t, s, r) {
|
|
1031
1035
|
return (e !== t || E(r.enabled, e) === !1) && (!s.suspense || e.state.status !== "error") && ue(e, s);
|
|
1032
1036
|
}
|
|
1033
1037
|
function ue(e, t) {
|
|
1034
1038
|
return E(t.enabled, e) !== !1 && e.isStaleByTime(P(t.staleTime, e));
|
|
1035
1039
|
}
|
|
1036
|
-
function
|
|
1040
|
+
function vt(e, t) {
|
|
1037
1041
|
return !K(e.getCurrentResult(), t);
|
|
1038
1042
|
}
|
|
1039
|
-
function
|
|
1043
|
+
function ve(e) {
|
|
1040
1044
|
return {
|
|
1041
1045
|
onFetch: (t, s) => {
|
|
1042
1046
|
const r = t.options, i = t.fetchOptions?.meta?.fetchMore?.direction, n = t.state.data?.pages || [], a = t.state.data?.pageParams || [];
|
|
@@ -1050,7 +1054,7 @@ function me(e) {
|
|
|
1050
1054
|
c = !0;
|
|
1051
1055
|
}), t.signal)
|
|
1052
1056
|
});
|
|
1053
|
-
}, f =
|
|
1057
|
+
}, f = Ue(t.options, t.fetchOptions), p = async (g, y, m) => {
|
|
1054
1058
|
if (c)
|
|
1055
1059
|
return Promise.reject();
|
|
1056
1060
|
if (y == null && g.pages.length)
|
|
@@ -1064,14 +1068,14 @@ function me(e) {
|
|
|
1064
1068
|
meta: t.options.meta
|
|
1065
1069
|
};
|
|
1066
1070
|
return l(W), W;
|
|
1067
|
-
})(), A = await f(O), { maxPages: I } = t.options,
|
|
1071
|
+
})(), A = await f(O), { maxPages: I } = t.options, T = m ? ct : ut;
|
|
1068
1072
|
return {
|
|
1069
|
-
pages:
|
|
1070
|
-
pageParams:
|
|
1073
|
+
pages: T(g.pages, A, I),
|
|
1074
|
+
pageParams: T(g.pageParams, y, I)
|
|
1071
1075
|
};
|
|
1072
1076
|
};
|
|
1073
1077
|
if (i && n.length) {
|
|
1074
|
-
const g = i === "backward", y = g ?
|
|
1078
|
+
const g = i === "backward", y = g ? bt : be, m = {
|
|
1075
1079
|
pages: n,
|
|
1076
1080
|
pageParams: a
|
|
1077
1081
|
}, v = y(r, m);
|
|
@@ -1079,7 +1083,7 @@ function me(e) {
|
|
|
1079
1083
|
} else {
|
|
1080
1084
|
const g = e ?? n.length;
|
|
1081
1085
|
do {
|
|
1082
|
-
const y = u === 0 ? a[0] ?? r.initialPageParam :
|
|
1086
|
+
const y = u === 0 ? a[0] ?? r.initialPageParam : be(r, o);
|
|
1083
1087
|
if (u > 0 && y == null)
|
|
1084
1088
|
break;
|
|
1085
1089
|
o = await p(o, y), u++;
|
|
@@ -1100,7 +1104,7 @@ function me(e) {
|
|
|
1100
1104
|
}
|
|
1101
1105
|
};
|
|
1102
1106
|
}
|
|
1103
|
-
function
|
|
1107
|
+
function be(e, { pages: t, pageParams: s }) {
|
|
1104
1108
|
const r = t.length - 1;
|
|
1105
1109
|
return t.length > 0 ? e.getNextPageParam(
|
|
1106
1110
|
t[r],
|
|
@@ -1109,16 +1113,16 @@ function ve(e, { pages: t, pageParams: s }) {
|
|
|
1109
1113
|
s
|
|
1110
1114
|
) : void 0;
|
|
1111
1115
|
}
|
|
1112
|
-
function
|
|
1116
|
+
function bt(e, { pages: t, pageParams: s }) {
|
|
1113
1117
|
return t.length > 0 ? e.getPreviousPageParam?.(t[0], t, s[0], s) : void 0;
|
|
1114
1118
|
}
|
|
1115
|
-
var
|
|
1119
|
+
var Ot = class extends ke {
|
|
1116
1120
|
#e;
|
|
1117
1121
|
#t;
|
|
1118
1122
|
#s;
|
|
1119
1123
|
#i;
|
|
1120
1124
|
constructor(e) {
|
|
1121
|
-
super(), this.#e = e.client, this.mutationId = e.mutationId, this.#s = e.mutationCache, this.#t = [], this.state = e.state ||
|
|
1125
|
+
super(), this.#e = e.client, this.mutationId = e.mutationId, this.#s = e.mutationCache, this.#t = [], this.state = e.state || Ne(), this.setOptions(e.options), this.scheduleGc();
|
|
1122
1126
|
}
|
|
1123
1127
|
setOptions(e) {
|
|
1124
1128
|
this.options = e, this.updateGcTime(this.options.gcTime);
|
|
@@ -1155,7 +1159,7 @@ var bt = class extends _e {
|
|
|
1155
1159
|
meta: this.options.meta,
|
|
1156
1160
|
mutationKey: this.options.mutationKey
|
|
1157
1161
|
};
|
|
1158
|
-
this.#i =
|
|
1162
|
+
this.#i = _e({
|
|
1159
1163
|
fn: () => this.options.mutationFn ? this.options.mutationFn(e, s) : Promise.reject(new Error("No mutationFn found")),
|
|
1160
1164
|
onFail: (n, a) => {
|
|
1161
1165
|
this.#r({ type: "failed", failureCount: n, error: a });
|
|
@@ -1315,7 +1319,7 @@ var bt = class extends _e {
|
|
|
1315
1319
|
});
|
|
1316
1320
|
}
|
|
1317
1321
|
};
|
|
1318
|
-
function
|
|
1322
|
+
function Ne() {
|
|
1319
1323
|
return {
|
|
1320
1324
|
context: void 0,
|
|
1321
1325
|
data: void 0,
|
|
@@ -1328,7 +1332,7 @@ function xe() {
|
|
|
1328
1332
|
submittedAt: 0
|
|
1329
1333
|
};
|
|
1330
1334
|
}
|
|
1331
|
-
var
|
|
1335
|
+
var je = class extends N {
|
|
1332
1336
|
constructor(t = {}) {
|
|
1333
1337
|
super(), this.config = t, this.#e = /* @__PURE__ */ new Set(), this.#t = /* @__PURE__ */ new Map(), this.#s = 0;
|
|
1334
1338
|
}
|
|
@@ -1336,7 +1340,7 @@ var Ne = class extends N {
|
|
|
1336
1340
|
#t;
|
|
1337
1341
|
#s;
|
|
1338
1342
|
build(t, s, r) {
|
|
1339
|
-
const i = new
|
|
1343
|
+
const i = new Ot({
|
|
1340
1344
|
client: t,
|
|
1341
1345
|
mutationCache: this,
|
|
1342
1346
|
mutationId: ++this.#s,
|
|
@@ -1420,7 +1424,7 @@ var Ne = class extends N {
|
|
|
1420
1424
|
function V(e) {
|
|
1421
1425
|
return e.options.scope?.id;
|
|
1422
1426
|
}
|
|
1423
|
-
var
|
|
1427
|
+
var St = class extends N {
|
|
1424
1428
|
#e;
|
|
1425
1429
|
#t = void 0;
|
|
1426
1430
|
#s;
|
|
@@ -1455,7 +1459,7 @@ var Ot = class extends N {
|
|
|
1455
1459
|
return this.#i = t, this.#s?.removeObserver(this), this.#s = this.#e.getMutationCache().build(this.#e, this.options), this.#s.addObserver(this), this.#s.execute(e);
|
|
1456
1460
|
}
|
|
1457
1461
|
#r() {
|
|
1458
|
-
const e = this.#s?.state ??
|
|
1462
|
+
const e = this.#s?.state ?? Ne();
|
|
1459
1463
|
this.#t = {
|
|
1460
1464
|
...e,
|
|
1461
1465
|
isPending: e.status === "pending",
|
|
@@ -1503,7 +1507,7 @@ var Ot = class extends N {
|
|
|
1503
1507
|
});
|
|
1504
1508
|
});
|
|
1505
1509
|
}
|
|
1506
|
-
},
|
|
1510
|
+
}, He = class extends N {
|
|
1507
1511
|
constructor(t = {}) {
|
|
1508
1512
|
super(), this.config = t, this.#e = /* @__PURE__ */ new Map();
|
|
1509
1513
|
}
|
|
@@ -1511,7 +1515,7 @@ var Ot = class extends N {
|
|
|
1511
1515
|
build(t, s, r) {
|
|
1512
1516
|
const i = s.queryKey, n = s.queryHash ?? ae(i, s);
|
|
1513
1517
|
let a = this.get(n);
|
|
1514
|
-
return a || (a = new
|
|
1518
|
+
return a || (a = new yt({
|
|
1515
1519
|
client: t,
|
|
1516
1520
|
queryKey: i,
|
|
1517
1521
|
queryHash: n,
|
|
@@ -1574,7 +1578,7 @@ var Ot = class extends N {
|
|
|
1574
1578
|
});
|
|
1575
1579
|
});
|
|
1576
1580
|
}
|
|
1577
|
-
},
|
|
1581
|
+
}, Ct = class {
|
|
1578
1582
|
#e;
|
|
1579
1583
|
#t;
|
|
1580
1584
|
#s;
|
|
@@ -1584,7 +1588,7 @@ var Ot = class extends N {
|
|
|
1584
1588
|
#o;
|
|
1585
1589
|
#n;
|
|
1586
1590
|
constructor(t = {}) {
|
|
1587
|
-
this.#e = t.queryCache || new
|
|
1591
|
+
this.#e = t.queryCache || new He(), this.#t = t.mutationCache || new je(), this.#s = t.defaultOptions || {}, this.#i = /* @__PURE__ */ new Map(), this.#r = /* @__PURE__ */ new Map(), this.#a = 0;
|
|
1588
1592
|
}
|
|
1589
1593
|
mount() {
|
|
1590
1594
|
this.#a++, this.#a === 1 && (this.#o = oe.subscribe(async (t) => {
|
|
@@ -1626,7 +1630,7 @@ var Ot = class extends N {
|
|
|
1626
1630
|
setQueryData(t, s, r) {
|
|
1627
1631
|
const i = this.defaultQueryOptions({ queryKey: t }), a = this.#e.get(
|
|
1628
1632
|
i.queryHash
|
|
1629
|
-
)?.state.data, o =
|
|
1633
|
+
)?.state.data, o = nt(s, a);
|
|
1630
1634
|
if (o !== void 0)
|
|
1631
1635
|
return this.#e.build(this, i).setData(o, { ...r, manual: !0 });
|
|
1632
1636
|
}
|
|
@@ -1705,13 +1709,13 @@ var Ot = class extends N {
|
|
|
1705
1709
|
return this.fetchQuery(t).then(w).catch(w);
|
|
1706
1710
|
}
|
|
1707
1711
|
fetchInfiniteQuery(t) {
|
|
1708
|
-
return t.behavior =
|
|
1712
|
+
return t.behavior = ve(t.pages), this.fetchQuery(t);
|
|
1709
1713
|
}
|
|
1710
1714
|
prefetchInfiniteQuery(t) {
|
|
1711
1715
|
return this.fetchInfiniteQuery(t).then(w).catch(w);
|
|
1712
1716
|
}
|
|
1713
1717
|
ensureInfiniteQueryData(t) {
|
|
1714
|
-
return t.behavior =
|
|
1718
|
+
return t.behavior = ve(t.pages), this.ensureQueryData(t);
|
|
1715
1719
|
}
|
|
1716
1720
|
resumePausedMutations() {
|
|
1717
1721
|
return x.isOnline() ? this.#t.resumePausedMutations() : Promise.resolve();
|
|
@@ -1777,10 +1781,10 @@ var Ot = class extends N {
|
|
|
1777
1781
|
clear() {
|
|
1778
1782
|
this.#e.clear(), this.#t.clear();
|
|
1779
1783
|
}
|
|
1780
|
-
},
|
|
1781
|
-
function
|
|
1784
|
+
}, wt = "VUE_QUERY_CLIENT";
|
|
1785
|
+
function Le(e) {
|
|
1782
1786
|
const t = e ? `:${e}` : "";
|
|
1783
|
-
return `${
|
|
1787
|
+
return `${wt}${t}`;
|
|
1784
1788
|
}
|
|
1785
1789
|
function re(e, t) {
|
|
1786
1790
|
Object.keys(e).forEach((s) => {
|
|
@@ -1790,14 +1794,14 @@ function re(e, t) {
|
|
|
1790
1794
|
function ie(e, t, s = "", r = 0) {
|
|
1791
1795
|
if (t) {
|
|
1792
1796
|
const i = t(e, s, r);
|
|
1793
|
-
if (i === void 0 &&
|
|
1797
|
+
if (i === void 0 && Ee(e) || i !== void 0)
|
|
1794
1798
|
return i;
|
|
1795
1799
|
}
|
|
1796
1800
|
if (Array.isArray(e))
|
|
1797
1801
|
return e.map(
|
|
1798
1802
|
(i, n) => ie(i, t, String(n), r + 1)
|
|
1799
1803
|
);
|
|
1800
|
-
if (typeof e == "object" &&
|
|
1804
|
+
if (typeof e == "object" && Qt(e)) {
|
|
1801
1805
|
const i = Object.entries(e).map(([n, a]) => [
|
|
1802
1806
|
n,
|
|
1803
1807
|
ie(a, t, n, r + 1)
|
|
@@ -1806,62 +1810,62 @@ function ie(e, t, s = "", r = 0) {
|
|
|
1806
1810
|
}
|
|
1807
1811
|
return e;
|
|
1808
1812
|
}
|
|
1809
|
-
function
|
|
1813
|
+
function Et(e, t) {
|
|
1810
1814
|
return ie(e, t);
|
|
1811
1815
|
}
|
|
1812
1816
|
function h(e, t = !1) {
|
|
1813
|
-
return
|
|
1817
|
+
return Et(e, (s, r, i) => {
|
|
1814
1818
|
if (i === 1 && r === "queryKey")
|
|
1815
1819
|
return h(s, !0);
|
|
1816
|
-
if (t &&
|
|
1820
|
+
if (t && At(s))
|
|
1817
1821
|
return h(s(), t);
|
|
1818
|
-
if (
|
|
1819
|
-
return h(
|
|
1822
|
+
if (Ee(s))
|
|
1823
|
+
return h(ze(s), t);
|
|
1820
1824
|
});
|
|
1821
1825
|
}
|
|
1822
|
-
function
|
|
1826
|
+
function Qt(e) {
|
|
1823
1827
|
if (Object.prototype.toString.call(e) !== "[object Object]")
|
|
1824
1828
|
return !1;
|
|
1825
1829
|
const t = Object.getPrototypeOf(e);
|
|
1826
1830
|
return t === null || t === Object.prototype;
|
|
1827
1831
|
}
|
|
1828
|
-
function
|
|
1832
|
+
function At(e) {
|
|
1829
1833
|
return typeof e == "function";
|
|
1830
1834
|
}
|
|
1831
|
-
function
|
|
1832
|
-
if (!
|
|
1835
|
+
function Ve(e = "") {
|
|
1836
|
+
if (!Ye())
|
|
1833
1837
|
throw new Error(
|
|
1834
1838
|
"vue-query hooks can only be used inside setup() function or functions that support injection context."
|
|
1835
1839
|
);
|
|
1836
|
-
const t =
|
|
1840
|
+
const t = Le(e), s = Je(t);
|
|
1837
1841
|
if (!s)
|
|
1838
1842
|
throw new Error(
|
|
1839
1843
|
"No 'queryClient' found in Vue context, use 'VueQueryPlugin' to properly initialize the library."
|
|
1840
1844
|
);
|
|
1841
1845
|
return s;
|
|
1842
1846
|
}
|
|
1843
|
-
var
|
|
1847
|
+
var Ke = class extends He {
|
|
1844
1848
|
find(e) {
|
|
1845
1849
|
return super.find(h(e));
|
|
1846
1850
|
}
|
|
1847
1851
|
findAll(e = {}) {
|
|
1848
1852
|
return super.findAll(h(e));
|
|
1849
1853
|
}
|
|
1850
|
-
},
|
|
1854
|
+
}, Rt = class extends je {
|
|
1851
1855
|
find(e) {
|
|
1852
1856
|
return super.find(h(e));
|
|
1853
1857
|
}
|
|
1854
1858
|
findAll(e = {}) {
|
|
1855
1859
|
return super.findAll(h(e));
|
|
1856
1860
|
}
|
|
1857
|
-
},
|
|
1861
|
+
}, Ge = class extends Ct {
|
|
1858
1862
|
constructor(e = {}) {
|
|
1859
1863
|
const t = {
|
|
1860
1864
|
defaultOptions: e.defaultOptions,
|
|
1861
|
-
queryCache: e.queryCache || new
|
|
1862
|
-
mutationCache: e.mutationCache || new
|
|
1865
|
+
queryCache: e.queryCache || new Ke(),
|
|
1866
|
+
mutationCache: e.mutationCache || new Rt()
|
|
1863
1867
|
};
|
|
1864
|
-
super(t), this.isRestoring =
|
|
1868
|
+
super(t), this.isRestoring = Xe(!1);
|
|
1865
1869
|
}
|
|
1866
1870
|
isFetching(e = {}) {
|
|
1867
1871
|
return super.isFetching(h(e));
|
|
@@ -1915,7 +1919,7 @@ var Ve = class extends je {
|
|
|
1915
1919
|
...s,
|
|
1916
1920
|
type: s.refetchType ?? s.type ?? "active"
|
|
1917
1921
|
};
|
|
1918
|
-
return
|
|
1922
|
+
return Ze().then(() => super.refetchQueries(i, r));
|
|
1919
1923
|
}
|
|
1920
1924
|
refetchQueries(e = {}, t = {}) {
|
|
1921
1925
|
return super.refetchQueries(
|
|
@@ -1954,22 +1958,22 @@ var Ve = class extends je {
|
|
|
1954
1958
|
return super.getMutationDefaults(h(e));
|
|
1955
1959
|
}
|
|
1956
1960
|
};
|
|
1957
|
-
function
|
|
1958
|
-
return
|
|
1961
|
+
function Pt() {
|
|
1962
|
+
return We().__VUE_DEVTOOLS_GLOBAL_HOOK__;
|
|
1959
1963
|
}
|
|
1960
|
-
function
|
|
1964
|
+
function We() {
|
|
1961
1965
|
return typeof navigator < "u" && typeof window < "u" ? window : typeof globalThis < "u" ? globalThis : {};
|
|
1962
1966
|
}
|
|
1963
|
-
const
|
|
1967
|
+
const It = typeof Proxy == "function", Tt = "devtools-plugin:setup", Dt = "plugin:settings:set";
|
|
1964
1968
|
let _, ne;
|
|
1965
|
-
function
|
|
1969
|
+
function Ft() {
|
|
1966
1970
|
var e;
|
|
1967
1971
|
return _ !== void 0 || (typeof window < "u" && window.performance ? (_ = !0, ne = window.performance) : typeof globalThis < "u" && (!((e = globalThis.perf_hooks) === null || e === void 0) && e.performance) ? (_ = !0, ne = globalThis.perf_hooks.performance) : _ = !1), _;
|
|
1968
1972
|
}
|
|
1969
|
-
function
|
|
1970
|
-
return
|
|
1973
|
+
function Mt() {
|
|
1974
|
+
return Ft() ? ne.now() : Date.now();
|
|
1971
1975
|
}
|
|
1972
|
-
class
|
|
1976
|
+
class Ut {
|
|
1973
1977
|
constructor(t, s) {
|
|
1974
1978
|
this.target = null, this.targetQueue = [], this.onQueue = [], this.plugin = t, this.hook = s;
|
|
1975
1979
|
const r = {};
|
|
@@ -1997,7 +2001,7 @@ class Mt {
|
|
|
1997
2001
|
n = a;
|
|
1998
2002
|
},
|
|
1999
2003
|
now() {
|
|
2000
|
-
return
|
|
2004
|
+
return Mt();
|
|
2001
2005
|
}
|
|
2002
2006
|
}, s && s.on(Dt, (a, o) => {
|
|
2003
2007
|
a === this.plugin.id && this.fallbacks.setSettings(o);
|
|
@@ -2031,12 +2035,12 @@ class Mt {
|
|
|
2031
2035
|
s.resolve(await this.target[s.method](...s.args));
|
|
2032
2036
|
}
|
|
2033
2037
|
}
|
|
2034
|
-
function
|
|
2035
|
-
const s = e, r =
|
|
2038
|
+
function qt(e, t) {
|
|
2039
|
+
const s = e, r = We(), i = Pt(), n = It && s.enableEarlyProxy;
|
|
2036
2040
|
if (i && (r.__VUE_DEVTOOLS_PLUGIN_API_AVAILABLE__ || !n))
|
|
2037
|
-
i.emit(
|
|
2041
|
+
i.emit(Tt, e, t);
|
|
2038
2042
|
else {
|
|
2039
|
-
const a = n ? new
|
|
2043
|
+
const a = n ? new Ut(s, i) : null;
|
|
2040
2044
|
(r.__VUE_DEVTOOLS_PLUGINS__ = r.__VUE_DEVTOOLS_PLUGINS__ || []).push({
|
|
2041
2045
|
pluginDescriptor: s,
|
|
2042
2046
|
setupFn: t,
|
|
@@ -2044,17 +2048,7 @@ function Ut(e, t) {
|
|
|
2044
2048
|
}), a && t(a.proxiedTarget);
|
|
2045
2049
|
}
|
|
2046
2050
|
}
|
|
2047
|
-
|
|
2048
|
-
* match-sorter-utils
|
|
2049
|
-
*
|
|
2050
|
-
* Copyright (c) TanStack
|
|
2051
|
-
*
|
|
2052
|
-
* This source code is licensed under the MIT license found in the
|
|
2053
|
-
* LICENSE.md file in the root directory of this source tree.
|
|
2054
|
-
*
|
|
2055
|
-
* @license MIT
|
|
2056
|
-
*/
|
|
2057
|
-
const We = {
|
|
2051
|
+
const Be = {
|
|
2058
2052
|
À: "A",
|
|
2059
2053
|
Á: "A",
|
|
2060
2054
|
Â: "A",
|
|
@@ -2454,16 +2448,10 @@ const We = {
|
|
|
2454
2448
|
x̧: "x",
|
|
2455
2449
|
Z̧: "Z",
|
|
2456
2450
|
z̧: "z"
|
|
2457
|
-
},
|
|
2458
|
-
function
|
|
2459
|
-
return e.replace(
|
|
2460
|
-
}
|
|
2461
|
-
/**
|
|
2462
|
-
* @name match-sorter
|
|
2463
|
-
* @license MIT license.
|
|
2464
|
-
* @copyright (c) 2099 Kent C. Dodds
|
|
2465
|
-
* @author Kent C. Dodds <me@kentcdodds.com> (https://kentcdodds.com)
|
|
2466
|
-
*/
|
|
2451
|
+
}, _t = Object.keys(Be).join("|"), kt = new RegExp(_t, "g");
|
|
2452
|
+
function xt(e) {
|
|
2453
|
+
return e.replace(kt, (t) => Be[t]);
|
|
2454
|
+
}
|
|
2467
2455
|
const S = {
|
|
2468
2456
|
CASE_SENSITIVE_EQUAL: 7,
|
|
2469
2457
|
EQUAL: 6,
|
|
@@ -2474,10 +2462,10 @@ const S = {
|
|
|
2474
2462
|
MATCHES: 1,
|
|
2475
2463
|
NO_MATCH: 0
|
|
2476
2464
|
};
|
|
2477
|
-
function
|
|
2465
|
+
function Nt(e, t, s) {
|
|
2478
2466
|
var r;
|
|
2479
2467
|
if (s = s || {}, s.threshold = (r = s.threshold) != null ? r : S.MATCHES, !s.accessors) {
|
|
2480
|
-
const a =
|
|
2468
|
+
const a = Oe(e, t, s);
|
|
2481
2469
|
return {
|
|
2482
2470
|
// ends up being duplicate of 'item' in matches but consistent
|
|
2483
2471
|
rankedValue: e,
|
|
@@ -2487,7 +2475,7 @@ function xt(e, t, s) {
|
|
|
2487
2475
|
passed: a >= s.threshold
|
|
2488
2476
|
};
|
|
2489
2477
|
}
|
|
2490
|
-
const i =
|
|
2478
|
+
const i = Vt(e, s.accessors), n = {
|
|
2491
2479
|
rankedValue: e,
|
|
2492
2480
|
rank: S.NO_MATCH,
|
|
2493
2481
|
accessorIndex: -1,
|
|
@@ -2496,7 +2484,7 @@ function xt(e, t, s) {
|
|
|
2496
2484
|
};
|
|
2497
2485
|
for (let a = 0; a < i.length; a++) {
|
|
2498
2486
|
const o = i[a];
|
|
2499
|
-
let u =
|
|
2487
|
+
let u = Oe(o.itemValue, t, s);
|
|
2500
2488
|
const {
|
|
2501
2489
|
minRanking: d,
|
|
2502
2490
|
maxRanking: c,
|
|
@@ -2506,10 +2494,10 @@ function xt(e, t, s) {
|
|
|
2506
2494
|
}
|
|
2507
2495
|
return n;
|
|
2508
2496
|
}
|
|
2509
|
-
function
|
|
2510
|
-
return e =
|
|
2497
|
+
function Oe(e, t, s) {
|
|
2498
|
+
return e = Se(e, s), t = Se(t, s), t.length > e.length ? S.NO_MATCH : e === t ? S.CASE_SENSITIVE_EQUAL : (e = e.toLowerCase(), t = t.toLowerCase(), e === t ? S.EQUAL : e.startsWith(t) ? S.STARTS_WITH : e.includes(` ${t}`) ? S.WORD_STARTS_WITH : e.includes(t) ? S.CONTAINS : t.length === 1 ? S.NO_MATCH : jt(e).includes(t) ? S.ACRONYM : Ht(e, t));
|
|
2511
2499
|
}
|
|
2512
|
-
function
|
|
2500
|
+
function jt(e) {
|
|
2513
2501
|
let t = "";
|
|
2514
2502
|
return e.split(" ").forEach((r) => {
|
|
2515
2503
|
r.split("-").forEach((n) => {
|
|
@@ -2517,7 +2505,7 @@ function Nt(e) {
|
|
|
2517
2505
|
});
|
|
2518
2506
|
}), t;
|
|
2519
2507
|
}
|
|
2520
|
-
function
|
|
2508
|
+
function Ht(e, t) {
|
|
2521
2509
|
let s = 0, r = 0;
|
|
2522
2510
|
function i(u, d, c) {
|
|
2523
2511
|
for (let l = c, f = d.length; l < f; l++)
|
|
@@ -2541,22 +2529,22 @@ function jt(e, t) {
|
|
|
2541
2529
|
const o = r - a;
|
|
2542
2530
|
return n(o);
|
|
2543
2531
|
}
|
|
2544
|
-
function
|
|
2532
|
+
function Se(e, t) {
|
|
2545
2533
|
let {
|
|
2546
2534
|
keepDiacritics: s
|
|
2547
2535
|
} = t;
|
|
2548
|
-
return e = `${e}`, s || (e =
|
|
2536
|
+
return e = `${e}`, s || (e = xt(e)), e;
|
|
2549
2537
|
}
|
|
2550
|
-
function
|
|
2538
|
+
function Lt(e, t) {
|
|
2551
2539
|
let s = t;
|
|
2552
2540
|
typeof t == "object" && (s = t.accessor);
|
|
2553
2541
|
const r = s(e);
|
|
2554
2542
|
return r == null ? [] : Array.isArray(r) ? r : [String(r)];
|
|
2555
2543
|
}
|
|
2556
|
-
function
|
|
2544
|
+
function Vt(e, t) {
|
|
2557
2545
|
const s = [];
|
|
2558
2546
|
for (let r = 0, i = t.length; r < i; r++) {
|
|
2559
|
-
const n = t[r], a =
|
|
2547
|
+
const n = t[r], a = Kt(n), o = Lt(e, n);
|
|
2560
2548
|
for (let u = 0, d = o.length; u < d; u++)
|
|
2561
2549
|
s.push({
|
|
2562
2550
|
itemValue: o[u],
|
|
@@ -2565,37 +2553,37 @@ function Lt(e, t) {
|
|
|
2565
2553
|
}
|
|
2566
2554
|
return s;
|
|
2567
2555
|
}
|
|
2568
|
-
const
|
|
2556
|
+
const Ce = {
|
|
2569
2557
|
maxRanking: 1 / 0,
|
|
2570
2558
|
minRanking: -1 / 0
|
|
2571
2559
|
};
|
|
2572
|
-
function
|
|
2573
|
-
return typeof e == "function" ?
|
|
2574
|
-
...
|
|
2560
|
+
function Kt(e) {
|
|
2561
|
+
return typeof e == "function" ? Ce : {
|
|
2562
|
+
...Ce,
|
|
2575
2563
|
...e
|
|
2576
2564
|
};
|
|
2577
2565
|
}
|
|
2578
2566
|
function F(e) {
|
|
2579
2567
|
return e.state.fetchStatus === "fetching" ? 0 : e.state.fetchStatus === "paused" ? 4 : e.getObserversCount() ? e.isStale() ? 2 : 1 : 3;
|
|
2580
2568
|
}
|
|
2581
|
-
function
|
|
2569
|
+
function we(e) {
|
|
2582
2570
|
const t = F(e);
|
|
2583
2571
|
return t === 0 ? "fetching" : t === 4 ? "paused" : t === 2 ? "stale" : t === 3 ? "inactive" : "fresh";
|
|
2584
2572
|
}
|
|
2585
|
-
function
|
|
2573
|
+
function Gt(e) {
|
|
2586
2574
|
return F(e) === 2 ? 0 : 16777215;
|
|
2587
2575
|
}
|
|
2588
|
-
function
|
|
2576
|
+
function Wt(e) {
|
|
2589
2577
|
const t = F(e);
|
|
2590
2578
|
return t === 0 ? 27647 : t === 4 ? 9193963 : t === 2 ? 16757248 : t === 3 ? 4148832 : 33575;
|
|
2591
2579
|
}
|
|
2592
|
-
var
|
|
2593
|
-
"Status > Last Updated":
|
|
2594
|
-
"Query Hash":
|
|
2595
|
-
"Last Updated":
|
|
2580
|
+
var Bt = (e, t) => e.queryHash.localeCompare(t.queryHash), $e = (e, t) => e.state.dataUpdatedAt < t.state.dataUpdatedAt ? 1 : -1, $t = (e, t) => F(e) === F(t) ? $e(e, t) : F(e) > F(t) ? 1 : -1, B = {
|
|
2581
|
+
"Status > Last Updated": $t,
|
|
2582
|
+
"Query Hash": Bt,
|
|
2583
|
+
"Last Updated": $e
|
|
2596
2584
|
}, R = "vue-query", $ = "Vue Query";
|
|
2597
|
-
function
|
|
2598
|
-
|
|
2585
|
+
function zt(e, t) {
|
|
2586
|
+
qt(
|
|
2599
2587
|
{
|
|
2600
2588
|
id: R,
|
|
2601
2589
|
label: $,
|
|
@@ -2734,19 +2722,19 @@ function $t(e, t) {
|
|
|
2734
2722
|
}), s.on.getInspectorTree((n) => {
|
|
2735
2723
|
if (n.inspectorId === R) {
|
|
2736
2724
|
const a = i.getAll(), o = s.getSettings(), c = (n.filter ? a.filter(
|
|
2737
|
-
(l) =>
|
|
2725
|
+
(l) => Nt(l.queryHash, n.filter).passed
|
|
2738
2726
|
) : [...a]).sort(
|
|
2739
2727
|
(l, f) => B[o.sortFn](l, f) * o.baseSort
|
|
2740
2728
|
).map((l) => {
|
|
2741
|
-
const f =
|
|
2729
|
+
const f = we(l);
|
|
2742
2730
|
return {
|
|
2743
2731
|
id: l.queryHash,
|
|
2744
2732
|
label: l.queryHash,
|
|
2745
2733
|
tags: [
|
|
2746
2734
|
{
|
|
2747
2735
|
label: `${f} [${l.getObserversCount()}]`,
|
|
2748
|
-
textColor:
|
|
2749
|
-
backgroundColor:
|
|
2736
|
+
textColor: Gt(l),
|
|
2737
|
+
backgroundColor: Wt(l)
|
|
2750
2738
|
}
|
|
2751
2739
|
]
|
|
2752
2740
|
};
|
|
@@ -2766,7 +2754,7 @@ function $t(e, t) {
|
|
|
2766
2754
|
},
|
|
2767
2755
|
{
|
|
2768
2756
|
key: "Query status",
|
|
2769
|
-
value:
|
|
2757
|
+
value: we(a)
|
|
2770
2758
|
},
|
|
2771
2759
|
{
|
|
2772
2760
|
key: "Observers",
|
|
@@ -2795,15 +2783,15 @@ function $t(e, t) {
|
|
|
2795
2783
|
}
|
|
2796
2784
|
);
|
|
2797
2785
|
}
|
|
2798
|
-
var
|
|
2786
|
+
var rs = {
|
|
2799
2787
|
install: (e, t = {}) => {
|
|
2800
|
-
const s =
|
|
2788
|
+
const s = Le(t.queryClientKey);
|
|
2801
2789
|
let r;
|
|
2802
2790
|
if ("queryClient" in t && t.queryClient)
|
|
2803
2791
|
r = t.queryClient;
|
|
2804
2792
|
else {
|
|
2805
2793
|
const a = "queryClientConfig" in t ? t.queryClientConfig : void 0;
|
|
2806
|
-
r = new
|
|
2794
|
+
r = new Ge(a);
|
|
2807
2795
|
}
|
|
2808
2796
|
M || r.mount();
|
|
2809
2797
|
let i = () => {
|
|
@@ -2826,19 +2814,19 @@ var ss = {
|
|
|
2826
2814
|
n(), a();
|
|
2827
2815
|
};
|
|
2828
2816
|
}
|
|
2829
|
-
e.provide(s, r), process.env.NODE_ENV === "development" && t.enableDevtoolsV6Plugin &&
|
|
2817
|
+
e.provide(s, r), process.env.NODE_ENV === "development" && t.enableDevtoolsV6Plugin && zt(e, r);
|
|
2830
2818
|
}
|
|
2831
2819
|
};
|
|
2832
|
-
function
|
|
2833
|
-
process.env.NODE_ENV === "development" && (
|
|
2820
|
+
function Yt(e, t, s) {
|
|
2821
|
+
process.env.NODE_ENV === "development" && (Qe() || console.warn(
|
|
2834
2822
|
'vue-query composable like "useQuery()" should only be used inside a "setup()" function or a running effect scope. They might otherwise lead to memory leaks.'
|
|
2835
2823
|
));
|
|
2836
|
-
const r = s ||
|
|
2824
|
+
const r = s || Ve(), i = Ae(() => {
|
|
2837
2825
|
const p = h(t);
|
|
2838
2826
|
typeof p.enabled == "function" && (p.enabled = p.enabled());
|
|
2839
2827
|
const g = r.defaultQueryOptions(p);
|
|
2840
2828
|
return g._optimisticResults = r.isRestoring?.value ? "isRestoring" : "optimistic", g;
|
|
2841
|
-
}), n = new e(r, i.value), a = i.value.shallow ?
|
|
2829
|
+
}), n = new e(r, i.value), a = i.value.shallow ? Re(n.getCurrentResult()) : Pe(n.getCurrentResult());
|
|
2842
2830
|
let o = () => {
|
|
2843
2831
|
};
|
|
2844
2832
|
r.isRestoring && k(
|
|
@@ -2853,7 +2841,7 @@ function zt(e, t, s) {
|
|
|
2853
2841
|
const u = () => {
|
|
2854
2842
|
n.setOptions(i.value), re(a, n.getCurrentResult());
|
|
2855
2843
|
};
|
|
2856
|
-
k(i, u),
|
|
2844
|
+
k(i, u), Ie(() => {
|
|
2857
2845
|
o();
|
|
2858
2846
|
});
|
|
2859
2847
|
const d = (...p) => (u(), a.refetch(...p)), c = () => new Promise(
|
|
@@ -2887,19 +2875,19 @@ function zt(e, t, s) {
|
|
|
2887
2875
|
throw p;
|
|
2888
2876
|
}
|
|
2889
2877
|
);
|
|
2890
|
-
const l = i.value.shallow ?
|
|
2878
|
+
const l = i.value.shallow ? Te(a) : De(a), f = Fe(l);
|
|
2891
2879
|
for (const p in a)
|
|
2892
2880
|
typeof a[p] == "function" && (f[p] = a[p]);
|
|
2893
2881
|
return f.suspense = c, f.refetch = d, f;
|
|
2894
2882
|
}
|
|
2895
|
-
function rs(e, t) {
|
|
2896
|
-
return zt(yt, e, t);
|
|
2897
|
-
}
|
|
2898
2883
|
function is(e, t) {
|
|
2899
|
-
|
|
2884
|
+
return Yt(gt, e, t);
|
|
2885
|
+
}
|
|
2886
|
+
function ns(e, t) {
|
|
2887
|
+
process.env.NODE_ENV === "development" && (Qe() || console.warn(
|
|
2900
2888
|
'vue-query composable like "useQuery()" should only be used inside a "setup()" function or a running effect scope. They might otherwise lead to memory leaks.'
|
|
2901
2889
|
));
|
|
2902
|
-
const s = t ||
|
|
2890
|
+
const s = t || Ve(), r = Ae(() => s.defaultMutationOptions(h(e))), i = new St(s, r.value), n = r.value.shallow ? Re(i.getCurrentResult()) : Pe(i.getCurrentResult()), a = i.subscribe((c) => {
|
|
2903
2891
|
re(n, c);
|
|
2904
2892
|
}), o = (c, l) => {
|
|
2905
2893
|
i.mutate(c, l).catch(() => {
|
|
@@ -2907,10 +2895,10 @@ function is(e, t) {
|
|
|
2907
2895
|
};
|
|
2908
2896
|
k(r, () => {
|
|
2909
2897
|
i.setOptions(r.value);
|
|
2910
|
-
}),
|
|
2898
|
+
}), Ie(() => {
|
|
2911
2899
|
a();
|
|
2912
2900
|
});
|
|
2913
|
-
const u = r.value.shallow ?
|
|
2901
|
+
const u = r.value.shallow ? Te(n) : De(n), d = Fe(u);
|
|
2914
2902
|
return k(
|
|
2915
2903
|
() => n.error,
|
|
2916
2904
|
(c) => {
|
|
@@ -2924,14 +2912,14 @@ function is(e, t) {
|
|
|
2924
2912
|
reset: n.reset
|
|
2925
2913
|
};
|
|
2926
2914
|
}
|
|
2927
|
-
const
|
|
2928
|
-
function
|
|
2915
|
+
const as = new Ge();
|
|
2916
|
+
function os(e, t, s) {
|
|
2929
2917
|
return {
|
|
2930
2918
|
queryClientConfig: {
|
|
2931
|
-
queryCache: new
|
|
2919
|
+
queryCache: new Ke({
|
|
2932
2920
|
onError: (r) => {
|
|
2933
2921
|
const i = r.code === "ERR_NETWORK", n = [403, 401].includes(r.response?.status);
|
|
2934
|
-
i ? e.error("Ошибка подключения к сети") : n ?
|
|
2922
|
+
i ? e.error("Ошибка подключения к сети") : n ? et(t, tt, s) : e.error(ce(r));
|
|
2935
2923
|
}
|
|
2936
2924
|
}),
|
|
2937
2925
|
defaultOptions: {
|
|
@@ -2946,10 +2934,10 @@ function as(e, t, s) {
|
|
|
2946
2934
|
};
|
|
2947
2935
|
}
|
|
2948
2936
|
export {
|
|
2949
|
-
|
|
2950
|
-
|
|
2951
|
-
|
|
2952
|
-
|
|
2953
|
-
|
|
2954
|
-
|
|
2937
|
+
rs as VueQueryPlugin,
|
|
2938
|
+
as as queryClient,
|
|
2939
|
+
ns as useMutation,
|
|
2940
|
+
is as useQuery,
|
|
2941
|
+
Ve as useQueryClient,
|
|
2942
|
+
os as vueQueryOptions
|
|
2955
2943
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mhz-helpers",
|
|
3
3
|
"description": "Mhz helpers and composables",
|
|
4
|
-
"version": "1.3.
|
|
4
|
+
"version": "1.3.9",
|
|
5
5
|
"author": "Alexandr Dergunov <dergunovs@mail.ru> (https://github.com/dergunovs)",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"type": "module",
|
|
@@ -24,20 +24,20 @@
|
|
|
24
24
|
"test:cov": "vitest run --coverage"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@tanstack/vue-query": "5.90.
|
|
27
|
+
"@tanstack/vue-query": "5.90.7",
|
|
28
28
|
"@vueuse/core": "14.0.0",
|
|
29
29
|
"@vueuse/integrations": "14.0.0",
|
|
30
30
|
"async-validator": "4.2.5",
|
|
31
|
-
"axios": "1.13.
|
|
32
|
-
"vue": "3.5.
|
|
31
|
+
"axios": "1.13.2",
|
|
32
|
+
"vue": "3.5.23",
|
|
33
33
|
"vue-router": "4.6.3"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@eslint/js": "9.
|
|
37
|
-
"@types/node": "24.
|
|
36
|
+
"@eslint/js": "9.39.1",
|
|
37
|
+
"@types/node": "24.10.0",
|
|
38
38
|
"@vitejs/plugin-vue": "6.0.1",
|
|
39
|
-
"@vitest/coverage-v8": "4.0.
|
|
40
|
-
"eslint": "9.
|
|
39
|
+
"@vitest/coverage-v8": "4.0.7",
|
|
40
|
+
"eslint": "9.39.1",
|
|
41
41
|
"eslint-config-prettier": "10.1.8",
|
|
42
42
|
"eslint-import-resolver-typescript": "4.4.4",
|
|
43
43
|
"eslint-plugin-import-x": "4.16.1",
|
|
@@ -56,16 +56,16 @@
|
|
|
56
56
|
"stylelint-order": "7.0.0",
|
|
57
57
|
"stylelint-prettier": "5.0.3",
|
|
58
58
|
"typescript": "5.9.3",
|
|
59
|
-
"typescript-eslint": "8.46.
|
|
60
|
-
"vite": "7.1
|
|
59
|
+
"typescript-eslint": "8.46.3",
|
|
60
|
+
"vite": "7.2.1",
|
|
61
61
|
"vite-plugin-dts": "4.5.4",
|
|
62
|
-
"vitest": "4.0.
|
|
62
|
+
"vitest": "4.0.7",
|
|
63
63
|
"vue-eslint-parser": "10.2.0",
|
|
64
64
|
"vue-linters-config": "0.5.4",
|
|
65
|
-
"vue-tsc": "3.1.
|
|
65
|
+
"vue-tsc": "3.1.3"
|
|
66
66
|
},
|
|
67
67
|
"peerDependencies": {
|
|
68
|
-
"vue": "3.5.
|
|
68
|
+
"vue": "3.5.23",
|
|
69
69
|
"vue-router": "4.6.3"
|
|
70
70
|
},
|
|
71
71
|
"engines": {
|