@btc-embedded/cdk-extensions 0.10.1 → 0.10.4
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 +40 -40
- package/CHANGELOG.md +11 -0
- package/lib/constructs/EventPipe.js +1 -1
- package/lib/constructs/S3Bucket.js +1 -1
- package/lib/constructs/SecureRestApi.js +1 -1
- package/lib/constructs/SecureRestApiV2.js +1 -1
- package/lib/extensions/ApiGatewayExtension.js +1 -1
- package/lib/extensions/ApplicationLoadBalancerExtension.js +1 -1
- package/lib/extensions/ApplicationLoadBalancerExtensionV2.js +1 -1
- package/lib/extensions/CloudMapExtension.js +1 -1
- package/lib/extensions/DeactivatableServiceExtension.js +1 -1
- package/lib/extensions/DocumentDbAccessExtension.js +3 -6
- package/lib/extensions/DomainEventMessagingExtension.js +1 -1
- package/lib/extensions/ExtraContainerExtension.js +1 -1
- package/lib/extensions/HTTPApiExtension.js +1 -1
- package/lib/extensions/LogExtension.js +3 -4
- 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 +3 -6
- package/lib/extensions/SharedVolumeExtension.js +5 -4
- package/lib/extensions/TcpKeepAliveExtension.js +3 -6
- package/lib/platform/ApiGateway.js +1 -1
- package/lib/platform/ApiGatewayV2.js +2 -2
- package/lib/platform/ApplicationLoadBalancer.js +1 -1
- package/lib/platform/ApplicationLoadBalancerV2.js +2 -2
- package/lib/platform/CognitoUserPool.js +2 -2
- package/lib/platform/DefaultUserPoolClients.js +1 -1
- package/lib/platform/DocumentDB.js +2 -2
- package/lib/platform/PrivateDnsNamespace.js +1 -1
- package/lib/platform/ResourceServer.js +1 -1
- package/lib/platform/Vpc.js +1 -1
- package/lib/utils/StackParameter.js +1 -1
- package/lib/utils/functions.d.ts +12 -2
- package/lib/utils/functions.js +23 -6
- package/node_modules/yaml/README.md +2 -0
- package/node_modules/yaml/browser/dist/compose/compose-collection.js +2 -2
- package/node_modules/yaml/browser/dist/compose/resolve-props.js +2 -4
- package/node_modules/yaml/browser/dist/compose/util-empty-scalar-position.js +1 -2
- package/node_modules/yaml/browser/dist/doc/anchors.js +1 -2
- package/node_modules/yaml/browser/dist/doc/createNode.js +1 -2
- package/node_modules/yaml/browser/dist/nodes/Alias.js +24 -11
- package/node_modules/yaml/browser/dist/nodes/YAMLMap.js +1 -1
- package/node_modules/yaml/browser/dist/nodes/addPairToJSMap.js +1 -0
- package/node_modules/yaml/browser/dist/parse/parser.js +14 -1
- package/node_modules/yaml/browser/dist/schema/tags.js +3 -3
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/binary.js +3 -2
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/pairs.js +1 -1
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/timestamp.js +1 -1
- package/node_modules/yaml/browser/dist/stringify/stringify.js +3 -4
- package/node_modules/yaml/browser/dist/stringify/stringifyString.js +3 -4
- package/node_modules/yaml/dist/cli.d.ts +1 -1
- package/node_modules/yaml/dist/cli.mjs +5 -3
- package/node_modules/yaml/dist/compose/compose-collection.js +2 -2
- package/node_modules/yaml/dist/compose/composer.js +1 -1
- package/node_modules/yaml/dist/compose/resolve-props.js +2 -4
- package/node_modules/yaml/dist/compose/util-empty-scalar-position.js +1 -2
- package/node_modules/yaml/dist/doc/anchors.js +1 -2
- package/node_modules/yaml/dist/doc/createNode.js +1 -2
- package/node_modules/yaml/dist/log.js +1 -1
- package/node_modules/yaml/dist/nodes/Alias.d.ts +1 -1
- package/node_modules/yaml/dist/nodes/Alias.js +23 -10
- package/node_modules/yaml/dist/nodes/addPairToJSMap.js +1 -0
- package/node_modules/yaml/dist/nodes/toJS.d.ts +2 -0
- package/node_modules/yaml/dist/parse/parser.js +15 -2
- package/node_modules/yaml/dist/schema/yaml-1.1/binary.js +4 -3
- package/node_modules/yaml/dist/schema/yaml-1.1/timestamp.js +1 -1
- package/node_modules/yaml/dist/stringify/stringify.js +3 -4
- package/node_modules/yaml/dist/stringify/stringifyString.js +2 -3
- package/node_modules/yaml/package.json +2 -2
- package/node_modules/zod/LICENSE +1 -1
- package/node_modules/zod/README.md +105 -2971
- package/node_modules/zod/{lib/external.js → dist/cjs/index.js} +6 -6
- package/node_modules/zod/dist/cjs/package.json +3 -0
- package/node_modules/zod/{lib → dist/cjs/v3}/ZodError.js +3 -3
- package/node_modules/zod/{lib → dist/cjs/v3}/benchmarks/datetime.js +1 -1
- package/node_modules/zod/{lib → dist/cjs/v3}/benchmarks/discriminatedUnion.js +15 -15
- package/node_modules/zod/dist/cjs/v3/benchmarks/index.js +59 -0
- package/node_modules/zod/{lib → dist/cjs/v3}/benchmarks/object.js +11 -11
- package/node_modules/zod/{lib → dist/cjs/v3}/benchmarks/primitives.js +22 -33
- package/node_modules/zod/{lib → dist/cjs/v3}/benchmarks/realworld.js +12 -12
- package/node_modules/zod/{lib → dist/cjs/v3}/benchmarks/string.js +5 -5
- package/node_modules/zod/{lib → dist/cjs/v3}/benchmarks/union.js +15 -15
- package/node_modules/zod/{lib → dist/cjs/v3}/errors.js +6 -6
- package/node_modules/zod/dist/cjs/v3/external.js +22 -0
- package/node_modules/zod/{lib → dist/cjs/v3}/helpers/errorUtil.js +2 -1
- package/node_modules/zod/{lib → dist/cjs/v3}/helpers/parseUtil.js +7 -8
- package/node_modules/zod/{lib → dist/cjs/v3}/helpers/util.js +5 -10
- package/node_modules/zod/{lib → dist/cjs/v3}/index.js +2 -2
- package/node_modules/zod/{lib → dist/cjs/v3}/locales/en.js +30 -50
- package/node_modules/zod/{lib → dist/cjs/v3}/types.js +466 -539
- package/node_modules/zod/dist/cjs/v4/classic/checks.js +32 -0
- package/node_modules/zod/dist/cjs/v4/classic/coerce.js +47 -0
- package/node_modules/zod/dist/cjs/v4/classic/compat.js +63 -0
- package/node_modules/zod/dist/cjs/v4/classic/errors.js +67 -0
- package/node_modules/zod/dist/cjs/v4/classic/external.js +69 -0
- package/node_modules/zod/dist/cjs/v4/classic/index.js +33 -0
- package/node_modules/zod/dist/cjs/v4/classic/iso.js +60 -0
- package/node_modules/zod/dist/cjs/v4/classic/parse.js +32 -0
- package/node_modules/zod/dist/cjs/v4/classic/schemas.js +1100 -0
- package/node_modules/zod/dist/cjs/v4/core/api.js +1021 -0
- package/node_modules/zod/dist/cjs/v4/core/checks.js +580 -0
- package/node_modules/zod/dist/cjs/v4/core/config.js +10 -0
- package/node_modules/zod/dist/cjs/v4/core/core.js +63 -0
- package/node_modules/zod/dist/cjs/v4/core/doc.js +39 -0
- package/node_modules/zod/dist/cjs/v4/core/errors.js +222 -0
- package/node_modules/zod/dist/cjs/v4/core/function.js +102 -0
- package/node_modules/zod/dist/cjs/v4/core/index.js +44 -0
- package/node_modules/zod/dist/cjs/v4/core/json-schema.js +2 -0
- package/node_modules/zod/dist/cjs/v4/core/parse.js +87 -0
- package/node_modules/zod/dist/cjs/v4/core/regexes.js +103 -0
- package/node_modules/zod/dist/cjs/v4/core/registries.js +47 -0
- package/node_modules/zod/dist/cjs/v4/core/schemas.js +1719 -0
- package/node_modules/zod/dist/cjs/v4/core/standard-schema.js +2 -0
- package/node_modules/zod/dist/cjs/v4/core/to-json-schema.js +833 -0
- package/node_modules/zod/dist/cjs/v4/core/util.js +537 -0
- package/node_modules/zod/dist/cjs/v4/core/versions.js +8 -0
- package/node_modules/zod/dist/cjs/v4/core/zsf.js +172 -0
- package/node_modules/zod/dist/cjs/v4/index.js +22 -0
- package/node_modules/zod/dist/cjs/v4/locales/ar.js +142 -0
- package/node_modules/zod/dist/cjs/v4/locales/az.js +141 -0
- package/node_modules/zod/dist/cjs/v4/locales/be.js +190 -0
- package/node_modules/zod/dist/cjs/v4/locales/ca.js +144 -0
- package/node_modules/zod/dist/cjs/v4/locales/cs.js +161 -0
- package/node_modules/zod/dist/cjs/v4/locales/de.js +142 -0
- package/node_modules/zod/dist/cjs/v4/locales/en.js +145 -0
- package/node_modules/zod/dist/cjs/v4/locales/es.js +143 -0
- package/node_modules/zod/dist/cjs/v4/locales/fa.js +148 -0
- package/node_modules/zod/dist/cjs/v4/locales/fi.js +148 -0
- package/node_modules/zod/dist/cjs/v4/locales/fr-CA.js +143 -0
- package/node_modules/zod/dist/cjs/v4/locales/fr.js +142 -0
- package/node_modules/zod/dist/cjs/v4/locales/he.js +143 -0
- package/node_modules/zod/dist/cjs/v4/locales/hu.js +143 -0
- package/node_modules/zod/dist/cjs/v4/locales/id.js +142 -0
- package/node_modules/zod/dist/cjs/v4/locales/index.js +82 -0
- package/node_modules/zod/dist/cjs/v4/locales/it.js +143 -0
- package/node_modules/zod/dist/cjs/v4/locales/ja.js +141 -0
- package/node_modules/zod/dist/cjs/v4/locales/kh.js +143 -0
- package/node_modules/zod/dist/cjs/v4/locales/ko.js +147 -0
- package/node_modules/zod/dist/cjs/v4/locales/mk.js +144 -0
- package/node_modules/zod/dist/cjs/v4/locales/ms.js +142 -0
- package/node_modules/zod/dist/cjs/v4/locales/nl.js +143 -0
- package/node_modules/zod/dist/cjs/v4/locales/no.js +142 -0
- package/node_modules/zod/dist/cjs/v4/locales/ota.js +143 -0
- package/node_modules/zod/dist/cjs/v4/locales/pl.js +143 -0
- package/node_modules/zod/dist/cjs/v4/locales/ps.js +148 -0
- package/node_modules/zod/dist/cjs/v4/locales/pt.js +142 -0
- package/node_modules/zod/dist/cjs/v4/locales/ru.js +190 -0
- package/node_modules/zod/dist/cjs/v4/locales/sl.js +143 -0
- package/node_modules/zod/dist/cjs/v4/locales/sv.js +144 -0
- package/node_modules/zod/dist/cjs/v4/locales/ta.js +143 -0
- package/node_modules/zod/dist/cjs/v4/locales/th.js +143 -0
- package/node_modules/zod/dist/cjs/v4/locales/tr.js +143 -0
- package/node_modules/zod/dist/cjs/v4/locales/ua.js +143 -0
- package/node_modules/zod/dist/cjs/v4/locales/ur.js +143 -0
- package/node_modules/zod/dist/cjs/v4/locales/vi.js +142 -0
- package/node_modules/zod/dist/cjs/v4/locales/zh-CN.js +142 -0
- package/node_modules/zod/dist/cjs/v4/locales/zh-TW.js +143 -0
- package/node_modules/zod/dist/cjs/v4/mini/checks.js +34 -0
- package/node_modules/zod/dist/cjs/v4/mini/coerce.js +47 -0
- package/node_modules/zod/dist/cjs/v4/mini/external.js +61 -0
- package/node_modules/zod/dist/cjs/v4/mini/index.js +32 -0
- package/node_modules/zod/dist/cjs/v4/mini/iso.js +60 -0
- package/node_modules/zod/dist/cjs/v4/mini/parse.js +8 -0
- package/node_modules/zod/dist/cjs/v4/mini/schemas.js +831 -0
- package/node_modules/zod/dist/esm/index.js +3 -0
- package/node_modules/zod/dist/esm/package.json +3 -0
- package/node_modules/zod/dist/esm/v3/ZodError.js +132 -0
- package/node_modules/zod/dist/esm/v3/benchmarks/datetime.js +49 -0
- package/node_modules/zod/dist/esm/v3/benchmarks/discriminatedUnion.js +74 -0
- package/node_modules/zod/dist/esm/v3/benchmarks/index.js +54 -0
- package/node_modules/zod/dist/esm/v3/benchmarks/ipv4.js +49 -0
- package/node_modules/zod/dist/esm/v3/benchmarks/object.js +65 -0
- package/node_modules/zod/dist/esm/v3/benchmarks/primitives.js +154 -0
- package/node_modules/zod/dist/esm/v3/benchmarks/realworld.js +51 -0
- package/node_modules/zod/dist/esm/v3/benchmarks/string.js +50 -0
- package/node_modules/zod/dist/esm/v3/benchmarks/union.js +74 -0
- package/node_modules/zod/dist/esm/v3/errors.js +9 -0
- package/node_modules/zod/dist/esm/v3/external.js +6 -0
- package/node_modules/zod/dist/esm/v3/helpers/errorUtil.js +6 -0
- package/node_modules/zod/dist/esm/v3/helpers/parseUtil.js +109 -0
- package/node_modules/zod/dist/esm/v3/helpers/partialUtil.js +1 -0
- package/node_modules/zod/dist/esm/v3/helpers/typeAliases.js +1 -0
- package/node_modules/zod/dist/esm/v3/helpers/util.js +133 -0
- package/node_modules/zod/dist/esm/v3/index.js +4 -0
- package/node_modules/zod/dist/esm/v3/locales/en.js +107 -0
- package/node_modules/zod/dist/esm/v3/standard-schema.js +1 -0
- package/node_modules/zod/dist/esm/v3/tests/Mocker.js +53 -0
- package/node_modules/zod/{lib/index.mjs → dist/esm/v3/types.js} +148 -862
- package/node_modules/zod/dist/esm/v4/classic/checks.js +1 -0
- package/node_modules/zod/dist/esm/v4/classic/coerce.js +17 -0
- package/node_modules/zod/dist/esm/v4/classic/compat.js +33 -0
- package/node_modules/zod/dist/esm/v4/classic/errors.js +41 -0
- package/node_modules/zod/dist/esm/v4/classic/external.js +18 -0
- package/node_modules/zod/dist/esm/v4/classic/index.js +4 -0
- package/node_modules/zod/dist/esm/v4/classic/iso.js +30 -0
- package/node_modules/zod/dist/esm/v4/classic/parse.js +6 -0
- package/node_modules/zod/dist/esm/v4/classic/schemas.js +998 -0
- package/node_modules/zod/dist/esm/v4/core/api.js +889 -0
- package/node_modules/zod/dist/esm/v4/core/checks.js +554 -0
- package/node_modules/zod/dist/esm/v4/core/config.js +6 -0
- package/node_modules/zod/dist/esm/v4/core/core.js +57 -0
- package/node_modules/zod/dist/esm/v4/core/doc.js +35 -0
- package/node_modules/zod/dist/esm/v4/core/errors.js +191 -0
- package/node_modules/zod/dist/esm/v4/core/function.js +75 -0
- package/node_modules/zod/dist/esm/v4/core/index.js +15 -0
- package/node_modules/zod/dist/esm/v4/core/json-schema.js +1 -0
- package/node_modules/zod/dist/esm/v4/core/parse.js +57 -0
- package/node_modules/zod/dist/esm/v4/core/regexes.js +95 -0
- package/node_modules/zod/dist/esm/v4/core/registries.js +42 -0
- package/node_modules/zod/dist/esm/v4/core/schemas.js +1688 -0
- package/node_modules/zod/dist/esm/v4/core/standard-schema.js +1 -0
- package/node_modules/zod/dist/esm/v4/core/to-json-schema.js +828 -0
- package/node_modules/zod/dist/esm/v4/core/util.js +491 -0
- package/node_modules/zod/dist/esm/v4/core/versions.js +5 -0
- package/node_modules/zod/dist/esm/v4/core/zsf.js +171 -0
- package/node_modules/zod/dist/esm/v4/index.js +3 -0
- package/node_modules/zod/dist/esm/v4/locales/ar.js +116 -0
- package/node_modules/zod/dist/esm/v4/locales/az.js +115 -0
- package/node_modules/zod/dist/esm/v4/locales/be.js +164 -0
- package/node_modules/zod/dist/esm/v4/locales/ca.js +118 -0
- package/node_modules/zod/dist/esm/v4/locales/cs.js +135 -0
- package/node_modules/zod/dist/esm/v4/locales/de.js +116 -0
- package/node_modules/zod/dist/esm/v4/locales/en.js +117 -0
- package/node_modules/zod/dist/esm/v4/locales/es.js +117 -0
- package/node_modules/zod/dist/esm/v4/locales/fa.js +122 -0
- package/node_modules/zod/dist/esm/v4/locales/fi.js +122 -0
- package/node_modules/zod/dist/esm/v4/locales/fr-CA.js +117 -0
- package/node_modules/zod/dist/esm/v4/locales/fr.js +116 -0
- package/node_modules/zod/dist/esm/v4/locales/he.js +117 -0
- package/node_modules/zod/dist/esm/v4/locales/hu.js +117 -0
- package/node_modules/zod/dist/esm/v4/locales/id.js +116 -0
- package/node_modules/zod/dist/esm/v4/locales/index.js +38 -0
- package/node_modules/zod/dist/esm/v4/locales/it.js +117 -0
- package/node_modules/zod/dist/esm/v4/locales/ja.js +115 -0
- package/node_modules/zod/dist/esm/v4/locales/kh.js +117 -0
- package/node_modules/zod/dist/esm/v4/locales/ko.js +121 -0
- package/node_modules/zod/dist/esm/v4/locales/mk.js +118 -0
- package/node_modules/zod/dist/esm/v4/locales/ms.js +116 -0
- package/node_modules/zod/dist/esm/v4/locales/nl.js +117 -0
- package/node_modules/zod/dist/esm/v4/locales/no.js +116 -0
- package/node_modules/zod/dist/esm/v4/locales/ota.js +117 -0
- package/node_modules/zod/dist/esm/v4/locales/pl.js +117 -0
- package/node_modules/zod/dist/esm/v4/locales/ps.js +122 -0
- package/node_modules/zod/dist/esm/v4/locales/pt.js +116 -0
- package/node_modules/zod/dist/esm/v4/locales/ru.js +164 -0
- package/node_modules/zod/dist/esm/v4/locales/sl.js +117 -0
- package/node_modules/zod/dist/esm/v4/locales/sv.js +118 -0
- package/node_modules/zod/dist/esm/v4/locales/ta.js +117 -0
- package/node_modules/zod/dist/esm/v4/locales/th.js +117 -0
- package/node_modules/zod/dist/esm/v4/locales/tr.js +115 -0
- package/node_modules/zod/dist/esm/v4/locales/ua.js +117 -0
- package/node_modules/zod/dist/esm/v4/locales/ur.js +117 -0
- package/node_modules/zod/dist/esm/v4/locales/vi.js +116 -0
- package/node_modules/zod/dist/esm/v4/locales/zh-CN.js +116 -0
- package/node_modules/zod/dist/esm/v4/locales/zh-TW.js +117 -0
- package/node_modules/zod/dist/esm/v4/mini/checks.js +1 -0
- package/node_modules/zod/dist/esm/v4/mini/coerce.js +17 -0
- package/node_modules/zod/dist/esm/v4/mini/external.js +13 -0
- package/node_modules/zod/dist/esm/v4/mini/index.js +3 -0
- package/node_modules/zod/dist/esm/v4/mini/iso.js +30 -0
- package/node_modules/zod/dist/esm/v4/mini/parse.js +1 -0
- package/node_modules/zod/dist/esm/v4/mini/schemas.js +725 -0
- package/node_modules/zod/dist/types/index.d.ts +3 -0
- package/node_modules/zod/dist/types/package.json +3 -0
- package/node_modules/zod/{lib → dist/types/v3}/ZodError.d.ts +7 -7
- package/node_modules/zod/dist/types/v3/benchmarks/index.d.ts +1 -0
- package/node_modules/zod/{lib → dist/types/v3}/errors.d.ts +2 -2
- package/node_modules/zod/dist/types/v3/external.d.ts +6 -0
- package/node_modules/zod/{lib → dist/types/v3}/helpers/errorUtil.d.ts +1 -1
- package/node_modules/zod/{lib → dist/types/v3}/helpers/parseUtil.d.ts +4 -4
- package/node_modules/zod/{lib → dist/types/v3}/helpers/partialUtil.d.ts +1 -1
- package/node_modules/zod/{lib → dist/types/v3}/helpers/util.d.ts +14 -11
- package/node_modules/zod/dist/types/v3/index.d.ts +4 -0
- package/node_modules/zod/{lib → dist/types/v3}/locales/en.d.ts +1 -1
- package/node_modules/zod/{lib/__tests__ → dist/types/v3/tests}/Mocker.d.ts +6 -6
- package/node_modules/zod/{lib → dist/types/v3}/types.d.ts +120 -151
- package/node_modules/zod/dist/types/v4/classic/checks.d.ts +1 -0
- package/node_modules/zod/dist/types/v4/classic/coerce.d.ts +17 -0
- package/node_modules/zod/dist/types/v4/classic/compat.d.ts +48 -0
- package/node_modules/zod/dist/types/v4/classic/errors.d.ts +30 -0
- package/node_modules/zod/dist/types/v4/classic/external.d.ts +13 -0
- package/node_modules/zod/dist/types/v4/classic/index.d.ts +4 -0
- package/node_modules/zod/dist/types/v4/classic/iso.d.ts +22 -0
- package/node_modules/zod/dist/types/v4/classic/parse.d.ts +23 -0
- package/node_modules/zod/dist/types/v4/classic/schemas.d.ts +624 -0
- package/node_modules/zod/dist/types/v4/core/api.d.ts +281 -0
- package/node_modules/zod/dist/types/v4/core/checks.d.ts +277 -0
- package/node_modules/zod/dist/types/v4/core/config.d.ts +9 -0
- package/node_modules/zod/dist/types/v4/core/core.d.ts +47 -0
- package/node_modules/zod/dist/types/v4/core/doc.d.ts +14 -0
- package/node_modules/zod/dist/types/v4/core/errors.d.ts +204 -0
- package/node_modules/zod/dist/types/v4/core/function.d.ts +52 -0
- package/node_modules/zod/dist/types/v4/core/index.d.ts +15 -0
- package/node_modules/zod/dist/types/v4/core/json-schema.d.ts +87 -0
- package/node_modules/zod/dist/types/v4/core/parse.d.ts +25 -0
- package/node_modules/zod/dist/types/v4/core/regexes.d.ts +62 -0
- package/node_modules/zod/dist/types/v4/core/registries.d.ts +39 -0
- package/node_modules/zod/dist/types/v4/core/schemas.d.ts +1005 -0
- package/node_modules/zod/dist/types/v4/core/standard-schema.d.ts +55 -0
- package/node_modules/zod/dist/types/v4/core/to-json-schema.d.ts +84 -0
- package/node_modules/zod/dist/types/v4/core/util.d.ts +183 -0
- package/node_modules/zod/dist/types/v4/core/versions.d.ts +5 -0
- package/node_modules/zod/dist/types/v4/core/zsf.d.ts +91 -0
- package/node_modules/zod/dist/types/v4/index.d.ts +3 -0
- package/node_modules/zod/dist/types/v4/locales/ar.d.ts +4 -0
- package/node_modules/zod/dist/types/v4/locales/az.d.ts +4 -0
- package/node_modules/zod/dist/types/v4/locales/be.d.ts +4 -0
- package/node_modules/zod/dist/types/v4/locales/ca.d.ts +4 -0
- package/node_modules/zod/dist/types/v4/locales/cs.d.ts +4 -0
- package/node_modules/zod/dist/types/v4/locales/de.d.ts +4 -0
- package/node_modules/zod/dist/types/v4/locales/en.d.ts +5 -0
- package/node_modules/zod/dist/types/v4/locales/es.d.ts +4 -0
- package/node_modules/zod/dist/types/v4/locales/fa.d.ts +4 -0
- package/node_modules/zod/dist/types/v4/locales/fi.d.ts +4 -0
- package/node_modules/zod/dist/types/v4/locales/fr-CA.d.ts +4 -0
- package/node_modules/zod/dist/types/v4/locales/fr.d.ts +4 -0
- package/node_modules/zod/dist/types/v4/locales/he.d.ts +4 -0
- package/node_modules/zod/dist/types/v4/locales/hu.d.ts +4 -0
- package/node_modules/zod/dist/types/v4/locales/id.d.ts +4 -0
- package/node_modules/zod/dist/types/v4/locales/index.d.ts +38 -0
- package/node_modules/zod/dist/types/v4/locales/it.d.ts +4 -0
- package/node_modules/zod/dist/types/v4/locales/ja.d.ts +4 -0
- package/node_modules/zod/dist/types/v4/locales/kh.d.ts +4 -0
- package/node_modules/zod/dist/types/v4/locales/ko.d.ts +4 -0
- package/node_modules/zod/dist/types/v4/locales/mk.d.ts +4 -0
- package/node_modules/zod/dist/types/v4/locales/ms.d.ts +4 -0
- package/node_modules/zod/dist/types/v4/locales/nl.d.ts +4 -0
- package/node_modules/zod/dist/types/v4/locales/no.d.ts +4 -0
- package/node_modules/zod/dist/types/v4/locales/ota.d.ts +4 -0
- package/node_modules/zod/dist/types/v4/locales/pl.d.ts +4 -0
- package/node_modules/zod/dist/types/v4/locales/ps.d.ts +4 -0
- package/node_modules/zod/dist/types/v4/locales/pt.d.ts +4 -0
- package/node_modules/zod/dist/types/v4/locales/ru.d.ts +4 -0
- package/node_modules/zod/dist/types/v4/locales/sl.d.ts +4 -0
- package/node_modules/zod/dist/types/v4/locales/sv.d.ts +4 -0
- package/node_modules/zod/dist/types/v4/locales/ta.d.ts +4 -0
- package/node_modules/zod/dist/types/v4/locales/th.d.ts +4 -0
- package/node_modules/zod/dist/types/v4/locales/tr.d.ts +5 -0
- package/node_modules/zod/dist/types/v4/locales/ua.d.ts +4 -0
- package/node_modules/zod/dist/types/v4/locales/ur.d.ts +4 -0
- package/node_modules/zod/dist/types/v4/locales/vi.d.ts +4 -0
- package/node_modules/zod/dist/types/v4/locales/zh-CN.d.ts +4 -0
- package/node_modules/zod/dist/types/v4/locales/zh-TW.d.ts +4 -0
- package/node_modules/zod/dist/types/v4/mini/checks.d.ts +1 -0
- package/node_modules/zod/dist/types/v4/mini/coerce.d.ts +7 -0
- package/node_modules/zod/dist/types/v4/mini/external.d.ts +11 -0
- package/node_modules/zod/dist/types/v4/mini/index.d.ts +3 -0
- package/node_modules/zod/dist/types/v4/mini/iso.d.ts +22 -0
- package/node_modules/zod/dist/types/v4/mini/parse.d.ts +1 -0
- package/node_modules/zod/dist/types/v4/mini/schemas.d.ts +351 -0
- package/node_modules/zod/package.json +105 -107
- package/node_modules/zod/v3/index.d.ts +3 -0
- package/node_modules/zod/v3/index.js +1 -0
- package/node_modules/zod/v4/core/index.d.ts +1 -0
- package/node_modules/zod/v4/core/index.js +1 -0
- package/node_modules/zod/v4/index.d.ts +3 -0
- package/node_modules/zod/v4/index.js +1 -0
- package/node_modules/zod/v4/locales/en.d.ts +2 -0
- package/node_modules/zod/v4/locales/en.js +2 -0
- package/node_modules/zod/v4/locales/index.d.ts +1 -0
- package/node_modules/zod/v4/locales/index.js +1 -0
- package/node_modules/zod/v4-mini/index.d.ts +1 -0
- package/node_modules/zod/v4-mini/index.js +1 -0
- package/package.json +16 -16
- package/node_modules/zod/index.d.ts +0 -2
- package/node_modules/zod/lib/benchmarks/index.js +0 -59
- package/node_modules/zod/lib/external.d.ts +0 -6
- package/node_modules/zod/lib/index.d.ts +0 -4
- package/node_modules/zod/lib/index.umd.js +0 -4520
- /package/node_modules/zod/{lib → dist/cjs/v3}/benchmarks/ipv4.js +0 -0
- /package/node_modules/zod/{lib → dist/cjs/v3}/helpers/enumUtil.js +0 -0
- /package/node_modules/zod/{lib → dist/cjs/v3}/helpers/partialUtil.js +0 -0
- /package/node_modules/zod/{lib → dist/cjs/v3}/helpers/typeAliases.js +0 -0
- /package/node_modules/zod/{lib → dist/cjs/v3}/standard-schema.js +0 -0
- /package/node_modules/zod/{lib/__tests__ → dist/cjs/v3/tests}/Mocker.js +0 -0
- /package/node_modules/zod/{lib/benchmarks/index.d.ts → dist/esm/v3/helpers/enumUtil.js} +0 -0
- /package/node_modules/zod/{lib → dist/types/v3}/benchmarks/datetime.d.ts +0 -0
- /package/node_modules/zod/{lib → dist/types/v3}/benchmarks/discriminatedUnion.d.ts +0 -0
- /package/node_modules/zod/{lib → dist/types/v3}/benchmarks/ipv4.d.ts +0 -0
- /package/node_modules/zod/{lib → dist/types/v3}/benchmarks/object.d.ts +0 -0
- /package/node_modules/zod/{lib → dist/types/v3}/benchmarks/primitives.d.ts +0 -0
- /package/node_modules/zod/{lib → dist/types/v3}/benchmarks/realworld.d.ts +0 -0
- /package/node_modules/zod/{lib → dist/types/v3}/benchmarks/string.d.ts +0 -0
- /package/node_modules/zod/{lib → dist/types/v3}/benchmarks/union.d.ts +0 -0
- /package/node_modules/zod/{lib → dist/types/v3}/helpers/enumUtil.d.ts +0 -0
- /package/node_modules/zod/{lib → dist/types/v3}/helpers/typeAliases.d.ts +0 -0
- /package/node_modules/zod/{lib → dist/types/v3}/standard-schema.d.ts +0 -0
|
@@ -1,556 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
function assertNever(_x) {
|
|
7
|
-
throw new Error();
|
|
8
|
-
}
|
|
9
|
-
util.assertNever = assertNever;
|
|
10
|
-
util.arrayToEnum = (items) => {
|
|
11
|
-
const obj = {};
|
|
12
|
-
for (const item of items) {
|
|
13
|
-
obj[item] = item;
|
|
14
|
-
}
|
|
15
|
-
return obj;
|
|
16
|
-
};
|
|
17
|
-
util.getValidEnumValues = (obj) => {
|
|
18
|
-
const validKeys = util.objectKeys(obj).filter((k) => typeof obj[obj[k]] !== "number");
|
|
19
|
-
const filtered = {};
|
|
20
|
-
for (const k of validKeys) {
|
|
21
|
-
filtered[k] = obj[k];
|
|
22
|
-
}
|
|
23
|
-
return util.objectValues(filtered);
|
|
24
|
-
};
|
|
25
|
-
util.objectValues = (obj) => {
|
|
26
|
-
return util.objectKeys(obj).map(function (e) {
|
|
27
|
-
return obj[e];
|
|
28
|
-
});
|
|
29
|
-
};
|
|
30
|
-
util.objectKeys = typeof Object.keys === "function" // eslint-disable-line ban/ban
|
|
31
|
-
? (obj) => Object.keys(obj) // eslint-disable-line ban/ban
|
|
32
|
-
: (object) => {
|
|
33
|
-
const keys = [];
|
|
34
|
-
for (const key in object) {
|
|
35
|
-
if (Object.prototype.hasOwnProperty.call(object, key)) {
|
|
36
|
-
keys.push(key);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
return keys;
|
|
40
|
-
};
|
|
41
|
-
util.find = (arr, checker) => {
|
|
42
|
-
for (const item of arr) {
|
|
43
|
-
if (checker(item))
|
|
44
|
-
return item;
|
|
45
|
-
}
|
|
46
|
-
return undefined;
|
|
47
|
-
};
|
|
48
|
-
util.isInteger = typeof Number.isInteger === "function"
|
|
49
|
-
? (val) => Number.isInteger(val) // eslint-disable-line ban/ban
|
|
50
|
-
: (val) => typeof val === "number" && isFinite(val) && Math.floor(val) === val;
|
|
51
|
-
function joinValues(array, separator = " | ") {
|
|
52
|
-
return array
|
|
53
|
-
.map((val) => (typeof val === "string" ? `'${val}'` : val))
|
|
54
|
-
.join(separator);
|
|
55
|
-
}
|
|
56
|
-
util.joinValues = joinValues;
|
|
57
|
-
util.jsonStringifyReplacer = (_, value) => {
|
|
58
|
-
if (typeof value === "bigint") {
|
|
59
|
-
return value.toString();
|
|
60
|
-
}
|
|
61
|
-
return value;
|
|
62
|
-
};
|
|
63
|
-
})(util || (util = {}));
|
|
64
|
-
var objectUtil;
|
|
65
|
-
(function (objectUtil) {
|
|
66
|
-
objectUtil.mergeShapes = (first, second) => {
|
|
67
|
-
return {
|
|
68
|
-
...first,
|
|
69
|
-
...second, // second overwrites first
|
|
70
|
-
};
|
|
71
|
-
};
|
|
72
|
-
})(objectUtil || (objectUtil = {}));
|
|
73
|
-
const ZodParsedType = util.arrayToEnum([
|
|
74
|
-
"string",
|
|
75
|
-
"nan",
|
|
76
|
-
"number",
|
|
77
|
-
"integer",
|
|
78
|
-
"float",
|
|
79
|
-
"boolean",
|
|
80
|
-
"date",
|
|
81
|
-
"bigint",
|
|
82
|
-
"symbol",
|
|
83
|
-
"function",
|
|
84
|
-
"undefined",
|
|
85
|
-
"null",
|
|
86
|
-
"array",
|
|
87
|
-
"object",
|
|
88
|
-
"unknown",
|
|
89
|
-
"promise",
|
|
90
|
-
"void",
|
|
91
|
-
"never",
|
|
92
|
-
"map",
|
|
93
|
-
"set",
|
|
94
|
-
]);
|
|
95
|
-
const getParsedType = (data) => {
|
|
96
|
-
const t = typeof data;
|
|
97
|
-
switch (t) {
|
|
98
|
-
case "undefined":
|
|
99
|
-
return ZodParsedType.undefined;
|
|
100
|
-
case "string":
|
|
101
|
-
return ZodParsedType.string;
|
|
102
|
-
case "number":
|
|
103
|
-
return isNaN(data) ? ZodParsedType.nan : ZodParsedType.number;
|
|
104
|
-
case "boolean":
|
|
105
|
-
return ZodParsedType.boolean;
|
|
106
|
-
case "function":
|
|
107
|
-
return ZodParsedType.function;
|
|
108
|
-
case "bigint":
|
|
109
|
-
return ZodParsedType.bigint;
|
|
110
|
-
case "symbol":
|
|
111
|
-
return ZodParsedType.symbol;
|
|
112
|
-
case "object":
|
|
113
|
-
if (Array.isArray(data)) {
|
|
114
|
-
return ZodParsedType.array;
|
|
115
|
-
}
|
|
116
|
-
if (data === null) {
|
|
117
|
-
return ZodParsedType.null;
|
|
118
|
-
}
|
|
119
|
-
if (data.then &&
|
|
120
|
-
typeof data.then === "function" &&
|
|
121
|
-
data.catch &&
|
|
122
|
-
typeof data.catch === "function") {
|
|
123
|
-
return ZodParsedType.promise;
|
|
124
|
-
}
|
|
125
|
-
if (typeof Map !== "undefined" && data instanceof Map) {
|
|
126
|
-
return ZodParsedType.map;
|
|
127
|
-
}
|
|
128
|
-
if (typeof Set !== "undefined" && data instanceof Set) {
|
|
129
|
-
return ZodParsedType.set;
|
|
130
|
-
}
|
|
131
|
-
if (typeof Date !== "undefined" && data instanceof Date) {
|
|
132
|
-
return ZodParsedType.date;
|
|
133
|
-
}
|
|
134
|
-
return ZodParsedType.object;
|
|
135
|
-
default:
|
|
136
|
-
return ZodParsedType.unknown;
|
|
137
|
-
}
|
|
138
|
-
};
|
|
139
|
-
|
|
140
|
-
const ZodIssueCode = util.arrayToEnum([
|
|
141
|
-
"invalid_type",
|
|
142
|
-
"invalid_literal",
|
|
143
|
-
"custom",
|
|
144
|
-
"invalid_union",
|
|
145
|
-
"invalid_union_discriminator",
|
|
146
|
-
"invalid_enum_value",
|
|
147
|
-
"unrecognized_keys",
|
|
148
|
-
"invalid_arguments",
|
|
149
|
-
"invalid_return_type",
|
|
150
|
-
"invalid_date",
|
|
151
|
-
"invalid_string",
|
|
152
|
-
"too_small",
|
|
153
|
-
"too_big",
|
|
154
|
-
"invalid_intersection_types",
|
|
155
|
-
"not_multiple_of",
|
|
156
|
-
"not_finite",
|
|
157
|
-
]);
|
|
158
|
-
const quotelessJson = (obj) => {
|
|
159
|
-
const json = JSON.stringify(obj, null, 2);
|
|
160
|
-
return json.replace(/"([^"]+)":/g, "$1:");
|
|
161
|
-
};
|
|
162
|
-
class ZodError extends Error {
|
|
163
|
-
get errors() {
|
|
164
|
-
return this.issues;
|
|
165
|
-
}
|
|
166
|
-
constructor(issues) {
|
|
167
|
-
super();
|
|
168
|
-
this.issues = [];
|
|
169
|
-
this.addIssue = (sub) => {
|
|
170
|
-
this.issues = [...this.issues, sub];
|
|
171
|
-
};
|
|
172
|
-
this.addIssues = (subs = []) => {
|
|
173
|
-
this.issues = [...this.issues, ...subs];
|
|
174
|
-
};
|
|
175
|
-
const actualProto = new.target.prototype;
|
|
176
|
-
if (Object.setPrototypeOf) {
|
|
177
|
-
// eslint-disable-next-line ban/ban
|
|
178
|
-
Object.setPrototypeOf(this, actualProto);
|
|
179
|
-
}
|
|
180
|
-
else {
|
|
181
|
-
this.__proto__ = actualProto;
|
|
182
|
-
}
|
|
183
|
-
this.name = "ZodError";
|
|
184
|
-
this.issues = issues;
|
|
185
|
-
}
|
|
186
|
-
format(_mapper) {
|
|
187
|
-
const mapper = _mapper ||
|
|
188
|
-
function (issue) {
|
|
189
|
-
return issue.message;
|
|
190
|
-
};
|
|
191
|
-
const fieldErrors = { _errors: [] };
|
|
192
|
-
const processError = (error) => {
|
|
193
|
-
for (const issue of error.issues) {
|
|
194
|
-
if (issue.code === "invalid_union") {
|
|
195
|
-
issue.unionErrors.map(processError);
|
|
196
|
-
}
|
|
197
|
-
else if (issue.code === "invalid_return_type") {
|
|
198
|
-
processError(issue.returnTypeError);
|
|
199
|
-
}
|
|
200
|
-
else if (issue.code === "invalid_arguments") {
|
|
201
|
-
processError(issue.argumentsError);
|
|
202
|
-
}
|
|
203
|
-
else if (issue.path.length === 0) {
|
|
204
|
-
fieldErrors._errors.push(mapper(issue));
|
|
205
|
-
}
|
|
206
|
-
else {
|
|
207
|
-
let curr = fieldErrors;
|
|
208
|
-
let i = 0;
|
|
209
|
-
while (i < issue.path.length) {
|
|
210
|
-
const el = issue.path[i];
|
|
211
|
-
const terminal = i === issue.path.length - 1;
|
|
212
|
-
if (!terminal) {
|
|
213
|
-
curr[el] = curr[el] || { _errors: [] };
|
|
214
|
-
// if (typeof el === "string") {
|
|
215
|
-
// curr[el] = curr[el] || { _errors: [] };
|
|
216
|
-
// } else if (typeof el === "number") {
|
|
217
|
-
// const errorArray: any = [];
|
|
218
|
-
// errorArray._errors = [];
|
|
219
|
-
// curr[el] = curr[el] || errorArray;
|
|
220
|
-
// }
|
|
221
|
-
}
|
|
222
|
-
else {
|
|
223
|
-
curr[el] = curr[el] || { _errors: [] };
|
|
224
|
-
curr[el]._errors.push(mapper(issue));
|
|
225
|
-
}
|
|
226
|
-
curr = curr[el];
|
|
227
|
-
i++;
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
};
|
|
232
|
-
processError(this);
|
|
233
|
-
return fieldErrors;
|
|
234
|
-
}
|
|
235
|
-
static assert(value) {
|
|
236
|
-
if (!(value instanceof ZodError)) {
|
|
237
|
-
throw new Error(`Not a ZodError: ${value}`);
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
toString() {
|
|
241
|
-
return this.message;
|
|
242
|
-
}
|
|
243
|
-
get message() {
|
|
244
|
-
return JSON.stringify(this.issues, util.jsonStringifyReplacer, 2);
|
|
245
|
-
}
|
|
246
|
-
get isEmpty() {
|
|
247
|
-
return this.issues.length === 0;
|
|
248
|
-
}
|
|
249
|
-
flatten(mapper = (issue) => issue.message) {
|
|
250
|
-
const fieldErrors = {};
|
|
251
|
-
const formErrors = [];
|
|
252
|
-
for (const sub of this.issues) {
|
|
253
|
-
if (sub.path.length > 0) {
|
|
254
|
-
fieldErrors[sub.path[0]] = fieldErrors[sub.path[0]] || [];
|
|
255
|
-
fieldErrors[sub.path[0]].push(mapper(sub));
|
|
256
|
-
}
|
|
257
|
-
else {
|
|
258
|
-
formErrors.push(mapper(sub));
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
return { formErrors, fieldErrors };
|
|
262
|
-
}
|
|
263
|
-
get formErrors() {
|
|
264
|
-
return this.flatten();
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
ZodError.create = (issues) => {
|
|
268
|
-
const error = new ZodError(issues);
|
|
269
|
-
return error;
|
|
270
|
-
};
|
|
271
|
-
|
|
272
|
-
const errorMap = (issue, _ctx) => {
|
|
273
|
-
let message;
|
|
274
|
-
switch (issue.code) {
|
|
275
|
-
case ZodIssueCode.invalid_type:
|
|
276
|
-
if (issue.received === ZodParsedType.undefined) {
|
|
277
|
-
message = "Required";
|
|
278
|
-
}
|
|
279
|
-
else {
|
|
280
|
-
message = `Expected ${issue.expected}, received ${issue.received}`;
|
|
281
|
-
}
|
|
282
|
-
break;
|
|
283
|
-
case ZodIssueCode.invalid_literal:
|
|
284
|
-
message = `Invalid literal value, expected ${JSON.stringify(issue.expected, util.jsonStringifyReplacer)}`;
|
|
285
|
-
break;
|
|
286
|
-
case ZodIssueCode.unrecognized_keys:
|
|
287
|
-
message = `Unrecognized key(s) in object: ${util.joinValues(issue.keys, ", ")}`;
|
|
288
|
-
break;
|
|
289
|
-
case ZodIssueCode.invalid_union:
|
|
290
|
-
message = `Invalid input`;
|
|
291
|
-
break;
|
|
292
|
-
case ZodIssueCode.invalid_union_discriminator:
|
|
293
|
-
message = `Invalid discriminator value. Expected ${util.joinValues(issue.options)}`;
|
|
294
|
-
break;
|
|
295
|
-
case ZodIssueCode.invalid_enum_value:
|
|
296
|
-
message = `Invalid enum value. Expected ${util.joinValues(issue.options)}, received '${issue.received}'`;
|
|
297
|
-
break;
|
|
298
|
-
case ZodIssueCode.invalid_arguments:
|
|
299
|
-
message = `Invalid function arguments`;
|
|
300
|
-
break;
|
|
301
|
-
case ZodIssueCode.invalid_return_type:
|
|
302
|
-
message = `Invalid function return type`;
|
|
303
|
-
break;
|
|
304
|
-
case ZodIssueCode.invalid_date:
|
|
305
|
-
message = `Invalid date`;
|
|
306
|
-
break;
|
|
307
|
-
case ZodIssueCode.invalid_string:
|
|
308
|
-
if (typeof issue.validation === "object") {
|
|
309
|
-
if ("includes" in issue.validation) {
|
|
310
|
-
message = `Invalid input: must include "${issue.validation.includes}"`;
|
|
311
|
-
if (typeof issue.validation.position === "number") {
|
|
312
|
-
message = `${message} at one or more positions greater than or equal to ${issue.validation.position}`;
|
|
313
|
-
}
|
|
314
|
-
}
|
|
315
|
-
else if ("startsWith" in issue.validation) {
|
|
316
|
-
message = `Invalid input: must start with "${issue.validation.startsWith}"`;
|
|
317
|
-
}
|
|
318
|
-
else if ("endsWith" in issue.validation) {
|
|
319
|
-
message = `Invalid input: must end with "${issue.validation.endsWith}"`;
|
|
320
|
-
}
|
|
321
|
-
else {
|
|
322
|
-
util.assertNever(issue.validation);
|
|
323
|
-
}
|
|
324
|
-
}
|
|
325
|
-
else if (issue.validation !== "regex") {
|
|
326
|
-
message = `Invalid ${issue.validation}`;
|
|
327
|
-
}
|
|
328
|
-
else {
|
|
329
|
-
message = "Invalid";
|
|
330
|
-
}
|
|
331
|
-
break;
|
|
332
|
-
case ZodIssueCode.too_small:
|
|
333
|
-
if (issue.type === "array")
|
|
334
|
-
message = `Array must contain ${issue.exact ? "exactly" : issue.inclusive ? `at least` : `more than`} ${issue.minimum} element(s)`;
|
|
335
|
-
else if (issue.type === "string")
|
|
336
|
-
message = `String must contain ${issue.exact ? "exactly" : issue.inclusive ? `at least` : `over`} ${issue.minimum} character(s)`;
|
|
337
|
-
else if (issue.type === "number")
|
|
338
|
-
message = `Number must be ${issue.exact
|
|
339
|
-
? `exactly equal to `
|
|
340
|
-
: issue.inclusive
|
|
341
|
-
? `greater than or equal to `
|
|
342
|
-
: `greater than `}${issue.minimum}`;
|
|
343
|
-
else if (issue.type === "date")
|
|
344
|
-
message = `Date must be ${issue.exact
|
|
345
|
-
? `exactly equal to `
|
|
346
|
-
: issue.inclusive
|
|
347
|
-
? `greater than or equal to `
|
|
348
|
-
: `greater than `}${new Date(Number(issue.minimum))}`;
|
|
349
|
-
else
|
|
350
|
-
message = "Invalid input";
|
|
351
|
-
break;
|
|
352
|
-
case ZodIssueCode.too_big:
|
|
353
|
-
if (issue.type === "array")
|
|
354
|
-
message = `Array must contain ${issue.exact ? `exactly` : issue.inclusive ? `at most` : `less than`} ${issue.maximum} element(s)`;
|
|
355
|
-
else if (issue.type === "string")
|
|
356
|
-
message = `String must contain ${issue.exact ? `exactly` : issue.inclusive ? `at most` : `under`} ${issue.maximum} character(s)`;
|
|
357
|
-
else if (issue.type === "number")
|
|
358
|
-
message = `Number must be ${issue.exact
|
|
359
|
-
? `exactly`
|
|
360
|
-
: issue.inclusive
|
|
361
|
-
? `less than or equal to`
|
|
362
|
-
: `less than`} ${issue.maximum}`;
|
|
363
|
-
else if (issue.type === "bigint")
|
|
364
|
-
message = `BigInt must be ${issue.exact
|
|
365
|
-
? `exactly`
|
|
366
|
-
: issue.inclusive
|
|
367
|
-
? `less than or equal to`
|
|
368
|
-
: `less than`} ${issue.maximum}`;
|
|
369
|
-
else if (issue.type === "date")
|
|
370
|
-
message = `Date must be ${issue.exact
|
|
371
|
-
? `exactly`
|
|
372
|
-
: issue.inclusive
|
|
373
|
-
? `smaller than or equal to`
|
|
374
|
-
: `smaller than`} ${new Date(Number(issue.maximum))}`;
|
|
375
|
-
else
|
|
376
|
-
message = "Invalid input";
|
|
377
|
-
break;
|
|
378
|
-
case ZodIssueCode.custom:
|
|
379
|
-
message = `Invalid input`;
|
|
380
|
-
break;
|
|
381
|
-
case ZodIssueCode.invalid_intersection_types:
|
|
382
|
-
message = `Intersection results could not be merged`;
|
|
383
|
-
break;
|
|
384
|
-
case ZodIssueCode.not_multiple_of:
|
|
385
|
-
message = `Number must be a multiple of ${issue.multipleOf}`;
|
|
386
|
-
break;
|
|
387
|
-
case ZodIssueCode.not_finite:
|
|
388
|
-
message = "Number must be finite";
|
|
389
|
-
break;
|
|
390
|
-
default:
|
|
391
|
-
message = _ctx.defaultError;
|
|
392
|
-
util.assertNever(issue);
|
|
393
|
-
}
|
|
394
|
-
return { message };
|
|
395
|
-
};
|
|
396
|
-
|
|
397
|
-
let overrideErrorMap = errorMap;
|
|
398
|
-
function setErrorMap(map) {
|
|
399
|
-
overrideErrorMap = map;
|
|
400
|
-
}
|
|
401
|
-
function getErrorMap() {
|
|
402
|
-
return overrideErrorMap;
|
|
403
|
-
}
|
|
404
|
-
|
|
405
|
-
const makeIssue = (params) => {
|
|
406
|
-
const { data, path, errorMaps, issueData } = params;
|
|
407
|
-
const fullPath = [...path, ...(issueData.path || [])];
|
|
408
|
-
const fullIssue = {
|
|
409
|
-
...issueData,
|
|
410
|
-
path: fullPath,
|
|
411
|
-
};
|
|
412
|
-
if (issueData.message !== undefined) {
|
|
413
|
-
return {
|
|
414
|
-
...issueData,
|
|
415
|
-
path: fullPath,
|
|
416
|
-
message: issueData.message,
|
|
417
|
-
};
|
|
418
|
-
}
|
|
419
|
-
let errorMessage = "";
|
|
420
|
-
const maps = errorMaps
|
|
421
|
-
.filter((m) => !!m)
|
|
422
|
-
.slice()
|
|
423
|
-
.reverse();
|
|
424
|
-
for (const map of maps) {
|
|
425
|
-
errorMessage = map(fullIssue, { data, defaultError: errorMessage }).message;
|
|
426
|
-
}
|
|
427
|
-
return {
|
|
428
|
-
...issueData,
|
|
429
|
-
path: fullPath,
|
|
430
|
-
message: errorMessage,
|
|
431
|
-
};
|
|
432
|
-
};
|
|
433
|
-
const EMPTY_PATH = [];
|
|
434
|
-
function addIssueToContext(ctx, issueData) {
|
|
435
|
-
const overrideMap = getErrorMap();
|
|
436
|
-
const issue = makeIssue({
|
|
437
|
-
issueData: issueData,
|
|
438
|
-
data: ctx.data,
|
|
439
|
-
path: ctx.path,
|
|
440
|
-
errorMaps: [
|
|
441
|
-
ctx.common.contextualErrorMap, // contextual error map is first priority
|
|
442
|
-
ctx.schemaErrorMap, // then schema-bound map if available
|
|
443
|
-
overrideMap, // then global override map
|
|
444
|
-
overrideMap === errorMap ? undefined : errorMap, // then global default map
|
|
445
|
-
].filter((x) => !!x),
|
|
446
|
-
});
|
|
447
|
-
ctx.common.issues.push(issue);
|
|
448
|
-
}
|
|
449
|
-
class ParseStatus {
|
|
450
|
-
constructor() {
|
|
451
|
-
this.value = "valid";
|
|
452
|
-
}
|
|
453
|
-
dirty() {
|
|
454
|
-
if (this.value === "valid")
|
|
455
|
-
this.value = "dirty";
|
|
456
|
-
}
|
|
457
|
-
abort() {
|
|
458
|
-
if (this.value !== "aborted")
|
|
459
|
-
this.value = "aborted";
|
|
460
|
-
}
|
|
461
|
-
static mergeArray(status, results) {
|
|
462
|
-
const arrayValue = [];
|
|
463
|
-
for (const s of results) {
|
|
464
|
-
if (s.status === "aborted")
|
|
465
|
-
return INVALID;
|
|
466
|
-
if (s.status === "dirty")
|
|
467
|
-
status.dirty();
|
|
468
|
-
arrayValue.push(s.value);
|
|
469
|
-
}
|
|
470
|
-
return { status: status.value, value: arrayValue };
|
|
471
|
-
}
|
|
472
|
-
static async mergeObjectAsync(status, pairs) {
|
|
473
|
-
const syncPairs = [];
|
|
474
|
-
for (const pair of pairs) {
|
|
475
|
-
const key = await pair.key;
|
|
476
|
-
const value = await pair.value;
|
|
477
|
-
syncPairs.push({
|
|
478
|
-
key,
|
|
479
|
-
value,
|
|
480
|
-
});
|
|
481
|
-
}
|
|
482
|
-
return ParseStatus.mergeObjectSync(status, syncPairs);
|
|
483
|
-
}
|
|
484
|
-
static mergeObjectSync(status, pairs) {
|
|
485
|
-
const finalObject = {};
|
|
486
|
-
for (const pair of pairs) {
|
|
487
|
-
const { key, value } = pair;
|
|
488
|
-
if (key.status === "aborted")
|
|
489
|
-
return INVALID;
|
|
490
|
-
if (value.status === "aborted")
|
|
491
|
-
return INVALID;
|
|
492
|
-
if (key.status === "dirty")
|
|
493
|
-
status.dirty();
|
|
494
|
-
if (value.status === "dirty")
|
|
495
|
-
status.dirty();
|
|
496
|
-
if (key.value !== "__proto__" &&
|
|
497
|
-
(typeof value.value !== "undefined" || pair.alwaysSet)) {
|
|
498
|
-
finalObject[key.value] = value.value;
|
|
499
|
-
}
|
|
500
|
-
}
|
|
501
|
-
return { status: status.value, value: finalObject };
|
|
502
|
-
}
|
|
503
|
-
}
|
|
504
|
-
const INVALID = Object.freeze({
|
|
505
|
-
status: "aborted",
|
|
506
|
-
});
|
|
507
|
-
const DIRTY = (value) => ({ status: "dirty", value });
|
|
508
|
-
const OK = (value) => ({ status: "valid", value });
|
|
509
|
-
const isAborted = (x) => x.status === "aborted";
|
|
510
|
-
const isDirty = (x) => x.status === "dirty";
|
|
511
|
-
const isValid = (x) => x.status === "valid";
|
|
512
|
-
const isAsync = (x) => typeof Promise !== "undefined" && x instanceof Promise;
|
|
513
|
-
|
|
514
|
-
/******************************************************************************
|
|
515
|
-
Copyright (c) Microsoft Corporation.
|
|
516
|
-
|
|
517
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
518
|
-
purpose with or without fee is hereby granted.
|
|
519
|
-
|
|
520
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
521
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
522
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
523
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
524
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
525
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
526
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
527
|
-
***************************************************************************** */
|
|
528
|
-
|
|
529
|
-
function __classPrivateFieldGet(receiver, state, kind, f) {
|
|
530
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
531
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
532
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
533
|
-
}
|
|
534
|
-
|
|
535
|
-
function __classPrivateFieldSet(receiver, state, value, kind, f) {
|
|
536
|
-
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
537
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
538
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
539
|
-
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
540
|
-
}
|
|
541
|
-
|
|
542
|
-
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
543
|
-
var e = new Error(message);
|
|
544
|
-
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
545
|
-
};
|
|
546
|
-
|
|
547
|
-
var errorUtil;
|
|
548
|
-
(function (errorUtil) {
|
|
549
|
-
errorUtil.errToObj = (message) => typeof message === "string" ? { message } : message || {};
|
|
550
|
-
errorUtil.toString = (message) => typeof message === "string" ? message : message === null || message === void 0 ? void 0 : message.message;
|
|
551
|
-
})(errorUtil || (errorUtil = {}));
|
|
552
|
-
|
|
553
|
-
var _ZodEnum_cache, _ZodNativeEnum_cache;
|
|
1
|
+
import { ZodError, ZodIssueCode, } from "./ZodError.js";
|
|
2
|
+
import { defaultErrorMap, getErrorMap } from "./errors.js";
|
|
3
|
+
import { errorUtil } from "./helpers/errorUtil.js";
|
|
4
|
+
import { DIRTY, INVALID, OK, ParseStatus, addIssueToContext, isAborted, isAsync, isDirty, isValid, makeIssue, } from "./helpers/parseUtil.js";
|
|
5
|
+
import { util, ZodParsedType, getParsedType } from "./helpers/util.js";
|
|
554
6
|
class ParseInputLazyPath {
|
|
555
7
|
constructor(parent, value, path, key) {
|
|
556
8
|
this._cachedPath = [];
|
|
@@ -561,7 +13,7 @@ class ParseInputLazyPath {
|
|
|
561
13
|
}
|
|
562
14
|
get path() {
|
|
563
15
|
if (!this._cachedPath.length) {
|
|
564
|
-
if (this._key
|
|
16
|
+
if (Array.isArray(this._key)) {
|
|
565
17
|
this._cachedPath.push(...this._path, ...this._key);
|
|
566
18
|
}
|
|
567
19
|
else {
|
|
@@ -601,21 +53,20 @@ function processCreateParams(params) {
|
|
|
601
53
|
if (errorMap)
|
|
602
54
|
return { errorMap: errorMap, description };
|
|
603
55
|
const customMap = (iss, ctx) => {
|
|
604
|
-
var _a, _b;
|
|
605
56
|
const { message } = params;
|
|
606
57
|
if (iss.code === "invalid_enum_value") {
|
|
607
|
-
return { message: message
|
|
58
|
+
return { message: message ?? ctx.defaultError };
|
|
608
59
|
}
|
|
609
60
|
if (typeof ctx.data === "undefined") {
|
|
610
|
-
return { message:
|
|
61
|
+
return { message: message ?? required_error ?? ctx.defaultError };
|
|
611
62
|
}
|
|
612
63
|
if (iss.code !== "invalid_type")
|
|
613
64
|
return { message: ctx.defaultError };
|
|
614
|
-
return { message:
|
|
65
|
+
return { message: message ?? invalid_type_error ?? ctx.defaultError };
|
|
615
66
|
};
|
|
616
67
|
return { errorMap: customMap, description };
|
|
617
68
|
}
|
|
618
|
-
class ZodType {
|
|
69
|
+
export class ZodType {
|
|
619
70
|
get description() {
|
|
620
71
|
return this._def.description;
|
|
621
72
|
}
|
|
@@ -663,14 +114,13 @@ class ZodType {
|
|
|
663
114
|
throw result.error;
|
|
664
115
|
}
|
|
665
116
|
safeParse(data, params) {
|
|
666
|
-
var _a;
|
|
667
117
|
const ctx = {
|
|
668
118
|
common: {
|
|
669
119
|
issues: [],
|
|
670
|
-
async:
|
|
671
|
-
contextualErrorMap: params
|
|
120
|
+
async: params?.async ?? false,
|
|
121
|
+
contextualErrorMap: params?.errorMap,
|
|
672
122
|
},
|
|
673
|
-
path:
|
|
123
|
+
path: params?.path || [],
|
|
674
124
|
schemaErrorMap: this._def.errorMap,
|
|
675
125
|
parent: null,
|
|
676
126
|
data,
|
|
@@ -680,7 +130,6 @@ class ZodType {
|
|
|
680
130
|
return handleResult(ctx, result);
|
|
681
131
|
}
|
|
682
132
|
"~validate"(data) {
|
|
683
|
-
var _a, _b;
|
|
684
133
|
const ctx = {
|
|
685
134
|
common: {
|
|
686
135
|
issues: [],
|
|
@@ -704,7 +153,7 @@ class ZodType {
|
|
|
704
153
|
};
|
|
705
154
|
}
|
|
706
155
|
catch (err) {
|
|
707
|
-
if (
|
|
156
|
+
if (err?.message?.toLowerCase()?.includes("encountered")) {
|
|
708
157
|
this["~standard"].async = true;
|
|
709
158
|
}
|
|
710
159
|
ctx.common = {
|
|
@@ -731,19 +180,17 @@ class ZodType {
|
|
|
731
180
|
const ctx = {
|
|
732
181
|
common: {
|
|
733
182
|
issues: [],
|
|
734
|
-
contextualErrorMap: params
|
|
183
|
+
contextualErrorMap: params?.errorMap,
|
|
735
184
|
async: true,
|
|
736
185
|
},
|
|
737
|
-
path:
|
|
186
|
+
path: params?.path || [],
|
|
738
187
|
schemaErrorMap: this._def.errorMap,
|
|
739
188
|
parent: null,
|
|
740
189
|
data,
|
|
741
190
|
parsedType: getParsedType(data),
|
|
742
191
|
};
|
|
743
192
|
const maybeAsyncResult = this._parse({ data, path: ctx.path, parent: ctx });
|
|
744
|
-
const result = await (isAsync(maybeAsyncResult)
|
|
745
|
-
? maybeAsyncResult
|
|
746
|
-
: Promise.resolve(maybeAsyncResult));
|
|
193
|
+
const result = await (isAsync(maybeAsyncResult) ? maybeAsyncResult : Promise.resolve(maybeAsyncResult));
|
|
747
194
|
return handleResult(ctx, result);
|
|
748
195
|
}
|
|
749
196
|
refine(check, message) {
|
|
@@ -787,9 +234,7 @@ class ZodType {
|
|
|
787
234
|
refinement(check, refinementData) {
|
|
788
235
|
return this._refinement((val, ctx) => {
|
|
789
236
|
if (!check(val)) {
|
|
790
|
-
ctx.addIssue(typeof refinementData === "function"
|
|
791
|
-
? refinementData(val, ctx)
|
|
792
|
-
: refinementData);
|
|
237
|
+
ctx.addIssue(typeof refinementData === "function" ? refinementData(val, ctx) : refinementData);
|
|
793
238
|
return false;
|
|
794
239
|
}
|
|
795
240
|
else {
|
|
@@ -961,21 +406,21 @@ const base64urlRegex = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z
|
|
|
961
406
|
const dateRegexSource = `((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))`;
|
|
962
407
|
const dateRegex = new RegExp(`^${dateRegexSource}$`);
|
|
963
408
|
function timeRegexSource(args) {
|
|
964
|
-
|
|
965
|
-
let regex = `([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d`;
|
|
409
|
+
let secondsRegexSource = `[0-5]\\d`;
|
|
966
410
|
if (args.precision) {
|
|
967
|
-
|
|
411
|
+
secondsRegexSource = `${secondsRegexSource}\\.\\d{${args.precision}}`;
|
|
968
412
|
}
|
|
969
413
|
else if (args.precision == null) {
|
|
970
|
-
|
|
414
|
+
secondsRegexSource = `${secondsRegexSource}(\\.\\d+)?`;
|
|
971
415
|
}
|
|
972
|
-
|
|
416
|
+
const secondsQuantifier = args.precision ? "+" : "?"; // require seconds if precision is nonzero
|
|
417
|
+
return `([01]\\d|2[0-3]):[0-5]\\d(:${secondsRegexSource})${secondsQuantifier}`;
|
|
973
418
|
}
|
|
974
419
|
function timeRegex(args) {
|
|
975
420
|
return new RegExp(`^${timeRegexSource(args)}$`);
|
|
976
421
|
}
|
|
977
422
|
// Adapted from https://stackoverflow.com/a/3143231
|
|
978
|
-
function datetimeRegex(args) {
|
|
423
|
+
export function datetimeRegex(args) {
|
|
979
424
|
let regex = `${dateRegexSource}T${timeRegexSource(args)}`;
|
|
980
425
|
const opts = [];
|
|
981
426
|
opts.push(args.local ? `Z?` : `Z`);
|
|
@@ -1006,13 +451,15 @@ function isValidJWT(jwt, alg) {
|
|
|
1006
451
|
const decoded = JSON.parse(atob(base64));
|
|
1007
452
|
if (typeof decoded !== "object" || decoded === null)
|
|
1008
453
|
return false;
|
|
1009
|
-
if (
|
|
454
|
+
if ("typ" in decoded && decoded?.typ !== "JWT")
|
|
455
|
+
return false;
|
|
456
|
+
if (!decoded.alg)
|
|
1010
457
|
return false;
|
|
1011
458
|
if (alg && decoded.alg !== alg)
|
|
1012
459
|
return false;
|
|
1013
460
|
return true;
|
|
1014
461
|
}
|
|
1015
|
-
catch
|
|
462
|
+
catch {
|
|
1016
463
|
return false;
|
|
1017
464
|
}
|
|
1018
465
|
}
|
|
@@ -1025,7 +472,7 @@ function isValidCidr(ip, version) {
|
|
|
1025
472
|
}
|
|
1026
473
|
return false;
|
|
1027
474
|
}
|
|
1028
|
-
class ZodString extends ZodType {
|
|
475
|
+
export class ZodString extends ZodType {
|
|
1029
476
|
_parse(input) {
|
|
1030
477
|
if (this._def.coerce) {
|
|
1031
478
|
input.data = String(input.data);
|
|
@@ -1183,7 +630,7 @@ class ZodString extends ZodType {
|
|
|
1183
630
|
try {
|
|
1184
631
|
new URL(input.data);
|
|
1185
632
|
}
|
|
1186
|
-
catch
|
|
633
|
+
catch {
|
|
1187
634
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
1188
635
|
addIssueToContext(ctx, {
|
|
1189
636
|
validation: "url",
|
|
@@ -1413,7 +860,6 @@ class ZodString extends ZodType {
|
|
|
1413
860
|
return this._addCheck({ kind: "cidr", ...errorUtil.errToObj(options) });
|
|
1414
861
|
}
|
|
1415
862
|
datetime(options) {
|
|
1416
|
-
var _a, _b;
|
|
1417
863
|
if (typeof options === "string") {
|
|
1418
864
|
return this._addCheck({
|
|
1419
865
|
kind: "datetime",
|
|
@@ -1425,10 +871,10 @@ class ZodString extends ZodType {
|
|
|
1425
871
|
}
|
|
1426
872
|
return this._addCheck({
|
|
1427
873
|
kind: "datetime",
|
|
1428
|
-
precision: typeof
|
|
1429
|
-
offset:
|
|
1430
|
-
local:
|
|
1431
|
-
...errorUtil.errToObj(options
|
|
874
|
+
precision: typeof options?.precision === "undefined" ? null : options?.precision,
|
|
875
|
+
offset: options?.offset ?? false,
|
|
876
|
+
local: options?.local ?? false,
|
|
877
|
+
...errorUtil.errToObj(options?.message),
|
|
1432
878
|
});
|
|
1433
879
|
}
|
|
1434
880
|
date(message) {
|
|
@@ -1444,8 +890,8 @@ class ZodString extends ZodType {
|
|
|
1444
890
|
}
|
|
1445
891
|
return this._addCheck({
|
|
1446
892
|
kind: "time",
|
|
1447
|
-
precision: typeof
|
|
1448
|
-
...errorUtil.errToObj(options
|
|
893
|
+
precision: typeof options?.precision === "undefined" ? null : options?.precision,
|
|
894
|
+
...errorUtil.errToObj(options?.message),
|
|
1449
895
|
});
|
|
1450
896
|
}
|
|
1451
897
|
duration(message) {
|
|
@@ -1462,8 +908,8 @@ class ZodString extends ZodType {
|
|
|
1462
908
|
return this._addCheck({
|
|
1463
909
|
kind: "includes",
|
|
1464
910
|
value: value,
|
|
1465
|
-
position: options
|
|
1466
|
-
...errorUtil.errToObj(options
|
|
911
|
+
position: options?.position,
|
|
912
|
+
...errorUtil.errToObj(options?.message),
|
|
1467
913
|
});
|
|
1468
914
|
}
|
|
1469
915
|
startsWith(value, message) {
|
|
@@ -1596,11 +1042,10 @@ class ZodString extends ZodType {
|
|
|
1596
1042
|
}
|
|
1597
1043
|
}
|
|
1598
1044
|
ZodString.create = (params) => {
|
|
1599
|
-
var _a;
|
|
1600
1045
|
return new ZodString({
|
|
1601
1046
|
checks: [],
|
|
1602
1047
|
typeName: ZodFirstPartyTypeKind.ZodString,
|
|
1603
|
-
coerce:
|
|
1048
|
+
coerce: params?.coerce ?? false,
|
|
1604
1049
|
...processCreateParams(params),
|
|
1605
1050
|
});
|
|
1606
1051
|
};
|
|
@@ -1609,11 +1054,11 @@ function floatSafeRemainder(val, step) {
|
|
|
1609
1054
|
const valDecCount = (val.toString().split(".")[1] || "").length;
|
|
1610
1055
|
const stepDecCount = (step.toString().split(".")[1] || "").length;
|
|
1611
1056
|
const decCount = valDecCount > stepDecCount ? valDecCount : stepDecCount;
|
|
1612
|
-
const valInt = parseInt(val.toFixed(decCount).replace(".", ""));
|
|
1613
|
-
const stepInt = parseInt(step.toFixed(decCount).replace(".", ""));
|
|
1614
|
-
return (valInt % stepInt) /
|
|
1057
|
+
const valInt = Number.parseInt(val.toFixed(decCount).replace(".", ""));
|
|
1058
|
+
const stepInt = Number.parseInt(step.toFixed(decCount).replace(".", ""));
|
|
1059
|
+
return (valInt % stepInt) / 10 ** decCount;
|
|
1615
1060
|
}
|
|
1616
|
-
class ZodNumber extends ZodType {
|
|
1061
|
+
export class ZodNumber extends ZodType {
|
|
1617
1062
|
constructor() {
|
|
1618
1063
|
super(...arguments);
|
|
1619
1064
|
this.min = this.gte;
|
|
@@ -1650,9 +1095,7 @@ class ZodNumber extends ZodType {
|
|
|
1650
1095
|
}
|
|
1651
1096
|
}
|
|
1652
1097
|
else if (check.kind === "min") {
|
|
1653
|
-
const tooSmall = check.inclusive
|
|
1654
|
-
? input.data < check.value
|
|
1655
|
-
: input.data <= check.value;
|
|
1098
|
+
const tooSmall = check.inclusive ? input.data < check.value : input.data <= check.value;
|
|
1656
1099
|
if (tooSmall) {
|
|
1657
1100
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
1658
1101
|
addIssueToContext(ctx, {
|
|
@@ -1667,9 +1110,7 @@ class ZodNumber extends ZodType {
|
|
|
1667
1110
|
}
|
|
1668
1111
|
}
|
|
1669
1112
|
else if (check.kind === "max") {
|
|
1670
|
-
const tooBig = check.inclusive
|
|
1671
|
-
? input.data > check.value
|
|
1672
|
-
: input.data >= check.value;
|
|
1113
|
+
const tooBig = check.inclusive ? input.data > check.value : input.data >= check.value;
|
|
1673
1114
|
if (tooBig) {
|
|
1674
1115
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
1675
1116
|
addIssueToContext(ctx, {
|
|
@@ -1827,15 +1268,13 @@ class ZodNumber extends ZodType {
|
|
|
1827
1268
|
return max;
|
|
1828
1269
|
}
|
|
1829
1270
|
get isInt() {
|
|
1830
|
-
return !!this._def.checks.find((ch) => ch.kind === "int" ||
|
|
1831
|
-
(ch.kind === "multipleOf" && util.isInteger(ch.value)));
|
|
1271
|
+
return !!this._def.checks.find((ch) => ch.kind === "int" || (ch.kind === "multipleOf" && util.isInteger(ch.value)));
|
|
1832
1272
|
}
|
|
1833
1273
|
get isFinite() {
|
|
1834
|
-
let max = null
|
|
1274
|
+
let max = null;
|
|
1275
|
+
let min = null;
|
|
1835
1276
|
for (const ch of this._def.checks) {
|
|
1836
|
-
if (ch.kind === "finite" ||
|
|
1837
|
-
ch.kind === "int" ||
|
|
1838
|
-
ch.kind === "multipleOf") {
|
|
1277
|
+
if (ch.kind === "finite" || ch.kind === "int" || ch.kind === "multipleOf") {
|
|
1839
1278
|
return true;
|
|
1840
1279
|
}
|
|
1841
1280
|
else if (ch.kind === "min") {
|
|
@@ -1854,11 +1293,11 @@ ZodNumber.create = (params) => {
|
|
|
1854
1293
|
return new ZodNumber({
|
|
1855
1294
|
checks: [],
|
|
1856
1295
|
typeName: ZodFirstPartyTypeKind.ZodNumber,
|
|
1857
|
-
coerce:
|
|
1296
|
+
coerce: params?.coerce || false,
|
|
1858
1297
|
...processCreateParams(params),
|
|
1859
1298
|
});
|
|
1860
1299
|
};
|
|
1861
|
-
class ZodBigInt extends ZodType {
|
|
1300
|
+
export class ZodBigInt extends ZodType {
|
|
1862
1301
|
constructor() {
|
|
1863
1302
|
super(...arguments);
|
|
1864
1303
|
this.min = this.gte;
|
|
@@ -1869,7 +1308,7 @@ class ZodBigInt extends ZodType {
|
|
|
1869
1308
|
try {
|
|
1870
1309
|
input.data = BigInt(input.data);
|
|
1871
1310
|
}
|
|
1872
|
-
catch
|
|
1311
|
+
catch {
|
|
1873
1312
|
return this._getInvalidInput(input);
|
|
1874
1313
|
}
|
|
1875
1314
|
}
|
|
@@ -1881,9 +1320,7 @@ class ZodBigInt extends ZodType {
|
|
|
1881
1320
|
const status = new ParseStatus();
|
|
1882
1321
|
for (const check of this._def.checks) {
|
|
1883
1322
|
if (check.kind === "min") {
|
|
1884
|
-
const tooSmall = check.inclusive
|
|
1885
|
-
? input.data < check.value
|
|
1886
|
-
: input.data <= check.value;
|
|
1323
|
+
const tooSmall = check.inclusive ? input.data < check.value : input.data <= check.value;
|
|
1887
1324
|
if (tooSmall) {
|
|
1888
1325
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
1889
1326
|
addIssueToContext(ctx, {
|
|
@@ -1897,9 +1334,7 @@ class ZodBigInt extends ZodType {
|
|
|
1897
1334
|
}
|
|
1898
1335
|
}
|
|
1899
1336
|
else if (check.kind === "max") {
|
|
1900
|
-
const tooBig = check.inclusive
|
|
1901
|
-
? input.data > check.value
|
|
1902
|
-
: input.data >= check.value;
|
|
1337
|
+
const tooBig = check.inclusive ? input.data > check.value : input.data >= check.value;
|
|
1903
1338
|
if (tooBig) {
|
|
1904
1339
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
1905
1340
|
addIssueToContext(ctx, {
|
|
@@ -2031,15 +1466,14 @@ class ZodBigInt extends ZodType {
|
|
|
2031
1466
|
}
|
|
2032
1467
|
}
|
|
2033
1468
|
ZodBigInt.create = (params) => {
|
|
2034
|
-
var _a;
|
|
2035
1469
|
return new ZodBigInt({
|
|
2036
1470
|
checks: [],
|
|
2037
1471
|
typeName: ZodFirstPartyTypeKind.ZodBigInt,
|
|
2038
|
-
coerce:
|
|
1472
|
+
coerce: params?.coerce ?? false,
|
|
2039
1473
|
...processCreateParams(params),
|
|
2040
1474
|
});
|
|
2041
1475
|
};
|
|
2042
|
-
class ZodBoolean extends ZodType {
|
|
1476
|
+
export class ZodBoolean extends ZodType {
|
|
2043
1477
|
_parse(input) {
|
|
2044
1478
|
if (this._def.coerce) {
|
|
2045
1479
|
input.data = Boolean(input.data);
|
|
@@ -2060,11 +1494,11 @@ class ZodBoolean extends ZodType {
|
|
|
2060
1494
|
ZodBoolean.create = (params) => {
|
|
2061
1495
|
return new ZodBoolean({
|
|
2062
1496
|
typeName: ZodFirstPartyTypeKind.ZodBoolean,
|
|
2063
|
-
coerce:
|
|
1497
|
+
coerce: params?.coerce || false,
|
|
2064
1498
|
...processCreateParams(params),
|
|
2065
1499
|
});
|
|
2066
1500
|
};
|
|
2067
|
-
class ZodDate extends ZodType {
|
|
1501
|
+
export class ZodDate extends ZodType {
|
|
2068
1502
|
_parse(input) {
|
|
2069
1503
|
if (this._def.coerce) {
|
|
2070
1504
|
input.data = new Date(input.data);
|
|
@@ -2079,7 +1513,7 @@ class ZodDate extends ZodType {
|
|
|
2079
1513
|
});
|
|
2080
1514
|
return INVALID;
|
|
2081
1515
|
}
|
|
2082
|
-
if (isNaN(input.data.getTime())) {
|
|
1516
|
+
if (Number.isNaN(input.data.getTime())) {
|
|
2083
1517
|
const ctx = this._getOrReturnCtx(input);
|
|
2084
1518
|
addIssueToContext(ctx, {
|
|
2085
1519
|
code: ZodIssueCode.invalid_date,
|
|
@@ -2170,12 +1604,12 @@ class ZodDate extends ZodType {
|
|
|
2170
1604
|
ZodDate.create = (params) => {
|
|
2171
1605
|
return new ZodDate({
|
|
2172
1606
|
checks: [],
|
|
2173
|
-
coerce:
|
|
1607
|
+
coerce: params?.coerce || false,
|
|
2174
1608
|
typeName: ZodFirstPartyTypeKind.ZodDate,
|
|
2175
1609
|
...processCreateParams(params),
|
|
2176
1610
|
});
|
|
2177
1611
|
};
|
|
2178
|
-
class ZodSymbol extends ZodType {
|
|
1612
|
+
export class ZodSymbol extends ZodType {
|
|
2179
1613
|
_parse(input) {
|
|
2180
1614
|
const parsedType = this._getType(input);
|
|
2181
1615
|
if (parsedType !== ZodParsedType.symbol) {
|
|
@@ -2196,7 +1630,7 @@ ZodSymbol.create = (params) => {
|
|
|
2196
1630
|
...processCreateParams(params),
|
|
2197
1631
|
});
|
|
2198
1632
|
};
|
|
2199
|
-
class ZodUndefined extends ZodType {
|
|
1633
|
+
export class ZodUndefined extends ZodType {
|
|
2200
1634
|
_parse(input) {
|
|
2201
1635
|
const parsedType = this._getType(input);
|
|
2202
1636
|
if (parsedType !== ZodParsedType.undefined) {
|
|
@@ -2217,7 +1651,7 @@ ZodUndefined.create = (params) => {
|
|
|
2217
1651
|
...processCreateParams(params),
|
|
2218
1652
|
});
|
|
2219
1653
|
};
|
|
2220
|
-
class ZodNull extends ZodType {
|
|
1654
|
+
export class ZodNull extends ZodType {
|
|
2221
1655
|
_parse(input) {
|
|
2222
1656
|
const parsedType = this._getType(input);
|
|
2223
1657
|
if (parsedType !== ZodParsedType.null) {
|
|
@@ -2238,7 +1672,7 @@ ZodNull.create = (params) => {
|
|
|
2238
1672
|
...processCreateParams(params),
|
|
2239
1673
|
});
|
|
2240
1674
|
};
|
|
2241
|
-
class ZodAny extends ZodType {
|
|
1675
|
+
export class ZodAny extends ZodType {
|
|
2242
1676
|
constructor() {
|
|
2243
1677
|
super(...arguments);
|
|
2244
1678
|
// to prevent instances of other classes from extending ZodAny. this causes issues with catchall in ZodObject.
|
|
@@ -2254,7 +1688,7 @@ ZodAny.create = (params) => {
|
|
|
2254
1688
|
...processCreateParams(params),
|
|
2255
1689
|
});
|
|
2256
1690
|
};
|
|
2257
|
-
class ZodUnknown extends ZodType {
|
|
1691
|
+
export class ZodUnknown extends ZodType {
|
|
2258
1692
|
constructor() {
|
|
2259
1693
|
super(...arguments);
|
|
2260
1694
|
// required
|
|
@@ -2270,7 +1704,7 @@ ZodUnknown.create = (params) => {
|
|
|
2270
1704
|
...processCreateParams(params),
|
|
2271
1705
|
});
|
|
2272
1706
|
};
|
|
2273
|
-
class ZodNever extends ZodType {
|
|
1707
|
+
export class ZodNever extends ZodType {
|
|
2274
1708
|
_parse(input) {
|
|
2275
1709
|
const ctx = this._getOrReturnCtx(input);
|
|
2276
1710
|
addIssueToContext(ctx, {
|
|
@@ -2287,7 +1721,7 @@ ZodNever.create = (params) => {
|
|
|
2287
1721
|
...processCreateParams(params),
|
|
2288
1722
|
});
|
|
2289
1723
|
};
|
|
2290
|
-
class ZodVoid extends ZodType {
|
|
1724
|
+
export class ZodVoid extends ZodType {
|
|
2291
1725
|
_parse(input) {
|
|
2292
1726
|
const parsedType = this._getType(input);
|
|
2293
1727
|
if (parsedType !== ZodParsedType.undefined) {
|
|
@@ -2308,7 +1742,7 @@ ZodVoid.create = (params) => {
|
|
|
2308
1742
|
...processCreateParams(params),
|
|
2309
1743
|
});
|
|
2310
1744
|
};
|
|
2311
|
-
class ZodArray extends ZodType {
|
|
1745
|
+
export class ZodArray extends ZodType {
|
|
2312
1746
|
_parse(input) {
|
|
2313
1747
|
const { ctx, status } = this._processInputParams(input);
|
|
2314
1748
|
const def = this._def;
|
|
@@ -2440,7 +1874,7 @@ function deepPartialify(schema) {
|
|
|
2440
1874
|
return schema;
|
|
2441
1875
|
}
|
|
2442
1876
|
}
|
|
2443
|
-
class ZodObject extends ZodType {
|
|
1877
|
+
export class ZodObject extends ZodType {
|
|
2444
1878
|
constructor() {
|
|
2445
1879
|
super(...arguments);
|
|
2446
1880
|
this._cached = null;
|
|
@@ -2492,7 +1926,8 @@ class ZodObject extends ZodType {
|
|
|
2492
1926
|
return this._cached;
|
|
2493
1927
|
const shape = this._def.shape();
|
|
2494
1928
|
const keys = util.objectKeys(shape);
|
|
2495
|
-
|
|
1929
|
+
this._cached = { shape, keys };
|
|
1930
|
+
return this._cached;
|
|
2496
1931
|
}
|
|
2497
1932
|
_parse(input) {
|
|
2498
1933
|
const parsedType = this._getType(input);
|
|
@@ -2508,8 +1943,7 @@ class ZodObject extends ZodType {
|
|
|
2508
1943
|
const { status, ctx } = this._processInputParams(input);
|
|
2509
1944
|
const { shape, keys: shapeKeys } = this._getCached();
|
|
2510
1945
|
const extraKeys = [];
|
|
2511
|
-
if (!(this._def.catchall instanceof ZodNever &&
|
|
2512
|
-
this._def.unknownKeys === "strip")) {
|
|
1946
|
+
if (!(this._def.catchall instanceof ZodNever && this._def.unknownKeys === "strip")) {
|
|
2513
1947
|
for (const key in ctx.data) {
|
|
2514
1948
|
if (!shapeKeys.includes(key)) {
|
|
2515
1949
|
extraKeys.push(key);
|
|
@@ -2545,7 +1979,8 @@ class ZodObject extends ZodType {
|
|
|
2545
1979
|
status.dirty();
|
|
2546
1980
|
}
|
|
2547
1981
|
}
|
|
2548
|
-
else if (unknownKeys === "strip")
|
|
1982
|
+
else if (unknownKeys === "strip") {
|
|
1983
|
+
}
|
|
2549
1984
|
else {
|
|
2550
1985
|
throw new Error(`Internal ZodObject error: invalid unknownKeys value.`);
|
|
2551
1986
|
}
|
|
@@ -2597,11 +2032,10 @@ class ZodObject extends ZodType {
|
|
|
2597
2032
|
...(message !== undefined
|
|
2598
2033
|
? {
|
|
2599
2034
|
errorMap: (issue, ctx) => {
|
|
2600
|
-
|
|
2601
|
-
const defaultError = (_c = (_b = (_a = this._def).errorMap) === null || _b === void 0 ? void 0 : _b.call(_a, issue, ctx).message) !== null && _c !== void 0 ? _c : ctx.defaultError;
|
|
2035
|
+
const defaultError = this._def.errorMap?.(issue, ctx).message ?? ctx.defaultError;
|
|
2602
2036
|
if (issue.code === "unrecognized_keys")
|
|
2603
2037
|
return {
|
|
2604
|
-
message:
|
|
2038
|
+
message: errorUtil.errToObj(message).message ?? defaultError,
|
|
2605
2039
|
};
|
|
2606
2040
|
return {
|
|
2607
2041
|
message: defaultError,
|
|
@@ -2733,11 +2167,11 @@ class ZodObject extends ZodType {
|
|
|
2733
2167
|
}
|
|
2734
2168
|
pick(mask) {
|
|
2735
2169
|
const shape = {};
|
|
2736
|
-
util.objectKeys(mask)
|
|
2170
|
+
for (const key of util.objectKeys(mask)) {
|
|
2737
2171
|
if (mask[key] && this.shape[key]) {
|
|
2738
2172
|
shape[key] = this.shape[key];
|
|
2739
2173
|
}
|
|
2740
|
-
}
|
|
2174
|
+
}
|
|
2741
2175
|
return new ZodObject({
|
|
2742
2176
|
...this._def,
|
|
2743
2177
|
shape: () => shape,
|
|
@@ -2745,11 +2179,11 @@ class ZodObject extends ZodType {
|
|
|
2745
2179
|
}
|
|
2746
2180
|
omit(mask) {
|
|
2747
2181
|
const shape = {};
|
|
2748
|
-
util.objectKeys(this.shape)
|
|
2182
|
+
for (const key of util.objectKeys(this.shape)) {
|
|
2749
2183
|
if (!mask[key]) {
|
|
2750
2184
|
shape[key] = this.shape[key];
|
|
2751
2185
|
}
|
|
2752
|
-
}
|
|
2186
|
+
}
|
|
2753
2187
|
return new ZodObject({
|
|
2754
2188
|
...this._def,
|
|
2755
2189
|
shape: () => shape,
|
|
@@ -2763,7 +2197,7 @@ class ZodObject extends ZodType {
|
|
|
2763
2197
|
}
|
|
2764
2198
|
partial(mask) {
|
|
2765
2199
|
const newShape = {};
|
|
2766
|
-
util.objectKeys(this.shape)
|
|
2200
|
+
for (const key of util.objectKeys(this.shape)) {
|
|
2767
2201
|
const fieldSchema = this.shape[key];
|
|
2768
2202
|
if (mask && !mask[key]) {
|
|
2769
2203
|
newShape[key] = fieldSchema;
|
|
@@ -2771,7 +2205,7 @@ class ZodObject extends ZodType {
|
|
|
2771
2205
|
else {
|
|
2772
2206
|
newShape[key] = fieldSchema.optional();
|
|
2773
2207
|
}
|
|
2774
|
-
}
|
|
2208
|
+
}
|
|
2775
2209
|
return new ZodObject({
|
|
2776
2210
|
...this._def,
|
|
2777
2211
|
shape: () => newShape,
|
|
@@ -2779,7 +2213,7 @@ class ZodObject extends ZodType {
|
|
|
2779
2213
|
}
|
|
2780
2214
|
required(mask) {
|
|
2781
2215
|
const newShape = {};
|
|
2782
|
-
util.objectKeys(this.shape)
|
|
2216
|
+
for (const key of util.objectKeys(this.shape)) {
|
|
2783
2217
|
if (mask && !mask[key]) {
|
|
2784
2218
|
newShape[key] = this.shape[key];
|
|
2785
2219
|
}
|
|
@@ -2791,7 +2225,7 @@ class ZodObject extends ZodType {
|
|
|
2791
2225
|
}
|
|
2792
2226
|
newShape[key] = newField;
|
|
2793
2227
|
}
|
|
2794
|
-
}
|
|
2228
|
+
}
|
|
2795
2229
|
return new ZodObject({
|
|
2796
2230
|
...this._def,
|
|
2797
2231
|
shape: () => newShape,
|
|
@@ -2828,7 +2262,7 @@ ZodObject.lazycreate = (shape, params) => {
|
|
|
2828
2262
|
...processCreateParams(params),
|
|
2829
2263
|
});
|
|
2830
2264
|
};
|
|
2831
|
-
class ZodUnion extends ZodType {
|
|
2265
|
+
export class ZodUnion extends ZodType {
|
|
2832
2266
|
_parse(input) {
|
|
2833
2267
|
const { ctx } = this._processInputParams(input);
|
|
2834
2268
|
const options = this._def.options;
|
|
@@ -2976,7 +2410,7 @@ const getDiscriminator = (type) => {
|
|
|
2976
2410
|
return [];
|
|
2977
2411
|
}
|
|
2978
2412
|
};
|
|
2979
|
-
class ZodDiscriminatedUnion extends ZodType {
|
|
2413
|
+
export class ZodDiscriminatedUnion extends ZodType {
|
|
2980
2414
|
_parse(input) {
|
|
2981
2415
|
const { ctx } = this._processInputParams(input);
|
|
2982
2416
|
if (ctx.parsedType !== ZodParsedType.object) {
|
|
@@ -3063,9 +2497,7 @@ function mergeValues(a, b) {
|
|
|
3063
2497
|
}
|
|
3064
2498
|
else if (aType === ZodParsedType.object && bType === ZodParsedType.object) {
|
|
3065
2499
|
const bKeys = util.objectKeys(b);
|
|
3066
|
-
const sharedKeys = util
|
|
3067
|
-
.objectKeys(a)
|
|
3068
|
-
.filter((key) => bKeys.indexOf(key) !== -1);
|
|
2500
|
+
const sharedKeys = util.objectKeys(a).filter((key) => bKeys.indexOf(key) !== -1);
|
|
3069
2501
|
const newObj = { ...a, ...b };
|
|
3070
2502
|
for (const key of sharedKeys) {
|
|
3071
2503
|
const sharedValue = mergeValues(a[key], b[key]);
|
|
@@ -3092,16 +2524,14 @@ function mergeValues(a, b) {
|
|
|
3092
2524
|
}
|
|
3093
2525
|
return { valid: true, data: newArray };
|
|
3094
2526
|
}
|
|
3095
|
-
else if (aType === ZodParsedType.date &&
|
|
3096
|
-
bType === ZodParsedType.date &&
|
|
3097
|
-
+a === +b) {
|
|
2527
|
+
else if (aType === ZodParsedType.date && bType === ZodParsedType.date && +a === +b) {
|
|
3098
2528
|
return { valid: true, data: a };
|
|
3099
2529
|
}
|
|
3100
2530
|
else {
|
|
3101
2531
|
return { valid: false };
|
|
3102
2532
|
}
|
|
3103
2533
|
}
|
|
3104
|
-
class ZodIntersection extends ZodType {
|
|
2534
|
+
export class ZodIntersection extends ZodType {
|
|
3105
2535
|
_parse(input) {
|
|
3106
2536
|
const { status, ctx } = this._processInputParams(input);
|
|
3107
2537
|
const handleParsed = (parsedLeft, parsedRight) => {
|
|
@@ -3155,7 +2585,8 @@ ZodIntersection.create = (left, right, params) => {
|
|
|
3155
2585
|
...processCreateParams(params),
|
|
3156
2586
|
});
|
|
3157
2587
|
};
|
|
3158
|
-
|
|
2588
|
+
// type ZodTupleItems = [ZodTypeAny, ...ZodTypeAny[]];
|
|
2589
|
+
export class ZodTuple extends ZodType {
|
|
3159
2590
|
_parse(input) {
|
|
3160
2591
|
const { status, ctx } = this._processInputParams(input);
|
|
3161
2592
|
if (ctx.parsedType !== ZodParsedType.array) {
|
|
@@ -3225,7 +2656,7 @@ ZodTuple.create = (schemas, params) => {
|
|
|
3225
2656
|
...processCreateParams(params),
|
|
3226
2657
|
});
|
|
3227
2658
|
};
|
|
3228
|
-
class ZodRecord extends ZodType {
|
|
2659
|
+
export class ZodRecord extends ZodType {
|
|
3229
2660
|
get keySchema() {
|
|
3230
2661
|
return this._def.keyType;
|
|
3231
2662
|
}
|
|
@@ -3279,7 +2710,7 @@ class ZodRecord extends ZodType {
|
|
|
3279
2710
|
});
|
|
3280
2711
|
}
|
|
3281
2712
|
}
|
|
3282
|
-
class ZodMap extends ZodType {
|
|
2713
|
+
export class ZodMap extends ZodType {
|
|
3283
2714
|
get keySchema() {
|
|
3284
2715
|
return this._def.keyType;
|
|
3285
2716
|
}
|
|
@@ -3346,7 +2777,7 @@ ZodMap.create = (keyType, valueType, params) => {
|
|
|
3346
2777
|
...processCreateParams(params),
|
|
3347
2778
|
});
|
|
3348
2779
|
};
|
|
3349
|
-
class ZodSet extends ZodType {
|
|
2780
|
+
export class ZodSet extends ZodType {
|
|
3350
2781
|
_parse(input) {
|
|
3351
2782
|
const { status, ctx } = this._processInputParams(input);
|
|
3352
2783
|
if (ctx.parsedType !== ZodParsedType.set) {
|
|
@@ -3432,7 +2863,7 @@ ZodSet.create = (valueType, params) => {
|
|
|
3432
2863
|
...processCreateParams(params),
|
|
3433
2864
|
});
|
|
3434
2865
|
};
|
|
3435
|
-
class ZodFunction extends ZodType {
|
|
2866
|
+
export class ZodFunction extends ZodType {
|
|
3436
2867
|
constructor() {
|
|
3437
2868
|
super(...arguments);
|
|
3438
2869
|
this.validate = this.implement;
|
|
@@ -3451,12 +2882,7 @@ class ZodFunction extends ZodType {
|
|
|
3451
2882
|
return makeIssue({
|
|
3452
2883
|
data: args,
|
|
3453
2884
|
path: ctx.path,
|
|
3454
|
-
errorMaps: [
|
|
3455
|
-
ctx.common.contextualErrorMap,
|
|
3456
|
-
ctx.schemaErrorMap,
|
|
3457
|
-
getErrorMap(),
|
|
3458
|
-
errorMap,
|
|
3459
|
-
].filter((x) => !!x),
|
|
2885
|
+
errorMaps: [ctx.common.contextualErrorMap, ctx.schemaErrorMap, getErrorMap(), defaultErrorMap].filter((x) => !!x),
|
|
3460
2886
|
issueData: {
|
|
3461
2887
|
code: ZodIssueCode.invalid_arguments,
|
|
3462
2888
|
argumentsError: error,
|
|
@@ -3467,12 +2893,7 @@ class ZodFunction extends ZodType {
|
|
|
3467
2893
|
return makeIssue({
|
|
3468
2894
|
data: returns,
|
|
3469
2895
|
path: ctx.path,
|
|
3470
|
-
errorMaps: [
|
|
3471
|
-
ctx.common.contextualErrorMap,
|
|
3472
|
-
ctx.schemaErrorMap,
|
|
3473
|
-
getErrorMap(),
|
|
3474
|
-
errorMap,
|
|
3475
|
-
].filter((x) => !!x),
|
|
2896
|
+
errorMaps: [ctx.common.contextualErrorMap, ctx.schemaErrorMap, getErrorMap(), defaultErrorMap].filter((x) => !!x),
|
|
3476
2897
|
issueData: {
|
|
3477
2898
|
code: ZodIssueCode.invalid_return_type,
|
|
3478
2899
|
returnTypeError: error,
|
|
@@ -3488,9 +2909,7 @@ class ZodFunction extends ZodType {
|
|
|
3488
2909
|
const me = this;
|
|
3489
2910
|
return OK(async function (...args) {
|
|
3490
2911
|
const error = new ZodError([]);
|
|
3491
|
-
const parsedArgs = await me._def.args
|
|
3492
|
-
.parseAsync(args, params)
|
|
3493
|
-
.catch((e) => {
|
|
2912
|
+
const parsedArgs = await me._def.args.parseAsync(args, params).catch((e) => {
|
|
3494
2913
|
error.addIssue(makeArgsIssue(args, e));
|
|
3495
2914
|
throw error;
|
|
3496
2915
|
});
|
|
@@ -3551,16 +2970,14 @@ class ZodFunction extends ZodType {
|
|
|
3551
2970
|
}
|
|
3552
2971
|
static create(args, returns, params) {
|
|
3553
2972
|
return new ZodFunction({
|
|
3554
|
-
args: (args
|
|
3555
|
-
? args
|
|
3556
|
-
: ZodTuple.create([]).rest(ZodUnknown.create())),
|
|
2973
|
+
args: (args ? args : ZodTuple.create([]).rest(ZodUnknown.create())),
|
|
3557
2974
|
returns: returns || ZodUnknown.create(),
|
|
3558
2975
|
typeName: ZodFirstPartyTypeKind.ZodFunction,
|
|
3559
2976
|
...processCreateParams(params),
|
|
3560
2977
|
});
|
|
3561
2978
|
}
|
|
3562
2979
|
}
|
|
3563
|
-
class ZodLazy extends ZodType {
|
|
2980
|
+
export class ZodLazy extends ZodType {
|
|
3564
2981
|
get schema() {
|
|
3565
2982
|
return this._def.getter();
|
|
3566
2983
|
}
|
|
@@ -3577,7 +2994,7 @@ ZodLazy.create = (getter, params) => {
|
|
|
3577
2994
|
...processCreateParams(params),
|
|
3578
2995
|
});
|
|
3579
2996
|
};
|
|
3580
|
-
class ZodLiteral extends ZodType {
|
|
2997
|
+
export class ZodLiteral extends ZodType {
|
|
3581
2998
|
_parse(input) {
|
|
3582
2999
|
if (input.data !== this._def.value) {
|
|
3583
3000
|
const ctx = this._getOrReturnCtx(input);
|
|
@@ -3608,11 +3025,7 @@ function createZodEnum(values, params) {
|
|
|
3608
3025
|
...processCreateParams(params),
|
|
3609
3026
|
});
|
|
3610
3027
|
}
|
|
3611
|
-
class ZodEnum extends ZodType {
|
|
3612
|
-
constructor() {
|
|
3613
|
-
super(...arguments);
|
|
3614
|
-
_ZodEnum_cache.set(this, void 0);
|
|
3615
|
-
}
|
|
3028
|
+
export class ZodEnum extends ZodType {
|
|
3616
3029
|
_parse(input) {
|
|
3617
3030
|
if (typeof input.data !== "string") {
|
|
3618
3031
|
const ctx = this._getOrReturnCtx(input);
|
|
@@ -3624,10 +3037,10 @@ class ZodEnum extends ZodType {
|
|
|
3624
3037
|
});
|
|
3625
3038
|
return INVALID;
|
|
3626
3039
|
}
|
|
3627
|
-
if (!
|
|
3628
|
-
|
|
3040
|
+
if (!this._cache) {
|
|
3041
|
+
this._cache = new Set(this._def.values);
|
|
3629
3042
|
}
|
|
3630
|
-
if (!
|
|
3043
|
+
if (!this._cache.has(input.data)) {
|
|
3631
3044
|
const ctx = this._getOrReturnCtx(input);
|
|
3632
3045
|
const expectedValues = this._def.values;
|
|
3633
3046
|
addIssueToContext(ctx, {
|
|
@@ -3676,18 +3089,12 @@ class ZodEnum extends ZodType {
|
|
|
3676
3089
|
});
|
|
3677
3090
|
}
|
|
3678
3091
|
}
|
|
3679
|
-
_ZodEnum_cache = new WeakMap();
|
|
3680
3092
|
ZodEnum.create = createZodEnum;
|
|
3681
|
-
class ZodNativeEnum extends ZodType {
|
|
3682
|
-
constructor() {
|
|
3683
|
-
super(...arguments);
|
|
3684
|
-
_ZodNativeEnum_cache.set(this, void 0);
|
|
3685
|
-
}
|
|
3093
|
+
export class ZodNativeEnum extends ZodType {
|
|
3686
3094
|
_parse(input) {
|
|
3687
3095
|
const nativeEnumValues = util.getValidEnumValues(this._def.values);
|
|
3688
3096
|
const ctx = this._getOrReturnCtx(input);
|
|
3689
|
-
if (ctx.parsedType !== ZodParsedType.string &&
|
|
3690
|
-
ctx.parsedType !== ZodParsedType.number) {
|
|
3097
|
+
if (ctx.parsedType !== ZodParsedType.string && ctx.parsedType !== ZodParsedType.number) {
|
|
3691
3098
|
const expectedValues = util.objectValues(nativeEnumValues);
|
|
3692
3099
|
addIssueToContext(ctx, {
|
|
3693
3100
|
expected: util.joinValues(expectedValues),
|
|
@@ -3696,10 +3103,10 @@ class ZodNativeEnum extends ZodType {
|
|
|
3696
3103
|
});
|
|
3697
3104
|
return INVALID;
|
|
3698
3105
|
}
|
|
3699
|
-
if (!
|
|
3700
|
-
|
|
3106
|
+
if (!this._cache) {
|
|
3107
|
+
this._cache = new Set(util.getValidEnumValues(this._def.values));
|
|
3701
3108
|
}
|
|
3702
|
-
if (!
|
|
3109
|
+
if (!this._cache.has(input.data)) {
|
|
3703
3110
|
const expectedValues = util.objectValues(nativeEnumValues);
|
|
3704
3111
|
addIssueToContext(ctx, {
|
|
3705
3112
|
received: ctx.data,
|
|
@@ -3714,7 +3121,6 @@ class ZodNativeEnum extends ZodType {
|
|
|
3714
3121
|
return this._def.values;
|
|
3715
3122
|
}
|
|
3716
3123
|
}
|
|
3717
|
-
_ZodNativeEnum_cache = new WeakMap();
|
|
3718
3124
|
ZodNativeEnum.create = (values, params) => {
|
|
3719
3125
|
return new ZodNativeEnum({
|
|
3720
3126
|
values: values,
|
|
@@ -3722,14 +3128,13 @@ ZodNativeEnum.create = (values, params) => {
|
|
|
3722
3128
|
...processCreateParams(params),
|
|
3723
3129
|
});
|
|
3724
3130
|
};
|
|
3725
|
-
class ZodPromise extends ZodType {
|
|
3131
|
+
export class ZodPromise extends ZodType {
|
|
3726
3132
|
unwrap() {
|
|
3727
3133
|
return this._def.type;
|
|
3728
3134
|
}
|
|
3729
3135
|
_parse(input) {
|
|
3730
3136
|
const { ctx } = this._processInputParams(input);
|
|
3731
|
-
if (ctx.parsedType !== ZodParsedType.promise &&
|
|
3732
|
-
ctx.common.async === false) {
|
|
3137
|
+
if (ctx.parsedType !== ZodParsedType.promise && ctx.common.async === false) {
|
|
3733
3138
|
addIssueToContext(ctx, {
|
|
3734
3139
|
code: ZodIssueCode.invalid_type,
|
|
3735
3140
|
expected: ZodParsedType.promise,
|
|
@@ -3737,9 +3142,7 @@ class ZodPromise extends ZodType {
|
|
|
3737
3142
|
});
|
|
3738
3143
|
return INVALID;
|
|
3739
3144
|
}
|
|
3740
|
-
const promisified = ctx.parsedType === ZodParsedType.promise
|
|
3741
|
-
? ctx.data
|
|
3742
|
-
: Promise.resolve(ctx.data);
|
|
3145
|
+
const promisified = ctx.parsedType === ZodParsedType.promise ? ctx.data : Promise.resolve(ctx.data);
|
|
3743
3146
|
return OK(promisified.then((data) => {
|
|
3744
3147
|
return this._def.type.parseAsync(data, {
|
|
3745
3148
|
path: ctx.path,
|
|
@@ -3755,7 +3158,7 @@ ZodPromise.create = (schema, params) => {
|
|
|
3755
3158
|
...processCreateParams(params),
|
|
3756
3159
|
});
|
|
3757
3160
|
};
|
|
3758
|
-
class ZodEffects extends ZodType {
|
|
3161
|
+
export class ZodEffects extends ZodType {
|
|
3759
3162
|
innerType() {
|
|
3760
3163
|
return this._def.schema;
|
|
3761
3164
|
}
|
|
@@ -3845,9 +3248,7 @@ class ZodEffects extends ZodType {
|
|
|
3845
3248
|
return { status: status.value, value: inner.value };
|
|
3846
3249
|
}
|
|
3847
3250
|
else {
|
|
3848
|
-
return this._def.schema
|
|
3849
|
-
._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx })
|
|
3850
|
-
.then((inner) => {
|
|
3251
|
+
return this._def.schema._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx }).then((inner) => {
|
|
3851
3252
|
if (inner.status === "aborted")
|
|
3852
3253
|
return INVALID;
|
|
3853
3254
|
if (inner.status === "dirty")
|
|
@@ -3866,7 +3267,7 @@ class ZodEffects extends ZodType {
|
|
|
3866
3267
|
parent: ctx,
|
|
3867
3268
|
});
|
|
3868
3269
|
if (!isValid(base))
|
|
3869
|
-
return
|
|
3270
|
+
return INVALID;
|
|
3870
3271
|
const result = effect.transform(base.value, checkCtx);
|
|
3871
3272
|
if (result instanceof Promise) {
|
|
3872
3273
|
throw new Error(`Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.`);
|
|
@@ -3874,12 +3275,13 @@ class ZodEffects extends ZodType {
|
|
|
3874
3275
|
return { status: status.value, value: result };
|
|
3875
3276
|
}
|
|
3876
3277
|
else {
|
|
3877
|
-
return this._def.schema
|
|
3878
|
-
._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx })
|
|
3879
|
-
.then((base) => {
|
|
3278
|
+
return this._def.schema._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx }).then((base) => {
|
|
3880
3279
|
if (!isValid(base))
|
|
3881
|
-
return
|
|
3882
|
-
return Promise.resolve(effect.transform(base.value, checkCtx)).then((result) => ({
|
|
3280
|
+
return INVALID;
|
|
3281
|
+
return Promise.resolve(effect.transform(base.value, checkCtx)).then((result) => ({
|
|
3282
|
+
status: status.value,
|
|
3283
|
+
value: result,
|
|
3284
|
+
}));
|
|
3883
3285
|
});
|
|
3884
3286
|
}
|
|
3885
3287
|
}
|
|
@@ -3902,7 +3304,8 @@ ZodEffects.createWithPreprocess = (preprocess, schema, params) => {
|
|
|
3902
3304
|
...processCreateParams(params),
|
|
3903
3305
|
});
|
|
3904
3306
|
};
|
|
3905
|
-
|
|
3307
|
+
export { ZodEffects as ZodTransformer };
|
|
3308
|
+
export class ZodOptional extends ZodType {
|
|
3906
3309
|
_parse(input) {
|
|
3907
3310
|
const parsedType = this._getType(input);
|
|
3908
3311
|
if (parsedType === ZodParsedType.undefined) {
|
|
@@ -3921,7 +3324,7 @@ ZodOptional.create = (type, params) => {
|
|
|
3921
3324
|
...processCreateParams(params),
|
|
3922
3325
|
});
|
|
3923
3326
|
};
|
|
3924
|
-
class ZodNullable extends ZodType {
|
|
3327
|
+
export class ZodNullable extends ZodType {
|
|
3925
3328
|
_parse(input) {
|
|
3926
3329
|
const parsedType = this._getType(input);
|
|
3927
3330
|
if (parsedType === ZodParsedType.null) {
|
|
@@ -3940,7 +3343,7 @@ ZodNullable.create = (type, params) => {
|
|
|
3940
3343
|
...processCreateParams(params),
|
|
3941
3344
|
});
|
|
3942
3345
|
};
|
|
3943
|
-
class ZodDefault extends ZodType {
|
|
3346
|
+
export class ZodDefault extends ZodType {
|
|
3944
3347
|
_parse(input) {
|
|
3945
3348
|
const { ctx } = this._processInputParams(input);
|
|
3946
3349
|
let data = ctx.data;
|
|
@@ -3961,13 +3364,11 @@ ZodDefault.create = (type, params) => {
|
|
|
3961
3364
|
return new ZodDefault({
|
|
3962
3365
|
innerType: type,
|
|
3963
3366
|
typeName: ZodFirstPartyTypeKind.ZodDefault,
|
|
3964
|
-
defaultValue: typeof params.default === "function"
|
|
3965
|
-
? params.default
|
|
3966
|
-
: () => params.default,
|
|
3367
|
+
defaultValue: typeof params.default === "function" ? params.default : () => params.default,
|
|
3967
3368
|
...processCreateParams(params),
|
|
3968
3369
|
});
|
|
3969
3370
|
};
|
|
3970
|
-
class ZodCatch extends ZodType {
|
|
3371
|
+
export class ZodCatch extends ZodType {
|
|
3971
3372
|
_parse(input) {
|
|
3972
3373
|
const { ctx } = this._processInputParams(input);
|
|
3973
3374
|
// newCtx is used to not collect issues from inner types in ctx
|
|
@@ -4026,7 +3427,7 @@ ZodCatch.create = (type, params) => {
|
|
|
4026
3427
|
...processCreateParams(params),
|
|
4027
3428
|
});
|
|
4028
3429
|
};
|
|
4029
|
-
class ZodNaN extends ZodType {
|
|
3430
|
+
export class ZodNaN extends ZodType {
|
|
4030
3431
|
_parse(input) {
|
|
4031
3432
|
const parsedType = this._getType(input);
|
|
4032
3433
|
if (parsedType !== ZodParsedType.nan) {
|
|
@@ -4047,8 +3448,8 @@ ZodNaN.create = (params) => {
|
|
|
4047
3448
|
...processCreateParams(params),
|
|
4048
3449
|
});
|
|
4049
3450
|
};
|
|
4050
|
-
const BRAND = Symbol("zod_brand");
|
|
4051
|
-
class ZodBranded extends ZodType {
|
|
3451
|
+
export const BRAND = Symbol("zod_brand");
|
|
3452
|
+
export class ZodBranded extends ZodType {
|
|
4052
3453
|
_parse(input) {
|
|
4053
3454
|
const { ctx } = this._processInputParams(input);
|
|
4054
3455
|
const data = ctx.data;
|
|
@@ -4062,7 +3463,7 @@ class ZodBranded extends ZodType {
|
|
|
4062
3463
|
return this._def.type;
|
|
4063
3464
|
}
|
|
4064
3465
|
}
|
|
4065
|
-
class ZodPipeline extends ZodType {
|
|
3466
|
+
export class ZodPipeline extends ZodType {
|
|
4066
3467
|
_parse(input) {
|
|
4067
3468
|
const { status, ctx } = this._processInputParams(input);
|
|
4068
3469
|
if (ctx.common.async) {
|
|
@@ -4120,7 +3521,7 @@ class ZodPipeline extends ZodType {
|
|
|
4120
3521
|
});
|
|
4121
3522
|
}
|
|
4122
3523
|
}
|
|
4123
|
-
class ZodReadonly extends ZodType {
|
|
3524
|
+
export class ZodReadonly extends ZodType {
|
|
4124
3525
|
_parse(input) {
|
|
4125
3526
|
const result = this._def.innerType._parse(input);
|
|
4126
3527
|
const freeze = (data) => {
|
|
@@ -4129,9 +3530,7 @@ class ZodReadonly extends ZodType {
|
|
|
4129
3530
|
}
|
|
4130
3531
|
return data;
|
|
4131
3532
|
};
|
|
4132
|
-
return isAsync(result)
|
|
4133
|
-
? result.then((data) => freeze(data))
|
|
4134
|
-
: freeze(result);
|
|
3533
|
+
return isAsync(result) ? result.then((data) => freeze(data)) : freeze(result);
|
|
4135
3534
|
}
|
|
4136
3535
|
unwrap() {
|
|
4137
3536
|
return this._def.innerType;
|
|
@@ -4152,15 +3551,11 @@ ZodReadonly.create = (type, params) => {
|
|
|
4152
3551
|
////////////////////////////////////////
|
|
4153
3552
|
////////////////////////////////////////
|
|
4154
3553
|
function cleanParams(params, data) {
|
|
4155
|
-
const p = typeof params === "function"
|
|
4156
|
-
? params(data)
|
|
4157
|
-
: typeof params === "string"
|
|
4158
|
-
? { message: params }
|
|
4159
|
-
: params;
|
|
3554
|
+
const p = typeof params === "function" ? params(data) : typeof params === "string" ? { message: params } : params;
|
|
4160
3555
|
const p2 = typeof p === "string" ? { message: p } : p;
|
|
4161
3556
|
return p2;
|
|
4162
3557
|
}
|
|
4163
|
-
function custom(check, _params = {},
|
|
3558
|
+
export function custom(check, _params = {},
|
|
4164
3559
|
/**
|
|
4165
3560
|
* @deprecated
|
|
4166
3561
|
*
|
|
@@ -4174,31 +3569,30 @@ function custom(check, _params = {},
|
|
|
4174
3569
|
fatal) {
|
|
4175
3570
|
if (check)
|
|
4176
3571
|
return ZodAny.create().superRefine((data, ctx) => {
|
|
4177
|
-
var _a, _b;
|
|
4178
3572
|
const r = check(data);
|
|
4179
3573
|
if (r instanceof Promise) {
|
|
4180
3574
|
return r.then((r) => {
|
|
4181
|
-
var _a, _b;
|
|
4182
3575
|
if (!r) {
|
|
4183
3576
|
const params = cleanParams(_params, data);
|
|
4184
|
-
const _fatal =
|
|
3577
|
+
const _fatal = params.fatal ?? fatal ?? true;
|
|
4185
3578
|
ctx.addIssue({ code: "custom", ...params, fatal: _fatal });
|
|
4186
3579
|
}
|
|
4187
3580
|
});
|
|
4188
3581
|
}
|
|
4189
3582
|
if (!r) {
|
|
4190
3583
|
const params = cleanParams(_params, data);
|
|
4191
|
-
const _fatal =
|
|
3584
|
+
const _fatal = params.fatal ?? fatal ?? true;
|
|
4192
3585
|
ctx.addIssue({ code: "custom", ...params, fatal: _fatal });
|
|
4193
3586
|
}
|
|
4194
3587
|
return;
|
|
4195
3588
|
});
|
|
4196
3589
|
return ZodAny.create();
|
|
4197
3590
|
}
|
|
4198
|
-
|
|
3591
|
+
export { ZodType as Schema, ZodType as ZodSchema };
|
|
3592
|
+
export const late = {
|
|
4199
3593
|
object: ZodObject.lazycreate,
|
|
4200
3594
|
};
|
|
4201
|
-
var ZodFirstPartyTypeKind;
|
|
3595
|
+
export var ZodFirstPartyTypeKind;
|
|
4202
3596
|
(function (ZodFirstPartyTypeKind) {
|
|
4203
3597
|
ZodFirstPartyTypeKind["ZodString"] = "ZodString";
|
|
4204
3598
|
ZodFirstPartyTypeKind["ZodNumber"] = "ZodNumber";
|
|
@@ -4237,6 +3631,10 @@ var ZodFirstPartyTypeKind;
|
|
|
4237
3631
|
ZodFirstPartyTypeKind["ZodPipeline"] = "ZodPipeline";
|
|
4238
3632
|
ZodFirstPartyTypeKind["ZodReadonly"] = "ZodReadonly";
|
|
4239
3633
|
})(ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {}));
|
|
3634
|
+
// requires TS 4.4+
|
|
3635
|
+
class Class {
|
|
3636
|
+
constructor(..._) { }
|
|
3637
|
+
}
|
|
4240
3638
|
const instanceOfType = (
|
|
4241
3639
|
// const instanceOfType = <T extends new (...args: any[]) => any>(
|
|
4242
3640
|
cls, params = {
|
|
@@ -4279,7 +3677,7 @@ const pipelineType = ZodPipeline.create;
|
|
|
4279
3677
|
const ostring = () => stringType().optional();
|
|
4280
3678
|
const onumber = () => numberType().optional();
|
|
4281
3679
|
const oboolean = () => booleanType().optional();
|
|
4282
|
-
const coerce = {
|
|
3680
|
+
export const coerce = {
|
|
4283
3681
|
string: ((arg) => ZodString.create({ ...arg, coerce: true })),
|
|
4284
3682
|
number: ((arg) => ZodNumber.create({ ...arg, coerce: true })),
|
|
4285
3683
|
boolean: ((arg) => ZodBoolean.create({
|
|
@@ -4289,117 +3687,5 @@ const coerce = {
|
|
|
4289
3687
|
bigint: ((arg) => ZodBigInt.create({ ...arg, coerce: true })),
|
|
4290
3688
|
date: ((arg) => ZodDate.create({ ...arg, coerce: true })),
|
|
4291
3689
|
};
|
|
4292
|
-
|
|
4293
|
-
|
|
4294
|
-
var z = /*#__PURE__*/Object.freeze({
|
|
4295
|
-
__proto__: null,
|
|
4296
|
-
defaultErrorMap: errorMap,
|
|
4297
|
-
setErrorMap: setErrorMap,
|
|
4298
|
-
getErrorMap: getErrorMap,
|
|
4299
|
-
makeIssue: makeIssue,
|
|
4300
|
-
EMPTY_PATH: EMPTY_PATH,
|
|
4301
|
-
addIssueToContext: addIssueToContext,
|
|
4302
|
-
ParseStatus: ParseStatus,
|
|
4303
|
-
INVALID: INVALID,
|
|
4304
|
-
DIRTY: DIRTY,
|
|
4305
|
-
OK: OK,
|
|
4306
|
-
isAborted: isAborted,
|
|
4307
|
-
isDirty: isDirty,
|
|
4308
|
-
isValid: isValid,
|
|
4309
|
-
isAsync: isAsync,
|
|
4310
|
-
get util () { return util; },
|
|
4311
|
-
get objectUtil () { return objectUtil; },
|
|
4312
|
-
ZodParsedType: ZodParsedType,
|
|
4313
|
-
getParsedType: getParsedType,
|
|
4314
|
-
ZodType: ZodType,
|
|
4315
|
-
datetimeRegex: datetimeRegex,
|
|
4316
|
-
ZodString: ZodString,
|
|
4317
|
-
ZodNumber: ZodNumber,
|
|
4318
|
-
ZodBigInt: ZodBigInt,
|
|
4319
|
-
ZodBoolean: ZodBoolean,
|
|
4320
|
-
ZodDate: ZodDate,
|
|
4321
|
-
ZodSymbol: ZodSymbol,
|
|
4322
|
-
ZodUndefined: ZodUndefined,
|
|
4323
|
-
ZodNull: ZodNull,
|
|
4324
|
-
ZodAny: ZodAny,
|
|
4325
|
-
ZodUnknown: ZodUnknown,
|
|
4326
|
-
ZodNever: ZodNever,
|
|
4327
|
-
ZodVoid: ZodVoid,
|
|
4328
|
-
ZodArray: ZodArray,
|
|
4329
|
-
ZodObject: ZodObject,
|
|
4330
|
-
ZodUnion: ZodUnion,
|
|
4331
|
-
ZodDiscriminatedUnion: ZodDiscriminatedUnion,
|
|
4332
|
-
ZodIntersection: ZodIntersection,
|
|
4333
|
-
ZodTuple: ZodTuple,
|
|
4334
|
-
ZodRecord: ZodRecord,
|
|
4335
|
-
ZodMap: ZodMap,
|
|
4336
|
-
ZodSet: ZodSet,
|
|
4337
|
-
ZodFunction: ZodFunction,
|
|
4338
|
-
ZodLazy: ZodLazy,
|
|
4339
|
-
ZodLiteral: ZodLiteral,
|
|
4340
|
-
ZodEnum: ZodEnum,
|
|
4341
|
-
ZodNativeEnum: ZodNativeEnum,
|
|
4342
|
-
ZodPromise: ZodPromise,
|
|
4343
|
-
ZodEffects: ZodEffects,
|
|
4344
|
-
ZodTransformer: ZodEffects,
|
|
4345
|
-
ZodOptional: ZodOptional,
|
|
4346
|
-
ZodNullable: ZodNullable,
|
|
4347
|
-
ZodDefault: ZodDefault,
|
|
4348
|
-
ZodCatch: ZodCatch,
|
|
4349
|
-
ZodNaN: ZodNaN,
|
|
4350
|
-
BRAND: BRAND,
|
|
4351
|
-
ZodBranded: ZodBranded,
|
|
4352
|
-
ZodPipeline: ZodPipeline,
|
|
4353
|
-
ZodReadonly: ZodReadonly,
|
|
4354
|
-
custom: custom,
|
|
4355
|
-
Schema: ZodType,
|
|
4356
|
-
ZodSchema: ZodType,
|
|
4357
|
-
late: late,
|
|
4358
|
-
get ZodFirstPartyTypeKind () { return ZodFirstPartyTypeKind; },
|
|
4359
|
-
coerce: coerce,
|
|
4360
|
-
any: anyType,
|
|
4361
|
-
array: arrayType,
|
|
4362
|
-
bigint: bigIntType,
|
|
4363
|
-
boolean: booleanType,
|
|
4364
|
-
date: dateType,
|
|
4365
|
-
discriminatedUnion: discriminatedUnionType,
|
|
4366
|
-
effect: effectsType,
|
|
4367
|
-
'enum': enumType,
|
|
4368
|
-
'function': functionType,
|
|
4369
|
-
'instanceof': instanceOfType,
|
|
4370
|
-
intersection: intersectionType,
|
|
4371
|
-
lazy: lazyType,
|
|
4372
|
-
literal: literalType,
|
|
4373
|
-
map: mapType,
|
|
4374
|
-
nan: nanType,
|
|
4375
|
-
nativeEnum: nativeEnumType,
|
|
4376
|
-
never: neverType,
|
|
4377
|
-
'null': nullType,
|
|
4378
|
-
nullable: nullableType,
|
|
4379
|
-
number: numberType,
|
|
4380
|
-
object: objectType,
|
|
4381
|
-
oboolean: oboolean,
|
|
4382
|
-
onumber: onumber,
|
|
4383
|
-
optional: optionalType,
|
|
4384
|
-
ostring: ostring,
|
|
4385
|
-
pipeline: pipelineType,
|
|
4386
|
-
preprocess: preprocessType,
|
|
4387
|
-
promise: promiseType,
|
|
4388
|
-
record: recordType,
|
|
4389
|
-
set: setType,
|
|
4390
|
-
strictObject: strictObjectType,
|
|
4391
|
-
string: stringType,
|
|
4392
|
-
symbol: symbolType,
|
|
4393
|
-
transformer: effectsType,
|
|
4394
|
-
tuple: tupleType,
|
|
4395
|
-
'undefined': undefinedType,
|
|
4396
|
-
union: unionType,
|
|
4397
|
-
unknown: unknownType,
|
|
4398
|
-
'void': voidType,
|
|
4399
|
-
NEVER: NEVER,
|
|
4400
|
-
ZodIssueCode: ZodIssueCode,
|
|
4401
|
-
quotelessJson: quotelessJson,
|
|
4402
|
-
ZodError: ZodError
|
|
4403
|
-
});
|
|
4404
|
-
|
|
4405
|
-
export { BRAND, DIRTY, EMPTY_PATH, INVALID, NEVER, OK, ParseStatus, ZodType as Schema, ZodAny, ZodArray, ZodBigInt, ZodBoolean, ZodBranded, ZodCatch, ZodDate, ZodDefault, ZodDiscriminatedUnion, ZodEffects, ZodEnum, ZodError, ZodFirstPartyTypeKind, ZodFunction, ZodIntersection, ZodIssueCode, ZodLazy, ZodLiteral, ZodMap, ZodNaN, ZodNativeEnum, ZodNever, ZodNull, ZodNullable, ZodNumber, ZodObject, ZodOptional, ZodParsedType, ZodPipeline, ZodPromise, ZodReadonly, ZodRecord, ZodType as ZodSchema, ZodSet, ZodString, ZodSymbol, ZodEffects as ZodTransformer, ZodTuple, ZodType, ZodUndefined, ZodUnion, ZodUnknown, ZodVoid, addIssueToContext, anyType as any, arrayType as array, bigIntType as bigint, booleanType as boolean, coerce, custom, dateType as date, datetimeRegex, z as default, errorMap as defaultErrorMap, discriminatedUnionType as discriminatedUnion, effectsType as effect, enumType as enum, functionType as function, getErrorMap, getParsedType, instanceOfType as instanceof, intersectionType as intersection, isAborted, isAsync, isDirty, isValid, late, lazyType as lazy, literalType as literal, makeIssue, mapType as map, nanType as nan, nativeEnumType as nativeEnum, neverType as never, nullType as null, nullableType as nullable, numberType as number, objectType as object, objectUtil, oboolean, onumber, optionalType as optional, ostring, pipelineType as pipeline, preprocessType as preprocess, promiseType as promise, quotelessJson, recordType as record, setType as set, setErrorMap, strictObjectType as strictObject, stringType as string, symbolType as symbol, effectsType as transformer, tupleType as tuple, undefinedType as undefined, unionType as union, unknownType as unknown, util, voidType as void, z };
|
|
3690
|
+
export { anyType as any, arrayType as array, bigIntType as bigint, booleanType as boolean, dateType as date, discriminatedUnionType as discriminatedUnion, effectsType as effect, enumType as enum, functionType as function, instanceOfType as instanceof, intersectionType as intersection, lazyType as lazy, literalType as literal, mapType as map, nanType as nan, nativeEnumType as nativeEnum, neverType as never, nullType as null, nullableType as nullable, numberType as number, objectType as object, oboolean, onumber, optionalType as optional, ostring, pipelineType as pipeline, preprocessType as preprocess, promiseType as promise, recordType as record, setType as set, strictObjectType as strictObject, stringType as string, symbolType as symbol, effectsType as transformer, tupleType as tuple, undefinedType as undefined, unionType as union, unknownType as unknown, voidType as void, };
|
|
3691
|
+
export const NEVER = INVALID;
|