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,42 @@
|
|
|
1
|
+
function o(e) {
|
|
2
|
+
let s = !1;
|
|
3
|
+
const c = [];
|
|
4
|
+
for (let a = 0; a < e.length; a++) {
|
|
5
|
+
let t = e.charAt(a);
|
|
6
|
+
switch (t) {
|
|
7
|
+
case "_":
|
|
8
|
+
s = !0;
|
|
9
|
+
break;
|
|
10
|
+
case "0":
|
|
11
|
+
case "1":
|
|
12
|
+
case "2":
|
|
13
|
+
case "3":
|
|
14
|
+
case "4":
|
|
15
|
+
case "5":
|
|
16
|
+
case "6":
|
|
17
|
+
case "7":
|
|
18
|
+
case "8":
|
|
19
|
+
case "9":
|
|
20
|
+
c.push(t), s = !1;
|
|
21
|
+
break;
|
|
22
|
+
default:
|
|
23
|
+
s && (s = !1, t = t.toUpperCase()), c.push(t);
|
|
24
|
+
break;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
return c.join("");
|
|
28
|
+
}
|
|
29
|
+
const r = /* @__PURE__ */ new Set([
|
|
30
|
+
// names reserved by JavaScript
|
|
31
|
+
"constructor",
|
|
32
|
+
"toString",
|
|
33
|
+
"toJSON",
|
|
34
|
+
"valueOf"
|
|
35
|
+
]);
|
|
36
|
+
function f(e) {
|
|
37
|
+
return r.has(e) ? e + "$" : e;
|
|
38
|
+
}
|
|
39
|
+
export {
|
|
40
|
+
o as protoCamelCase,
|
|
41
|
+
f as safeObjectProperty
|
|
42
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
function* i(e) {
|
|
2
|
+
switch (e.kind) {
|
|
3
|
+
case "file":
|
|
4
|
+
for (const s of e.messages)
|
|
5
|
+
yield s, yield* i(s);
|
|
6
|
+
yield* e.enums, yield* e.services, yield* e.extensions;
|
|
7
|
+
break;
|
|
8
|
+
case "message":
|
|
9
|
+
for (const s of e.nestedMessages)
|
|
10
|
+
yield s, yield* i(s);
|
|
11
|
+
yield* e.nestedEnums, yield* e.nestedExtensions;
|
|
12
|
+
break;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
export {
|
|
16
|
+
i as nestedTypes
|
|
17
|
+
};
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import { ScalarType as r } from "../descriptors.js";
|
|
2
|
+
import { isMessage as N } from "../is-message.js";
|
|
3
|
+
import { FieldError as s } from "./error.js";
|
|
4
|
+
import { isReflectList as m, isReflectMap as p, isReflectMessage as g } from "./guard.js";
|
|
5
|
+
import { UINT32_MAX as T, INT32_MAX as S, INT32_MIN as h, FLOAT32_MAX as F, FLOAT32_MIN as E } from "../wire/binary-encoding.js";
|
|
6
|
+
import { getTextEncoding as M } from "../wire/text-encoding.js";
|
|
7
|
+
import { protoInt64 as f } from "../proto-int64.js";
|
|
8
|
+
function w(e, t) {
|
|
9
|
+
const n = e.fieldKind == "list" ? m(t, e) : e.fieldKind == "map" ? p(t, e) : u(e, t);
|
|
10
|
+
if (n === !0)
|
|
11
|
+
return;
|
|
12
|
+
let c;
|
|
13
|
+
switch (e.fieldKind) {
|
|
14
|
+
case "list":
|
|
15
|
+
c = `expected ${I(e)}, got ${o(t)}`;
|
|
16
|
+
break;
|
|
17
|
+
case "map":
|
|
18
|
+
c = `expected ${b(e)}, got ${o(t)}`;
|
|
19
|
+
break;
|
|
20
|
+
default:
|
|
21
|
+
c = i(e, t, n);
|
|
22
|
+
}
|
|
23
|
+
return new s(e, c);
|
|
24
|
+
}
|
|
25
|
+
function x(e, t, n) {
|
|
26
|
+
const c = u(e, n);
|
|
27
|
+
if (c !== !0)
|
|
28
|
+
return new s(e, `list item #${t + 1}: ${i(e, n, c)}`);
|
|
29
|
+
}
|
|
30
|
+
function O(e, t, n) {
|
|
31
|
+
const c = y(t, e.mapKey);
|
|
32
|
+
if (c !== !0)
|
|
33
|
+
return new s(e, `invalid map key: ${i({ scalar: e.mapKey }, t, c)}`);
|
|
34
|
+
const a = u(e, n);
|
|
35
|
+
if (a !== !0)
|
|
36
|
+
return new s(e, `map entry ${o(t)}: ${i(e, n, a)}`);
|
|
37
|
+
}
|
|
38
|
+
function u(e, t) {
|
|
39
|
+
return e.scalar !== void 0 ? y(t, e.scalar) : e.enum !== void 0 ? e.enum.open ? Number.isInteger(t) : e.enum.values.some((n) => n.number === t) : g(t, e.message);
|
|
40
|
+
}
|
|
41
|
+
function y(e, t) {
|
|
42
|
+
switch (t) {
|
|
43
|
+
case r.DOUBLE:
|
|
44
|
+
return typeof e == "number";
|
|
45
|
+
case r.FLOAT:
|
|
46
|
+
return typeof e != "number" ? !1 : Number.isNaN(e) || !Number.isFinite(e) ? !0 : e > F || e < E ? `${e.toFixed()} out of range` : !0;
|
|
47
|
+
case r.INT32:
|
|
48
|
+
case r.SFIXED32:
|
|
49
|
+
case r.SINT32:
|
|
50
|
+
return typeof e != "number" || !Number.isInteger(e) ? !1 : e > S || e < h ? `${e.toFixed()} out of range` : !0;
|
|
51
|
+
case r.FIXED32:
|
|
52
|
+
case r.UINT32:
|
|
53
|
+
return typeof e != "number" || !Number.isInteger(e) ? !1 : e > T || e < 0 ? `${e.toFixed()} out of range` : !0;
|
|
54
|
+
case r.BOOL:
|
|
55
|
+
return typeof e == "boolean";
|
|
56
|
+
case r.STRING:
|
|
57
|
+
return typeof e != "string" ? !1 : M().checkUtf8(e) || "invalid UTF8";
|
|
58
|
+
case r.BYTES:
|
|
59
|
+
return e instanceof Uint8Array;
|
|
60
|
+
case r.INT64:
|
|
61
|
+
case r.SFIXED64:
|
|
62
|
+
case r.SINT64:
|
|
63
|
+
if (typeof e == "bigint" || typeof e == "number" || typeof e == "string" && e.length > 0)
|
|
64
|
+
try {
|
|
65
|
+
return f.parse(e), !0;
|
|
66
|
+
} catch {
|
|
67
|
+
return `${e} out of range`;
|
|
68
|
+
}
|
|
69
|
+
return !1;
|
|
70
|
+
case r.FIXED64:
|
|
71
|
+
case r.UINT64:
|
|
72
|
+
if (typeof e == "bigint" || typeof e == "number" || typeof e == "string" && e.length > 0)
|
|
73
|
+
try {
|
|
74
|
+
return f.uParse(e), !0;
|
|
75
|
+
} catch {
|
|
76
|
+
return `${e} out of range`;
|
|
77
|
+
}
|
|
78
|
+
return !1;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
function i(e, t, n) {
|
|
82
|
+
return n = typeof n == "string" ? `: ${n}` : `, got ${o(t)}`, e.scalar !== void 0 ? `expected ${R(e.scalar)}` + n : e.enum !== void 0 ? `expected ${e.enum.toString()}` + n : `expected ${$(e.message)}` + n;
|
|
83
|
+
}
|
|
84
|
+
function o(e) {
|
|
85
|
+
switch (typeof e) {
|
|
86
|
+
case "object":
|
|
87
|
+
return e === null ? "null" : e instanceof Uint8Array ? `Uint8Array(${e.length})` : Array.isArray(e) ? `Array(${e.length})` : m(e) ? I(e.field()) : p(e) ? b(e.field()) : g(e) ? $(e.desc) : N(e) ? `message ${e.$typeName}` : "object";
|
|
88
|
+
case "string":
|
|
89
|
+
return e.length > 30 ? "string" : `"${e.split('"').join('\\"')}"`;
|
|
90
|
+
case "boolean":
|
|
91
|
+
return String(e);
|
|
92
|
+
case "number":
|
|
93
|
+
return String(e);
|
|
94
|
+
case "bigint":
|
|
95
|
+
return String(e) + "n";
|
|
96
|
+
default:
|
|
97
|
+
return typeof e;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
function $(e) {
|
|
101
|
+
return `ReflectMessage (${e.typeName})`;
|
|
102
|
+
}
|
|
103
|
+
function I(e) {
|
|
104
|
+
switch (e.listKind) {
|
|
105
|
+
case "message":
|
|
106
|
+
return `ReflectList (${e.message.toString()})`;
|
|
107
|
+
case "enum":
|
|
108
|
+
return `ReflectList (${e.enum.toString()})`;
|
|
109
|
+
case "scalar":
|
|
110
|
+
return `ReflectList (${r[e.scalar]})`;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
function b(e) {
|
|
114
|
+
switch (e.mapKind) {
|
|
115
|
+
case "message":
|
|
116
|
+
return `ReflectMap (${r[e.mapKey]}, ${e.message.toString()})`;
|
|
117
|
+
case "enum":
|
|
118
|
+
return `ReflectMap (${r[e.mapKey]}, ${e.enum.toString()})`;
|
|
119
|
+
case "scalar":
|
|
120
|
+
return `ReflectMap (${r[e.mapKey]}, ${r[e.scalar]})`;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
function R(e) {
|
|
124
|
+
switch (e) {
|
|
125
|
+
case r.STRING:
|
|
126
|
+
return "string";
|
|
127
|
+
case r.BOOL:
|
|
128
|
+
return "boolean";
|
|
129
|
+
case r.INT64:
|
|
130
|
+
case r.SINT64:
|
|
131
|
+
case r.SFIXED64:
|
|
132
|
+
return "bigint (int64)";
|
|
133
|
+
case r.UINT64:
|
|
134
|
+
case r.FIXED64:
|
|
135
|
+
return "bigint (uint64)";
|
|
136
|
+
case r.BYTES:
|
|
137
|
+
return "Uint8Array";
|
|
138
|
+
case r.DOUBLE:
|
|
139
|
+
return "number (float64)";
|
|
140
|
+
case r.FLOAT:
|
|
141
|
+
return "number (float32)";
|
|
142
|
+
case r.FIXED32:
|
|
143
|
+
case r.UINT32:
|
|
144
|
+
return "number (uint32)";
|
|
145
|
+
case r.INT32:
|
|
146
|
+
case r.SFIXED32:
|
|
147
|
+
case r.SINT32:
|
|
148
|
+
return "number (int32)";
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
export {
|
|
152
|
+
w as checkField,
|
|
153
|
+
x as checkListItem,
|
|
154
|
+
O as checkMapEntry,
|
|
155
|
+
o as formatVal
|
|
156
|
+
};
|
|
@@ -0,0 +1,349 @@
|
|
|
1
|
+
import { ScalarType as i } from "../descriptors.js";
|
|
2
|
+
import { checkField as j, checkMapEntry as O, checkListItem as b } from "./reflect-check.js";
|
|
3
|
+
import { FieldError as _ } from "./error.js";
|
|
4
|
+
import { unsafeLocal as o, unsafeOneofCase as F, unsafeIsSet as R, unsafeClear as E, unsafeGet as K, unsafeSet as L } from "./unsafe.js";
|
|
5
|
+
import { create as A } from "../create.js";
|
|
6
|
+
import { isWrapperDesc as $, isWrapper as M } from "../wkt/wrappers.js";
|
|
7
|
+
import { scalarZeroValue as X } from "./scalar.js";
|
|
8
|
+
import { protoInt64 as a } from "../proto-int64.js";
|
|
9
|
+
import { isReflectMap as U, isReflectList as P, isObject as w, isReflectMessage as B } from "./guard.js";
|
|
10
|
+
function v(t, e, s = !0) {
|
|
11
|
+
return new S(t, e, s);
|
|
12
|
+
}
|
|
13
|
+
const d = /* @__PURE__ */ new WeakMap();
|
|
14
|
+
class S {
|
|
15
|
+
get sortedFields() {
|
|
16
|
+
const e = d.get(this.desc);
|
|
17
|
+
if (e)
|
|
18
|
+
return e;
|
|
19
|
+
const s = this.desc.fields.concat().sort((r, n) => r.number - n.number);
|
|
20
|
+
return d.set(this.desc, s), s;
|
|
21
|
+
}
|
|
22
|
+
constructor(e, s, r = !0) {
|
|
23
|
+
this.lists = /* @__PURE__ */ new Map(), this.maps = /* @__PURE__ */ new Map(), this.check = r, this.desc = e, this.message = this[o] = s ?? A(e), this.fields = e.fields, this.oneofs = e.oneofs, this.members = e.members;
|
|
24
|
+
}
|
|
25
|
+
findNumber(e) {
|
|
26
|
+
return this._fieldsByNumber || (this._fieldsByNumber = new Map(this.desc.fields.map((s) => [s.number, s]))), this._fieldsByNumber.get(e);
|
|
27
|
+
}
|
|
28
|
+
oneofCase(e) {
|
|
29
|
+
return c(this.message, e), F(this.message, e);
|
|
30
|
+
}
|
|
31
|
+
isSet(e) {
|
|
32
|
+
return c(this.message, e), R(this.message, e);
|
|
33
|
+
}
|
|
34
|
+
clear(e) {
|
|
35
|
+
c(this.message, e), E(this.message, e);
|
|
36
|
+
}
|
|
37
|
+
get(e) {
|
|
38
|
+
c(this.message, e);
|
|
39
|
+
const s = K(this.message, e);
|
|
40
|
+
switch (e.fieldKind) {
|
|
41
|
+
case "list":
|
|
42
|
+
let r = this.lists.get(e);
|
|
43
|
+
return (!r || r[o] !== s) && this.lists.set(
|
|
44
|
+
e,
|
|
45
|
+
// biome-ignore lint/suspicious/noAssignInExpressions: no
|
|
46
|
+
r = new D(e, s, this.check)
|
|
47
|
+
), r;
|
|
48
|
+
case "map":
|
|
49
|
+
let n = this.maps.get(e);
|
|
50
|
+
return (!n || n[o] !== s) && this.maps.set(
|
|
51
|
+
e,
|
|
52
|
+
// biome-ignore lint/suspicious/noAssignInExpressions: no
|
|
53
|
+
n = new C(e, s, this.check)
|
|
54
|
+
), n;
|
|
55
|
+
case "message":
|
|
56
|
+
return m(e, s, this.check);
|
|
57
|
+
case "scalar":
|
|
58
|
+
return s === void 0 ? X(e.scalar, !1) : g(e, s);
|
|
59
|
+
case "enum":
|
|
60
|
+
return s ?? e.enum.values[0].number;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
set(e, s) {
|
|
64
|
+
if (c(this.message, e), this.check) {
|
|
65
|
+
const n = j(e, s);
|
|
66
|
+
if (n)
|
|
67
|
+
throw n;
|
|
68
|
+
}
|
|
69
|
+
let r;
|
|
70
|
+
e.fieldKind == "message" ? r = l(e, s) : U(s) || P(s) ? r = s[o] : r = p(e, s), L(this.message, e, r);
|
|
71
|
+
}
|
|
72
|
+
getUnknown() {
|
|
73
|
+
return this.message.$unknown;
|
|
74
|
+
}
|
|
75
|
+
setUnknown(e) {
|
|
76
|
+
this.message.$unknown = e;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
function c(t, e) {
|
|
80
|
+
if (e.parent.typeName !== t.$typeName)
|
|
81
|
+
throw new _(e, `cannot use ${e.toString()} with message ${t.$typeName}`, "ForeignFieldError");
|
|
82
|
+
}
|
|
83
|
+
class D {
|
|
84
|
+
field() {
|
|
85
|
+
return this._field;
|
|
86
|
+
}
|
|
87
|
+
get size() {
|
|
88
|
+
return this._arr.length;
|
|
89
|
+
}
|
|
90
|
+
constructor(e, s, r) {
|
|
91
|
+
this._field = e, this._arr = this[o] = s, this.check = r;
|
|
92
|
+
}
|
|
93
|
+
get(e) {
|
|
94
|
+
const s = this._arr[e];
|
|
95
|
+
return s === void 0 ? void 0 : u(this._field, s, this.check);
|
|
96
|
+
}
|
|
97
|
+
set(e, s) {
|
|
98
|
+
if (e < 0 || e >= this._arr.length)
|
|
99
|
+
throw new _(this._field, `list item #${e + 1}: out of range`);
|
|
100
|
+
if (this.check) {
|
|
101
|
+
const r = b(this._field, e, s);
|
|
102
|
+
if (r)
|
|
103
|
+
throw r;
|
|
104
|
+
}
|
|
105
|
+
this._arr[e] = k(this._field, s);
|
|
106
|
+
}
|
|
107
|
+
add(e) {
|
|
108
|
+
if (this.check) {
|
|
109
|
+
const s = b(this._field, this._arr.length, e);
|
|
110
|
+
if (s)
|
|
111
|
+
throw s;
|
|
112
|
+
}
|
|
113
|
+
this._arr.push(k(this._field, e));
|
|
114
|
+
}
|
|
115
|
+
clear() {
|
|
116
|
+
this._arr.splice(0, this._arr.length);
|
|
117
|
+
}
|
|
118
|
+
[Symbol.iterator]() {
|
|
119
|
+
return this.values();
|
|
120
|
+
}
|
|
121
|
+
keys() {
|
|
122
|
+
return this._arr.keys();
|
|
123
|
+
}
|
|
124
|
+
*values() {
|
|
125
|
+
for (const e of this._arr)
|
|
126
|
+
yield u(this._field, e, this.check);
|
|
127
|
+
}
|
|
128
|
+
*entries() {
|
|
129
|
+
for (let e = 0; e < this._arr.length; e++)
|
|
130
|
+
yield [e, u(this._field, this._arr[e], this.check)];
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
class C {
|
|
134
|
+
constructor(e, s, r = !0) {
|
|
135
|
+
this.obj = this[o] = s ?? {}, this.check = r, this._field = e;
|
|
136
|
+
}
|
|
137
|
+
field() {
|
|
138
|
+
return this._field;
|
|
139
|
+
}
|
|
140
|
+
set(e, s) {
|
|
141
|
+
if (this.check) {
|
|
142
|
+
const r = O(this._field, e, s);
|
|
143
|
+
if (r)
|
|
144
|
+
throw r;
|
|
145
|
+
}
|
|
146
|
+
return this.obj[h(e)] = W(this._field, s), this;
|
|
147
|
+
}
|
|
148
|
+
delete(e) {
|
|
149
|
+
const s = h(e), r = Object.prototype.hasOwnProperty.call(this.obj, s);
|
|
150
|
+
return r && delete this.obj[s], r;
|
|
151
|
+
}
|
|
152
|
+
clear() {
|
|
153
|
+
for (const e of Object.keys(this.obj))
|
|
154
|
+
delete this.obj[e];
|
|
155
|
+
}
|
|
156
|
+
get(e) {
|
|
157
|
+
let s = this.obj[h(e)];
|
|
158
|
+
return s !== void 0 && (s = f(this._field, s, this.check)), s;
|
|
159
|
+
}
|
|
160
|
+
has(e) {
|
|
161
|
+
return Object.prototype.hasOwnProperty.call(this.obj, h(e));
|
|
162
|
+
}
|
|
163
|
+
*keys() {
|
|
164
|
+
for (const e of Object.keys(this.obj))
|
|
165
|
+
yield y(e, this._field.mapKey);
|
|
166
|
+
}
|
|
167
|
+
*entries() {
|
|
168
|
+
for (const e of Object.entries(this.obj))
|
|
169
|
+
yield [
|
|
170
|
+
y(e[0], this._field.mapKey),
|
|
171
|
+
f(this._field, e[1], this.check)
|
|
172
|
+
];
|
|
173
|
+
}
|
|
174
|
+
[Symbol.iterator]() {
|
|
175
|
+
return this.entries();
|
|
176
|
+
}
|
|
177
|
+
get size() {
|
|
178
|
+
return Object.keys(this.obj).length;
|
|
179
|
+
}
|
|
180
|
+
*values() {
|
|
181
|
+
for (const e of Object.values(this.obj))
|
|
182
|
+
yield f(this._field, e, this.check);
|
|
183
|
+
}
|
|
184
|
+
forEach(e, s) {
|
|
185
|
+
for (const r of this.entries())
|
|
186
|
+
e.call(s, r[1], r[0], this);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
function l(t, e) {
|
|
190
|
+
return B(e) ? M(e.message) && !t.oneof && t.fieldKind == "message" ? e.message.value : e.desc.typeName == "google.protobuf.Struct" && t.parent.typeName != "google.protobuf.Value" ? T(e.message) : e.message : e;
|
|
191
|
+
}
|
|
192
|
+
function m(t, e, s) {
|
|
193
|
+
return e !== void 0 && ($(t.message) && !t.oneof && t.fieldKind == "message" ? e = {
|
|
194
|
+
$typeName: t.message.typeName,
|
|
195
|
+
value: g(t.message.fields[0], e)
|
|
196
|
+
} : t.message.typeName == "google.protobuf.Struct" && t.parent.typeName != "google.protobuf.Value" && w(e) && (e = N(e))), new S(t.message, e, s);
|
|
197
|
+
}
|
|
198
|
+
function k(t, e) {
|
|
199
|
+
return t.listKind == "message" ? l(t, e) : p(t, e);
|
|
200
|
+
}
|
|
201
|
+
function u(t, e, s) {
|
|
202
|
+
return t.listKind == "message" ? m(t, e, s) : g(t, e);
|
|
203
|
+
}
|
|
204
|
+
function W(t, e) {
|
|
205
|
+
return t.mapKind == "message" ? l(t, e) : p(t, e);
|
|
206
|
+
}
|
|
207
|
+
function f(t, e, s) {
|
|
208
|
+
return t.mapKind == "message" ? m(t, e, s) : e;
|
|
209
|
+
}
|
|
210
|
+
function h(t) {
|
|
211
|
+
return typeof t == "string" || typeof t == "number" ? t : String(t);
|
|
212
|
+
}
|
|
213
|
+
function y(t, e) {
|
|
214
|
+
switch (e) {
|
|
215
|
+
case i.STRING:
|
|
216
|
+
return t;
|
|
217
|
+
case i.INT32:
|
|
218
|
+
case i.FIXED32:
|
|
219
|
+
case i.UINT32:
|
|
220
|
+
case i.SFIXED32:
|
|
221
|
+
case i.SINT32: {
|
|
222
|
+
const s = Number.parseInt(t);
|
|
223
|
+
if (Number.isFinite(s))
|
|
224
|
+
return s;
|
|
225
|
+
break;
|
|
226
|
+
}
|
|
227
|
+
case i.BOOL:
|
|
228
|
+
switch (t) {
|
|
229
|
+
case "true":
|
|
230
|
+
return !0;
|
|
231
|
+
case "false":
|
|
232
|
+
return !1;
|
|
233
|
+
}
|
|
234
|
+
break;
|
|
235
|
+
case i.UINT64:
|
|
236
|
+
case i.FIXED64:
|
|
237
|
+
try {
|
|
238
|
+
return a.uParse(t);
|
|
239
|
+
} catch {
|
|
240
|
+
}
|
|
241
|
+
break;
|
|
242
|
+
default:
|
|
243
|
+
try {
|
|
244
|
+
return a.parse(t);
|
|
245
|
+
} catch {
|
|
246
|
+
}
|
|
247
|
+
break;
|
|
248
|
+
}
|
|
249
|
+
return t;
|
|
250
|
+
}
|
|
251
|
+
function g(t, e) {
|
|
252
|
+
switch (t.scalar) {
|
|
253
|
+
case i.INT64:
|
|
254
|
+
case i.SFIXED64:
|
|
255
|
+
case i.SINT64:
|
|
256
|
+
"longAsString" in t && t.longAsString && typeof e == "string" && (e = a.parse(e));
|
|
257
|
+
break;
|
|
258
|
+
case i.FIXED64:
|
|
259
|
+
case i.UINT64:
|
|
260
|
+
"longAsString" in t && t.longAsString && typeof e == "string" && (e = a.uParse(e));
|
|
261
|
+
break;
|
|
262
|
+
}
|
|
263
|
+
return e;
|
|
264
|
+
}
|
|
265
|
+
function p(t, e) {
|
|
266
|
+
switch (t.scalar) {
|
|
267
|
+
case i.INT64:
|
|
268
|
+
case i.SFIXED64:
|
|
269
|
+
case i.SINT64:
|
|
270
|
+
"longAsString" in t && t.longAsString ? e = String(e) : (typeof e == "string" || typeof e == "number") && (e = a.parse(e));
|
|
271
|
+
break;
|
|
272
|
+
case i.FIXED64:
|
|
273
|
+
case i.UINT64:
|
|
274
|
+
"longAsString" in t && t.longAsString ? e = String(e) : (typeof e == "string" || typeof e == "number") && (e = a.uParse(e));
|
|
275
|
+
break;
|
|
276
|
+
}
|
|
277
|
+
return e;
|
|
278
|
+
}
|
|
279
|
+
function N(t) {
|
|
280
|
+
const e = {
|
|
281
|
+
$typeName: "google.protobuf.Struct",
|
|
282
|
+
fields: {}
|
|
283
|
+
};
|
|
284
|
+
if (w(t))
|
|
285
|
+
for (const [s, r] of Object.entries(t))
|
|
286
|
+
e.fields[s] = V(r);
|
|
287
|
+
return e;
|
|
288
|
+
}
|
|
289
|
+
function T(t) {
|
|
290
|
+
const e = {};
|
|
291
|
+
for (const [s, r] of Object.entries(t.fields))
|
|
292
|
+
e[s] = I(r);
|
|
293
|
+
return e;
|
|
294
|
+
}
|
|
295
|
+
function I(t) {
|
|
296
|
+
switch (t.kind.case) {
|
|
297
|
+
case "structValue":
|
|
298
|
+
return T(t.kind.value);
|
|
299
|
+
case "listValue":
|
|
300
|
+
return t.kind.value.values.map(I);
|
|
301
|
+
case "nullValue":
|
|
302
|
+
case void 0:
|
|
303
|
+
return null;
|
|
304
|
+
default:
|
|
305
|
+
return t.kind.value;
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
function V(t) {
|
|
309
|
+
const e = {
|
|
310
|
+
$typeName: "google.protobuf.Value",
|
|
311
|
+
kind: { case: void 0 }
|
|
312
|
+
};
|
|
313
|
+
switch (typeof t) {
|
|
314
|
+
case "number":
|
|
315
|
+
e.kind = { case: "numberValue", value: t };
|
|
316
|
+
break;
|
|
317
|
+
case "string":
|
|
318
|
+
e.kind = { case: "stringValue", value: t };
|
|
319
|
+
break;
|
|
320
|
+
case "boolean":
|
|
321
|
+
e.kind = { case: "boolValue", value: t };
|
|
322
|
+
break;
|
|
323
|
+
case "object":
|
|
324
|
+
if (t === null)
|
|
325
|
+
e.kind = { case: "nullValue", value: 0 };
|
|
326
|
+
else if (Array.isArray(t)) {
|
|
327
|
+
const s = {
|
|
328
|
+
$typeName: "google.protobuf.ListValue",
|
|
329
|
+
values: []
|
|
330
|
+
};
|
|
331
|
+
if (Array.isArray(t))
|
|
332
|
+
for (const r of t)
|
|
333
|
+
s.values.push(V(r));
|
|
334
|
+
e.kind = {
|
|
335
|
+
case: "listValue",
|
|
336
|
+
value: s
|
|
337
|
+
};
|
|
338
|
+
} else
|
|
339
|
+
e.kind = {
|
|
340
|
+
case: "structValue",
|
|
341
|
+
value: N(t)
|
|
342
|
+
};
|
|
343
|
+
break;
|
|
344
|
+
}
|
|
345
|
+
return e;
|
|
346
|
+
}
|
|
347
|
+
export {
|
|
348
|
+
v as reflect
|
|
349
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { protoInt64 as a } from "../proto-int64.js";
|
|
2
|
+
import { ScalarType as r } from "../descriptors.js";
|
|
3
|
+
function s(t, e) {
|
|
4
|
+
switch (t) {
|
|
5
|
+
case r.STRING:
|
|
6
|
+
return "";
|
|
7
|
+
case r.BOOL:
|
|
8
|
+
return !1;
|
|
9
|
+
case r.DOUBLE:
|
|
10
|
+
case r.FLOAT:
|
|
11
|
+
return 0;
|
|
12
|
+
case r.INT64:
|
|
13
|
+
case r.UINT64:
|
|
14
|
+
case r.SFIXED64:
|
|
15
|
+
case r.FIXED64:
|
|
16
|
+
case r.SINT64:
|
|
17
|
+
return e ? "0" : a.zero;
|
|
18
|
+
case r.BYTES:
|
|
19
|
+
return new Uint8Array(0);
|
|
20
|
+
default:
|
|
21
|
+
return 0;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
function o(t, e) {
|
|
25
|
+
switch (t) {
|
|
26
|
+
case r.BOOL:
|
|
27
|
+
return e === !1;
|
|
28
|
+
case r.STRING:
|
|
29
|
+
return e === "";
|
|
30
|
+
case r.BYTES:
|
|
31
|
+
return e instanceof Uint8Array && !e.byteLength;
|
|
32
|
+
default:
|
|
33
|
+
return e == 0;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
export {
|
|
37
|
+
o as isScalarZeroValue,
|
|
38
|
+
s as scalarZeroValue
|
|
39
|
+
};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { isScalarZeroValue as s, scalarZeroValue as r } from "./scalar.js";
|
|
2
|
+
const c = 2, l = Symbol.for("reflect unsafe local");
|
|
3
|
+
function f(n, e) {
|
|
4
|
+
const a = n[e.localName].case;
|
|
5
|
+
return a === void 0 ? a : e.fields.find((o) => o.localName === a);
|
|
6
|
+
}
|
|
7
|
+
function m(n, e) {
|
|
8
|
+
const a = e.localName;
|
|
9
|
+
if (e.oneof)
|
|
10
|
+
return n[e.oneof.localName].case === a;
|
|
11
|
+
if (e.presence != c)
|
|
12
|
+
return n[a] !== void 0 && Object.prototype.hasOwnProperty.call(n, a);
|
|
13
|
+
switch (e.fieldKind) {
|
|
14
|
+
case "list":
|
|
15
|
+
return n[a].length > 0;
|
|
16
|
+
case "map":
|
|
17
|
+
return Object.keys(n[a]).length > 0;
|
|
18
|
+
case "scalar":
|
|
19
|
+
return !s(e.scalar, n[a]);
|
|
20
|
+
case "enum":
|
|
21
|
+
return n[a] !== e.enum.values[0].number;
|
|
22
|
+
}
|
|
23
|
+
throw new Error("message field with implicit presence");
|
|
24
|
+
}
|
|
25
|
+
function t(n, e) {
|
|
26
|
+
return Object.prototype.hasOwnProperty.call(n, e) && n[e] !== void 0;
|
|
27
|
+
}
|
|
28
|
+
function i(n, e) {
|
|
29
|
+
if (e.oneof) {
|
|
30
|
+
const a = n[e.oneof.localName];
|
|
31
|
+
return a.case === e.localName ? a.value : void 0;
|
|
32
|
+
}
|
|
33
|
+
return n[e.localName];
|
|
34
|
+
}
|
|
35
|
+
function p(n, e, a) {
|
|
36
|
+
e.oneof ? n[e.oneof.localName] = {
|
|
37
|
+
case: e.localName,
|
|
38
|
+
value: a
|
|
39
|
+
} : n[e.localName] = a;
|
|
40
|
+
}
|
|
41
|
+
function N(n, e) {
|
|
42
|
+
const a = e.localName;
|
|
43
|
+
if (e.oneof) {
|
|
44
|
+
const o = e.oneof.localName;
|
|
45
|
+
n[o].case === a && (n[o] = { case: void 0 });
|
|
46
|
+
} else if (e.presence != c)
|
|
47
|
+
delete n[a];
|
|
48
|
+
else
|
|
49
|
+
switch (e.fieldKind) {
|
|
50
|
+
case "map":
|
|
51
|
+
n[a] = {};
|
|
52
|
+
break;
|
|
53
|
+
case "list":
|
|
54
|
+
n[a] = [];
|
|
55
|
+
break;
|
|
56
|
+
case "enum":
|
|
57
|
+
n[a] = e.enum.values[0].number;
|
|
58
|
+
break;
|
|
59
|
+
case "scalar":
|
|
60
|
+
n[a] = r(e.scalar, e.longAsString);
|
|
61
|
+
break;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
export {
|
|
65
|
+
N as unsafeClear,
|
|
66
|
+
i as unsafeGet,
|
|
67
|
+
m as unsafeIsSet,
|
|
68
|
+
t as unsafeIsSetExplicit,
|
|
69
|
+
l as unsafeLocal,
|
|
70
|
+
f as unsafeOneofCase,
|
|
71
|
+
p as unsafeSet
|
|
72
|
+
};
|