web-core-tcm 0.0.52 → 0.0.54

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 (113) hide show
  1. package/dist/node_modules/@alova/shared/dist/alova-shared.esm.js +249 -101
  2. package/dist/node_modules/@bufbuild/protobuf/dist/esm/clone.js +35 -0
  3. package/dist/node_modules/@bufbuild/protobuf/dist/esm/codegenv2/embed.js +109 -0
  4. package/dist/node_modules/@bufbuild/protobuf/dist/esm/codegenv2/enum.js +16 -0
  5. package/dist/node_modules/@bufbuild/protobuf/dist/esm/codegenv2/extension.js +9 -0
  6. package/dist/node_modules/@bufbuild/protobuf/dist/esm/codegenv2/file.js +9 -10
  7. package/dist/node_modules/@bufbuild/protobuf/dist/esm/codegenv2/index.js +28 -0
  8. package/dist/node_modules/@bufbuild/protobuf/dist/esm/codegenv2/scalar.js +48 -0
  9. package/dist/node_modules/@bufbuild/protobuf/dist/esm/codegenv2/service.js +8 -0
  10. package/dist/node_modules/@bufbuild/protobuf/dist/esm/codegenv2/symbols.js +49 -0
  11. package/dist/node_modules/@bufbuild/protobuf/dist/esm/codegenv2/types.js +1 -0
  12. package/dist/node_modules/@bufbuild/protobuf/dist/esm/equals.js +127 -0
  13. package/dist/node_modules/@bufbuild/protobuf/dist/esm/extensions.js +86 -0
  14. package/dist/node_modules/@bufbuild/protobuf/dist/esm/fields.js +11 -0
  15. package/dist/node_modules/@bufbuild/protobuf/dist/esm/from-binary.js +60 -56
  16. package/dist/node_modules/@bufbuild/protobuf/dist/esm/from-json.js +434 -0
  17. package/dist/node_modules/@bufbuild/protobuf/dist/esm/index.js +49 -0
  18. package/dist/node_modules/@bufbuild/protobuf/dist/esm/merge.js +33 -0
  19. package/dist/node_modules/@bufbuild/protobuf/dist/esm/reflect/error.js +12 -3
  20. package/dist/node_modules/@bufbuild/protobuf/dist/esm/reflect/guard.js +14 -10
  21. package/dist/node_modules/@bufbuild/protobuf/dist/esm/reflect/names.js +32 -12
  22. package/dist/node_modules/@bufbuild/protobuf/dist/esm/reflect/nested-types.js +42 -6
  23. package/dist/node_modules/@bufbuild/protobuf/dist/esm/reflect/reflect.js +58 -50
  24. package/dist/node_modules/@bufbuild/protobuf/dist/esm/reflect/scalar.js +26 -4
  25. package/dist/node_modules/@bufbuild/protobuf/dist/esm/registry.js +130 -99
  26. package/dist/node_modules/@bufbuild/protobuf/dist/esm/to-json.js +279 -0
  27. package/dist/node_modules/@bufbuild/protobuf/dist/esm/types.js +1 -0
  28. package/dist/node_modules/@bufbuild/protobuf/dist/esm/wire/base64-encoding.js +48 -27
  29. package/dist/node_modules/@bufbuild/protobuf/dist/esm/wire/index.js +24 -0
  30. package/dist/node_modules/@bufbuild/protobuf/dist/esm/wire/size-delimited.js +123 -0
  31. package/dist/node_modules/@bufbuild/protobuf/dist/esm/wire/text-encoding.js +9 -5
  32. package/dist/node_modules/@bufbuild/protobuf/dist/esm/wkt/any.js +40 -0
  33. package/dist/node_modules/@bufbuild/protobuf/dist/esm/wkt/duration.js +18 -0
  34. package/dist/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/any_pb.js +7 -0
  35. package/dist/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/api_pb.js +11 -0
  36. package/dist/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/compiler/plugin_pb.js +19 -0
  37. package/dist/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/cpp_features_pb.js +18 -0
  38. package/dist/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/descriptor_pb.js +134 -60
  39. package/dist/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/duration_pb.js +7 -0
  40. package/dist/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/empty_pb.js +7 -0
  41. package/dist/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/field_mask_pb.js +7 -0
  42. package/dist/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/go_features_pb.js +25 -0
  43. package/dist/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/java_features_pb.js +26 -0
  44. package/dist/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/source_context_pb.js +7 -0
  45. package/dist/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/struct_pb.js +17 -0
  46. package/dist/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/timestamp_pb.js +7 -0
  47. package/dist/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/type_pb.js +35 -0
  48. package/dist/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/wrappers_pb.js +15 -0
  49. package/dist/node_modules/@bufbuild/protobuf/dist/esm/wkt/index.js +180 -0
  50. package/dist/node_modules/@bufbuild/protobuf/dist/esm/wkt/timestamp.js +29 -0
  51. package/dist/node_modules/alova/dist/adapter/fetch.esm.js +10 -10
  52. package/dist/node_modules/alova/dist/alova.esm.js +263 -211
  53. package/dist/node_modules/alova/dist/clienthook/index.esm.js +2110 -70
  54. package/dist/node_modules/builder-pattern/dist/index.js +25 -13
  55. package/dist/node_modules/pinyin/lib/esm/pinyin.js +2 -2
  56. package/dist/node_modules/punycode/punycode.es6.js +17 -17
  57. package/dist/src/api/algorithm/alova/implement/comprehensiveAlgorithm.js +4 -7
  58. package/dist/src/api/algorithm/alova/implement/index.js +12 -0
  59. package/dist/src/api/algorithm/alova/implement/inquiriesAlgorithm.js +4 -7
  60. package/dist/src/api/algorithm/alova/implement/inspectionsAlgorithm.js +7 -10
  61. package/dist/src/api/algorithm/alova/implement/lisemsAlgorithm.js +6 -9
  62. package/dist/src/api/algorithm/alova/implement/pulsationsAlgorithm.js +7 -10
  63. package/dist/src/api/algorithm/alova/index.js +11 -15
  64. package/dist/src/api/algorithm/comprehensiveAlgorithm.js +5 -6
  65. package/dist/src/api/authorization/alova/globals.js +1 -0
  66. package/dist/src/api/authorization/alova/implement/index.js +4 -0
  67. package/dist/src/api/authorization/alova/index.js +10 -8
  68. package/dist/src/api/check/alova/globals.js +1 -0
  69. package/dist/src/api/check/alova/implement/index.js +5 -0
  70. package/dist/src/api/check/alova/index.js +5 -6
  71. package/dist/src/api/check/check.js +2 -2
  72. package/dist/src/api/config/index.d.ts +1 -1
  73. package/dist/src/api/config/index.js +2 -2
  74. package/dist/src/api/core/index.js +9 -0
  75. package/dist/src/api/device/device.d.ts +4 -5
  76. package/dist/src/api/device/device.js +20 -29
  77. package/dist/src/api/doctor/alova/globals.js +1 -0
  78. package/dist/src/api/doctor/alova/implement/index.js +4 -0
  79. package/dist/src/api/doctor/alova/index.js +10 -9
  80. package/dist/src/api/index.d.ts +12 -11
  81. package/dist/src/api/index.js +28 -0
  82. package/dist/src/api/metric/alova/implement/index.js +4 -0
  83. package/dist/src/api/metric/alova/index.js +1 -0
  84. package/dist/src/api/metric/index.js +5 -4
  85. package/dist/src/api/oauth/alova/globals.js +1 -0
  86. package/dist/src/api/oauth/alova/implement/index.js +4 -0
  87. package/dist/src/api/oauth/alova/index.js +13 -11
  88. package/dist/src/api/outpatient/alova/globals.js +1 -0
  89. package/dist/src/api/outpatient/alova/implement/index.js +4 -0
  90. package/dist/src/api/outpatient/alova/index.js +5 -5
  91. package/dist/src/api/patient/alova/globals.js +1 -0
  92. package/dist/src/api/patient/alova/implement/index.js +16 -0
  93. package/dist/src/api/patient/alova/index.js +9 -12
  94. package/dist/src/api/patient/meta.js +1 -0
  95. package/dist/src/api/prescription/alova/globals.js +1 -0
  96. package/dist/src/api/prescription/alova/implement/index.js +6 -0
  97. package/dist/src/api/prescription/alova/index.js +8 -7
  98. package/dist/src/api/scientist/alova/globals.js +1 -0
  99. package/dist/src/api/scientist/alova/implement/index.js +4 -0
  100. package/dist/src/api/scientist/alova/index.js +5 -5
  101. package/dist/src/index.d.ts +0 -1
  102. package/dist/src/index.js +34 -32
  103. package/dist/src/proto/index.js +10 -0
  104. package/dist/src/proto/types/Images_pb.js +7 -6
  105. package/dist/src/proto/types/WaveMap_pb.js +4 -3
  106. package/dist/src/util/helper.js +38 -2
  107. package/dist/src/util/string.js +47 -5
  108. package/package.json +66 -14
  109. package/dist/node_modules/@vue/reactivity/dist/reactivity.esm-bundler.js +0 -556
  110. package/dist/node_modules/@vue/runtime-core/dist/runtime-core.esm-bundler.js +0 -36
  111. package/dist/node_modules/@vue/shared/dist/shared.esm-bundler.js +0 -26
  112. package/dist/node_modules/quasar/src/composables/use-quasar/use-quasar.js +0 -8
  113. package/dist/node_modules/quasar/src/utils/private.symbols/symbols.js +0 -4
