mhz-helpers 1.0.41 → 1.0.43

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.
Files changed (2) hide show
  1. package/dist/index.js +32 -30
  2. package/package.json +20 -20
package/dist/index.js CHANGED
@@ -2504,7 +2504,7 @@ function vn(t, e) {
2504
2504
  return e;
2505
2505
  }
2506
2506
  function ve(t, e) {
2507
- if (t && !e || e && !t)
2507
+ if (!e || Object.keys(t).length !== Object.keys(e).length)
2508
2508
  return !1;
2509
2509
  for (const n in t)
2510
2510
  if (t[n] !== e[n])
@@ -2746,9 +2746,6 @@ var T = Zs(), En = class {
2746
2746
  this.#e && (clearTimeout(this.#e), this.#e = void 0);
2747
2747
  }
2748
2748
  }, ei = class extends En {
2749
- constructor(t) {
2750
- super(), this.#u = !1, this.#o = t.defaultOptions, this.#c(t.options), this.#i = [], this.#n = t.cache, this.queryKey = t.queryKey, this.queryHash = t.queryHash, this.#e = t.state || ti(this.options), this.state = this.#e, this.scheduleGc();
2751
- }
2752
2749
  #e;
2753
2750
  #t;
2754
2751
  #n;
@@ -2757,6 +2754,9 @@ var T = Zs(), En = class {
2757
2754
  #i;
2758
2755
  #o;
2759
2756
  #u;
2757
+ constructor(t) {
2758
+ super(), this.#u = !1, this.#o = t.defaultOptions, this.#c(t.options), this.#i = [], this.#n = t.cache, this.queryKey = t.queryKey, this.queryHash = t.queryHash, this.#e = t.state || ti(this.options), this.state = this.#e, this.scheduleGc();
2759
+ }
2760
2760
  get meta() {
2761
2761
  return this.options.meta;
2762
2762
  }
@@ -3073,13 +3073,13 @@ var Sn = class extends re {
3073
3073
  });
3074
3074
  }
3075
3075
  }, ni = class extends En {
3076
- constructor(t) {
3077
- super(), this.mutationId = t.mutationId, this.#t = t.defaultOptions, this.#n = t.mutationCache, this.#e = [], this.state = t.state || An(), this.setOptions(t.options), this.scheduleGc();
3078
- }
3079
3076
  #e;
3080
3077
  #t;
3081
3078
  #n;
3082
3079
  #r;
3080
+ constructor(t) {
3081
+ super(), this.mutationId = t.mutationId, this.#t = t.defaultOptions, this.#n = t.mutationCache, this.#e = [], this.state = t.state || An(), this.setOptions(t.options), this.scheduleGc();
3082
+ }
3083
3083
  setOptions(t) {
3084
3084
  this.options = { ...this.#t, ...t }, this.updateGcTime(this.options.gcTime);
3085
3085
  }
@@ -3432,7 +3432,8 @@ var ii = class {
3432
3432
  return this.#t.findAll({ ...e, status: "pending" }).length;
3433
3433
  }
3434
3434
  getQueryData(e) {
3435
- return this.#e.find({ queryKey: e })?.state.data;
3435
+ const n = this.defaultQueryOptions({ queryKey: e });
3436
+ return this.#e.get(n.queryHash)?.state.data;
3436
3437
  }
3437
3438
  ensureQueryData(e) {
3438
3439
  const n = this.getQueryData(e.queryKey);
@@ -3445,11 +3446,11 @@ var ii = class {
3445
3446
  });
3446
3447
  }
3447
3448
  setQueryData(e, n, r) {
3448
- const i = this.#e.find({ queryKey: e })?.state.data, o = Ks(n, i);
3449
- if (typeof o > "u")
3450
- return;
3451
- const a = this.defaultQueryOptions({ queryKey: e });
3452
- return this.#e.build(this, a).setData(o, { ...r, manual: !0 });
3449
+ const s = this.defaultQueryOptions({ queryKey: e }), o = this.#e.get(
3450
+ s.queryHash
3451
+ )?.state.data, a = Ks(n, o);
3452
+ if (!(typeof a > "u"))
3453
+ return this.#e.build(this, s).setData(a, { ...r, manual: !0 });
3453
3454
  }
3454
3455
  setQueriesData(e, n, r) {
3455
3456
  return T.batch(
@@ -3460,7 +3461,8 @@ var ii = class {
3460
3461
  );
3461
3462
  }
3462
3463
  getQueryState(e) {
3463
- return this.#e.find({ queryKey: e })?.state;
3464
+ const n = this.defaultQueryOptions({ queryKey: e });
3465
+ return this.#e.get(n.queryHash)?.state;
3464
3466
  }
3465
3467
  removeQueries(e) {
3466
3468
  const n = this.#e;
@@ -3567,11 +3569,11 @@ var ii = class {
3567
3569
  }), r;
3568
3570
  }
