@xenosystem/agent-cli 0.5.135 → 0.5.136
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +1 -1
- package/dist/index.js +1787 -1787
- package/dist/metafile-esm.json +1 -1
- package/dist/sdk-build-identity.json +28 -28
- package/node_modules/@xeno-corporation/account/README.md +24 -0
- package/node_modules/@xeno-corporation/account/dist/client-CVtf6u7F.d.mts +2346 -0
- package/node_modules/@xeno-corporation/account/dist/client-CVtf6u7F.d.ts +2346 -0
- package/node_modules/@xeno-corporation/account/dist/index.d.mts +36 -809
- package/node_modules/@xeno-corporation/account/dist/index.d.ts +36 -809
- package/node_modules/@xeno-corporation/account/dist/index.js +1808 -33
- package/node_modules/@xeno-corporation/account/dist/index.js.map +1 -1
- package/node_modules/@xeno-corporation/account/dist/index.mjs +1769 -32
- package/node_modules/@xeno-corporation/account/dist/index.mjs.map +1 -1
- package/node_modules/@xeno-corporation/account/dist/node.d.mts +25 -2
- package/node_modules/@xeno-corporation/account/dist/node.d.ts +25 -2
- package/node_modules/@xeno-corporation/account/dist/node.js +192 -33
- package/node_modules/@xeno-corporation/account/dist/node.js.map +1 -1
- package/node_modules/@xeno-corporation/account/dist/node.mjs +157 -1
- package/node_modules/@xeno-corporation/account/dist/node.mjs.map +1 -1
- package/node_modules/@xeno-corporation/account/package.json +2 -2
- package/node_modules/zod/LICENSE +1 -1
- package/node_modules/zod/README.md +110 -2920
- package/node_modules/zod/compile.cjs +96 -0
- package/node_modules/zod/compile.d.ts +1 -0
- package/node_modules/zod/compile.js +52 -0
- package/node_modules/zod/index.cjs +52 -0
- package/node_modules/zod/index.d.cts +3 -0
- package/node_modules/zod/index.d.ts +3 -2
- package/node_modules/zod/index.js +7 -0
- package/node_modules/zod/{lib/external.js → locales/index.cjs} +20 -6
- package/node_modules/zod/locales/index.d.cts +1 -0
- package/node_modules/zod/locales/index.d.ts +1 -0
- package/node_modules/zod/locales/index.js +1 -0
- package/node_modules/zod/locales/package.json +7 -0
- package/node_modules/zod/mini/index.cjs +51 -0
- package/node_modules/zod/mini/index.d.cts +3 -0
- package/node_modules/zod/mini/index.d.ts +3 -0
- package/node_modules/zod/mini/index.js +3 -0
- package/node_modules/zod/mini/package.json +7 -0
- package/node_modules/zod/package.json +127 -102
- package/node_modules/zod/src/compile.ts +56 -0
- package/node_modules/zod/src/index.ts +7 -0
- package/node_modules/zod/src/locales/index.ts +1 -0
- package/node_modules/zod/src/mini/index.ts +3 -0
- package/node_modules/zod/src/v3/ZodError.ts +340 -0
- package/node_modules/zod/src/v3/benchmarks/datetime.ts +58 -0
- package/node_modules/zod/src/v3/benchmarks/discriminatedUnion.ts +80 -0
- package/node_modules/zod/src/v3/benchmarks/index.ts +59 -0
- package/node_modules/zod/src/v3/benchmarks/ipv4.ts +57 -0
- package/node_modules/zod/src/v3/benchmarks/object.ts +69 -0
- package/node_modules/zod/src/v3/benchmarks/primitives.ts +162 -0
- package/node_modules/zod/src/v3/benchmarks/realworld.ts +63 -0
- package/node_modules/zod/src/v3/benchmarks/string.ts +55 -0
- package/node_modules/zod/src/v3/benchmarks/union.ts +80 -0
- package/node_modules/zod/src/v3/errors.ts +13 -0
- package/node_modules/zod/src/v3/external.ts +6 -0
- package/node_modules/zod/src/v3/helpers/enumUtil.ts +17 -0
- package/node_modules/zod/src/v3/helpers/errorUtil.ts +8 -0
- package/node_modules/zod/src/v3/helpers/parseUtil.ts +176 -0
- package/node_modules/zod/src/v3/helpers/partialUtil.ts +34 -0
- package/node_modules/zod/src/v3/helpers/util.ts +224 -0
- package/node_modules/zod/src/v3/index.ts +4 -0
- package/node_modules/zod/src/v3/locales/en.ts +124 -0
- package/node_modules/zod/src/v3/standard-schema.ts +113 -0
- package/node_modules/zod/src/v3/tests/Mocker.ts +54 -0
- package/node_modules/zod/src/v3/tests/all-errors.test.ts +157 -0
- package/node_modules/zod/src/v3/tests/anyunknown.test.ts +28 -0
- package/node_modules/zod/src/v3/tests/array.test.ts +71 -0
- package/node_modules/zod/src/v3/tests/async-parsing.test.ts +388 -0
- package/node_modules/zod/src/v3/tests/async-refinements.test.ts +46 -0
- package/node_modules/zod/src/v3/tests/base.test.ts +29 -0
- package/node_modules/zod/src/v3/tests/bigint.test.ts +55 -0
- package/node_modules/zod/src/v3/tests/branded.test.ts +53 -0
- package/node_modules/zod/src/v3/tests/catch.test.ts +220 -0
- package/node_modules/zod/src/v3/tests/coerce.test.ts +133 -0
- package/node_modules/zod/src/v3/tests/complex.test.ts +70 -0
- package/node_modules/zod/src/v3/tests/custom.test.ts +31 -0
- package/node_modules/zod/src/v3/tests/date.test.ts +32 -0
- package/node_modules/zod/src/v3/tests/deepmasking.test.ts +186 -0
- package/node_modules/zod/src/v3/tests/default.test.ts +112 -0
- package/node_modules/zod/src/v3/tests/description.test.ts +33 -0
- package/node_modules/zod/src/v3/tests/discriminated-unions.test.ts +315 -0
- package/node_modules/zod/src/v3/tests/enum.test.ts +80 -0
- package/node_modules/zod/src/v3/tests/error.test.ts +586 -0
- package/node_modules/zod/src/v3/tests/firstparty.test.ts +87 -0
- package/node_modules/zod/src/v3/tests/firstpartyschematypes.test.ts +21 -0
- package/node_modules/zod/src/v3/tests/function.test.ts +261 -0
- package/node_modules/zod/src/v3/tests/generics.test.ts +48 -0
- package/node_modules/zod/src/v3/tests/instanceof.test.ts +37 -0
- package/node_modules/zod/src/v3/tests/intersection.test.ts +128 -0
- package/node_modules/zod/src/v3/tests/language-server.source.ts +76 -0
- package/node_modules/zod/src/v3/tests/language-server.test.ts +206 -0
- package/node_modules/zod/src/v3/tests/literal.test.ts +36 -0
- package/node_modules/zod/src/v3/tests/map.test.ts +110 -0
- package/node_modules/zod/src/v3/tests/masking.test.ts +4 -0
- package/node_modules/zod/src/v3/tests/mocker.test.ts +19 -0
- package/node_modules/zod/src/v3/tests/nan.test.ts +24 -0
- package/node_modules/zod/src/v3/tests/nativeEnum.test.ts +87 -0
- package/node_modules/zod/src/v3/tests/nullable.test.ts +42 -0
- package/node_modules/zod/src/v3/tests/number.test.ts +176 -0
- package/node_modules/zod/src/v3/tests/object-augmentation.test.ts +29 -0
- package/node_modules/zod/src/v3/tests/object-in-es5-env.test.ts +29 -0
- package/node_modules/zod/src/v3/tests/object.test.ts +431 -0
- package/node_modules/zod/src/v3/tests/optional.test.ts +42 -0
- package/node_modules/zod/src/v3/tests/parseUtil.test.ts +23 -0
- package/node_modules/zod/src/v3/tests/parser.test.ts +41 -0
- package/node_modules/zod/src/v3/tests/partials.test.ts +243 -0
- package/node_modules/zod/src/v3/tests/pickomit.test.ts +111 -0
- package/node_modules/zod/src/v3/tests/pipeline.test.ts +29 -0
- package/node_modules/zod/src/v3/tests/preprocess.test.ts +186 -0
- package/node_modules/zod/src/v3/tests/primitive.test.ts +440 -0
- package/node_modules/zod/src/v3/tests/promise.test.ts +90 -0
- package/node_modules/zod/src/v3/tests/readonly.test.ts +114 -0
- package/node_modules/zod/src/v3/tests/record.test.ts +171 -0
- package/node_modules/zod/src/v3/tests/recursive.test.ts +197 -0
- package/node_modules/zod/src/v3/tests/refine.test.ts +313 -0
- package/node_modules/zod/src/v3/tests/safeparse.test.ts +27 -0
- package/node_modules/zod/src/v3/tests/set.test.ts +142 -0
- package/node_modules/zod/src/v3/tests/standard-schema.test.ts +83 -0
- package/node_modules/zod/src/v3/tests/string.test.ts +922 -0
- package/node_modules/zod/src/v3/tests/transformer.test.ts +233 -0
- package/node_modules/zod/src/v3/tests/tuple.test.ts +90 -0
- package/node_modules/zod/src/v3/tests/unions.test.ts +57 -0
- package/node_modules/zod/src/v3/tests/validations.test.ts +133 -0
- package/node_modules/zod/src/v3/tests/void.test.ts +15 -0
- package/node_modules/zod/src/v3/types.ts +5138 -0
- package/node_modules/zod/src/v4/classic/checks.ts +33 -0
- package/node_modules/zod/src/v4/classic/coerce.ts +27 -0
- package/node_modules/zod/src/v4/classic/compat.ts +78 -0
- package/node_modules/zod/src/v4/classic/deep-partial.ts +76 -0
- package/node_modules/zod/src/v4/classic/errors.ts +97 -0
- package/node_modules/zod/src/v4/classic/external.ts +57 -0
- package/node_modules/zod/src/v4/classic/from-json-schema.ts +944 -0
- package/node_modules/zod/src/v4/classic/in-out.ts +45 -0
- package/node_modules/zod/src/v4/classic/index.ts +5 -0
- package/node_modules/zod/src/v4/classic/iso.ts +20 -0
- package/node_modules/zod/src/v4/classic/parse.ts +88 -0
- package/node_modules/zod/src/v4/classic/schemas.ts +2937 -0
- package/node_modules/zod/src/v4/classic/tests/anyunknown.test.ts +26 -0
- package/node_modules/zod/src/v4/classic/tests/apply.test.ts +86 -0
- package/node_modules/zod/src/v4/classic/tests/array.test.ts +291 -0
- package/node_modules/zod/src/v4/classic/tests/assignability.test.ts +402 -0
- package/node_modules/zod/src/v4/classic/tests/async-parsing.test.ts +381 -0
- package/node_modules/zod/src/v4/classic/tests/async-refinements.test.ts +68 -0
- package/node_modules/zod/src/v4/classic/tests/base.test.ts +7 -0
- package/node_modules/zod/src/v4/classic/tests/bigint.test.ts +89 -0
- package/node_modules/zod/src/v4/classic/tests/brand.test.ts +106 -0
- package/node_modules/zod/src/v4/classic/tests/catch.test.ts +604 -0
- package/node_modules/zod/src/v4/classic/tests/coalesce.test.ts +20 -0
- package/node_modules/zod/src/v4/classic/tests/codec-examples.test.ts +572 -0
- package/node_modules/zod/src/v4/classic/tests/codec.test.ts +704 -0
- package/node_modules/zod/src/v4/classic/tests/coerce.test.ts +160 -0
- package/node_modules/zod/src/v4/classic/tests/continuability.test.ts +374 -0
- package/node_modules/zod/src/v4/classic/tests/credit-card.test.ts +76 -0
- package/node_modules/zod/src/v4/classic/tests/custom.test.ts +40 -0
- package/node_modules/zod/src/v4/classic/tests/cyclic-data.test.ts +985 -0
- package/node_modules/zod/src/v4/classic/tests/date.test.ts +92 -0
- package/node_modules/zod/src/v4/classic/tests/datetime.test.ts +316 -0
- package/node_modules/zod/src/v4/classic/tests/deep-partial.test.ts +380 -0
- package/node_modules/zod/src/v4/classic/tests/default-locale.test.ts +32 -0
- package/node_modules/zod/src/v4/classic/tests/default.test.ts +455 -0
- package/node_modules/zod/src/v4/classic/tests/describe-meta-checks.test.ts +27 -0
- package/node_modules/zod/src/v4/classic/tests/description.test.ts +32 -0
- package/node_modules/zod/src/v4/classic/tests/detached-methods.test.ts +221 -0
- package/node_modules/zod/src/v4/classic/tests/discriminated-unions.test.ts +942 -0
- package/node_modules/zod/src/v4/classic/tests/enum.test.ts +305 -0
- package/node_modules/zod/src/v4/classic/tests/error-utils.test.ts +917 -0
- package/node_modules/zod/src/v4/classic/tests/error.test.ts +1108 -0
- package/node_modules/zod/src/v4/classic/tests/file.test.ts +96 -0
- package/node_modules/zod/src/v4/classic/tests/firstparty.test.ts +179 -0
- package/node_modules/zod/src/v4/classic/tests/fix-json-issue.test.ts +26 -0
- package/node_modules/zod/src/v4/classic/tests/from-json-schema.test.ts +1467 -0
- package/node_modules/zod/src/v4/classic/tests/function.test.ts +391 -0
- package/node_modules/zod/src/v4/classic/tests/generics.test.ts +72 -0
- package/node_modules/zod/src/v4/classic/tests/global-config.test.ts +32 -0
- package/node_modules/zod/src/v4/classic/tests/hash.test.ts +67 -0
- package/node_modules/zod/src/v4/classic/tests/iban.test.ts +81 -0
- package/node_modules/zod/src/v4/classic/tests/in-out.test.ts +159 -0
- package/node_modules/zod/src/v4/classic/tests/index.test.ts +958 -0
- package/node_modules/zod/src/v4/classic/tests/instance-footprint.test.ts +319 -0
- package/node_modules/zod/src/v4/classic/tests/instanceof.test.ts +127 -0
- package/node_modules/zod/src/v4/classic/tests/intersection.test.ts +334 -0
- package/node_modules/zod/src/v4/classic/tests/issue-schema.test.ts +215 -0
- package/node_modules/zod/src/v4/classic/tests/jitless-allows-eval.test.ts +39 -0
- package/node_modules/zod/src/v4/classic/tests/json.test.ts +109 -0
- package/node_modules/zod/src/v4/classic/tests/lazy.test.ts +262 -0
- package/node_modules/zod/src/v4/classic/tests/literal.test.ts +128 -0
- package/node_modules/zod/src/v4/classic/tests/locales_ka.test.ts +29 -0
- package/node_modules/zod/src/v4/classic/tests/locales_ro.test.ts +24 -0
- package/node_modules/zod/src/v4/classic/tests/map.test.ts +349 -0
- package/node_modules/zod/src/v4/classic/tests/nan.test.ts +21 -0
- package/node_modules/zod/src/v4/classic/tests/nested-refine.test.ts +168 -0
- package/node_modules/zod/src/v4/classic/tests/nonoptional.test.ts +101 -0
- package/node_modules/zod/src/v4/classic/tests/nullable.test.ts +22 -0
- package/node_modules/zod/src/v4/classic/tests/number.test.ts +401 -0
- package/node_modules/zod/src/v4/classic/tests/object.test.ts +1006 -0
- package/node_modules/zod/src/v4/classic/tests/optin-ladder.test.ts +235 -0
- package/node_modules/zod/src/v4/classic/tests/optional.test.ts +366 -0
- package/node_modules/zod/src/v4/classic/tests/partial.test.ts +497 -0
- package/node_modules/zod/src/v4/classic/tests/pickomit.test.ts +211 -0
- package/node_modules/zod/src/v4/classic/tests/pipe.test.ts +101 -0
- package/node_modules/zod/src/v4/classic/tests/prefault.test.ts +144 -0
- package/node_modules/zod/src/v4/classic/tests/preprocess-types.test.ts +44 -0
- package/node_modules/zod/src/v4/classic/tests/preprocess.test.ts +351 -0
- package/node_modules/zod/src/v4/classic/tests/primitive.test.ts +175 -0
- package/node_modules/zod/src/v4/classic/tests/promise.test.ts +81 -0
- package/node_modules/zod/src/v4/classic/tests/properties.test.ts +141 -0
- package/node_modules/zod/src/v4/classic/tests/prototypes.test.ts +23 -0
- package/node_modules/zod/src/v4/classic/tests/readonly.test.ts +184 -0
- package/node_modules/zod/src/v4/classic/tests/record.test.ts +885 -0
- package/node_modules/zod/src/v4/classic/tests/recursive-types.test.ts +707 -0
- package/node_modules/zod/src/v4/classic/tests/redos.test.ts +68 -0
- package/node_modules/zod/src/v4/classic/tests/refine.test.ts +693 -0
- package/node_modules/zod/src/v4/classic/tests/registries.test.ts +243 -0
- package/node_modules/zod/src/v4/classic/tests/set.test.ts +196 -0
- package/node_modules/zod/src/v4/classic/tests/standard-schema.test.ts +153 -0
- package/node_modules/zod/src/v4/classic/tests/string-formats.test.ts +125 -0
- package/node_modules/zod/src/v4/classic/tests/string.test.ts +1440 -0
- package/node_modules/zod/src/v4/classic/tests/stringbool.test.ts +124 -0
- package/node_modules/zod/src/v4/classic/tests/template-literal.test.ts +812 -0
- package/node_modules/zod/src/v4/classic/tests/to-json-schema-methods.test.ts +438 -0
- package/node_modules/zod/src/v4/classic/tests/to-json-schema.test.ts +4733 -0
- package/node_modules/zod/src/v4/classic/tests/transform.test.ts +378 -0
- package/node_modules/zod/src/v4/classic/tests/tuple.test.ts +511 -0
- package/node_modules/zod/src/v4/classic/tests/union.test.ts +310 -0
- package/node_modules/zod/src/v4/classic/tests/url.test.ts +13 -0
- package/node_modules/zod/src/v4/classic/tests/validate.test.ts +645 -0
- package/node_modules/zod/src/v4/classic/tests/validations.test.ts +283 -0
- package/node_modules/zod/src/v4/classic/tests/void.test.ts +12 -0
- package/node_modules/zod/src/v4/core/api.ts +1875 -0
- package/node_modules/zod/src/v4/core/checks.ts +1266 -0
- package/node_modules/zod/src/v4/core/compile.ts +2322 -0
- package/node_modules/zod/src/v4/core/core.ts +230 -0
- package/node_modules/zod/src/v4/core/doc.ts +52 -0
- package/node_modules/zod/src/v4/core/errors.ts +543 -0
- package/node_modules/zod/src/v4/core/index.ts +19 -0
- package/node_modules/zod/src/v4/core/json-schema-generator.ts +131 -0
- package/node_modules/zod/src/v4/core/json-schema-processors.ts +934 -0
- package/node_modules/zod/src/v4/core/json-schema.ts +148 -0
- package/node_modules/zod/src/v4/core/memoizer.ts +331 -0
- package/node_modules/zod/src/v4/core/parse.ts +309 -0
- package/node_modules/zod/src/v4/core/regexes.ts +217 -0
- package/node_modules/zod/src/v4/core/registries.ts +105 -0
- package/node_modules/zod/src/v4/core/schemas.ts +5226 -0
- package/node_modules/zod/src/v4/core/standard-schema.ts +159 -0
- package/node_modules/zod/src/v4/core/tests/cached.test.ts +54 -0
- package/node_modules/zod/src/v4/core/tests/compile-differential.test.ts +1004 -0
- package/node_modules/zod/src/v4/core/tests/compile-generative.test.ts +445 -0
- package/node_modules/zod/src/v4/core/tests/compile-global.test.ts +89 -0
- package/node_modules/zod/src/v4/core/tests/compile-off-by-default.test.ts +26 -0
- package/node_modules/zod/src/v4/core/tests/compile-stats.test.ts +34 -0
- package/node_modules/zod/src/v4/core/tests/compile.test.ts +2036 -0
- package/node_modules/zod/src/v4/core/tests/email-regex.test.ts +140 -0
- package/node_modules/zod/src/v4/core/tests/extend.test.ts +59 -0
- package/node_modules/zod/src/v4/core/tests/index.test.ts +46 -0
- package/node_modules/zod/src/v4/core/tests/locales/be.test.ts +124 -0
- package/node_modules/zod/src/v4/core/tests/locales/el.test.ts +214 -0
- package/node_modules/zod/src/v4/core/tests/locales/en.test.ts +22 -0
- package/node_modules/zod/src/v4/core/tests/locales/es.test.ts +180 -0
- package/node_modules/zod/src/v4/core/tests/locales/fr.test.ts +72 -0
- package/node_modules/zod/src/v4/core/tests/locales/he.test.ts +379 -0
- package/node_modules/zod/src/v4/core/tests/locales/hr.test.ts +163 -0
- package/node_modules/zod/src/v4/core/tests/locales/nl.test.ts +46 -0
- package/node_modules/zod/src/v4/core/tests/locales/parity.test.ts +42 -0
- package/node_modules/zod/src/v4/core/tests/locales/ru.test.ts +128 -0
- package/node_modules/zod/src/v4/core/tests/locales/tg.test.ts +85 -0
- package/node_modules/zod/src/v4/core/tests/locales/tk.test.ts +69 -0
- package/node_modules/zod/src/v4/core/tests/locales/tr.test.ts +69 -0
- package/node_modules/zod/src/v4/core/tests/locales/uz.test.ts +105 -0
- package/node_modules/zod/src/v4/core/tests/polyfill-collision.test.ts +46 -0
- package/node_modules/zod/src/v4/core/tests/record-constructor.test.ts +125 -0
- package/node_modules/zod/src/v4/core/tests/recursive-tuples.test.ts +45 -0
- package/node_modules/zod/src/v4/core/tests/treeshake.test.ts +51 -0
- package/node_modules/zod/src/v4/core/tests/url-no-canparse.test.ts +133 -0
- package/node_modules/zod/src/v4/core/to-json-schema.ts +857 -0
- package/node_modules/zod/src/v4/core/util.ts +1293 -0
- package/node_modules/zod/src/v4/core/versions.ts +5 -0
- package/node_modules/zod/src/v4/core/visit.ts +193 -0
- package/node_modules/zod/src/v4/core/zsf.ts +323 -0
- package/node_modules/zod/src/v4/index.ts +4 -0
- package/node_modules/zod/src/v4/locales/ar.ts +120 -0
- package/node_modules/zod/src/v4/locales/az.ts +116 -0
- package/node_modules/zod/src/v4/locales/be.ts +188 -0
- package/node_modules/zod/src/v4/locales/bg.ts +133 -0
- package/node_modules/zod/src/v4/locales/bn.ts +123 -0
- package/node_modules/zod/src/v4/locales/ca.ts +121 -0
- package/node_modules/zod/src/v4/locales/ckb.ts +140 -0
- package/node_modules/zod/src/v4/locales/cs.ts +123 -0
- package/node_modules/zod/src/v4/locales/da.ts +128 -0
- package/node_modules/zod/src/v4/locales/de.ts +121 -0
- package/node_modules/zod/src/v4/locales/el.ts +124 -0
- package/node_modules/zod/src/v4/locales/en.ts +136 -0
- package/node_modules/zod/src/v4/locales/eo.ts +123 -0
- package/node_modules/zod/src/v4/locales/es.ts +145 -0
- package/node_modules/zod/src/v4/locales/fa.ts +131 -0
- package/node_modules/zod/src/v4/locales/fi.ts +126 -0
- package/node_modules/zod/src/v4/locales/fr-CA.ts +121 -0
- package/node_modules/zod/src/v4/locales/fr.ts +139 -0
- package/node_modules/zod/src/v4/locales/gu.ts +123 -0
- package/node_modules/zod/src/v4/locales/he.ts +253 -0
- package/node_modules/zod/src/v4/locales/hi.ts +126 -0
- package/node_modules/zod/src/v4/locales/hr.ts +135 -0
- package/node_modules/zod/src/v4/locales/hu.ts +122 -0
- package/node_modules/zod/src/v4/locales/hy.ts +175 -0
- package/node_modules/zod/src/v4/locales/id.ts +120 -0
- package/node_modules/zod/src/v4/locales/index.ts +63 -0
- package/node_modules/zod/src/v4/locales/is.ts +124 -0
- package/node_modules/zod/src/v4/locales/it.ts +121 -0
- package/node_modules/zod/src/v4/locales/ja.ts +119 -0
- package/node_modules/zod/src/v4/locales/ka.ts +128 -0
- package/node_modules/zod/src/v4/locales/kh.ts +7 -0
- package/node_modules/zod/src/v4/locales/km.ts +124 -0
- package/node_modules/zod/src/v4/locales/kn.ts +126 -0
- package/node_modules/zod/src/v4/locales/ko.ts +126 -0
- package/node_modules/zod/src/v4/locales/lt.ts +243 -0
- package/node_modules/zod/src/v4/locales/mk.ts +123 -0
- package/node_modules/zod/src/v4/locales/ms.ts +120 -0
- package/node_modules/zod/src/v4/locales/ne.ts +128 -0
- package/node_modules/zod/src/v4/locales/nl.ts +126 -0
- package/node_modules/zod/src/v4/locales/nn.ts +121 -0
- package/node_modules/zod/src/v4/locales/no.ts +121 -0
- package/node_modules/zod/src/v4/locales/ota.ts +122 -0
- package/node_modules/zod/src/v4/locales/pl.ts +123 -0
- package/node_modules/zod/src/v4/locales/ps.ts +131 -0
- package/node_modules/zod/src/v4/locales/pt-BR.ts +161 -0
- package/node_modules/zod/src/v4/locales/pt.ts +159 -0
- package/node_modules/zod/src/v4/locales/ro.ts +132 -0
- package/node_modules/zod/src/v4/locales/ru.ts +188 -0
- package/node_modules/zod/src/v4/locales/sk.ts +123 -0
- package/node_modules/zod/src/v4/locales/sl.ts +123 -0
- package/node_modules/zod/src/v4/locales/sv.ts +124 -0
- package/node_modules/zod/src/v4/locales/ta.ts +123 -0
- package/node_modules/zod/src/v4/locales/tg.ts +135 -0
- package/node_modules/zod/src/v4/locales/th.ts +124 -0
- package/node_modules/zod/src/v4/locales/tk.ts +113 -0
- package/node_modules/zod/src/v4/locales/tr.ts +116 -0
- package/node_modules/zod/src/v4/locales/ua.ts +7 -0
- package/node_modules/zod/src/v4/locales/uk.ts +122 -0
- package/node_modules/zod/src/v4/locales/ur.ts +124 -0
- package/node_modules/zod/src/v4/locales/uz.ts +120 -0
- package/node_modules/zod/src/v4/locales/vi.ts +122 -0
- package/node_modules/zod/src/v4/locales/yo.ts +129 -0
- package/node_modules/zod/src/v4/locales/zh-CN.ts +121 -0
- package/node_modules/zod/src/v4/locales/zh-TW.ts +120 -0
- package/node_modules/zod/src/v4/mini/checks.ts +33 -0
- package/node_modules/zod/src/v4/mini/coerce.ts +27 -0
- package/node_modules/zod/src/v4/mini/deep-partial.ts +73 -0
- package/node_modules/zod/src/v4/mini/external.ts +52 -0
- package/node_modules/zod/src/v4/mini/in-out.ts +45 -0
- package/node_modules/zod/src/v4/mini/index.ts +3 -0
- package/node_modules/zod/src/v4/mini/iso.ts +66 -0
- package/node_modules/zod/src/v4/mini/parse.ts +16 -0
- package/node_modules/zod/src/v4/mini/schemas.ts +2051 -0
- package/node_modules/zod/src/v4/mini/tests/apply.test.ts +57 -0
- package/node_modules/zod/src/v4/mini/tests/assignability.test.ts +190 -0
- package/node_modules/zod/src/v4/mini/tests/brand.test.ts +94 -0
- package/node_modules/zod/src/v4/mini/tests/checks.test.ts +158 -0
- package/node_modules/zod/src/v4/mini/tests/codec.test.ts +582 -0
- package/node_modules/zod/src/v4/mini/tests/computed.test.ts +30 -0
- package/node_modules/zod/src/v4/mini/tests/cyclic-data.test.ts +84 -0
- package/node_modules/zod/src/v4/mini/tests/deep-partial.test.ts +54 -0
- package/node_modules/zod/src/v4/mini/tests/error.test.ts +41 -0
- package/node_modules/zod/src/v4/mini/tests/functions.test.ts +14 -0
- package/node_modules/zod/src/v4/mini/tests/index.test.ts +1146 -0
- package/node_modules/zod/src/v4/mini/tests/number.test.ts +109 -0
- package/node_modules/zod/src/v4/mini/tests/object.test.ts +292 -0
- package/node_modules/zod/src/v4/mini/tests/prototypes.test.ts +43 -0
- package/node_modules/zod/src/v4/mini/tests/recursive-types.test.ts +341 -0
- package/node_modules/zod/src/v4/mini/tests/standard-schema.test.ts +50 -0
- package/node_modules/zod/src/v4/mini/tests/string.test.ts +396 -0
- package/node_modules/zod/src/v4-mini/index.ts +3 -0
- package/node_modules/zod/v3/ZodError.cjs +167 -0
- package/node_modules/zod/v3/ZodError.d.cts +164 -0
- package/node_modules/zod/{lib → v3}/ZodError.d.ts +13 -13
- package/node_modules/zod/{lib → v3}/ZodError.js +31 -25
- package/node_modules/zod/v3/errors.cjs +36 -0
- package/node_modules/zod/v3/errors.d.cts +5 -0
- package/node_modules/zod/{lib → v3}/errors.d.ts +2 -2
- package/node_modules/zod/v3/errors.js +9 -0
- package/node_modules/zod/v3/external.cjs +41 -0
- package/node_modules/zod/v3/external.d.cts +6 -0
- package/node_modules/zod/v3/external.d.ts +6 -0
- package/node_modules/zod/v3/external.js +6 -0
- package/node_modules/zod/v3/helpers/enumUtil.cjs +21 -0
- package/node_modules/zod/v3/helpers/enumUtil.d.ts +8 -0
- package/node_modules/zod/v3/helpers/enumUtil.js +1 -0
- package/node_modules/zod/v3/helpers/errorUtil.cjs +28 -0
- package/node_modules/zod/v3/helpers/errorUtil.d.cts +9 -0
- package/node_modules/zod/{lib → v3}/helpers/errorUtil.d.ts +1 -1
- package/node_modules/zod/v3/helpers/errorUtil.js +6 -0
- package/node_modules/zod/{lib/helpers/parseUtil.js → v3/helpers/parseUtil.cjs} +26 -8
- package/node_modules/zod/v3/helpers/parseUtil.d.cts +78 -0
- package/node_modules/zod/{lib → v3}/helpers/parseUtil.d.ts +4 -4
- package/node_modules/zod/v3/helpers/parseUtil.js +109 -0
- package/node_modules/zod/v3/helpers/partialUtil.cjs +21 -0
- package/node_modules/zod/v3/helpers/partialUtil.d.cts +8 -0
- package/node_modules/zod/{lib → v3}/helpers/partialUtil.d.ts +1 -1
- package/node_modules/zod/v3/helpers/partialUtil.js +1 -0
- package/node_modules/zod/v3/helpers/typeAliases.cjs +21 -0
- package/node_modules/zod/v3/helpers/typeAliases.d.cts +2 -0
- package/node_modules/zod/v3/helpers/typeAliases.d.ts +2 -0
- package/node_modules/zod/v3/helpers/typeAliases.js +1 -0
- package/node_modules/zod/{lib/helpers/util.js → v3/helpers/util.cjs} +24 -10
- package/node_modules/zod/v3/helpers/util.d.cts +85 -0
- package/node_modules/zod/{lib → v3}/helpers/util.d.ts +14 -11
- package/node_modules/zod/v3/helpers/util.js +133 -0
- package/node_modules/zod/{lib/index.js → v3/index.cjs} +21 -2
- package/node_modules/zod/v3/index.d.cts +4 -0
- package/node_modules/zod/v3/index.d.ts +4 -0
- package/node_modules/zod/v3/index.js +4 -0
- package/node_modules/zod/{lib/locales/en.js → v3/locales/en.cjs} +33 -50
- package/node_modules/zod/v3/locales/en.d.cts +3 -0
- package/node_modules/zod/{lib → v3}/locales/en.d.ts +1 -1
- package/node_modules/zod/v3/locales/en.js +109 -0
- package/node_modules/zod/v3/package.json +7 -0
- package/node_modules/zod/v3/standard-schema.cjs +21 -0
- package/node_modules/zod/v3/standard-schema.d.ts +102 -0
- package/node_modules/zod/v3/standard-schema.js +1 -0
- package/node_modules/zod/{lib/types.js → v3/types.cjs} +521 -546
- package/node_modules/zod/{lib/types.d.ts → v3/types.d.cts} +125 -153
- package/node_modules/zod/v3/types.d.ts +1034 -0
- package/node_modules/zod/{lib/index.mjs → v3/types.js} +183 -868
- package/node_modules/zod/v4/classic/checks.cjs +53 -0
- package/node_modules/zod/v4/classic/checks.d.cts +1 -0
- package/node_modules/zod/v4/classic/checks.d.ts +1 -0
- package/node_modules/zod/v4/classic/checks.js +1 -0
- package/node_modules/zod/v4/classic/coerce.cjs +66 -0
- package/node_modules/zod/v4/classic/coerce.d.cts +17 -0
- package/node_modules/zod/v4/classic/coerce.d.ts +17 -0
- package/node_modules/zod/v4/classic/coerce.js +17 -0
- package/node_modules/zod/v4/classic/compat.cjs +80 -0
- package/node_modules/zod/v4/classic/compat.d.cts +48 -0
- package/node_modules/zod/v4/classic/compat.d.ts +48 -0
- package/node_modules/zod/v4/classic/compat.js +31 -0
- package/node_modules/zod/v4/classic/deep-partial.cjs +58 -0
- package/node_modules/zod/v4/classic/deep-partial.d.cts +14 -0
- package/node_modules/zod/v4/classic/deep-partial.d.ts +14 -0
- package/node_modules/zod/v4/classic/deep-partial.js +13 -0
- package/node_modules/zod/v4/classic/errors.cjs +102 -0
- package/node_modules/zod/v4/classic/errors.d.cts +29 -0
- package/node_modules/zod/v4/classic/errors.d.ts +29 -0
- package/node_modules/zod/v4/classic/errors.js +57 -0
- package/node_modules/zod/v4/classic/external.cjs +97 -0
- package/node_modules/zod/v4/classic/external.d.cts +19 -0
- package/node_modules/zod/v4/classic/external.d.ts +19 -0
- package/node_modules/zod/v4/classic/external.js +17 -0
- package/node_modules/zod/v4/classic/from-json-schema.cjs +926 -0
- package/node_modules/zod/v4/classic/from-json-schema.d.cts +12 -0
- package/node_modules/zod/v4/classic/from-json-schema.d.ts +12 -0
- package/node_modules/zod/v4/classic/from-json-schema.js +881 -0
- package/node_modules/zod/v4/classic/in-out.cjs +82 -0
- package/node_modules/zod/v4/classic/in-out.d.cts +8 -0
- package/node_modules/zod/v4/classic/in-out.d.ts +8 -0
- package/node_modules/zod/v4/classic/in-out.js +36 -0
- package/node_modules/zod/v4/classic/index.cjs +52 -0
- package/node_modules/zod/v4/classic/index.d.cts +3 -0
- package/node_modules/zod/v4/classic/index.d.ts +3 -0
- package/node_modules/zod/v4/classic/index.js +4 -0
- package/node_modules/zod/v4/classic/iso.cjs +68 -0
- package/node_modules/zod/v4/classic/iso.d.cts +7 -0
- package/node_modules/zod/v4/classic/iso.d.ts +7 -0
- package/node_modules/zod/v4/classic/iso.js +15 -0
- package/node_modules/zod/v4/classic/package.json +7 -0
- package/node_modules/zod/v4/classic/parse.cjs +63 -0
- package/node_modules/zod/v4/classic/parse.d.cts +44 -0
- package/node_modules/zod/v4/classic/parse.d.ts +44 -0
- package/node_modules/zod/v4/classic/parse.js +16 -0
- package/node_modules/zod/v4/classic/schemas.cjs +1676 -0
- package/node_modules/zod/v4/classic/schemas.d.cts +816 -0
- package/node_modules/zod/v4/classic/schemas.d.ts +816 -0
- package/node_modules/zod/v4/classic/schemas.js +1535 -0
- package/node_modules/zod/v4/core/api.cjs +1269 -0
- package/node_modules/zod/v4/core/api.d.cts +335 -0
- package/node_modules/zod/v4/core/api.d.ts +335 -0
- package/node_modules/zod/v4/core/api.js +1107 -0
- package/node_modules/zod/v4/core/checks.cjs +561 -0
- package/node_modules/zod/v4/core/checks.d.cts +294 -0
- package/node_modules/zod/v4/core/checks.d.ts +294 -0
- package/node_modules/zod/v4/core/checks.js +516 -0
- package/node_modules/zod/v4/core/compile.cjs +1916 -0
- package/node_modules/zod/v4/core/compile.d.cts +65 -0
- package/node_modules/zod/v4/core/compile.d.ts +65 -0
- package/node_modules/zod/v4/core/compile.js +1866 -0
- package/node_modules/zod/v4/core/core.cjs +167 -0
- package/node_modules/zod/v4/core/core.d.cts +82 -0
- package/node_modules/zod/v4/core/core.d.ts +82 -0
- package/node_modules/zod/v4/core/core.js +141 -0
- package/node_modules/zod/v4/core/doc.cjs +61 -0
- package/node_modules/zod/v4/core/doc.d.cts +16 -0
- package/node_modules/zod/v4/core/doc.d.ts +16 -0
- package/node_modules/zod/v4/core/doc.js +38 -0
- package/node_modules/zod/v4/core/errors.cjs +317 -0
- package/node_modules/zod/v4/core/errors.d.cts +225 -0
- package/node_modules/zod/v4/core/errors.d.ts +225 -0
- package/node_modules/zod/v4/core/errors.js +267 -0
- package/node_modules/zod/v4/core/index.cjs +70 -0
- package/node_modules/zod/v4/core/index.d.cts +19 -0
- package/node_modules/zod/v4/core/index.d.ts +19 -0
- package/node_modules/zod/v4/core/index.js +19 -0
- package/node_modules/zod/v4/core/json-schema-generator.cjs +122 -0
- package/node_modules/zod/v4/core/json-schema-generator.d.cts +65 -0
- package/node_modules/zod/v4/core/json-schema-generator.d.ts +65 -0
- package/node_modules/zod/v4/core/json-schema-generator.js +99 -0
- package/node_modules/zod/v4/core/json-schema-processors.cjs +929 -0
- package/node_modules/zod/v4/core/json-schema-processors.d.cts +65 -0
- package/node_modules/zod/v4/core/json-schema-processors.d.ts +65 -0
- package/node_modules/zod/v4/core/json-schema-processors.js +843 -0
- package/node_modules/zod/v4/core/json-schema.cjs +21 -0
- package/node_modules/zod/v4/core/json-schema.d.cts +89 -0
- package/node_modules/zod/v4/core/json-schema.d.ts +89 -0
- package/node_modules/zod/v4/core/json-schema.js +1 -0
- package/node_modules/zod/v4/core/memoizer.cjs +360 -0
- package/node_modules/zod/v4/core/memoizer.d.cts +15 -0
- package/node_modules/zod/v4/core/memoizer.d.ts +15 -0
- package/node_modules/zod/v4/core/memoizer.js +311 -0
- package/node_modules/zod/v4/core/package.json +7 -0
- package/node_modules/zod/v4/core/parse.cjs +233 -0
- package/node_modules/zod/v4/core/parse.d.cts +52 -0
- package/node_modules/zod/v4/core/parse.d.ts +52 -0
- package/node_modules/zod/v4/core/parse.js +175 -0
- package/node_modules/zod/v4/core/regexes.cjs +209 -0
- package/node_modules/zod/v4/core/regexes.d.cts +90 -0
- package/node_modules/zod/v4/core/regexes.d.ts +90 -0
- package/node_modules/zod/v4/core/regexes.js +156 -0
- package/node_modules/zod/v4/core/registries.cjs +75 -0
- package/node_modules/zod/v4/core/registries.d.cts +35 -0
- package/node_modules/zod/v4/core/registries.d.ts +35 -0
- package/node_modules/zod/v4/core/registries.js +51 -0
- package/node_modules/zod/v4/core/schemas.cjs +2699 -0
- package/node_modules/zod/v4/core/schemas.d.cts +1275 -0
- package/node_modules/zod/v4/core/schemas.d.ts +1275 -0
- package/node_modules/zod/v4/core/schemas.js +2636 -0
- package/node_modules/zod/v4/core/standard-schema.cjs +21 -0
- package/node_modules/zod/v4/core/standard-schema.d.cts +126 -0
- package/node_modules/zod/v4/core/standard-schema.d.ts +126 -0
- package/node_modules/zod/v4/core/standard-schema.js +1 -0
- package/node_modules/zod/v4/core/to-json-schema.cjs +681 -0
- package/node_modules/zod/v4/core/to-json-schema.d.cts +154 -0
- package/node_modules/zod/v4/core/to-json-schema.d.ts +154 -0
- package/node_modules/zod/v4/core/to-json-schema.js +651 -0
- package/node_modules/zod/v4/core/util.cjs +964 -0
- package/node_modules/zod/v4/core/util.d.cts +280 -0
- package/node_modules/zod/v4/core/util.d.ts +280 -0
- package/node_modules/zod/v4/core/util.js +873 -0
- package/node_modules/zod/v4/core/versions.cjs +27 -0
- package/node_modules/zod/v4/core/versions.d.cts +5 -0
- package/node_modules/zod/v4/core/versions.d.ts +5 -0
- package/node_modules/zod/v4/core/versions.js +5 -0
- package/node_modules/zod/v4/core/visit.cjs +214 -0
- package/node_modules/zod/v4/core/visit.d.cts +30 -0
- package/node_modules/zod/v4/core/visit.d.ts +30 -0
- package/node_modules/zod/v4/core/visit.js +169 -0
- package/node_modules/zod/v4/index.cjs +51 -0
- package/node_modules/zod/v4/index.d.cts +3 -0
- package/node_modules/zod/v4/index.d.ts +3 -0
- package/node_modules/zod/v4/index.js +4 -0
- package/node_modules/zod/v4/locales/ar.cjs +138 -0
- package/node_modules/zod/v4/locales/ar.d.cts +5 -0
- package/node_modules/zod/v4/locales/ar.d.ts +4 -0
- package/node_modules/zod/v4/locales/ar.js +111 -0
- package/node_modules/zod/v4/locales/az.cjs +137 -0
- package/node_modules/zod/v4/locales/az.d.cts +5 -0
- package/node_modules/zod/v4/locales/az.d.ts +4 -0
- package/node_modules/zod/v4/locales/az.js +110 -0
- package/node_modules/zod/v4/locales/be.cjs +195 -0
- package/node_modules/zod/v4/locales/be.d.cts +5 -0
- package/node_modules/zod/v4/locales/be.d.ts +4 -0
- package/node_modules/zod/v4/locales/be.js +168 -0
- package/node_modules/zod/v4/locales/bg.cjs +152 -0
- package/node_modules/zod/v4/locales/bg.d.cts +5 -0
- package/node_modules/zod/v4/locales/bg.d.ts +4 -0
- package/node_modules/zod/v4/locales/bg.js +125 -0
- package/node_modules/zod/v4/locales/bn.cjs +140 -0
- package/node_modules/zod/v4/locales/bn.d.cts +5 -0
- package/node_modules/zod/v4/locales/bn.d.ts +4 -0
- package/node_modules/zod/v4/locales/bn.js +113 -0
- package/node_modules/zod/v4/locales/ca.cjs +139 -0
- package/node_modules/zod/v4/locales/ca.d.cts +5 -0
- package/node_modules/zod/v4/locales/ca.d.ts +4 -0
- package/node_modules/zod/v4/locales/ca.js +112 -0
- package/node_modules/zod/v4/locales/ckb.cjs +160 -0
- package/node_modules/zod/v4/locales/ckb.d.cts +5 -0
- package/node_modules/zod/v4/locales/ckb.d.ts +4 -0
- package/node_modules/zod/v4/locales/ckb.js +133 -0
- package/node_modules/zod/v4/locales/cs.cjs +143 -0
- package/node_modules/zod/v4/locales/cs.d.cts +5 -0
- package/node_modules/zod/v4/locales/cs.d.ts +4 -0
- package/node_modules/zod/v4/locales/cs.js +116 -0
- package/node_modules/zod/v4/locales/da.cjs +147 -0
- package/node_modules/zod/v4/locales/da.d.cts +5 -0
- package/node_modules/zod/v4/locales/da.d.ts +4 -0
- package/node_modules/zod/v4/locales/da.js +120 -0
- package/node_modules/zod/v4/locales/de.cjs +140 -0
- package/node_modules/zod/v4/locales/de.d.cts +5 -0
- package/node_modules/zod/v4/locales/de.d.ts +4 -0
- package/node_modules/zod/v4/locales/de.js +113 -0
- package/node_modules/zod/v4/locales/el.cjs +139 -0
- package/node_modules/zod/v4/locales/el.d.cts +5 -0
- package/node_modules/zod/v4/locales/el.d.ts +4 -0
- package/node_modules/zod/v4/locales/el.js +112 -0
- package/node_modules/zod/v4/locales/en.cjs +152 -0
- package/node_modules/zod/v4/locales/en.d.cts +5 -0
- package/node_modules/zod/v4/locales/en.d.ts +4 -0
- package/node_modules/zod/v4/locales/en.js +125 -0
- package/node_modules/zod/v4/locales/eo.cjs +141 -0
- package/node_modules/zod/v4/locales/eo.d.cts +5 -0
- package/node_modules/zod/v4/locales/eo.d.ts +4 -0
- package/node_modules/zod/v4/locales/eo.js +114 -0
- package/node_modules/zod/v4/locales/es.cjs +163 -0
- package/node_modules/zod/v4/locales/es.d.cts +5 -0
- package/node_modules/zod/v4/locales/es.d.ts +4 -0
- package/node_modules/zod/v4/locales/es.js +136 -0
- package/node_modules/zod/v4/locales/fa.cjs +146 -0
- package/node_modules/zod/v4/locales/fa.d.cts +5 -0
- package/node_modules/zod/v4/locales/fa.d.ts +4 -0
- package/node_modules/zod/v4/locales/fa.js +119 -0
- package/node_modules/zod/v4/locales/fi.cjs +144 -0
- package/node_modules/zod/v4/locales/fi.d.cts +5 -0
- package/node_modules/zod/v4/locales/fi.d.ts +4 -0
- package/node_modules/zod/v4/locales/fi.js +117 -0
- package/node_modules/zod/v4/locales/fr-CA.cjs +139 -0
- package/node_modules/zod/v4/locales/fr-CA.d.cts +5 -0
- package/node_modules/zod/v4/locales/fr-CA.d.ts +4 -0
- package/node_modules/zod/v4/locales/fr-CA.js +112 -0
- package/node_modules/zod/v4/locales/fr.cjs +156 -0
- package/node_modules/zod/v4/locales/fr.d.cts +5 -0
- package/node_modules/zod/v4/locales/fr.d.ts +4 -0
- package/node_modules/zod/v4/locales/fr.js +129 -0
- package/node_modules/zod/v4/locales/gu.cjs +140 -0
- package/node_modules/zod/v4/locales/gu.d.cts +5 -0
- package/node_modules/zod/v4/locales/gu.d.ts +4 -0
- package/node_modules/zod/v4/locales/gu.js +113 -0
- package/node_modules/zod/v4/locales/he.cjs +248 -0
- package/node_modules/zod/v4/locales/he.d.cts +5 -0
- package/node_modules/zod/v4/locales/he.d.ts +4 -0
- package/node_modules/zod/v4/locales/he.js +221 -0
- package/node_modules/zod/v4/locales/hi.cjs +138 -0
- package/node_modules/zod/v4/locales/hi.d.cts +5 -0
- package/node_modules/zod/v4/locales/hi.d.ts +4 -0
- package/node_modules/zod/v4/locales/hi.js +111 -0
- package/node_modules/zod/v4/locales/hr.cjs +153 -0
- package/node_modules/zod/v4/locales/hr.d.cts +5 -0
- package/node_modules/zod/v4/locales/hr.d.ts +4 -0
- package/node_modules/zod/v4/locales/hr.js +126 -0
- package/node_modules/zod/v4/locales/hu.cjs +140 -0
- package/node_modules/zod/v4/locales/hu.d.cts +5 -0
- package/node_modules/zod/v4/locales/hu.d.ts +4 -0
- package/node_modules/zod/v4/locales/hu.js +113 -0
- package/node_modules/zod/v4/locales/hy.cjs +185 -0
- package/node_modules/zod/v4/locales/hy.d.cts +5 -0
- package/node_modules/zod/v4/locales/hy.d.ts +4 -0
- package/node_modules/zod/v4/locales/hy.js +158 -0
- package/node_modules/zod/v4/locales/id.cjs +138 -0
- package/node_modules/zod/v4/locales/id.d.cts +5 -0
- package/node_modules/zod/v4/locales/id.d.ts +4 -0
- package/node_modules/zod/v4/locales/id.js +111 -0
- package/node_modules/zod/v4/locales/index.cjs +152 -0
- package/node_modules/zod/v4/locales/index.d.cts +63 -0
- package/node_modules/zod/v4/locales/index.d.ts +63 -0
- package/node_modules/zod/v4/locales/index.js +63 -0
- package/node_modules/zod/v4/locales/is.cjs +141 -0
- package/node_modules/zod/v4/locales/is.d.cts +5 -0
- package/node_modules/zod/v4/locales/is.d.ts +4 -0
- package/node_modules/zod/v4/locales/is.js +114 -0
- package/node_modules/zod/v4/locales/it.cjs +140 -0
- package/node_modules/zod/v4/locales/it.d.cts +5 -0
- package/node_modules/zod/v4/locales/it.d.ts +4 -0
- package/node_modules/zod/v4/locales/it.js +113 -0
- package/node_modules/zod/v4/locales/ja.cjs +139 -0
- package/node_modules/zod/v4/locales/ja.d.cts +5 -0
- package/node_modules/zod/v4/locales/ja.d.ts +4 -0
- package/node_modules/zod/v4/locales/ja.js +112 -0
- package/node_modules/zod/v4/locales/ka.cjs +144 -0
- package/node_modules/zod/v4/locales/ka.d.cts +5 -0
- package/node_modules/zod/v4/locales/ka.d.ts +4 -0
- package/node_modules/zod/v4/locales/ka.js +117 -0
- package/node_modules/zod/v4/locales/kh.cjs +12 -0
- package/node_modules/zod/v4/locales/kh.d.cts +5 -0
- package/node_modules/zod/v4/locales/kh.d.ts +5 -0
- package/node_modules/zod/v4/locales/kh.js +5 -0
- package/node_modules/zod/v4/locales/km.cjs +142 -0
- package/node_modules/zod/v4/locales/km.d.cts +5 -0
- package/node_modules/zod/v4/locales/km.d.ts +4 -0
- package/node_modules/zod/v4/locales/km.js +115 -0
- package/node_modules/zod/v4/locales/kn.cjs +143 -0
- package/node_modules/zod/v4/locales/kn.d.cts +5 -0
- package/node_modules/zod/v4/locales/kn.d.ts +4 -0
- package/node_modules/zod/v4/locales/kn.js +116 -0
- package/node_modules/zod/v4/locales/ko.cjs +143 -0
- package/node_modules/zod/v4/locales/ko.d.cts +5 -0
- package/node_modules/zod/v4/locales/ko.d.ts +4 -0
- package/node_modules/zod/v4/locales/ko.js +116 -0
- package/node_modules/zod/v4/locales/lt.cjs +234 -0
- package/node_modules/zod/v4/locales/lt.d.cts +5 -0
- package/node_modules/zod/v4/locales/lt.d.ts +4 -0
- package/node_modules/zod/v4/locales/lt.js +207 -0
- package/node_modules/zod/v4/locales/mk.cjs +141 -0
- package/node_modules/zod/v4/locales/mk.d.cts +5 -0
- package/node_modules/zod/v4/locales/mk.d.ts +4 -0
- package/node_modules/zod/v4/locales/mk.js +114 -0
- package/node_modules/zod/v4/locales/ms.cjs +139 -0
- package/node_modules/zod/v4/locales/ms.d.cts +5 -0
- package/node_modules/zod/v4/locales/ms.d.ts +4 -0
- package/node_modules/zod/v4/locales/ms.js +112 -0
- package/node_modules/zod/v4/locales/ne.cjs +138 -0
- package/node_modules/zod/v4/locales/ne.d.cts +5 -0
- package/node_modules/zod/v4/locales/ne.d.ts +4 -0
- package/node_modules/zod/v4/locales/ne.js +111 -0
- package/node_modules/zod/v4/locales/nl.cjs +142 -0
- package/node_modules/zod/v4/locales/nl.d.cts +5 -0
- package/node_modules/zod/v4/locales/nl.d.ts +4 -0
- package/node_modules/zod/v4/locales/nl.js +115 -0
- package/node_modules/zod/v4/locales/nn.cjs +140 -0
- package/node_modules/zod/v4/locales/nn.d.cts +5 -0
- package/node_modules/zod/v4/locales/nn.d.ts +4 -0
- package/node_modules/zod/v4/locales/nn.js +113 -0
- package/node_modules/zod/v4/locales/no.cjs +140 -0
- package/node_modules/zod/v4/locales/no.d.cts +5 -0
- package/node_modules/zod/v4/locales/no.d.ts +4 -0
- package/node_modules/zod/v4/locales/no.js +113 -0
- package/node_modules/zod/v4/locales/ota.cjs +141 -0
- package/node_modules/zod/v4/locales/ota.d.cts +5 -0
- package/node_modules/zod/v4/locales/ota.d.ts +4 -0
- package/node_modules/zod/v4/locales/ota.js +114 -0
- package/node_modules/zod/v4/locales/package.json +7 -0
- package/node_modules/zod/v4/locales/pl.cjs +141 -0
- package/node_modules/zod/v4/locales/pl.d.cts +5 -0
- package/node_modules/zod/v4/locales/pl.d.ts +4 -0
- package/node_modules/zod/v4/locales/pl.js +114 -0
- package/node_modules/zod/v4/locales/ps.cjs +146 -0
- package/node_modules/zod/v4/locales/ps.d.cts +5 -0
- package/node_modules/zod/v4/locales/ps.d.ts +4 -0
- package/node_modules/zod/v4/locales/ps.js +119 -0
- package/node_modules/zod/v4/locales/pt-BR.cjs +170 -0
- package/node_modules/zod/v4/locales/pt-BR.d.cts +5 -0
- package/node_modules/zod/v4/locales/pt-BR.d.ts +4 -0
- package/node_modules/zod/v4/locales/pt-BR.js +143 -0
- package/node_modules/zod/v4/locales/pt.cjs +169 -0
- package/node_modules/zod/v4/locales/pt.d.cts +5 -0
- package/node_modules/zod/v4/locales/pt.d.ts +4 -0
- package/node_modules/zod/v4/locales/pt.js +142 -0
- package/node_modules/zod/v4/locales/ro.cjs +149 -0
- package/node_modules/zod/v4/locales/ro.d.cts +5 -0
- package/node_modules/zod/v4/locales/ro.d.ts +4 -0
- package/node_modules/zod/v4/locales/ro.js +122 -0
- package/node_modules/zod/v4/locales/ru.cjs +195 -0
- package/node_modules/zod/v4/locales/ru.d.cts +5 -0
- package/node_modules/zod/v4/locales/ru.d.ts +4 -0
- package/node_modules/zod/v4/locales/ru.js +168 -0
- package/node_modules/zod/v4/locales/sk.cjs +143 -0
- package/node_modules/zod/v4/locales/sk.d.cts +5 -0
- package/node_modules/zod/v4/locales/sk.d.ts +4 -0
- package/node_modules/zod/v4/locales/sk.js +116 -0
- package/node_modules/zod/v4/locales/sl.cjs +141 -0
- package/node_modules/zod/v4/locales/sl.d.cts +5 -0
- package/node_modules/zod/v4/locales/sl.d.ts +4 -0
- package/node_modules/zod/v4/locales/sl.js +114 -0
- package/node_modules/zod/v4/locales/sv.cjs +142 -0
- package/node_modules/zod/v4/locales/sv.d.cts +5 -0
- package/node_modules/zod/v4/locales/sv.d.ts +4 -0
- package/node_modules/zod/v4/locales/sv.js +115 -0
- package/node_modules/zod/v4/locales/ta.cjs +142 -0
- package/node_modules/zod/v4/locales/ta.d.cts +5 -0
- package/node_modules/zod/v4/locales/ta.d.ts +4 -0
- package/node_modules/zod/v4/locales/ta.js +115 -0
- package/node_modules/zod/v4/locales/tg.cjs +144 -0
- package/node_modules/zod/v4/locales/tg.d.cts +5 -0
- package/node_modules/zod/v4/locales/tg.d.ts +4 -0
- package/node_modules/zod/v4/locales/tg.js +117 -0
- package/node_modules/zod/v4/locales/th.cjs +142 -0
- package/node_modules/zod/v4/locales/th.d.cts +5 -0
- package/node_modules/zod/v4/locales/th.d.ts +4 -0
- package/node_modules/zod/v4/locales/th.js +115 -0
- package/node_modules/zod/v4/locales/tk.cjs +134 -0
- package/node_modules/zod/v4/locales/tk.d.cts +5 -0
- package/node_modules/zod/v4/locales/tk.d.ts +4 -0
- package/node_modules/zod/v4/locales/tk.js +107 -0
- package/node_modules/zod/v4/locales/tr.cjs +137 -0
- package/node_modules/zod/v4/locales/tr.d.cts +5 -0
- package/node_modules/zod/v4/locales/tr.d.ts +4 -0
- package/node_modules/zod/v4/locales/tr.js +110 -0
- package/node_modules/zod/v4/locales/ua.cjs +12 -0
- package/node_modules/zod/v4/locales/ua.d.cts +5 -0
- package/node_modules/zod/v4/locales/ua.d.ts +5 -0
- package/node_modules/zod/v4/locales/ua.js +5 -0
- package/node_modules/zod/v4/locales/uk.cjs +140 -0
- package/node_modules/zod/v4/locales/uk.d.cts +5 -0
- package/node_modules/zod/v4/locales/uk.d.ts +4 -0
- package/node_modules/zod/v4/locales/uk.js +113 -0
- package/node_modules/zod/v4/locales/ur.cjs +142 -0
- package/node_modules/zod/v4/locales/ur.d.cts +5 -0
- package/node_modules/zod/v4/locales/ur.d.ts +4 -0
- package/node_modules/zod/v4/locales/ur.js +115 -0
- package/node_modules/zod/v4/locales/uz.cjs +140 -0
- package/node_modules/zod/v4/locales/uz.d.cts +5 -0
- package/node_modules/zod/v4/locales/uz.d.ts +4 -0
- package/node_modules/zod/v4/locales/uz.js +113 -0
- package/node_modules/zod/v4/locales/vi.cjs +140 -0
- package/node_modules/zod/v4/locales/vi.d.cts +5 -0
- package/node_modules/zod/v4/locales/vi.d.ts +4 -0
- package/node_modules/zod/v4/locales/vi.js +113 -0
- package/node_modules/zod/v4/locales/yo.cjs +139 -0
- package/node_modules/zod/v4/locales/yo.d.cts +5 -0
- package/node_modules/zod/v4/locales/yo.d.ts +4 -0
- package/node_modules/zod/v4/locales/yo.js +112 -0
- package/node_modules/zod/v4/locales/zh-CN.cjs +141 -0
- package/node_modules/zod/v4/locales/zh-CN.d.cts +5 -0
- package/node_modules/zod/v4/locales/zh-CN.d.ts +4 -0
- package/node_modules/zod/v4/locales/zh-CN.js +114 -0
- package/node_modules/zod/v4/locales/zh-TW.cjs +139 -0
- package/node_modules/zod/v4/locales/zh-TW.d.cts +5 -0
- package/node_modules/zod/v4/locales/zh-TW.d.ts +4 -0
- package/node_modules/zod/v4/locales/zh-TW.js +112 -0
- package/node_modules/zod/v4/mini/checks.cjs +54 -0
- package/node_modules/zod/v4/mini/checks.d.cts +1 -0
- package/node_modules/zod/v4/mini/checks.d.ts +1 -0
- package/node_modules/zod/v4/mini/checks.js +1 -0
- package/node_modules/zod/v4/mini/coerce.cjs +71 -0
- package/node_modules/zod/v4/mini/coerce.d.cts +7 -0
- package/node_modules/zod/v4/mini/coerce.d.ts +7 -0
- package/node_modules/zod/v4/mini/coerce.js +22 -0
- package/node_modules/zod/v4/mini/deep-partial.cjs +58 -0
- package/node_modules/zod/v4/mini/deep-partial.d.cts +14 -0
- package/node_modules/zod/v4/mini/deep-partial.d.ts +14 -0
- package/node_modules/zod/v4/mini/deep-partial.js +13 -0
- package/node_modules/zod/v4/mini/external.cjs +95 -0
- package/node_modules/zod/v4/mini/external.d.cts +16 -0
- package/node_modules/zod/v4/mini/external.d.ts +16 -0
- package/node_modules/zod/v4/mini/external.js +16 -0
- package/node_modules/zod/v4/mini/in-out.cjs +82 -0
- package/node_modules/zod/v4/mini/in-out.d.cts +8 -0
- package/node_modules/zod/v4/mini/in-out.d.ts +8 -0
- package/node_modules/zod/v4/mini/in-out.js +36 -0
- package/node_modules/zod/v4/mini/index.cjs +51 -0
- package/node_modules/zod/v4/mini/index.d.cts +3 -0
- package/node_modules/zod/v4/mini/index.d.ts +3 -0
- package/node_modules/zod/v4/mini/index.js +3 -0
- package/node_modules/zod/v4/mini/iso.cjs +83 -0
- package/node_modules/zod/v4/mini/iso.d.cts +22 -0
- package/node_modules/zod/v4/mini/iso.d.ts +22 -0
- package/node_modules/zod/v4/mini/iso.js +34 -0
- package/node_modules/zod/v4/mini/package.json +7 -0
- package/node_modules/zod/v4/mini/parse.cjs +37 -0
- package/node_modules/zod/v4/mini/parse.d.cts +1 -0
- package/node_modules/zod/v4/mini/parse.d.ts +1 -0
- package/node_modules/zod/v4/mini/parse.js +1 -0
- package/node_modules/zod/v4/mini/schemas.cjs +1147 -0
- package/node_modules/zod/v4/mini/schemas.d.cts +480 -0
- package/node_modules/zod/v4/mini/schemas.d.ts +480 -0
- package/node_modules/zod/v4/mini/schemas.js +1002 -0
- package/node_modules/zod/v4/package.json +7 -0
- package/node_modules/zod/v4-mini/index.cjs +51 -0
- package/node_modules/zod/v4-mini/index.d.cts +3 -0
- package/node_modules/zod/v4-mini/index.d.ts +3 -0
- package/node_modules/zod/v4-mini/index.js +3 -0
- package/node_modules/zod/v4-mini/package.json +7 -0
- package/package.json +4 -4
- package/node_modules/@xeno-corporation/account/dist/tokenStore-CnIo2ILq.d.mts +0 -47
- package/node_modules/@xeno-corporation/account/dist/tokenStore-CnIo2ILq.d.ts +0 -47
- package/node_modules/zod/lib/__tests__/Mocker.d.ts +0 -17
- package/node_modules/zod/lib/__tests__/Mocker.js +0 -57
- package/node_modules/zod/lib/benchmarks/datetime.d.ts +0 -5
- package/node_modules/zod/lib/benchmarks/datetime.js +0 -54
- package/node_modules/zod/lib/benchmarks/discriminatedUnion.d.ts +0 -5
- package/node_modules/zod/lib/benchmarks/discriminatedUnion.js +0 -79
- package/node_modules/zod/lib/benchmarks/index.js +0 -59
- package/node_modules/zod/lib/benchmarks/ipv4.d.ts +0 -5
- package/node_modules/zod/lib/benchmarks/ipv4.js +0 -54
- package/node_modules/zod/lib/benchmarks/object.d.ts +0 -5
- package/node_modules/zod/lib/benchmarks/object.js +0 -70
- package/node_modules/zod/lib/benchmarks/primitives.d.ts +0 -5
- package/node_modules/zod/lib/benchmarks/primitives.js +0 -170
- package/node_modules/zod/lib/benchmarks/realworld.d.ts +0 -5
- package/node_modules/zod/lib/benchmarks/realworld.js +0 -56
- package/node_modules/zod/lib/benchmarks/string.d.ts +0 -5
- package/node_modules/zod/lib/benchmarks/string.js +0 -55
- package/node_modules/zod/lib/benchmarks/union.d.ts +0 -5
- package/node_modules/zod/lib/benchmarks/union.js +0 -79
- package/node_modules/zod/lib/errors.js +0 -17
- package/node_modules/zod/lib/external.d.ts +0 -6
- package/node_modules/zod/lib/helpers/enumUtil.js +0 -2
- package/node_modules/zod/lib/helpers/errorUtil.js +0 -8
- package/node_modules/zod/lib/helpers/partialUtil.js +0 -2
- package/node_modules/zod/lib/helpers/typeAliases.js +0 -2
- package/node_modules/zod/lib/index.d.ts +0 -4
- package/node_modules/zod/lib/index.umd.js +0 -4497
- package/node_modules/zod/lib/standard-schema.js +0 -2
- /package/node_modules/zod/{lib/benchmarks/index.d.ts → compile.d.cts} +0 -0
- /package/node_modules/zod/{lib/helpers/typeAliases.d.ts → src/v3/helpers/typeAliases.ts} +0 -0
- /package/node_modules/zod/{lib/helpers/enumUtil.d.ts → v3/helpers/enumUtil.d.cts} +0 -0
- /package/node_modules/zod/{lib/standard-schema.d.ts → v3/standard-schema.d.cts} +0 -0
|
@@ -1,24 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
3
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
4
|
-
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");
|
|
5
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
6
|
-
};
|
|
7
|
-
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
8
|
-
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
9
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
10
|
-
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");
|
|
11
|
-
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
12
|
-
};
|
|
13
|
-
var _ZodEnum_cache, _ZodNativeEnum_cache;
|
|
14
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.boolean = exports.bigint = exports.array = exports.any = exports.coerce = exports.ZodFirstPartyTypeKind = exports.late = exports.ZodSchema = exports.Schema = exports.
|
|
16
|
-
exports.NEVER = exports.void = exports.unknown = exports.union = exports.undefined = exports.tuple = exports.transformer = exports.symbol = exports.string = exports.strictObject = exports.set = exports.record = exports.promise = exports.preprocess = exports.pipeline = exports.ostring = exports.optional = exports.onumber = exports.oboolean = exports.object = exports.number = exports.nullable = exports.null = exports.never = exports.nativeEnum = exports.nan = exports.map = exports.literal = exports.lazy = exports.intersection = exports.instanceof = exports.function = exports.enum = exports.effect =
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
const
|
|
20
|
-
const
|
|
21
|
-
const
|
|
3
|
+
exports.discriminatedUnion = exports.date = exports.boolean = exports.bigint = exports.array = exports.any = exports.coerce = exports.ZodFirstPartyTypeKind = exports.late = exports.ZodSchema = exports.Schema = exports.ZodReadonly = exports.ZodPipeline = exports.ZodBranded = exports.BRAND = exports.ZodNaN = exports.ZodCatch = exports.ZodDefault = exports.ZodNullable = exports.ZodOptional = exports.ZodTransformer = exports.ZodEffects = exports.ZodPromise = exports.ZodNativeEnum = exports.ZodEnum = exports.ZodLiteral = exports.ZodLazy = exports.ZodFunction = exports.ZodSet = exports.ZodMap = exports.ZodRecord = exports.ZodTuple = exports.ZodIntersection = exports.ZodDiscriminatedUnion = exports.ZodUnion = exports.ZodObject = exports.ZodArray = exports.ZodVoid = exports.ZodNever = exports.ZodUnknown = exports.ZodAny = exports.ZodNull = exports.ZodUndefined = exports.ZodSymbol = exports.ZodDate = exports.ZodBoolean = exports.ZodBigInt = exports.ZodNumber = exports.ZodString = exports.ZodType = void 0;
|
|
4
|
+
exports.NEVER = exports.void = exports.unknown = exports.union = exports.undefined = exports.tuple = exports.transformer = exports.symbol = exports.string = exports.strictObject = exports.set = exports.record = exports.promise = exports.preprocess = exports.pipeline = exports.ostring = exports.optional = exports.onumber = exports.oboolean = exports.object = exports.number = exports.nullable = exports.null = exports.never = exports.nativeEnum = exports.nan = exports.map = exports.literal = exports.lazy = exports.intersection = exports.instanceof = exports.function = exports.enum = exports.effect = void 0;
|
|
5
|
+
exports.datetimeRegex = datetimeRegex;
|
|
6
|
+
exports.custom = custom;
|
|
7
|
+
const ZodError_js_1 = require("./ZodError.cjs");
|
|
8
|
+
const errors_js_1 = require("./errors.cjs");
|
|
9
|
+
const errorUtil_js_1 = require("./helpers/errorUtil.cjs");
|
|
10
|
+
const parseUtil_js_1 = require("./helpers/parseUtil.cjs");
|
|
11
|
+
const util_js_1 = require("./helpers/util.cjs");
|
|
22
12
|
class ParseInputLazyPath {
|
|
23
13
|
constructor(parent, value, path, key) {
|
|
24
14
|
this._cachedPath = [];
|
|
@@ -29,7 +19,7 @@ class ParseInputLazyPath {
|
|
|
29
19
|
}
|
|
30
20
|
get path() {
|
|
31
21
|
if (!this._cachedPath.length) {
|
|
32
|
-
if (this._key
|
|
22
|
+
if (Array.isArray(this._key)) {
|
|
33
23
|
this._cachedPath.push(...this._path, ...this._key);
|
|
34
24
|
}
|
|
35
25
|
else {
|
|
@@ -40,7 +30,7 @@ class ParseInputLazyPath {
|
|
|
40
30
|
}
|
|
41
31
|
}
|
|
42
32
|
const handleResult = (ctx, result) => {
|
|
43
|
-
if ((0,
|
|
33
|
+
if ((0, parseUtil_js_1.isValid)(result)) {
|
|
44
34
|
return { success: true, data: result.value };
|
|
45
35
|
}
|
|
46
36
|
else {
|
|
@@ -52,7 +42,7 @@ const handleResult = (ctx, result) => {
|
|
|
52
42
|
get error() {
|
|
53
43
|
if (this._error)
|
|
54
44
|
return this._error;
|
|
55
|
-
const error = new
|
|
45
|
+
const error = new ZodError_js_1.ZodError(ctx.common.issues);
|
|
56
46
|
this._error = error;
|
|
57
47
|
return this._error;
|
|
58
48
|
},
|
|
@@ -69,17 +59,16 @@ function processCreateParams(params) {
|
|
|
69
59
|
if (errorMap)
|
|
70
60
|
return { errorMap: errorMap, description };
|
|
71
61
|
const customMap = (iss, ctx) => {
|
|
72
|
-
var _a, _b;
|
|
73
62
|
const { message } = params;
|
|
74
63
|
if (iss.code === "invalid_enum_value") {
|
|
75
|
-
return { message: message
|
|
64
|
+
return { message: message ?? ctx.defaultError };
|
|
76
65
|
}
|
|
77
66
|
if (typeof ctx.data === "undefined") {
|
|
78
|
-
return { message:
|
|
67
|
+
return { message: message ?? required_error ?? ctx.defaultError };
|
|
79
68
|
}
|
|
80
69
|
if (iss.code !== "invalid_type")
|
|
81
70
|
return { message: ctx.defaultError };
|
|
82
|
-
return { message:
|
|
71
|
+
return { message: message ?? invalid_type_error ?? ctx.defaultError };
|
|
83
72
|
};
|
|
84
73
|
return { errorMap: customMap, description };
|
|
85
74
|
}
|
|
@@ -88,13 +77,13 @@ class ZodType {
|
|
|
88
77
|
return this._def.description;
|
|
89
78
|
}
|
|
90
79
|
_getType(input) {
|
|
91
|
-
return (0,
|
|
80
|
+
return (0, util_js_1.getParsedType)(input.data);
|
|
92
81
|
}
|
|
93
82
|
_getOrReturnCtx(input, ctx) {
|
|
94
83
|
return (ctx || {
|
|
95
84
|
common: input.parent.common,
|
|
96
85
|
data: input.data,
|
|
97
|
-
parsedType: (0,
|
|
86
|
+
parsedType: (0, util_js_1.getParsedType)(input.data),
|
|
98
87
|
schemaErrorMap: this._def.errorMap,
|
|
99
88
|
path: input.path,
|
|
100
89
|
parent: input.parent,
|
|
@@ -102,11 +91,11 @@ class ZodType {
|
|
|
102
91
|
}
|
|
103
92
|
_processInputParams(input) {
|
|
104
93
|
return {
|
|
105
|
-
status: new
|
|
94
|
+
status: new parseUtil_js_1.ParseStatus(),
|
|
106
95
|
ctx: {
|
|
107
96
|
common: input.parent.common,
|
|
108
97
|
data: input.data,
|
|
109
|
-
parsedType: (0,
|
|
98
|
+
parsedType: (0, util_js_1.getParsedType)(input.data),
|
|
110
99
|
schemaErrorMap: this._def.errorMap,
|
|
111
100
|
path: input.path,
|
|
112
101
|
parent: input.parent,
|
|
@@ -115,7 +104,7 @@ class ZodType {
|
|
|
115
104
|
}
|
|
116
105
|
_parseSync(input) {
|
|
117
106
|
const result = this._parse(input);
|
|
118
|
-
if ((0,
|
|
107
|
+
if ((0, parseUtil_js_1.isAsync)(result)) {
|
|
119
108
|
throw new Error("Synchronous parse encountered promise.");
|
|
120
109
|
}
|
|
121
110
|
return result;
|
|
@@ -131,24 +120,22 @@ class ZodType {
|
|
|
131
120
|
throw result.error;
|
|
132
121
|
}
|
|
133
122
|
safeParse(data, params) {
|
|
134
|
-
var _a;
|
|
135
123
|
const ctx = {
|
|
136
124
|
common: {
|
|
137
125
|
issues: [],
|
|
138
|
-
async:
|
|
139
|
-
contextualErrorMap: params
|
|
126
|
+
async: params?.async ?? false,
|
|
127
|
+
contextualErrorMap: params?.errorMap,
|
|
140
128
|
},
|
|
141
|
-
path:
|
|
129
|
+
path: params?.path || [],
|
|
142
130
|
schemaErrorMap: this._def.errorMap,
|
|
143
131
|
parent: null,
|
|
144
132
|
data,
|
|
145
|
-
parsedType: (0,
|
|
133
|
+
parsedType: (0, util_js_1.getParsedType)(data),
|
|
146
134
|
};
|
|
147
135
|
const result = this._parseSync({ data, path: ctx.path, parent: ctx });
|
|
148
136
|
return handleResult(ctx, result);
|
|
149
137
|
}
|
|
150
138
|
"~validate"(data) {
|
|
151
|
-
var _a, _b;
|
|
152
139
|
const ctx = {
|
|
153
140
|
common: {
|
|
154
141
|
issues: [],
|
|
@@ -158,12 +145,12 @@ class ZodType {
|
|
|
158
145
|
schemaErrorMap: this._def.errorMap,
|
|
159
146
|
parent: null,
|
|
160
147
|
data,
|
|
161
|
-
parsedType: (0,
|
|
148
|
+
parsedType: (0, util_js_1.getParsedType)(data),
|
|
162
149
|
};
|
|
163
150
|
if (!this["~standard"].async) {
|
|
164
151
|
try {
|
|
165
152
|
const result = this._parseSync({ data, path: [], parent: ctx });
|
|
166
|
-
return (0,
|
|
153
|
+
return (0, parseUtil_js_1.isValid)(result)
|
|
167
154
|
? {
|
|
168
155
|
value: result.value,
|
|
169
156
|
}
|
|
@@ -172,7 +159,7 @@ class ZodType {
|
|
|
172
159
|
};
|
|
173
160
|
}
|
|
174
161
|
catch (err) {
|
|
175
|
-
if (
|
|
162
|
+
if (err?.message?.toLowerCase()?.includes("encountered")) {
|
|
176
163
|
this["~standard"].async = true;
|
|
177
164
|
}
|
|
178
165
|
ctx.common = {
|
|
@@ -181,7 +168,7 @@ class ZodType {
|
|
|
181
168
|
};
|
|
182
169
|
}
|
|
183
170
|
}
|
|
184
|
-
return this._parseAsync({ data, path: [], parent: ctx }).then((result) => (0,
|
|
171
|
+
return this._parseAsync({ data, path: [], parent: ctx }).then((result) => (0, parseUtil_js_1.isValid)(result)
|
|
185
172
|
? {
|
|
186
173
|
value: result.value,
|
|
187
174
|
}
|
|
@@ -199,19 +186,17 @@ class ZodType {
|
|
|
199
186
|
const ctx = {
|
|
200
187
|
common: {
|
|
201
188
|
issues: [],
|
|
202
|
-
contextualErrorMap: params
|
|
189
|
+
contextualErrorMap: params?.errorMap,
|
|
203
190
|
async: true,
|
|
204
191
|
},
|
|
205
|
-
path:
|
|
192
|
+
path: params?.path || [],
|
|
206
193
|
schemaErrorMap: this._def.errorMap,
|
|
207
194
|
parent: null,
|
|
208
195
|
data,
|
|
209
|
-
parsedType: (0,
|
|
196
|
+
parsedType: (0, util_js_1.getParsedType)(data),
|
|
210
197
|
};
|
|
211
198
|
const maybeAsyncResult = this._parse({ data, path: ctx.path, parent: ctx });
|
|
212
|
-
const result = await ((0,
|
|
213
|
-
? maybeAsyncResult
|
|
214
|
-
: Promise.resolve(maybeAsyncResult));
|
|
199
|
+
const result = await ((0, parseUtil_js_1.isAsync)(maybeAsyncResult) ? maybeAsyncResult : Promise.resolve(maybeAsyncResult));
|
|
215
200
|
return handleResult(ctx, result);
|
|
216
201
|
}
|
|
217
202
|
refine(check, message) {
|
|
@@ -229,7 +214,7 @@ class ZodType {
|
|
|
229
214
|
return this._refinement((val, ctx) => {
|
|
230
215
|
const result = check(val);
|
|
231
216
|
const setError = () => ctx.addIssue({
|
|
232
|
-
code:
|
|
217
|
+
code: ZodError_js_1.ZodIssueCode.custom,
|
|
233
218
|
...getIssueProperties(val),
|
|
234
219
|
});
|
|
235
220
|
if (typeof Promise !== "undefined" && result instanceof Promise) {
|
|
@@ -255,9 +240,7 @@ class ZodType {
|
|
|
255
240
|
refinement(check, refinementData) {
|
|
256
241
|
return this._refinement((val, ctx) => {
|
|
257
242
|
if (!check(val)) {
|
|
258
|
-
ctx.addIssue(typeof refinementData === "function"
|
|
259
|
-
? refinementData(val, ctx)
|
|
260
|
-
: refinementData);
|
|
243
|
+
ctx.addIssue(typeof refinementData === "function" ? refinementData(val, ctx) : refinementData);
|
|
261
244
|
return false;
|
|
262
245
|
}
|
|
263
246
|
else {
|
|
@@ -411,7 +394,7 @@ const emailRegex = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z
|
|
|
411
394
|
// const emailRegex =
|
|
412
395
|
// /^[a-z0-9.!#$%&’*+/=?^_`{|}~-]+@[a-z0-9-]+(?:\.[a-z0-9\-]+)*$/i;
|
|
413
396
|
// from https://thekevinscott.com/emojis-in-javascript/#writing-a-regular-expression
|
|
414
|
-
const _emojiRegex = `^
|
|
397
|
+
const _emojiRegex = `^[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`;
|
|
415
398
|
let emojiRegex;
|
|
416
399
|
// faster, simpler, safer
|
|
417
400
|
const ipv4Regex = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/;
|
|
@@ -432,15 +415,15 @@ const base64urlRegex = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z
|
|
|
432
415
|
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])))`;
|
|
433
416
|
const dateRegex = new RegExp(`^${dateRegexSource}$`);
|
|
434
417
|
function timeRegexSource(args) {
|
|
435
|
-
|
|
436
|
-
let regex = `([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d`;
|
|
418
|
+
let secondsRegexSource = `[0-5]\\d`;
|
|
437
419
|
if (args.precision) {
|
|
438
|
-
|
|
420
|
+
secondsRegexSource = `${secondsRegexSource}\\.\\d{${args.precision}}`;
|
|
439
421
|
}
|
|
440
422
|
else if (args.precision == null) {
|
|
441
|
-
|
|
423
|
+
secondsRegexSource = `${secondsRegexSource}(\\.\\d+)?`;
|
|
442
424
|
}
|
|
443
|
-
|
|
425
|
+
const secondsQuantifier = args.precision ? "+" : "?"; // require seconds if precision is nonzero
|
|
426
|
+
return `([01]\\d|2[0-3]):[0-5]\\d(:${secondsRegexSource})${secondsQuantifier}`;
|
|
444
427
|
}
|
|
445
428
|
function timeRegex(args) {
|
|
446
429
|
return new RegExp(`^${timeRegexSource(args)}$`);
|
|
@@ -455,7 +438,6 @@ function datetimeRegex(args) {
|
|
|
455
438
|
regex = `${regex}(${opts.join("|")})`;
|
|
456
439
|
return new RegExp(`^${regex}$`);
|
|
457
440
|
}
|
|
458
|
-
exports.datetimeRegex = datetimeRegex;
|
|
459
441
|
function isValidIP(ip, version) {
|
|
460
442
|
if ((version === "v4" || !version) && ipv4Regex.test(ip)) {
|
|
461
443
|
return true;
|
|
@@ -470,21 +452,26 @@ function isValidJWT(jwt, alg) {
|
|
|
470
452
|
return false;
|
|
471
453
|
try {
|
|
472
454
|
const [header] = jwt.split(".");
|
|
455
|
+
if (!header)
|
|
456
|
+
return false;
|
|
473
457
|
// Convert base64url to base64
|
|
474
458
|
const base64 = header
|
|
475
459
|
.replace(/-/g, "+")
|
|
476
460
|
.replace(/_/g, "/")
|
|
477
461
|
.padEnd(header.length + ((4 - (header.length % 4)) % 4), "=");
|
|
462
|
+
// @ts-ignore
|
|
478
463
|
const decoded = JSON.parse(atob(base64));
|
|
479
464
|
if (typeof decoded !== "object" || decoded === null)
|
|
480
465
|
return false;
|
|
481
|
-
if (
|
|
466
|
+
if ("typ" in decoded && decoded?.typ !== "JWT")
|
|
467
|
+
return false;
|
|
468
|
+
if (!decoded.alg)
|
|
482
469
|
return false;
|
|
483
470
|
if (alg && decoded.alg !== alg)
|
|
484
471
|
return false;
|
|
485
472
|
return true;
|
|
486
473
|
}
|
|
487
|
-
catch
|
|
474
|
+
catch {
|
|
488
475
|
return false;
|
|
489
476
|
}
|
|
490
477
|
}
|
|
@@ -503,23 +490,23 @@ class ZodString extends ZodType {
|
|
|
503
490
|
input.data = String(input.data);
|
|
504
491
|
}
|
|
505
492
|
const parsedType = this._getType(input);
|
|
506
|
-
if (parsedType !==
|
|
493
|
+
if (parsedType !== util_js_1.ZodParsedType.string) {
|
|
507
494
|
const ctx = this._getOrReturnCtx(input);
|
|
508
|
-
(0,
|
|
509
|
-
code:
|
|
510
|
-
expected:
|
|
495
|
+
(0, parseUtil_js_1.addIssueToContext)(ctx, {
|
|
496
|
+
code: ZodError_js_1.ZodIssueCode.invalid_type,
|
|
497
|
+
expected: util_js_1.ZodParsedType.string,
|
|
511
498
|
received: ctx.parsedType,
|
|
512
499
|
});
|
|
513
|
-
return
|
|
500
|
+
return parseUtil_js_1.INVALID;
|
|
514
501
|
}
|
|
515
|
-
const status = new
|
|
502
|
+
const status = new parseUtil_js_1.ParseStatus();
|
|
516
503
|
let ctx = undefined;
|
|
517
504
|
for (const check of this._def.checks) {
|
|
518
505
|
if (check.kind === "min") {
|
|
519
506
|
if (input.data.length < check.value) {
|
|
520
507
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
521
|
-
(0,
|
|
522
|
-
code:
|
|
508
|
+
(0, parseUtil_js_1.addIssueToContext)(ctx, {
|
|
509
|
+
code: ZodError_js_1.ZodIssueCode.too_small,
|
|
523
510
|
minimum: check.value,
|
|
524
511
|
type: "string",
|
|
525
512
|
inclusive: true,
|
|
@@ -532,8 +519,8 @@ class ZodString extends ZodType {
|
|
|
532
519
|
else if (check.kind === "max") {
|
|
533
520
|
if (input.data.length > check.value) {
|
|
534
521
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
535
|
-
(0,
|
|
536
|
-
code:
|
|
522
|
+
(0, parseUtil_js_1.addIssueToContext)(ctx, {
|
|
523
|
+
code: ZodError_js_1.ZodIssueCode.too_big,
|
|
537
524
|
maximum: check.value,
|
|
538
525
|
type: "string",
|
|
539
526
|
inclusive: true,
|
|
@@ -549,8 +536,8 @@ class ZodString extends ZodType {
|
|
|
549
536
|
if (tooBig || tooSmall) {
|
|
550
537
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
551
538
|
if (tooBig) {
|
|
552
|
-
(0,
|
|
553
|
-
code:
|
|
539
|
+
(0, parseUtil_js_1.addIssueToContext)(ctx, {
|
|
540
|
+
code: ZodError_js_1.ZodIssueCode.too_big,
|
|
554
541
|
maximum: check.value,
|
|
555
542
|
type: "string",
|
|
556
543
|
inclusive: true,
|
|
@@ -559,8 +546,8 @@ class ZodString extends ZodType {
|
|
|
559
546
|
});
|
|
560
547
|
}
|
|
561
548
|
else if (tooSmall) {
|
|
562
|
-
(0,
|
|
563
|
-
code:
|
|
549
|
+
(0, parseUtil_js_1.addIssueToContext)(ctx, {
|
|
550
|
+
code: ZodError_js_1.ZodIssueCode.too_small,
|
|
564
551
|
minimum: check.value,
|
|
565
552
|
type: "string",
|
|
566
553
|
inclusive: true,
|
|
@@ -574,9 +561,9 @@ class ZodString extends ZodType {
|
|
|
574
561
|
else if (check.kind === "email") {
|
|
575
562
|
if (!emailRegex.test(input.data)) {
|
|
576
563
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
577
|
-
(0,
|
|
564
|
+
(0, parseUtil_js_1.addIssueToContext)(ctx, {
|
|
578
565
|
validation: "email",
|
|
579
|
-
code:
|
|
566
|
+
code: ZodError_js_1.ZodIssueCode.invalid_string,
|
|
580
567
|
message: check.message,
|
|
581
568
|
});
|
|
582
569
|
status.dirty();
|
|
@@ -588,9 +575,9 @@ class ZodString extends ZodType {
|
|
|
588
575
|
}
|
|
589
576
|
if (!emojiRegex.test(input.data)) {
|
|
590
577
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
591
|
-
(0,
|
|
578
|
+
(0, parseUtil_js_1.addIssueToContext)(ctx, {
|
|
592
579
|
validation: "emoji",
|
|
593
|
-
code:
|
|
580
|
+
code: ZodError_js_1.ZodIssueCode.invalid_string,
|
|
594
581
|
message: check.message,
|
|
595
582
|
});
|
|
596
583
|
status.dirty();
|
|
@@ -599,9 +586,9 @@ class ZodString extends ZodType {
|
|
|
599
586
|
else if (check.kind === "uuid") {
|
|
600
587
|
if (!uuidRegex.test(input.data)) {
|
|
601
588
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
602
|
-
(0,
|
|
589
|
+
(0, parseUtil_js_1.addIssueToContext)(ctx, {
|
|
603
590
|
validation: "uuid",
|
|
604
|
-
code:
|
|
591
|
+
code: ZodError_js_1.ZodIssueCode.invalid_string,
|
|
605
592
|
message: check.message,
|
|
606
593
|
});
|
|
607
594
|
status.dirty();
|
|
@@ -610,9 +597,9 @@ class ZodString extends ZodType {
|
|
|
610
597
|
else if (check.kind === "nanoid") {
|
|
611
598
|
if (!nanoidRegex.test(input.data)) {
|
|
612
599
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
613
|
-
(0,
|
|
600
|
+
(0, parseUtil_js_1.addIssueToContext)(ctx, {
|
|
614
601
|
validation: "nanoid",
|
|
615
|
-
code:
|
|
602
|
+
code: ZodError_js_1.ZodIssueCode.invalid_string,
|
|
616
603
|
message: check.message,
|
|
617
604
|
});
|
|
618
605
|
status.dirty();
|
|
@@ -621,9 +608,9 @@ class ZodString extends ZodType {
|
|
|
621
608
|
else if (check.kind === "cuid") {
|
|
622
609
|
if (!cuidRegex.test(input.data)) {
|
|
623
610
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
624
|
-
(0,
|
|
611
|
+
(0, parseUtil_js_1.addIssueToContext)(ctx, {
|
|
625
612
|
validation: "cuid",
|
|
626
|
-
code:
|
|
613
|
+
code: ZodError_js_1.ZodIssueCode.invalid_string,
|
|
627
614
|
message: check.message,
|
|
628
615
|
});
|
|
629
616
|
status.dirty();
|
|
@@ -632,9 +619,9 @@ class ZodString extends ZodType {
|
|
|
632
619
|
else if (check.kind === "cuid2") {
|
|
633
620
|
if (!cuid2Regex.test(input.data)) {
|
|
634
621
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
635
|
-
(0,
|
|
622
|
+
(0, parseUtil_js_1.addIssueToContext)(ctx, {
|
|
636
623
|
validation: "cuid2",
|
|
637
|
-
code:
|
|
624
|
+
code: ZodError_js_1.ZodIssueCode.invalid_string,
|
|
638
625
|
message: check.message,
|
|
639
626
|
});
|
|
640
627
|
status.dirty();
|
|
@@ -643,9 +630,9 @@ class ZodString extends ZodType {
|
|
|
643
630
|
else if (check.kind === "ulid") {
|
|
644
631
|
if (!ulidRegex.test(input.data)) {
|
|
645
632
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
646
|
-
(0,
|
|
633
|
+
(0, parseUtil_js_1.addIssueToContext)(ctx, {
|
|
647
634
|
validation: "ulid",
|
|
648
|
-
code:
|
|
635
|
+
code: ZodError_js_1.ZodIssueCode.invalid_string,
|
|
649
636
|
message: check.message,
|
|
650
637
|
});
|
|
651
638
|
status.dirty();
|
|
@@ -653,13 +640,14 @@ class ZodString extends ZodType {
|
|
|
653
640
|
}
|
|
654
641
|
else if (check.kind === "url") {
|
|
655
642
|
try {
|
|
643
|
+
// @ts-ignore
|
|
656
644
|
new URL(input.data);
|
|
657
645
|
}
|
|
658
|
-
catch
|
|
646
|
+
catch {
|
|
659
647
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
660
|
-
(0,
|
|
648
|
+
(0, parseUtil_js_1.addIssueToContext)(ctx, {
|
|
661
649
|
validation: "url",
|
|
662
|
-
code:
|
|
650
|
+
code: ZodError_js_1.ZodIssueCode.invalid_string,
|
|
663
651
|
message: check.message,
|
|
664
652
|
});
|
|
665
653
|
status.dirty();
|
|
@@ -670,9 +658,9 @@ class ZodString extends ZodType {
|
|
|
670
658
|
const testResult = check.regex.test(input.data);
|
|
671
659
|
if (!testResult) {
|
|
672
660
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
673
|
-
(0,
|
|
661
|
+
(0, parseUtil_js_1.addIssueToContext)(ctx, {
|
|
674
662
|
validation: "regex",
|
|
675
|
-
code:
|
|
663
|
+
code: ZodError_js_1.ZodIssueCode.invalid_string,
|
|
676
664
|
message: check.message,
|
|
677
665
|
});
|
|
678
666
|
status.dirty();
|
|
@@ -684,8 +672,8 @@ class ZodString extends ZodType {
|
|
|
684
672
|
else if (check.kind === "includes") {
|
|
685
673
|
if (!input.data.includes(check.value, check.position)) {
|
|
686
674
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
687
|
-
(0,
|
|
688
|
-
code:
|
|
675
|
+
(0, parseUtil_js_1.addIssueToContext)(ctx, {
|
|
676
|
+
code: ZodError_js_1.ZodIssueCode.invalid_string,
|
|
689
677
|
validation: { includes: check.value, position: check.position },
|
|
690
678
|
message: check.message,
|
|
691
679
|
});
|
|
@@ -701,8 +689,8 @@ class ZodString extends ZodType {
|
|
|
701
689
|
else if (check.kind === "startsWith") {
|
|
702
690
|
if (!input.data.startsWith(check.value)) {
|
|
703
691
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
704
|
-
(0,
|
|
705
|
-
code:
|
|
692
|
+
(0, parseUtil_js_1.addIssueToContext)(ctx, {
|
|
693
|
+
code: ZodError_js_1.ZodIssueCode.invalid_string,
|
|
706
694
|
validation: { startsWith: check.value },
|
|
707
695
|
message: check.message,
|
|
708
696
|
});
|
|
@@ -712,8 +700,8 @@ class ZodString extends ZodType {
|
|
|
712
700
|
else if (check.kind === "endsWith") {
|
|
713
701
|
if (!input.data.endsWith(check.value)) {
|
|
714
702
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
715
|
-
(0,
|
|
716
|
-
code:
|
|
703
|
+
(0, parseUtil_js_1.addIssueToContext)(ctx, {
|
|
704
|
+
code: ZodError_js_1.ZodIssueCode.invalid_string,
|
|
717
705
|
validation: { endsWith: check.value },
|
|
718
706
|
message: check.message,
|
|
719
707
|
});
|
|
@@ -724,8 +712,8 @@ class ZodString extends ZodType {
|
|
|
724
712
|
const regex = datetimeRegex(check);
|
|
725
713
|
if (!regex.test(input.data)) {
|
|
726
714
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
727
|
-
(0,
|
|
728
|
-
code:
|
|
715
|
+
(0, parseUtil_js_1.addIssueToContext)(ctx, {
|
|
716
|
+
code: ZodError_js_1.ZodIssueCode.invalid_string,
|
|
729
717
|
validation: "datetime",
|
|
730
718
|
message: check.message,
|
|
731
719
|
});
|
|
@@ -736,8 +724,8 @@ class ZodString extends ZodType {
|
|
|
736
724
|
const regex = dateRegex;
|
|
737
725
|
if (!regex.test(input.data)) {
|
|
738
726
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
739
|
-
(0,
|
|
740
|
-
code:
|
|
727
|
+
(0, parseUtil_js_1.addIssueToContext)(ctx, {
|
|
728
|
+
code: ZodError_js_1.ZodIssueCode.invalid_string,
|
|
741
729
|
validation: "date",
|
|
742
730
|
message: check.message,
|
|
743
731
|
});
|
|
@@ -748,8 +736,8 @@ class ZodString extends ZodType {
|
|
|
748
736
|
const regex = timeRegex(check);
|
|
749
737
|
if (!regex.test(input.data)) {
|
|
750
738
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
751
|
-
(0,
|
|
752
|
-
code:
|
|
739
|
+
(0, parseUtil_js_1.addIssueToContext)(ctx, {
|
|
740
|
+
code: ZodError_js_1.ZodIssueCode.invalid_string,
|
|
753
741
|
validation: "time",
|
|
754
742
|
message: check.message,
|
|
755
743
|
});
|
|
@@ -759,9 +747,9 @@ class ZodString extends ZodType {
|
|
|
759
747
|
else if (check.kind === "duration") {
|
|
760
748
|
if (!durationRegex.test(input.data)) {
|
|
761
749
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
762
|
-
(0,
|
|
750
|
+
(0, parseUtil_js_1.addIssueToContext)(ctx, {
|
|
763
751
|
validation: "duration",
|
|
764
|
-
code:
|
|
752
|
+
code: ZodError_js_1.ZodIssueCode.invalid_string,
|
|
765
753
|
message: check.message,
|
|
766
754
|
});
|
|
767
755
|
status.dirty();
|
|
@@ -770,9 +758,9 @@ class ZodString extends ZodType {
|
|
|
770
758
|
else if (check.kind === "ip") {
|
|
771
759
|
if (!isValidIP(input.data, check.version)) {
|
|
772
760
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
773
|
-
(0,
|
|
761
|
+
(0, parseUtil_js_1.addIssueToContext)(ctx, {
|
|
774
762
|
validation: "ip",
|
|
775
|
-
code:
|
|
763
|
+
code: ZodError_js_1.ZodIssueCode.invalid_string,
|
|
776
764
|
message: check.message,
|
|
777
765
|
});
|
|
778
766
|
status.dirty();
|
|
@@ -781,9 +769,9 @@ class ZodString extends ZodType {
|
|
|
781
769
|
else if (check.kind === "jwt") {
|
|
782
770
|
if (!isValidJWT(input.data, check.alg)) {
|
|
783
771
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
784
|
-
(0,
|
|
772
|
+
(0, parseUtil_js_1.addIssueToContext)(ctx, {
|
|
785
773
|
validation: "jwt",
|
|
786
|
-
code:
|
|
774
|
+
code: ZodError_js_1.ZodIssueCode.invalid_string,
|
|
787
775
|
message: check.message,
|
|
788
776
|
});
|
|
789
777
|
status.dirty();
|
|
@@ -792,9 +780,9 @@ class ZodString extends ZodType {
|
|
|
792
780
|
else if (check.kind === "cidr") {
|
|
793
781
|
if (!isValidCidr(input.data, check.version)) {
|
|
794
782
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
795
|
-
(0,
|
|
783
|
+
(0, parseUtil_js_1.addIssueToContext)(ctx, {
|
|
796
784
|
validation: "cidr",
|
|
797
|
-
code:
|
|
785
|
+
code: ZodError_js_1.ZodIssueCode.invalid_string,
|
|
798
786
|
message: check.message,
|
|
799
787
|
});
|
|
800
788
|
status.dirty();
|
|
@@ -803,9 +791,9 @@ class ZodString extends ZodType {
|
|
|
803
791
|
else if (check.kind === "base64") {
|
|
804
792
|
if (!base64Regex.test(input.data)) {
|
|
805
793
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
806
|
-
(0,
|
|
794
|
+
(0, parseUtil_js_1.addIssueToContext)(ctx, {
|
|
807
795
|
validation: "base64",
|
|
808
|
-
code:
|
|
796
|
+
code: ZodError_js_1.ZodIssueCode.invalid_string,
|
|
809
797
|
message: check.message,
|
|
810
798
|
});
|
|
811
799
|
status.dirty();
|
|
@@ -814,16 +802,16 @@ class ZodString extends ZodType {
|
|
|
814
802
|
else if (check.kind === "base64url") {
|
|
815
803
|
if (!base64urlRegex.test(input.data)) {
|
|
816
804
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
817
|
-
(0,
|
|
805
|
+
(0, parseUtil_js_1.addIssueToContext)(ctx, {
|
|
818
806
|
validation: "base64url",
|
|
819
|
-
code:
|
|
807
|
+
code: ZodError_js_1.ZodIssueCode.invalid_string,
|
|
820
808
|
message: check.message,
|
|
821
809
|
});
|
|
822
810
|
status.dirty();
|
|
823
811
|
}
|
|
824
812
|
}
|
|
825
813
|
else {
|
|
826
|
-
|
|
814
|
+
util_js_1.util.assertNever(check);
|
|
827
815
|
}
|
|
828
816
|
}
|
|
829
817
|
return { status: status.value, value: input.data };
|
|
@@ -831,8 +819,8 @@ class ZodString extends ZodType {
|
|
|
831
819
|
_regex(regex, validation, message) {
|
|
832
820
|
return this.refinement((data) => regex.test(data), {
|
|
833
821
|
validation,
|
|
834
|
-
code:
|
|
835
|
-
...
|
|
822
|
+
code: ZodError_js_1.ZodIssueCode.invalid_string,
|
|
823
|
+
...errorUtil_js_1.errorUtil.errToObj(message),
|
|
836
824
|
});
|
|
837
825
|
}
|
|
838
826
|
_addCheck(check) {
|
|
@@ -842,50 +830,49 @@ class ZodString extends ZodType {
|
|
|
842
830
|
});
|
|
843
831
|
}
|
|
844
832
|
email(message) {
|
|
845
|
-
return this._addCheck({ kind: "email", ...
|
|
833
|
+
return this._addCheck({ kind: "email", ...errorUtil_js_1.errorUtil.errToObj(message) });
|
|
846
834
|
}
|
|
847
835
|
url(message) {
|
|
848
|
-
return this._addCheck({ kind: "url", ...
|
|
836
|
+
return this._addCheck({ kind: "url", ...errorUtil_js_1.errorUtil.errToObj(message) });
|
|
849
837
|
}
|
|
850
838
|
emoji(message) {
|
|
851
|
-
return this._addCheck({ kind: "emoji", ...
|
|
839
|
+
return this._addCheck({ kind: "emoji", ...errorUtil_js_1.errorUtil.errToObj(message) });
|
|
852
840
|
}
|
|
853
841
|
uuid(message) {
|
|
854
|
-
return this._addCheck({ kind: "uuid", ...
|
|
842
|
+
return this._addCheck({ kind: "uuid", ...errorUtil_js_1.errorUtil.errToObj(message) });
|
|
855
843
|
}
|
|
856
844
|
nanoid(message) {
|
|
857
|
-
return this._addCheck({ kind: "nanoid", ...
|
|
845
|
+
return this._addCheck({ kind: "nanoid", ...errorUtil_js_1.errorUtil.errToObj(message) });
|
|
858
846
|
}
|
|
859
847
|
cuid(message) {
|
|
860
|
-
return this._addCheck({ kind: "cuid", ...
|
|
848
|
+
return this._addCheck({ kind: "cuid", ...errorUtil_js_1.errorUtil.errToObj(message) });
|
|
861
849
|
}
|
|
862
850
|
cuid2(message) {
|
|
863
|
-
return this._addCheck({ kind: "cuid2", ...
|
|
851
|
+
return this._addCheck({ kind: "cuid2", ...errorUtil_js_1.errorUtil.errToObj(message) });
|
|
864
852
|
}
|
|
865
853
|
ulid(message) {
|
|
866
|
-
return this._addCheck({ kind: "ulid", ...
|
|
854
|
+
return this._addCheck({ kind: "ulid", ...errorUtil_js_1.errorUtil.errToObj(message) });
|
|
867
855
|
}
|
|
868
856
|
base64(message) {
|
|
869
|
-
return this._addCheck({ kind: "base64", ...
|
|
857
|
+
return this._addCheck({ kind: "base64", ...errorUtil_js_1.errorUtil.errToObj(message) });
|
|
870
858
|
}
|
|
871
859
|
base64url(message) {
|
|
872
860
|
// base64url encoding is a modification of base64 that can safely be used in URLs and filenames
|
|
873
861
|
return this._addCheck({
|
|
874
862
|
kind: "base64url",
|
|
875
|
-
...
|
|
863
|
+
...errorUtil_js_1.errorUtil.errToObj(message),
|
|
876
864
|
});
|
|
877
865
|
}
|
|
878
866
|
jwt(options) {
|
|
879
|
-
return this._addCheck({ kind: "jwt", ...
|
|
867
|
+
return this._addCheck({ kind: "jwt", ...errorUtil_js_1.errorUtil.errToObj(options) });
|
|
880
868
|
}
|
|
881
869
|
ip(options) {
|
|
882
|
-
return this._addCheck({ kind: "ip", ...
|
|
870
|
+
return this._addCheck({ kind: "ip", ...errorUtil_js_1.errorUtil.errToObj(options) });
|
|
883
871
|
}
|
|
884
872
|
cidr(options) {
|
|
885
|
-
return this._addCheck({ kind: "cidr", ...
|
|
873
|
+
return this._addCheck({ kind: "cidr", ...errorUtil_js_1.errorUtil.errToObj(options) });
|
|
886
874
|
}
|
|
887
875
|
datetime(options) {
|
|
888
|
-
var _a, _b;
|
|
889
876
|
if (typeof options === "string") {
|
|
890
877
|
return this._addCheck({
|
|
891
878
|
kind: "datetime",
|
|
@@ -897,10 +884,10 @@ class ZodString extends ZodType {
|
|
|
897
884
|
}
|
|
898
885
|
return this._addCheck({
|
|
899
886
|
kind: "datetime",
|
|
900
|
-
precision: typeof
|
|
901
|
-
offset:
|
|
902
|
-
local:
|
|
903
|
-
...
|
|
887
|
+
precision: typeof options?.precision === "undefined" ? null : options?.precision,
|
|
888
|
+
offset: options?.offset ?? false,
|
|
889
|
+
local: options?.local ?? false,
|
|
890
|
+
...errorUtil_js_1.errorUtil.errToObj(options?.message),
|
|
904
891
|
});
|
|
905
892
|
}
|
|
906
893
|
date(message) {
|
|
@@ -916,68 +903,68 @@ class ZodString extends ZodType {
|
|
|
916
903
|
}
|
|
917
904
|
return this._addCheck({
|
|
918
905
|
kind: "time",
|
|
919
|
-
precision: typeof
|
|
920
|
-
...
|
|
906
|
+
precision: typeof options?.precision === "undefined" ? null : options?.precision,
|
|
907
|
+
...errorUtil_js_1.errorUtil.errToObj(options?.message),
|
|
921
908
|
});
|
|
922
909
|
}
|
|
923
910
|
duration(message) {
|
|
924
|
-
return this._addCheck({ kind: "duration", ...
|
|
911
|
+
return this._addCheck({ kind: "duration", ...errorUtil_js_1.errorUtil.errToObj(message) });
|
|
925
912
|
}
|
|
926
913
|
regex(regex, message) {
|
|
927
914
|
return this._addCheck({
|
|
928
915
|
kind: "regex",
|
|
929
916
|
regex: regex,
|
|
930
|
-
...
|
|
917
|
+
...errorUtil_js_1.errorUtil.errToObj(message),
|
|
931
918
|
});
|
|
932
919
|
}
|
|
933
920
|
includes(value, options) {
|
|
934
921
|
return this._addCheck({
|
|
935
922
|
kind: "includes",
|
|
936
923
|
value: value,
|
|
937
|
-
position: options
|
|
938
|
-
...
|
|
924
|
+
position: options?.position,
|
|
925
|
+
...errorUtil_js_1.errorUtil.errToObj(options?.message),
|
|
939
926
|
});
|
|
940
927
|
}
|
|
941
928
|
startsWith(value, message) {
|
|
942
929
|
return this._addCheck({
|
|
943
930
|
kind: "startsWith",
|
|
944
931
|
value: value,
|
|
945
|
-
...
|
|
932
|
+
...errorUtil_js_1.errorUtil.errToObj(message),
|
|
946
933
|
});
|
|
947
934
|
}
|
|
948
935
|
endsWith(value, message) {
|
|
949
936
|
return this._addCheck({
|
|
950
937
|
kind: "endsWith",
|
|
951
938
|
value: value,
|
|
952
|
-
...
|
|
939
|
+
...errorUtil_js_1.errorUtil.errToObj(message),
|
|
953
940
|
});
|
|
954
941
|
}
|
|
955
942
|
min(minLength, message) {
|
|
956
943
|
return this._addCheck({
|
|
957
944
|
kind: "min",
|
|
958
945
|
value: minLength,
|
|
959
|
-
...
|
|
946
|
+
...errorUtil_js_1.errorUtil.errToObj(message),
|
|
960
947
|
});
|
|
961
948
|
}
|
|
962
949
|
max(maxLength, message) {
|
|
963
950
|
return this._addCheck({
|
|
964
951
|
kind: "max",
|
|
965
952
|
value: maxLength,
|
|
966
|
-
...
|
|
953
|
+
...errorUtil_js_1.errorUtil.errToObj(message),
|
|
967
954
|
});
|
|
968
955
|
}
|
|
969
956
|
length(len, message) {
|
|
970
957
|
return this._addCheck({
|
|
971
958
|
kind: "length",
|
|
972
959
|
value: len,
|
|
973
|
-
...
|
|
960
|
+
...errorUtil_js_1.errorUtil.errToObj(message),
|
|
974
961
|
});
|
|
975
962
|
}
|
|
976
963
|
/**
|
|
977
964
|
* Equivalent to `.min(1)`
|
|
978
965
|
*/
|
|
979
966
|
nonempty(message) {
|
|
980
|
-
return this.min(1,
|
|
967
|
+
return this.min(1, errorUtil_js_1.errorUtil.errToObj(message));
|
|
981
968
|
}
|
|
982
969
|
trim() {
|
|
983
970
|
return new ZodString({
|
|
@@ -1069,11 +1056,10 @@ class ZodString extends ZodType {
|
|
|
1069
1056
|
}
|
|
1070
1057
|
exports.ZodString = ZodString;
|
|
1071
1058
|
ZodString.create = (params) => {
|
|
1072
|
-
var _a;
|
|
1073
1059
|
return new ZodString({
|
|
1074
1060
|
checks: [],
|
|
1075
1061
|
typeName: ZodFirstPartyTypeKind.ZodString,
|
|
1076
|
-
coerce:
|
|
1062
|
+
coerce: params?.coerce ?? false,
|
|
1077
1063
|
...processCreateParams(params),
|
|
1078
1064
|
});
|
|
1079
1065
|
};
|
|
@@ -1082,9 +1068,9 @@ function floatSafeRemainder(val, step) {
|
|
|
1082
1068
|
const valDecCount = (val.toString().split(".")[1] || "").length;
|
|
1083
1069
|
const stepDecCount = (step.toString().split(".")[1] || "").length;
|
|
1084
1070
|
const decCount = valDecCount > stepDecCount ? valDecCount : stepDecCount;
|
|
1085
|
-
const valInt = parseInt(val.toFixed(decCount).replace(".", ""));
|
|
1086
|
-
const stepInt = parseInt(step.toFixed(decCount).replace(".", ""));
|
|
1087
|
-
return (valInt % stepInt) /
|
|
1071
|
+
const valInt = Number.parseInt(val.toFixed(decCount).replace(".", ""));
|
|
1072
|
+
const stepInt = Number.parseInt(step.toFixed(decCount).replace(".", ""));
|
|
1073
|
+
return (valInt % stepInt) / 10 ** decCount;
|
|
1088
1074
|
}
|
|
1089
1075
|
class ZodNumber extends ZodType {
|
|
1090
1076
|
constructor() {
|
|
@@ -1098,23 +1084,23 @@ class ZodNumber extends ZodType {
|
|
|
1098
1084
|
input.data = Number(input.data);
|
|
1099
1085
|
}
|
|
1100
1086
|
const parsedType = this._getType(input);
|
|
1101
|
-
if (parsedType !==
|
|
1087
|
+
if (parsedType !== util_js_1.ZodParsedType.number) {
|
|
1102
1088
|
const ctx = this._getOrReturnCtx(input);
|
|
1103
|
-
(0,
|
|
1104
|
-
code:
|
|
1105
|
-
expected:
|
|
1089
|
+
(0, parseUtil_js_1.addIssueToContext)(ctx, {
|
|
1090
|
+
code: ZodError_js_1.ZodIssueCode.invalid_type,
|
|
1091
|
+
expected: util_js_1.ZodParsedType.number,
|
|
1106
1092
|
received: ctx.parsedType,
|
|
1107
1093
|
});
|
|
1108
|
-
return
|
|
1094
|
+
return parseUtil_js_1.INVALID;
|
|
1109
1095
|
}
|
|
1110
1096
|
let ctx = undefined;
|
|
1111
|
-
const status = new
|
|
1097
|
+
const status = new parseUtil_js_1.ParseStatus();
|
|
1112
1098
|
for (const check of this._def.checks) {
|
|
1113
1099
|
if (check.kind === "int") {
|
|
1114
|
-
if (!
|
|
1100
|
+
if (!util_js_1.util.isInteger(input.data)) {
|
|
1115
1101
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
1116
|
-
(0,
|
|
1117
|
-
code:
|
|
1102
|
+
(0, parseUtil_js_1.addIssueToContext)(ctx, {
|
|
1103
|
+
code: ZodError_js_1.ZodIssueCode.invalid_type,
|
|
1118
1104
|
expected: "integer",
|
|
1119
1105
|
received: "float",
|
|
1120
1106
|
message: check.message,
|
|
@@ -1123,13 +1109,11 @@ class ZodNumber extends ZodType {
|
|
|
1123
1109
|
}
|
|
1124
1110
|
}
|
|
1125
1111
|
else if (check.kind === "min") {
|
|
1126
|
-
const tooSmall = check.inclusive
|
|
1127
|
-
? input.data < check.value
|
|
1128
|
-
: input.data <= check.value;
|
|
1112
|
+
const tooSmall = check.inclusive ? input.data < check.value : input.data <= check.value;
|
|
1129
1113
|
if (tooSmall) {
|
|
1130
1114
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
1131
|
-
(0,
|
|
1132
|
-
code:
|
|
1115
|
+
(0, parseUtil_js_1.addIssueToContext)(ctx, {
|
|
1116
|
+
code: ZodError_js_1.ZodIssueCode.too_small,
|
|
1133
1117
|
minimum: check.value,
|
|
1134
1118
|
type: "number",
|
|
1135
1119
|
inclusive: check.inclusive,
|
|
@@ -1140,13 +1124,11 @@ class ZodNumber extends ZodType {
|
|
|
1140
1124
|
}
|
|
1141
1125
|
}
|
|
1142
1126
|
else if (check.kind === "max") {
|
|
1143
|
-
const tooBig = check.inclusive
|
|
1144
|
-
? input.data > check.value
|
|
1145
|
-
: input.data >= check.value;
|
|
1127
|
+
const tooBig = check.inclusive ? input.data > check.value : input.data >= check.value;
|
|
1146
1128
|
if (tooBig) {
|
|
1147
1129
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
1148
|
-
(0,
|
|
1149
|
-
code:
|
|
1130
|
+
(0, parseUtil_js_1.addIssueToContext)(ctx, {
|
|
1131
|
+
code: ZodError_js_1.ZodIssueCode.too_big,
|
|
1150
1132
|
maximum: check.value,
|
|
1151
1133
|
type: "number",
|
|
1152
1134
|
inclusive: check.inclusive,
|
|
@@ -1159,8 +1141,8 @@ class ZodNumber extends ZodType {
|
|
|
1159
1141
|
else if (check.kind === "multipleOf") {
|
|
1160
1142
|
if (floatSafeRemainder(input.data, check.value) !== 0) {
|
|
1161
1143
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
1162
|
-
(0,
|
|
1163
|
-
code:
|
|
1144
|
+
(0, parseUtil_js_1.addIssueToContext)(ctx, {
|
|
1145
|
+
code: ZodError_js_1.ZodIssueCode.not_multiple_of,
|
|
1164
1146
|
multipleOf: check.value,
|
|
1165
1147
|
message: check.message,
|
|
1166
1148
|
});
|
|
@@ -1170,30 +1152,30 @@ class ZodNumber extends ZodType {
|
|
|
1170
1152
|
else if (check.kind === "finite") {
|
|
1171
1153
|
if (!Number.isFinite(input.data)) {
|
|
1172
1154
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
1173
|
-
(0,
|
|
1174
|
-
code:
|
|
1155
|
+
(0, parseUtil_js_1.addIssueToContext)(ctx, {
|
|
1156
|
+
code: ZodError_js_1.ZodIssueCode.not_finite,
|
|
1175
1157
|
message: check.message,
|
|
1176
1158
|
});
|
|
1177
1159
|
status.dirty();
|
|
1178
1160
|
}
|
|
1179
1161
|
}
|
|
1180
1162
|
else {
|
|
1181
|
-
|
|
1163
|
+
util_js_1.util.assertNever(check);
|
|
1182
1164
|
}
|
|
1183
1165
|
}
|
|
1184
1166
|
return { status: status.value, value: input.data };
|
|
1185
1167
|
}
|
|
1186
1168
|
gte(value, message) {
|
|
1187
|
-
return this.setLimit("min", value, true,
|
|
1169
|
+
return this.setLimit("min", value, true, errorUtil_js_1.errorUtil.toString(message));
|
|
1188
1170
|
}
|
|
1189
1171
|
gt(value, message) {
|
|
1190
|
-
return this.setLimit("min", value, false,
|
|
1172
|
+
return this.setLimit("min", value, false, errorUtil_js_1.errorUtil.toString(message));
|
|
1191
1173
|
}
|
|
1192
1174
|
lte(value, message) {
|
|
1193
|
-
return this.setLimit("max", value, true,
|
|
1175
|
+
return this.setLimit("max", value, true, errorUtil_js_1.errorUtil.toString(message));
|
|
1194
1176
|
}
|
|
1195
1177
|
lt(value, message) {
|
|
1196
|
-
return this.setLimit("max", value, false,
|
|
1178
|
+
return this.setLimit("max", value, false, errorUtil_js_1.errorUtil.toString(message));
|
|
1197
1179
|
}
|
|
1198
1180
|
setLimit(kind, value, inclusive, message) {
|
|
1199
1181
|
return new ZodNumber({
|
|
@@ -1204,7 +1186,7 @@ class ZodNumber extends ZodType {
|
|
|
1204
1186
|
kind,
|
|
1205
1187
|
value,
|
|
1206
1188
|
inclusive,
|
|
1207
|
-
message:
|
|
1189
|
+
message: errorUtil_js_1.errorUtil.toString(message),
|
|
1208
1190
|
},
|
|
1209
1191
|
],
|
|
1210
1192
|
});
|
|
@@ -1218,7 +1200,7 @@ class ZodNumber extends ZodType {
|
|
|
1218
1200
|
int(message) {
|
|
1219
1201
|
return this._addCheck({
|
|
1220
1202
|
kind: "int",
|
|
1221
|
-
message:
|
|
1203
|
+
message: errorUtil_js_1.errorUtil.toString(message),
|
|
1222
1204
|
});
|
|
1223
1205
|
}
|
|
1224
1206
|
positive(message) {
|
|
@@ -1226,7 +1208,7 @@ class ZodNumber extends ZodType {
|
|
|
1226
1208
|
kind: "min",
|
|
1227
1209
|
value: 0,
|
|
1228
1210
|
inclusive: false,
|
|
1229
|
-
message:
|
|
1211
|
+
message: errorUtil_js_1.errorUtil.toString(message),
|
|
1230
1212
|
});
|
|
1231
1213
|
}
|
|
1232
1214
|
negative(message) {
|
|
@@ -1234,7 +1216,7 @@ class ZodNumber extends ZodType {
|
|
|
1234
1216
|
kind: "max",
|
|
1235
1217
|
value: 0,
|
|
1236
1218
|
inclusive: false,
|
|
1237
|
-
message:
|
|
1219
|
+
message: errorUtil_js_1.errorUtil.toString(message),
|
|
1238
1220
|
});
|
|
1239
1221
|
}
|
|
1240
1222
|
nonpositive(message) {
|
|
@@ -1242,7 +1224,7 @@ class ZodNumber extends ZodType {
|
|
|
1242
1224
|
kind: "max",
|
|
1243
1225
|
value: 0,
|
|
1244
1226
|
inclusive: true,
|
|
1245
|
-
message:
|
|
1227
|
+
message: errorUtil_js_1.errorUtil.toString(message),
|
|
1246
1228
|
});
|
|
1247
1229
|
}
|
|
1248
1230
|
nonnegative(message) {
|
|
@@ -1250,20 +1232,20 @@ class ZodNumber extends ZodType {
|
|
|
1250
1232
|
kind: "min",
|
|
1251
1233
|
value: 0,
|
|
1252
1234
|
inclusive: true,
|
|
1253
|
-
message:
|
|
1235
|
+
message: errorUtil_js_1.errorUtil.toString(message),
|
|
1254
1236
|
});
|
|
1255
1237
|
}
|
|
1256
1238
|
multipleOf(value, message) {
|
|
1257
1239
|
return this._addCheck({
|
|
1258
1240
|
kind: "multipleOf",
|
|
1259
1241
|
value: value,
|
|
1260
|
-
message:
|
|
1242
|
+
message: errorUtil_js_1.errorUtil.toString(message),
|
|
1261
1243
|
});
|
|
1262
1244
|
}
|
|
1263
1245
|
finite(message) {
|
|
1264
1246
|
return this._addCheck({
|
|
1265
1247
|
kind: "finite",
|
|
1266
|
-
message:
|
|
1248
|
+
message: errorUtil_js_1.errorUtil.toString(message),
|
|
1267
1249
|
});
|
|
1268
1250
|
}
|
|
1269
1251
|
safe(message) {
|
|
@@ -1271,12 +1253,12 @@ class ZodNumber extends ZodType {
|
|
|
1271
1253
|
kind: "min",
|
|
1272
1254
|
inclusive: true,
|
|
1273
1255
|
value: Number.MIN_SAFE_INTEGER,
|
|
1274
|
-
message:
|
|
1256
|
+
message: errorUtil_js_1.errorUtil.toString(message),
|
|
1275
1257
|
})._addCheck({
|
|
1276
1258
|
kind: "max",
|
|
1277
1259
|
inclusive: true,
|
|
1278
1260
|
value: Number.MAX_SAFE_INTEGER,
|
|
1279
|
-
message:
|
|
1261
|
+
message: errorUtil_js_1.errorUtil.toString(message),
|
|
1280
1262
|
});
|
|
1281
1263
|
}
|
|
1282
1264
|
get minValue() {
|
|
@@ -1300,15 +1282,13 @@ class ZodNumber extends ZodType {
|
|
|
1300
1282
|
return max;
|
|
1301
1283
|
}
|
|
1302
1284
|
get isInt() {
|
|
1303
|
-
return !!this._def.checks.find((ch) => ch.kind === "int" ||
|
|
1304
|
-
(ch.kind === "multipleOf" && util_1.util.isInteger(ch.value)));
|
|
1285
|
+
return !!this._def.checks.find((ch) => ch.kind === "int" || (ch.kind === "multipleOf" && util_js_1.util.isInteger(ch.value)));
|
|
1305
1286
|
}
|
|
1306
1287
|
get isFinite() {
|
|
1307
|
-
let max = null
|
|
1288
|
+
let max = null;
|
|
1289
|
+
let min = null;
|
|
1308
1290
|
for (const ch of this._def.checks) {
|
|
1309
|
-
if (ch.kind === "finite" ||
|
|
1310
|
-
ch.kind === "int" ||
|
|
1311
|
-
ch.kind === "multipleOf") {
|
|
1291
|
+
if (ch.kind === "finite" || ch.kind === "int" || ch.kind === "multipleOf") {
|
|
1312
1292
|
return true;
|
|
1313
1293
|
}
|
|
1314
1294
|
else if (ch.kind === "min") {
|
|
@@ -1328,7 +1308,7 @@ ZodNumber.create = (params) => {
|
|
|
1328
1308
|
return new ZodNumber({
|
|
1329
1309
|
checks: [],
|
|
1330
1310
|
typeName: ZodFirstPartyTypeKind.ZodNumber,
|
|
1331
|
-
coerce:
|
|
1311
|
+
coerce: params?.coerce || false,
|
|
1332
1312
|
...processCreateParams(params),
|
|
1333
1313
|
});
|
|
1334
1314
|
};
|
|
@@ -1343,25 +1323,23 @@ class ZodBigInt extends ZodType {
|
|
|
1343
1323
|
try {
|
|
1344
1324
|
input.data = BigInt(input.data);
|
|
1345
1325
|
}
|
|
1346
|
-
catch
|
|
1326
|
+
catch {
|
|
1347
1327
|
return this._getInvalidInput(input);
|
|
1348
1328
|
}
|
|
1349
1329
|
}
|
|
1350
1330
|
const parsedType = this._getType(input);
|
|
1351
|
-
if (parsedType !==
|
|
1331
|
+
if (parsedType !== util_js_1.ZodParsedType.bigint) {
|
|
1352
1332
|
return this._getInvalidInput(input);
|
|
1353
1333
|
}
|
|
1354
1334
|
let ctx = undefined;
|
|
1355
|
-
const status = new
|
|
1335
|
+
const status = new parseUtil_js_1.ParseStatus();
|
|
1356
1336
|
for (const check of this._def.checks) {
|
|
1357
1337
|
if (check.kind === "min") {
|
|
1358
|
-
const tooSmall = check.inclusive
|
|
1359
|
-
? input.data < check.value
|
|
1360
|
-
: input.data <= check.value;
|
|
1338
|
+
const tooSmall = check.inclusive ? input.data < check.value : input.data <= check.value;
|
|
1361
1339
|
if (tooSmall) {
|
|
1362
1340
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
1363
|
-
(0,
|
|
1364
|
-
code:
|
|
1341
|
+
(0, parseUtil_js_1.addIssueToContext)(ctx, {
|
|
1342
|
+
code: ZodError_js_1.ZodIssueCode.too_small,
|
|
1365
1343
|
type: "bigint",
|
|
1366
1344
|
minimum: check.value,
|
|
1367
1345
|
inclusive: check.inclusive,
|
|
@@ -1371,13 +1349,11 @@ class ZodBigInt extends ZodType {
|
|
|
1371
1349
|
}
|
|
1372
1350
|
}
|
|
1373
1351
|
else if (check.kind === "max") {
|
|
1374
|
-
const tooBig = check.inclusive
|
|
1375
|
-
? input.data > check.value
|
|
1376
|
-
: input.data >= check.value;
|
|
1352
|
+
const tooBig = check.inclusive ? input.data > check.value : input.data >= check.value;
|
|
1377
1353
|
if (tooBig) {
|
|
1378
1354
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
1379
|
-
(0,
|
|
1380
|
-
code:
|
|
1355
|
+
(0, parseUtil_js_1.addIssueToContext)(ctx, {
|
|
1356
|
+
code: ZodError_js_1.ZodIssueCode.too_big,
|
|
1381
1357
|
type: "bigint",
|
|
1382
1358
|
maximum: check.value,
|
|
1383
1359
|
inclusive: check.inclusive,
|
|
@@ -1389,8 +1365,8 @@ class ZodBigInt extends ZodType {
|
|
|
1389
1365
|
else if (check.kind === "multipleOf") {
|
|
1390
1366
|
if (input.data % check.value !== BigInt(0)) {
|
|
1391
1367
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
1392
|
-
(0,
|
|
1393
|
-
code:
|
|
1368
|
+
(0, parseUtil_js_1.addIssueToContext)(ctx, {
|
|
1369
|
+
code: ZodError_js_1.ZodIssueCode.not_multiple_of,
|
|
1394
1370
|
multipleOf: check.value,
|
|
1395
1371
|
message: check.message,
|
|
1396
1372
|
});
|
|
@@ -1398,31 +1374,31 @@ class ZodBigInt extends ZodType {
|
|
|
1398
1374
|
}
|
|
1399
1375
|
}
|
|
1400
1376
|
else {
|
|
1401
|
-
|
|
1377
|
+
util_js_1.util.assertNever(check);
|
|
1402
1378
|
}
|
|
1403
1379
|
}
|
|
1404
1380
|
return { status: status.value, value: input.data };
|
|
1405
1381
|
}
|
|
1406
1382
|
_getInvalidInput(input) {
|
|
1407
1383
|
const ctx = this._getOrReturnCtx(input);
|
|
1408
|
-
(0,
|
|
1409
|
-
code:
|
|
1410
|
-
expected:
|
|
1384
|
+
(0, parseUtil_js_1.addIssueToContext)(ctx, {
|
|
1385
|
+
code: ZodError_js_1.ZodIssueCode.invalid_type,
|
|
1386
|
+
expected: util_js_1.ZodParsedType.bigint,
|
|
1411
1387
|
received: ctx.parsedType,
|
|
1412
1388
|
});
|
|
1413
|
-
return
|
|
1389
|
+
return parseUtil_js_1.INVALID;
|
|
1414
1390
|
}
|
|
1415
1391
|
gte(value, message) {
|
|
1416
|
-
return this.setLimit("min", value, true,
|
|
1392
|
+
return this.setLimit("min", value, true, errorUtil_js_1.errorUtil.toString(message));
|
|
1417
1393
|
}
|
|
1418
1394
|
gt(value, message) {
|
|
1419
|
-
return this.setLimit("min", value, false,
|
|
1395
|
+
return this.setLimit("min", value, false, errorUtil_js_1.errorUtil.toString(message));
|
|
1420
1396
|
}
|
|
1421
1397
|
lte(value, message) {
|
|
1422
|
-
return this.setLimit("max", value, true,
|
|
1398
|
+
return this.setLimit("max", value, true, errorUtil_js_1.errorUtil.toString(message));
|
|
1423
1399
|
}
|
|
1424
1400
|
lt(value, message) {
|
|
1425
|
-
return this.setLimit("max", value, false,
|
|
1401
|
+
return this.setLimit("max", value, false, errorUtil_js_1.errorUtil.toString(message));
|
|
1426
1402
|
}
|
|
1427
1403
|
setLimit(kind, value, inclusive, message) {
|
|
1428
1404
|
return new ZodBigInt({
|
|
@@ -1433,7 +1409,7 @@ class ZodBigInt extends ZodType {
|
|
|
1433
1409
|
kind,
|
|
1434
1410
|
value,
|
|
1435
1411
|
inclusive,
|
|
1436
|
-
message:
|
|
1412
|
+
message: errorUtil_js_1.errorUtil.toString(message),
|
|
1437
1413
|
},
|
|
1438
1414
|
],
|
|
1439
1415
|
});
|
|
@@ -1449,7 +1425,7 @@ class ZodBigInt extends ZodType {
|
|
|
1449
1425
|
kind: "min",
|
|
1450
1426
|
value: BigInt(0),
|
|
1451
1427
|
inclusive: false,
|
|
1452
|
-
message:
|
|
1428
|
+
message: errorUtil_js_1.errorUtil.toString(message),
|
|
1453
1429
|
});
|
|
1454
1430
|
}
|
|
1455
1431
|
negative(message) {
|
|
@@ -1457,7 +1433,7 @@ class ZodBigInt extends ZodType {
|
|
|
1457
1433
|
kind: "max",
|
|
1458
1434
|
value: BigInt(0),
|
|
1459
1435
|
inclusive: false,
|
|
1460
|
-
message:
|
|
1436
|
+
message: errorUtil_js_1.errorUtil.toString(message),
|
|
1461
1437
|
});
|
|
1462
1438
|
}
|
|
1463
1439
|
nonpositive(message) {
|
|
@@ -1465,7 +1441,7 @@ class ZodBigInt extends ZodType {
|
|
|
1465
1441
|
kind: "max",
|
|
1466
1442
|
value: BigInt(0),
|
|
1467
1443
|
inclusive: true,
|
|
1468
|
-
message:
|
|
1444
|
+
message: errorUtil_js_1.errorUtil.toString(message),
|
|
1469
1445
|
});
|
|
1470
1446
|
}
|
|
1471
1447
|
nonnegative(message) {
|
|
@@ -1473,14 +1449,14 @@ class ZodBigInt extends ZodType {
|
|
|
1473
1449
|
kind: "min",
|
|
1474
1450
|
value: BigInt(0),
|
|
1475
1451
|
inclusive: true,
|
|
1476
|
-
message:
|
|
1452
|
+
message: errorUtil_js_1.errorUtil.toString(message),
|
|
1477
1453
|
});
|
|
1478
1454
|
}
|
|
1479
1455
|
multipleOf(value, message) {
|
|
1480
1456
|
return this._addCheck({
|
|
1481
1457
|
kind: "multipleOf",
|
|
1482
1458
|
value,
|
|
1483
|
-
message:
|
|
1459
|
+
message: errorUtil_js_1.errorUtil.toString(message),
|
|
1484
1460
|
});
|
|
1485
1461
|
}
|
|
1486
1462
|
get minValue() {
|
|
@@ -1506,11 +1482,10 @@ class ZodBigInt extends ZodType {
|
|
|
1506
1482
|
}
|
|
1507
1483
|
exports.ZodBigInt = ZodBigInt;
|
|
1508
1484
|
ZodBigInt.create = (params) => {
|
|
1509
|
-
var _a;
|
|
1510
1485
|
return new ZodBigInt({
|
|
1511
1486
|
checks: [],
|
|
1512
1487
|
typeName: ZodFirstPartyTypeKind.ZodBigInt,
|
|
1513
|
-
coerce:
|
|
1488
|
+
coerce: params?.coerce ?? false,
|
|
1514
1489
|
...processCreateParams(params),
|
|
1515
1490
|
});
|
|
1516
1491
|
};
|
|
@@ -1520,23 +1495,23 @@ class ZodBoolean extends ZodType {
|
|
|
1520
1495
|
input.data = Boolean(input.data);
|
|
1521
1496
|
}
|
|
1522
1497
|
const parsedType = this._getType(input);
|
|
1523
|
-
if (parsedType !==
|
|
1498
|
+
if (parsedType !== util_js_1.ZodParsedType.boolean) {
|
|
1524
1499
|
const ctx = this._getOrReturnCtx(input);
|
|
1525
|
-
(0,
|
|
1526
|
-
code:
|
|
1527
|
-
expected:
|
|
1500
|
+
(0, parseUtil_js_1.addIssueToContext)(ctx, {
|
|
1501
|
+
code: ZodError_js_1.ZodIssueCode.invalid_type,
|
|
1502
|
+
expected: util_js_1.ZodParsedType.boolean,
|
|
1528
1503
|
received: ctx.parsedType,
|
|
1529
1504
|
});
|
|
1530
|
-
return
|
|
1505
|
+
return parseUtil_js_1.INVALID;
|
|
1531
1506
|
}
|
|
1532
|
-
return (0,
|
|
1507
|
+
return (0, parseUtil_js_1.OK)(input.data);
|
|
1533
1508
|
}
|
|
1534
1509
|
}
|
|
1535
1510
|
exports.ZodBoolean = ZodBoolean;
|
|
1536
1511
|
ZodBoolean.create = (params) => {
|
|
1537
1512
|
return new ZodBoolean({
|
|
1538
1513
|
typeName: ZodFirstPartyTypeKind.ZodBoolean,
|
|
1539
|
-
coerce:
|
|
1514
|
+
coerce: params?.coerce || false,
|
|
1540
1515
|
...processCreateParams(params),
|
|
1541
1516
|
});
|
|
1542
1517
|
};
|
|
@@ -1546,30 +1521,30 @@ class ZodDate extends ZodType {
|
|
|
1546
1521
|
input.data = new Date(input.data);
|
|
1547
1522
|
}
|
|
1548
1523
|
const parsedType = this._getType(input);
|
|
1549
|
-
if (parsedType !==
|
|
1524
|
+
if (parsedType !== util_js_1.ZodParsedType.date) {
|
|
1550
1525
|
const ctx = this._getOrReturnCtx(input);
|
|
1551
|
-
(0,
|
|
1552
|
-
code:
|
|
1553
|
-
expected:
|
|
1526
|
+
(0, parseUtil_js_1.addIssueToContext)(ctx, {
|
|
1527
|
+
code: ZodError_js_1.ZodIssueCode.invalid_type,
|
|
1528
|
+
expected: util_js_1.ZodParsedType.date,
|
|
1554
1529
|
received: ctx.parsedType,
|
|
1555
1530
|
});
|
|
1556
|
-
return
|
|
1531
|
+
return parseUtil_js_1.INVALID;
|
|
1557
1532
|
}
|
|
1558
|
-
if (isNaN(input.data.getTime())) {
|
|
1533
|
+
if (Number.isNaN(input.data.getTime())) {
|
|
1559
1534
|
const ctx = this._getOrReturnCtx(input);
|
|
1560
|
-
(0,
|
|
1561
|
-
code:
|
|
1535
|
+
(0, parseUtil_js_1.addIssueToContext)(ctx, {
|
|
1536
|
+
code: ZodError_js_1.ZodIssueCode.invalid_date,
|
|
1562
1537
|
});
|
|
1563
|
-
return
|
|
1538
|
+
return parseUtil_js_1.INVALID;
|
|
1564
1539
|
}
|
|
1565
|
-
const status = new
|
|
1540
|
+
const status = new parseUtil_js_1.ParseStatus();
|
|
1566
1541
|
let ctx = undefined;
|
|
1567
1542
|
for (const check of this._def.checks) {
|
|
1568
1543
|
if (check.kind === "min") {
|
|
1569
1544
|
if (input.data.getTime() < check.value) {
|
|
1570
1545
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
1571
|
-
(0,
|
|
1572
|
-
code:
|
|
1546
|
+
(0, parseUtil_js_1.addIssueToContext)(ctx, {
|
|
1547
|
+
code: ZodError_js_1.ZodIssueCode.too_small,
|
|
1573
1548
|
message: check.message,
|
|
1574
1549
|
inclusive: true,
|
|
1575
1550
|
exact: false,
|
|
@@ -1582,8 +1557,8 @@ class ZodDate extends ZodType {
|
|
|
1582
1557
|
else if (check.kind === "max") {
|
|
1583
1558
|
if (input.data.getTime() > check.value) {
|
|
1584
1559
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
1585
|
-
(0,
|
|
1586
|
-
code:
|
|
1560
|
+
(0, parseUtil_js_1.addIssueToContext)(ctx, {
|
|
1561
|
+
code: ZodError_js_1.ZodIssueCode.too_big,
|
|
1587
1562
|
message: check.message,
|
|
1588
1563
|
inclusive: true,
|
|
1589
1564
|
exact: false,
|
|
@@ -1594,7 +1569,7 @@ class ZodDate extends ZodType {
|
|
|
1594
1569
|
}
|
|
1595
1570
|
}
|
|
1596
1571
|
else {
|
|
1597
|
-
|
|
1572
|
+
util_js_1.util.assertNever(check);
|
|
1598
1573
|
}
|
|
1599
1574
|
}
|
|
1600
1575
|
return {
|
|
@@ -1612,14 +1587,14 @@ class ZodDate extends ZodType {
|
|
|
1612
1587
|
return this._addCheck({
|
|
1613
1588
|
kind: "min",
|
|
1614
1589
|
value: minDate.getTime(),
|
|
1615
|
-
message:
|
|
1590
|
+
message: errorUtil_js_1.errorUtil.toString(message),
|
|
1616
1591
|
});
|
|
1617
1592
|
}
|
|
1618
1593
|
max(maxDate, message) {
|
|
1619
1594
|
return this._addCheck({
|
|
1620
1595
|
kind: "max",
|
|
1621
1596
|
value: maxDate.getTime(),
|
|
1622
|
-
message:
|
|
1597
|
+
message: errorUtil_js_1.errorUtil.toString(message),
|
|
1623
1598
|
});
|
|
1624
1599
|
}
|
|
1625
1600
|
get minDate() {
|
|
@@ -1647,7 +1622,7 @@ exports.ZodDate = ZodDate;
|
|
|
1647
1622
|
ZodDate.create = (params) => {
|
|
1648
1623
|
return new ZodDate({
|
|
1649
1624
|
checks: [],
|
|
1650
|
-
coerce:
|
|
1625
|
+
coerce: params?.coerce || false,
|
|
1651
1626
|
typeName: ZodFirstPartyTypeKind.ZodDate,
|
|
1652
1627
|
...processCreateParams(params),
|
|
1653
1628
|
});
|
|
@@ -1655,16 +1630,16 @@ ZodDate.create = (params) => {
|
|
|
1655
1630
|
class ZodSymbol extends ZodType {
|
|
1656
1631
|
_parse(input) {
|
|
1657
1632
|
const parsedType = this._getType(input);
|
|
1658
|
-
if (parsedType !==
|
|
1633
|
+
if (parsedType !== util_js_1.ZodParsedType.symbol) {
|
|
1659
1634
|
const ctx = this._getOrReturnCtx(input);
|
|
1660
|
-
(0,
|
|
1661
|
-
code:
|
|
1662
|
-
expected:
|
|
1635
|
+
(0, parseUtil_js_1.addIssueToContext)(ctx, {
|
|
1636
|
+
code: ZodError_js_1.ZodIssueCode.invalid_type,
|
|
1637
|
+
expected: util_js_1.ZodParsedType.symbol,
|
|
1663
1638
|
received: ctx.parsedType,
|
|
1664
1639
|
});
|
|
1665
|
-
return
|
|
1640
|
+
return parseUtil_js_1.INVALID;
|
|
1666
1641
|
}
|
|
1667
|
-
return (0,
|
|
1642
|
+
return (0, parseUtil_js_1.OK)(input.data);
|
|
1668
1643
|
}
|
|
1669
1644
|
}
|
|
1670
1645
|
exports.ZodSymbol = ZodSymbol;
|
|
@@ -1677,16 +1652,16 @@ ZodSymbol.create = (params) => {
|
|
|
1677
1652
|
class ZodUndefined extends ZodType {
|
|
1678
1653
|
_parse(input) {
|
|
1679
1654
|
const parsedType = this._getType(input);
|
|
1680
|
-
if (parsedType !==
|
|
1655
|
+
if (parsedType !== util_js_1.ZodParsedType.undefined) {
|
|
1681
1656
|
const ctx = this._getOrReturnCtx(input);
|
|
1682
|
-
(0,
|
|
1683
|
-
code:
|
|
1684
|
-
expected:
|
|
1657
|
+
(0, parseUtil_js_1.addIssueToContext)(ctx, {
|
|
1658
|
+
code: ZodError_js_1.ZodIssueCode.invalid_type,
|
|
1659
|
+
expected: util_js_1.ZodParsedType.undefined,
|
|
1685
1660
|
received: ctx.parsedType,
|
|
1686
1661
|
});
|
|
1687
|
-
return
|
|
1662
|
+
return parseUtil_js_1.INVALID;
|
|
1688
1663
|
}
|
|
1689
|
-
return (0,
|
|
1664
|
+
return (0, parseUtil_js_1.OK)(input.data);
|
|
1690
1665
|
}
|
|
1691
1666
|
}
|
|
1692
1667
|
exports.ZodUndefined = ZodUndefined;
|
|
@@ -1699,16 +1674,16 @@ ZodUndefined.create = (params) => {
|
|
|
1699
1674
|
class ZodNull extends ZodType {
|
|
1700
1675
|
_parse(input) {
|
|
1701
1676
|
const parsedType = this._getType(input);
|
|
1702
|
-
if (parsedType !==
|
|
1677
|
+
if (parsedType !== util_js_1.ZodParsedType.null) {
|
|
1703
1678
|
const ctx = this._getOrReturnCtx(input);
|
|
1704
|
-
(0,
|
|
1705
|
-
code:
|
|
1706
|
-
expected:
|
|
1679
|
+
(0, parseUtil_js_1.addIssueToContext)(ctx, {
|
|
1680
|
+
code: ZodError_js_1.ZodIssueCode.invalid_type,
|
|
1681
|
+
expected: util_js_1.ZodParsedType.null,
|
|
1707
1682
|
received: ctx.parsedType,
|
|
1708
1683
|
});
|
|
1709
|
-
return
|
|
1684
|
+
return parseUtil_js_1.INVALID;
|
|
1710
1685
|
}
|
|
1711
|
-
return (0,
|
|
1686
|
+
return (0, parseUtil_js_1.OK)(input.data);
|
|
1712
1687
|
}
|
|
1713
1688
|
}
|
|
1714
1689
|
exports.ZodNull = ZodNull;
|
|
@@ -1725,7 +1700,7 @@ class ZodAny extends ZodType {
|
|
|
1725
1700
|
this._any = true;
|
|
1726
1701
|
}
|
|
1727
1702
|
_parse(input) {
|
|
1728
|
-
return (0,
|
|
1703
|
+
return (0, parseUtil_js_1.OK)(input.data);
|
|
1729
1704
|
}
|
|
1730
1705
|
}
|
|
1731
1706
|
exports.ZodAny = ZodAny;
|
|
@@ -1742,7 +1717,7 @@ class ZodUnknown extends ZodType {
|
|
|
1742
1717
|
this._unknown = true;
|
|
1743
1718
|
}
|
|
1744
1719
|
_parse(input) {
|
|
1745
|
-
return (0,
|
|
1720
|
+
return (0, parseUtil_js_1.OK)(input.data);
|
|
1746
1721
|
}
|
|
1747
1722
|
}
|
|
1748
1723
|
exports.ZodUnknown = ZodUnknown;
|
|
@@ -1755,12 +1730,12 @@ ZodUnknown.create = (params) => {
|
|
|
1755
1730
|
class ZodNever extends ZodType {
|
|
1756
1731
|
_parse(input) {
|
|
1757
1732
|
const ctx = this._getOrReturnCtx(input);
|
|
1758
|
-
(0,
|
|
1759
|
-
code:
|
|
1760
|
-
expected:
|
|
1733
|
+
(0, parseUtil_js_1.addIssueToContext)(ctx, {
|
|
1734
|
+
code: ZodError_js_1.ZodIssueCode.invalid_type,
|
|
1735
|
+
expected: util_js_1.ZodParsedType.never,
|
|
1761
1736
|
received: ctx.parsedType,
|
|
1762
1737
|
});
|
|
1763
|
-
return
|
|
1738
|
+
return parseUtil_js_1.INVALID;
|
|
1764
1739
|
}
|
|
1765
1740
|
}
|
|
1766
1741
|
exports.ZodNever = ZodNever;
|
|
@@ -1773,16 +1748,16 @@ ZodNever.create = (params) => {
|
|
|
1773
1748
|
class ZodVoid extends ZodType {
|
|
1774
1749
|
_parse(input) {
|
|
1775
1750
|
const parsedType = this._getType(input);
|
|
1776
|
-
if (parsedType !==
|
|
1751
|
+
if (parsedType !== util_js_1.ZodParsedType.undefined) {
|
|
1777
1752
|
const ctx = this._getOrReturnCtx(input);
|
|
1778
|
-
(0,
|
|
1779
|
-
code:
|
|
1780
|
-
expected:
|
|
1753
|
+
(0, parseUtil_js_1.addIssueToContext)(ctx, {
|
|
1754
|
+
code: ZodError_js_1.ZodIssueCode.invalid_type,
|
|
1755
|
+
expected: util_js_1.ZodParsedType.void,
|
|
1781
1756
|
received: ctx.parsedType,
|
|
1782
1757
|
});
|
|
1783
|
-
return
|
|
1758
|
+
return parseUtil_js_1.INVALID;
|
|
1784
1759
|
}
|
|
1785
|
-
return (0,
|
|
1760
|
+
return (0, parseUtil_js_1.OK)(input.data);
|
|
1786
1761
|
}
|
|
1787
1762
|
}
|
|
1788
1763
|
exports.ZodVoid = ZodVoid;
|
|
@@ -1796,20 +1771,20 @@ class ZodArray extends ZodType {
|
|
|
1796
1771
|
_parse(input) {
|
|
1797
1772
|
const { ctx, status } = this._processInputParams(input);
|
|
1798
1773
|
const def = this._def;
|
|
1799
|
-
if (ctx.parsedType !==
|
|
1800
|
-
(0,
|
|
1801
|
-
code:
|
|
1802
|
-
expected:
|
|
1774
|
+
if (ctx.parsedType !== util_js_1.ZodParsedType.array) {
|
|
1775
|
+
(0, parseUtil_js_1.addIssueToContext)(ctx, {
|
|
1776
|
+
code: ZodError_js_1.ZodIssueCode.invalid_type,
|
|
1777
|
+
expected: util_js_1.ZodParsedType.array,
|
|
1803
1778
|
received: ctx.parsedType,
|
|
1804
1779
|
});
|
|
1805
|
-
return
|
|
1780
|
+
return parseUtil_js_1.INVALID;
|
|
1806
1781
|
}
|
|
1807
1782
|
if (def.exactLength !== null) {
|
|
1808
1783
|
const tooBig = ctx.data.length > def.exactLength.value;
|
|
1809
1784
|
const tooSmall = ctx.data.length < def.exactLength.value;
|
|
1810
1785
|
if (tooBig || tooSmall) {
|
|
1811
|
-
(0,
|
|
1812
|
-
code: tooBig ?
|
|
1786
|
+
(0, parseUtil_js_1.addIssueToContext)(ctx, {
|
|
1787
|
+
code: tooBig ? ZodError_js_1.ZodIssueCode.too_big : ZodError_js_1.ZodIssueCode.too_small,
|
|
1813
1788
|
minimum: (tooSmall ? def.exactLength.value : undefined),
|
|
1814
1789
|
maximum: (tooBig ? def.exactLength.value : undefined),
|
|
1815
1790
|
type: "array",
|
|
@@ -1822,8 +1797,8 @@ class ZodArray extends ZodType {
|
|
|
1822
1797
|
}
|
|
1823
1798
|
if (def.minLength !== null) {
|
|
1824
1799
|
if (ctx.data.length < def.minLength.value) {
|
|
1825
|
-
(0,
|
|
1826
|
-
code:
|
|
1800
|
+
(0, parseUtil_js_1.addIssueToContext)(ctx, {
|
|
1801
|
+
code: ZodError_js_1.ZodIssueCode.too_small,
|
|
1827
1802
|
minimum: def.minLength.value,
|
|
1828
1803
|
type: "array",
|
|
1829
1804
|
inclusive: true,
|
|
@@ -1835,8 +1810,8 @@ class ZodArray extends ZodType {
|
|
|
1835
1810
|
}
|
|
1836
1811
|
if (def.maxLength !== null) {
|
|
1837
1812
|
if (ctx.data.length > def.maxLength.value) {
|
|
1838
|
-
(0,
|
|
1839
|
-
code:
|
|
1813
|
+
(0, parseUtil_js_1.addIssueToContext)(ctx, {
|
|
1814
|
+
code: ZodError_js_1.ZodIssueCode.too_big,
|
|
1840
1815
|
maximum: def.maxLength.value,
|
|
1841
1816
|
type: "array",
|
|
1842
1817
|
inclusive: true,
|
|
@@ -1850,13 +1825,13 @@ class ZodArray extends ZodType {
|
|
|
1850
1825
|
return Promise.all([...ctx.data].map((item, i) => {
|
|
1851
1826
|
return def.type._parseAsync(new ParseInputLazyPath(ctx, item, ctx.path, i));
|
|
1852
1827
|
})).then((result) => {
|
|
1853
|
-
return
|
|
1828
|
+
return parseUtil_js_1.ParseStatus.mergeArray(status, result);
|
|
1854
1829
|
});
|
|
1855
1830
|
}
|
|
1856
1831
|
const result = [...ctx.data].map((item, i) => {
|
|
1857
1832
|
return def.type._parseSync(new ParseInputLazyPath(ctx, item, ctx.path, i));
|
|
1858
1833
|
});
|
|
1859
|
-
return
|
|
1834
|
+
return parseUtil_js_1.ParseStatus.mergeArray(status, result);
|
|
1860
1835
|
}
|
|
1861
1836
|
get element() {
|
|
1862
1837
|
return this._def.type;
|
|
@@ -1864,19 +1839,19 @@ class ZodArray extends ZodType {
|
|
|
1864
1839
|
min(minLength, message) {
|
|
1865
1840
|
return new ZodArray({
|
|
1866
1841
|
...this._def,
|
|
1867
|
-
minLength: { value: minLength, message:
|
|
1842
|
+
minLength: { value: minLength, message: errorUtil_js_1.errorUtil.toString(message) },
|
|
1868
1843
|
});
|
|
1869
1844
|
}
|
|
1870
1845
|
max(maxLength, message) {
|
|
1871
1846
|
return new ZodArray({
|
|
1872
1847
|
...this._def,
|
|
1873
|
-
maxLength: { value: maxLength, message:
|
|
1848
|
+
maxLength: { value: maxLength, message: errorUtil_js_1.errorUtil.toString(message) },
|
|
1874
1849
|
});
|
|
1875
1850
|
}
|
|
1876
1851
|
length(len, message) {
|
|
1877
1852
|
return new ZodArray({
|
|
1878
1853
|
...this._def,
|
|
1879
|
-
exactLength: { value: len, message:
|
|
1854
|
+
exactLength: { value: len, message: errorUtil_js_1.errorUtil.toString(message) },
|
|
1880
1855
|
});
|
|
1881
1856
|
}
|
|
1882
1857
|
nonempty(message) {
|
|
@@ -1976,25 +1951,25 @@ class ZodObject extends ZodType {
|
|
|
1976
1951
|
if (this._cached !== null)
|
|
1977
1952
|
return this._cached;
|
|
1978
1953
|
const shape = this._def.shape();
|
|
1979
|
-
const keys =
|
|
1980
|
-
|
|
1954
|
+
const keys = util_js_1.util.objectKeys(shape);
|
|
1955
|
+
this._cached = { shape, keys };
|
|
1956
|
+
return this._cached;
|
|
1981
1957
|
}
|
|
1982
1958
|
_parse(input) {
|
|
1983
1959
|
const parsedType = this._getType(input);
|
|
1984
|
-
if (parsedType !==
|
|
1960
|
+
if (parsedType !== util_js_1.ZodParsedType.object) {
|
|
1985
1961
|
const ctx = this._getOrReturnCtx(input);
|
|
1986
|
-
(0,
|
|
1987
|
-
code:
|
|
1988
|
-
expected:
|
|
1962
|
+
(0, parseUtil_js_1.addIssueToContext)(ctx, {
|
|
1963
|
+
code: ZodError_js_1.ZodIssueCode.invalid_type,
|
|
1964
|
+
expected: util_js_1.ZodParsedType.object,
|
|
1989
1965
|
received: ctx.parsedType,
|
|
1990
1966
|
});
|
|
1991
|
-
return
|
|
1967
|
+
return parseUtil_js_1.INVALID;
|
|
1992
1968
|
}
|
|
1993
1969
|
const { status, ctx } = this._processInputParams(input);
|
|
1994
1970
|
const { shape, keys: shapeKeys } = this._getCached();
|
|
1995
1971
|
const extraKeys = [];
|
|
1996
|
-
if (!(this._def.catchall instanceof ZodNever &&
|
|
1997
|
-
this._def.unknownKeys === "strip")) {
|
|
1972
|
+
if (!(this._def.catchall instanceof ZodNever && this._def.unknownKeys === "strip")) {
|
|
1998
1973
|
for (const key in ctx.data) {
|
|
1999
1974
|
if (!shapeKeys.includes(key)) {
|
|
2000
1975
|
extraKeys.push(key);
|
|
@@ -2023,8 +1998,8 @@ class ZodObject extends ZodType {
|
|
|
2023
1998
|
}
|
|
2024
1999
|
else if (unknownKeys === "strict") {
|
|
2025
2000
|
if (extraKeys.length > 0) {
|
|
2026
|
-
(0,
|
|
2027
|
-
code:
|
|
2001
|
+
(0, parseUtil_js_1.addIssueToContext)(ctx, {
|
|
2002
|
+
code: ZodError_js_1.ZodIssueCode.unrecognized_keys,
|
|
2028
2003
|
keys: extraKeys,
|
|
2029
2004
|
});
|
|
2030
2005
|
status.dirty();
|
|
@@ -2065,29 +2040,28 @@ class ZodObject extends ZodType {
|
|
|
2065
2040
|
return syncPairs;
|
|
2066
2041
|
})
|
|
2067
2042
|
.then((syncPairs) => {
|
|
2068
|
-
return
|
|
2043
|
+
return parseUtil_js_1.ParseStatus.mergeObjectSync(status, syncPairs);
|
|
2069
2044
|
});
|
|
2070
2045
|
}
|
|
2071
2046
|
else {
|
|
2072
|
-
return
|
|
2047
|
+
return parseUtil_js_1.ParseStatus.mergeObjectSync(status, pairs);
|
|
2073
2048
|
}
|
|
2074
2049
|
}
|
|
2075
2050
|
get shape() {
|
|
2076
2051
|
return this._def.shape();
|
|
2077
2052
|
}
|
|
2078
2053
|
strict(message) {
|
|
2079
|
-
|
|
2054
|
+
errorUtil_js_1.errorUtil.errToObj;
|
|
2080
2055
|
return new ZodObject({
|
|
2081
2056
|
...this._def,
|
|
2082
2057
|
unknownKeys: "strict",
|
|
2083
2058
|
...(message !== undefined
|
|
2084
2059
|
? {
|
|
2085
2060
|
errorMap: (issue, ctx) => {
|
|
2086
|
-
|
|
2087
|
-
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;
|
|
2061
|
+
const defaultError = this._def.errorMap?.(issue, ctx).message ?? ctx.defaultError;
|
|
2088
2062
|
if (issue.code === "unrecognized_keys")
|
|
2089
2063
|
return {
|
|
2090
|
-
message:
|
|
2064
|
+
message: errorUtil_js_1.errorUtil.errToObj(message).message ?? defaultError,
|
|
2091
2065
|
};
|
|
2092
2066
|
return {
|
|
2093
2067
|
message: defaultError,
|
|
@@ -2219,11 +2193,11 @@ class ZodObject extends ZodType {
|
|
|
2219
2193
|
}
|
|
2220
2194
|
pick(mask) {
|
|
2221
2195
|
const shape = {};
|
|
2222
|
-
|
|
2196
|
+
for (const key of util_js_1.util.objectKeys(mask)) {
|
|
2223
2197
|
if (mask[key] && this.shape[key]) {
|
|
2224
2198
|
shape[key] = this.shape[key];
|
|
2225
2199
|
}
|
|
2226
|
-
}
|
|
2200
|
+
}
|
|
2227
2201
|
return new ZodObject({
|
|
2228
2202
|
...this._def,
|
|
2229
2203
|
shape: () => shape,
|
|
@@ -2231,11 +2205,11 @@ class ZodObject extends ZodType {
|
|
|
2231
2205
|
}
|
|
2232
2206
|
omit(mask) {
|
|
2233
2207
|
const shape = {};
|
|
2234
|
-
|
|
2208
|
+
for (const key of util_js_1.util.objectKeys(this.shape)) {
|
|
2235
2209
|
if (!mask[key]) {
|
|
2236
2210
|
shape[key] = this.shape[key];
|
|
2237
2211
|
}
|
|
2238
|
-
}
|
|
2212
|
+
}
|
|
2239
2213
|
return new ZodObject({
|
|
2240
2214
|
...this._def,
|
|
2241
2215
|
shape: () => shape,
|
|
@@ -2249,7 +2223,7 @@ class ZodObject extends ZodType {
|
|
|
2249
2223
|
}
|
|
2250
2224
|
partial(mask) {
|
|
2251
2225
|
const newShape = {};
|
|
2252
|
-
|
|
2226
|
+
for (const key of util_js_1.util.objectKeys(this.shape)) {
|
|
2253
2227
|
const fieldSchema = this.shape[key];
|
|
2254
2228
|
if (mask && !mask[key]) {
|
|
2255
2229
|
newShape[key] = fieldSchema;
|
|
@@ -2257,7 +2231,7 @@ class ZodObject extends ZodType {
|
|
|
2257
2231
|
else {
|
|
2258
2232
|
newShape[key] = fieldSchema.optional();
|
|
2259
2233
|
}
|
|
2260
|
-
}
|
|
2234
|
+
}
|
|
2261
2235
|
return new ZodObject({
|
|
2262
2236
|
...this._def,
|
|
2263
2237
|
shape: () => newShape,
|
|
@@ -2265,7 +2239,7 @@ class ZodObject extends ZodType {
|
|
|
2265
2239
|
}
|
|
2266
2240
|
required(mask) {
|
|
2267
2241
|
const newShape = {};
|
|
2268
|
-
|
|
2242
|
+
for (const key of util_js_1.util.objectKeys(this.shape)) {
|
|
2269
2243
|
if (mask && !mask[key]) {
|
|
2270
2244
|
newShape[key] = this.shape[key];
|
|
2271
2245
|
}
|
|
@@ -2277,14 +2251,14 @@ class ZodObject extends ZodType {
|
|
|
2277
2251
|
}
|
|
2278
2252
|
newShape[key] = newField;
|
|
2279
2253
|
}
|
|
2280
|
-
}
|
|
2254
|
+
}
|
|
2281
2255
|
return new ZodObject({
|
|
2282
2256
|
...this._def,
|
|
2283
2257
|
shape: () => newShape,
|
|
2284
2258
|
});
|
|
2285
2259
|
}
|
|
2286
2260
|
keyof() {
|
|
2287
|
-
return createZodEnum(
|
|
2261
|
+
return createZodEnum(util_js_1.util.objectKeys(this.shape));
|
|
2288
2262
|
}
|
|
2289
2263
|
}
|
|
2290
2264
|
exports.ZodObject = ZodObject;
|
|
@@ -2334,12 +2308,12 @@ class ZodUnion extends ZodType {
|
|
|
2334
2308
|
}
|
|
2335
2309
|
}
|
|
2336
2310
|
// return invalid
|
|
2337
|
-
const unionErrors = results.map((result) => new
|
|
2338
|
-
(0,
|
|
2339
|
-
code:
|
|
2311
|
+
const unionErrors = results.map((result) => new ZodError_js_1.ZodError(result.ctx.common.issues));
|
|
2312
|
+
(0, parseUtil_js_1.addIssueToContext)(ctx, {
|
|
2313
|
+
code: ZodError_js_1.ZodIssueCode.invalid_union,
|
|
2340
2314
|
unionErrors,
|
|
2341
2315
|
});
|
|
2342
|
-
return
|
|
2316
|
+
return parseUtil_js_1.INVALID;
|
|
2343
2317
|
}
|
|
2344
2318
|
if (ctx.common.async) {
|
|
2345
2319
|
return Promise.all(options.map(async (option) => {
|
|
@@ -2392,12 +2366,12 @@ class ZodUnion extends ZodType {
|
|
|
2392
2366
|
ctx.common.issues.push(...dirty.ctx.common.issues);
|
|
2393
2367
|
return dirty.result;
|
|
2394
2368
|
}
|
|
2395
|
-
const unionErrors = issues.map((issues) => new
|
|
2396
|
-
(0,
|
|
2397
|
-
code:
|
|
2369
|
+
const unionErrors = issues.map((issues) => new ZodError_js_1.ZodError(issues));
|
|
2370
|
+
(0, parseUtil_js_1.addIssueToContext)(ctx, {
|
|
2371
|
+
code: ZodError_js_1.ZodIssueCode.invalid_union,
|
|
2398
2372
|
unionErrors,
|
|
2399
2373
|
});
|
|
2400
|
-
return
|
|
2374
|
+
return parseUtil_js_1.INVALID;
|
|
2401
2375
|
}
|
|
2402
2376
|
}
|
|
2403
2377
|
get options() {
|
|
@@ -2434,7 +2408,7 @@ const getDiscriminator = (type) => {
|
|
|
2434
2408
|
}
|
|
2435
2409
|
else if (type instanceof ZodNativeEnum) {
|
|
2436
2410
|
// eslint-disable-next-line ban/ban
|
|
2437
|
-
return
|
|
2411
|
+
return util_js_1.util.objectValues(type.enum);
|
|
2438
2412
|
}
|
|
2439
2413
|
else if (type instanceof ZodDefault) {
|
|
2440
2414
|
return getDiscriminator(type._def.innerType);
|
|
@@ -2467,24 +2441,24 @@ const getDiscriminator = (type) => {
|
|
|
2467
2441
|
class ZodDiscriminatedUnion extends ZodType {
|
|
2468
2442
|
_parse(input) {
|
|
2469
2443
|
const { ctx } = this._processInputParams(input);
|
|
2470
|
-
if (ctx.parsedType !==
|
|
2471
|
-
(0,
|
|
2472
|
-
code:
|
|
2473
|
-
expected:
|
|
2444
|
+
if (ctx.parsedType !== util_js_1.ZodParsedType.object) {
|
|
2445
|
+
(0, parseUtil_js_1.addIssueToContext)(ctx, {
|
|
2446
|
+
code: ZodError_js_1.ZodIssueCode.invalid_type,
|
|
2447
|
+
expected: util_js_1.ZodParsedType.object,
|
|
2474
2448
|
received: ctx.parsedType,
|
|
2475
2449
|
});
|
|
2476
|
-
return
|
|
2450
|
+
return parseUtil_js_1.INVALID;
|
|
2477
2451
|
}
|
|
2478
2452
|
const discriminator = this.discriminator;
|
|
2479
2453
|
const discriminatorValue = ctx.data[discriminator];
|
|
2480
2454
|
const option = this.optionsMap.get(discriminatorValue);
|
|
2481
2455
|
if (!option) {
|
|
2482
|
-
(0,
|
|
2483
|
-
code:
|
|
2456
|
+
(0, parseUtil_js_1.addIssueToContext)(ctx, {
|
|
2457
|
+
code: ZodError_js_1.ZodIssueCode.invalid_union_discriminator,
|
|
2484
2458
|
options: Array.from(this.optionsMap.keys()),
|
|
2485
2459
|
path: [discriminator],
|
|
2486
2460
|
});
|
|
2487
|
-
return
|
|
2461
|
+
return parseUtil_js_1.INVALID;
|
|
2488
2462
|
}
|
|
2489
2463
|
if (ctx.common.async) {
|
|
2490
2464
|
return option._parseAsync({
|
|
@@ -2545,18 +2519,20 @@ class ZodDiscriminatedUnion extends ZodType {
|
|
|
2545
2519
|
}
|
|
2546
2520
|
exports.ZodDiscriminatedUnion = ZodDiscriminatedUnion;
|
|
2547
2521
|
function mergeValues(a, b) {
|
|
2548
|
-
const aType = (0,
|
|
2549
|
-
const bType = (0,
|
|
2522
|
+
const aType = (0, util_js_1.getParsedType)(a);
|
|
2523
|
+
const bType = (0, util_js_1.getParsedType)(b);
|
|
2550
2524
|
if (a === b) {
|
|
2551
2525
|
return { valid: true, data: a };
|
|
2552
2526
|
}
|
|
2553
|
-
else if (aType ===
|
|
2554
|
-
const bKeys =
|
|
2555
|
-
const sharedKeys =
|
|
2556
|
-
.objectKeys(a)
|
|
2557
|
-
.filter((key) => bKeys.indexOf(key) !== -1);
|
|
2527
|
+
else if (aType === util_js_1.ZodParsedType.object && bType === util_js_1.ZodParsedType.object) {
|
|
2528
|
+
const bKeys = util_js_1.util.objectKeys(b);
|
|
2529
|
+
const sharedKeys = util_js_1.util.objectKeys(a).filter((key) => bKeys.indexOf(key) !== -1);
|
|
2558
2530
|
const newObj = { ...a, ...b };
|
|
2531
|
+
if (Object.prototype.hasOwnProperty.call(newObj, "__proto__"))
|
|
2532
|
+
delete newObj.__proto__;
|
|
2559
2533
|
for (const key of sharedKeys) {
|
|
2534
|
+
if (key === "__proto__")
|
|
2535
|
+
continue;
|
|
2560
2536
|
const sharedValue = mergeValues(a[key], b[key]);
|
|
2561
2537
|
if (!sharedValue.valid) {
|
|
2562
2538
|
return { valid: false };
|
|
@@ -2565,7 +2541,7 @@ function mergeValues(a, b) {
|
|
|
2565
2541
|
}
|
|
2566
2542
|
return { valid: true, data: newObj };
|
|
2567
2543
|
}
|
|
2568
|
-
else if (aType ===
|
|
2544
|
+
else if (aType === util_js_1.ZodParsedType.array && bType === util_js_1.ZodParsedType.array) {
|
|
2569
2545
|
if (a.length !== b.length) {
|
|
2570
2546
|
return { valid: false };
|
|
2571
2547
|
}
|
|
@@ -2581,9 +2557,7 @@ function mergeValues(a, b) {
|
|
|
2581
2557
|
}
|
|
2582
2558
|
return { valid: true, data: newArray };
|
|
2583
2559
|
}
|
|
2584
|
-
else if (aType ===
|
|
2585
|
-
bType === util_1.ZodParsedType.date &&
|
|
2586
|
-
+a === +b) {
|
|
2560
|
+
else if (aType === util_js_1.ZodParsedType.date && bType === util_js_1.ZodParsedType.date && +a === +b) {
|
|
2587
2561
|
return { valid: true, data: a };
|
|
2588
2562
|
}
|
|
2589
2563
|
else {
|
|
@@ -2594,17 +2568,17 @@ class ZodIntersection extends ZodType {
|
|
|
2594
2568
|
_parse(input) {
|
|
2595
2569
|
const { status, ctx } = this._processInputParams(input);
|
|
2596
2570
|
const handleParsed = (parsedLeft, parsedRight) => {
|
|
2597
|
-
if ((0,
|
|
2598
|
-
return
|
|
2571
|
+
if ((0, parseUtil_js_1.isAborted)(parsedLeft) || (0, parseUtil_js_1.isAborted)(parsedRight)) {
|
|
2572
|
+
return parseUtil_js_1.INVALID;
|
|
2599
2573
|
}
|
|
2600
2574
|
const merged = mergeValues(parsedLeft.value, parsedRight.value);
|
|
2601
2575
|
if (!merged.valid) {
|
|
2602
|
-
(0,
|
|
2603
|
-
code:
|
|
2576
|
+
(0, parseUtil_js_1.addIssueToContext)(ctx, {
|
|
2577
|
+
code: ZodError_js_1.ZodIssueCode.invalid_intersection_types,
|
|
2604
2578
|
});
|
|
2605
|
-
return
|
|
2579
|
+
return parseUtil_js_1.INVALID;
|
|
2606
2580
|
}
|
|
2607
|
-
if ((0,
|
|
2581
|
+
if ((0, parseUtil_js_1.isDirty)(parsedLeft) || (0, parseUtil_js_1.isDirty)(parsedRight)) {
|
|
2608
2582
|
status.dirty();
|
|
2609
2583
|
}
|
|
2610
2584
|
return { status: status.value, value: merged.data };
|
|
@@ -2645,31 +2619,32 @@ ZodIntersection.create = (left, right, params) => {
|
|
|
2645
2619
|
...processCreateParams(params),
|
|
2646
2620
|
});
|
|
2647
2621
|
};
|
|
2622
|
+
// type ZodTupleItems = [ZodTypeAny, ...ZodTypeAny[]];
|
|
2648
2623
|
class ZodTuple extends ZodType {
|
|
2649
2624
|
_parse(input) {
|
|
2650
2625
|
const { status, ctx } = this._processInputParams(input);
|
|
2651
|
-
if (ctx.parsedType !==
|
|
2652
|
-
(0,
|
|
2653
|
-
code:
|
|
2654
|
-
expected:
|
|
2626
|
+
if (ctx.parsedType !== util_js_1.ZodParsedType.array) {
|
|
2627
|
+
(0, parseUtil_js_1.addIssueToContext)(ctx, {
|
|
2628
|
+
code: ZodError_js_1.ZodIssueCode.invalid_type,
|
|
2629
|
+
expected: util_js_1.ZodParsedType.array,
|
|
2655
2630
|
received: ctx.parsedType,
|
|
2656
2631
|
});
|
|
2657
|
-
return
|
|
2632
|
+
return parseUtil_js_1.INVALID;
|
|
2658
2633
|
}
|
|
2659
2634
|
if (ctx.data.length < this._def.items.length) {
|
|
2660
|
-
(0,
|
|
2661
|
-
code:
|
|
2635
|
+
(0, parseUtil_js_1.addIssueToContext)(ctx, {
|
|
2636
|
+
code: ZodError_js_1.ZodIssueCode.too_small,
|
|
2662
2637
|
minimum: this._def.items.length,
|
|
2663
2638
|
inclusive: true,
|
|
2664
2639
|
exact: false,
|
|
2665
2640
|
type: "array",
|
|
2666
2641
|
});
|
|
2667
|
-
return
|
|
2642
|
+
return parseUtil_js_1.INVALID;
|
|
2668
2643
|
}
|
|
2669
2644
|
const rest = this._def.rest;
|
|
2670
2645
|
if (!rest && ctx.data.length > this._def.items.length) {
|
|
2671
|
-
(0,
|
|
2672
|
-
code:
|
|
2646
|
+
(0, parseUtil_js_1.addIssueToContext)(ctx, {
|
|
2647
|
+
code: ZodError_js_1.ZodIssueCode.too_big,
|
|
2673
2648
|
maximum: this._def.items.length,
|
|
2674
2649
|
inclusive: true,
|
|
2675
2650
|
exact: false,
|
|
@@ -2687,11 +2662,11 @@ class ZodTuple extends ZodType {
|
|
|
2687
2662
|
.filter((x) => !!x); // filter nulls
|
|
2688
2663
|
if (ctx.common.async) {
|
|
2689
2664
|
return Promise.all(items).then((results) => {
|
|
2690
|
-
return
|
|
2665
|
+
return parseUtil_js_1.ParseStatus.mergeArray(status, results);
|
|
2691
2666
|
});
|
|
2692
2667
|
}
|
|
2693
2668
|
else {
|
|
2694
|
-
return
|
|
2669
|
+
return parseUtil_js_1.ParseStatus.mergeArray(status, items);
|
|
2695
2670
|
}
|
|
2696
2671
|
}
|
|
2697
2672
|
get items() {
|
|
@@ -2725,13 +2700,13 @@ class ZodRecord extends ZodType {
|
|
|
2725
2700
|
}
|
|
2726
2701
|
_parse(input) {
|
|
2727
2702
|
const { status, ctx } = this._processInputParams(input);
|
|
2728
|
-
if (ctx.parsedType !==
|
|
2729
|
-
(0,
|
|
2730
|
-
code:
|
|
2731
|
-
expected:
|
|
2703
|
+
if (ctx.parsedType !== util_js_1.ZodParsedType.object) {
|
|
2704
|
+
(0, parseUtil_js_1.addIssueToContext)(ctx, {
|
|
2705
|
+
code: ZodError_js_1.ZodIssueCode.invalid_type,
|
|
2706
|
+
expected: util_js_1.ZodParsedType.object,
|
|
2732
2707
|
received: ctx.parsedType,
|
|
2733
2708
|
});
|
|
2734
|
-
return
|
|
2709
|
+
return parseUtil_js_1.INVALID;
|
|
2735
2710
|
}
|
|
2736
2711
|
const pairs = [];
|
|
2737
2712
|
const keyType = this._def.keyType;
|
|
@@ -2744,10 +2719,10 @@ class ZodRecord extends ZodType {
|
|
|
2744
2719
|
});
|
|
2745
2720
|
}
|
|
2746
2721
|
if (ctx.common.async) {
|
|
2747
|
-
return
|
|
2722
|
+
return parseUtil_js_1.ParseStatus.mergeObjectAsync(status, pairs);
|
|
2748
2723
|
}
|
|
2749
2724
|
else {
|
|
2750
|
-
return
|
|
2725
|
+
return parseUtil_js_1.ParseStatus.mergeObjectSync(status, pairs);
|
|
2751
2726
|
}
|
|
2752
2727
|
}
|
|
2753
2728
|
get element() {
|
|
@@ -2780,13 +2755,13 @@ class ZodMap extends ZodType {
|
|
|
2780
2755
|
}
|
|
2781
2756
|
_parse(input) {
|
|
2782
2757
|
const { status, ctx } = this._processInputParams(input);
|
|
2783
|
-
if (ctx.parsedType !==
|
|
2784
|
-
(0,
|
|
2785
|
-
code:
|
|
2786
|
-
expected:
|
|
2758
|
+
if (ctx.parsedType !== util_js_1.ZodParsedType.map) {
|
|
2759
|
+
(0, parseUtil_js_1.addIssueToContext)(ctx, {
|
|
2760
|
+
code: ZodError_js_1.ZodIssueCode.invalid_type,
|
|
2761
|
+
expected: util_js_1.ZodParsedType.map,
|
|
2787
2762
|
received: ctx.parsedType,
|
|
2788
2763
|
});
|
|
2789
|
-
return
|
|
2764
|
+
return parseUtil_js_1.INVALID;
|
|
2790
2765
|
}
|
|
2791
2766
|
const keyType = this._def.keyType;
|
|
2792
2767
|
const valueType = this._def.valueType;
|
|
@@ -2803,7 +2778,7 @@ class ZodMap extends ZodType {
|
|
|
2803
2778
|
const key = await pair.key;
|
|
2804
2779
|
const value = await pair.value;
|
|
2805
2780
|
if (key.status === "aborted" || value.status === "aborted") {
|
|
2806
|
-
return
|
|
2781
|
+
return parseUtil_js_1.INVALID;
|
|
2807
2782
|
}
|
|
2808
2783
|
if (key.status === "dirty" || value.status === "dirty") {
|
|
2809
2784
|
status.dirty();
|
|
@@ -2819,7 +2794,7 @@ class ZodMap extends ZodType {
|
|
|
2819
2794
|
const key = pair.key;
|
|
2820
2795
|
const value = pair.value;
|
|
2821
2796
|
if (key.status === "aborted" || value.status === "aborted") {
|
|
2822
|
-
return
|
|
2797
|
+
return parseUtil_js_1.INVALID;
|
|
2823
2798
|
}
|
|
2824
2799
|
if (key.status === "dirty" || value.status === "dirty") {
|
|
2825
2800
|
status.dirty();
|
|
@@ -2842,19 +2817,19 @@ ZodMap.create = (keyType, valueType, params) => {
|
|
|
2842
2817
|
class ZodSet extends ZodType {
|
|
2843
2818
|
_parse(input) {
|
|
2844
2819
|
const { status, ctx } = this._processInputParams(input);
|
|
2845
|
-
if (ctx.parsedType !==
|
|
2846
|
-
(0,
|
|
2847
|
-
code:
|
|
2848
|
-
expected:
|
|
2820
|
+
if (ctx.parsedType !== util_js_1.ZodParsedType.set) {
|
|
2821
|
+
(0, parseUtil_js_1.addIssueToContext)(ctx, {
|
|
2822
|
+
code: ZodError_js_1.ZodIssueCode.invalid_type,
|
|
2823
|
+
expected: util_js_1.ZodParsedType.set,
|
|
2849
2824
|
received: ctx.parsedType,
|
|
2850
2825
|
});
|
|
2851
|
-
return
|
|
2826
|
+
return parseUtil_js_1.INVALID;
|
|
2852
2827
|
}
|
|
2853
2828
|
const def = this._def;
|
|
2854
2829
|
if (def.minSize !== null) {
|
|
2855
2830
|
if (ctx.data.size < def.minSize.value) {
|
|
2856
|
-
(0,
|
|
2857
|
-
code:
|
|
2831
|
+
(0, parseUtil_js_1.addIssueToContext)(ctx, {
|
|
2832
|
+
code: ZodError_js_1.ZodIssueCode.too_small,
|
|
2858
2833
|
minimum: def.minSize.value,
|
|
2859
2834
|
type: "set",
|
|
2860
2835
|
inclusive: true,
|
|
@@ -2866,8 +2841,8 @@ class ZodSet extends ZodType {
|
|
|
2866
2841
|
}
|
|
2867
2842
|
if (def.maxSize !== null) {
|
|
2868
2843
|
if (ctx.data.size > def.maxSize.value) {
|
|
2869
|
-
(0,
|
|
2870
|
-
code:
|
|
2844
|
+
(0, parseUtil_js_1.addIssueToContext)(ctx, {
|
|
2845
|
+
code: ZodError_js_1.ZodIssueCode.too_big,
|
|
2871
2846
|
maximum: def.maxSize.value,
|
|
2872
2847
|
type: "set",
|
|
2873
2848
|
inclusive: true,
|
|
@@ -2882,7 +2857,7 @@ class ZodSet extends ZodType {
|
|
|
2882
2857
|
const parsedSet = new Set();
|
|
2883
2858
|
for (const element of elements) {
|
|
2884
2859
|
if (element.status === "aborted")
|
|
2885
|
-
return
|
|
2860
|
+
return parseUtil_js_1.INVALID;
|
|
2886
2861
|
if (element.status === "dirty")
|
|
2887
2862
|
status.dirty();
|
|
2888
2863
|
parsedSet.add(element.value);
|
|
@@ -2900,13 +2875,13 @@ class ZodSet extends ZodType {
|
|
|
2900
2875
|
min(minSize, message) {
|
|
2901
2876
|
return new ZodSet({
|
|
2902
2877
|
...this._def,
|
|
2903
|
-
minSize: { value: minSize, message:
|
|
2878
|
+
minSize: { value: minSize, message: errorUtil_js_1.errorUtil.toString(message) },
|
|
2904
2879
|
});
|
|
2905
2880
|
}
|
|
2906
2881
|
max(maxSize, message) {
|
|
2907
2882
|
return new ZodSet({
|
|
2908
2883
|
...this._def,
|
|
2909
|
-
maxSize: { value: maxSize, message:
|
|
2884
|
+
maxSize: { value: maxSize, message: errorUtil_js_1.errorUtil.toString(message) },
|
|
2910
2885
|
});
|
|
2911
2886
|
}
|
|
2912
2887
|
size(size, message) {
|
|
@@ -2933,42 +2908,32 @@ class ZodFunction extends ZodType {
|
|
|
2933
2908
|
}
|
|
2934
2909
|
_parse(input) {
|
|
2935
2910
|
const { ctx } = this._processInputParams(input);
|
|
2936
|
-
if (ctx.parsedType !==
|
|
2937
|
-
(0,
|
|
2938
|
-
code:
|
|
2939
|
-
expected:
|
|
2911
|
+
if (ctx.parsedType !== util_js_1.ZodParsedType.function) {
|
|
2912
|
+
(0, parseUtil_js_1.addIssueToContext)(ctx, {
|
|
2913
|
+
code: ZodError_js_1.ZodIssueCode.invalid_type,
|
|
2914
|
+
expected: util_js_1.ZodParsedType.function,
|
|
2940
2915
|
received: ctx.parsedType,
|
|
2941
2916
|
});
|
|
2942
|
-
return
|
|
2917
|
+
return parseUtil_js_1.INVALID;
|
|
2943
2918
|
}
|
|
2944
2919
|
function makeArgsIssue(args, error) {
|
|
2945
|
-
return (0,
|
|
2920
|
+
return (0, parseUtil_js_1.makeIssue)({
|
|
2946
2921
|
data: args,
|
|
2947
2922
|
path: ctx.path,
|
|
2948
|
-
errorMaps: [
|
|
2949
|
-
ctx.common.contextualErrorMap,
|
|
2950
|
-
ctx.schemaErrorMap,
|
|
2951
|
-
(0, errors_1.getErrorMap)(),
|
|
2952
|
-
errors_1.defaultErrorMap,
|
|
2953
|
-
].filter((x) => !!x),
|
|
2923
|
+
errorMaps: [ctx.common.contextualErrorMap, ctx.schemaErrorMap, (0, errors_js_1.getErrorMap)(), errors_js_1.defaultErrorMap].filter((x) => !!x),
|
|
2954
2924
|
issueData: {
|
|
2955
|
-
code:
|
|
2925
|
+
code: ZodError_js_1.ZodIssueCode.invalid_arguments,
|
|
2956
2926
|
argumentsError: error,
|
|
2957
2927
|
},
|
|
2958
2928
|
});
|
|
2959
2929
|
}
|
|
2960
2930
|
function makeReturnsIssue(returns, error) {
|
|
2961
|
-
return (0,
|
|
2931
|
+
return (0, parseUtil_js_1.makeIssue)({
|
|
2962
2932
|
data: returns,
|
|
2963
2933
|
path: ctx.path,
|
|
2964
|
-
errorMaps: [
|
|
2965
|
-
ctx.common.contextualErrorMap,
|
|
2966
|
-
ctx.schemaErrorMap,
|
|
2967
|
-
(0, errors_1.getErrorMap)(),
|
|
2968
|
-
errors_1.defaultErrorMap,
|
|
2969
|
-
].filter((x) => !!x),
|
|
2934
|
+
errorMaps: [ctx.common.contextualErrorMap, ctx.schemaErrorMap, (0, errors_js_1.getErrorMap)(), errors_js_1.defaultErrorMap].filter((x) => !!x),
|
|
2970
2935
|
issueData: {
|
|
2971
|
-
code:
|
|
2936
|
+
code: ZodError_js_1.ZodIssueCode.invalid_return_type,
|
|
2972
2937
|
returnTypeError: error,
|
|
2973
2938
|
},
|
|
2974
2939
|
});
|
|
@@ -2976,15 +2941,12 @@ class ZodFunction extends ZodType {
|
|
|
2976
2941
|
const params = { errorMap: ctx.common.contextualErrorMap };
|
|
2977
2942
|
const fn = ctx.data;
|
|
2978
2943
|
if (this._def.returns instanceof ZodPromise) {
|
|
2979
|
-
// Would love a way to avoid disabling this rule, but we need
|
|
2980
|
-
// an alias (using an arrow function was what caused 2651).
|
|
2944
|
+
// Would love a way to avoid disabling this rule, but we need an alias (using an arrow function was what caused 2651).
|
|
2981
2945
|
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
2982
2946
|
const me = this;
|
|
2983
|
-
return (0,
|
|
2984
|
-
const error = new
|
|
2985
|
-
const parsedArgs = await me._def.args
|
|
2986
|
-
.parseAsync(args, params)
|
|
2987
|
-
.catch((e) => {
|
|
2947
|
+
return (0, parseUtil_js_1.OK)(async function (...args) {
|
|
2948
|
+
const error = new ZodError_js_1.ZodError([]);
|
|
2949
|
+
const parsedArgs = await me._def.args.parseAsync(args, params).catch((e) => {
|
|
2988
2950
|
error.addIssue(makeArgsIssue(args, e));
|
|
2989
2951
|
throw error;
|
|
2990
2952
|
});
|
|
@@ -2999,19 +2961,18 @@ class ZodFunction extends ZodType {
|
|
|
2999
2961
|
});
|
|
3000
2962
|
}
|
|
3001
2963
|
else {
|
|
3002
|
-
// Would love a way to avoid disabling this rule, but we need
|
|
3003
|
-
// an alias (using an arrow function was what caused 2651).
|
|
2964
|
+
// Would love a way to avoid disabling this rule, but we need an alias (using an arrow function was what caused 2651).
|
|
3004
2965
|
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
3005
2966
|
const me = this;
|
|
3006
|
-
return (0,
|
|
2967
|
+
return (0, parseUtil_js_1.OK)(function (...args) {
|
|
3007
2968
|
const parsedArgs = me._def.args.safeParse(args, params);
|
|
3008
2969
|
if (!parsedArgs.success) {
|
|
3009
|
-
throw new
|
|
2970
|
+
throw new ZodError_js_1.ZodError([makeArgsIssue(args, parsedArgs.error)]);
|
|
3010
2971
|
}
|
|
3011
2972
|
const result = Reflect.apply(fn, this, parsedArgs.data);
|
|
3012
2973
|
const parsedReturns = me._def.returns.safeParse(result, params);
|
|
3013
2974
|
if (!parsedReturns.success) {
|
|
3014
|
-
throw new
|
|
2975
|
+
throw new ZodError_js_1.ZodError([makeReturnsIssue(result, parsedReturns.error)]);
|
|
3015
2976
|
}
|
|
3016
2977
|
return parsedReturns.data;
|
|
3017
2978
|
});
|
|
@@ -3045,9 +3006,7 @@ class ZodFunction extends ZodType {
|
|
|
3045
3006
|
}
|
|
3046
3007
|
static create(args, returns, params) {
|
|
3047
3008
|
return new ZodFunction({
|
|
3048
|
-
args: (args
|
|
3049
|
-
? args
|
|
3050
|
-
: ZodTuple.create([]).rest(ZodUnknown.create())),
|
|
3009
|
+
args: (args ? args : ZodTuple.create([]).rest(ZodUnknown.create())),
|
|
3051
3010
|
returns: returns || ZodUnknown.create(),
|
|
3052
3011
|
typeName: ZodFirstPartyTypeKind.ZodFunction,
|
|
3053
3012
|
...processCreateParams(params),
|
|
@@ -3077,12 +3036,12 @@ class ZodLiteral extends ZodType {
|
|
|
3077
3036
|
_parse(input) {
|
|
3078
3037
|
if (input.data !== this._def.value) {
|
|
3079
3038
|
const ctx = this._getOrReturnCtx(input);
|
|
3080
|
-
(0,
|
|
3039
|
+
(0, parseUtil_js_1.addIssueToContext)(ctx, {
|
|
3081
3040
|
received: ctx.data,
|
|
3082
|
-
code:
|
|
3041
|
+
code: ZodError_js_1.ZodIssueCode.invalid_literal,
|
|
3083
3042
|
expected: this._def.value,
|
|
3084
3043
|
});
|
|
3085
|
-
return
|
|
3044
|
+
return parseUtil_js_1.INVALID;
|
|
3086
3045
|
}
|
|
3087
3046
|
return { status: "valid", value: input.data };
|
|
3088
3047
|
}
|
|
@@ -3106,35 +3065,31 @@ function createZodEnum(values, params) {
|
|
|
3106
3065
|
});
|
|
3107
3066
|
}
|
|
3108
3067
|
class ZodEnum extends ZodType {
|
|
3109
|
-
constructor() {
|
|
3110
|
-
super(...arguments);
|
|
3111
|
-
_ZodEnum_cache.set(this, void 0);
|
|
3112
|
-
}
|
|
3113
3068
|
_parse(input) {
|
|
3114
3069
|
if (typeof input.data !== "string") {
|
|
3115
3070
|
const ctx = this._getOrReturnCtx(input);
|
|
3116
3071
|
const expectedValues = this._def.values;
|
|
3117
|
-
(0,
|
|
3118
|
-
expected:
|
|
3072
|
+
(0, parseUtil_js_1.addIssueToContext)(ctx, {
|
|
3073
|
+
expected: util_js_1.util.joinValues(expectedValues),
|
|
3119
3074
|
received: ctx.parsedType,
|
|
3120
|
-
code:
|
|
3075
|
+
code: ZodError_js_1.ZodIssueCode.invalid_type,
|
|
3121
3076
|
});
|
|
3122
|
-
return
|
|
3077
|
+
return parseUtil_js_1.INVALID;
|
|
3123
3078
|
}
|
|
3124
|
-
if (!
|
|
3125
|
-
|
|
3079
|
+
if (!this._cache) {
|
|
3080
|
+
this._cache = new Set(this._def.values);
|
|
3126
3081
|
}
|
|
3127
|
-
if (!
|
|
3082
|
+
if (!this._cache.has(input.data)) {
|
|
3128
3083
|
const ctx = this._getOrReturnCtx(input);
|
|
3129
3084
|
const expectedValues = this._def.values;
|
|
3130
|
-
(0,
|
|
3085
|
+
(0, parseUtil_js_1.addIssueToContext)(ctx, {
|
|
3131
3086
|
received: ctx.data,
|
|
3132
|
-
code:
|
|
3087
|
+
code: ZodError_js_1.ZodIssueCode.invalid_enum_value,
|
|
3133
3088
|
options: expectedValues,
|
|
3134
3089
|
});
|
|
3135
|
-
return
|
|
3090
|
+
return parseUtil_js_1.INVALID;
|
|
3136
3091
|
}
|
|
3137
|
-
return (0,
|
|
3092
|
+
return (0, parseUtil_js_1.OK)(input.data);
|
|
3138
3093
|
}
|
|
3139
3094
|
get options() {
|
|
3140
3095
|
return this._def.values;
|
|
@@ -3174,46 +3129,39 @@ class ZodEnum extends ZodType {
|
|
|
3174
3129
|
}
|
|
3175
3130
|
}
|
|
3176
3131
|
exports.ZodEnum = ZodEnum;
|
|
3177
|
-
_ZodEnum_cache = new WeakMap();
|
|
3178
3132
|
ZodEnum.create = createZodEnum;
|
|
3179
3133
|
class ZodNativeEnum extends ZodType {
|
|
3180
|
-
constructor() {
|
|
3181
|
-
super(...arguments);
|
|
3182
|
-
_ZodNativeEnum_cache.set(this, void 0);
|
|
3183
|
-
}
|
|
3184
3134
|
_parse(input) {
|
|
3185
|
-
const nativeEnumValues =
|
|
3135
|
+
const nativeEnumValues = util_js_1.util.getValidEnumValues(this._def.values);
|
|
3186
3136
|
const ctx = this._getOrReturnCtx(input);
|
|
3187
|
-
if (ctx.parsedType !==
|
|
3188
|
-
|
|
3189
|
-
|
|
3190
|
-
|
|
3191
|
-
expected: util_1.util.joinValues(expectedValues),
|
|
3137
|
+
if (ctx.parsedType !== util_js_1.ZodParsedType.string && ctx.parsedType !== util_js_1.ZodParsedType.number) {
|
|
3138
|
+
const expectedValues = util_js_1.util.objectValues(nativeEnumValues);
|
|
3139
|
+
(0, parseUtil_js_1.addIssueToContext)(ctx, {
|
|
3140
|
+
expected: util_js_1.util.joinValues(expectedValues),
|
|
3192
3141
|
received: ctx.parsedType,
|
|
3193
|
-
code:
|
|
3142
|
+
code: ZodError_js_1.ZodIssueCode.invalid_type,
|
|
3194
3143
|
});
|
|
3195
|
-
return
|
|
3144
|
+
return parseUtil_js_1.INVALID;
|
|
3196
3145
|
}
|
|
3197
|
-
if (!
|
|
3198
|
-
|
|
3146
|
+
if (!this._cache) {
|
|
3147
|
+
this._cache = new Set(util_js_1.util.getValidEnumValues(this._def.values));
|
|
3199
3148
|
}
|
|
3200
|
-
if (!
|
|
3201
|
-
const expectedValues =
|
|
3202
|
-
(0,
|
|
3149
|
+
if (!this._cache.has(input.data)) {
|
|
3150
|
+
const expectedValues = util_js_1.util.objectValues(nativeEnumValues);
|
|
3151
|
+
(0, parseUtil_js_1.addIssueToContext)(ctx, {
|
|
3203
3152
|
received: ctx.data,
|
|
3204
|
-
code:
|
|
3153
|
+
code: ZodError_js_1.ZodIssueCode.invalid_enum_value,
|
|
3205
3154
|
options: expectedValues,
|
|
3206
3155
|
});
|
|
3207
|
-
return
|
|
3156
|
+
return parseUtil_js_1.INVALID;
|
|
3208
3157
|
}
|
|
3209
|
-
return (0,
|
|
3158
|
+
return (0, parseUtil_js_1.OK)(input.data);
|
|
3210
3159
|
}
|
|
3211
3160
|
get enum() {
|
|
3212
3161
|
return this._def.values;
|
|
3213
3162
|
}
|
|
3214
3163
|
}
|
|
3215
3164
|
exports.ZodNativeEnum = ZodNativeEnum;
|
|
3216
|
-
_ZodNativeEnum_cache = new WeakMap();
|
|
3217
3165
|
ZodNativeEnum.create = (values, params) => {
|
|
3218
3166
|
return new ZodNativeEnum({
|
|
3219
3167
|
values: values,
|
|
@@ -3227,19 +3175,16 @@ class ZodPromise extends ZodType {
|
|
|
3227
3175
|
}
|
|
3228
3176
|
_parse(input) {
|
|
3229
3177
|
const { ctx } = this._processInputParams(input);
|
|
3230
|
-
if (ctx.parsedType !==
|
|
3231
|
-
|
|
3232
|
-
|
|
3233
|
-
|
|
3234
|
-
expected: util_1.ZodParsedType.promise,
|
|
3178
|
+
if (ctx.parsedType !== util_js_1.ZodParsedType.promise && ctx.common.async === false) {
|
|
3179
|
+
(0, parseUtil_js_1.addIssueToContext)(ctx, {
|
|
3180
|
+
code: ZodError_js_1.ZodIssueCode.invalid_type,
|
|
3181
|
+
expected: util_js_1.ZodParsedType.promise,
|
|
3235
3182
|
received: ctx.parsedType,
|
|
3236
3183
|
});
|
|
3237
|
-
return
|
|
3184
|
+
return parseUtil_js_1.INVALID;
|
|
3238
3185
|
}
|
|
3239
|
-
const promisified = ctx.parsedType ===
|
|
3240
|
-
|
|
3241
|
-
: Promise.resolve(ctx.data);
|
|
3242
|
-
return (0, parseUtil_1.OK)(promisified.then((data) => {
|
|
3186
|
+
const promisified = ctx.parsedType === util_js_1.ZodParsedType.promise ? ctx.data : Promise.resolve(ctx.data);
|
|
3187
|
+
return (0, parseUtil_js_1.OK)(promisified.then((data) => {
|
|
3243
3188
|
return this._def.type.parseAsync(data, {
|
|
3244
3189
|
path: ctx.path,
|
|
3245
3190
|
errorMap: ctx.common.contextualErrorMap,
|
|
@@ -3269,7 +3214,7 @@ class ZodEffects extends ZodType {
|
|
|
3269
3214
|
const effect = this._def.effect || null;
|
|
3270
3215
|
const checkCtx = {
|
|
3271
3216
|
addIssue: (arg) => {
|
|
3272
|
-
(0,
|
|
3217
|
+
(0, parseUtil_js_1.addIssueToContext)(ctx, arg);
|
|
3273
3218
|
if (arg.fatal) {
|
|
3274
3219
|
status.abort();
|
|
3275
3220
|
}
|
|
@@ -3287,35 +3232,35 @@ class ZodEffects extends ZodType {
|
|
|
3287
3232
|
if (ctx.common.async) {
|
|
3288
3233
|
return Promise.resolve(processed).then(async (processed) => {
|
|
3289
3234
|
if (status.value === "aborted")
|
|
3290
|
-
return
|
|
3235
|
+
return parseUtil_js_1.INVALID;
|
|
3291
3236
|
const result = await this._def.schema._parseAsync({
|
|
3292
3237
|
data: processed,
|
|
3293
3238
|
path: ctx.path,
|
|
3294
3239
|
parent: ctx,
|
|
3295
3240
|
});
|
|
3296
3241
|
if (result.status === "aborted")
|
|
3297
|
-
return
|
|
3242
|
+
return parseUtil_js_1.INVALID;
|
|
3298
3243
|
if (result.status === "dirty")
|
|
3299
|
-
return (0,
|
|
3244
|
+
return (0, parseUtil_js_1.DIRTY)(result.value);
|
|
3300
3245
|
if (status.value === "dirty")
|
|
3301
|
-
return (0,
|
|
3246
|
+
return (0, parseUtil_js_1.DIRTY)(result.value);
|
|
3302
3247
|
return result;
|
|
3303
3248
|
});
|
|
3304
3249
|
}
|
|
3305
3250
|
else {
|
|
3306
3251
|
if (status.value === "aborted")
|
|
3307
|
-
return
|
|
3252
|
+
return parseUtil_js_1.INVALID;
|
|
3308
3253
|
const result = this._def.schema._parseSync({
|
|
3309
3254
|
data: processed,
|
|
3310
3255
|
path: ctx.path,
|
|
3311
3256
|
parent: ctx,
|
|
3312
3257
|
});
|
|
3313
3258
|
if (result.status === "aborted")
|
|
3314
|
-
return
|
|
3259
|
+
return parseUtil_js_1.INVALID;
|
|
3315
3260
|
if (result.status === "dirty")
|
|
3316
|
-
return (0,
|
|
3261
|
+
return (0, parseUtil_js_1.DIRTY)(result.value);
|
|
3317
3262
|
if (status.value === "dirty")
|
|
3318
|
-
return (0,
|
|
3263
|
+
return (0, parseUtil_js_1.DIRTY)(result.value);
|
|
3319
3264
|
return result;
|
|
3320
3265
|
}
|
|
3321
3266
|
}
|
|
@@ -3337,7 +3282,7 @@ class ZodEffects extends ZodType {
|
|
|
3337
3282
|
parent: ctx,
|
|
3338
3283
|
});
|
|
3339
3284
|
if (inner.status === "aborted")
|
|
3340
|
-
return
|
|
3285
|
+
return parseUtil_js_1.INVALID;
|
|
3341
3286
|
if (inner.status === "dirty")
|
|
3342
3287
|
status.dirty();
|
|
3343
3288
|
// return value is ignored
|
|
@@ -3345,11 +3290,9 @@ class ZodEffects extends ZodType {
|
|
|
3345
3290
|
return { status: status.value, value: inner.value };
|
|
3346
3291
|
}
|
|
3347
3292
|
else {
|
|
3348
|
-
return this._def.schema
|
|
3349
|
-
._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx })
|
|
3350
|
-
.then((inner) => {
|
|
3293
|
+
return this._def.schema._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx }).then((inner) => {
|
|
3351
3294
|
if (inner.status === "aborted")
|
|
3352
|
-
return
|
|
3295
|
+
return parseUtil_js_1.INVALID;
|
|
3353
3296
|
if (inner.status === "dirty")
|
|
3354
3297
|
status.dirty();
|
|
3355
3298
|
return executeRefinement(inner.value).then(() => {
|
|
@@ -3365,8 +3308,8 @@ class ZodEffects extends ZodType {
|
|
|
3365
3308
|
path: ctx.path,
|
|
3366
3309
|
parent: ctx,
|
|
3367
3310
|
});
|
|
3368
|
-
if (!(0,
|
|
3369
|
-
return
|
|
3311
|
+
if (!(0, parseUtil_js_1.isValid)(base))
|
|
3312
|
+
return parseUtil_js_1.INVALID;
|
|
3370
3313
|
const result = effect.transform(base.value, checkCtx);
|
|
3371
3314
|
if (result instanceof Promise) {
|
|
3372
3315
|
throw new Error(`Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.`);
|
|
@@ -3374,16 +3317,17 @@ class ZodEffects extends ZodType {
|
|
|
3374
3317
|
return { status: status.value, value: result };
|
|
3375
3318
|
}
|
|
3376
3319
|
else {
|
|
3377
|
-
return this._def.schema
|
|
3378
|
-
|
|
3379
|
-
|
|
3380
|
-
|
|
3381
|
-
|
|
3382
|
-
|
|
3320
|
+
return this._def.schema._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx }).then((base) => {
|
|
3321
|
+
if (!(0, parseUtil_js_1.isValid)(base))
|
|
3322
|
+
return parseUtil_js_1.INVALID;
|
|
3323
|
+
return Promise.resolve(effect.transform(base.value, checkCtx)).then((result) => ({
|
|
3324
|
+
status: status.value,
|
|
3325
|
+
value: result,
|
|
3326
|
+
}));
|
|
3383
3327
|
});
|
|
3384
3328
|
}
|
|
3385
3329
|
}
|
|
3386
|
-
|
|
3330
|
+
util_js_1.util.assertNever(effect);
|
|
3387
3331
|
}
|
|
3388
3332
|
}
|
|
3389
3333
|
exports.ZodEffects = ZodEffects;
|
|
@@ -3407,8 +3351,8 @@ ZodEffects.createWithPreprocess = (preprocess, schema, params) => {
|
|
|
3407
3351
|
class ZodOptional extends ZodType {
|
|
3408
3352
|
_parse(input) {
|
|
3409
3353
|
const parsedType = this._getType(input);
|
|
3410
|
-
if (parsedType ===
|
|
3411
|
-
return (0,
|
|
3354
|
+
if (parsedType === util_js_1.ZodParsedType.undefined) {
|
|
3355
|
+
return (0, parseUtil_js_1.OK)(undefined);
|
|
3412
3356
|
}
|
|
3413
3357
|
return this._def.innerType._parse(input);
|
|
3414
3358
|
}
|
|
@@ -3427,8 +3371,8 @@ ZodOptional.create = (type, params) => {
|
|
|
3427
3371
|
class ZodNullable extends ZodType {
|
|
3428
3372
|
_parse(input) {
|
|
3429
3373
|
const parsedType = this._getType(input);
|
|
3430
|
-
if (parsedType ===
|
|
3431
|
-
return (0,
|
|
3374
|
+
if (parsedType === util_js_1.ZodParsedType.null) {
|
|
3375
|
+
return (0, parseUtil_js_1.OK)(null);
|
|
3432
3376
|
}
|
|
3433
3377
|
return this._def.innerType._parse(input);
|
|
3434
3378
|
}
|
|
@@ -3448,7 +3392,7 @@ class ZodDefault extends ZodType {
|
|
|
3448
3392
|
_parse(input) {
|
|
3449
3393
|
const { ctx } = this._processInputParams(input);
|
|
3450
3394
|
let data = ctx.data;
|
|
3451
|
-
if (ctx.parsedType ===
|
|
3395
|
+
if (ctx.parsedType === util_js_1.ZodParsedType.undefined) {
|
|
3452
3396
|
data = this._def.defaultValue();
|
|
3453
3397
|
}
|
|
3454
3398
|
return this._def.innerType._parse({
|
|
@@ -3466,9 +3410,7 @@ ZodDefault.create = (type, params) => {
|
|
|
3466
3410
|
return new ZodDefault({
|
|
3467
3411
|
innerType: type,
|
|
3468
3412
|
typeName: ZodFirstPartyTypeKind.ZodDefault,
|
|
3469
|
-
defaultValue: typeof params.default === "function"
|
|
3470
|
-
? params.default
|
|
3471
|
-
: () => params.default,
|
|
3413
|
+
defaultValue: typeof params.default === "function" ? params.default : () => params.default,
|
|
3472
3414
|
...processCreateParams(params),
|
|
3473
3415
|
});
|
|
3474
3416
|
};
|
|
@@ -3490,7 +3432,7 @@ class ZodCatch extends ZodType {
|
|
|
3490
3432
|
...newCtx,
|
|
3491
3433
|
},
|
|
3492
3434
|
});
|
|
3493
|
-
if ((0,
|
|
3435
|
+
if ((0, parseUtil_js_1.isAsync)(result)) {
|
|
3494
3436
|
return result.then((result) => {
|
|
3495
3437
|
return {
|
|
3496
3438
|
status: "valid",
|
|
@@ -3498,7 +3440,7 @@ class ZodCatch extends ZodType {
|
|
|
3498
3440
|
? result.value
|
|
3499
3441
|
: this._def.catchValue({
|
|
3500
3442
|
get error() {
|
|
3501
|
-
return new
|
|
3443
|
+
return new ZodError_js_1.ZodError(newCtx.common.issues);
|
|
3502
3444
|
},
|
|
3503
3445
|
input: newCtx.data,
|
|
3504
3446
|
}),
|
|
@@ -3512,7 +3454,7 @@ class ZodCatch extends ZodType {
|
|
|
3512
3454
|
? result.value
|
|
3513
3455
|
: this._def.catchValue({
|
|
3514
3456
|
get error() {
|
|
3515
|
-
return new
|
|
3457
|
+
return new ZodError_js_1.ZodError(newCtx.common.issues);
|
|
3516
3458
|
},
|
|
3517
3459
|
input: newCtx.data,
|
|
3518
3460
|
}),
|
|
@@ -3535,14 +3477,14 @@ ZodCatch.create = (type, params) => {
|
|
|
3535
3477
|
class ZodNaN extends ZodType {
|
|
3536
3478
|
_parse(input) {
|
|
3537
3479
|
const parsedType = this._getType(input);
|
|
3538
|
-
if (parsedType !==
|
|
3480
|
+
if (parsedType !== util_js_1.ZodParsedType.nan) {
|
|
3539
3481
|
const ctx = this._getOrReturnCtx(input);
|
|
3540
|
-
(0,
|
|
3541
|
-
code:
|
|
3542
|
-
expected:
|
|
3482
|
+
(0, parseUtil_js_1.addIssueToContext)(ctx, {
|
|
3483
|
+
code: ZodError_js_1.ZodIssueCode.invalid_type,
|
|
3484
|
+
expected: util_js_1.ZodParsedType.nan,
|
|
3543
3485
|
received: ctx.parsedType,
|
|
3544
3486
|
});
|
|
3545
|
-
return
|
|
3487
|
+
return parseUtil_js_1.INVALID;
|
|
3546
3488
|
}
|
|
3547
3489
|
return { status: "valid", value: input.data };
|
|
3548
3490
|
}
|
|
@@ -3581,10 +3523,10 @@ class ZodPipeline extends ZodType {
|
|
|
3581
3523
|
parent: ctx,
|
|
3582
3524
|
});
|
|
3583
3525
|
if (inResult.status === "aborted")
|
|
3584
|
-
return
|
|
3526
|
+
return parseUtil_js_1.INVALID;
|
|
3585
3527
|
if (inResult.status === "dirty") {
|
|
3586
3528
|
status.dirty();
|
|
3587
|
-
return (0,
|
|
3529
|
+
return (0, parseUtil_js_1.DIRTY)(inResult.value);
|
|
3588
3530
|
}
|
|
3589
3531
|
else {
|
|
3590
3532
|
return this._def.out._parseAsync({
|
|
@@ -3603,7 +3545,7 @@ class ZodPipeline extends ZodType {
|
|
|
3603
3545
|
parent: ctx,
|
|
3604
3546
|
});
|
|
3605
3547
|
if (inResult.status === "aborted")
|
|
3606
|
-
return
|
|
3548
|
+
return parseUtil_js_1.INVALID;
|
|
3607
3549
|
if (inResult.status === "dirty") {
|
|
3608
3550
|
status.dirty();
|
|
3609
3551
|
return {
|
|
@@ -3633,14 +3575,12 @@ class ZodReadonly extends ZodType {
|
|
|
3633
3575
|
_parse(input) {
|
|
3634
3576
|
const result = this._def.innerType._parse(input);
|
|
3635
3577
|
const freeze = (data) => {
|
|
3636
|
-
if ((0,
|
|
3578
|
+
if ((0, parseUtil_js_1.isValid)(data)) {
|
|
3637
3579
|
data.value = Object.freeze(data.value);
|
|
3638
3580
|
}
|
|
3639
3581
|
return data;
|
|
3640
3582
|
};
|
|
3641
|
-
return (0,
|
|
3642
|
-
? result.then((data) => freeze(data))
|
|
3643
|
-
: freeze(result);
|
|
3583
|
+
return (0, parseUtil_js_1.isAsync)(result) ? result.then((data) => freeze(data)) : freeze(result);
|
|
3644
3584
|
}
|
|
3645
3585
|
unwrap() {
|
|
3646
3586
|
return this._def.innerType;
|
|
@@ -3654,7 +3594,19 @@ ZodReadonly.create = (type, params) => {
|
|
|
3654
3594
|
...processCreateParams(params),
|
|
3655
3595
|
});
|
|
3656
3596
|
};
|
|
3657
|
-
|
|
3597
|
+
////////////////////////////////////////
|
|
3598
|
+
////////////////////////////////////////
|
|
3599
|
+
////////// //////////
|
|
3600
|
+
////////// z.custom //////////
|
|
3601
|
+
////////// //////////
|
|
3602
|
+
////////////////////////////////////////
|
|
3603
|
+
////////////////////////////////////////
|
|
3604
|
+
function cleanParams(params, data) {
|
|
3605
|
+
const p = typeof params === "function" ? params(data) : typeof params === "string" ? { message: params } : params;
|
|
3606
|
+
const p2 = typeof p === "string" ? { message: p } : p;
|
|
3607
|
+
return p2;
|
|
3608
|
+
}
|
|
3609
|
+
function custom(check, _params = {},
|
|
3658
3610
|
/**
|
|
3659
3611
|
* @deprecated
|
|
3660
3612
|
*
|
|
@@ -3668,21 +3620,25 @@ function custom(check, params = {},
|
|
|
3668
3620
|
fatal) {
|
|
3669
3621
|
if (check)
|
|
3670
3622
|
return ZodAny.create().superRefine((data, ctx) => {
|
|
3671
|
-
|
|
3672
|
-
if (
|
|
3673
|
-
|
|
3674
|
-
|
|
3675
|
-
|
|
3676
|
-
|
|
3677
|
-
: params;
|
|
3678
|
-
|
|
3679
|
-
|
|
3680
|
-
ctx.addIssue({ code: "custom", ...p2, fatal: _fatal });
|
|
3623
|
+
const r = check(data);
|
|
3624
|
+
if (r instanceof Promise) {
|
|
3625
|
+
return r.then((r) => {
|
|
3626
|
+
if (!r) {
|
|
3627
|
+
const params = cleanParams(_params, data);
|
|
3628
|
+
const _fatal = params.fatal ?? fatal ?? true;
|
|
3629
|
+
ctx.addIssue({ code: "custom", ...params, fatal: _fatal });
|
|
3630
|
+
}
|
|
3631
|
+
});
|
|
3681
3632
|
}
|
|
3633
|
+
if (!r) {
|
|
3634
|
+
const params = cleanParams(_params, data);
|
|
3635
|
+
const _fatal = params.fatal ?? fatal ?? true;
|
|
3636
|
+
ctx.addIssue({ code: "custom", ...params, fatal: _fatal });
|
|
3637
|
+
}
|
|
3638
|
+
return;
|
|
3682
3639
|
});
|
|
3683
3640
|
return ZodAny.create();
|
|
3684
3641
|
}
|
|
3685
|
-
exports.custom = custom;
|
|
3686
3642
|
exports.late = {
|
|
3687
3643
|
object: ZodObject.lazycreate,
|
|
3688
3644
|
};
|
|
@@ -3820,4 +3776,23 @@ exports.coerce = {
|
|
|
3820
3776
|
bigint: ((arg) => ZodBigInt.create({ ...arg, coerce: true })),
|
|
3821
3777
|
date: ((arg) => ZodDate.create({ ...arg, coerce: true })),
|
|
3822
3778
|
};
|
|
3823
|
-
exports.NEVER =
|
|
3779
|
+
exports.NEVER = parseUtil_js_1.INVALID;
|
|
3780
|
+
|
|
3781
|
+
// seal-cjs-exports
|
|
3782
|
+
(function () {
|
|
3783
|
+
var keys = Object.getOwnPropertyNames(exports);
|
|
3784
|
+
for (var i = 0; i < keys.length; i++) {
|
|
3785
|
+
var desc = Object.getOwnPropertyDescriptor(exports, keys[i]);
|
|
3786
|
+
if (!desc || !desc.get || !desc.configurable) continue;
|
|
3787
|
+
var value;
|
|
3788
|
+
try {
|
|
3789
|
+
value = desc.get();
|
|
3790
|
+
} catch (e) {
|
|
3791
|
+
continue;
|
|
3792
|
+
}
|
|
3793
|
+
// a circular require may not have settled this one yet, so leave it live
|
|
3794
|
+
if (value === undefined) continue;
|
|
3795
|
+
Object.defineProperty(exports, keys[i], { value: value, writable: false, enumerable: desc.enumerable, configurable: false });
|
|
3796
|
+
}
|
|
3797
|
+
Object.freeze(exports);
|
|
3798
|
+
})();
|