mhz-helpers 1.3.21 → 1.3.22
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/query/index.js +64 -63
- package/package.json +14 -14
package/dist/query/index.js
CHANGED
|
@@ -130,27 +130,28 @@ function N(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) => N(e[s], t[s])) : !1;
|
|
131
131
|
}
|
|
132
132
|
var ot = Object.prototype.hasOwnProperty;
|
|
133
|
-
function Y(e, t) {
|
|
133
|
+
function Y(e, t, s = 0) {
|
|
134
134
|
if (e === t)
|
|
135
135
|
return e;
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
136
|
+
if (s > 500) return t;
|
|
137
|
+
const r = fe(e) && fe(t);
|
|
138
|
+
if (!r && !(J(e) && J(t))) return t;
|
|
139
|
+
const n = (r ? e : Object.keys(e)).length, o = r ? t : Object.keys(t), a = o.length, u = r ? new Array(a) : {};
|
|
140
|
+
let y = 0;
|
|
141
|
+
for (let c = 0; c < a; c++) {
|
|
142
|
+
const l = r ? c : o[c], f = e[l], d = t[l];
|
|
143
|
+
if (f === d) {
|
|
144
|
+
u[l] = f, (r ? c < n : ot.call(e, l)) && y++;
|
|
144
145
|
continue;
|
|
145
146
|
}
|
|
146
|
-
if (
|
|
147
|
-
|
|
147
|
+
if (f === null || d === null || typeof f != "object" || typeof d != "object") {
|
|
148
|
+
u[l] = d;
|
|
148
149
|
continue;
|
|
149
150
|
}
|
|
150
|
-
const
|
|
151
|
-
|
|
151
|
+
const g = Y(f, d, s + 1);
|
|
152
|
+
u[l] = g, g === f && y++;
|
|
152
153
|
}
|
|
153
|
-
return
|
|
154
|
+
return n === a && y === n ? e : u;
|
|
154
155
|
}
|
|
155
156
|
function K(e, t) {
|
|
156
157
|
if (!t || Object.keys(e).length !== Object.keys(t).length)
|
|
@@ -394,13 +395,13 @@ function _e(e) {
|
|
|
394
395
|
t = !0;
|
|
395
396
|
}, u = () => {
|
|
396
397
|
t = !1;
|
|
397
|
-
},
|
|
398
|
+
}, y = () => ae.isFocused() && (e.networkMode === "always" || x.isOnline()) && e.canRun(), c = () => qe(e.networkMode) && e.canRun(), l = (p) => {
|
|
398
399
|
n() || (r?.(), i.resolve(p));
|
|
399
400
|
}, f = (p) => {
|
|
400
401
|
n() || (r?.(), i.reject(p));
|
|
401
|
-
},
|
|
402
|
+
}, d = () => new Promise((p) => {
|
|
402
403
|
r = (m) => {
|
|
403
|
-
(n() ||
|
|
404
|
+
(n() || y()) && p(m);
|
|
404
405
|
}, e.onPause?.();
|
|
405
406
|
}).then(() => {
|
|
406
407
|
r = void 0, n() || e.onContinue?.();
|
|
@@ -422,7 +423,7 @@ function _e(e) {
|
|
|
422
423
|
f(v);
|
|
423
424
|
return;
|
|
424
425
|
}
|
|
425
|
-
s++, e.onFail?.(s, v), at(I).then(() =>
|
|
426
|
+
s++, e.onFail?.(s, v), at(I).then(() => y() ? void 0 : d()).then(() => {
|
|
426
427
|
t ? f(v) : g();
|
|
427
428
|
});
|
|
428
429
|
});
|
|
@@ -435,7 +436,7 @@ function _e(e) {
|
|
|
435
436
|
cancelRetry: a,
|
|
436
437
|
continueRetry: u,
|
|
437
438
|
canStart: c,
|
|
438
|
-
start: () => (c() ? g() :
|
|
439
|
+
start: () => (c() ? g() : d().then(g), i)
|
|
439
440
|
};
|
|
440
441
|
}
|
|
441
442
|
var ke = class {
|
|
@@ -569,7 +570,7 @@ var ke = class {
|
|
|
569
570
|
get: () => (this.#a = !0, s.signal)
|
|
570
571
|
});
|
|
571
572
|
}, i = () => {
|
|
572
|
-
const a = Ue(this.options, t),
|
|
573
|
+
const a = Ue(this.options, t), y = (() => {
|
|
573
574
|
const c = {
|
|
574
575
|
client: this.#i,
|
|
575
576
|
queryKey: this.queryKey,
|
|
@@ -579,9 +580,9 @@ var ke = class {
|
|
|
579
580
|
})();
|
|
580
581
|
return this.#a = !1, this.options.persister ? this.options.persister(
|
|
581
582
|
a,
|
|
582
|
-
|
|
583
|
+
y,
|
|
583
584
|
this
|
|
584
|
-
) : a(
|
|
585
|
+
) : a(y);
|
|
585
586
|
}, o = (() => {
|
|
586
587
|
const a = {
|
|
587
588
|
fetchOptions: t,
|
|
@@ -904,16 +905,16 @@ var mt = class extends j {
|
|
|
904
905
|
this.#h && (D.clearInterval(this.#h), this.#h = void 0);
|
|
905
906
|
}
|
|
906
907
|
createResult(e, t) {
|
|
907
|
-
const s = this.#t, r = this.options, i = this.#i, n = this.#r, o = this.#o, u = e !== s ? e.state : this.#s, { state:
|
|
908
|
-
let c = { ...
|
|
908
|
+
const s = this.#t, r = this.options, i = this.#i, n = this.#r, o = this.#o, u = e !== s ? e.state : this.#s, { state: y } = e;
|
|
909
|
+
let c = { ...y }, l = !1, f;
|
|
909
910
|
if (t._optimisticResults) {
|
|
910
911
|
const C = this.hasListeners(), H = !C && ge(e, t), q = C && me(e, s, t, r);
|
|
911
912
|
(H || q) && (c = {
|
|
912
913
|
...c,
|
|
913
|
-
...xe(
|
|
914
|
+
...xe(y.data, e.options)
|
|
914
915
|
}), t._optimisticResults === "isRestoring" && (c.fetchStatus = "idle");
|
|
915
916
|
}
|
|
916
|
-
let { error:
|
|
917
|
+
let { error: d, errorUpdatedAt: g, status: p } = c;
|
|
917
918
|
f = c.data;
|
|
918
919
|
let m = !1;
|
|
919
920
|
if (t.placeholderData !== void 0 && f === void 0 && p === "pending") {
|
|
@@ -936,7 +937,7 @@ var mt = class extends j {
|
|
|
936
937
|
} catch (C) {
|
|
937
938
|
this.#n = C;
|
|
938
939
|
}
|
|
939
|
-
this.#n && (
|
|
940
|
+
this.#n && (d = this.#n, f = this.#f, g = Date.now(), p = "error");
|
|
940
941
|
const v = c.fetchStatus === "fetching", O = p === "pending", A = p === "error", I = O && v, T = f !== void 0, Q = {
|
|
941
942
|
status: p,
|
|
942
943
|
fetchStatus: c.fetchStatus,
|
|
@@ -947,7 +948,7 @@ var mt = class extends j {
|
|
|
947
948
|
isLoading: I,
|
|
948
949
|
data: f,
|
|
949
950
|
dataUpdatedAt: c.dataUpdatedAt,
|
|
950
|
-
error:
|
|
951
|
+
error: d,
|
|
951
952
|
errorUpdatedAt: g,
|
|
952
953
|
failureCount: c.fetchFailureCount,
|
|
953
954
|
failureReason: c.fetchFailureReason,
|
|
@@ -1055,7 +1056,7 @@ function ve(e) {
|
|
|
1055
1056
|
onFetch: (t, s) => {
|
|
1056
1057
|
const r = t.options, i = t.fetchOptions?.meta?.fetchMore?.direction, n = t.state.data?.pages || [], o = t.state.data?.pageParams || [];
|
|
1057
1058
|
let a = { pages: [], pageParams: [] }, u = 0;
|
|
1058
|
-
const
|
|
1059
|
+
const y = async () => {
|
|
1059
1060
|
let c = !1;
|
|
1060
1061
|
const l = (g) => {
|
|
1061
1062
|
ht(
|
|
@@ -1063,7 +1064,7 @@ function ve(e) {
|
|
|
1063
1064
|
() => t.signal,
|
|
1064
1065
|
() => c = !0
|
|
1065
1066
|
);
|
|
1066
|
-
}, f = Ue(t.options, t.fetchOptions),
|
|
1067
|
+
}, f = Ue(t.options, t.fetchOptions), d = async (g, p, m) => {
|
|
1067
1068
|
if (c)
|
|
1068
1069
|
return Promise.reject();
|
|
1069
1070
|
if (p == null && g.pages.length)
|
|
@@ -1088,20 +1089,20 @@ function ve(e) {
|
|
|
1088
1089
|
pages: n,
|
|
1089
1090
|
pageParams: o
|
|
1090
1091
|
}, v = p(r, m);
|
|
1091
|
-
a = await
|
|
1092
|
+
a = await d(m, v, g);
|
|
1092
1093
|
} else {
|
|
1093
1094
|
const g = e ?? n.length;
|
|
1094
1095
|
do {
|
|
1095
1096
|
const p = u === 0 ? o[0] ?? r.initialPageParam : be(r, a);
|
|
1096
1097
|
if (u > 0 && p == null)
|
|
1097
1098
|
break;
|
|
1098
|
-
a = await
|
|
1099
|
+
a = await d(a, p), u++;
|
|
1099
1100
|
} while (u < g);
|
|
1100
1101
|
}
|
|
1101
1102
|
return a;
|
|
1102
1103
|
};
|
|
1103
1104
|
t.options.persister ? t.fetchFn = () => t.options.persister?.(
|
|
1104
|
-
|
|
1105
|
+
y,
|
|
1105
1106
|
{
|
|
1106
1107
|
client: t.client,
|
|
1107
1108
|
queryKey: t.queryKey,
|
|
@@ -1109,7 +1110,7 @@ function ve(e) {
|
|
|
1109
1110
|
signal: t.signal
|
|
1110
1111
|
},
|
|
1111
1112
|
s
|
|
1112
|
-
) : t.fetchFn =
|
|
1113
|
+
) : t.fetchFn = y;
|
|
1113
1114
|
}
|
|
1114
1115
|
};
|
|
1115
1116
|
}
|
|
@@ -2065,11 +2066,11 @@ class qt {
|
|
|
2065
2066
|
args: u,
|
|
2066
2067
|
resolve: () => {
|
|
2067
2068
|
}
|
|
2068
|
-
}), this.fallbacks[a](...u)) : (...u) => new Promise((
|
|
2069
|
+
}), this.fallbacks[a](...u)) : (...u) => new Promise((y) => {
|
|
2069
2070
|
this.targetQueue.push({
|
|
2070
2071
|
method: a,
|
|
2071
2072
|
args: u,
|
|
2072
|
-
resolve:
|
|
2073
|
+
resolve: y
|
|
2073
2074
|
});
|
|
2074
2075
|
})
|
|
2075
2076
|
});
|
|
@@ -2533,11 +2534,11 @@ function Nt(e, t, s) {
|
|
|
2533
2534
|
const a = i[o];
|
|
2534
2535
|
let u = Oe(a.itemValue, t, s);
|
|
2535
2536
|
const {
|
|
2536
|
-
minRanking:
|
|
2537
|
+
minRanking: y,
|
|
2537
2538
|
maxRanking: c,
|
|
2538
2539
|
threshold: l = s.threshold
|
|
2539
2540
|
} = a.attributes;
|
|
2540
|
-
u <
|
|
2541
|
+
u < y && u >= S.MATCHES ? u = y : u > c && (u = c), u = Math.min(u, c), u >= l && u > n.rank && (n.rank = u, n.passed = !0, n.accessorIndex = o, n.accessorThreshold = l, n.rankedValue = a.itemValue);
|
|
2541
2542
|
}
|
|
2542
2543
|
return n;
|
|
2543
2544
|
}
|
|
@@ -2554,21 +2555,21 @@ function Ht(e) {
|
|
|
2554
2555
|
}
|
|
2555
2556
|
function Lt(e, t) {
|
|
2556
2557
|
let s = 0, r = 0;
|
|
2557
|
-
function i(u,
|
|
2558
|
-
for (let l = c, f =
|
|
2559
|
-
if (
|
|
2558
|
+
function i(u, y, c) {
|
|
2559
|
+
for (let l = c, f = y.length; l < f; l++)
|
|
2560
|
+
if (y[l] === u)
|
|
2560
2561
|
return s += 1, l + 1;
|
|
2561
2562
|
return -1;
|
|
2562
2563
|
}
|
|
2563
2564
|
function n(u) {
|
|
2564
|
-
const
|
|
2565
|
-
return S.MATCHES + c *
|
|
2565
|
+
const y = 1 / u, c = s / t.length;
|
|
2566
|
+
return S.MATCHES + c * y;
|
|
2566
2567
|
}
|
|
2567
2568
|
const o = i(t[0], e, 0);
|
|
2568
2569
|
if (o < 0)
|
|
2569
2570
|
return S.NO_MATCH;
|
|
2570
2571
|
r = o;
|
|
2571
|
-
for (let u = 1,
|
|
2572
|
+
for (let u = 1, y = t.length; u < y; u++) {
|
|
2572
2573
|
const c = t[u];
|
|
2573
2574
|
if (r = i(c, e, r), !(r > -1))
|
|
2574
2575
|
return S.NO_MATCH;
|
|
@@ -2592,7 +2593,7 @@ function Kt(e, t) {
|
|
|
2592
2593
|
const s = [];
|
|
2593
2594
|
for (let r = 0, i = t.length; r < i; r++) {
|
|
2594
2595
|
const n = t[r], o = Gt(n), a = Vt(e, n);
|
|
2595
|
-
for (let u = 0,
|
|
2596
|
+
for (let u = 0, y = a.length; u < y; u++)
|
|
2596
2597
|
s.push({
|
|
2597
2598
|
itemValue: a[u],
|
|
2598
2599
|
attributes: o
|
|
@@ -2869,9 +2870,9 @@ function Jt(e, t, s) {
|
|
|
2869
2870
|
'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.'
|
|
2870
2871
|
));
|
|
2871
2872
|
const r = s || Ve(), i = Ae(() => {
|
|
2872
|
-
let
|
|
2873
|
-
typeof
|
|
2874
|
-
const g = h(
|
|
2873
|
+
let d = t;
|
|
2874
|
+
typeof d == "function" && (d = d());
|
|
2875
|
+
const g = h(d);
|
|
2875
2876
|
typeof g.enabled == "function" && (g.enabled = g.enabled());
|
|
2876
2877
|
const p = r.defaultQueryOptions(g);
|
|
2877
2878
|
return p._optimisticResults = r.isRestoring?.value ? "isRestoring" : "optimistic", p;
|
|
@@ -2880,8 +2881,8 @@ function Jt(e, t, s) {
|
|
|
2880
2881
|
};
|
|
2881
2882
|
r.isRestoring && k(
|
|
2882
2883
|
r.isRestoring,
|
|
2883
|
-
(
|
|
2884
|
-
|
|
2884
|
+
(d) => {
|
|
2885
|
+
d || (a(), a = n.subscribe((g) => {
|
|
2885
2886
|
re(o, g);
|
|
2886
2887
|
}));
|
|
2887
2888
|
},
|
|
@@ -2893,8 +2894,8 @@ function Jt(e, t, s) {
|
|
|
2893
2894
|
k(i, u), Ie(() => {
|
|
2894
2895
|
a();
|
|
2895
2896
|
});
|
|
2896
|
-
const
|
|
2897
|
-
(
|
|
2897
|
+
const y = (...d) => (u(), o.refetch(...d)), c = () => new Promise(
|
|
2898
|
+
(d, g) => {
|
|
2898
2899
|
let p = () => {
|
|
2899
2900
|
};
|
|
2900
2901
|
const m = () => {
|
|
@@ -2903,12 +2904,12 @@ function Jt(e, t, s) {
|
|
|
2903
2904
|
const v = n.getOptimisticResult(
|
|
2904
2905
|
i.value
|
|
2905
2906
|
);
|
|
2906
|
-
v.isStale ? (p(), n.fetchOptimistic(i.value).then(
|
|
2907
|
+
v.isStale ? (p(), n.fetchOptimistic(i.value).then(d, (O) => {
|
|
2907
2908
|
Z(i.value.throwOnError, [
|
|
2908
2909
|
O,
|
|
2909
2910
|
n.getCurrentQuery()
|
|
2910
|
-
]) ? g(O) :
|
|
2911
|
-
})) : (p(),
|
|
2911
|
+
]) ? g(O) : d(n.getCurrentResult());
|
|
2912
|
+
})) : (p(), d(v));
|
|
2912
2913
|
}
|
|
2913
2914
|
};
|
|
2914
2915
|
m(), p = k(i, m);
|
|
@@ -2916,18 +2917,18 @@ function Jt(e, t, s) {
|
|
|
2916
2917
|
);
|
|
2917
2918
|
k(
|
|
2918
2919
|
() => o.error,
|
|
2919
|
-
(
|
|
2920
|
+
(d) => {
|
|
2920
2921
|
if (o.isError && !o.isFetching && Z(i.value.throwOnError, [
|
|
2921
|
-
|
|
2922
|
+
d,
|
|
2922
2923
|
n.getCurrentQuery()
|
|
2923
2924
|
]))
|
|
2924
|
-
throw
|
|
2925
|
+
throw d;
|
|
2925
2926
|
}
|
|
2926
2927
|
);
|
|
2927
2928
|
const l = i.value.shallow ? Te(o) : De(o), f = Fe(l);
|
|
2928
|
-
for (const
|
|
2929
|
-
typeof o[
|
|
2930
|
-
return f.suspense = c, f.refetch =
|
|
2929
|
+
for (const d in o)
|
|
2930
|
+
typeof o[d] == "function" && (f[d] = o[d]);
|
|
2931
|
+
return f.suspense = c, f.refetch = y, f;
|
|
2931
2932
|
}
|
|
2932
2933
|
function ns(e, t) {
|
|
2933
2934
|
return Jt(mt, e, t);
|
|
@@ -2950,7 +2951,7 @@ function os(e, t) {
|
|
|
2950
2951
|
}), Ie(() => {
|
|
2951
2952
|
o();
|
|
2952
2953
|
});
|
|
2953
|
-
const u = r.value.shallow ? Te(n) : De(n),
|
|
2954
|
+
const u = r.value.shallow ? Te(n) : De(n), y = Fe(u);
|
|
2954
2955
|
return k(
|
|
2955
2956
|
() => n.error,
|
|
2956
2957
|
(c) => {
|
|
@@ -2958,7 +2959,7 @@ function os(e, t) {
|
|
|
2958
2959
|
throw c;
|
|
2959
2960
|
}
|
|
2960
2961
|
), {
|
|
2961
|
-
...
|
|
2962
|
+
...y,
|
|
2962
2963
|
mutate: a,
|
|
2963
2964
|
mutateAsync: n.mutate,
|
|
2964
2965
|
reset: n.reset
|
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.22",
|
|
5
5
|
"author": "Alexandr Dergunov <dergunovs@mail.ru> (https://github.com/dergunovs)",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"type": "module",
|
|
@@ -24,48 +24,48 @@
|
|
|
24
24
|
"test:cov": "vitest run --coverage"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@tanstack/vue-query": "5.92.
|
|
27
|
+
"@tanstack/vue-query": "5.92.6",
|
|
28
28
|
"@vueuse/core": "14.1.0",
|
|
29
29
|
"@vueuse/integrations": "14.1.0",
|
|
30
30
|
"async-validator": "4.2.5",
|
|
31
31
|
"axios": "1.13.2",
|
|
32
|
-
"vue": "3.6.0-beta.
|
|
32
|
+
"vue": "3.6.0-beta.3",
|
|
33
33
|
"vue-router": "4.6.4"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@eslint/js": "9.39.2",
|
|
37
|
-
"@types/node": "25.0.
|
|
37
|
+
"@types/node": "25.0.9",
|
|
38
38
|
"@vitejs/plugin-vue": "6.0.3",
|
|
39
|
-
"@vitest/coverage-v8": "4.0.
|
|
39
|
+
"@vitest/coverage-v8": "4.0.17",
|
|
40
40
|
"eslint": "9.39.2",
|
|
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",
|
|
44
|
-
"eslint-plugin-prettier": "5.5.
|
|
44
|
+
"eslint-plugin-prettier": "5.5.5",
|
|
45
45
|
"eslint-plugin-sonarjs": "3.0.5",
|
|
46
46
|
"eslint-plugin-unicorn": "62.0.0",
|
|
47
47
|
"eslint-plugin-vue": "10.6.2",
|
|
48
48
|
"globals": "17.0.0",
|
|
49
|
-
"happy-dom": "20.0
|
|
50
|
-
"postcss-html": "1.8.
|
|
51
|
-
"prettier": "3.
|
|
52
|
-
"stylelint": "
|
|
49
|
+
"happy-dom": "20.3.0",
|
|
50
|
+
"postcss-html": "1.8.1",
|
|
51
|
+
"prettier": "3.8.0",
|
|
52
|
+
"stylelint": "17.0.0",
|
|
53
53
|
"stylelint-config-recess-order": "7.4.0",
|
|
54
|
-
"stylelint-config-recommended-scss": "
|
|
54
|
+
"stylelint-config-recommended-scss": "17.0.0",
|
|
55
55
|
"stylelint-config-recommended-vue": "1.6.1",
|
|
56
56
|
"stylelint-order": "7.0.1",
|
|
57
57
|
"stylelint-prettier": "5.0.3",
|
|
58
58
|
"typescript": "5.9.3",
|
|
59
|
-
"typescript-eslint": "8.
|
|
59
|
+
"typescript-eslint": "8.53.0",
|
|
60
60
|
"vite": "7.3.1",
|
|
61
61
|
"vite-plugin-dts": "4.5.4",
|
|
62
|
-
"vitest": "4.0.
|
|
62
|
+
"vitest": "4.0.17",
|
|
63
63
|
"vue-eslint-parser": "10.2.0",
|
|
64
64
|
"vue-linters-config": "0.5.5",
|
|
65
65
|
"vue-tsc": "3.2.2"
|
|
66
66
|
},
|
|
67
67
|
"peerDependencies": {
|
|
68
|
-
"vue": "3.6.0-beta.
|
|
68
|
+
"vue": "3.6.0-beta.3",
|
|
69
69
|
"vue-router": "4.6.4"
|
|
70
70
|
},
|
|
71
71
|
"engines": {
|