@@ -1,209 +1,256 @@
1
- import { newInstance as g, pushItem as v, trueValue as $, createEventManager as Re, undefinedValue as m, createAssert as qe, getConfig as U, isPlainObject as ae, forEach as K, filterItem as k, objectKeys as L, isFn as H, getContextOptions as $e, mapItem as O, isArray as ke, deleteAttr as A, falseValue as W, len as R, promiseThen as P, key as We, promiseCatch as je, promiseFinally as xe, JSONParse as Ge, JSONStringify as Ve, instanceOf as ne, isString as be, noop as Q, PromiseCls as x, getOptions as Je, getMethodInternalKey as ce, getLocalCacheConfigParam as Ye, getContext as re, $self as me, isSpecialRequestBody as ze, sloughFunction as Qe, buildCompletedURL as Xe, promiseReject as Ze, objAssign as Ie, isSSR as et, MEMORY as tt, STORAGE_RESTORE as X, deepClone as st, buildNamespacedCacheKey as ie, getTime as ve, RegExpCls as le } from "../../@alova/shared/dist/alova-shared.esm.js";
2
- let Ee = {
1
+ import { isSSR as Ve, STORAGE_RESTORE as K, len as x, getTime as te, buildNamespacedCacheKey as de, filterItem as z, undefinedValue as f, forEach as T, instanceOf as pe, RegExpCls as fe, pushItem as H, mapItem as L, objectKeys as k, PromiseCls as C, newInstance as g, deleteAttr as N, getContext as A, isString as Ke, objAssign as Je, getMethodInternalKey as U, getLocalCacheConfigParam as se, isArray as ge, isFn as b, MEMORY as Pe, promiseResolve as Ye, getConfig as $, trueValue as Y, getOptions as ze, noop as ce, $self as ve, isSpecialRequestBody as Qe, isPlainObject as Ce, sloughFunction as Xe, falseValue as Q, buildCompletedURL as Ze, deepClone as Ie, promiseFinally as De, promiseThen as D, promiseReject as et, getContextOptions as tt, key as st, promiseCatch as at, createAssert as ot, createEventManager as Te, JSONParse as nt, JSONStringify as ct } from "../../@alova/shared/dist/alova-shared.esm.js";
2
+ let X = {
3
3
  autoHitCache: "global",
4
- ssr: et
4
+ ssr: Ve
5
5
  };
6
- const q = "color: black; font-size: 12px; font-weight: bolder";
7
- var ot = (a, e, t, o) => {
8
- const s = console, i = (...l) => console.log(...l), { url: n } = e, c = t === X, h = "\x1B[42m%s\x1B[49m", p = "\x1B[32m%s\x1B[39m", r = ` [HitCache]${n} `, d = () => Array(R(r) + 1).join("^");
9
- Ee.ssr ? (i(h, r), i(p, " Cache ", a), i(p, " Mode ", t), c && i(p, " Tag ", o), i(p, d())) : (s.groupCollapsed ? s.groupCollapsed("%cHitCache", "padding: 2px 6px; background: #c4fcd3; color: #53b56d;", n) : i(h, r), i("%c[Cache]", q, a), i("%c[Mode]", q, t), c && i("%c[Tag]", q, o), i("%c[Method]", q, e), s.groupEnd ? s.groupEnd() : i(p, d()));
6
+ var Ht = (s) => {
7
+ X = {
8
+ ...X,
9
+ ...s
10
+ };
11
+ };
12
+ const J = "color: black; font-size: 12px; font-weight: bolder";
13
+ var rt = (s, e, t, o) => {
14
+ const a = console, r = (...l) => console.log(...l), { url: n } = e, c = t === K, h = "\x1B[42m%s\x1B[49m", d = "\x1B[32m%s\x1B[39m", i = ` [HitCache]${n} `, u = () => Array(x(i) + 1).join("^");
15
+ X.ssr ? (r(h, i), r(d, " Cache ", s), r(d, " Mode ", t), c && r(d, " Tag ", o), r(d, u())) : (a.groupCollapsed ? a.groupCollapsed("%cHitCache", "padding: 2px 6px; background: #c4fcd3; color: #53b56d;", n) : r(h, i), r("%c[Cache]", J, s), r("%c[Mode]", J, t), c && r("%c[Tag]", J, o), r("%c[Method]", J, e), a.groupEnd ? a.groupEnd() : r(d, u()));
10
16
  };
11
- const Z = (a) => `hss.${a}`, He = "hsr.", I = (a) => He + a, j = "$$hsrs", Me = "__$<>$__", ee = (a, e) => {
12
- a[e] = 0;
13
- }, Y = async (a, e, t, o, s, i, n) => {
14
- if (o > ve() && t) {
15
- const c = ie(a, e);
16
- if (await s.set(c, k([t, o === 1 / 0 ? m : o, n], Boolean)), i) {
17
- const h = {}, p = [];
18
- K(i, (l) => {
19
- const u = ne(l, le), S = u ? l.source + (l.flags ? Me + l.flags : "") : l;
20
- S && (u && !h[S] && v(p, S), ee(h, u ? I(S) : Z(S)));
17
+ const re = (s) => `hss.${s}`, Le = "hsr.", ie = (s) => Le + s, Z = "$$hsrs", Oe = "__$<>$__", le = (s, e) => {
18
+ s[e] = 0;
19
+ }, q = async (s, e, t, o, a, r, n) => {
20
+ if (o > te() && t) {
21
+ const c = de(s, e);
22
+ if (await a.set(c, z([t, o === 1 / 0 ? f : o, n], Boolean)), r) {
23
+ const h = {}, d = [];
24
+ T(r, (l) => {
25
+ const p = pe(l, fe), y = p ? l.source + (l.flags ? Oe + l.flags : "") : l;
26
+ y && (p && !h[y] && H(d, y), le(h, p ? ie(y) : re(y)));
21
27
  });
22
- const r = O(L(h), async (l) => {
23
- const u = await s.get(l) || {};
24
- ee(u, c), await s.set(l, u);
25
- }), d = async () => {
26
- if (R(p)) {
27
- const l = await s.get(j) || [];
28
- v(l, ...p), await s.set(j, l);
28
+ const i = L(k(h), async (l) => {
29
+ const p = await a.get(l) || {};
30
+ le(p, c), await a.set(l, p);
31
+ }), u = async () => {
32
+ if (x(d)) {
33
+ const l = await a.get(Z) || [];
34
+ H(l, ...d), await a.set(Z, l);
29
35
  }
30
36
  };
31
- await x.all([...r, d()]);
37
+ await C.all([...i, u()]);
32
38
  }
33
39
  }
34
- }, at = async (a, e, t) => {
35
- const o = ie(a, e);
40
+ }, he = async (s, e, t) => {
41
+ const o = de(s, e);
36
42
  await t.remove(o);
37
- }, Pe = async (a, e, t, o) => {
38
- const s = await t.get(ie(a, e));
39
- if (s) {
40
- const [i, n, c] = s;
41
- if (c === o && (!n || n > ve()))
42
- return s;
43
- await at(a, e, t);
43
+ }, Ae = async (s, e, t, o) => {
44
+ const a = await t.get(de(s, e));
45
+ if (a) {
46
+ const [r, n, c] = a;
47
+ if (c === o && (!n || n > te()))
48
+ return a;
49
+ await he(s, e, t);
44
50
  }
45
- }, nt = async (a, e, t, o) => {
46
- const s = await Pe(a, e, t, o);
47
- return s ? s[0] : m;
48
- }, ct = async (a, e, t) => {
49
- const o = `${e}`, s = {}, i = Z(a);
50
- s[i] = await t.get(i);
51
+ }, O = async (s, e, t, o) => {
52
+ const a = await Ae(s, e, t, o);
53
+ return a ? a[0] : f;
54
+ }, xe = async (s) => C.all(s.map((e) => e.clear())), it = async (s, e, t) => {
55
+ const o = `${e}`, a = {}, r = re(s);
56
+ a[r] = await t.get(r);
51
57
  let n;
52
58
  if (e) {
53
- const r = Z(o);
54
- s[r] = await t.get(r), n = await t.get(j);
55
- const d = [];
56
- n && R(n) && (K(n, (l) => {
57
- const [u, S] = l.split(Me);
58
- g(le, u, S).test(o) && v(d, l);
59
- }), await x.all(O(d, async (l) => {
60
- const u = I(l);
61
- s[u] = await t.get(u);
59
+ const i = re(o);
60
+ a[i] = await t.get(i), n = await t.get(Z);
61
+ const u = [];
62
+ n && x(n) && (T(n, (l) => {
63
+ const [p, y] = l.split(Oe);
64
+ g(fe, p, y).test(o) && H(u, l);
65
+ }), await C.all(L(u, async (l) => {
66
+ const p = ie(l);
67
+ a[p] = await t.get(p);
62
68
  })));
63
69
  }
64
- const c = async (r) => {
70
+ const c = async (i) => {
65
71
  try {
66
- await t.remove(r);
67
- for (const d in s) {
68
- const l = s[d];
69
- l && A(l, r);
72
+ await t.remove(i);
73
+ for (const u in a) {
74
+ const l = a[u];
75
+ l && N(l, i);
70
76
  }
71
77
  } catch {
72
78
  }
73
79
  }, h = {};
74
- await x.all(O(L(s), async (r) => {
75
- const d = s[r];
76
- if (d) {
80
+ await C.all(L(k(a), async (i) => {
81
+ const u = a[i];
82
+ if (u) {
77
83
  const l = [];
78
- for (const u in d)
79
- h[u] || (ee(h, u), v(l, c(u)));
80
- await x.all(l);
84
+ for (const p in u)
85
+ h[p] || (le(h, p), H(l, c(p)));
86
+ await C.all(l);
81
87
  }
82
88
  }));
83
- const p = R(n || []);
84
- await x.all(O(L(s), async (r) => {
85
- const d = s[r];
86
- d && (R(L(d)) ? await t.set(r, d) : (await t.remove(r), r.includes(He) && n && (n = k(n, (l) => I(l) !== r))));
87
- })), p !== R(n || []) && await t.set(j, n);
89
+ const d = x(n || []);
90
+ await C.all(L(k(a), async (i) => {
91
+ const u = a[i];
92
+ u && (x(k(u)) ? await t.set(i, u) : (await t.remove(i), i.includes(Le) && n && (n = z(n, (l) => ie(l) !== i))));
93
+ })), d !== x(n || []) && await t.set(Z, n);
88
94
  };
89
- var rt = (a) => {
90
- const { data: e, config: t } = a, o = { ...t }, { headers: s = {}, params: i = {} } = o, n = re(a);
91
- o.headers = { ...s }, o.params = be(i) ? i : { ...i };
92
- const c = g(y, a.type, n, a.url, o, e);
93
- return Ie(c, {
94
- ...a,
95
+ var lt = (s) => {
96
+ const { data: e, config: t } = s, o = { ...t }, { headers: a = {}, params: r = {} } = o, n = A(s);
97
+ o.headers = { ...a }, o.params = Ke(r) ? r : { ...r };
98
+ const c = g(R, s.type, n, s.url, o, e);
99
+ return Je(c, {
100
+ ...s,
95
101
  config: o
96
102
  });
97
103
  };
98
- const it = async (a) => {
99
- const { autoHitCache: e } = Ee, { l1Cache: t, l2Cache: o } = re(a), s = ce(a), { name: i } = U(a), n = {
100
- global: [...se, ...oe],
104
+ const Mt = async (s, { policy: e = "all" } = {}) => {
105
+ if (s && s.key) {
106
+ const { id: t, l1Cache: o, l2Cache: a } = A(s), r = U(s), { f: n, c, s: h, e: d, t: i } = se(s);
107
+ if (c)
108
+ return n();
109
+ let u = e !== "l2" ? await O(t, r, o) : f;
110
+ return e === "l2" ? u = await O(t, r, a, i) : e === "all" && !u && h && d(K) > te() && (u = await O(t, r, a, i)), u;
111
+ }
112
+ }, Kt = async (s, e, { policy: t = "all" } = {}) => {
113
+ const a = (ge(s) ? s : [s]).map(async (r) => {
114
+ const { hitSource: n } = r, { id: c, l1Cache: h, l2Cache: d } = A(r), i = U(r), { e: u, s: l, t: p, c: y } = se(r);
115
+ if (y)
116
+ return;
117
+ let S = e;
118
+ if (b(e)) {
119
+ let M = t !== "l2" ? await O(c, i, h) : f;
120
+ if ((t === "l2" || t === "all" && !M && l && u(K) > te()) && (M = await O(c, i, d, p)), S = e(M), S === f)
121
+ return;
122
+ }
123
+ return C.all([
124
+ t !== "l2" && q(c, i, S, u(Pe), h, n),
125
+ t === "l2" || t === "all" && l ? q(c, i, S, u(K), d, n, p) : f
126
+ ]);
127
+ });
128
+ return C.all(a);
129
+ }, Pt = async (s) => {
130
+ if (!s) {
131
+ await C.all([xe(I), xe(ee)]);
132
+ return;
133
+ }
134
+ const t = (ge(s) ? s : [s]).map((o) => {
135
+ const { id: a, l1Cache: r, l2Cache: n } = A(o), { c, m: h } = se(o);
136
+ if (c)
137
+ return;
138
+ const d = U(o);
139
+ return C.all([
140
+ he(a, d, r),
141
+ h === K ? he(a, d, n) : Ye()
142
+ ]);
143
+ });
144
+ await C.all(t);
145
+ }, ht = async (s) => {
146
+ const { autoHitCache: e } = X, { l1Cache: t, l2Cache: o } = A(s), a = U(s), { name: r } = $(s), n = {
147
+ global: [...I, ...ee],
101
148
  self: [t, o],
102
149
  close: []
103
150
  }[e];
104
- n && R(n) && await x.all(O(n, (c) => ct(s, i, c)));
105
- }, Ce = {};
106
- function lt(a, e) {
107
- let t = $, o;
108
- const s = g(x, (n) => {
151
+ n && x(n) && await C.all(L(n, (c) => it(a, r, c)));
152
+ }, be = {};
153
+ function ut(s, e) {
154
+ let t = Y, o;
155
+ const a = g(C, (n) => {
109
156
  o = n;
110
157
  });
111
158
  return {
112
159
  // request interrupt function
113
160
  abort: () => {
114
- P(s, (n) => n && n.abort());
161
+ D(a, (n) => n && n.abort());
115
162
  },
116
163
  onDownload: (n) => {
117
- P(s, (c) => c && c.onDownload && c.onDownload(n));
164
+ D(a, (c) => c && c.onDownload && c.onDownload(n));
118
165
  },
119
166
  onUpload: (n) => {
120
- P(s, (c) => c && c.onUpload && c.onUpload(n));
167
+ D(a, (c) => c && c.onUpload && c.onUpload(n));
121
168
  },
122
169
  response: async () => {
123
- const { beforeRequest: n = Q, responded: c, requestAdapter: h, cacheLogger: p } = Je(a), r = ce(a), { s: d, t: l, m: u, e: S } = Ye(a), { id: E, l1Cache: G, l2Cache: ue, snapshots: Ke } = re(a), { cacheFor: pe } = U(a), { hitSource: V } = a;
124
- let T = await (H(pe) ? pe() : (
170
+ const { beforeRequest: n = ce, responded: c, requestAdapter: h, cacheLogger: d } = ze(s), i = U(s), { s: u, t: l, m: p, e: y } = se(s), { id: S, l1Cache: M, l2Cache: me, snapshots: Ue } = A(s), { cacheFor: ye } = $(s), { hitSource: oe } = s;
171
+ let _ = await (b(ye) ? ye() : (
125
172
  // If it is a forced request, skip the step of getting it from the cache
126
173
  // Otherwise, determine whether to use cached data
127
- e ? m : nt(E, r, G)
174
+ e ? f : O(S, i, M)
128
175
  ));
129
- if (u === X && !T && !e) {
130
- const f = await Pe(E, r, ue, l);
131
- if (f) {
132
- const [w, M] = f;
133
- await Y(E, r, w, M, G, V), T = w;
176
+ if (p === K && !_ && !e) {
177
+ const m = await Ae(S, i, me, l);
178
+ if (m) {
179
+ const [v, P] = m;
180
+ await q(S, i, v, P, M, oe), _ = v;
134
181
  }
135
182
  }
136
- const C = rt(a);
137
- await n(C);
138
- const { baseURL: Oe, url: Te, type: De, data: Le } = C, { params: Ue = {}, headers: Ae = {}, transform: _e = me, shareRequest: Be } = U(C), _ = Ce[E] = Ce[E] || {}, de = C.data, ge = ze(de);
139
- let D = ge ? m : _[r], B = me, F = m, N = Q;
140
- if (H(c))
141
- B = c;
142
- else if (ae(c)) {
143
- const { onSuccess: f, onError: w, onComplete: M } = c;
144
- B = H(f) ? f : B, F = H(w) ? w : F, N = H(M) ? M : N;
183
+ const w = lt(s);
184
+ await n(w);
185
+ const { baseURL: _e, url: Fe, type: ke, data: qe } = w, { params: Be = {}, headers: Ne = {}, transform: $e = ve, shareRequest: We } = $(w), W = be[S] = be[S] || {}, Se = w.data, we = Qe(Se);
186
+ let F = we ? f : W[i], j = ve, G = f, V = ce;
187
+ if (b(c))
188
+ j = c;
189
+ else if (Ce(c)) {
190
+ const { onSuccess: m, onError: v, onComplete: P } = c;
191
+ j = b(m) ? m : j, G = b(v) ? v : G, V = b(P) ? P : V;
145
192
  }
146
- if (T !== m)
147
- return o(), C.fromCache = $, Qe(p, ot)(T, C, u, l), N(C), T;
148
- if (t = W, !Be || !D) {
149
- const f = h({
150
- url: Xe(Oe, Te, Ue),
151
- type: De,
152
- data: Le,
153
- headers: Ae
154
- }, C);
155
- D = _[r] = f;
193
+ if (_ !== f)
194
+ return o(), w.fromCache = Y, Xe(d, rt)(_, w, p, l), V(w), _;
195
+ if (t = Q, !We || !F) {
196
+ const m = h({
197
+ url: Ze(_e, Fe, Be),
198
+ type: ke,
199
+ data: qe,
200
+ headers: Ne
201
+ }, w);
202
+ F = W[i] = m;
156
203
  }
157
- o(D);
158
- const fe = async (f, w, M = $) => {
159
- const Fe = await f, J = await _e(Fe, w || {});
160
- Ke.save(a);
204
+ o(F);
205
+ const Re = async (m, v, P = Y) => {
206
+ const je = await m, ne = await $e(je, v || {});
207
+ Ue.save(s);
161
208
  try {
162
- await it(C);
209
+ await ht(w);
163
210
  } catch {
164
211
  }
165
- if ((!de || !ge) && M)
212
+ if ((!Se || !we) && P)
166
213
  try {
167
- await x.all([
168
- Y(E, r, J, S(tt), G, V),
169
- d && Y(E, r, J, S(X), ue, V, l)
214
+ await C.all([
215
+ q(S, i, ne, y(Pe), M, oe),
216
+ u && q(S, i, ne, y(K), me, oe, l)
170
217
  ]);
171
218
  } catch {
172
219
  }
173
- return st(J);
220
+ return Ie(ne);
174
221
  };
175
- return xe(P(x.all([D.response(), D.headers()]), ([f, w]) => (A(_, r), fe(B(f, C), w)), (f) => (A(_, r), H(F) ? (
222
+ return De(D(C.all([F.response(), F.headers()]), ([m, v]) => (N(W, i), Re(j(m, w), v)), (m) => (N(W, i), b(G) ? (
176
223
  // When responding to an error, if no error is thrown, the successful response process will be processed, but the data will not be cached.
177
- fe(F(f, C), m, W)
178
- ) : Ze(f))), () => {
179
- N(C);
224
+ Re(G(m, w), f, Q)
225
+ ) : et(m))), () => {
226
+ V(w);
180
227
  });
181
228
  },
182
229
  fromCache: () => t
183
230
  };
184
231
  }
185
- const ye = (a, e) => () => {
186
- const t = e.indexOf(a);
232
+ const Ee = (s, e) => () => {
233
+ const t = e.indexOf(s);
187
234
  t >= 0 && e.splice(t, 1);
188
235
  };
189
- class y {
190
- constructor(e, t, o, s, i) {
191
- this.dhs = [], this.uhs = [], this.fromCache = m;
236
+ class R {
237
+ constructor(e, t, o, a, r) {
238
+ this.dhs = [], this.uhs = [], this.fromCache = f;
192
239
  const n = () => {
193
240
  n.a();
194
241
  };
195
- n.a = Q, e = e.toUpperCase();
196
- const c = this, h = $e(t);
242
+ n.a = ce, e = e.toUpperCase();
243
+ const c = this, h = tt(t);
197
244
  c.abort = n, c.baseURL = h.baseURL || "", c.url = o, c.type = e, c.context = t;
198
- const p = {}, r = "cacheFor", d = ae(h[r]) ? h[r][e] : m, l = s && s.hitSource;
199
- K(["timeout", "shareRequest"], (u) => {
200
- h[u] !== m && (p[u] = h[u]);
201
- }), d !== m && (p[r] = d), l && (c.hitSource = O(ke(l) ? l : [l], (u) => ne(u, y) ? ce(u) : u), A(s, "hitSource")), c.config = {
202
- ...p,
245
+ const d = {}, i = "cacheFor", u = Ce(h[i]) ? h[i][e] : f, l = a && a.hitSource;
246
+ T(["timeout", "shareRequest"], (p) => {
247
+ h[p] !== f && (d[p] = h[p]);
248
+ }), u !== f && (d[i] = u), l && (c.hitSource = L(ge(l) ? l : [l], (p) => pe(p, R) ? U(p) : p), N(a, "hitSource")), c.config = {
249
+ ...d,
203
250
  headers: {},
204
251
  params: {},
205
- ...s || {}
206
- }, c.data = i, c.meta = s ? s.meta : c.meta, c.key = c.generateKey();
252
+ ...a || {}
253
+ }, c.data = r, c.meta = a ? a.meta : c.meta, c.key = c.generateKey();
207
254
  }
208
255
  /**
209
256
  * Bind download progress callback function
@@ -212,7 +259,7 @@ class y {
212
259
  * @return unbind function
213
260
  */
214
261
  onDownload(e) {
215
- return v(this.dhs, e), ye(e, this.dhs);
262
+ return H(this.dhs, e), Ee(e, this.dhs);
216
263
  }
217
264
  /**
218
265
  * Bind upload progress callback function
@@ -221,24 +268,24 @@ class y {
221
268
  * @return unbind function
222
269
  */
223
270
  onUpload(e) {
224
- return v(this.uhs, e), ye(e, this.uhs);
271
+ return H(this.uhs, e), Ee(e, this.uhs);
225
272
  }
226
273
  /**
227
274
  * Send a request through a method instance and return a promise object
228
275
  */
229
- send(e = W) {
230
- const t = this, { response: o, onDownload: s, onUpload: i, abort: n, fromCache: c } = lt(t, e);
231
- return R(t.dhs) > 0 && s((h, p) => K(t.dhs, (r) => r({ loaded: h, total: p }))), R(t.uhs) > 0 && i((h, p) => K(t.uhs, (r) => r({ loaded: h, total: p }))), t.abort.a = n, t.fromCache = m, t.promise = P(o(), (h) => (t.fromCache = c(), h)), t.promise;
276
+ send(e = Q) {
277
+ const t = this, { response: o, onDownload: a, onUpload: r, abort: n, fromCache: c } = ut(t, e);
278
+ return x(t.dhs) > 0 && a((h, d) => T(t.dhs, (i) => i({ loaded: h, total: d }))), x(t.uhs) > 0 && r((h, d) => T(t.uhs, (i) => i({ loaded: h, total: d }))), t.abort.a = n, t.fromCache = f, t.promise = D(o(), (h) => (t.fromCache = c(), h)), t.promise;
232
279
  }
233
280
  /**
234
281
  * Set the method name, if there is already a name it will be overwritten
235
282
  * @param name method name
236
283
  */
237
284
  setName(e) {
238
- U(this).name = e;
285
+ $(this).name = e;
239
286
  }
240
287
  generateKey() {
241
- return We(this);
288
+ return st(this);
242
289
  }
243
290
  /**
244
291
  * Bind callbacks for resolve and/or reject Promise
@@ -247,7 +294,7 @@ class y {
247
294
  * @returns Returns a Promise for executing any callbacks
248
295
  */
249
296
  then(e, t) {
250
- return P(this.send(), e, t);
297
+ return D(this.send(), e, t);
251
298
  }
252
299
  /**
253
300
  * Bind a callback only for reject Promise
@@ -255,7 +302,7 @@ class y {
255
302
  * @returns Returns a Promise that completes the callback
256
303
  */
257
304
  catch(e) {
258
- return je(this.send(), e);
305
+ return at(this.send(), e);
259
306
  }
260
307
  /**
261
308
  * Bind a callback that is called when the Promise is resolved (resolve or reject)
@@ -263,73 +310,73 @@ class y {
263
310
  * @return Returns a Promise that completes the callback.
264
311
  */
265
312
  finally(e) {
266
- return xe(this.send(), e);
313
+ return De(this.send(), e);
267
314
  }
268
315
  }
269
- const he = qe(), b = "success", ht = () => {
270
- let a = {};
271
- const e = Re();
316
+ const ae = ot(), E = "success", dt = () => {
317
+ let s = {};
318
+ const e = Te();
272
319
  return {
273
- set(o, s) {
274
- a[o] = s, e.emit(b, { type: "set", key: o, value: s, container: a });
320
+ set(o, a) {
321
+ s[o] = a, e.emit(E, { type: "set", key: o, value: a, container: s });
275
322
  },
276
323
  get: (o) => {
277
- const s = a[o];
278
- return e.emit(b, { type: "get", key: o, value: s, container: a }), s;
324
+ const a = s[o];
325
+ return e.emit(E, { type: "get", key: o, value: a, container: s }), a;
279
326
  },
280
327
  remove(o) {
281
- A(a, o), e.emit(b, { type: "remove", key: o, container: a });
328
+ N(s, o), e.emit(E, { type: "remove", key: o, container: s });
282
329
  },
283
330
  clear: () => {
284
- a = {}, e.emit(b, { type: "clear", key: "", container: a });
331
+ s = {}, e.emit(E, { type: "clear", key: "", container: s });
285
332
  },
286
333
  emitter: e
287
334
  };
288
- }, ut = () => {
289
- const a = Re(), e = localStorage;
335
+ }, pt = () => {
336
+ const s = Te(), e = localStorage;
290
337
  return {
291
- set: (o, s) => {
292
- e.setItem(o, Ve(s)), a.emit(b, { type: "set", key: o, value: s, container: e });
338
+ set: (o, a) => {
339
+ e.setItem(o, ct(a)), s.emit(E, { type: "set", key: o, value: a, container: e });
293
340
  },
294
341
  get: (o) => {
295
- const s = e.getItem(o), i = s && Ge(s);
296
- return a.emit(b, { type: "get", key: o, value: i, container: e }), i;
342
+ const a = e.getItem(o), r = a && nt(a);
343
+ return s.emit(E, { type: "get", key: o, value: r, container: e }), r;
297
344
  },
298
345
  remove: (o) => {
299
- e.removeItem(o), a.emit(b, { type: "remove", key: o, container: e });
346
+ e.removeItem(o), s.emit(E, { type: "remove", key: o, container: e });
300
347
  },
301
348
  clear: () => {
302
- e.clear(), a.emit(b, { type: "clear", key: "", container: e });
349
+ e.clear(), s.emit(E, { type: "clear", key: "", container: e });
303
350
  },
304
- emitter: a
351
+ emitter: s
305
352
  };
306
- }, pt = () => {
307
- const a = () => {
308
- he(W, "l2Cache is not defined.");
353
+ }, ft = () => {
354
+ const s = () => {
355
+ ae(Q, "l2Cache is not defined.");
309
356
  };
310
357
  return {
311
358
  set: () => {
312
- a();
359
+ s();
313
360
  },
314
- get: () => (a(), m),
361
+ get: () => (s(), f),
315
362
  remove: () => {
316
- a();
363
+ s();
317
364
  },
318
365
  clear: () => {
319
366
  }
320
367
  };
321
- }, Se = Set;
322
- class dt {
368
+ }, He = Set;
369
+ class gt {
323
370
  constructor(e) {
324
- this.records = {}, this.occupy = 0, he(e >= 0, "expected snapshots limit to be >= 0"), this.capacity = e;
371
+ this.records = {}, this.occupy = 0, ae(e >= 0, "expected snapshots limit to be >= 0"), this.capacity = e;
325
372
  }
326
373
  /**
327
374
  * Save method instance snapshot
328
375
  * @param methodInstance method instance
329
376
  */
330
377
  save(e) {
331
- const { name: t } = U(e), { records: o, occupy: s, capacity: i } = this;
332
- t && s < i && ((o[t] = o[t] || g(Se)).add(e), this.occupy += 1);
378
+ const { name: t } = $(e), { records: o, occupy: a, capacity: r } = this;
379
+ t && a < r && ((o[t] = o[t] || g(He)).add(e), this.occupy += 1);
333
380
  }
334
381
  /**
335
382
  * Get a Method instance snapshot, which will filter out the corresponding Method instance based on the matcher
@@ -337,78 +384,83 @@ class dt {
337
384
  * @returns Array of matched Method instance snapshots
338
385
  */
339
386
  match(e, t = !0) {
340
- let o, s, i, n = e;
341
- ae(e) && (n = e.name, i = e.filter), ne(n, le) ? s = n : be(n) && (o = n);
387
+ let o, a, r, n = e;
388
+ Ce(e) && (n = e.name, r = e.filter), pe(n, fe) ? a = n : Ke(n) && (o = n);
342
389
  const { records: c } = this;
343
- let h = g(Se);
344
- o ? h = c[o] || h : s && K(k(L(c), (r) => s.test(r)), (r) => {
345
- c[r].forEach((d) => h.add(d));
390
+ let h = g(He);
391
+ o ? h = c[o] || h : a && T(z(k(c), (i) => a.test(i)), (i) => {
392
+ c[i].forEach((u) => h.add(u));
346
393
  });
347
- const p = H(i) ? k([...h], i) : [...h];
348
- return t ? p : p[0];
394
+ const d = b(r) ? z([...h], r) : [...h];
395
+ return t ? d : d[0];
349
396
  }
350
397
  }
351
- const te = "GET", gt = "HEAD", ft = "POST", mt = "PUT", Ct = "PATCH", yt = "DELETE", St = "OPTIONS", we = {
398
+ const ue = "GET", Ct = "HEAD", mt = "POST", yt = "PUT", St = "PATCH", wt = "DELETE", Rt = "OPTIONS", Me = {
352
399
  /**
353
400
  * GET requests are cached for 5 minutes (300000 milliseconds) by default, and other requests are not cached by default.
354
401
  */
355
402
  cacheFor: {
356
- [te]: 3e5
403
+ [ue]: 3e5
357
404
  },
358
405
  /**
359
406
  * Share requests default to true
360
407
  */
361
- shareRequest: $,
408
+ shareRequest: Y,
362
409
  /**
363
410
  * Number of method snapshots, default is 1000
364
411
  */
365
412
  snapshots: 1e3
366
413
  };
367
- let wt = 0;
368
- class Rt {
414
+ let vt = 0;
415
+ class xt {
369
416
  constructor(e) {
370
417
  var t, o;
371
- const s = this;
372
- s.id = (e.id || (wt += 1)).toString(), s.l1Cache = e.l1Cache || ht(), s.l2Cache = e.l2Cache || (typeof localStorage < "u" ? ut() : pt()), s.options = {
373
- ...we,
418
+ const a = this;
419
+ a.id = (e.id || (vt += 1)).toString(), a.l1Cache = e.l1Cache || dt(), a.l2Cache = e.l2Cache || (typeof localStorage < "u" ? pt() : ft()), a.options = {
420
+ ...Me,
374
421
  ...e
375
- }, s.snapshots = g(dt, (o = (t = e.snapshots) !== null && t !== void 0 ? t : we.snapshots) !== null && o !== void 0 ? o : 0);
422
+ }, a.snapshots = g(gt, (o = (t = e.snapshots) !== null && t !== void 0 ? t : Me.snapshots) !== null && o !== void 0 ? o : 0);
376
423
  }
377
424
  Request(e) {
378
- return g(y, e.method || te, this, e.url, e, e.data);
425
+ return g(R, e.method || ue, this, e.url, e, e.data);
379
426
  }
380
427
  Get(e, t) {
381
- return g(y, te, this, e, t);
428
+ return g(R, ue, this, e, t);
382
429
  }
383
430
  Post(e, t, o) {
384
- return g(y, ft, this, e, o, t);
431
+ return g(R, mt, this, e, o, t);
385
432
  }
386
433
  Delete(e, t, o) {
387
- return g(y, yt, this, e, o, t);
434
+ return g(R, wt, this, e, o, t);
388
435
  }
389
436
  Put(e, t, o) {
390
- return g(y, mt, this, e, o, t);
437
+ return g(R, yt, this, e, o, t);
391
438
  }
392
439
  Head(e, t) {
393
- return g(y, gt, this, e, t);
440
+ return g(R, Ct, this, e, t);
394
441
  }
395
442
  Patch(e, t, o) {
396
- return g(y, Ct, this, e, o, t);
443
+ return g(R, St, this, e, o, t);
397
444
  }
398
445
  Options(e, t) {
399
- return g(y, St, this, e, t);
446
+ return g(R, Rt, this, e, t);
400
447
  }
401
448
  }
402
- let z = m;
403
- const se = [], oe = [], vt = (a) => {
404
- const e = g(Rt, a), t = e.options.statesHook;
405
- z && t && he(z.name === t.name, "expected to use the same `statesHook`"), z = t;
406
- const { l1Cache: o, l2Cache: s } = e;
407
- return !se.includes(o) && v(se, o), !oe.includes(s) && v(oe, s), e;
408
- };
449
+ let B = f;
450
+ const I = [], ee = [], Dt = (s) => {
451
+ const e = g(xt, s), t = e.options.statesHook;
452
+ B && t && ae(B.name === t.name, "expected to use the same `statesHook`"), B = t;
453
+ const { l1Cache: o, l2Cache: a } = e;
454
+ return !I.includes(o) && H(I, o), !ee.includes(a) && H(ee, a), e;
455
+ }, Tt = () => (ae(B, "`statesHook` is not set in alova instance"), B);
409
456
  export {
410
- y as Method,
411
- vt as createAlova,
412
- Ee as globalConfigMap,
413
- it as hitCacheBySource
457
+ R as Method,
458
+ Dt as createAlova,
459
+ Ht as globalConfig,
460
+ X as globalConfigMap,
461
+ ht as hitCacheBySource,
462
+ Pt as invalidateCache,
463
+ Tt as promiseStatesHook,
464
+ Mt as queryCache,
465
+ Kt as setCache
414
466
  };