3569
3571
  defaultQueryOptions(e) {
3570
- if (e?._defaulted)
3572
+ if (e._defaulted)
3571
3573
  return e;
3572
3574
  const n = {
3573
3575
  ...this.#n.queries,
3574
- ...e?.queryKey && this.getQueryDefaults(e.queryKey),
3576
+ ...this.getQueryDefaults(e.queryKey),
3575
3577
  ...e,
3576
3578
  _defaulted: !0
3577
3579
  };
@@ -3639,13 +3641,13 @@ var ii = class {
3639
3641
  }
3640
3642
  setOptions(t, e) {
3641
3643
  const n = this.options, r = this.#t;
3642
- if (this.options = this.#e.defaultQueryOptions(t), ve(n, this.options) || this.#e.getQueryCache().notify({
3644
+ if (this.options = this.#e.defaultQueryOptions(t), typeof this.options.enabled < "u" && typeof this.options.enabled != "boolean")
3645
+ throw new Error("Expected enabled to be a boolean");
3646
+ this.#w(), ve(this.options, n) || this.#e.getQueryCache().notify({
3643
3647
  type: "observerOptionsUpdated",
3644
3648
  query: this.#t,
3645
3649
  observer: this
3646
- }), typeof this.options.enabled < "u" && typeof this.options.enabled != "boolean")
3647
- throw new Error("Expected enabled to be a boolean");
3648
- this.options.queryKey || (this.options.queryKey = n.queryKey), this.#w();
3650
+ });
3649
3651
  const s = this.hasListeners();
3650
3652
  s && Nt(
3651
3653
  this.#t,
@@ -3858,23 +3860,23 @@ function ui(t, e) {
3858
3860
  return !ve(t.getCurrentResult(), e);
3859
3861
  }
3860
3862
  var ci = class extends re {
3861
- constructor(t, e) {
3862
- super(), this.#t = void 0, this.#e = t, this.setOptions(e), this.bindMethods(), this.#s();
3863
- }
3864
3863
  #e;
3865
- #t;
3864
+ #t = void 0;
3866
3865
  #n;
3867
3866
  #r;
3867
+ constructor(t, e) {
3868
+ super(), this.#e = t, this.setOptions(e), this.bindMethods(), this.#s();
3869
+ }
3868
3870
  bindMethods() {
3869
3871
  this.mutate = this.mutate.bind(this), this.reset = this.reset.bind(this);
3870
3872
  }
3871
3873
  setOptions(t) {
3872
3874
  const e = this.options;
3873
- this.options = this.#e.defaultMutationOptions(t), ve(e, this.options) || this.#e.getMutationCache().notify({
3875
+ this.options = this.#e.defaultMutationOptions(t), ve(this.options, e) || this.#e.getMutationCache().notify({
3874
3876
  type: "observerOptionsUpdated",
3875
3877
  mutation: this.#n,
3876
3878
  observer: this
3877
- }), this.#n?.setOptions(this.options), e?.mutationKey && this.options.mutationKey && G(e.mutationKey) !== G(this.options.mutationKey) && this.reset();
3879
+ }), e?.mutationKey && this.options.mutationKey && G(e.mutationKey) !== G(this.options.mutationKey) ? this.reset() : this.#n?.setOptions(this.options);
3878
3880
  }
