web-core-tcm 0.0.25 → 0.0.26
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 +134 -0
- package/dist/node_modules/@bufbuild/protobuf/dist/esm/codegenv2/boot.js +70 -0
- package/dist/node_modules/@bufbuild/protobuf/dist/esm/codegenv2/file.js +14 -0
- package/dist/node_modules/@bufbuild/protobuf/dist/esm/codegenv2/message.js +6 -0
- package/dist/node_modules/@bufbuild/protobuf/dist/esm/codegenv2/restore-json-names.js +10 -0
- package/dist/node_modules/@bufbuild/protobuf/dist/esm/create.js +136 -0
- package/dist/node_modules/@bufbuild/protobuf/dist/esm/descriptors.js +7 -0
- package/dist/node_modules/@bufbuild/protobuf/dist/esm/from-binary.js +164 -0
- package/dist/node_modules/@bufbuild/protobuf/dist/esm/is-message.js +6 -0
- package/dist/node_modules/@bufbuild/protobuf/dist/esm/proto-int64.js +75 -0
- package/dist/node_modules/@bufbuild/protobuf/dist/esm/reflect/error.js +8 -0
- package/dist/node_modules/@bufbuild/protobuf/dist/esm/reflect/guard.js +35 -0
- package/dist/node_modules/@bufbuild/protobuf/dist/esm/reflect/names.js +42 -0
- package/dist/node_modules/@bufbuild/protobuf/dist/esm/reflect/nested-types.js +17 -0
- package/dist/node_modules/@bufbuild/protobuf/dist/esm/reflect/reflect-check.js +156 -0
- package/dist/node_modules/@bufbuild/protobuf/dist/esm/reflect/reflect.js +349 -0
- package/dist/node_modules/@bufbuild/protobuf/dist/esm/reflect/scalar.js +39 -0
- package/dist/node_modules/@bufbuild/protobuf/dist/esm/reflect/unsafe.js +72 -0
- package/dist/node_modules/@bufbuild/protobuf/dist/esm/registry.js +551 -0
- package/dist/node_modules/@bufbuild/protobuf/dist/esm/to-binary.js +159 -0
- package/dist/node_modules/@bufbuild/protobuf/dist/esm/wire/base64-encoding.js +58 -0
- package/dist/node_modules/@bufbuild/protobuf/dist/esm/wire/binary-encoding.js +350 -0
- package/dist/node_modules/@bufbuild/protobuf/dist/esm/wire/text-encoding.js +25 -0
- package/dist/node_modules/@bufbuild/protobuf/dist/esm/wire/text-format.js +145 -0
- package/dist/node_modules/@bufbuild/protobuf/dist/esm/wire/varint.js +110 -0
- package/dist/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/descriptor_pb.js +107 -0
- package/dist/node_modules/@bufbuild/protobuf/dist/esm/wkt/wrappers.js +24 -0
- package/dist/node_modules/@vue/reactivity/dist/reactivity.esm-bundler.js +556 -0
- package/dist/node_modules/@vue/runtime-core/dist/runtime-core.esm-bundler.js +36 -0
- package/dist/node_modules/@vue/shared/dist/shared.esm-bundler.js +26 -0
- package/dist/node_modules/alova/dist/adapter/fetch.esm.js +55 -0
- package/dist/node_modules/alova/dist/alova.esm.js +414 -0
- package/dist/node_modules/alova/dist/clienthook/index.esm.js +89 -0
- package/dist/node_modules/builder-pattern/dist/index.js +22 -0
- package/dist/node_modules/jwt-decode/build/esm/index.js +52 -0
- package/dist/node_modules/pinyin/lib/esm/pinyin.js +242260 -0
- package/dist/node_modules/punycode/punycode.es6.js +139 -0
- package/dist/node_modules/quasar/src/composables/use-quasar/use-quasar.js +8 -0
- package/dist/node_modules/quasar/src/utils/private.symbols/symbols.js +4 -0
- package/dist/src/api/algorithm/comprehensiveAlgorithm.d.ts +4 -0
- package/dist/src/api/algorithm/comprehensiveAlgorithm.js +16 -0
- package/dist/src/api/algorithm/index.d.ts +10 -0
- package/dist/src/api/algorithm/index.js +62 -0
- package/dist/src/api/algorithm/inquiriesAlgorithm.d.ts +13 -0
- package/dist/src/api/algorithm/inquiriesAlgorithm.js +9 -0
- package/dist/src/api/algorithm/inspectionsAlgorithm.d.ts +2 -0
- package/dist/src/api/algorithm/inspectionsAlgorithm.js +10 -0
- package/dist/src/api/algorithm/lisemsAlgorithm.d.ts +2 -0
- package/dist/src/api/algorithm/lisemsAlgorithm.js +15 -0
- package/dist/src/api/algorithm/pulsationsAlgorithm.d.ts +4 -0
- package/dist/src/api/algorithm/pulsationsAlgorithm.js +8 -0
- package/dist/src/api/authorization/alova/apiDefinitions.d.ts +21 -0
- package/dist/src/api/authorization/alova/apiDefinitions.js +9 -0
- package/dist/src/api/authorization/alova/createApis.d.ts +10 -0
- package/dist/src/api/authorization/alova/createApis.js +51 -0
- package/dist/src/api/authorization/alova/implement/authorization.d.ts +4 -0
- package/dist/src/api/authorization/alova/implement/authorization.js +15 -0
- package/dist/src/api/authorization/alova/index.d.ts +5 -0
- package/dist/src/api/authorization/alova/index.js +18 -0
- package/dist/src/api/authorization/authorization.d.ts +8 -0
- package/dist/src/api/authorization/authorization.js +16 -0
- package/dist/src/api/authorization/index.js +9 -0
- package/dist/src/api/check/alova/apiDefinitions.d.ts +28 -0
- package/dist/src/api/check/alova/apiDefinitions.js +16 -0
- package/dist/src/api/check/alova/createApis.d.ts +10 -0
- package/dist/src/api/check/alova/createApis.js +51 -0
- package/dist/src/api/check/alova/implement/check.d.ts +27 -0
- package/dist/src/api/check/alova/implement/check.js +119 -0
- package/dist/src/api/check/alova/index.d.ts +5 -0
- package/dist/src/api/check/alova/index.js +21 -0
- package/dist/src/api/check/check.d.ts +54 -0
- package/dist/src/api/check/check.js +131 -0
- package/dist/src/api/check/index.js +11 -0
- package/dist/src/api/config/alova/index.d.ts +5 -0
- package/dist/src/api/config/alova/index.js +55 -0
- package/dist/src/api/config/index.d.ts +23 -0
- package/dist/src/api/config/index.js +106 -0
- package/dist/src/api/device/device.d.ts +5 -0
- package/dist/src/api/device/device.js +46 -0
- package/dist/src/api/doctor/alova/apiDefinitions.d.ts +26 -0
- package/dist/src/api/doctor/alova/apiDefinitions.js +14 -0
- package/dist/src/api/doctor/alova/createApis.d.ts +10 -0
- package/dist/src/api/doctor/alova/createApis.js +51 -0
- package/dist/src/api/doctor/alova/implement/doctor.d.ts +7 -0
- package/dist/src/api/doctor/alova/implement/doctor.js +42 -0
- package/dist/src/api/doctor/alova/index.d.ts +5 -0
- package/dist/src/api/doctor/alova/index.js +20 -0
- package/dist/src/api/doctor/doctor.d.ts +22 -0
- package/dist/src/api/doctor/doctor.js +29 -0
- package/dist/src/api/doctor/index.js +9 -0
- package/dist/src/api/metric/implement/metric.d.ts +24 -0
- package/dist/src/api/metric/implement/metric.js +80 -0
- package/dist/src/api/metric/index.js +6 -0
- package/dist/src/api/metric/metric.d.ts +28 -0
- package/dist/src/api/metric/metric.js +75 -0
- package/dist/src/api/oauth/alova/apiDefinitions.d.ts +24 -0
- package/dist/src/api/oauth/alova/apiDefinitions.js +12 -0
- package/dist/src/api/oauth/alova/createApis.d.ts +10 -0
- package/dist/src/api/oauth/alova/createApis.js +51 -0
- package/dist/src/api/oauth/alova/implement/oauth.d.ts +4 -0
- package/dist/src/api/oauth/alova/implement/oauth.js +15 -0
- package/dist/src/api/oauth/alova/index.d.ts +5 -0
- package/dist/src/api/oauth/alova/index.js +17 -0
- package/dist/src/api/oauth/index.js +9 -0
- package/dist/src/api/oauth/oauth.d.ts +7 -0
- package/dist/src/api/oauth/oauth.js +16 -0
- package/dist/src/api/outpatient/alova/apiDefinitions.d.ts +25 -0
- package/dist/src/api/outpatient/alova/apiDefinitions.js +13 -0
- package/dist/src/api/outpatient/alova/createApis.d.ts +10 -0
- package/dist/src/api/outpatient/alova/createApis.js +51 -0
- package/dist/src/api/outpatient/alova/implement/outpatient.d.ts +10 -0
- package/dist/src/api/outpatient/alova/implement/outpatient.js +71 -0
- package/dist/src/api/outpatient/alova/index.d.ts +5 -0
- package/dist/src/api/outpatient/alova/index.js +21 -0
- package/dist/src/api/outpatient/index.js +11 -0
- package/dist/src/api/outpatient/outpatient.d.ts +39 -0
- package/dist/src/api/outpatient/outpatient.js +45 -0
- package/dist/src/api/patient/alova/apiDefinitions.d.ts +39 -0
- package/dist/src/api/patient/alova/apiDefinitions.js +27 -0
- package/dist/src/api/patient/alova/createApis.d.ts +10 -0
- package/dist/src/api/patient/alova/createApis.js +51 -0
- package/dist/src/api/patient/alova/implement/meta.d.ts +113 -0
- package/dist/src/api/patient/alova/implement/meta.js +404 -0
- package/dist/src/api/patient/alova/implement/patient.d.ts +22 -0
- package/dist/src/api/patient/alova/implement/patient.js +72 -0
- package/dist/src/api/patient/alova/index.d.ts +5 -0
- package/dist/src/api/patient/alova/index.js +22 -0
- package/dist/src/api/patient/core.d.ts +50 -0
- package/dist/src/api/patient/core.js +109 -0
- package/dist/src/api/patient/index.js +46 -0
- package/dist/src/api/patient/meta.d.ts +238 -0
- package/dist/src/api/patient/meta.js +454 -0
- package/dist/src/api/patient/patient.d.ts +43 -0
- package/dist/src/api/patient/patient.js +42 -0
- package/dist/src/api/prescription/alova/apiDefinitions.d.ts +27 -0
- package/dist/src/api/prescription/alova/apiDefinitions.js +15 -0
- package/dist/src/api/prescription/alova/createApis.d.ts +10 -0
- package/dist/src/api/prescription/alova/createApis.js +51 -0
- package/dist/src/api/prescription/alova/implement/herbal.d.ts +15 -0
- package/dist/src/api/prescription/alova/implement/herbal.js +54 -0
- package/dist/src/api/prescription/alova/implement/prescription.d.ts +15 -0
- package/dist/src/api/prescription/alova/implement/prescription.js +49 -0
- package/dist/src/api/prescription/alova/index.d.ts +5 -0
- package/dist/src/api/prescription/alova/index.js +20 -0
- package/dist/src/api/prescription/herbal.d.ts +19 -0
- package/dist/src/api/prescription/herbal.js +34 -0
- package/dist/src/api/prescription/index.js +13 -0
- package/dist/src/api/prescription/prescription.d.ts +26 -0
- package/dist/src/api/prescription/prescription.js +49 -0
- package/dist/src/api/scientist/alova/apiDefinitions.d.ts +25 -0
- package/dist/src/api/scientist/alova/apiDefinitions.js +13 -0
- package/dist/src/api/scientist/alova/createApis.d.ts +10 -0
- package/dist/src/api/scientist/alova/createApis.js +51 -0
- package/dist/src/api/scientist/alova/implement/scientist.d.ts +6 -0
- package/dist/src/api/scientist/alova/implement/scientist.js +35 -0
- package/dist/src/api/scientist/alova/index.d.ts +6 -0
- package/dist/src/api/scientist/alova/index.js +21 -0
- package/dist/src/api/scientist/index.js +9 -0
- package/dist/src/api/scientist/scientist.d.ts +20 -0
- package/dist/src/api/scientist/scientist.js +37 -0
- package/dist/src/components/models.d.ts +7 -0
- package/dist/src/index.js +36 -0
- package/dist/src/pages/LoginPage.vue.d.ts +2 -0
- package/dist/src/proto/types/Images_pb.d.ts +34 -0
- package/dist/src/proto/types/Images_pb.js +10 -0
- package/dist/src/proto/types/WaveMap_pb.d.ts +48 -0
- package/dist/src/proto/types/WaveMap_pb.js +10 -0
- package/dist/src/router/index.d.ts +2 -0
- package/dist/src/router/routes.d.ts +3 -0
- package/dist/src/util/RichTextUtil.d.ts +1 -0
- package/dist/src/util/RichTextUtil.js +6 -0
- package/dist/src/util/datetime.d.ts +5 -0
- package/dist/src/util/export.d.ts +4 -0
- package/dist/src/util/helper.d.ts +65 -0
- package/dist/src/util/helper.js +46 -0
- package/dist/src/util/image.d.ts +2 -0
- package/dist/src/util/image.js +17 -0
- package/dist/src/util/number.d.ts +12 -0
- package/dist/src/util/s256.d.ts +2 -0
- package/dist/src/util/secret.d.ts +10 -0
- package/dist/src/util/string.d.ts +21 -0
- package/dist/src/util/string.js +10 -0
- package/package.json +4 -1
- package/.editorconfig +0 -7
- package/.github/workflows/test.yml +0 -29
- package/.prettierrc.json +0 -5
- package/.vscode/extensions.json +0 -15
- package/.vscode/settings.json +0 -9
- package/eslint.config.js +0 -83
- package/index.html +0 -24
- package/postcss.config.js +0 -29
- package/quasar.config.ts +0 -233
- package/src/App.vue +0 -7
- package/src/api/algorithm/comprehensiveAlgorithm.ts +0 -20
- package/src/api/algorithm/index.ts +0 -50
- package/src/api/algorithm/inquiriesAlgorithm.ts +0 -16
- package/src/api/algorithm/inspectionsAlgorithm.ts +0 -11
- package/src/api/algorithm/lisemsAlgorithm.ts +0 -16
- package/src/api/algorithm/pulsationsAlgorithm.ts +0 -8
- package/src/api/authorization/alova/apiDefinitions.ts +0 -23
- package/src/api/authorization/alova/createApis.ts +0 -114
- package/src/api/authorization/alova/globals.d.ts +0 -394
- package/src/api/authorization/alova/implement/authorization.ts +0 -14
- package/src/api/authorization/alova/index.ts +0 -22
- package/src/api/authorization/authorization.ts +0 -16
- package/src/api/check/alova/apiDefinitions.ts +0 -30
- package/src/api/check/alova/createApis.ts +0 -114
- package/src/api/check/alova/globals.d.ts +0 -1257
- package/src/api/check/alova/implement/check.ts +0 -165
- package/src/api/check/alova/index.ts +0 -22
- package/src/api/check/check.ts +0 -217
- package/src/api/config/alova/index.ts +0 -71
- package/src/api/config/index.ts +0 -132
- package/src/api/device/device.js +0 -58
- package/src/api/doctor/alova/apiDefinitions.ts +0 -28
- package/src/api/doctor/alova/createApis.ts +0 -114
- package/src/api/doctor/alova/globals.d.ts +0 -559
- package/src/api/doctor/alova/implement/doctor.ts +0 -51
- package/src/api/doctor/alova/index.ts +0 -23
- package/src/api/doctor/doctor.ts +0 -53
- package/src/api/metric/implement/metric.ts +0 -108
- package/src/api/metric/metric.ts +0 -114
- package/src/api/oauth/alova/apiDefinitions.ts +0 -26
- package/src/api/oauth/alova/createApis.ts +0 -114
- package/src/api/oauth/alova/globals.d.ts +0 -460
- package/src/api/oauth/alova/implement/oauth.ts +0 -24
- package/src/api/oauth/alova/index.ts +0 -21
- package/src/api/oauth/oauth.ts +0 -19
- package/src/api/outpatient/alova/apiDefinitions.ts +0 -27
- package/src/api/outpatient/alova/createApis.ts +0 -114
- package/src/api/outpatient/alova/globals.d.ts +0 -685
- package/src/api/outpatient/alova/implement/outpatient.ts +0 -91
- package/src/api/outpatient/alova/index.ts +0 -22
- package/src/api/outpatient/outpatient.ts +0 -67
- package/src/api/patient/alova/apiDefinitions.ts +0 -41
- package/src/api/patient/alova/createApis.ts +0 -114
- package/src/api/patient/alova/globals.d.ts +0 -1690
- package/src/api/patient/alova/implement/meta.ts +0 -517
- package/src/api/patient/alova/implement/patient.ts +0 -99
- package/src/api/patient/alova/index.ts +0 -22
- package/src/api/patient/core.ts +0 -133
- package/src/api/patient/meta.ts +0 -570
- package/src/api/patient/patient.ts +0 -98
- package/src/api/prescription/alova/apiDefinitions.ts +0 -29
- package/src/api/prescription/alova/createApis.ts +0 -114
- package/src/api/prescription/alova/globals.d.ts +0 -968
- package/src/api/prescription/alova/implement/herbal.ts +0 -68
- package/src/api/prescription/alova/implement/prescription.ts +0 -62
- package/src/api/prescription/alova/index.ts +0 -22
- package/src/api/prescription/herbal.ts +0 -51
- package/src/api/prescription/prescription.ts +0 -76
- package/src/api/scientist/alova/apiDefinitions.ts +0 -27
- package/src/api/scientist/alova/createApis.ts +0 -114
- package/src/api/scientist/alova/globals.d.ts +0 -447
- package/src/api/scientist/alova/implement/scientist.ts +0 -40
- package/src/api/scientist/alova/index.ts +0 -24
- package/src/api/scientist/scientist.ts +0 -49
- package/src/assets/quasar-logo-vertical.svg +0 -15
- package/src/boot/.gitkeep +0 -0
- package/src/components/ExampleComponent.vue +0 -37
- package/src/components/models.ts +0 -8
- package/src/css/app.scss +0 -1
- package/src/css/quasar.variables.scss +0 -25
- package/src/env.d.ts +0 -7
- package/src/layouts/UserLayout.vue +0 -108
- package/src/pages/LoginPage.vue +0 -29
- package/src/proto/Images.proto +0 -7
- package/src/proto/WaveMap.proto +0 -10
- package/src/proto/types/Images_pb.ts +0 -48
- package/src/proto/types/WaveMap_pb.ts +0 -59
- package/src/router/index.ts +0 -37
- package/src/router/routes.ts +0 -14
- package/src/util/RichTextUtil.ts +0 -5
- package/src/util/datetime.ts +0 -43
- package/src/util/export.ts +0 -46
- package/src/util/helper.ts +0 -159
- package/src/util/image.ts +0 -28
- package/src/util/number.ts +0 -146
- package/src/util/s256.js +0 -27
- package/src/util/secret.ts +0 -60
- package/src/util/string.ts +0 -121
- package/tsconfig.json +0 -7
- /package/{public → dist}/favicon.ico +0 -0
- /package/{public → dist}/icons/favicon-128x128.png +0 -0
- /package/{public → dist}/icons/favicon-16x16.png +0 -0
- /package/{public → dist}/icons/favicon-32x32.png +0 -0
- /package/{public → dist}/icons/favicon-96x96.png +0 -0
- /package/{src/api/authorization/alova/implement/index.ts → dist/src/api/authorization/alova/implement/index.d.ts} +0 -0
- /package/{src/api/authorization/index.ts → dist/src/api/authorization/index.d.ts} +0 -0
- /package/{src/api/check/alova/implement/index.ts → dist/src/api/check/alova/implement/index.d.ts} +0 -0
- /package/{src/api/check/index.ts → dist/src/api/check/index.d.ts} +0 -0
- /package/{src/api/doctor/alova/implement/index.ts → dist/src/api/doctor/alova/implement/index.d.ts} +0 -0
- /package/{src/api/doctor/index.ts → dist/src/api/doctor/index.d.ts} +0 -0
- /package/{src/api/index.ts → dist/src/api/index.d.ts} +0 -0
- /package/{src/api/metric/implement/index.ts → dist/src/api/metric/implement/index.d.ts} +0 -0
- /package/{src/api/metric/index.ts → dist/src/api/metric/index.d.ts} +0 -0
- /package/{src/api/oauth/alova/implement/index.ts → dist/src/api/oauth/alova/implement/index.d.ts} +0 -0
- /package/{src/api/oauth/index.ts → dist/src/api/oauth/index.d.ts} +0 -0
- /package/{src/api/outpatient/alova/implement/index.ts → dist/src/api/outpatient/alova/implement/index.d.ts} +0 -0
- /package/{src/api/outpatient/index.ts → dist/src/api/outpatient/index.d.ts} +0 -0
- /package/{src/api/patient/alova/implement/index.ts → dist/src/api/patient/alova/implement/index.d.ts} +0 -0
- /package/{src/api/patient/index.ts → dist/src/api/patient/index.d.ts} +0 -0
- /package/{src/api/prescription/alova/implement/index.ts → dist/src/api/prescription/alova/implement/index.d.ts} +0 -0
- /package/{src/api/prescription/index.ts → dist/src/api/prescription/index.d.ts} +0 -0
- /package/{src/api/scientist/alova/implement/index.ts → dist/src/api/scientist/alova/implement/index.d.ts} +0 -0
- /package/{src/api/scientist/index.ts → dist/src/api/scientist/index.d.ts} +0 -0
- /package/{src/index.ts → dist/src/index.d.ts} +0 -0
- /package/{src/proto/index.ts → dist/src/proto/index.d.ts} +0 -0
|
@@ -0,0 +1,414 @@
|
|
|
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 = {
|
|
3
|
+
autoHitCache: "global",
|
|
4
|
+
ssr: et
|
|
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()));
|
|
10
|
+
};
|
|
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)));
|
|
21
|
+
});
|
|
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);
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
await x.all([...r, d()]);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}, at = async (a, e, t) => {
|
|
35
|
+
const o = ie(a, e);
|
|
36
|
+
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);
|
|
44
|
+
}
|
|
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
|
+
let n;
|
|
52
|
+
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);
|
|
62
|
+
})));
|
|
63
|
+
}
|
|
64
|
+
const c = async (r) => {
|
|
65
|
+
try {
|
|
66
|
+
await t.remove(r);
|
|
67
|
+
for (const d in s) {
|
|
68
|
+
const l = s[d];
|
|
69
|
+
l && A(l, r);
|
|
70
|
+
}
|
|
71
|
+
} catch {
|
|
72
|
+
}
|
|
73
|
+
}, h = {};
|
|
74
|
+
await x.all(O(L(s), async (r) => {
|
|
75
|
+
const d = s[r];
|
|
76
|
+
if (d) {
|
|
77
|
+
const l = [];
|
|
78
|
+
for (const u in d)
|
|
79
|
+
h[u] || (ee(h, u), v(l, c(u)));
|
|
80
|
+
await x.all(l);
|
|
81
|
+
}
|
|
82
|
+
}));
|
|
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);
|
|
88
|
+
};
|
|
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
|
+
config: o
|
|
96
|
+
});
|
|
97
|
+
};
|
|
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],
|
|
101
|
+
self: [t, o],
|
|
102
|
+
close: []
|
|
103
|
+
}[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) => {
|
|
109
|
+
o = n;
|
|
110
|
+
});
|
|
111
|
+
return {
|
|
112
|
+
// request interrupt function
|
|
113
|
+
abort: () => {
|
|
114
|
+
P(s, (n) => n && n.abort());
|
|
115
|
+
},
|
|
116
|
+
onDownload: (n) => {
|
|
117
|
+
P(s, (c) => c && c.onDownload && c.onDownload(n));
|
|
118
|
+
},
|
|
119
|
+
onUpload: (n) => {
|
|
120
|
+
P(s, (c) => c && c.onUpload && c.onUpload(n));
|
|
121
|
+
},
|
|
122
|
+
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() : (
|
|
125
|
+
// If it is a forced request, skip the step of getting it from the cache
|
|
126
|
+
// Otherwise, determine whether to use cached data
|
|
127
|
+
e ? m : nt(E, r, G)
|
|
128
|
+
));
|
|
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;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
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;
|
|
145
|
+
}
|
|
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;
|
|
156
|
+
}
|
|
157
|
+
o(D);
|
|
158
|
+
const fe = async (f, w, M = $) => {
|
|
159
|
+
const Fe = await f, J = await _e(Fe, w || {});
|
|
160
|
+
Ke.save(a);
|
|
161
|
+
try {
|
|
162
|
+
await it(C);
|
|
163
|
+
} catch {
|
|
164
|
+
}
|
|
165
|
+
if ((!de || !ge) && M)
|
|
166
|
+
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)
|
|
170
|
+
]);
|
|
171
|
+
} catch {
|
|
172
|
+
}
|
|
173
|
+
return st(J);
|
|
174
|
+
};
|
|
175
|
+
return xe(P(x.all([D.response(), D.headers()]), ([f, w]) => (A(_, r), fe(B(f, C), w)), (f) => (A(_, r), H(F) ? (
|
|
176
|
+
// 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);
|
|
180
|
+
});
|
|
181
|
+
},
|
|
182
|
+
fromCache: () => t
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
const ye = (a, e) => () => {
|
|
186
|
+
const t = e.indexOf(a);
|
|
187
|
+
t >= 0 && e.splice(t, 1);
|
|
188
|
+
};
|
|
189
|
+
class y {
|
|
190
|
+
constructor(e, t, o, s, i) {
|
|
191
|
+
this.dhs = [], this.uhs = [], this.fromCache = m;
|
|
192
|
+
const n = () => {
|
|
193
|
+
n.a();
|
|
194
|
+
};
|
|
195
|
+
n.a = Q, e = e.toUpperCase();
|
|
196
|
+
const c = this, h = $e(t);
|
|
197
|
+
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,
|
|
203
|
+
headers: {},
|
|
204
|
+
params: {},
|
|
205
|
+
...s || {}
|
|
206
|
+
}, c.data = i, c.meta = s ? s.meta : c.meta, c.key = c.generateKey();
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* Bind download progress callback function
|
|
210
|
+
* @param progressHandler Download progress callback function
|
|
211
|
+
* @version 2.17.0
|
|
212
|
+
* @return unbind function
|
|
213
|
+
*/
|
|
214
|
+
onDownload(e) {
|
|
215
|
+
return v(this.dhs, e), ye(e, this.dhs);
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* Bind upload progress callback function
|
|
219
|
+
* @param progressHandler Upload progress callback function
|
|
220
|
+
* @version 2.17.0
|
|
221
|
+
* @return unbind function
|
|
222
|
+
*/
|
|
223
|
+
onUpload(e) {
|
|
224
|
+
return v(this.uhs, e), ye(e, this.uhs);
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* Send a request through a method instance and return a promise object
|
|
228
|
+
*/
|
|
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;
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* Set the method name, if there is already a name it will be overwritten
|
|
235
|
+
* @param name method name
|
|
236
|
+
*/
|
|
237
|
+
setName(e) {
|
|
238
|
+
U(this).name = e;
|
|
239
|
+
}
|
|
240
|
+
generateKey() {
|
|
241
|
+
return We(this);
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
* Bind callbacks for resolve and/or reject Promise
|
|
245
|
+
* @param onfulfilled The callback to be executed when resolving the Promise
|
|
246
|
+
* @param onrejected The callback to be executed when the Promise is rejected
|
|
247
|
+
* @returns Returns a Promise for executing any callbacks
|
|
248
|
+
*/
|
|
249
|
+
then(e, t) {
|
|
250
|
+
return P(this.send(), e, t);
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* Bind a callback only for reject Promise
|
|
254
|
+
* @param onrejected The callback to be executed when the Promise is rejected
|
|
255
|
+
* @returns Returns a Promise that completes the callback
|
|
256
|
+
*/
|
|
257
|
+
catch(e) {
|
|
258
|
+
return je(this.send(), e);
|
|
259
|
+
}
|
|
260
|
+
/**
|
|
261
|
+
* Bind a callback that is called when the Promise is resolved (resolve or reject)
|
|
262
|
+
* @param onfinally Callback executed when Promise is resolved (resolve or reject).
|
|
263
|
+
* @return Returns a Promise that completes the callback.
|
|
264
|
+
*/
|
|
265
|
+
finally(e) {
|
|
266
|
+
return xe(this.send(), e);
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
const he = qe(), b = "success", ht = () => {
|
|
270
|
+
let a = {};
|
|
271
|
+
const e = Re();
|
|
272
|
+
return {
|
|
273
|
+
set(o, s) {
|
|
274
|
+
a[o] = s, e.emit(b, { type: "set", key: o, value: s, container: a });
|
|
275
|
+
},
|
|
276
|
+
get: (o) => {
|
|
277
|
+
const s = a[o];
|
|
278
|
+
return e.emit(b, { type: "get", key: o, value: s, container: a }), s;
|
|
279
|
+
},
|
|
280
|
+
remove(o) {
|
|
281
|
+
A(a, o), e.emit(b, { type: "remove", key: o, container: a });
|
|
282
|
+
},
|
|
283
|
+
clear: () => {
|
|
284
|
+
a = {}, e.emit(b, { type: "clear", key: "", container: a });
|
|
285
|
+
},
|
|
286
|
+
emitter: e
|
|
287
|
+
};
|
|
288
|
+
}, ut = () => {
|
|
289
|
+
const a = Re(), e = localStorage;
|
|
290
|
+
return {
|
|
291
|
+
set: (o, s) => {
|
|
292
|
+
e.setItem(o, Ve(s)), a.emit(b, { type: "set", key: o, value: s, container: e });
|
|
293
|
+
},
|
|
294
|
+
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;
|
|
297
|
+
},
|
|
298
|
+
remove: (o) => {
|
|
299
|
+
e.removeItem(o), a.emit(b, { type: "remove", key: o, container: e });
|
|
300
|
+
},
|
|
301
|
+
clear: () => {
|
|
302
|
+
e.clear(), a.emit(b, { type: "clear", key: "", container: e });
|
|
303
|
+
},
|
|
304
|
+
emitter: a
|
|
305
|
+
};
|
|
306
|
+
}, pt = () => {
|
|
307
|
+
const a = () => {
|
|
308
|
+
he(W, "l2Cache is not defined.");
|
|
309
|
+
};
|
|
310
|
+
return {
|
|
311
|
+
set: () => {
|
|
312
|
+
a();
|
|
313
|
+
},
|
|
314
|
+
get: () => (a(), m),
|
|
315
|
+
remove: () => {
|
|
316
|
+
a();
|
|
317
|
+
},
|
|
318
|
+
clear: () => {
|
|
319
|
+
}
|
|
320
|
+
};
|
|
321
|
+
}, Se = Set;
|
|
322
|
+
class dt {
|
|
323
|
+
constructor(e) {
|
|
324
|
+
this.records = {}, this.occupy = 0, he(e >= 0, "expected snapshots limit to be >= 0"), this.capacity = e;
|
|
325
|
+
}
|
|
326
|
+
/**
|
|
327
|
+
* Save method instance snapshot
|
|
328
|
+
* @param methodInstance method instance
|
|
329
|
+
*/
|
|
330
|
+
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);
|
|
333
|
+
}
|
|
334
|
+
/**
|
|
335
|
+
* Get a Method instance snapshot, which will filter out the corresponding Method instance based on the matcher
|
|
336
|
+
* @param matcher Matching snapshot name, which can be a string or regular expression, or an object with a filter function
|
|
337
|
+
* @returns Array of matched Method instance snapshots
|
|
338
|
+
*/
|
|
339
|
+
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);
|
|
342
|
+
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));
|
|
346
|
+
});
|
|
347
|
+
const p = H(i) ? k([...h], i) : [...h];
|
|
348
|
+
return t ? p : p[0];
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
const te = "GET", gt = "HEAD", ft = "POST", mt = "PUT", Ct = "PATCH", yt = "DELETE", St = "OPTIONS", we = {
|
|
352
|
+
/**
|
|
353
|
+
* GET requests are cached for 5 minutes (300000 milliseconds) by default, and other requests are not cached by default.
|
|
354
|
+
*/
|
|
355
|
+
cacheFor: {
|
|
356
|
+
[te]: 3e5
|
|
357
|
+
},
|
|
358
|
+
/**
|
|
359
|
+
* Share requests default to true
|
|
360
|
+
*/
|
|
361
|
+
shareRequest: $,
|
|
362
|
+
/**
|
|
363
|
+
* Number of method snapshots, default is 1000
|
|
364
|
+
*/
|
|
365
|
+
snapshots: 1e3
|
|
366
|
+
};
|
|
367
|
+
let wt = 0;
|
|
368
|
+
class Rt {
|
|
369
|
+
constructor(e) {
|
|
370
|
+
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,
|
|
374
|
+
...e
|
|
375
|
+
}, s.snapshots = g(dt, (o = (t = e.snapshots) !== null && t !== void 0 ? t : we.snapshots) !== null && o !== void 0 ? o : 0);
|
|
376
|
+
}
|
|
377
|
+
Request(e) {
|
|
378
|
+
return g(y, e.method || te, this, e.url, e, e.data);
|
|
379
|
+
}
|
|
380
|
+
Get(e, t) {
|
|
381
|
+
return g(y, te, this, e, t);
|
|
382
|
+
}
|
|
383
|
+
Post(e, t, o) {
|
|
384
|
+
return g(y, ft, this, e, o, t);
|
|
385
|
+
}
|
|
386
|
+
Delete(e, t, o) {
|
|
387
|
+
return g(y, yt, this, e, o, t);
|
|
388
|
+
}
|
|
389
|
+
Put(e, t, o) {
|
|
390
|
+
return g(y, mt, this, e, o, t);
|
|
391
|
+
}
|
|
392
|
+
Head(e, t) {
|
|
393
|
+
return g(y, gt, this, e, t);
|
|
394
|
+
}
|
|
395
|
+
Patch(e, t, o) {
|
|
396
|
+
return g(y, Ct, this, e, o, t);
|
|
397
|
+
}
|
|
398
|
+
Options(e, t) {
|
|
399
|
+
return g(y, St, this, e, t);
|
|
400
|
+
}
|
|
401
|
+
}
|
|
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
|
+
};
|
|
409
|
+
export {
|
|
410
|
+
y as Method,
|
|
411
|
+
vt as createAlova,
|
|
412
|
+
Ee as globalConfigMap,
|
|
413
|
+
it as hitCacheBySource
|
|
414
|
+
};
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { noop as x, $self as F, isFn as u, isPlainObject as O, undefinedValue as R, instanceOf as A, trueValue as d, falseValue as v, len as w, PromiseCls as V, newInstance as L, forEach as P, splice as b, pushItem as h } from "../../../@alova/shared/dist/alova-shared.esm.js";
|
|
2
|
+
const j = {
|
|
3
|
+
authRole: null
|
|
4
|
+
}, M = {
|
|
5
|
+
authRole: "login"
|
|
6
|
+
}, p = {
|
|
7
|
+
authRole: "logout"
|
|
8
|
+
}, G = {
|
|
9
|
+
authRole: "refreshToken"
|
|
10
|
+
}, C = ({ meta: n }, s) => {
|
|
11
|
+
if (O(n)) {
|
|
12
|
+
for (const l in n)
|
|
13
|
+
if (Object.prototype.hasOwnProperty.call(n, l)) {
|
|
14
|
+
const e = s[l];
|
|
15
|
+
if (A(e, RegExp) ? e.test(n[l]) : n[l] === e)
|
|
16
|
+
return d;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return v;
|
|
20
|
+
}, Q = (n, s) => L(V, (l) => {
|
|
21
|
+
h(s, {
|
|
22
|
+
method: n,
|
|
23
|
+
resolve: l
|
|
24
|
+
});
|
|
25
|
+
}), N = (n, s, l, e) => {
|
|
26
|
+
if (C(n, s?.metaMatches || l))
|
|
27
|
+
return (u(s) ? s : O(s) && u(s.handler) ? s.handler : x)(e, n);
|
|
28
|
+
}, W = async (n, s, l, e, t, a) => {
|
|
29
|
+
const o = w(e) >= 2;
|
|
30
|
+
let E = t?.isExpired(...e);
|
|
31
|
+
if (A(E, V) && (E = await E), E)
|
|
32
|
+
try {
|
|
33
|
+
if (d && (l(d), await t?.handler(...e), l(v), P(s, ({ resolve: i }) => i())), o) {
|
|
34
|
+
const { config: i } = n, c = i.transform;
|
|
35
|
+
i.transform = R;
|
|
36
|
+
const r = await n;
|
|
37
|
+
return i.transform = c, r;
|
|
38
|
+
}
|
|
39
|
+
} finally {
|
|
40
|
+
l(v), b(s, 0, w(s));
|
|
41
|
+
}
|
|
42
|
+
}, $ = (n) => {
|
|
43
|
+
let s = R, l = R, e = R;
|
|
44
|
+
if (u(n))
|
|
45
|
+
s = n;
|
|
46
|
+
else if (O(n)) {
|
|
47
|
+
const { onSuccess: t, onError: a, onComplete: o } = n;
|
|
48
|
+
s = u(t) ? t : s, l = u(a) ? a : l, e = u(o) ? o : e;
|
|
49
|
+
}
|
|
50
|
+
return {
|
|
51
|
+
onSuccess: s,
|
|
52
|
+
onError: l,
|
|
53
|
+
onComplete: e
|
|
54
|
+
};
|
|
55
|
+
}, I = ({ visitorMeta: n, login: s, logout: l, refreshToken: e, assignToken: t = x }) => {
|
|
56
|
+
let a = v;
|
|
57
|
+
const o = [];
|
|
58
|
+
return {
|
|
59
|
+
waitingList: o,
|
|
60
|
+
onAuthRequired: (i) => async (c) => {
|
|
61
|
+
const r = C(c, n || j), f = C(c, s?.metaMatches || M);
|
|
62
|
+
return !r && !f && !C(c, e?.metaMatches || G) && (a && await Q(c, o), await W(c, o, (D) => {
|
|
63
|
+
a = D;
|
|
64
|
+
}, [c], e)), !r && !f && await t(c), i?.(c);
|
|
65
|
+
},
|
|
66
|
+
onResponseRefreshToken: (i) => {
|
|
67
|
+
const c = $(i);
|
|
68
|
+
return {
|
|
69
|
+
...c,
|
|
70
|
+
onSuccess: async (r, f) => (await N(f, s, M, r), await N(f, l, p, r), (c.onSuccess || F)(r, f))
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
};
|
|
75
|
+
var U;
|
|
76
|
+
(function(n) {
|
|
77
|
+
n[n.USE_REQUEST = 1] = "USE_REQUEST", n[n.USE_WATCHER = 2] = "USE_WATCHER", n[n.USE_FETCHER = 3] = "USE_FETCHER";
|
|
78
|
+
})(U || (U = {}));
|
|
79
|
+
var T;
|
|
80
|
+
(function(n) {
|
|
81
|
+
n[n.CONNECTING = 0] = "CONNECTING", n[n.OPEN = 1] = "OPEN", n[n.CLOSED = 2] = "CLOSED";
|
|
82
|
+
})(T || (T = {}));
|
|
83
|
+
var _;
|
|
84
|
+
(function(n) {
|
|
85
|
+
n.Open = "open", n.Error = "error", n.Message = "message", n.Close = "close";
|
|
86
|
+
})(_ || (_ = {}));
|
|
87
|
+
export {
|
|
88
|
+
I as createClientTokenAuthentication
|
|
89
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
function f(r, o, l) {
|
|
2
|
+
let u, n, e;
|
|
3
|
+
r instanceof Function ? (u = r, n = o, e = l) : (n = r, e = o);
|
|
4
|
+
const t = n ? Object.assign({}, n) : {}, c = new Proxy(
|
|
5
|
+
{},
|
|
6
|
+
{
|
|
7
|
+
get(b, s) {
|
|
8
|
+
if (s === "build")
|
|
9
|
+
if (e && Object.assign(t, e), u) {
|
|
10
|
+
const i = new u();
|
|
11
|
+
return () => Object.assign(i, { ...t });
|
|
12
|
+
} else
|
|
13
|
+
return () => t;
|
|
14
|
+
return (...i) => i.length === 0 ? t[s.toString()] : (t[s.toString()] = i[0], c);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
);
|
|
18
|
+
return c;
|
|
19
|
+
}
|
|
20
|
+
export {
|
|
21
|
+
f as Builder
|
|
22
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
class o extends Error {
|
|
2
|
+
}
|
|
3
|
+
o.prototype.name = "InvalidTokenError";
|
|
4
|
+
function i(t) {
|
|
5
|
+
return decodeURIComponent(atob(t).replace(/(.)/g, (e, r) => {
|
|
6
|
+
let n = r.charCodeAt(0).toString(16).toUpperCase();
|
|
7
|
+
return n.length < 2 && (n = "0" + n), "%" + n;
|
|
8
|
+
}));
|
|
9
|
+
}
|
|
10
|
+
function s(t) {
|
|
11
|
+
let e = t.replace(/-/g, "+").replace(/_/g, "/");
|
|
12
|
+
switch (e.length % 4) {
|
|
13
|
+
case 0:
|
|
14
|
+
break;
|
|
15
|
+
case 2:
|
|
16
|
+
e += "==";
|
|
17
|
+
break;
|
|
18
|
+
case 3:
|
|
19
|
+
e += "=";
|
|
20
|
+
break;
|
|
21
|
+
default:
|
|
22
|
+
throw new Error("base64 string is not of the correct length");
|
|
23
|
+
}
|
|
24
|
+
try {
|
|
25
|
+
return i(e);
|
|
26
|
+
} catch {
|
|
27
|
+
return atob(e);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
function d(t, e) {
|
|
31
|
+
if (typeof t != "string")
|
|
32
|
+
throw new o("Invalid token specified: must be a string");
|
|
33
|
+
e || (e = {});
|
|
34
|
+
const r = e.header === !0 ? 0 : 1, n = t.split(".")[r];
|
|
35
|
+
if (typeof n != "string")
|
|
36
|
+
throw new o(`Invalid token specified: missing part #${r + 1}`);
|
|
37
|
+
let c;
|
|
38
|
+
try {
|
|
39
|
+
c = s(n);
|
|
40
|
+
} catch (a) {
|
|
41
|
+
throw new o(`Invalid token specified: invalid base64 for part #${r + 1} (${a.message})`);
|
|
42
|
+
}
|
|
43
|
+
try {
|
|
44
|
+
return JSON.parse(c);
|
|
45
|
+
} catch (a) {
|
|
46
|
+
throw new o(`Invalid token specified: invalid json for part #${r + 1} (${a.message})`);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
export {
|
|
50
|
+
o as InvalidTokenError,
|
|
51
|
+
d as jwtDecode
|
|
52
|
+
};
|