@btc-embedded/cdk-extensions 0.6.0 → 0.7.0
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/.jsii +5 -3
- package/CHANGELOG.md +19 -0
- package/lib/constructs/SecureRestApi.js +1 -1
- package/lib/extensions/ApiGatewayExtension.js +1 -1
- package/lib/extensions/ApplicationLoadBalancerExtension.js +1 -1
- package/lib/extensions/CloudMapExtension.js +1 -1
- package/lib/extensions/DocumentDbAccessExtension.js +1 -1
- package/lib/extensions/DomainEventMessagingExtension.js +1 -1
- package/lib/extensions/ExtraContainerExtension.js +1 -1
- package/lib/extensions/LogExtension.js +1 -1
- package/lib/extensions/ModifyContainerDefinitionExtension.js +1 -1
- package/lib/extensions/ModifyTaskDefinitionExtension.js +1 -1
- package/lib/extensions/OpenTelemetryExtension.js +1 -1
- package/lib/extensions/PostgresDbAccessExtension.js +1 -1
- package/lib/extensions/SharedVolumeExtension.js +1 -1
- package/lib/extensions/TcpKeepAliveExtension.js +1 -1
- package/lib/platform/ApiGateway.js +1 -1
- package/lib/platform/ApplicationLoadBalancer.js +1 -1
- package/lib/platform/DefaultUserPoolClients.js +1 -1
- package/lib/platform/DocumentDB.js +1 -1
- package/lib/platform/PrivateDnsNamespace.js +1 -1
- package/lib/platform/Vpc.js +1 -1
- package/lib/utils/configFileParsing.d.ts +25 -0
- package/lib/utils/configFileParsing.js +51 -0
- package/lib/utils/index.d.ts +1 -0
- package/lib/utils/index.js +2 -1
- package/node_modules/yaml/LICENSE +13 -0
- package/node_modules/yaml/README.md +188 -0
- package/node_modules/yaml/bin.mjs +11 -0
- package/node_modules/yaml/browser/dist/compose/compose-collection.js +88 -0
- package/node_modules/yaml/browser/dist/compose/compose-doc.js +43 -0
- package/node_modules/yaml/browser/dist/compose/compose-node.js +102 -0
- package/node_modules/yaml/browser/dist/compose/compose-scalar.js +86 -0
- package/node_modules/yaml/browser/dist/compose/composer.js +217 -0
- package/node_modules/yaml/browser/dist/compose/resolve-block-map.js +115 -0
- package/node_modules/yaml/browser/dist/compose/resolve-block-scalar.js +198 -0
- package/node_modules/yaml/browser/dist/compose/resolve-block-seq.js +49 -0
- package/node_modules/yaml/browser/dist/compose/resolve-end.js +37 -0
- package/node_modules/yaml/browser/dist/compose/resolve-flow-collection.js +207 -0
- package/node_modules/yaml/browser/dist/compose/resolve-flow-scalar.js +223 -0
- package/node_modules/yaml/browser/dist/compose/resolve-props.js +148 -0
- package/node_modules/yaml/browser/dist/compose/util-contains-newline.js +34 -0
- package/node_modules/yaml/browser/dist/compose/util-empty-scalar-position.js +27 -0
- package/node_modules/yaml/browser/dist/compose/util-flow-indent-check.js +15 -0
- package/node_modules/yaml/browser/dist/compose/util-map-includes.js +13 -0
- package/node_modules/yaml/browser/dist/doc/Document.js +335 -0
- package/node_modules/yaml/browser/dist/doc/anchors.js +72 -0
- package/node_modules/yaml/browser/dist/doc/applyReviver.js +55 -0
- package/node_modules/yaml/browser/dist/doc/createNode.js +89 -0
- package/node_modules/yaml/browser/dist/doc/directives.js +176 -0
- package/node_modules/yaml/browser/dist/errors.js +57 -0
- package/node_modules/yaml/browser/dist/index.js +17 -0
- package/node_modules/yaml/browser/dist/log.js +11 -0
- package/node_modules/yaml/browser/dist/nodes/Alias.js +101 -0
- package/node_modules/yaml/browser/dist/nodes/Collection.js +147 -0
- package/node_modules/yaml/browser/dist/nodes/Node.js +38 -0
- package/node_modules/yaml/browser/dist/nodes/Pair.js +36 -0
- package/node_modules/yaml/browser/dist/nodes/Scalar.js +24 -0
- package/node_modules/yaml/browser/dist/nodes/YAMLMap.js +144 -0
- package/node_modules/yaml/browser/dist/nodes/YAMLSeq.js +113 -0
- package/node_modules/yaml/browser/dist/nodes/addPairToJSMap.js +62 -0
- package/node_modules/yaml/browser/dist/nodes/identity.js +36 -0
- package/node_modules/yaml/browser/dist/nodes/toJS.js +37 -0
- package/node_modules/yaml/browser/dist/parse/cst-scalar.js +214 -0
- package/node_modules/yaml/browser/dist/parse/cst-stringify.js +61 -0
- package/node_modules/yaml/browser/dist/parse/cst-visit.js +97 -0
- package/node_modules/yaml/browser/dist/parse/cst.js +98 -0
- package/node_modules/yaml/browser/dist/parse/lexer.js +717 -0
- package/node_modules/yaml/browser/dist/parse/line-counter.js +39 -0
- package/node_modules/yaml/browser/dist/parse/parser.js +954 -0
- package/node_modules/yaml/browser/dist/public-api.js +102 -0
- package/node_modules/yaml/browser/dist/schema/Schema.js +37 -0
- package/node_modules/yaml/browser/dist/schema/common/map.js +17 -0
- package/node_modules/yaml/browser/dist/schema/common/null.js +15 -0
- package/node_modules/yaml/browser/dist/schema/common/seq.js +17 -0
- package/node_modules/yaml/browser/dist/schema/common/string.js +14 -0
- package/node_modules/yaml/browser/dist/schema/core/bool.js +19 -0
- package/node_modules/yaml/browser/dist/schema/core/float.js +43 -0
- package/node_modules/yaml/browser/dist/schema/core/int.js +38 -0
- package/node_modules/yaml/browser/dist/schema/core/schema.js +23 -0
- package/node_modules/yaml/browser/dist/schema/json/schema.js +62 -0
- package/node_modules/yaml/browser/dist/schema/tags.js +96 -0
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/binary.js +57 -0
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/bool.js +26 -0
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/float.js +46 -0
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/int.js +71 -0
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/merge.js +64 -0
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/omap.js +74 -0
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/pairs.js +78 -0
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/schema.js +39 -0
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/set.js +93 -0
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/timestamp.js +101 -0
- package/node_modules/yaml/browser/dist/stringify/foldFlowLines.js +146 -0
- package/node_modules/yaml/browser/dist/stringify/stringify.js +129 -0
- package/node_modules/yaml/browser/dist/stringify/stringifyCollection.js +143 -0
- package/node_modules/yaml/browser/dist/stringify/stringifyComment.js +20 -0
- package/node_modules/yaml/browser/dist/stringify/stringifyDocument.js +85 -0
- package/node_modules/yaml/browser/dist/stringify/stringifyNumber.js +24 -0
- package/node_modules/yaml/browser/dist/stringify/stringifyPair.js +150 -0
- package/node_modules/yaml/browser/dist/stringify/stringifyString.js +337 -0
- package/node_modules/yaml/browser/dist/util.js +11 -0
- package/node_modules/yaml/browser/dist/visit.js +233 -0
- package/node_modules/yaml/browser/index.js +5 -0
- package/node_modules/yaml/browser/package.json +3 -0
- package/node_modules/yaml/dist/cli.d.ts +8 -0
- package/node_modules/yaml/dist/cli.mjs +199 -0
- package/node_modules/yaml/dist/compose/compose-collection.d.ts +11 -0
- package/node_modules/yaml/dist/compose/compose-collection.js +90 -0
- package/node_modules/yaml/dist/compose/compose-doc.d.ts +7 -0
- package/node_modules/yaml/dist/compose/compose-doc.js +45 -0
- package/node_modules/yaml/dist/compose/compose-node.d.ts +29 -0
- package/node_modules/yaml/dist/compose/compose-node.js +105 -0
- package/node_modules/yaml/dist/compose/compose-scalar.d.ts +5 -0
- package/node_modules/yaml/dist/compose/compose-scalar.js +88 -0
- package/node_modules/yaml/dist/compose/composer.d.ts +63 -0
- package/node_modules/yaml/dist/compose/composer.js +222 -0
- package/node_modules/yaml/dist/compose/resolve-block-map.d.ts +6 -0
- package/node_modules/yaml/dist/compose/resolve-block-map.js +117 -0
- package/node_modules/yaml/dist/compose/resolve-block-scalar.d.ts +11 -0
- package/node_modules/yaml/dist/compose/resolve-block-scalar.js +200 -0
- package/node_modules/yaml/dist/compose/resolve-block-seq.d.ts +6 -0
- package/node_modules/yaml/dist/compose/resolve-block-seq.js +51 -0
- package/node_modules/yaml/dist/compose/resolve-end.d.ts +6 -0
- package/node_modules/yaml/dist/compose/resolve-end.js +39 -0
- package/node_modules/yaml/dist/compose/resolve-flow-collection.d.ts +7 -0
- package/node_modules/yaml/dist/compose/resolve-flow-collection.js +209 -0
- package/node_modules/yaml/dist/compose/resolve-flow-scalar.d.ts +10 -0
- package/node_modules/yaml/dist/compose/resolve-flow-scalar.js +225 -0
- package/node_modules/yaml/dist/compose/resolve-props.d.ts +23 -0
- package/node_modules/yaml/dist/compose/resolve-props.js +150 -0
- package/node_modules/yaml/dist/compose/util-contains-newline.d.ts +2 -0
- package/node_modules/yaml/dist/compose/util-contains-newline.js +36 -0
- package/node_modules/yaml/dist/compose/util-empty-scalar-position.d.ts +2 -0
- package/node_modules/yaml/dist/compose/util-empty-scalar-position.js +29 -0
- package/node_modules/yaml/dist/compose/util-flow-indent-check.d.ts +3 -0
- package/node_modules/yaml/dist/compose/util-flow-indent-check.js +17 -0
- package/node_modules/yaml/dist/compose/util-map-includes.d.ts +4 -0
- package/node_modules/yaml/dist/compose/util-map-includes.js +15 -0
- package/node_modules/yaml/dist/doc/Document.d.ts +141 -0
- package/node_modules/yaml/dist/doc/Document.js +337 -0
- package/node_modules/yaml/dist/doc/anchors.d.ts +24 -0
- package/node_modules/yaml/dist/doc/anchors.js +77 -0
- package/node_modules/yaml/dist/doc/applyReviver.d.ts +9 -0
- package/node_modules/yaml/dist/doc/applyReviver.js +57 -0
- package/node_modules/yaml/dist/doc/createNode.d.ts +17 -0
- package/node_modules/yaml/dist/doc/createNode.js +91 -0
- package/node_modules/yaml/dist/doc/directives.d.ts +49 -0
- package/node_modules/yaml/dist/doc/directives.js +178 -0
- package/node_modules/yaml/dist/errors.d.ts +21 -0
- package/node_modules/yaml/dist/errors.js +62 -0
- package/node_modules/yaml/dist/index.d.ts +25 -0
- package/node_modules/yaml/dist/index.js +50 -0
- package/node_modules/yaml/dist/log.d.ts +3 -0
- package/node_modules/yaml/dist/log.js +19 -0
- package/node_modules/yaml/dist/nodes/Alias.d.ts +29 -0
- package/node_modules/yaml/dist/nodes/Alias.js +103 -0
- package/node_modules/yaml/dist/nodes/Collection.d.ts +73 -0
- package/node_modules/yaml/dist/nodes/Collection.js +151 -0
- package/node_modules/yaml/dist/nodes/Node.d.ts +53 -0
- package/node_modules/yaml/dist/nodes/Node.js +40 -0
- package/node_modules/yaml/dist/nodes/Pair.d.ts +22 -0
- package/node_modules/yaml/dist/nodes/Pair.js +39 -0
- package/node_modules/yaml/dist/nodes/Scalar.d.ts +43 -0
- package/node_modules/yaml/dist/nodes/Scalar.js +27 -0
- package/node_modules/yaml/dist/nodes/YAMLMap.d.ts +53 -0
- package/node_modules/yaml/dist/nodes/YAMLMap.js +147 -0
- package/node_modules/yaml/dist/nodes/YAMLSeq.d.ts +60 -0
- package/node_modules/yaml/dist/nodes/YAMLSeq.js +115 -0
- package/node_modules/yaml/dist/nodes/addPairToJSMap.d.ts +4 -0
- package/node_modules/yaml/dist/nodes/addPairToJSMap.js +64 -0
- package/node_modules/yaml/dist/nodes/identity.d.ts +23 -0
- package/node_modules/yaml/dist/nodes/identity.js +53 -0
- package/node_modules/yaml/dist/nodes/toJS.d.ts +27 -0
- package/node_modules/yaml/dist/nodes/toJS.js +39 -0
- package/node_modules/yaml/dist/options.d.ts +344 -0
- package/node_modules/yaml/dist/parse/cst-scalar.d.ts +64 -0
- package/node_modules/yaml/dist/parse/cst-scalar.js +218 -0
- package/node_modules/yaml/dist/parse/cst-stringify.d.ts +8 -0
- package/node_modules/yaml/dist/parse/cst-stringify.js +63 -0
- package/node_modules/yaml/dist/parse/cst-visit.d.ts +39 -0
- package/node_modules/yaml/dist/parse/cst-visit.js +99 -0
- package/node_modules/yaml/dist/parse/cst.d.ts +109 -0
- package/node_modules/yaml/dist/parse/cst.js +112 -0
- package/node_modules/yaml/dist/parse/lexer.d.ts +87 -0
- package/node_modules/yaml/dist/parse/lexer.js +719 -0
- package/node_modules/yaml/dist/parse/line-counter.d.ts +22 -0
- package/node_modules/yaml/dist/parse/line-counter.js +41 -0
- package/node_modules/yaml/dist/parse/parser.d.ts +84 -0
- package/node_modules/yaml/dist/parse/parser.js +959 -0
- package/node_modules/yaml/dist/public-api.d.ts +44 -0
- package/node_modules/yaml/dist/public-api.js +107 -0
- package/node_modules/yaml/dist/schema/Schema.d.ts +17 -0
- package/node_modules/yaml/dist/schema/Schema.js +39 -0
- package/node_modules/yaml/dist/schema/common/map.d.ts +2 -0
- package/node_modules/yaml/dist/schema/common/map.js +19 -0
- package/node_modules/yaml/dist/schema/common/null.d.ts +4 -0
- package/node_modules/yaml/dist/schema/common/null.js +17 -0
- package/node_modules/yaml/dist/schema/common/seq.d.ts +2 -0
- package/node_modules/yaml/dist/schema/common/seq.js +19 -0
- package/node_modules/yaml/dist/schema/common/string.d.ts +2 -0
- package/node_modules/yaml/dist/schema/common/string.js +16 -0
- package/node_modules/yaml/dist/schema/core/bool.d.ts +4 -0
- package/node_modules/yaml/dist/schema/core/bool.js +21 -0
- package/node_modules/yaml/dist/schema/core/float.d.ts +4 -0
- package/node_modules/yaml/dist/schema/core/float.js +47 -0
- package/node_modules/yaml/dist/schema/core/int.d.ts +4 -0
- package/node_modules/yaml/dist/schema/core/int.js +42 -0
- package/node_modules/yaml/dist/schema/core/schema.d.ts +1 -0
- package/node_modules/yaml/dist/schema/core/schema.js +25 -0
- package/node_modules/yaml/dist/schema/json/schema.d.ts +2 -0
- package/node_modules/yaml/dist/schema/json/schema.js +64 -0
- package/node_modules/yaml/dist/schema/json-schema.d.ts +69 -0
- package/node_modules/yaml/dist/schema/tags.d.ts +48 -0
- package/node_modules/yaml/dist/schema/tags.js +99 -0
- package/node_modules/yaml/dist/schema/types.d.ts +92 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/binary.d.ts +2 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/binary.js +69 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/bool.d.ts +7 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/bool.js +29 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/float.d.ts +4 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/float.js +50 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/int.d.ts +5 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/int.js +76 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/merge.d.ts +9 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/merge.js +68 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/omap.d.ts +22 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/omap.js +77 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/pairs.d.ts +10 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/pairs.js +82 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/schema.d.ts +1 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/schema.js +41 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/set.d.ts +28 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/set.js +96 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/timestamp.d.ts +6 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/timestamp.js +105 -0
- package/node_modules/yaml/dist/stringify/foldFlowLines.d.ts +34 -0
- package/node_modules/yaml/dist/stringify/foldFlowLines.js +151 -0
- package/node_modules/yaml/dist/stringify/stringify.d.ts +21 -0
- package/node_modules/yaml/dist/stringify/stringify.js +132 -0
- package/node_modules/yaml/dist/stringify/stringifyCollection.d.ts +17 -0
- package/node_modules/yaml/dist/stringify/stringifyCollection.js +145 -0
- package/node_modules/yaml/dist/stringify/stringifyComment.d.ts +10 -0
- package/node_modules/yaml/dist/stringify/stringifyComment.js +24 -0
- package/node_modules/yaml/dist/stringify/stringifyDocument.d.ts +4 -0
- package/node_modules/yaml/dist/stringify/stringifyDocument.js +87 -0
- package/node_modules/yaml/dist/stringify/stringifyNumber.d.ts +2 -0
- package/node_modules/yaml/dist/stringify/stringifyNumber.js +26 -0
- package/node_modules/yaml/dist/stringify/stringifyPair.d.ts +3 -0
- package/node_modules/yaml/dist/stringify/stringifyPair.js +152 -0
- package/node_modules/yaml/dist/stringify/stringifyString.d.ts +9 -0
- package/node_modules/yaml/dist/stringify/stringifyString.js +339 -0
- package/node_modules/yaml/dist/test-events.d.ts +4 -0
- package/node_modules/yaml/dist/test-events.js +134 -0
- package/node_modules/yaml/dist/util.d.ts +16 -0
- package/node_modules/yaml/dist/util.js +28 -0
- package/node_modules/yaml/dist/visit.d.ts +102 -0
- package/node_modules/yaml/dist/visit.js +236 -0
- package/node_modules/yaml/package.json +96 -0
- package/node_modules/yaml/util.js +2 -0
- package/node_modules/zod/LICENSE +21 -0
- package/node_modules/zod/README.md +3074 -0
- package/node_modules/zod/index.d.ts +2 -0
- package/node_modules/zod/lib/ZodError.d.ts +164 -0
- package/node_modules/zod/lib/ZodError.js +137 -0
- package/node_modules/zod/lib/__tests__/Mocker.d.ts +17 -0
- package/node_modules/zod/lib/__tests__/Mocker.js +57 -0
- package/node_modules/zod/lib/benchmarks/datetime.d.ts +5 -0
- package/node_modules/zod/lib/benchmarks/datetime.js +54 -0
- package/node_modules/zod/lib/benchmarks/discriminatedUnion.d.ts +5 -0
- package/node_modules/zod/lib/benchmarks/discriminatedUnion.js +79 -0
- package/node_modules/zod/lib/benchmarks/index.d.ts +1 -0
- package/node_modules/zod/lib/benchmarks/index.js +59 -0
- package/node_modules/zod/lib/benchmarks/ipv4.d.ts +5 -0
- package/node_modules/zod/lib/benchmarks/ipv4.js +54 -0
- package/node_modules/zod/lib/benchmarks/object.d.ts +5 -0
- package/node_modules/zod/lib/benchmarks/object.js +70 -0
- package/node_modules/zod/lib/benchmarks/primitives.d.ts +5 -0
- package/node_modules/zod/lib/benchmarks/primitives.js +170 -0
- package/node_modules/zod/lib/benchmarks/realworld.d.ts +5 -0
- package/node_modules/zod/lib/benchmarks/realworld.js +56 -0
- package/node_modules/zod/lib/benchmarks/string.d.ts +5 -0
- package/node_modules/zod/lib/benchmarks/string.js +55 -0
- package/node_modules/zod/lib/benchmarks/union.d.ts +5 -0
- package/node_modules/zod/lib/benchmarks/union.js +79 -0
- package/node_modules/zod/lib/errors.d.ts +5 -0
- package/node_modules/zod/lib/errors.js +17 -0
- package/node_modules/zod/lib/external.d.ts +6 -0
- package/node_modules/zod/lib/external.js +22 -0
- package/node_modules/zod/lib/helpers/enumUtil.d.ts +8 -0
- package/node_modules/zod/lib/helpers/enumUtil.js +2 -0
- package/node_modules/zod/lib/helpers/errorUtil.d.ts +9 -0
- package/node_modules/zod/lib/helpers/errorUtil.js +8 -0
- package/node_modules/zod/lib/helpers/parseUtil.d.ts +78 -0
- package/node_modules/zod/lib/helpers/parseUtil.js +125 -0
- package/node_modules/zod/lib/helpers/partialUtil.d.ts +8 -0
- package/node_modules/zod/lib/helpers/partialUtil.js +2 -0
- package/node_modules/zod/lib/helpers/typeAliases.d.ts +2 -0
- package/node_modules/zod/lib/helpers/typeAliases.js +2 -0
- package/node_modules/zod/lib/helpers/util.d.ts +82 -0
- package/node_modules/zod/lib/helpers/util.js +142 -0
- package/node_modules/zod/lib/index.d.ts +4 -0
- package/node_modules/zod/lib/index.js +33 -0
- package/node_modules/zod/lib/index.mjs +4405 -0
- package/node_modules/zod/lib/index.umd.js +4520 -0
- package/node_modules/zod/lib/locales/en.d.ts +3 -0
- package/node_modules/zod/lib/locales/en.js +129 -0
- package/node_modules/zod/lib/standard-schema.d.ts +102 -0
- package/node_modules/zod/lib/standard-schema.js +2 -0
- package/node_modules/zod/lib/types.d.ts +1062 -0
- package/node_modules/zod/lib/types.js +3846 -0
- package/node_modules/zod/package.json +122 -0
- package/package.json +7 -3
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const benchmark_1 = __importDefault(require("benchmark"));
|
|
7
|
+
const index_1 = require("../index");
|
|
8
|
+
const emptySuite = new benchmark_1.default.Suite("z.object: empty");
|
|
9
|
+
const shortSuite = new benchmark_1.default.Suite("z.object: short");
|
|
10
|
+
const longSuite = new benchmark_1.default.Suite("z.object: long");
|
|
11
|
+
const empty = index_1.z.object({});
|
|
12
|
+
const short = index_1.z.object({
|
|
13
|
+
string: index_1.z.string(),
|
|
14
|
+
});
|
|
15
|
+
const long = index_1.z.object({
|
|
16
|
+
string: index_1.z.string(),
|
|
17
|
+
number: index_1.z.number(),
|
|
18
|
+
boolean: index_1.z.boolean(),
|
|
19
|
+
});
|
|
20
|
+
emptySuite
|
|
21
|
+
.add("valid", () => {
|
|
22
|
+
empty.parse({});
|
|
23
|
+
})
|
|
24
|
+
.add("valid: extra keys", () => {
|
|
25
|
+
empty.parse({ string: "string" });
|
|
26
|
+
})
|
|
27
|
+
.add("invalid: null", () => {
|
|
28
|
+
try {
|
|
29
|
+
empty.parse(null);
|
|
30
|
+
}
|
|
31
|
+
catch (err) { }
|
|
32
|
+
})
|
|
33
|
+
.on("cycle", (e) => {
|
|
34
|
+
console.log(`${emptySuite.name}: ${e.target}`);
|
|
35
|
+
});
|
|
36
|
+
shortSuite
|
|
37
|
+
.add("valid", () => {
|
|
38
|
+
short.parse({ string: "string" });
|
|
39
|
+
})
|
|
40
|
+
.add("valid: extra keys", () => {
|
|
41
|
+
short.parse({ string: "string", number: 42 });
|
|
42
|
+
})
|
|
43
|
+
.add("invalid: null", () => {
|
|
44
|
+
try {
|
|
45
|
+
short.parse(null);
|
|
46
|
+
}
|
|
47
|
+
catch (err) { }
|
|
48
|
+
})
|
|
49
|
+
.on("cycle", (e) => {
|
|
50
|
+
console.log(`${shortSuite.name}: ${e.target}`);
|
|
51
|
+
});
|
|
52
|
+
longSuite
|
|
53
|
+
.add("valid", () => {
|
|
54
|
+
long.parse({ string: "string", number: 42, boolean: true });
|
|
55
|
+
})
|
|
56
|
+
.add("valid: extra keys", () => {
|
|
57
|
+
long.parse({ string: "string", number: 42, boolean: true, list: [] });
|
|
58
|
+
})
|
|
59
|
+
.add("invalid: null", () => {
|
|
60
|
+
try {
|
|
61
|
+
long.parse(null);
|
|
62
|
+
}
|
|
63
|
+
catch (err) { }
|
|
64
|
+
})
|
|
65
|
+
.on("cycle", (e) => {
|
|
66
|
+
console.log(`${longSuite.name}: ${e.target}`);
|
|
67
|
+
});
|
|
68
|
+
exports.default = {
|
|
69
|
+
suites: [emptySuite, shortSuite, longSuite],
|
|
70
|
+
};
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const benchmark_1 = __importDefault(require("benchmark"));
|
|
7
|
+
const Mocker_1 = require("../__tests__/Mocker");
|
|
8
|
+
const index_1 = require("../index");
|
|
9
|
+
const val = new Mocker_1.Mocker();
|
|
10
|
+
const enumSuite = new benchmark_1.default.Suite("z.enum");
|
|
11
|
+
const enumSchema = index_1.z.enum(["a", "b", "c"]);
|
|
12
|
+
enumSuite
|
|
13
|
+
.add("valid", () => {
|
|
14
|
+
enumSchema.parse("a");
|
|
15
|
+
})
|
|
16
|
+
.add("invalid", () => {
|
|
17
|
+
try {
|
|
18
|
+
enumSchema.parse("x");
|
|
19
|
+
}
|
|
20
|
+
catch (e) { }
|
|
21
|
+
})
|
|
22
|
+
.on("cycle", (e) => {
|
|
23
|
+
console.log(`z.enum: ${e.target}`);
|
|
24
|
+
});
|
|
25
|
+
const longEnumSuite = new benchmark_1.default.Suite("long z.enum");
|
|
26
|
+
const longEnumSchema = index_1.z.enum([
|
|
27
|
+
"one",
|
|
28
|
+
"two",
|
|
29
|
+
"three",
|
|
30
|
+
"four",
|
|
31
|
+
"five",
|
|
32
|
+
"six",
|
|
33
|
+
"seven",
|
|
34
|
+
"eight",
|
|
35
|
+
"nine",
|
|
36
|
+
"ten",
|
|
37
|
+
"eleven",
|
|
38
|
+
"twelve",
|
|
39
|
+
"thirteen",
|
|
40
|
+
"fourteen",
|
|
41
|
+
"fifteen",
|
|
42
|
+
"sixteen",
|
|
43
|
+
"seventeen",
|
|
44
|
+
]);
|
|
45
|
+
longEnumSuite
|
|
46
|
+
.add("valid", () => {
|
|
47
|
+
longEnumSchema.parse("five");
|
|
48
|
+
})
|
|
49
|
+
.add("invalid", () => {
|
|
50
|
+
try {
|
|
51
|
+
longEnumSchema.parse("invalid");
|
|
52
|
+
}
|
|
53
|
+
catch (e) { }
|
|
54
|
+
})
|
|
55
|
+
.on("cycle", (e) => {
|
|
56
|
+
console.log(`long z.enum: ${e.target}`);
|
|
57
|
+
});
|
|
58
|
+
const undefinedSuite = new benchmark_1.default.Suite("z.undefined");
|
|
59
|
+
const undefinedSchema = index_1.z.undefined();
|
|
60
|
+
undefinedSuite
|
|
61
|
+
.add("valid", () => {
|
|
62
|
+
undefinedSchema.parse(undefined);
|
|
63
|
+
})
|
|
64
|
+
.add("invalid", () => {
|
|
65
|
+
try {
|
|
66
|
+
undefinedSchema.parse(1);
|
|
67
|
+
}
|
|
68
|
+
catch (e) { }
|
|
69
|
+
})
|
|
70
|
+
.on("cycle", (e) => {
|
|
71
|
+
console.log(`z.undefined: ${e.target}`);
|
|
72
|
+
});
|
|
73
|
+
const literalSuite = new benchmark_1.default.Suite("z.literal");
|
|
74
|
+
const short = "short";
|
|
75
|
+
const bad = "bad";
|
|
76
|
+
const literalSchema = index_1.z.literal("short");
|
|
77
|
+
literalSuite
|
|
78
|
+
.add("valid", () => {
|
|
79
|
+
literalSchema.parse(short);
|
|
80
|
+
})
|
|
81
|
+
.add("invalid", () => {
|
|
82
|
+
try {
|
|
83
|
+
literalSchema.parse(bad);
|
|
84
|
+
}
|
|
85
|
+
catch (e) { }
|
|
86
|
+
})
|
|
87
|
+
.on("cycle", (e) => {
|
|
88
|
+
console.log(`z.literal: ${e.target}`);
|
|
89
|
+
});
|
|
90
|
+
const numberSuite = new benchmark_1.default.Suite("z.number");
|
|
91
|
+
const numberSchema = index_1.z.number().int();
|
|
92
|
+
numberSuite
|
|
93
|
+
.add("valid", () => {
|
|
94
|
+
numberSchema.parse(1);
|
|
95
|
+
})
|
|
96
|
+
.add("invalid type", () => {
|
|
97
|
+
try {
|
|
98
|
+
numberSchema.parse("bad");
|
|
99
|
+
}
|
|
100
|
+
catch (e) { }
|
|
101
|
+
})
|
|
102
|
+
.add("invalid number", () => {
|
|
103
|
+
try {
|
|
104
|
+
numberSchema.parse(0.5);
|
|
105
|
+
}
|
|
106
|
+
catch (e) { }
|
|
107
|
+
})
|
|
108
|
+
.on("cycle", (e) => {
|
|
109
|
+
console.log(`z.number: ${e.target}`);
|
|
110
|
+
});
|
|
111
|
+
const dateSuite = new benchmark_1.default.Suite("z.date");
|
|
112
|
+
const plainDate = index_1.z.date();
|
|
113
|
+
const minMaxDate = index_1.z
|
|
114
|
+
.date()
|
|
115
|
+
.min(new Date("2021-01-01"))
|
|
116
|
+
.max(new Date("2030-01-01"));
|
|
117
|
+
dateSuite
|
|
118
|
+
.add("valid", () => {
|
|
119
|
+
plainDate.parse(new Date());
|
|
120
|
+
})
|
|
121
|
+
.add("invalid", () => {
|
|
122
|
+
try {
|
|
123
|
+
plainDate.parse(1);
|
|
124
|
+
}
|
|
125
|
+
catch (e) { }
|
|
126
|
+
})
|
|
127
|
+
.add("valid min and max", () => {
|
|
128
|
+
minMaxDate.parse(new Date("2023-01-01"));
|
|
129
|
+
})
|
|
130
|
+
.add("invalid min", () => {
|
|
131
|
+
try {
|
|
132
|
+
minMaxDate.parse(new Date("2019-01-01"));
|
|
133
|
+
}
|
|
134
|
+
catch (e) { }
|
|
135
|
+
})
|
|
136
|
+
.add("invalid max", () => {
|
|
137
|
+
try {
|
|
138
|
+
minMaxDate.parse(new Date("2031-01-01"));
|
|
139
|
+
}
|
|
140
|
+
catch (e) { }
|
|
141
|
+
})
|
|
142
|
+
.on("cycle", (e) => {
|
|
143
|
+
console.log(`z.date: ${e.target}`);
|
|
144
|
+
});
|
|
145
|
+
const symbolSuite = new benchmark_1.default.Suite("z.symbol");
|
|
146
|
+
const symbolSchema = index_1.z.symbol();
|
|
147
|
+
symbolSuite
|
|
148
|
+
.add("valid", () => {
|
|
149
|
+
symbolSchema.parse(val.symbol);
|
|
150
|
+
})
|
|
151
|
+
.add("invalid", () => {
|
|
152
|
+
try {
|
|
153
|
+
symbolSchema.parse(1);
|
|
154
|
+
}
|
|
155
|
+
catch (e) { }
|
|
156
|
+
})
|
|
157
|
+
.on("cycle", (e) => {
|
|
158
|
+
console.log(`z.symbol: ${e.target}`);
|
|
159
|
+
});
|
|
160
|
+
exports.default = {
|
|
161
|
+
suites: [
|
|
162
|
+
enumSuite,
|
|
163
|
+
longEnumSuite,
|
|
164
|
+
undefinedSuite,
|
|
165
|
+
literalSuite,
|
|
166
|
+
numberSuite,
|
|
167
|
+
dateSuite,
|
|
168
|
+
symbolSuite,
|
|
169
|
+
],
|
|
170
|
+
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const benchmark_1 = __importDefault(require("benchmark"));
|
|
7
|
+
const index_1 = require("../index");
|
|
8
|
+
const shortSuite = new benchmark_1.default.Suite("realworld");
|
|
9
|
+
const People = index_1.z.array(index_1.z.object({
|
|
10
|
+
type: index_1.z.literal("person"),
|
|
11
|
+
hair: index_1.z.enum(["blue", "brown"]),
|
|
12
|
+
active: index_1.z.boolean(),
|
|
13
|
+
name: index_1.z.string(),
|
|
14
|
+
age: index_1.z.number().int(),
|
|
15
|
+
hobbies: index_1.z.array(index_1.z.string()),
|
|
16
|
+
address: index_1.z.object({
|
|
17
|
+
street: index_1.z.string(),
|
|
18
|
+
zip: index_1.z.string(),
|
|
19
|
+
country: index_1.z.string(),
|
|
20
|
+
}),
|
|
21
|
+
}));
|
|
22
|
+
let i = 0;
|
|
23
|
+
function num() {
|
|
24
|
+
return ++i;
|
|
25
|
+
}
|
|
26
|
+
function str() {
|
|
27
|
+
return (++i % 100).toString(16);
|
|
28
|
+
}
|
|
29
|
+
function array(fn) {
|
|
30
|
+
return Array.from({ length: ++i % 10 }, () => fn());
|
|
31
|
+
}
|
|
32
|
+
const people = Array.from({ length: 100 }, () => {
|
|
33
|
+
return {
|
|
34
|
+
type: "person",
|
|
35
|
+
hair: i % 2 ? "blue" : "brown",
|
|
36
|
+
active: !!(i % 2),
|
|
37
|
+
name: str(),
|
|
38
|
+
age: num(),
|
|
39
|
+
hobbies: array(str),
|
|
40
|
+
address: {
|
|
41
|
+
street: str(),
|
|
42
|
+
zip: str(),
|
|
43
|
+
country: str(),
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
});
|
|
47
|
+
shortSuite
|
|
48
|
+
.add("valid", () => {
|
|
49
|
+
People.parse(people);
|
|
50
|
+
})
|
|
51
|
+
.on("cycle", (e) => {
|
|
52
|
+
console.log(`${shortSuite.name}: ${e.target}`);
|
|
53
|
+
});
|
|
54
|
+
exports.default = {
|
|
55
|
+
suites: [shortSuite],
|
|
56
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const benchmark_1 = __importDefault(require("benchmark"));
|
|
7
|
+
const index_1 = require("../index");
|
|
8
|
+
const SUITE_NAME = "z.string";
|
|
9
|
+
const suite = new benchmark_1.default.Suite(SUITE_NAME);
|
|
10
|
+
const empty = "";
|
|
11
|
+
const short = "short";
|
|
12
|
+
const long = "long".repeat(256);
|
|
13
|
+
const manual = (str) => {
|
|
14
|
+
if (typeof str !== "string") {
|
|
15
|
+
throw new Error("Not a string");
|
|
16
|
+
}
|
|
17
|
+
return str;
|
|
18
|
+
};
|
|
19
|
+
const stringSchema = index_1.z.string();
|
|
20
|
+
const optionalStringSchema = index_1.z.string().optional();
|
|
21
|
+
const optionalNullableStringSchema = index_1.z.string().optional().nullable();
|
|
22
|
+
suite
|
|
23
|
+
.add("empty string", () => {
|
|
24
|
+
stringSchema.parse(empty);
|
|
25
|
+
})
|
|
26
|
+
.add("short string", () => {
|
|
27
|
+
stringSchema.parse(short);
|
|
28
|
+
})
|
|
29
|
+
.add("long string", () => {
|
|
30
|
+
stringSchema.parse(long);
|
|
31
|
+
})
|
|
32
|
+
.add("optional string", () => {
|
|
33
|
+
optionalStringSchema.parse(long);
|
|
34
|
+
})
|
|
35
|
+
.add("nullable string", () => {
|
|
36
|
+
optionalNullableStringSchema.parse(long);
|
|
37
|
+
})
|
|
38
|
+
.add("nullable (null) string", () => {
|
|
39
|
+
optionalNullableStringSchema.parse(null);
|
|
40
|
+
})
|
|
41
|
+
.add("invalid: null", () => {
|
|
42
|
+
try {
|
|
43
|
+
stringSchema.parse(null);
|
|
44
|
+
}
|
|
45
|
+
catch (err) { }
|
|
46
|
+
})
|
|
47
|
+
.add("manual parser: long", () => {
|
|
48
|
+
manual(long);
|
|
49
|
+
})
|
|
50
|
+
.on("cycle", (e) => {
|
|
51
|
+
console.log(`${SUITE_NAME}: ${e.target}`);
|
|
52
|
+
});
|
|
53
|
+
exports.default = {
|
|
54
|
+
suites: [suite],
|
|
55
|
+
};
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const benchmark_1 = __importDefault(require("benchmark"));
|
|
7
|
+
const index_1 = require("../index");
|
|
8
|
+
const doubleSuite = new benchmark_1.default.Suite("z.union: double");
|
|
9
|
+
const manySuite = new benchmark_1.default.Suite("z.union: many");
|
|
10
|
+
const aSchema = index_1.z.object({
|
|
11
|
+
type: index_1.z.literal("a"),
|
|
12
|
+
});
|
|
13
|
+
const objA = {
|
|
14
|
+
type: "a",
|
|
15
|
+
};
|
|
16
|
+
const bSchema = index_1.z.object({
|
|
17
|
+
type: index_1.z.literal("b"),
|
|
18
|
+
});
|
|
19
|
+
const objB = {
|
|
20
|
+
type: "b",
|
|
21
|
+
};
|
|
22
|
+
const cSchema = index_1.z.object({
|
|
23
|
+
type: index_1.z.literal("c"),
|
|
24
|
+
});
|
|
25
|
+
const objC = {
|
|
26
|
+
type: "c",
|
|
27
|
+
};
|
|
28
|
+
const dSchema = index_1.z.object({
|
|
29
|
+
type: index_1.z.literal("d"),
|
|
30
|
+
});
|
|
31
|
+
const double = index_1.z.union([aSchema, bSchema]);
|
|
32
|
+
const many = index_1.z.union([aSchema, bSchema, cSchema, dSchema]);
|
|
33
|
+
doubleSuite
|
|
34
|
+
.add("valid: a", () => {
|
|
35
|
+
double.parse(objA);
|
|
36
|
+
})
|
|
37
|
+
.add("valid: b", () => {
|
|
38
|
+
double.parse(objB);
|
|
39
|
+
})
|
|
40
|
+
.add("invalid: null", () => {
|
|
41
|
+
try {
|
|
42
|
+
double.parse(null);
|
|
43
|
+
}
|
|
44
|
+
catch (err) { }
|
|
45
|
+
})
|
|
46
|
+
.add("invalid: wrong shape", () => {
|
|
47
|
+
try {
|
|
48
|
+
double.parse(objC);
|
|
49
|
+
}
|
|
50
|
+
catch (err) { }
|
|
51
|
+
})
|
|
52
|
+
.on("cycle", (e) => {
|
|
53
|
+
console.log(`${doubleSuite.name}: ${e.target}`);
|
|
54
|
+
});
|
|
55
|
+
manySuite
|
|
56
|
+
.add("valid: a", () => {
|
|
57
|
+
many.parse(objA);
|
|
58
|
+
})
|
|
59
|
+
.add("valid: c", () => {
|
|
60
|
+
many.parse(objC);
|
|
61
|
+
})
|
|
62
|
+
.add("invalid: null", () => {
|
|
63
|
+
try {
|
|
64
|
+
many.parse(null);
|
|
65
|
+
}
|
|
66
|
+
catch (err) { }
|
|
67
|
+
})
|
|
68
|
+
.add("invalid: wrong shape", () => {
|
|
69
|
+
try {
|
|
70
|
+
many.parse({ type: "unknown" });
|
|
71
|
+
}
|
|
72
|
+
catch (err) { }
|
|
73
|
+
})
|
|
74
|
+
.on("cycle", (e) => {
|
|
75
|
+
console.log(`${manySuite.name}: ${e.target}`);
|
|
76
|
+
});
|
|
77
|
+
exports.default = {
|
|
78
|
+
suites: [doubleSuite, manySuite],
|
|
79
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.getErrorMap = exports.setErrorMap = exports.defaultErrorMap = void 0;
|
|
7
|
+
const en_1 = __importDefault(require("./locales/en"));
|
|
8
|
+
exports.defaultErrorMap = en_1.default;
|
|
9
|
+
let overrideErrorMap = en_1.default;
|
|
10
|
+
function setErrorMap(map) {
|
|
11
|
+
overrideErrorMap = map;
|
|
12
|
+
}
|
|
13
|
+
exports.setErrorMap = setErrorMap;
|
|
14
|
+
function getErrorMap() {
|
|
15
|
+
return overrideErrorMap;
|
|
16
|
+
}
|
|
17
|
+
exports.getErrorMap = getErrorMap;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./errors"), exports);
|
|
18
|
+
__exportStar(require("./helpers/parseUtil"), exports);
|
|
19
|
+
__exportStar(require("./helpers/typeAliases"), exports);
|
|
20
|
+
__exportStar(require("./helpers/util"), exports);
|
|
21
|
+
__exportStar(require("./types"), exports);
|
|
22
|
+
__exportStar(require("./ZodError"), exports);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare namespace enumUtil {
|
|
2
|
+
type UnionToIntersectionFn<T> = (T extends unknown ? (k: () => T) => void : never) extends (k: infer Intersection) => void ? Intersection : never;
|
|
3
|
+
type GetUnionLast<T> = UnionToIntersectionFn<T> extends () => infer Last ? Last : never;
|
|
4
|
+
type UnionToTuple<T, Tuple extends unknown[] = []> = [T] extends [never] ? Tuple : UnionToTuple<Exclude<T, GetUnionLast<T>>, [GetUnionLast<T>, ...Tuple]>;
|
|
5
|
+
type CastToStringTuple<T> = T extends [string, ...string[]] ? T : never;
|
|
6
|
+
export type UnionToTupleString<T> = CastToStringTuple<UnionToTuple<T>>;
|
|
7
|
+
export {};
|
|
8
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.errorUtil = void 0;
|
|
4
|
+
var errorUtil;
|
|
5
|
+
(function (errorUtil) {
|
|
6
|
+
errorUtil.errToObj = (message) => typeof message === "string" ? { message } : message || {};
|
|
7
|
+
errorUtil.toString = (message) => typeof message === "string" ? message : message === null || message === void 0 ? void 0 : message.message;
|
|
8
|
+
})(errorUtil || (exports.errorUtil = errorUtil = {}));
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import type { IssueData, ZodErrorMap, ZodIssue } from "../ZodError";
|
|
2
|
+
import type { ZodParsedType } from "./util";
|
|
3
|
+
export declare const makeIssue: (params: {
|
|
4
|
+
data: any;
|
|
5
|
+
path: (string | number)[];
|
|
6
|
+
errorMaps: ZodErrorMap[];
|
|
7
|
+
issueData: IssueData;
|
|
8
|
+
}) => ZodIssue;
|
|
9
|
+
export type ParseParams = {
|
|
10
|
+
path: (string | number)[];
|
|
11
|
+
errorMap: ZodErrorMap;
|
|
12
|
+
async: boolean;
|
|
13
|
+
};
|
|
14
|
+
export type ParsePathComponent = string | number;
|
|
15
|
+
export type ParsePath = ParsePathComponent[];
|
|
16
|
+
export declare const EMPTY_PATH: ParsePath;
|
|
17
|
+
export interface ParseContext {
|
|
18
|
+
readonly common: {
|
|
19
|
+
readonly issues: ZodIssue[];
|
|
20
|
+
readonly contextualErrorMap?: ZodErrorMap;
|
|
21
|
+
readonly async: boolean;
|
|
22
|
+
};
|
|
23
|
+
readonly path: ParsePath;
|
|
24
|
+
readonly schemaErrorMap?: ZodErrorMap;
|
|
25
|
+
readonly parent: ParseContext | null;
|
|
26
|
+
readonly data: any;
|
|
27
|
+
readonly parsedType: ZodParsedType;
|
|
28
|
+
}
|
|
29
|
+
export type ParseInput = {
|
|
30
|
+
data: any;
|
|
31
|
+
path: (string | number)[];
|
|
32
|
+
parent: ParseContext;
|
|
33
|
+
};
|
|
34
|
+
export declare function addIssueToContext(ctx: ParseContext, issueData: IssueData): void;
|
|
35
|
+
export type ObjectPair = {
|
|
36
|
+
key: SyncParseReturnType<any>;
|
|
37
|
+
value: SyncParseReturnType<any>;
|
|
38
|
+
};
|
|
39
|
+
export declare class ParseStatus {
|
|
40
|
+
value: "aborted" | "dirty" | "valid";
|
|
41
|
+
dirty(): void;
|
|
42
|
+
abort(): void;
|
|
43
|
+
static mergeArray(status: ParseStatus, results: SyncParseReturnType<any>[]): SyncParseReturnType;
|
|
44
|
+
static mergeObjectAsync(status: ParseStatus, pairs: {
|
|
45
|
+
key: ParseReturnType<any>;
|
|
46
|
+
value: ParseReturnType<any>;
|
|
47
|
+
}[]): Promise<SyncParseReturnType<any>>;
|
|
48
|
+
static mergeObjectSync(status: ParseStatus, pairs: {
|
|
49
|
+
key: SyncParseReturnType<any>;
|
|
50
|
+
value: SyncParseReturnType<any>;
|
|
51
|
+
alwaysSet?: boolean;
|
|
52
|
+
}[]): SyncParseReturnType;
|
|
53
|
+
}
|
|
54
|
+
export interface ParseResult {
|
|
55
|
+
status: "aborted" | "dirty" | "valid";
|
|
56
|
+
data: any;
|
|
57
|
+
}
|
|
58
|
+
export type INVALID = {
|
|
59
|
+
status: "aborted";
|
|
60
|
+
};
|
|
61
|
+
export declare const INVALID: INVALID;
|
|
62
|
+
export type DIRTY<T> = {
|
|
63
|
+
status: "dirty";
|
|
64
|
+
value: T;
|
|
65
|
+
};
|
|
66
|
+
export declare const DIRTY: <T>(value: T) => DIRTY<T>;
|
|
67
|
+
export type OK<T> = {
|
|
68
|
+
status: "valid";
|
|
69
|
+
value: T;
|
|
70
|
+
};
|
|
71
|
+
export declare const OK: <T>(value: T) => OK<T>;
|
|
72
|
+
export type SyncParseReturnType<T = any> = OK<T> | DIRTY<T> | INVALID;
|
|
73
|
+
export type AsyncParseReturnType<T> = Promise<SyncParseReturnType<T>>;
|
|
74
|
+
export type ParseReturnType<T> = SyncParseReturnType<T> | AsyncParseReturnType<T>;
|
|
75
|
+
export declare const isAborted: (x: ParseReturnType<any>) => x is INVALID;
|
|
76
|
+
export declare const isDirty: <T>(x: ParseReturnType<T>) => x is OK<T> | DIRTY<T>;
|
|
77
|
+
export declare const isValid: <T>(x: ParseReturnType<T>) => x is OK<T>;
|
|
78
|
+
export declare const isAsync: <T>(x: ParseReturnType<T>) => x is AsyncParseReturnType<T>;
|