3879
3881
  onUnsubscribe() {
3880
3882
  this.hasListeners() || this.#n?.removeObserver(this);
@@ -4088,13 +4090,13 @@ function di() {
4088
4090
  return qn().__VUE_DEVTOOLS_GLOBAL_HOOK__;
4089
4091
  }
4090
4092
  function qn() {
4091
- return typeof navigator < "u" && typeof window < "u" ? window : typeof global < "u" ? global : {};
4093
+ return typeof navigator < "u" && typeof window < "u" ? window : typeof globalThis < "u" ? globalThis : {};
4092
4094
  }
4093
4095
  const pi = typeof Proxy == "function", yi = "devtools-plugin:setup", mi = "plugin:settings:set";
4094
4096
  let X, Ze;
4095
4097
  function gi() {
4096
4098
  var t;
4097
- return X !== void 0 || (typeof window < "u" && window.performance ? (X = !0, Ze = window.performance) : typeof global < "u" && (!((t = global.perf_hooks) === null || t === void 0) && t.performance) ? (X = !0, Ze = global.perf_hooks.performance) : X = !1), X;
4099
+ return X !== void 0 || (typeof window < "u" && window.performance ? (X = !0, Ze = window.performance) : typeof globalThis < "u" && (!((t = globalThis.perf_hooks) === null || t === void 0) && t.performance) ? (X = !0, Ze = globalThis.perf_hooks.performance) : X = !1), X;
4098
4100
  }
4099
4101
  function bi() {
4100
4102
  return gi() ? Ze.now() : Date.now();
@@ -4961,7 +4963,7 @@ var so = {
4961
4963
  };
4962
4964
  function Ni(t, e, n) {
4963
4965
  process.env.NODE_ENV === "development" && (kt() || console.warn(
4964
- 'vue-query composables like "useQuery()" should only be used inside a "setup()" function or a running effect scope. They might otherwise lead to memory leaks.'
4966
+ '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.'
4965
4967
  ));
4966
4968
  const r = n || Pn(), s = $(() => {
4967
4969
  const p = E(e);
@@ -5022,7 +5024,7 @@ function io(t, e) {
5022
5024
  }
5023
5025
  function oo(t, e) {
5024
5026
  process.env.NODE_ENV === "development" && (kt() || console.warn(
5025
- 'vue-query composables like "useQuery()" should only be used inside a "setup()" function or a running effect scope. They might otherwise lead to memory leaks.'
5027
+ '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.'
5026
5028
  ));
5027
5029
  const n = e || Pn(), r = $(() => n.defaultMutationOptions(E(t))), s = new ci(n, r.value), i = Bt(s.getCurrentResult()), o = s.subscribe((f) => {
5028
5030
  Xe(i, f);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mhz-helpers",
3
3
  "description": "9000 Mhz frontend helpers and composables",
4
- "version": "1.0.41",
4
+ "version": "1.0.43",
5
5
  "author": "Alexandr Dergunov <dergunovs@mail.ru> (https://github.com/dergunovs)",
6
6
  "license": "MIT",
7
7
  "type": "module",
@@ -22,41 +22,41 @@
22
22
  "ts": "vue-tsc --noEmit"
23
23
  },
24
24
  "dependencies": {
25
- "@tanstack/vue-query": "5.17.19",
26
- "@vueuse/core": "10.7.2",
27
- "@vueuse/integrations": "10.7.2",
25
+ "@tanstack/vue-query": "5.24.1",
26
+ "@vueuse/core": "10.9.0",
27
+ "@vueuse/integrations": "10.9.0",
28
28
  "async-validator": "4.2.5",
29
29
  "axios": "1.6.7",
30
- "vue": "3.4.15",
31
- "vue-router": "4.2.5"
30
+ "vue": "3.4.21",
31
+ "vue-router": "4.3.0"
32
32
  },
33
33
  "devDependencies": {
34
- "@types/node": "20.11.9",
35
- "@typescript-eslint/eslint-plugin": "6.19.1",
36
- "@typescript-eslint/parser": "6.19.1",
37
- "@vitejs/plugin-vue": "5.0.3",
38
- "eslint": "8.56.0",
34
+ "@types/node": "20.11.24",
35
+ "@typescript-eslint/eslint-plugin": "7.1.0",
36
+ "@typescript-eslint/parser": "7.1.0",
37
+ "@vitejs/plugin-vue": "5.0.4",
38
+ "eslint": "8.57.0",
39
39
  "eslint-config-prettier": "9.1.0",
40
40
  "eslint-import-resolver-typescript": "3.6.1",
41
41
  "eslint-plugin-import": "2.29.1",
42
42
  "eslint-plugin-prettier": "5.1.3",
43
- "eslint-plugin-vue": "9.20.1",
43
+ "eslint-plugin-vue": "9.22.0",
44
44
  "postcss-html": "1.6.0",
45
- "prettier": "3.2.4",
46
- "stylelint": "16.2.0",
47
- "stylelint-config-recess-order": "4.4.0",
45
+ "prettier": "3.2.5",
46
+ "stylelint": "16.2.1",
47
+ "stylelint-config-recess-order": "4.6.0",
48
48
  "stylelint-config-recommended-scss": "14.0.0",
49
49
  "stylelint-config-recommended-vue": "1.5.0",
50
50
  "stylelint-prettier": "5.0.0",
51
51
  "typescript": "5.3.3",
52
- "vite": "5.0.12",
53
- "vite-plugin-dts": "3.7.2",
52
+ "vite": "5.1.4",
53
+ "vite-plugin-dts": "3.7.3",
54
54
  "vue-linters-config": "0.1.13",
55
- "vue-tsc": "1.8.27"
55
+ "vue-tsc": "2.0.2"
56
56
  },
57
57
  "peerDependencies": {
58
- "vue": "3.4.15",
59
- "vue-router": "4.2.5"
58
+ "vue": "3.4.21",
59
+ "vue-router": "4.3.0"
60
60
  },
61
61
  "engines": {
62
62
  "npm": ">=10.2.3",