mhz-helpers 1.4.30 → 1.4.32

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 CHANGED
@@ -1,2 +1,2 @@
1
- import { a as e, i as t, n, r, t as i } from "../api-gZT-_RKt.js";
1
+ import { a as e, i as t, n, r, t as i } from "../api-CaQgKkC8.js";
2
2
  export { i as api, n as deleteAuthHeader, r as handleError, t as setAuthHeader, e as setBaseURL };
@@ -538,7 +538,13 @@ function it(e, t) {
538
538
  var B = class e extends Error {
539
539
  static from(t, n, r, i, a, o) {
540
540
  let s = new e(t.message, n || t.code, r, i, a);
541
- return s.cause = t, s.name = t.name, t.status != null && s.status == null && (s.status = t.status), o && Object.assign(s, o), s;
541
+ return Object.defineProperty(s, "cause", {
542
+ __proto__: null,
543
+ value: t,
544
+ writable: !0,
545
+ enumerable: !1,
546
+ configurable: !0
547
+ }), s.name = t.name, t.status != null && s.status == null && (s.status = t.status), o && Object.assign(s, o), s;
542
548
  }
543
549
  constructor(e, t, n, r, i) {
544
550
  super(e), Object.defineProperty(this, "message", {
@@ -600,7 +606,12 @@ function V(e, t, n) {
600
606
  if (L.isDate(e)) return e.toISOString();
601
607
  if (L.isBoolean(e)) return e.toString();
602
608
  if (!l && L.isBlob(e)) throw new B("Blob is not supported. Use a Buffer instead.");
603
- return L.isArrayBuffer(e) || L.isTypedArray(e) ? l && typeof Blob == "function" ? new Blob([e]) : Buffer.from(e) : e;
609
+ if (L.isArrayBuffer(e) || L.isTypedArray(e)) {
610
+ if (l && typeof s == "function") return new s([e]);
611
+ if (typeof Buffer < "u") return Buffer.from(e);
612
+ throw new B("Blob is not supported. Use a Buffer instead.", B.ERR_NOT_SUPPORT);
613
+ }
614
+ return e;
604
615
  }
605
616
  function f(e) {
606
617
  if (e > c) throw new B("Object is too deeply nested (" + e + " levels). Max depth: " + c, B.ERR_FORM_DATA_DEPTH_EXCEEDED);
@@ -663,9 +674,7 @@ var ft = dt.prototype;
663
674
  ft.append = function(e, t) {
664
675
  this._pairs.push([e, t]);
665
676
  }, ft.toString = function(e) {
666
- let t = e ? function(t) {
667
- return e.call(this, t, ut);
668
- } : ut;
677
+ let t = e ? (t) => e.call(this, t, ut) : ut;
669
678
  return this._pairs.map(function(e) {
670
679
  return t(e[0]) + "=" + t(e[1]);
671
680
  }, "").join("&");
@@ -677,6 +686,7 @@ function pt(e) {
677
686
  }
678
687
  function mt(e, t, n) {
679
688
  if (!t) return e;
689
+ e ||= "";
680
690
  let r = L.isFunction(n) ? { serialize: n } : n, i = L.getSafeProp(r, "encode") || pt, a = L.getSafeProp(r, "serialize"), o;
681
691
  if (o = a ? a(t, r) : L.isURLSearchParams(t) ? t.toString() : new dt(t, r).toString(i), o) {
682
692
  let t = e.indexOf("#");
@@ -960,7 +970,11 @@ var K = (e, t, n = 3) => {
960
970
  let t = document.cookie.split(";");
961
971
  for (let n = 0; n < t.length; n++) {
962
972
  let r = t[n].replace(/^\s+/, ""), i = r.indexOf("=");
963
- if (i !== -1 && r.slice(0, i) === e) return decodeURIComponent(r.slice(i + 1));
973
+ if (i !== -1 && r.slice(0, i) === e) try {
974
+ return decodeURIComponent(r.slice(i + 1));
975
+ } catch {
976
+ return r.slice(i + 1);
977
+ }
964
978
  }
965
979
  return null;
966
980
  },
@@ -977,7 +991,7 @@ var K = (e, t, n = 3) => {
977
991
  //#endregion
978
992
  //#region ../../node_modules/axios/lib/helpers/isAbsoluteURL.js
979
993
  function Vt(e) {
980
- return typeof e == "string" ? /^([a-z][a-z\d+\-.]*:)?\/\//i.test(e) : !1;
994
+ return typeof e == "string" && /^([a-z][a-z\d+\-.]*:)?\/\//i.test(e);
981
995
  }
982
996
  //#endregion
983
997
  //#region ../../node_modules/axios/lib/helpers/combineURLs.js
@@ -1007,7 +1021,7 @@ function Jt(e, t, n, r) {
1007
1021
  //#region ../../node_modules/axios/lib/core/mergeConfig.js
1008
1022
  var Yt = (e) => e instanceof z ? { ...e } : e;
1009
1023
  function q(e, t) {
1010
- t ||= {};
1024
+ e ||= {}, t ||= {};
1011
1025
  let n = Object.create(null);
1012
1026
  Object.defineProperty(n, "hasOwnProperty", {
1013
1027
  __proto__: null,
@@ -1091,7 +1105,7 @@ function Zt(e, t, n) {
1091
1105
  e.set(t);
1092
1106
  return;
1093
1107
  }
1094
- Object.entries(t).forEach(([t, n]) => {
1108
+ Object.entries(t || {}).forEach(([t, n]) => {
1095
1109
  Xt.includes(t.toLowerCase()) && e.set(t, n);
1096
1110
  });
1097
1111
  }
@@ -1099,8 +1113,12 @@ var Qt = (e) => encodeURIComponent(e).replace(/%([0-9A-F]{2})/gi, (e, t) => Stri
1099
1113
  function $t(e) {
1100
1114
  let t = q({}, e), n = (e) => L.hasOwnProp(t, e) ? t[e] : void 0, r = n("data"), i = n("withXSRFToken"), a = n("xsrfHeaderName"), o = n("xsrfCookieName"), s = n("headers"), c = n("auth"), l = n("baseURL"), u = n("allowAbsoluteUrls"), d = n("url");
1101
1115
  if (t.headers = s = z.from(s), t.url = mt(Jt(l, d, u, t), n("params"), n("paramsSerializer")), c) {
1102
- let e = L.getSafeProp(c, "username") || "", t = L.getSafeProp(c, "password") || "";
1103
- s.set("Authorization", "Basic " + btoa(e + ":" + (t ? Qt(t) : "")));
1116
+ let t = L.getSafeProp(c, "username") || "", n = L.getSafeProp(c, "password") || "";
1117
+ try {
1118
+ s.set("Authorization", "Basic " + btoa(t + ":" + (n ? Qt(n) : "")));
1119
+ } catch (t) {
1120
+ throw B.from(t, B.ERR_BAD_OPTION_VALUE, e);
1121
+ }
1104
1122
  }
1105
1123
  if (L.isFormData(r) && (H.hasStandardBrowserEnv || H.hasStandardBrowserWebWorkerEnv || L.isReactNative(r) ? s.setContentType(void 0) : L.isFunction(r.getHeaders) && Zt(s, r.getHeaders(), n("formDataHeaderPolicy"))), H.hasStandardBrowserEnv && (L.isFunction(i) && (i = i(t)), i === !0 || i == null && zt(t.url))) {
1106
1124
  let e = a && o && Bt.read(o);
@@ -1149,7 +1167,7 @@ var en = typeof XMLHttpRequest < "u" && function(e) {
1149
1167
  }, r.cancelToken && r.cancelToken.subscribe(l), r.signal && (r.signal.aborted ? l() : r.signal.addEventListener("abort", l)));
1150
1168
  let _ = Pt(r.url);
1151
1169
  if (_ && !H.protocols.includes(_)) {
1152
- n(new B("Unsupported protocol " + _ + ":", B.ERR_BAD_REQUEST, e));
1170
+ n(new B("Unsupported protocol " + _ + ":", B.ERR_BAD_REQUEST, e)), m();
1153
1171
  return;
1154
1172
  }
1155
1173
  h.send(i || null);
@@ -1169,7 +1187,7 @@ var en = typeof XMLHttpRequest < "u" && function(e) {
1169
1187
  e.unsubscribe ? e.unsubscribe(i) : e.removeEventListener("abort", i);
1170
1188
  }), null);
1171
1189
  };
1172
- e.forEach((e) => e.addEventListener("abort", i));
1190
+ e.forEach((e) => e.addEventListener("abort", i, { once: !0 }));
1173
1191
  let { signal: s } = n;
1174
1192
  return s.unsubscribe = () => L.asap(o), s;
1175
1193
  }, nn = function* (e, t) {
@@ -1251,7 +1269,7 @@ function cn(e) {
1251
1269
  }
1252
1270
  //#endregion
1253
1271
  //#region ../../node_modules/axios/lib/env/data.js
1254
- var ln = "1.18.0", un = 64 * 1024, { isFunction: Y } = L, dn = (e) => encodeURIComponent(e).replace(/%([0-9A-F]{2})/gi, (e, t) => String.fromCharCode(parseInt(t, 16))), fn = (e) => {
1272
+ var ln = "1.18.1", un = 64 * 1024, { isFunction: Y } = L, dn = (e) => encodeURIComponent(e).replace(/%([0-9A-F]{2})/gi, (e, t) => String.fromCharCode(parseInt(t, 16))), fn = (e) => {
1255
1273
  if (!L.isString(e)) return e;
1256
1274
  try {
1257
1275
  return decodeURIComponent(e);
@@ -1408,9 +1426,27 @@ var ln = "1.18.0", un = 64 * 1024, { isFunction: Y } = L, dn = (e) => encodeURIC
1408
1426
  } catch (t) {
1409
1427
  if (A && A(), O && O.aborted && O.reason instanceof B) {
1410
1428
  let n = O.reason;
1411
- throw n.config = e, k && (n.request = k), t !== n && (n.cause = t), n;
1429
+ throw n.config = e, k && (n.request = k), t !== n && Object.defineProperty(n, "cause", {
1430
+ __proto__: null,
1431
+ value: t,
1432
+ writable: !0,
1433
+ enumerable: !1,
1434
+ configurable: !0
1435
+ }), n;
1436
+ }
1437
+ if (M) throw k && !M.request && (M.request = k), M;
1438
+ if (t instanceof B) throw k && !t.request && (t.request = k), t;
1439
+ if (t && t.name === "TypeError" && /Load failed|fetch/i.test(t.message)) {
1440
+ let n = new B("Network Error", B.ERR_NETWORK, e, k, t && t.response);
1441
+ throw Object.defineProperty(n, "cause", {
1442
+ __proto__: null,
1443
+ value: t.cause || t,
1444
+ writable: !0,
1445
+ enumerable: !1,
1446
+ configurable: !0
1447
+ }), n;
1412
1448
  }
1413
- throw M ? (k && !M.request && (M.request = k), M) : t instanceof B ? (k && !t.request && (t.request = k), t) : t && t.name === "TypeError" && /Load failed|fetch/i.test(t.message) ? Object.assign(new B("Network Error", B.ERR_NETWORK, e, k, t && t.response), { cause: t.cause || t }) : B.from(t, t && t.code, e, k, t && t.response);
1449
+ throw B.from(t, t && t.code, e, k, t && t.response);
1414
1450
  }
1415
1451
  };
1416
1452
  }, gn = /* @__PURE__ */ new Map(), _n = (e) => {
@@ -1457,7 +1493,7 @@ function xn(e, t) {
1457
1493
  }
1458
1494
  if (!i) {
1459
1495
  let e = Object.entries(a).map(([e, t]) => `adapter ${e} ` + (t === !1 ? "is not supported by the environment" : "is not available in the build"));
1460
- throw new B("There is no suitable adapter to dispatch the request " + (n ? e.length > 1 ? "since :\n" + e.map(yn).join("\n") : " " + yn(e[0]) : "as no adapter specified"), "ERR_NOT_SUPPORT");
1496
+ throw new B("There is no suitable adapter to dispatch the request " + (n ? e.length > 1 ? "since :\n" + e.map(yn).join("\n") : " " + yn(e[0]) : "as no adapter specified"), B.ERR_NOT_SUPPORT);
1461
1497
  }
1462
1498
  return i;
1463
1499
  }
@@ -1518,13 +1554,13 @@ Tn.transitional = function(e, t, n) {
1518
1554
  }
1519
1555
  return (n, i, a) => {
1520
1556
  if (e === !1) throw new B(r(i, " has been removed" + (t ? " in " + t : "")), B.ERR_DEPRECATED);
1521
- return t && !En[i] && (En[i] = !0, console.warn(r(i, " has been deprecated since v" + t + " and will be removed in the near future"))), e ? e(n, i, a) : !0;
1557
+ return t && !En[i] && (En[i] = !0, console.warn(r(i, " has been deprecated since v" + t + " and will be removed in the near future"))), !e || e(n, i, a);
1522
1558
  };
1523
1559
  }, Tn.spelling = function(e) {
1524
1560
  return (t, n) => (console.warn(`${n} is likely a misspelling of ${e}`), !0);
1525
1561
  };
1526
1562
  function Dn(e, t, n) {
1527
- if (typeof e != "object") throw new B("options must be an object", B.ERR_BAD_OPTION_VALUE);
1563
+ if (typeof e != "object" || !e) throw new B("options must be an object", B.ERR_BAD_OPTION_VALUE);
1528
1564
  let r = Object.keys(e), i = r.length;
1529
1565
  for (; i-- > 0;) {
1530
1566
  let a = r[i], o = Object.prototype.hasOwnProperty.call(t, a) ? t[a] : void 0;
@@ -1,4 +1,4 @@
1
- import { n as e, o as t, r as n, s as r } from "../api-gZT-_RKt.js";
1
+ import { n as e, o as t, r as n, s as r } from "../api-CaQgKkC8.js";
2
2
  import { logout as i } from "../useAuth/index.js";
3
3
  import * as a from "vue";
4
4
  //#region ../../node_modules/@tanstack/query-core/build/modern/subscribable.js
@@ -336,7 +336,7 @@ function ue(e) {
336
336
  return Math.min(1e3 * 2 ** e, 3e4);
337
337
  }
338
338
  function de(e) {
339
- return (e ?? "online") === "online" ? M.isOnline() : !0;
339
+ return (e ?? "online") !== "online" || M.isOnline();
340
340
  }
341
341
  var N = class extends Error {
342
342
  constructor(e) {
@@ -426,7 +426,7 @@ function me(e) {
426
426
  }, u = oe(t.options, t.fetchOptions), d = async (e, r, i) => {
427
427
  if (n) return Promise.reject(t.signal.reason);
428
428
  if (r == null && e.pages.length) return Promise.resolve(e);
429
- let a = await u((() => {
429
+ let a = (() => {
430
430
  let e = {
431
431
  client: t.client,
432
432
  queryKey: t.queryKey,
@@ -435,10 +435,10 @@ function me(e) {
435
435
  meta: t.options.meta
436
436
  };
437
437
  return l(e), e;
438
- })()), { maxPages: o } = t.options, s = i ? ae : ie;
438
+ })(), o = await u(a), { maxPages: s } = t.options, c = i ? ae : ie;
439
439
  return {
440
- pages: s(e.pages, a, o),
441
- pageParams: s(e.pageParams, r, o)
440
+ pages: c(e.pages, o, s),
441
+ pageParams: c(e.pageParams, r, s)
442
442
  };
443
443
  };
444
444
  if (i && a.length) {
@@ -545,7 +545,7 @@ var ge = class extends pe {
545
545
  return this.state.dataUpdateCount + this.state.errorUpdateCount > 0;
546
546
  }
547
547
  isStatic() {
548
- return this.getObserversCount() > 0 ? this.observers.some((e) => g(e.options.staleTime, this) === "static") : !1;
548
+ return this.getObserversCount() > 0 && this.observers.some((e) => g(e.options.staleTime, this) === "static");
549
549
  }
550
550
  isStale() {
551
551
  return this.getObserversCount() > 0 ? this.observers.some((e) => e.getCurrentResult().isStale) : this.state.data === void 0 || this.state.isInvalidated;
@@ -939,7 +939,8 @@ var _e = class extends o {
939
939
  let t = S.data !== void 0, r = S.status === "error" && !t, i = (e) => {
940
940
  r ? e.reject(S.error) : t && e.resolve(S.data);
941
941
  }, a = () => {
942
- i(this.#o = S.promise = A());
942
+ let e = this.#o = S.promise = A();
943
+ i(e);
943
944
  }, o = this.#o;
944
945
  switch (o.status) {
945
946
  case "pending":
@@ -6,7 +6,7 @@ function a(e) {
6
6
  return `[data-test="${e}"]`;
7
7
  }
8
8
  var o = (e) => {
9
- e.type === 1 && "props" in e && (e.props = e.props.filter((e) => e.type === 6 ? e.name !== "data-test" : !0));
9
+ e.type === 1 && "props" in e && (e.props = e.props.filter((e) => e.type !== 6 || e.name !== "data-test"));
10
10
  };
11
11
  async function s(e) {
12
12
  await new Promise((t) => {
@@ -325,7 +325,7 @@ var N = function(e, t, n, r, i, a) {
325
325
  return typeof e.getTime == "function" && typeof e.getMonth == "function" && typeof e.getYear == "function" && !isNaN(e.getTime());
326
326
  },
327
327
  number: function(e) {
328
- return isNaN(e) ? !1 : typeof e == "number";
328
+ return !isNaN(e) && typeof e == "number";
329
329
  },
330
330
  object: function(e) {
331
331
  return typeof e == "object" && !L.array(e);
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.4.30",
4
+ "version": "1.4.32",
5
5
  "author": "Alexandr Dergunov <dergunovs@mail.ru> (https://github.com/dergunovs)",
6
6
  "license": "MIT",
7
7
  "type": "module",
@@ -24,52 +24,52 @@
24
24
  "test:cov": "NODE_OPTIONS='--no-experimental-webstorage' vitest run --coverage"
25
25
  },
26
26
  "dependencies": {
27
- "@tanstack/vue-query": "5.101.0",
27
+ "@tanstack/vue-query": "5.101.2",
28
28
  "@vueuse/core": "14.3.0",
29
29
  "@vueuse/integrations": "14.3.0",
30
30
  "async-validator": "4.2.5",
31
- "axios": "1.18.0",
32
- "vue": "3.6.0-beta.16",
31
+ "axios": "1.18.1",
32
+ "vue": "3.6.0-beta.17",
33
33
  "vue-router": "5.1.0"
34
34
  },
35
35
  "devDependencies": {
36
36
  "@eslint/js": "10.0.1",
37
- "@types/node": "26.0.0",
37
+ "@types/node": "26.1.1",
38
38
  "@vitejs/plugin-vue": "6.0.7",
39
- "@vitest/coverage-v8": "4.1.9",
40
- "eslint": "10.5.0",
39
+ "@vitest/coverage-v8": "4.1.10",
40
+ "eslint": "10.6.0",
41
41
  "eslint-config-prettier": "10.1.8",
42
42
  "eslint-import-resolver-typescript": "4.4.5",
43
- "eslint-plugin-import-x": "4.16.2",
43
+ "eslint-plugin-import-x": "4.17.1",
44
44
  "eslint-plugin-prettier": "5.5.6",
45
45
  "eslint-plugin-sonarjs": "4.1.0",
46
- "eslint-plugin-unicorn": "68.0.0",
46
+ "eslint-plugin-unicorn": "69.0.0",
47
47
  "eslint-plugin-vue": "10.9.2",
48
- "globals": "17.6.0",
48
+ "globals": "17.7.0",
49
49
  "happy-dom": "20.10.6",
50
50
  "postcss-html": "1.8.1",
51
- "prettier": "3.8.4",
52
- "stylelint": "17.13.0",
51
+ "prettier": "3.9.4",
52
+ "stylelint": "17.14.0",
53
53
  "stylelint-config-recess-order": "7.7.0",
54
54
  "stylelint-config-recommended-scss": "17.0.1",
55
55
  "stylelint-config-recommended-vue": "1.6.1",
56
56
  "stylelint-order": "8.1.1",
57
57
  "stylelint-prettier": "5.0.3",
58
58
  "typescript": "6.0.3",
59
- "typescript-eslint": "8.61.1",
60
- "vite": "8.0.16",
61
- "vite-plugin-dts": "5.0.2",
62
- "vitest": "4.1.9",
59
+ "typescript-eslint": "8.63.0",
60
+ "vite": "8.1.4",
61
+ "vite-plugin-dts": "5.0.3",
62
+ "vitest": "4.1.10",
63
63
  "vue-eslint-parser": "10.4.1",
64
- "vue-linters-config": "0.5.8",
65
- "vue-tsc": "3.3.5"
64
+ "vue-linters-config": "0.5.9",
65
+ "vue-tsc": "3.3.7"
66
66
  },
67
67
  "peerDependencies": {
68
- "vue": "3.6.0-beta.16",
68
+ "vue": "3.6.0-beta.17",
69
69
  "vue-router": "5.1.0"
70
70
  },
71
71
  "engines": {
72
72
  "npm": ">=11.7.0",
73
- "node": ">=25.4.0"
73
+ "node": ">=26.5.0"
74
74
  }
75
75
  }