web-core-tcm 0.0.52 → 0.0.53
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/node_modules/@alova/shared/dist/alova-shared.esm.js +249 -101
- package/dist/node_modules/@bufbuild/protobuf/dist/esm/clone.js +35 -0
- package/dist/node_modules/@bufbuild/protobuf/dist/esm/codegenv2/embed.js +109 -0
- package/dist/node_modules/@bufbuild/protobuf/dist/esm/codegenv2/enum.js +16 -0
- package/dist/node_modules/@bufbuild/protobuf/dist/esm/codegenv2/extension.js +9 -0
- package/dist/node_modules/@bufbuild/protobuf/dist/esm/codegenv2/file.js +9 -10
- package/dist/node_modules/@bufbuild/protobuf/dist/esm/codegenv2/index.js +28 -0
- package/dist/node_modules/@bufbuild/protobuf/dist/esm/codegenv2/scalar.js +48 -0
- package/dist/node_modules/@bufbuild/protobuf/dist/esm/codegenv2/service.js +8 -0
- package/dist/node_modules/@bufbuild/protobuf/dist/esm/codegenv2/symbols.js +49 -0
- package/dist/node_modules/@bufbuild/protobuf/dist/esm/codegenv2/types.js +1 -0
- package/dist/node_modules/@bufbuild/protobuf/dist/esm/equals.js +127 -0
- package/dist/node_modules/@bufbuild/protobuf/dist/esm/extensions.js +86 -0
- package/dist/node_modules/@bufbuild/protobuf/dist/esm/fields.js +11 -0
- package/dist/node_modules/@bufbuild/protobuf/dist/esm/from-binary.js +60 -56
- package/dist/node_modules/@bufbuild/protobuf/dist/esm/from-json.js +434 -0
- package/dist/node_modules/@bufbuild/protobuf/dist/esm/index.js +49 -0
- package/dist/node_modules/@bufbuild/protobuf/dist/esm/merge.js +33 -0
- package/dist/node_modules/@bufbuild/protobuf/dist/esm/reflect/error.js +12 -3
- package/dist/node_modules/@bufbuild/protobuf/dist/esm/reflect/guard.js +14 -10
- package/dist/node_modules/@bufbuild/protobuf/dist/esm/reflect/names.js +32 -12
- package/dist/node_modules/@bufbuild/protobuf/dist/esm/reflect/nested-types.js +42 -6
- package/dist/node_modules/@bufbuild/protobuf/dist/esm/reflect/reflect.js +58 -50
- package/dist/node_modules/@bufbuild/protobuf/dist/esm/reflect/scalar.js +26 -4
- package/dist/node_modules/@bufbuild/protobuf/dist/esm/registry.js +130 -99
- package/dist/node_modules/@bufbuild/protobuf/dist/esm/to-json.js +279 -0
- package/dist/node_modules/@bufbuild/protobuf/dist/esm/types.js +1 -0
- package/dist/node_modules/@bufbuild/protobuf/dist/esm/wire/base64-encoding.js +48 -27
- package/dist/node_modules/@bufbuild/protobuf/dist/esm/wire/index.js +24 -0
- package/dist/node_modules/@bufbuild/protobuf/dist/esm/wire/size-delimited.js +123 -0
- package/dist/node_modules/@bufbuild/protobuf/dist/esm/wire/text-encoding.js +9 -5
- package/dist/node_modules/@bufbuild/protobuf/dist/esm/wkt/any.js +40 -0
- package/dist/node_modules/@bufbuild/protobuf/dist/esm/wkt/duration.js +18 -0
- package/dist/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/any_pb.js +7 -0
- package/dist/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/api_pb.js +11 -0
- package/dist/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/compiler/plugin_pb.js +19 -0
- package/dist/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/cpp_features_pb.js +18 -0
- package/dist/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/descriptor_pb.js +134 -60
- package/dist/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/duration_pb.js +7 -0
- package/dist/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/empty_pb.js +7 -0
- package/dist/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/field_mask_pb.js +7 -0
- package/dist/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/go_features_pb.js +25 -0
- package/dist/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/java_features_pb.js +26 -0
- package/dist/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/source_context_pb.js +7 -0
- package/dist/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/struct_pb.js +17 -0
- package/dist/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/timestamp_pb.js +7 -0
- package/dist/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/type_pb.js +35 -0
- package/dist/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/wrappers_pb.js +15 -0
- package/dist/node_modules/@bufbuild/protobuf/dist/esm/wkt/index.js +180 -0
- package/dist/node_modules/@bufbuild/protobuf/dist/esm/wkt/timestamp.js +29 -0
- package/dist/node_modules/alova/dist/adapter/fetch.esm.js +10 -10
- package/dist/node_modules/alova/dist/alova.esm.js +263 -211
- package/dist/node_modules/alova/dist/clienthook/index.esm.js +2110 -70
- package/dist/node_modules/builder-pattern/dist/index.js +25 -13
- package/dist/node_modules/pinyin/lib/esm/pinyin.js +2 -2
- package/dist/node_modules/punycode/punycode.es6.js +17 -17
- package/dist/src/api/algorithm/alova/implement/comprehensiveAlgorithm.js +4 -7
- package/dist/src/api/algorithm/alova/implement/index.js +12 -0
- package/dist/src/api/algorithm/alova/implement/inquiriesAlgorithm.js +4 -7
- package/dist/src/api/algorithm/alova/implement/inspectionsAlgorithm.js +7 -10
- package/dist/src/api/algorithm/alova/implement/lisemsAlgorithm.js +6 -9
- package/dist/src/api/algorithm/alova/implement/pulsationsAlgorithm.js +7 -10
- package/dist/src/api/algorithm/alova/index.js +11 -15
- package/dist/src/api/algorithm/comprehensiveAlgorithm.js +5 -6
- package/dist/src/api/authorization/alova/globals.js +1 -0
- package/dist/src/api/authorization/alova/implement/index.js +4 -0
- package/dist/src/api/authorization/alova/index.js +10 -8
- package/dist/src/api/check/alova/globals.js +1 -0
- package/dist/src/api/check/alova/implement/index.js +5 -0
- package/dist/src/api/check/alova/index.js +5 -6
- package/dist/src/api/check/check.js +2 -2
- package/dist/src/api/config/index.d.ts +1 -1
- package/dist/src/api/config/index.js +2 -2
- package/dist/src/api/core/index.js +9 -0
- package/dist/src/api/device/device.d.ts +4 -5
- package/dist/src/api/device/device.js +20 -29
- package/dist/src/api/doctor/alova/globals.js +1 -0
- package/dist/src/api/doctor/alova/implement/index.js +4 -0
- package/dist/src/api/doctor/alova/index.js +10 -9
- package/dist/src/api/index.d.ts +12 -11
- package/dist/src/api/index.js +28 -0
- package/dist/src/api/metric/alova/implement/index.js +4 -0
- package/dist/src/api/metric/alova/index.js +1 -0
- package/dist/src/api/metric/index.js +5 -4
- package/dist/src/api/oauth/alova/globals.js +1 -0
- package/dist/src/api/oauth/alova/implement/index.js +4 -0
- package/dist/src/api/oauth/alova/index.js +13 -11
- package/dist/src/api/outpatient/alova/globals.js +1 -0
- package/dist/src/api/outpatient/alova/implement/index.js +4 -0
- package/dist/src/api/outpatient/alova/index.js +5 -5
- package/dist/src/api/patient/alova/globals.js +1 -0
- package/dist/src/api/patient/alova/implement/index.js +16 -0
- package/dist/src/api/patient/alova/index.js +9 -12
- package/dist/src/api/patient/meta.js +1 -0
- package/dist/src/api/prescription/alova/globals.js +1 -0
- package/dist/src/api/prescription/alova/implement/index.js +6 -0
- package/dist/src/api/prescription/alova/index.js +8 -7
- package/dist/src/api/scientist/alova/globals.js +1 -0
- package/dist/src/api/scientist/alova/implement/index.js +4 -0
- package/dist/src/api/scientist/alova/index.js +5 -5
- package/dist/src/index.d.ts +0 -1
- package/dist/src/index.js +34 -32
- package/dist/src/proto/index.js +10 -0
- package/dist/src/proto/types/Images_pb.js +7 -6
- package/dist/src/proto/types/WaveMap_pb.js +4 -3
- package/dist/src/util/helper.js +38 -2
- package/dist/src/util/string.js +47 -5
- package/package.json +1 -1
- package/dist/node_modules/@vue/reactivity/dist/reactivity.esm-bundler.js +0 -556
- package/dist/node_modules/@vue/runtime-core/dist/runtime-core.esm-bundler.js +0 -36
- package/dist/node_modules/@vue/shared/dist/shared.esm-bundler.js +0 -26
- package/dist/node_modules/quasar/src/composables/use-quasar/use-quasar.js +0 -8
- package/dist/node_modules/quasar/src/utils/private.symbols/symbols.js +0 -4
|
@@ -1,209 +1,256 @@
|
|
|
1
|
-
import {
|
|
2
|
-
let
|
|
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:
|
|
4
|
+
ssr: Ve
|
|
5
5
|
};
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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
|
|
12
|
-
|
|
13
|
-
},
|
|
14
|
-
if (o >
|
|
15
|
-
const c =
|
|
16
|
-
if (await
|
|
17
|
-
const h = {},
|
|
18
|
-
|
|
19
|
-
const
|
|
20
|
-
|
|
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
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
}),
|
|
26
|
-
if (
|
|
27
|
-
const l = await
|
|
28
|
-
|
|
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
|
|
37
|
+
await C.all([...i, u()]);
|
|
32
38
|
}
|
|
33
39
|
}
|
|
34
|
-
},
|
|
35
|
-
const o =
|
|
40
|
+
}, he = async (s, e, t) => {
|
|
41
|
+
const o = de(s, e);
|
|
36
42
|
await t.remove(o);
|
|
37
|
-
},
|
|
38
|
-
const
|
|
39
|
-
if (
|
|
40
|
-
const [
|
|
41
|
-
if (c === o && (!n || n >
|
|
42
|
-
return
|
|
43
|
-
await
|
|
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
|
-
},
|
|
46
|
-
const
|
|
47
|
-
return
|
|
48
|
-
},
|
|
49
|
-
const o = `${e}`,
|
|
50
|
-
|
|
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
|
|
54
|
-
|
|
55
|
-
const
|
|
56
|
-
n &&
|
|
57
|
-
const [
|
|
58
|
-
g(
|
|
59
|
-
}), await
|
|
60
|
-
const
|
|
61
|
-
|
|
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 (
|
|
70
|
+
const c = async (i) => {
|
|
65
71
|
try {
|
|
66
|
-
await t.remove(
|
|
67
|
-
for (const
|
|
68
|
-
const l =
|
|
69
|
-
l &&
|
|
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
|
|
75
|
-
const
|
|
76
|
-
if (
|
|
80
|
+
await C.all(L(k(a), async (i) => {
|
|
81
|
+
const u = a[i];
|
|
82
|
+
if (u) {
|
|
77
83
|
const l = [];
|
|
78
|
-
for (const
|
|
79
|
-
h[
|
|
80
|
-
await
|
|
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
|
|
84
|
-
await
|
|
85
|
-
const
|
|
86
|
-
|
|
87
|
-
})),
|
|
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
|
|
90
|
-
const { data: e, config: t } =
|
|
91
|
-
o.headers = { ...
|
|
92
|
-
const c = g(
|
|
93
|
-
return
|
|
94
|
-
...
|
|
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
|
|
99
|
-
|
|
100
|
-
|
|
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 &&
|
|
105
|
-
},
|
|
106
|
-
function
|
|
107
|
-
let t =
|
|
108
|
-
const
|
|
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
|
-
|
|
161
|
+
D(a, (n) => n && n.abort());
|
|
115
162
|
},
|
|
116
163
|
onDownload: (n) => {
|
|
117
|
-
|
|
164
|
+
D(a, (c) => c && c.onDownload && c.onDownload(n));
|
|
118
165
|
},
|
|
119
166
|
onUpload: (n) => {
|
|
120
|
-
|
|
167
|
+
D(a, (c) => c && c.onUpload && c.onUpload(n));
|
|
121
168
|
},
|
|
122
169
|
response: async () => {
|
|
123
|
-
const { beforeRequest: n =
|
|
124
|
-
let
|
|
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 ?
|
|
174
|
+
e ? f : O(S, i, M)
|
|
128
175
|
));
|
|
129
|
-
if (
|
|
130
|
-
const
|
|
131
|
-
if (
|
|
132
|
-
const [
|
|
133
|
-
await
|
|
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
|
|
137
|
-
await n(
|
|
138
|
-
const { baseURL:
|
|
139
|
-
let
|
|
140
|
-
if (
|
|
141
|
-
|
|
142
|
-
else if (
|
|
143
|
-
const { onSuccess:
|
|
144
|
-
|
|
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 (
|
|
147
|
-
return o(),
|
|
148
|
-
if (t =
|
|
149
|
-
const
|
|
150
|
-
url:
|
|
151
|
-
type:
|
|
152
|
-
data:
|
|
153
|
-
headers:
|
|
154
|
-
},
|
|
155
|
-
|
|
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(
|
|
158
|
-
const
|
|
159
|
-
const
|
|
160
|
-
|
|
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
|
|
209
|
+
await ht(w);
|
|
163
210
|
} catch {
|
|
164
211
|
}
|
|
165
|
-
if ((!
|
|
212
|
+
if ((!Se || !we) && P)
|
|
166
213
|
try {
|
|
167
|
-
await
|
|
168
|
-
|
|
169
|
-
|
|
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
|
|
220
|
+
return Ie(ne);
|
|
174
221
|
};
|
|
175
|
-
return
|
|
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
|
-
|
|
178
|
-
) :
|
|
179
|
-
|
|
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
|
|
186
|
-
const t = e.indexOf(
|
|
232
|
+
const Ee = (s, e) => () => {
|
|
233
|
+
const t = e.indexOf(s);
|
|
187
234
|
t >= 0 && e.splice(t, 1);
|
|
188
235
|
};
|
|
189
|
-
class
|
|
190
|
-
constructor(e, t, o,
|
|
191
|
-
this.dhs = [], this.uhs = [], this.fromCache =
|
|
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 =
|
|
196
|
-
const c = this, h =
|
|
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
|
|
199
|
-
|
|
200
|
-
h[
|
|
201
|
-
}),
|
|
202
|
-
...
|
|
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
|
-
...
|
|
206
|
-
}, c.data =
|
|
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
|
|
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
|
|
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 =
|
|
230
|
-
const t = this, { response: o, onDownload:
|
|
231
|
-
return
|
|
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
|
-
|
|
285
|
+
$(this).name = e;
|
|
239
286
|
}
|
|
240
287
|
generateKey() {
|
|
241
|
-
return
|
|
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
|
|
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
|
|
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
|
|
313
|
+
return De(this.send(), e);
|
|
267
314
|
}
|
|
268
315
|
}
|
|
269
|
-
const
|
|
270
|
-
let
|
|
271
|
-
const e =
|
|
316
|
+
const ae = ot(), E = "success", dt = () => {
|
|
317
|
+
let s = {};
|
|
318
|
+
const e = Te();
|
|
272
319
|
return {
|
|
273
|
-
set(o,
|
|
274
|
-
|
|
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
|
|
278
|
-
return e.emit(
|
|
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
|
-
|
|
328
|
+
N(s, o), e.emit(E, { type: "remove", key: o, container: s });
|
|
282
329
|
},
|
|
283
330
|
clear: () => {
|
|
284
|
-
|
|
331
|
+
s = {}, e.emit(E, { type: "clear", key: "", container: s });
|
|
285
332
|
},
|
|
286
333
|
emitter: e
|
|
287
334
|
};
|
|
288
|
-
},
|
|
289
|
-
const
|
|
335
|
+
}, pt = () => {
|
|
336
|
+
const s = Te(), e = localStorage;
|
|
290
337
|
return {
|
|
291
|
-
set: (o,
|
|
292
|
-
e.setItem(o,
|
|
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
|
|
296
|
-
return
|
|
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),
|
|
346
|
+
e.removeItem(o), s.emit(E, { type: "remove", key: o, container: e });
|
|
300
347
|
},
|
|
301
348
|
clear: () => {
|
|
302
|
-
e.clear(),
|
|
349
|
+
e.clear(), s.emit(E, { type: "clear", key: "", container: e });
|
|
303
350
|
},
|
|
304
|
-
emitter:
|
|
351
|
+
emitter: s
|
|
305
352
|
};
|
|
306
|
-
},
|
|
307
|
-
const
|
|
308
|
-
|
|
353
|
+
}, ft = () => {
|
|
354
|
+
const s = () => {
|
|
355
|
+
ae(Q, "l2Cache is not defined.");
|
|
309
356
|
};
|
|
310
357
|
return {
|
|
311
358
|
set: () => {
|
|
312
|
-
|
|
359
|
+
s();
|
|
313
360
|
},
|
|
314
|
-
get: () => (
|
|
361
|
+
get: () => (s(), f),
|
|
315
362
|
remove: () => {
|
|
316
|
-
|
|
363
|
+
s();
|
|
317
364
|
},
|
|
318
365
|
clear: () => {
|
|
319
366
|
}
|
|
320
367
|
};
|
|
321
|
-
},
|
|
322
|
-
class
|
|
368
|
+
}, He = Set;
|
|
369
|
+
class gt {
|
|
323
370
|
constructor(e) {
|
|
324
|
-
this.records = {}, this.occupy = 0,
|
|
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 } =
|
|
332
|
-
t &&
|
|
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,
|
|
341
|
-
|
|
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(
|
|
344
|
-
o ? h = c[o] || h :
|
|
345
|
-
c[
|
|
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
|
|
348
|
-
return t ?
|
|
394
|
+
const d = b(r) ? z([...h], r) : [...h];
|
|
395
|
+
return t ? d : d[0];
|
|
349
396
|
}
|
|
350
397
|
}
|
|
351
|
-
const
|
|
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
|
-
[
|
|
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
|
|
368
|
-
class
|
|
414
|
+
let vt = 0;
|
|
415
|
+
class xt {
|
|
369
416
|
constructor(e) {
|
|
370
417
|
var t, o;
|
|
371
|
-
const
|
|
372
|
-
|
|
373
|
-
...
|
|
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
|
-
},
|
|
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(
|
|
425
|
+
return g(R, e.method || ue, this, e.url, e, e.data);
|
|
379
426
|
}
|
|
380
427
|
Get(e, t) {
|
|
381
|
-
return g(
|
|
428
|
+
return g(R, ue, this, e, t);
|
|
382
429
|
}
|
|
383
430
|
Post(e, t, o) {
|
|
384
|
-
return g(
|
|
431
|
+
return g(R, mt, this, e, o, t);
|
|
385
432
|
}
|
|
386
433
|
Delete(e, t, o) {
|
|
387
|
-
return g(
|
|
434
|
+
return g(R, wt, this, e, o, t);
|
|
388
435
|
}
|
|
389
436
|
Put(e, t, o) {
|
|
390
|
-
return g(
|
|
437
|
+
return g(R, yt, this, e, o, t);
|
|
391
438
|
}
|
|
392
439
|
Head(e, t) {
|
|
393
|
-
return g(
|
|
440
|
+
return g(R, Ct, this, e, t);
|
|
394
441
|
}
|
|
395
442
|
Patch(e, t, o) {
|
|
396
|
-
return g(
|
|
443
|
+
return g(R, St, this, e, o, t);
|
|
397
444
|
}
|
|
398
445
|
Options(e, t) {
|
|
399
|
-
return g(
|
|
446
|
+
return g(R, Rt, this, e, t);
|
|
400
447
|
}
|
|
401
448
|
}
|
|
402
|
-
let
|
|
403
|
-
const
|
|
404
|
-
const e = g(
|
|
405
|
-
|
|
406
|
-
const { l1Cache: o, l2Cache:
|
|
407
|
-
return !
|
|
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
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
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
|
};
|