@xenosystem/agent-cli 0.5.134 → 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 +1832 -1803
- 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,556 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
function assertNever(_x) {
|
|
7
|
-
throw new Error();
|
|
8
|
-
}
|
|
9
|
-
util.assertNever = assertNever;
|
|
10
|
-
util.arrayToEnum = (items) => {
|
|
11
|
-
const obj = {};
|
|
12
|
-
for (const item of items) {
|
|
13
|
-
obj[item] = item;
|
|
14
|
-
}
|
|
15
|
-
return obj;
|
|
16
|
-
};
|
|
17
|
-
util.getValidEnumValues = (obj) => {
|
|
18
|
-
const validKeys = util.objectKeys(obj).filter((k) => typeof obj[obj[k]] !== "number");
|
|
19
|
-
const filtered = {};
|
|
20
|
-
for (const k of validKeys) {
|
|
21
|
-
filtered[k] = obj[k];
|
|
22
|
-
}
|
|
23
|
-
return util.objectValues(filtered);
|
|
24
|
-
};
|
|
25
|
-
util.objectValues = (obj) => {
|
|
26
|
-
return util.objectKeys(obj).map(function (e) {
|
|
27
|
-
return obj[e];
|
|
28
|
-
});
|
|
29
|
-
};
|
|
30
|
-
util.objectKeys = typeof Object.keys === "function" // eslint-disable-line ban/ban
|
|
31
|
-
? (obj) => Object.keys(obj) // eslint-disable-line ban/ban
|
|
32
|
-
: (object) => {
|
|
33
|
-
const keys = [];
|
|
34
|
-
for (const key in object) {
|
|
35
|
-
if (Object.prototype.hasOwnProperty.call(object, key)) {
|
|
36
|
-
keys.push(key);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
return keys;
|
|
40
|
-
};
|
|
41
|
-
util.find = (arr, checker) => {
|
|
42
|
-
for (const item of arr) {
|
|
43
|
-
if (checker(item))
|
|
44
|
-
return item;
|
|
45
|
-
}
|
|
46
|
-
return undefined;
|
|
47
|
-
};
|
|
48
|
-
util.isInteger = typeof Number.isInteger === "function"
|
|
49
|
-
? (val) => Number.isInteger(val) // eslint-disable-line ban/ban
|
|
50
|
-
: (val) => typeof val === "number" && isFinite(val) && Math.floor(val) === val;
|
|
51
|
-
function joinValues(array, separator = " | ") {
|
|
52
|
-
return array
|
|
53
|
-
.map((val) => (typeof val === "string" ? `'${val}'` : val))
|
|
54
|
-
.join(separator);
|
|
55
|
-
}
|
|
56
|
-
util.joinValues = joinValues;
|
|
57
|
-
util.jsonStringifyReplacer = (_, value) => {
|
|
58
|
-
if (typeof value === "bigint") {
|
|
59
|
-
return value.toString();
|
|
60
|
-
}
|
|
61
|
-
return value;
|
|
62
|
-
};
|
|
63
|
-
})(util || (util = {}));
|
|
64
|
-
var objectUtil;
|
|
65
|
-
(function (objectUtil) {
|
|
66
|
-
objectUtil.mergeShapes = (first, second) => {
|
|
67
|
-
return {
|
|
68
|
-
...first,
|
|
69
|
-
...second, // second overwrites first
|
|
70
|
-
};
|
|
71
|
-
};
|
|
72
|
-
})(objectUtil || (objectUtil = {}));
|
|
73
|
-
const ZodParsedType = util.arrayToEnum([
|
|
74
|
-
"string",
|
|
75
|
-
"nan",
|
|
76
|
-
"number",
|
|
77
|
-
"integer",
|
|
78
|
-
"float",
|
|
79
|
-
"boolean",
|
|
80
|
-
"date",
|
|
81
|
-
"bigint",
|
|
82
|
-
"symbol",
|
|
83
|
-
"function",
|
|
84
|
-
"undefined",
|
|
85
|
-
"null",
|
|
86
|
-
"array",
|
|
87
|
-
"object",
|
|
88
|
-
"unknown",
|
|
89
|
-
"promise",
|
|
90
|
-
"void",
|
|
91
|
-
"never",
|
|
92
|
-
"map",
|
|
93
|
-
"set",
|
|
94
|
-
]);
|
|
95
|
-
const getParsedType = (data) => {
|
|
96
|
-
const t = typeof data;
|
|
97
|
-
switch (t) {
|
|
98
|
-
case "undefined":
|
|
99
|
-
return ZodParsedType.undefined;
|
|
100
|
-
case "string":
|
|
101
|
-
return ZodParsedType.string;
|
|
102
|
-
case "number":
|
|
103
|
-
return isNaN(data) ? ZodParsedType.nan : ZodParsedType.number;
|
|
104
|
-
case "boolean":
|
|
105
|
-
return ZodParsedType.boolean;
|
|
106
|
-
case "function":
|
|
107
|
-
return ZodParsedType.function;
|
|
108
|
-
case "bigint":
|
|
109
|
-
return ZodParsedType.bigint;
|
|
110
|
-
case "symbol":
|
|
111
|
-
return ZodParsedType.symbol;
|
|
112
|
-
case "object":
|
|
113
|
-
if (Array.isArray(data)) {
|
|
114
|
-
return ZodParsedType.array;
|
|
115
|
-
}
|
|
116
|
-
if (data === null) {
|
|
117
|
-
return ZodParsedType.null;
|
|
118
|
-
}
|
|
119
|
-
if (data.then &&
|
|
120
|
-
typeof data.then === "function" &&
|
|
121
|
-
data.catch &&
|
|
122
|
-
typeof data.catch === "function") {
|
|
123
|
-
return ZodParsedType.promise;
|
|
124
|
-
}
|
|
125
|
-
if (typeof Map !== "undefined" && data instanceof Map) {
|
|
126
|
-
return ZodParsedType.map;
|
|
127
|
-
}
|
|
128
|
-
if (typeof Set !== "undefined" && data instanceof Set) {
|
|
129
|
-
return ZodParsedType.set;
|
|
130
|
-
}
|
|
131
|
-
if (typeof Date !== "undefined" && data instanceof Date) {
|
|
132
|
-
return ZodParsedType.date;
|
|
133
|
-
}
|
|
134
|
-
return ZodParsedType.object;
|
|
135
|
-
default:
|
|
136
|
-
return ZodParsedType.unknown;
|
|
137
|
-
}
|
|
138
|
-
};
|
|
139
|
-
|
|
140
|
-
const ZodIssueCode = util.arrayToEnum([
|
|
141
|
-
"invalid_type",
|
|
142
|
-
"invalid_literal",
|
|
143
|
-
"custom",
|
|
144
|
-
"invalid_union",
|
|
145
|
-
"invalid_union_discriminator",
|
|
146
|
-
"invalid_enum_value",
|
|
147
|
-
"unrecognized_keys",
|
|
148
|
-
"invalid_arguments",
|
|
149
|
-
"invalid_return_type",
|
|
150
|
-
"invalid_date",
|
|
151
|
-
"invalid_string",
|
|
152
|
-
"too_small",
|
|
153
|
-
"too_big",
|
|
154
|
-
"invalid_intersection_types",
|
|
155
|
-
"not_multiple_of",
|
|
156
|
-
"not_finite",
|
|
157
|
-
]);
|
|
158
|
-
const quotelessJson = (obj) => {
|
|
159
|
-
const json = JSON.stringify(obj, null, 2);
|
|
160
|
-
return json.replace(/"([^"]+)":/g, "$1:");
|
|
161
|
-
};
|
|
162
|
-
class ZodError extends Error {
|
|
163
|
-
get errors() {
|
|
164
|
-
return this.issues;
|
|
165
|
-
}
|
|
166
|
-
constructor(issues) {
|
|
167
|
-
super();
|
|
168
|
-
this.issues = [];
|
|
169
|
-
this.addIssue = (sub) => {
|
|
170
|
-
this.issues = [...this.issues, sub];
|
|
171
|
-
};
|
|
172
|
-
this.addIssues = (subs = []) => {
|
|
173
|
-
this.issues = [...this.issues, ...subs];
|
|
174
|
-
};
|
|
175
|
-
const actualProto = new.target.prototype;
|
|
176
|
-
if (Object.setPrototypeOf) {
|
|
177
|
-
// eslint-disable-next-line ban/ban
|
|
178
|
-
Object.setPrototypeOf(this, actualProto);
|
|
179
|
-
}
|
|
180
|
-
else {
|
|
181
|
-
this.__proto__ = actualProto;
|
|
182
|
-
}
|
|
183
|
-
this.name = "ZodError";
|
|
184
|
-
this.issues = issues;
|
|
185
|
-
}
|
|
186
|
-
format(_mapper) {
|
|
187
|
-
const mapper = _mapper ||
|
|
188
|
-
function (issue) {
|
|
189
|
-
return issue.message;
|
|
190
|
-
};
|
|
191
|
-
const fieldErrors = { _errors: [] };
|
|
192
|
-
const processError = (error) => {
|
|
193
|
-
for (const issue of error.issues) {
|
|
194
|
-
if (issue.code === "invalid_union") {
|
|
195
|
-
issue.unionErrors.map(processError);
|
|
196
|
-
}
|
|
197
|
-
else if (issue.code === "invalid_return_type") {
|
|
198
|
-
processError(issue.returnTypeError);
|
|
199
|
-
}
|
|
200
|
-
else if (issue.code === "invalid_arguments") {
|
|
201
|
-
processError(issue.argumentsError);
|
|
202
|
-
}
|
|
203
|
-
else if (issue.path.length === 0) {
|
|
204
|
-
fieldErrors._errors.push(mapper(issue));
|
|
205
|
-
}
|
|
206
|
-
else {
|
|
207
|
-
let curr = fieldErrors;
|
|
208
|
-
let i = 0;
|
|
209
|
-
while (i < issue.path.length) {
|
|
210
|
-
const el = issue.path[i];
|
|
211
|
-
const terminal = i === issue.path.length - 1;
|
|
212
|
-
if (!terminal) {
|
|
213
|
-
curr[el] = curr[el] || { _errors: [] };
|
|
214
|
-
// if (typeof el === "string") {
|
|
215
|
-
// curr[el] = curr[el] || { _errors: [] };
|
|
216
|
-
// } else if (typeof el === "number") {
|
|
217
|
-
// const errorArray: any = [];
|
|
218
|
-
// errorArray._errors = [];
|
|
219
|
-
// curr[el] = curr[el] || errorArray;
|
|
220
|
-
// }
|
|
221
|
-
}
|
|
222
|
-
else {
|
|
223
|
-
curr[el] = curr[el] || { _errors: [] };
|
|
224
|
-
curr[el]._errors.push(mapper(issue));
|
|
225
|
-
}
|
|
226
|
-
curr = curr[el];
|
|
227
|
-
i++;
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
};
|
|
232
|
-
processError(this);
|
|
233
|
-
return fieldErrors;
|
|
234
|
-
}
|
|
235
|
-
static assert(value) {
|
|
236
|
-
if (!(value instanceof ZodError)) {
|
|
237
|
-
throw new Error(`Not a ZodError: ${value}`);
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
toString() {
|
|
241
|
-
return this.message;
|
|
242
|
-
}
|
|
243
|
-
get message() {
|
|
244
|
-
return JSON.stringify(this.issues, util.jsonStringifyReplacer, 2);
|
|
245
|
-
}
|
|
246
|
-
get isEmpty() {
|
|
247
|
-
return this.issues.length === 0;
|
|
248
|
-
}
|
|
249
|
-
flatten(mapper = (issue) => issue.message) {
|
|
250
|
-
const fieldErrors = {};
|
|
251
|
-
const formErrors = [];
|
|
252
|
-
for (const sub of this.issues) {
|
|
253
|
-
if (sub.path.length > 0) {
|
|
254
|
-
fieldErrors[sub.path[0]] = fieldErrors[sub.path[0]] || [];
|
|
255
|
-
fieldErrors[sub.path[0]].push(mapper(sub));
|
|
256
|
-
}
|
|
257
|
-
else {
|
|
258
|
-
formErrors.push(mapper(sub));
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
return { formErrors, fieldErrors };
|
|
262
|
-
}
|
|
263
|
-
get formErrors() {
|
|
264
|
-
return this.flatten();
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
ZodError.create = (issues) => {
|
|
268
|
-
const error = new ZodError(issues);
|
|
269
|
-
return error;
|
|
270
|
-
};
|
|
271
|
-
|
|
272
|
-
const errorMap = (issue, _ctx) => {
|
|
273
|
-
let message;
|
|
274
|
-
switch (issue.code) {
|
|
275
|
-
case ZodIssueCode.invalid_type:
|
|
276
|
-
if (issue.received === ZodParsedType.undefined) {
|
|
277
|
-
message = "Required";
|
|
278
|
-
}
|
|
279
|
-
else {
|
|
280
|
-
message = `Expected ${issue.expected}, received ${issue.received}`;
|
|
281
|
-
}
|
|
282
|
-
break;
|
|
283
|
-
case ZodIssueCode.invalid_literal:
|
|
284
|
-
message = `Invalid literal value, expected ${JSON.stringify(issue.expected, util.jsonStringifyReplacer)}`;
|
|
285
|
-
break;
|
|
286
|
-
case ZodIssueCode.unrecognized_keys:
|
|
287
|
-
message = `Unrecognized key(s) in object: ${util.joinValues(issue.keys, ", ")}`;
|
|
288
|
-
break;
|
|
289
|
-
case ZodIssueCode.invalid_union:
|
|
290
|
-
message = `Invalid input`;
|
|
291
|
-
break;
|
|
292
|
-
case ZodIssueCode.invalid_union_discriminator:
|
|
293
|
-
message = `Invalid discriminator value. Expected ${util.joinValues(issue.options)}`;
|
|
294
|
-
break;
|
|
295
|
-
case ZodIssueCode.invalid_enum_value:
|
|
296
|
-
message = `Invalid enum value. Expected ${util.joinValues(issue.options)}, received '${issue.received}'`;
|
|
297
|
-
break;
|
|
298
|
-
case ZodIssueCode.invalid_arguments:
|
|
299
|
-
message = `Invalid function arguments`;
|
|
300
|
-
break;
|
|
301
|
-
case ZodIssueCode.invalid_return_type:
|
|
302
|
-
message = `Invalid function return type`;
|
|
303
|
-
break;
|
|
304
|
-
case ZodIssueCode.invalid_date:
|
|
305
|
-
message = `Invalid date`;
|
|
306
|
-
break;
|
|
307
|
-
case ZodIssueCode.invalid_string:
|
|
308
|
-
if (typeof issue.validation === "object") {
|
|
309
|
-
if ("includes" in issue.validation) {
|
|
310
|
-
message = `Invalid input: must include "${issue.validation.includes}"`;
|
|
311
|
-
if (typeof issue.validation.position === "number") {
|
|
312
|
-
message = `${message} at one or more positions greater than or equal to ${issue.validation.position}`;
|
|
313
|
-
}
|
|
314
|
-
}
|
|
315
|
-
else if ("startsWith" in issue.validation) {
|
|
316
|
-
message = `Invalid input: must start with "${issue.validation.startsWith}"`;
|
|
317
|
-
}
|
|
318
|
-
else if ("endsWith" in issue.validation) {
|
|
319
|
-
message = `Invalid input: must end with "${issue.validation.endsWith}"`;
|
|
320
|
-
}
|
|
321
|
-
else {
|
|
322
|
-
util.assertNever(issue.validation);
|
|
323
|
-
}
|
|
324
|
-
}
|
|
325
|
-
else if (issue.validation !== "regex") {
|
|
326
|
-
message = `Invalid ${issue.validation}`;
|
|
327
|
-
}
|
|
328
|
-
else {
|
|
329
|
-
message = "Invalid";
|
|
330
|
-
}
|
|
331
|
-
break;
|
|
332
|
-
case ZodIssueCode.too_small:
|
|
333
|
-
if (issue.type === "array")
|
|
334
|
-
message = `Array must contain ${issue.exact ? "exactly" : issue.inclusive ? `at least` : `more than`} ${issue.minimum} element(s)`;
|
|
335
|
-
else if (issue.type === "string")
|
|
336
|
-
message = `String must contain ${issue.exact ? "exactly" : issue.inclusive ? `at least` : `over`} ${issue.minimum} character(s)`;
|
|
337
|
-
else if (issue.type === "number")
|
|
338
|
-
message = `Number must be ${issue.exact
|
|
339
|
-
? `exactly equal to `
|
|
340
|
-
: issue.inclusive
|
|
341
|
-
? `greater than or equal to `
|
|
342
|
-
: `greater than `}${issue.minimum}`;
|
|
343
|
-
else if (issue.type === "date")
|
|
344
|
-
message = `Date must be ${issue.exact
|
|
345
|
-
? `exactly equal to `
|
|
346
|
-
: issue.inclusive
|
|
347
|
-
? `greater than or equal to `
|
|
348
|
-
: `greater than `}${new Date(Number(issue.minimum))}`;
|
|
349
|
-
else
|
|
350
|
-
message = "Invalid input";
|
|
351
|
-
break;
|
|
352
|
-
case ZodIssueCode.too_big:
|
|
353
|
-
if (issue.type === "array")
|
|
354
|
-
message = `Array must contain ${issue.exact ? `exactly` : issue.inclusive ? `at most` : `less than`} ${issue.maximum} element(s)`;
|
|
355
|
-
else if (issue.type === "string")
|
|
356
|
-
message = `String must contain ${issue.exact ? `exactly` : issue.inclusive ? `at most` : `under`} ${issue.maximum} character(s)`;
|
|
357
|
-
else if (issue.type === "number")
|
|
358
|
-
message = `Number must be ${issue.exact
|
|
359
|
-
? `exactly`
|
|
360
|
-
: issue.inclusive
|
|
361
|
-
? `less than or equal to`
|
|
362
|
-
: `less than`} ${issue.maximum}`;
|
|
363
|
-
else if (issue.type === "bigint")
|
|
364
|
-
message = `BigInt must be ${issue.exact
|
|
365
|
-
? `exactly`
|
|
366
|
-
: issue.inclusive
|
|
367
|
-
? `less than or equal to`
|
|
368
|
-
: `less than`} ${issue.maximum}`;
|
|
369
|
-
else if (issue.type === "date")
|
|
370
|
-
message = `Date must be ${issue.exact
|
|
371
|
-
? `exactly`
|
|
372
|
-
: issue.inclusive
|
|
373
|
-
? `smaller than or equal to`
|
|
374
|
-
: `smaller than`} ${new Date(Number(issue.maximum))}`;
|
|
375
|
-
else
|
|
376
|
-
message = "Invalid input";
|
|
377
|
-
break;
|
|
378
|
-
case ZodIssueCode.custom:
|
|
379
|
-
message = `Invalid input`;
|
|
380
|
-
break;
|
|
381
|
-
case ZodIssueCode.invalid_intersection_types:
|
|
382
|
-
message = `Intersection results could not be merged`;
|
|
383
|
-
break;
|
|
384
|
-
case ZodIssueCode.not_multiple_of:
|
|
385
|
-
message = `Number must be a multiple of ${issue.multipleOf}`;
|
|
386
|
-
break;
|
|
387
|
-
case ZodIssueCode.not_finite:
|
|
388
|
-
message = "Number must be finite";
|
|
389
|
-
break;
|
|
390
|
-
default:
|
|
391
|
-
message = _ctx.defaultError;
|
|
392
|
-
util.assertNever(issue);
|
|
393
|
-
}
|
|
394
|
-
return { message };
|
|
395
|
-
};
|
|
396
|
-
|
|
397
|
-
let overrideErrorMap = errorMap;
|
|
398
|
-
function setErrorMap(map) {
|
|
399
|
-
overrideErrorMap = map;
|
|
400
|
-
}
|
|
401
|
-
function getErrorMap() {
|
|
402
|
-
return overrideErrorMap;
|
|
403
|
-
}
|
|
404
|
-
|
|
405
|
-
const makeIssue = (params) => {
|
|
406
|
-
const { data, path, errorMaps, issueData } = params;
|
|
407
|
-
const fullPath = [...path, ...(issueData.path || [])];
|
|
408
|
-
const fullIssue = {
|
|
409
|
-
...issueData,
|
|
410
|
-
path: fullPath,
|
|
411
|
-
};
|
|
412
|
-
if (issueData.message !== undefined) {
|
|
413
|
-
return {
|
|
414
|
-
...issueData,
|
|
415
|
-
path: fullPath,
|
|
416
|
-
message: issueData.message,
|
|
417
|
-
};
|
|
418
|
-
}
|
|
419
|
-
let errorMessage = "";
|
|
420
|
-
const maps = errorMaps
|
|
421
|
-
.filter((m) => !!m)
|
|
422
|
-
.slice()
|
|
423
|
-
.reverse();
|
|
424
|
-
for (const map of maps) {
|
|
425
|
-
errorMessage = map(fullIssue, { data, defaultError: errorMessage }).message;
|
|
426
|
-
}
|
|
427
|
-
return {
|
|
428
|
-
...issueData,
|
|
429
|
-
path: fullPath,
|
|
430
|
-
message: errorMessage,
|
|
431
|
-
};
|
|
432
|
-
};
|
|
433
|
-
const EMPTY_PATH = [];
|
|
434
|
-
function addIssueToContext(ctx, issueData) {
|
|
435
|
-
const overrideMap = getErrorMap();
|
|
436
|
-
const issue = makeIssue({
|
|
437
|
-
issueData: issueData,
|
|
438
|
-
data: ctx.data,
|
|
439
|
-
path: ctx.path,
|
|
440
|
-
errorMaps: [
|
|
441
|
-
ctx.common.contextualErrorMap, // contextual error map is first priority
|
|
442
|
-
ctx.schemaErrorMap, // then schema-bound map if available
|
|
443
|
-
overrideMap, // then global override map
|
|
444
|
-
overrideMap === errorMap ? undefined : errorMap, // then global default map
|
|
445
|
-
].filter((x) => !!x),
|
|
446
|
-
});
|
|
447
|
-
ctx.common.issues.push(issue);
|
|
448
|
-
}
|
|
449
|
-
class ParseStatus {
|
|
450
|
-
constructor() {
|
|
451
|
-
this.value = "valid";
|
|
452
|
-
}
|
|
453
|
-
dirty() {
|
|
454
|
-
if (this.value === "valid")
|
|
455
|
-
this.value = "dirty";
|
|
456
|
-
}
|
|
457
|
-
abort() {
|
|
458
|
-
if (this.value !== "aborted")
|
|
459
|
-
this.value = "aborted";
|
|
460
|
-
}
|
|
461
|
-
static mergeArray(status, results) {
|
|
462
|
-
const arrayValue = [];
|
|
463
|
-
for (const s of results) {
|
|
464
|
-
if (s.status === "aborted")
|
|
465
|
-
return INVALID;
|
|
466
|
-
if (s.status === "dirty")
|
|
467
|
-
status.dirty();
|
|
468
|
-
arrayValue.push(s.value);
|
|
469
|
-
}
|
|
470
|
-
return { status: status.value, value: arrayValue };
|
|
471
|
-
}
|
|
472
|
-
static async mergeObjectAsync(status, pairs) {
|
|
473
|
-
const syncPairs = [];
|
|
474
|
-
for (const pair of pairs) {
|
|
475
|
-
const key = await pair.key;
|
|
476
|
-
const value = await pair.value;
|
|
477
|
-
syncPairs.push({
|
|
478
|
-
key,
|
|
479
|
-
value,
|
|
480
|
-
});
|
|
481
|
-
}
|
|
482
|
-
return ParseStatus.mergeObjectSync(status, syncPairs);
|
|
483
|
-
}
|
|
484
|
-
static mergeObjectSync(status, pairs) {
|
|
485
|
-
const finalObject = {};
|
|
486
|
-
for (const pair of pairs) {
|
|
487
|
-
const { key, value } = pair;
|
|
488
|
-
if (key.status === "aborted")
|
|
489
|
-
return INVALID;
|
|
490
|
-
if (value.status === "aborted")
|
|
491
|
-
return INVALID;
|
|
492
|
-
if (key.status === "dirty")
|
|
493
|
-
status.dirty();
|
|
494
|
-
if (value.status === "dirty")
|
|
495
|
-
status.dirty();
|
|
496
|
-
if (key.value !== "__proto__" &&
|
|
497
|
-
(typeof value.value !== "undefined" || pair.alwaysSet)) {
|
|
498
|
-
finalObject[key.value] = value.value;
|
|
499
|
-
}
|
|
500
|
-
}
|
|
501
|
-
return { status: status.value, value: finalObject };
|
|
502
|
-
}
|
|
503
|
-
}
|
|
504
|
-
const INVALID = Object.freeze({
|
|
505
|
-
status: "aborted",
|
|
506
|
-
});
|
|
507
|
-
const DIRTY = (value) => ({ status: "dirty", value });
|
|
508
|
-
const OK = (value) => ({ status: "valid", value });
|
|
509
|
-
const isAborted = (x) => x.status === "aborted";
|
|
510
|
-
const isDirty = (x) => x.status === "dirty";
|
|
511
|
-
const isValid = (x) => x.status === "valid";
|
|
512
|
-
const isAsync = (x) => typeof Promise !== "undefined" && x instanceof Promise;
|
|
513
|
-
|
|
514
|
-
/******************************************************************************
|
|
515
|
-
Copyright (c) Microsoft Corporation.
|
|
516
|
-
|
|
517
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
518
|
-
purpose with or without fee is hereby granted.
|
|
519
|
-
|
|
520
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
521
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
522
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
523
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
524
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
525
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
526
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
527
|
-
***************************************************************************** */
|
|
528
|
-
|
|
529
|
-
function __classPrivateFieldGet(receiver, state, kind, f) {
|
|
530
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
531
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
532
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
533
|
-
}
|
|
534
|
-
|
|
535
|
-
function __classPrivateFieldSet(receiver, state, value, kind, f) {
|
|
536
|
-
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
537
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
538
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
539
|
-
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
540
|
-
}
|
|
541
|
-
|
|
542
|
-
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
543
|
-
var e = new Error(message);
|
|
544
|
-
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
545
|
-
};
|
|
546
|
-
|
|
547
|
-
var errorUtil;
|
|
548
|
-
(function (errorUtil) {
|
|
549
|
-
errorUtil.errToObj = (message) => typeof message === "string" ? { message } : message || {};
|
|
550
|
-
errorUtil.toString = (message) => typeof message === "string" ? message : message === null || message === void 0 ? void 0 : message.message;
|
|
551
|
-
})(errorUtil || (errorUtil = {}));
|
|
552
|
-
|
|
553
|
-
var _ZodEnum_cache, _ZodNativeEnum_cache;
|
|
1
|
+
import { ZodError, ZodIssueCode, } from "./ZodError.js";
|
|
2
|
+
import { defaultErrorMap, getErrorMap } from "./errors.js";
|
|
3
|
+
import { errorUtil } from "./helpers/errorUtil.js";
|
|
4
|
+
import { DIRTY, INVALID, OK, ParseStatus, addIssueToContext, isAborted, isAsync, isDirty, isValid, makeIssue, } from "./helpers/parseUtil.js";
|
|
5
|
+
import { util, ZodParsedType, getParsedType } from "./helpers/util.js";
|
|
554
6
|
class ParseInputLazyPath {
|
|
555
7
|
constructor(parent, value, path, key) {
|
|
556
8
|
this._cachedPath = [];
|
|
@@ -561,7 +13,7 @@ class ParseInputLazyPath {
|
|
|
561
13
|
}
|
|
562
14
|
get path() {
|
|
563
15
|
if (!this._cachedPath.length) {
|
|
564
|
-
if (this._key
|
|
16
|
+
if (Array.isArray(this._key)) {
|
|
565
17
|
this._cachedPath.push(...this._path, ...this._key);
|
|
566
18
|
}
|
|
567
19
|
else {
|
|
@@ -601,21 +53,20 @@ function processCreateParams(params) {
|
|
|
601
53
|
if (errorMap)
|
|
602
54
|
return { errorMap: errorMap, description };
|
|
603
55
|
const customMap = (iss, ctx) => {
|
|
604
|
-
var _a, _b;
|
|
605
56
|
const { message } = params;
|
|
606
57
|
if (iss.code === "invalid_enum_value") {
|
|
607
|
-
return { message: message
|
|
58
|
+
return { message: message ?? ctx.defaultError };
|
|
608
59
|
}
|
|
609
60
|
if (typeof ctx.data === "undefined") {
|
|
610
|
-
return { message:
|
|
61
|
+
return { message: message ?? required_error ?? ctx.defaultError };
|
|
611
62
|
}
|
|
612
63
|
if (iss.code !== "invalid_type")
|
|
613
64
|
return { message: ctx.defaultError };
|
|
614
|
-
return { message:
|
|
65
|
+
return { message: message ?? invalid_type_error ?? ctx.defaultError };
|
|
615
66
|
};
|
|
616
67
|
return { errorMap: customMap, description };
|
|
617
68
|
}
|
|
618
|
-
class ZodType {
|
|
69
|
+
export class ZodType {
|
|
619
70
|
get description() {
|
|
620
71
|
return this._def.description;
|
|
621
72
|
}
|
|
@@ -663,14 +114,13 @@ class ZodType {
|
|
|
663
114
|
throw result.error;
|
|
664
115
|
}
|
|
665
116
|
safeParse(data, params) {
|
|
666
|
-
var _a;
|
|
667
117
|
const ctx = {
|
|
668
118
|
common: {
|
|
669
119
|
issues: [],
|
|
670
|
-
async:
|
|
671
|
-
contextualErrorMap: params
|
|
120
|
+
async: params?.async ?? false,
|
|
121
|
+
contextualErrorMap: params?.errorMap,
|
|
672
122
|
},
|
|
673
|
-
path:
|
|
123
|
+
path: params?.path || [],
|
|
674
124
|
schemaErrorMap: this._def.errorMap,
|
|
675
125
|
parent: null,
|
|
676
126
|
data,
|
|
@@ -680,7 +130,6 @@ class ZodType {
|
|
|
680
130
|
return handleResult(ctx, result);
|
|
681
131
|
}
|
|
682
132
|
"~validate"(data) {
|
|
683
|
-
var _a, _b;
|
|
684
133
|
const ctx = {
|
|
685
134
|
common: {
|
|
686
135
|
issues: [],
|
|
@@ -704,7 +153,7 @@ class ZodType {
|
|
|
704
153
|
};
|
|
705
154
|
}
|
|
706
155
|
catch (err) {
|
|
707
|
-
if (
|
|
156
|
+
if (err?.message?.toLowerCase()?.includes("encountered")) {
|
|
708
157
|
this["~standard"].async = true;
|
|
709
158
|
}
|
|
710
159
|
ctx.common = {
|
|
@@ -731,19 +180,17 @@ class ZodType {
|
|
|
731
180
|
const ctx = {
|
|
732
181
|
common: {
|
|
733
182
|
issues: [],
|
|
734
|
-
contextualErrorMap: params
|
|
183
|
+
contextualErrorMap: params?.errorMap,
|
|
735
184
|
async: true,
|
|
736
185
|
},
|
|
737
|
-
path:
|
|
186
|
+
path: params?.path || [],
|
|
738
187
|
schemaErrorMap: this._def.errorMap,
|
|
739
188
|
parent: null,
|
|
740
189
|
data,
|
|
741
190
|
parsedType: getParsedType(data),
|
|
742
191
|
};
|
|
743
192
|
const maybeAsyncResult = this._parse({ data, path: ctx.path, parent: ctx });
|
|
744
|
-
const result = await (isAsync(maybeAsyncResult)
|
|
745
|
-
? maybeAsyncResult
|
|
746
|
-
: Promise.resolve(maybeAsyncResult));
|
|
193
|
+
const result = await (isAsync(maybeAsyncResult) ? maybeAsyncResult : Promise.resolve(maybeAsyncResult));
|
|
747
194
|
return handleResult(ctx, result);
|
|
748
195
|
}
|
|
749
196
|
refine(check, message) {
|
|
@@ -787,9 +234,7 @@ class ZodType {
|
|
|
787
234
|
refinement(check, refinementData) {
|
|
788
235
|
return this._refinement((val, ctx) => {
|
|
789
236
|
if (!check(val)) {
|
|
790
|
-
ctx.addIssue(typeof refinementData === "function"
|
|
791
|
-
? refinementData(val, ctx)
|
|
792
|
-
: refinementData);
|
|
237
|
+
ctx.addIssue(typeof refinementData === "function" ? refinementData(val, ctx) : refinementData);
|
|
793
238
|
return false;
|
|
794
239
|
}
|
|
795
240
|
else {
|
|
@@ -940,7 +385,7 @@ const emailRegex = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z
|
|
|
940
385
|
// const emailRegex =
|
|
941
386
|
// /^[a-z0-9.!#$%&’*+/=?^_`{|}~-]+@[a-z0-9-]+(?:\.[a-z0-9\-]+)*$/i;
|
|
942
387
|
// from https://thekevinscott.com/emojis-in-javascript/#writing-a-regular-expression
|
|
943
|
-
const _emojiRegex = `^
|
|
388
|
+
const _emojiRegex = `^[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`;
|
|
944
389
|
let emojiRegex;
|
|
945
390
|
// faster, simpler, safer
|
|
946
391
|
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])$/;
|
|
@@ -961,21 +406,21 @@ const base64urlRegex = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z
|
|
|
961
406
|
const dateRegexSource = `((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))`;
|
|
962
407
|
const dateRegex = new RegExp(`^${dateRegexSource}$`);
|
|
963
408
|
function timeRegexSource(args) {
|
|
964
|
-
|
|
965
|
-
let regex = `([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d`;
|
|
409
|
+
let secondsRegexSource = `[0-5]\\d`;
|
|
966
410
|
if (args.precision) {
|
|
967
|
-
|
|
411
|
+
secondsRegexSource = `${secondsRegexSource}\\.\\d{${args.precision}}`;
|
|
968
412
|
}
|
|
969
413
|
else if (args.precision == null) {
|
|
970
|
-
|
|
414
|
+
secondsRegexSource = `${secondsRegexSource}(\\.\\d+)?`;
|
|
971
415
|
}
|
|
972
|
-
|
|
416
|
+
const secondsQuantifier = args.precision ? "+" : "?"; // require seconds if precision is nonzero
|
|
417
|
+
return `([01]\\d|2[0-3]):[0-5]\\d(:${secondsRegexSource})${secondsQuantifier}`;
|
|
973
418
|
}
|
|
974
419
|
function timeRegex(args) {
|
|
975
420
|
return new RegExp(`^${timeRegexSource(args)}$`);
|
|
976
421
|
}
|
|
977
422
|
// Adapted from https://stackoverflow.com/a/3143231
|
|
978
|
-
function datetimeRegex(args) {
|
|
423
|
+
export function datetimeRegex(args) {
|
|
979
424
|
let regex = `${dateRegexSource}T${timeRegexSource(args)}`;
|
|
980
425
|
const opts = [];
|
|
981
426
|
opts.push(args.local ? `Z?` : `Z`);
|
|
@@ -998,21 +443,26 @@ function isValidJWT(jwt, alg) {
|
|
|
998
443
|
return false;
|
|
999
444
|
try {
|
|
1000
445
|
const [header] = jwt.split(".");
|
|
446
|
+
if (!header)
|
|
447
|
+
return false;
|
|
1001
448
|
// Convert base64url to base64
|
|
1002
449
|
const base64 = header
|
|
1003
450
|
.replace(/-/g, "+")
|
|
1004
451
|
.replace(/_/g, "/")
|
|
1005
452
|
.padEnd(header.length + ((4 - (header.length % 4)) % 4), "=");
|
|
453
|
+
// @ts-ignore
|
|
1006
454
|
const decoded = JSON.parse(atob(base64));
|
|
1007
455
|
if (typeof decoded !== "object" || decoded === null)
|
|
1008
456
|
return false;
|
|
1009
|
-
if (
|
|
457
|
+
if ("typ" in decoded && decoded?.typ !== "JWT")
|
|
458
|
+
return false;
|
|
459
|
+
if (!decoded.alg)
|
|
1010
460
|
return false;
|
|
1011
461
|
if (alg && decoded.alg !== alg)
|
|
1012
462
|
return false;
|
|
1013
463
|
return true;
|
|
1014
464
|
}
|
|
1015
|
-
catch
|
|
465
|
+
catch {
|
|
1016
466
|
return false;
|
|
1017
467
|
}
|
|
1018
468
|
}
|
|
@@ -1025,7 +475,7 @@ function isValidCidr(ip, version) {
|
|
|
1025
475
|
}
|
|
1026
476
|
return false;
|
|
1027
477
|
}
|
|
1028
|
-
class ZodString extends ZodType {
|
|
478
|
+
export class ZodString extends ZodType {
|
|
1029
479
|
_parse(input) {
|
|
1030
480
|
if (this._def.coerce) {
|
|
1031
481
|
input.data = String(input.data);
|
|
@@ -1181,9 +631,10 @@ class ZodString extends ZodType {
|
|
|
1181
631
|
}
|
|
1182
632
|
else if (check.kind === "url") {
|
|
1183
633
|
try {
|
|
634
|
+
// @ts-ignore
|
|
1184
635
|
new URL(input.data);
|
|
1185
636
|
}
|
|
1186
|
-
catch
|
|
637
|
+
catch {
|
|
1187
638
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
1188
639
|
addIssueToContext(ctx, {
|
|
1189
640
|
validation: "url",
|
|
@@ -1413,7 +864,6 @@ class ZodString extends ZodType {
|
|
|
1413
864
|
return this._addCheck({ kind: "cidr", ...errorUtil.errToObj(options) });
|
|
1414
865
|
}
|
|
1415
866
|
datetime(options) {
|
|
1416
|
-
var _a, _b;
|
|
1417
867
|
if (typeof options === "string") {
|
|
1418
868
|
return this._addCheck({
|
|
1419
869
|
kind: "datetime",
|
|
@@ -1425,10 +875,10 @@ class ZodString extends ZodType {
|
|
|
1425
875
|
}
|
|
1426
876
|
return this._addCheck({
|
|
1427
877
|
kind: "datetime",
|
|
1428
|
-
precision: typeof
|
|
1429
|
-
offset:
|
|
1430
|
-
local:
|
|
1431
|
-
...errorUtil.errToObj(options
|
|
878
|
+
precision: typeof options?.precision === "undefined" ? null : options?.precision,
|
|
879
|
+
offset: options?.offset ?? false,
|
|
880
|
+
local: options?.local ?? false,
|
|
881
|
+
...errorUtil.errToObj(options?.message),
|
|
1432
882
|
});
|
|
1433
883
|
}
|
|
1434
884
|
date(message) {
|
|
@@ -1444,8 +894,8 @@ class ZodString extends ZodType {
|
|
|
1444
894
|
}
|
|
1445
895
|
return this._addCheck({
|
|
1446
896
|
kind: "time",
|
|
1447
|
-
precision: typeof
|
|
1448
|
-
...errorUtil.errToObj(options
|
|
897
|
+
precision: typeof options?.precision === "undefined" ? null : options?.precision,
|
|
898
|
+
...errorUtil.errToObj(options?.message),
|
|
1449
899
|
});
|
|
1450
900
|
}
|
|
1451
901
|
duration(message) {
|
|
@@ -1462,8 +912,8 @@ class ZodString extends ZodType {
|
|
|
1462
912
|
return this._addCheck({
|
|
1463
913
|
kind: "includes",
|
|
1464
914
|
value: value,
|
|
1465
|
-
position: options
|
|
1466
|
-
...errorUtil.errToObj(options
|
|
915
|
+
position: options?.position,
|
|
916
|
+
...errorUtil.errToObj(options?.message),
|
|
1467
917
|
});
|
|
1468
918
|
}
|
|
1469
919
|
startsWith(value, message) {
|
|
@@ -1596,11 +1046,10 @@ class ZodString extends ZodType {
|
|
|
1596
1046
|
}
|
|
1597
1047
|
}
|
|
1598
1048
|
ZodString.create = (params) => {
|
|
1599
|
-
var _a;
|
|
1600
1049
|
return new ZodString({
|
|
1601
1050
|
checks: [],
|
|
1602
1051
|
typeName: ZodFirstPartyTypeKind.ZodString,
|
|
1603
|
-
coerce:
|
|
1052
|
+
coerce: params?.coerce ?? false,
|
|
1604
1053
|
...processCreateParams(params),
|
|
1605
1054
|
});
|
|
1606
1055
|
};
|
|
@@ -1609,11 +1058,11 @@ function floatSafeRemainder(val, step) {
|
|
|
1609
1058
|
const valDecCount = (val.toString().split(".")[1] || "").length;
|
|
1610
1059
|
const stepDecCount = (step.toString().split(".")[1] || "").length;
|
|
1611
1060
|
const decCount = valDecCount > stepDecCount ? valDecCount : stepDecCount;
|
|
1612
|
-
const valInt = parseInt(val.toFixed(decCount).replace(".", ""));
|
|
1613
|
-
const stepInt = parseInt(step.toFixed(decCount).replace(".", ""));
|
|
1614
|
-
return (valInt % stepInt) /
|
|
1061
|
+
const valInt = Number.parseInt(val.toFixed(decCount).replace(".", ""));
|
|
1062
|
+
const stepInt = Number.parseInt(step.toFixed(decCount).replace(".", ""));
|
|
1063
|
+
return (valInt % stepInt) / 10 ** decCount;
|
|
1615
1064
|
}
|
|
1616
|
-
class ZodNumber extends ZodType {
|
|
1065
|
+
export class ZodNumber extends ZodType {
|
|
1617
1066
|
constructor() {
|
|
1618
1067
|
super(...arguments);
|
|
1619
1068
|
this.min = this.gte;
|
|
@@ -1650,9 +1099,7 @@ class ZodNumber extends ZodType {
|
|
|
1650
1099
|
}
|
|
1651
1100
|
}
|
|
1652
1101
|
else if (check.kind === "min") {
|
|
1653
|
-
const tooSmall = check.inclusive
|
|
1654
|
-
? input.data < check.value
|
|
1655
|
-
: input.data <= check.value;
|
|
1102
|
+
const tooSmall = check.inclusive ? input.data < check.value : input.data <= check.value;
|
|
1656
1103
|
if (tooSmall) {
|
|
1657
1104
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
1658
1105
|
addIssueToContext(ctx, {
|
|
@@ -1667,9 +1114,7 @@ class ZodNumber extends ZodType {
|
|
|
1667
1114
|
}
|
|
1668
1115
|
}
|
|
1669
1116
|
else if (check.kind === "max") {
|
|
1670
|
-
const tooBig = check.inclusive
|
|
1671
|
-
? input.data > check.value
|
|
1672
|
-
: input.data >= check.value;
|
|
1117
|
+
const tooBig = check.inclusive ? input.data > check.value : input.data >= check.value;
|
|
1673
1118
|
if (tooBig) {
|
|
1674
1119
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
1675
1120
|
addIssueToContext(ctx, {
|
|
@@ -1827,15 +1272,13 @@ class ZodNumber extends ZodType {
|
|
|
1827
1272
|
return max;
|
|
1828
1273
|
}
|
|
1829
1274
|
get isInt() {
|
|
1830
|
-
return !!this._def.checks.find((ch) => ch.kind === "int" ||
|
|
1831
|
-
(ch.kind === "multipleOf" && util.isInteger(ch.value)));
|
|
1275
|
+
return !!this._def.checks.find((ch) => ch.kind === "int" || (ch.kind === "multipleOf" && util.isInteger(ch.value)));
|
|
1832
1276
|
}
|
|
1833
1277
|
get isFinite() {
|
|
1834
|
-
let max = null
|
|
1278
|
+
let max = null;
|
|
1279
|
+
let min = null;
|
|
1835
1280
|
for (const ch of this._def.checks) {
|
|
1836
|
-
if (ch.kind === "finite" ||
|
|
1837
|
-
ch.kind === "int" ||
|
|
1838
|
-
ch.kind === "multipleOf") {
|
|
1281
|
+
if (ch.kind === "finite" || ch.kind === "int" || ch.kind === "multipleOf") {
|
|
1839
1282
|
return true;
|
|
1840
1283
|
}
|
|
1841
1284
|
else if (ch.kind === "min") {
|
|
@@ -1854,11 +1297,11 @@ ZodNumber.create = (params) => {
|
|
|
1854
1297
|
return new ZodNumber({
|
|
1855
1298
|
checks: [],
|
|
1856
1299
|
typeName: ZodFirstPartyTypeKind.ZodNumber,
|
|
1857
|
-
coerce:
|
|
1300
|
+
coerce: params?.coerce || false,
|
|
1858
1301
|
...processCreateParams(params),
|
|
1859
1302
|
});
|
|
1860
1303
|
};
|
|
1861
|
-
class ZodBigInt extends ZodType {
|
|
1304
|
+
export class ZodBigInt extends ZodType {
|
|
1862
1305
|
constructor() {
|
|
1863
1306
|
super(...arguments);
|
|
1864
1307
|
this.min = this.gte;
|
|
@@ -1869,7 +1312,7 @@ class ZodBigInt extends ZodType {
|
|
|
1869
1312
|
try {
|
|
1870
1313
|
input.data = BigInt(input.data);
|
|
1871
1314
|
}
|
|
1872
|
-
catch
|
|
1315
|
+
catch {
|
|
1873
1316
|
return this._getInvalidInput(input);
|
|
1874
1317
|
}
|
|
1875
1318
|
}
|
|
@@ -1881,9 +1324,7 @@ class ZodBigInt extends ZodType {
|
|
|
1881
1324
|
const status = new ParseStatus();
|
|
1882
1325
|
for (const check of this._def.checks) {
|
|
1883
1326
|
if (check.kind === "min") {
|
|
1884
|
-
const tooSmall = check.inclusive
|
|
1885
|
-
? input.data < check.value
|
|
1886
|
-
: input.data <= check.value;
|
|
1327
|
+
const tooSmall = check.inclusive ? input.data < check.value : input.data <= check.value;
|
|
1887
1328
|
if (tooSmall) {
|
|
1888
1329
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
1889
1330
|
addIssueToContext(ctx, {
|
|
@@ -1897,9 +1338,7 @@ class ZodBigInt extends ZodType {
|
|
|
1897
1338
|
}
|
|
1898
1339
|
}
|
|
1899
1340
|
else if (check.kind === "max") {
|
|
1900
|
-
const tooBig = check.inclusive
|
|
1901
|
-
? input.data > check.value
|
|
1902
|
-
: input.data >= check.value;
|
|
1341
|
+
const tooBig = check.inclusive ? input.data > check.value : input.data >= check.value;
|
|
1903
1342
|
if (tooBig) {
|
|
1904
1343
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
1905
1344
|
addIssueToContext(ctx, {
|
|
@@ -2031,15 +1470,14 @@ class ZodBigInt extends ZodType {
|
|
|
2031
1470
|
}
|
|
2032
1471
|
}
|
|
2033
1472
|
ZodBigInt.create = (params) => {
|
|
2034
|
-
var _a;
|
|
2035
1473
|
return new ZodBigInt({
|
|
2036
1474
|
checks: [],
|
|
2037
1475
|
typeName: ZodFirstPartyTypeKind.ZodBigInt,
|
|
2038
|
-
coerce:
|
|
1476
|
+
coerce: params?.coerce ?? false,
|
|
2039
1477
|
...processCreateParams(params),
|
|
2040
1478
|
});
|
|
2041
1479
|
};
|
|
2042
|
-
class ZodBoolean extends ZodType {
|
|
1480
|
+
export class ZodBoolean extends ZodType {
|
|
2043
1481
|
_parse(input) {
|
|
2044
1482
|
if (this._def.coerce) {
|
|
2045
1483
|
input.data = Boolean(input.data);
|
|
@@ -2060,11 +1498,11 @@ class ZodBoolean extends ZodType {
|
|
|
2060
1498
|
ZodBoolean.create = (params) => {
|
|
2061
1499
|
return new ZodBoolean({
|
|
2062
1500
|
typeName: ZodFirstPartyTypeKind.ZodBoolean,
|
|
2063
|
-
coerce:
|
|
1501
|
+
coerce: params?.coerce || false,
|
|
2064
1502
|
...processCreateParams(params),
|
|
2065
1503
|
});
|
|
2066
1504
|
};
|
|
2067
|
-
class ZodDate extends ZodType {
|
|
1505
|
+
export class ZodDate extends ZodType {
|
|
2068
1506
|
_parse(input) {
|
|
2069
1507
|
if (this._def.coerce) {
|
|
2070
1508
|
input.data = new Date(input.data);
|
|
@@ -2079,7 +1517,7 @@ class ZodDate extends ZodType {
|
|
|
2079
1517
|
});
|
|
2080
1518
|
return INVALID;
|
|
2081
1519
|
}
|
|
2082
|
-
if (isNaN(input.data.getTime())) {
|
|
1520
|
+
if (Number.isNaN(input.data.getTime())) {
|
|
2083
1521
|
const ctx = this._getOrReturnCtx(input);
|
|
2084
1522
|
addIssueToContext(ctx, {
|
|
2085
1523
|
code: ZodIssueCode.invalid_date,
|
|
@@ -2170,12 +1608,12 @@ class ZodDate extends ZodType {
|
|
|
2170
1608
|
ZodDate.create = (params) => {
|
|
2171
1609
|
return new ZodDate({
|
|
2172
1610
|
checks: [],
|
|
2173
|
-
coerce:
|
|
1611
|
+
coerce: params?.coerce || false,
|
|
2174
1612
|
typeName: ZodFirstPartyTypeKind.ZodDate,
|
|
2175
1613
|
...processCreateParams(params),
|
|
2176
1614
|
});
|
|
2177
1615
|
};
|
|
2178
|
-
class ZodSymbol extends ZodType {
|
|
1616
|
+
export class ZodSymbol extends ZodType {
|
|
2179
1617
|
_parse(input) {
|
|
2180
1618
|
const parsedType = this._getType(input);
|
|
2181
1619
|
if (parsedType !== ZodParsedType.symbol) {
|
|
@@ -2196,7 +1634,7 @@ ZodSymbol.create = (params) => {
|
|
|
2196
1634
|
...processCreateParams(params),
|
|
2197
1635
|
});
|
|
2198
1636
|
};
|
|
2199
|
-
class ZodUndefined extends ZodType {
|
|
1637
|
+
export class ZodUndefined extends ZodType {
|
|
2200
1638
|
_parse(input) {
|
|
2201
1639
|
const parsedType = this._getType(input);
|
|
2202
1640
|
if (parsedType !== ZodParsedType.undefined) {
|
|
@@ -2217,7 +1655,7 @@ ZodUndefined.create = (params) => {
|
|
|
2217
1655
|
...processCreateParams(params),
|
|
2218
1656
|
});
|
|
2219
1657
|
};
|
|
2220
|
-
class ZodNull extends ZodType {
|
|
1658
|
+
export class ZodNull extends ZodType {
|
|
2221
1659
|
_parse(input) {
|
|
2222
1660
|
const parsedType = this._getType(input);
|
|
2223
1661
|
if (parsedType !== ZodParsedType.null) {
|
|
@@ -2238,7 +1676,7 @@ ZodNull.create = (params) => {
|
|
|
2238
1676
|
...processCreateParams(params),
|
|
2239
1677
|
});
|
|
2240
1678
|
};
|
|
2241
|
-
class ZodAny extends ZodType {
|
|
1679
|
+
export class ZodAny extends ZodType {
|
|
2242
1680
|
constructor() {
|
|
2243
1681
|
super(...arguments);
|
|
2244
1682
|
// to prevent instances of other classes from extending ZodAny. this causes issues with catchall in ZodObject.
|
|
@@ -2254,7 +1692,7 @@ ZodAny.create = (params) => {
|
|
|
2254
1692
|
...processCreateParams(params),
|
|
2255
1693
|
});
|
|
2256
1694
|
};
|
|
2257
|
-
class ZodUnknown extends ZodType {
|
|
1695
|
+
export class ZodUnknown extends ZodType {
|
|
2258
1696
|
constructor() {
|
|
2259
1697
|
super(...arguments);
|
|
2260
1698
|
// required
|
|
@@ -2270,7 +1708,7 @@ ZodUnknown.create = (params) => {
|
|
|
2270
1708
|
...processCreateParams(params),
|
|
2271
1709
|
});
|
|
2272
1710
|
};
|
|
2273
|
-
class ZodNever extends ZodType {
|
|
1711
|
+
export class ZodNever extends ZodType {
|
|
2274
1712
|
_parse(input) {
|
|
2275
1713
|
const ctx = this._getOrReturnCtx(input);
|
|
2276
1714
|
addIssueToContext(ctx, {
|
|
@@ -2287,7 +1725,7 @@ ZodNever.create = (params) => {
|
|
|
2287
1725
|
...processCreateParams(params),
|
|
2288
1726
|
});
|
|
2289
1727
|
};
|
|
2290
|
-
class ZodVoid extends ZodType {
|
|
1728
|
+
export class ZodVoid extends ZodType {
|
|
2291
1729
|
_parse(input) {
|
|
2292
1730
|
const parsedType = this._getType(input);
|
|
2293
1731
|
if (parsedType !== ZodParsedType.undefined) {
|
|
@@ -2308,7 +1746,7 @@ ZodVoid.create = (params) => {
|
|
|
2308
1746
|
...processCreateParams(params),
|
|
2309
1747
|
});
|
|
2310
1748
|
};
|
|
2311
|
-
class ZodArray extends ZodType {
|
|
1749
|
+
export class ZodArray extends ZodType {
|
|
2312
1750
|
_parse(input) {
|
|
2313
1751
|
const { ctx, status } = this._processInputParams(input);
|
|
2314
1752
|
const def = this._def;
|
|
@@ -2440,7 +1878,7 @@ function deepPartialify(schema) {
|
|
|
2440
1878
|
return schema;
|
|
2441
1879
|
}
|
|
2442
1880
|
}
|
|
2443
|
-
class ZodObject extends ZodType {
|
|
1881
|
+
export class ZodObject extends ZodType {
|
|
2444
1882
|
constructor() {
|
|
2445
1883
|
super(...arguments);
|
|
2446
1884
|
this._cached = null;
|
|
@@ -2492,7 +1930,8 @@ class ZodObject extends ZodType {
|
|
|
2492
1930
|
return this._cached;
|
|
2493
1931
|
const shape = this._def.shape();
|
|
2494
1932
|
const keys = util.objectKeys(shape);
|
|
2495
|
-
|
|
1933
|
+
this._cached = { shape, keys };
|
|
1934
|
+
return this._cached;
|
|
2496
1935
|
}
|
|
2497
1936
|
_parse(input) {
|
|
2498
1937
|
const parsedType = this._getType(input);
|
|
@@ -2508,8 +1947,7 @@ class ZodObject extends ZodType {
|
|
|
2508
1947
|
const { status, ctx } = this._processInputParams(input);
|
|
2509
1948
|
const { shape, keys: shapeKeys } = this._getCached();
|
|
2510
1949
|
const extraKeys = [];
|
|
2511
|
-
if (!(this._def.catchall instanceof ZodNever &&
|
|
2512
|
-
this._def.unknownKeys === "strip")) {
|
|
1950
|
+
if (!(this._def.catchall instanceof ZodNever && this._def.unknownKeys === "strip")) {
|
|
2513
1951
|
for (const key in ctx.data) {
|
|
2514
1952
|
if (!shapeKeys.includes(key)) {
|
|
2515
1953
|
extraKeys.push(key);
|
|
@@ -2545,7 +1983,8 @@ class ZodObject extends ZodType {
|
|
|
2545
1983
|
status.dirty();
|
|
2546
1984
|
}
|
|
2547
1985
|
}
|
|
2548
|
-
else if (unknownKeys === "strip")
|
|
1986
|
+
else if (unknownKeys === "strip") {
|
|
1987
|
+
}
|
|
2549
1988
|
else {
|
|
2550
1989
|
throw new Error(`Internal ZodObject error: invalid unknownKeys value.`);
|
|
2551
1990
|
}
|
|
@@ -2597,11 +2036,10 @@ class ZodObject extends ZodType {
|
|
|
2597
2036
|
...(message !== undefined
|
|
2598
2037
|
? {
|
|
2599
2038
|
errorMap: (issue, ctx) => {
|
|
2600
|
-
|
|
2601
|
-
const defaultError = (_c = (_b = (_a = this._def).errorMap) === null || _b === void 0 ? void 0 : _b.call(_a, issue, ctx).message) !== null && _c !== void 0 ? _c : ctx.defaultError;
|
|
2039
|
+
const defaultError = this._def.errorMap?.(issue, ctx).message ?? ctx.defaultError;
|
|
2602
2040
|
if (issue.code === "unrecognized_keys")
|
|
2603
2041
|
return {
|
|
2604
|
-
message:
|
|
2042
|
+
message: errorUtil.errToObj(message).message ?? defaultError,
|
|
2605
2043
|
};
|
|
2606
2044
|
return {
|
|
2607
2045
|
message: defaultError,
|
|
@@ -2733,11 +2171,11 @@ class ZodObject extends ZodType {
|
|
|
2733
2171
|
}
|
|
2734
2172
|
pick(mask) {
|
|
2735
2173
|
const shape = {};
|
|
2736
|
-
util.objectKeys(mask)
|
|
2174
|
+
for (const key of util.objectKeys(mask)) {
|
|
2737
2175
|
if (mask[key] && this.shape[key]) {
|
|
2738
2176
|
shape[key] = this.shape[key];
|
|
2739
2177
|
}
|
|
2740
|
-
}
|
|
2178
|
+
}
|
|
2741
2179
|
return new ZodObject({
|
|
2742
2180
|
...this._def,
|
|
2743
2181
|
shape: () => shape,
|
|
@@ -2745,11 +2183,11 @@ class ZodObject extends ZodType {
|
|
|
2745
2183
|
}
|
|
2746
2184
|
omit(mask) {
|
|
2747
2185
|
const shape = {};
|
|
2748
|
-
util.objectKeys(this.shape)
|
|
2186
|
+
for (const key of util.objectKeys(this.shape)) {
|
|
2749
2187
|
if (!mask[key]) {
|
|
2750
2188
|
shape[key] = this.shape[key];
|
|
2751
2189
|
}
|
|
2752
|
-
}
|
|
2190
|
+
}
|
|
2753
2191
|
return new ZodObject({
|
|
2754
2192
|
...this._def,
|
|
2755
2193
|
shape: () => shape,
|
|
@@ -2763,7 +2201,7 @@ class ZodObject extends ZodType {
|
|
|
2763
2201
|
}
|
|
2764
2202
|
partial(mask) {
|
|
2765
2203
|
const newShape = {};
|
|
2766
|
-
util.objectKeys(this.shape)
|
|
2204
|
+
for (const key of util.objectKeys(this.shape)) {
|
|
2767
2205
|
const fieldSchema = this.shape[key];
|
|
2768
2206
|
if (mask && !mask[key]) {
|
|
2769
2207
|
newShape[key] = fieldSchema;
|
|
@@ -2771,7 +2209,7 @@ class ZodObject extends ZodType {
|
|
|
2771
2209
|
else {
|
|
2772
2210
|
newShape[key] = fieldSchema.optional();
|
|
2773
2211
|
}
|
|
2774
|
-
}
|
|
2212
|
+
}
|
|
2775
2213
|
return new ZodObject({
|
|
2776
2214
|
...this._def,
|
|
2777
2215
|
shape: () => newShape,
|
|
@@ -2779,7 +2217,7 @@ class ZodObject extends ZodType {
|
|
|
2779
2217
|
}
|
|
2780
2218
|
required(mask) {
|
|
2781
2219
|
const newShape = {};
|
|
2782
|
-
util.objectKeys(this.shape)
|
|
2220
|
+
for (const key of util.objectKeys(this.shape)) {
|
|
2783
2221
|
if (mask && !mask[key]) {
|
|
2784
2222
|
newShape[key] = this.shape[key];
|
|
2785
2223
|
}
|
|
@@ -2791,7 +2229,7 @@ class ZodObject extends ZodType {
|
|
|
2791
2229
|
}
|
|
2792
2230
|
newShape[key] = newField;
|
|
2793
2231
|
}
|
|
2794
|
-
}
|
|
2232
|
+
}
|
|
2795
2233
|
return new ZodObject({
|
|
2796
2234
|
...this._def,
|
|
2797
2235
|
shape: () => newShape,
|
|
@@ -2828,7 +2266,7 @@ ZodObject.lazycreate = (shape, params) => {
|
|
|
2828
2266
|
...processCreateParams(params),
|
|
2829
2267
|
});
|
|
2830
2268
|
};
|
|
2831
|
-
class ZodUnion extends ZodType {
|
|
2269
|
+
export class ZodUnion extends ZodType {
|
|
2832
2270
|
_parse(input) {
|
|
2833
2271
|
const { ctx } = this._processInputParams(input);
|
|
2834
2272
|
const options = this._def.options;
|
|
@@ -2976,7 +2414,7 @@ const getDiscriminator = (type) => {
|
|
|
2976
2414
|
return [];
|
|
2977
2415
|
}
|
|
2978
2416
|
};
|
|
2979
|
-
class ZodDiscriminatedUnion extends ZodType {
|
|
2417
|
+
export class ZodDiscriminatedUnion extends ZodType {
|
|
2980
2418
|
_parse(input) {
|
|
2981
2419
|
const { ctx } = this._processInputParams(input);
|
|
2982
2420
|
if (ctx.parsedType !== ZodParsedType.object) {
|
|
@@ -3063,11 +2501,13 @@ function mergeValues(a, b) {
|
|
|
3063
2501
|
}
|
|
3064
2502
|
else if (aType === ZodParsedType.object && bType === ZodParsedType.object) {
|
|
3065
2503
|
const bKeys = util.objectKeys(b);
|
|
3066
|
-
const sharedKeys = util
|
|
3067
|
-
.objectKeys(a)
|
|
3068
|
-
.filter((key) => bKeys.indexOf(key) !== -1);
|
|
2504
|
+
const sharedKeys = util.objectKeys(a).filter((key) => bKeys.indexOf(key) !== -1);
|
|
3069
2505
|
const newObj = { ...a, ...b };
|
|
2506
|
+
if (Object.prototype.hasOwnProperty.call(newObj, "__proto__"))
|
|
2507
|
+
delete newObj.__proto__;
|
|
3070
2508
|
for (const key of sharedKeys) {
|
|
2509
|
+
if (key === "__proto__")
|
|
2510
|
+
continue;
|
|
3071
2511
|
const sharedValue = mergeValues(a[key], b[key]);
|
|
3072
2512
|
if (!sharedValue.valid) {
|
|
3073
2513
|
return { valid: false };
|
|
@@ -3092,16 +2532,14 @@ function mergeValues(a, b) {
|
|
|
3092
2532
|
}
|
|
3093
2533
|
return { valid: true, data: newArray };
|
|
3094
2534
|
}
|
|
3095
|
-
else if (aType === ZodParsedType.date &&
|
|
3096
|
-
bType === ZodParsedType.date &&
|
|
3097
|
-
+a === +b) {
|
|
2535
|
+
else if (aType === ZodParsedType.date && bType === ZodParsedType.date && +a === +b) {
|
|
3098
2536
|
return { valid: true, data: a };
|
|
3099
2537
|
}
|
|
3100
2538
|
else {
|
|
3101
2539
|
return { valid: false };
|
|
3102
2540
|
}
|
|
3103
2541
|
}
|
|
3104
|
-
class ZodIntersection extends ZodType {
|
|
2542
|
+
export class ZodIntersection extends ZodType {
|
|
3105
2543
|
_parse(input) {
|
|
3106
2544
|
const { status, ctx } = this._processInputParams(input);
|
|
3107
2545
|
const handleParsed = (parsedLeft, parsedRight) => {
|
|
@@ -3155,7 +2593,8 @@ ZodIntersection.create = (left, right, params) => {
|
|
|
3155
2593
|
...processCreateParams(params),
|
|
3156
2594
|
});
|
|
3157
2595
|
};
|
|
3158
|
-
|
|
2596
|
+
// type ZodTupleItems = [ZodTypeAny, ...ZodTypeAny[]];
|
|
2597
|
+
export class ZodTuple extends ZodType {
|
|
3159
2598
|
_parse(input) {
|
|
3160
2599
|
const { status, ctx } = this._processInputParams(input);
|
|
3161
2600
|
if (ctx.parsedType !== ZodParsedType.array) {
|
|
@@ -3225,7 +2664,7 @@ ZodTuple.create = (schemas, params) => {
|
|
|
3225
2664
|
...processCreateParams(params),
|
|
3226
2665
|
});
|
|
3227
2666
|
};
|
|
3228
|
-
class ZodRecord extends ZodType {
|
|
2667
|
+
export class ZodRecord extends ZodType {
|
|
3229
2668
|
get keySchema() {
|
|
3230
2669
|
return this._def.keyType;
|
|
3231
2670
|
}
|
|
@@ -3279,7 +2718,7 @@ class ZodRecord extends ZodType {
|
|
|
3279
2718
|
});
|
|
3280
2719
|
}
|
|
3281
2720
|
}
|
|
3282
|
-
class ZodMap extends ZodType {
|
|
2721
|
+
export class ZodMap extends ZodType {
|
|
3283
2722
|
get keySchema() {
|
|
3284
2723
|
return this._def.keyType;
|
|
3285
2724
|
}
|
|
@@ -3346,7 +2785,7 @@ ZodMap.create = (keyType, valueType, params) => {
|
|
|
3346
2785
|
...processCreateParams(params),
|
|
3347
2786
|
});
|
|
3348
2787
|
};
|
|
3349
|
-
class ZodSet extends ZodType {
|
|
2788
|
+
export class ZodSet extends ZodType {
|
|
3350
2789
|
_parse(input) {
|
|
3351
2790
|
const { status, ctx } = this._processInputParams(input);
|
|
3352
2791
|
if (ctx.parsedType !== ZodParsedType.set) {
|
|
@@ -3432,7 +2871,7 @@ ZodSet.create = (valueType, params) => {
|
|
|
3432
2871
|
...processCreateParams(params),
|
|
3433
2872
|
});
|
|
3434
2873
|
};
|
|
3435
|
-
class ZodFunction extends ZodType {
|
|
2874
|
+
export class ZodFunction extends ZodType {
|
|
3436
2875
|
constructor() {
|
|
3437
2876
|
super(...arguments);
|
|
3438
2877
|
this.validate = this.implement;
|
|
@@ -3451,12 +2890,7 @@ class ZodFunction extends ZodType {
|
|
|
3451
2890
|
return makeIssue({
|
|
3452
2891
|
data: args,
|
|
3453
2892
|
path: ctx.path,
|
|
3454
|
-
errorMaps: [
|
|
3455
|
-
ctx.common.contextualErrorMap,
|
|
3456
|
-
ctx.schemaErrorMap,
|
|
3457
|
-
getErrorMap(),
|
|
3458
|
-
errorMap,
|
|
3459
|
-
].filter((x) => !!x),
|
|
2893
|
+
errorMaps: [ctx.common.contextualErrorMap, ctx.schemaErrorMap, getErrorMap(), defaultErrorMap].filter((x) => !!x),
|
|
3460
2894
|
issueData: {
|
|
3461
2895
|
code: ZodIssueCode.invalid_arguments,
|
|
3462
2896
|
argumentsError: error,
|
|
@@ -3467,12 +2901,7 @@ class ZodFunction extends ZodType {
|
|
|
3467
2901
|
return makeIssue({
|
|
3468
2902
|
data: returns,
|
|
3469
2903
|
path: ctx.path,
|
|
3470
|
-
errorMaps: [
|
|
3471
|
-
ctx.common.contextualErrorMap,
|
|
3472
|
-
ctx.schemaErrorMap,
|
|
3473
|
-
getErrorMap(),
|
|
3474
|
-
errorMap,
|
|
3475
|
-
].filter((x) => !!x),
|
|
2904
|
+
errorMaps: [ctx.common.contextualErrorMap, ctx.schemaErrorMap, getErrorMap(), defaultErrorMap].filter((x) => !!x),
|
|
3476
2905
|
issueData: {
|
|
3477
2906
|
code: ZodIssueCode.invalid_return_type,
|
|
3478
2907
|
returnTypeError: error,
|
|
@@ -3482,15 +2911,12 @@ class ZodFunction extends ZodType {
|
|
|
3482
2911
|
const params = { errorMap: ctx.common.contextualErrorMap };
|
|
3483
2912
|
const fn = ctx.data;
|
|
3484
2913
|
if (this._def.returns instanceof ZodPromise) {
|
|
3485
|
-
// Would love a way to avoid disabling this rule, but we need
|
|
3486
|
-
// an alias (using an arrow function was what caused 2651).
|
|
2914
|
+
// Would love a way to avoid disabling this rule, but we need an alias (using an arrow function was what caused 2651).
|
|
3487
2915
|
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
3488
2916
|
const me = this;
|
|
3489
2917
|
return OK(async function (...args) {
|
|
3490
2918
|
const error = new ZodError([]);
|
|
3491
|
-
const parsedArgs = await me._def.args
|
|
3492
|
-
.parseAsync(args, params)
|
|
3493
|
-
.catch((e) => {
|
|
2919
|
+
const parsedArgs = await me._def.args.parseAsync(args, params).catch((e) => {
|
|
3494
2920
|
error.addIssue(makeArgsIssue(args, e));
|
|
3495
2921
|
throw error;
|
|
3496
2922
|
});
|
|
@@ -3505,8 +2931,7 @@ class ZodFunction extends ZodType {
|
|
|
3505
2931
|
});
|
|
3506
2932
|
}
|
|
3507
2933
|
else {
|
|
3508
|
-
// Would love a way to avoid disabling this rule, but we need
|
|
3509
|
-
// an alias (using an arrow function was what caused 2651).
|
|
2934
|
+
// Would love a way to avoid disabling this rule, but we need an alias (using an arrow function was what caused 2651).
|
|
3510
2935
|
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
3511
2936
|
const me = this;
|
|
3512
2937
|
return OK(function (...args) {
|
|
@@ -3551,16 +2976,14 @@ class ZodFunction extends ZodType {
|
|
|
3551
2976
|
}
|
|
3552
2977
|
static create(args, returns, params) {
|
|
3553
2978
|
return new ZodFunction({
|
|
3554
|
-
args: (args
|
|
3555
|
-
? args
|
|
3556
|
-
: ZodTuple.create([]).rest(ZodUnknown.create())),
|
|
2979
|
+
args: (args ? args : ZodTuple.create([]).rest(ZodUnknown.create())),
|
|
3557
2980
|
returns: returns || ZodUnknown.create(),
|
|
3558
2981
|
typeName: ZodFirstPartyTypeKind.ZodFunction,
|
|
3559
2982
|
...processCreateParams(params),
|
|
3560
2983
|
});
|
|
3561
2984
|
}
|
|
3562
2985
|
}
|
|
3563
|
-
class ZodLazy extends ZodType {
|
|
2986
|
+
export class ZodLazy extends ZodType {
|
|
3564
2987
|
get schema() {
|
|
3565
2988
|
return this._def.getter();
|
|
3566
2989
|
}
|
|
@@ -3577,7 +3000,7 @@ ZodLazy.create = (getter, params) => {
|
|
|
3577
3000
|
...processCreateParams(params),
|
|
3578
3001
|
});
|
|
3579
3002
|
};
|
|
3580
|
-
class ZodLiteral extends ZodType {
|
|
3003
|
+
export class ZodLiteral extends ZodType {
|
|
3581
3004
|
_parse(input) {
|
|
3582
3005
|
if (input.data !== this._def.value) {
|
|
3583
3006
|
const ctx = this._getOrReturnCtx(input);
|
|
@@ -3608,11 +3031,7 @@ function createZodEnum(values, params) {
|
|
|
3608
3031
|
...processCreateParams(params),
|
|
3609
3032
|
});
|
|
3610
3033
|
}
|
|
3611
|
-
class ZodEnum extends ZodType {
|
|
3612
|
-
constructor() {
|
|
3613
|
-
super(...arguments);
|
|
3614
|
-
_ZodEnum_cache.set(this, void 0);
|
|
3615
|
-
}
|
|
3034
|
+
export class ZodEnum extends ZodType {
|
|
3616
3035
|
_parse(input) {
|
|
3617
3036
|
if (typeof input.data !== "string") {
|
|
3618
3037
|
const ctx = this._getOrReturnCtx(input);
|
|
@@ -3624,10 +3043,10 @@ class ZodEnum extends ZodType {
|
|
|
3624
3043
|
});
|
|
3625
3044
|
return INVALID;
|
|
3626
3045
|
}
|
|
3627
|
-
if (!
|
|
3628
|
-
|
|
3046
|
+
if (!this._cache) {
|
|
3047
|
+
this._cache = new Set(this._def.values);
|
|
3629
3048
|
}
|
|
3630
|
-
if (!
|
|
3049
|
+
if (!this._cache.has(input.data)) {
|
|
3631
3050
|
const ctx = this._getOrReturnCtx(input);
|
|
3632
3051
|
const expectedValues = this._def.values;
|
|
3633
3052
|
addIssueToContext(ctx, {
|
|
@@ -3676,18 +3095,12 @@ class ZodEnum extends ZodType {
|
|
|
3676
3095
|
});
|
|
3677
3096
|
}
|
|
3678
3097
|
}
|
|
3679
|
-
_ZodEnum_cache = new WeakMap();
|
|
3680
3098
|
ZodEnum.create = createZodEnum;
|
|
3681
|
-
class ZodNativeEnum extends ZodType {
|
|
3682
|
-
constructor() {
|
|
3683
|
-
super(...arguments);
|
|
3684
|
-
_ZodNativeEnum_cache.set(this, void 0);
|
|
3685
|
-
}
|
|
3099
|
+
export class ZodNativeEnum extends ZodType {
|
|
3686
3100
|
_parse(input) {
|
|
3687
3101
|
const nativeEnumValues = util.getValidEnumValues(this._def.values);
|
|
3688
3102
|
const ctx = this._getOrReturnCtx(input);
|
|
3689
|
-
if (ctx.parsedType !== ZodParsedType.string &&
|
|
3690
|
-
ctx.parsedType !== ZodParsedType.number) {
|
|
3103
|
+
if (ctx.parsedType !== ZodParsedType.string && ctx.parsedType !== ZodParsedType.number) {
|
|
3691
3104
|
const expectedValues = util.objectValues(nativeEnumValues);
|
|
3692
3105
|
addIssueToContext(ctx, {
|
|
3693
3106
|
expected: util.joinValues(expectedValues),
|
|
@@ -3696,10 +3109,10 @@ class ZodNativeEnum extends ZodType {
|
|
|
3696
3109
|
});
|
|
3697
3110
|
return INVALID;
|
|
3698
3111
|
}
|
|
3699
|
-
if (!
|
|
3700
|
-
|
|
3112
|
+
if (!this._cache) {
|
|
3113
|
+
this._cache = new Set(util.getValidEnumValues(this._def.values));
|
|
3701
3114
|
}
|
|
3702
|
-
if (!
|
|
3115
|
+
if (!this._cache.has(input.data)) {
|
|
3703
3116
|
const expectedValues = util.objectValues(nativeEnumValues);
|
|
3704
3117
|
addIssueToContext(ctx, {
|
|
3705
3118
|
received: ctx.data,
|
|
@@ -3714,7 +3127,6 @@ class ZodNativeEnum extends ZodType {
|
|
|
3714
3127
|
return this._def.values;
|
|
3715
3128
|
}
|
|
3716
3129
|
}
|
|
3717
|
-
_ZodNativeEnum_cache = new WeakMap();
|
|
3718
3130
|
ZodNativeEnum.create = (values, params) => {
|
|
3719
3131
|
return new ZodNativeEnum({
|
|
3720
3132
|
values: values,
|
|
@@ -3722,14 +3134,13 @@ ZodNativeEnum.create = (values, params) => {
|
|
|
3722
3134
|
...processCreateParams(params),
|
|
3723
3135
|
});
|
|
3724
3136
|
};
|
|
3725
|
-
class ZodPromise extends ZodType {
|
|
3137
|
+
export class ZodPromise extends ZodType {
|
|
3726
3138
|
unwrap() {
|
|
3727
3139
|
return this._def.type;
|
|
3728
3140
|
}
|
|
3729
3141
|
_parse(input) {
|
|
3730
3142
|
const { ctx } = this._processInputParams(input);
|
|
3731
|
-
if (ctx.parsedType !== ZodParsedType.promise &&
|
|
3732
|
-
ctx.common.async === false) {
|
|
3143
|
+
if (ctx.parsedType !== ZodParsedType.promise && ctx.common.async === false) {
|
|
3733
3144
|
addIssueToContext(ctx, {
|
|
3734
3145
|
code: ZodIssueCode.invalid_type,
|
|
3735
3146
|
expected: ZodParsedType.promise,
|
|
@@ -3737,9 +3148,7 @@ class ZodPromise extends ZodType {
|
|
|
3737
3148
|
});
|
|
3738
3149
|
return INVALID;
|
|
3739
3150
|
}
|
|
3740
|
-
const promisified = ctx.parsedType === ZodParsedType.promise
|
|
3741
|
-
? ctx.data
|
|
3742
|
-
: Promise.resolve(ctx.data);
|
|
3151
|
+
const promisified = ctx.parsedType === ZodParsedType.promise ? ctx.data : Promise.resolve(ctx.data);
|
|
3743
3152
|
return OK(promisified.then((data) => {
|
|
3744
3153
|
return this._def.type.parseAsync(data, {
|
|
3745
3154
|
path: ctx.path,
|
|
@@ -3755,7 +3164,7 @@ ZodPromise.create = (schema, params) => {
|
|
|
3755
3164
|
...processCreateParams(params),
|
|
3756
3165
|
});
|
|
3757
3166
|
};
|
|
3758
|
-
class ZodEffects extends ZodType {
|
|
3167
|
+
export class ZodEffects extends ZodType {
|
|
3759
3168
|
innerType() {
|
|
3760
3169
|
return this._def.schema;
|
|
3761
3170
|
}
|
|
@@ -3845,9 +3254,7 @@ class ZodEffects extends ZodType {
|
|
|
3845
3254
|
return { status: status.value, value: inner.value };
|
|
3846
3255
|
}
|
|
3847
3256
|
else {
|
|
3848
|
-
return this._def.schema
|
|
3849
|
-
._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx })
|
|
3850
|
-
.then((inner) => {
|
|
3257
|
+
return this._def.schema._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx }).then((inner) => {
|
|
3851
3258
|
if (inner.status === "aborted")
|
|
3852
3259
|
return INVALID;
|
|
3853
3260
|
if (inner.status === "dirty")
|
|
@@ -3866,7 +3273,7 @@ class ZodEffects extends ZodType {
|
|
|
3866
3273
|
parent: ctx,
|
|
3867
3274
|
});
|
|
3868
3275
|
if (!isValid(base))
|
|
3869
|
-
return
|
|
3276
|
+
return INVALID;
|
|
3870
3277
|
const result = effect.transform(base.value, checkCtx);
|
|
3871
3278
|
if (result instanceof Promise) {
|
|
3872
3279
|
throw new Error(`Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.`);
|
|
@@ -3874,12 +3281,13 @@ class ZodEffects extends ZodType {
|
|
|
3874
3281
|
return { status: status.value, value: result };
|
|
3875
3282
|
}
|
|
3876
3283
|
else {
|
|
3877
|
-
return this._def.schema
|
|
3878
|
-
._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx })
|
|
3879
|
-
.then((base) => {
|
|
3284
|
+
return this._def.schema._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx }).then((base) => {
|
|
3880
3285
|
if (!isValid(base))
|
|
3881
|
-
return
|
|
3882
|
-
return Promise.resolve(effect.transform(base.value, checkCtx)).then((result) => ({
|
|
3286
|
+
return INVALID;
|
|
3287
|
+
return Promise.resolve(effect.transform(base.value, checkCtx)).then((result) => ({
|
|
3288
|
+
status: status.value,
|
|
3289
|
+
value: result,
|
|
3290
|
+
}));
|
|
3883
3291
|
});
|
|
3884
3292
|
}
|
|
3885
3293
|
}
|
|
@@ -3902,7 +3310,8 @@ ZodEffects.createWithPreprocess = (preprocess, schema, params) => {
|
|
|
3902
3310
|
...processCreateParams(params),
|
|
3903
3311
|
});
|
|
3904
3312
|
};
|
|
3905
|
-
|
|
3313
|
+
export { ZodEffects as ZodTransformer };
|
|
3314
|
+
export class ZodOptional extends ZodType {
|
|
3906
3315
|
_parse(input) {
|
|
3907
3316
|
const parsedType = this._getType(input);
|
|
3908
3317
|
if (parsedType === ZodParsedType.undefined) {
|
|
@@ -3921,7 +3330,7 @@ ZodOptional.create = (type, params) => {
|
|
|
3921
3330
|
...processCreateParams(params),
|
|
3922
3331
|
});
|
|
3923
3332
|
};
|
|
3924
|
-
class ZodNullable extends ZodType {
|
|
3333
|
+
export class ZodNullable extends ZodType {
|
|
3925
3334
|
_parse(input) {
|
|
3926
3335
|
const parsedType = this._getType(input);
|
|
3927
3336
|
if (parsedType === ZodParsedType.null) {
|
|
@@ -3940,7 +3349,7 @@ ZodNullable.create = (type, params) => {
|
|
|
3940
3349
|
...processCreateParams(params),
|
|
3941
3350
|
});
|
|
3942
3351
|
};
|
|
3943
|
-
class ZodDefault extends ZodType {
|
|
3352
|
+
export class ZodDefault extends ZodType {
|
|
3944
3353
|
_parse(input) {
|
|
3945
3354
|
const { ctx } = this._processInputParams(input);
|
|
3946
3355
|
let data = ctx.data;
|
|
@@ -3961,13 +3370,11 @@ ZodDefault.create = (type, params) => {
|
|
|
3961
3370
|
return new ZodDefault({
|
|
3962
3371
|
innerType: type,
|
|
3963
3372
|
typeName: ZodFirstPartyTypeKind.ZodDefault,
|
|
3964
|
-
defaultValue: typeof params.default === "function"
|
|
3965
|
-
? params.default
|
|
3966
|
-
: () => params.default,
|
|
3373
|
+
defaultValue: typeof params.default === "function" ? params.default : () => params.default,
|
|
3967
3374
|
...processCreateParams(params),
|
|
3968
3375
|
});
|
|
3969
3376
|
};
|
|
3970
|
-
class ZodCatch extends ZodType {
|
|
3377
|
+
export class ZodCatch extends ZodType {
|
|
3971
3378
|
_parse(input) {
|
|
3972
3379
|
const { ctx } = this._processInputParams(input);
|
|
3973
3380
|
// newCtx is used to not collect issues from inner types in ctx
|
|
@@ -4026,7 +3433,7 @@ ZodCatch.create = (type, params) => {
|
|
|
4026
3433
|
...processCreateParams(params),
|
|
4027
3434
|
});
|
|
4028
3435
|
};
|
|
4029
|
-
class ZodNaN extends ZodType {
|
|
3436
|
+
export class ZodNaN extends ZodType {
|
|
4030
3437
|
_parse(input) {
|
|
4031
3438
|
const parsedType = this._getType(input);
|
|
4032
3439
|
if (parsedType !== ZodParsedType.nan) {
|
|
@@ -4047,8 +3454,8 @@ ZodNaN.create = (params) => {
|
|
|
4047
3454
|
...processCreateParams(params),
|
|
4048
3455
|
});
|
|
4049
3456
|
};
|
|
4050
|
-
const BRAND = Symbol("zod_brand");
|
|
4051
|
-
class ZodBranded extends ZodType {
|
|
3457
|
+
export const BRAND = Symbol("zod_brand");
|
|
3458
|
+
export class ZodBranded extends ZodType {
|
|
4052
3459
|
_parse(input) {
|
|
4053
3460
|
const { ctx } = this._processInputParams(input);
|
|
4054
3461
|
const data = ctx.data;
|
|
@@ -4062,7 +3469,7 @@ class ZodBranded extends ZodType {
|
|
|
4062
3469
|
return this._def.type;
|
|
4063
3470
|
}
|
|
4064
3471
|
}
|
|
4065
|
-
class ZodPipeline extends ZodType {
|
|
3472
|
+
export class ZodPipeline extends ZodType {
|
|
4066
3473
|
_parse(input) {
|
|
4067
3474
|
const { status, ctx } = this._processInputParams(input);
|
|
4068
3475
|
if (ctx.common.async) {
|
|
@@ -4120,7 +3527,7 @@ class ZodPipeline extends ZodType {
|
|
|
4120
3527
|
});
|
|
4121
3528
|
}
|
|
4122
3529
|
}
|
|
4123
|
-
class ZodReadonly extends ZodType {
|
|
3530
|
+
export class ZodReadonly extends ZodType {
|
|
4124
3531
|
_parse(input) {
|
|
4125
3532
|
const result = this._def.innerType._parse(input);
|
|
4126
3533
|
const freeze = (data) => {
|
|
@@ -4129,9 +3536,7 @@ class ZodReadonly extends ZodType {
|
|
|
4129
3536
|
}
|
|
4130
3537
|
return data;
|
|
4131
3538
|
};
|
|
4132
|
-
return isAsync(result)
|
|
4133
|
-
? result.then((data) => freeze(data))
|
|
4134
|
-
: freeze(result);
|
|
3539
|
+
return isAsync(result) ? result.then((data) => freeze(data)) : freeze(result);
|
|
4135
3540
|
}
|
|
4136
3541
|
unwrap() {
|
|
4137
3542
|
return this._def.innerType;
|
|
@@ -4144,7 +3549,19 @@ ZodReadonly.create = (type, params) => {
|
|
|
4144
3549
|
...processCreateParams(params),
|
|
4145
3550
|
});
|
|
4146
3551
|
};
|
|
4147
|
-
|
|
3552
|
+
////////////////////////////////////////
|
|
3553
|
+
////////////////////////////////////////
|
|
3554
|
+
////////// //////////
|
|
3555
|
+
////////// z.custom //////////
|
|
3556
|
+
////////// //////////
|
|
3557
|
+
////////////////////////////////////////
|
|
3558
|
+
////////////////////////////////////////
|
|
3559
|
+
function cleanParams(params, data) {
|
|
3560
|
+
const p = typeof params === "function" ? params(data) : typeof params === "string" ? { message: params } : params;
|
|
3561
|
+
const p2 = typeof p === "string" ? { message: p } : p;
|
|
3562
|
+
return p2;
|
|
3563
|
+
}
|
|
3564
|
+
export function custom(check, _params = {},
|
|
4148
3565
|
/**
|
|
4149
3566
|
* @deprecated
|
|
4150
3567
|
*
|
|
@@ -4158,24 +3575,30 @@ function custom(check, params = {},
|
|
|
4158
3575
|
fatal) {
|
|
4159
3576
|
if (check)
|
|
4160
3577
|
return ZodAny.create().superRefine((data, ctx) => {
|
|
4161
|
-
|
|
4162
|
-
if (
|
|
4163
|
-
|
|
4164
|
-
|
|
4165
|
-
|
|
4166
|
-
|
|
4167
|
-
: params;
|
|
4168
|
-
|
|
4169
|
-
|
|
4170
|
-
|
|
3578
|
+
const r = check(data);
|
|
3579
|
+
if (r instanceof Promise) {
|
|
3580
|
+
return r.then((r) => {
|
|
3581
|
+
if (!r) {
|
|
3582
|
+
const params = cleanParams(_params, data);
|
|
3583
|
+
const _fatal = params.fatal ?? fatal ?? true;
|
|
3584
|
+
ctx.addIssue({ code: "custom", ...params, fatal: _fatal });
|
|
3585
|
+
}
|
|
3586
|
+
});
|
|
3587
|
+
}
|
|
3588
|
+
if (!r) {
|
|
3589
|
+
const params = cleanParams(_params, data);
|
|
3590
|
+
const _fatal = params.fatal ?? fatal ?? true;
|
|
3591
|
+
ctx.addIssue({ code: "custom", ...params, fatal: _fatal });
|
|
4171
3592
|
}
|
|
3593
|
+
return;
|
|
4172
3594
|
});
|
|
4173
3595
|
return ZodAny.create();
|
|
4174
3596
|
}
|
|
4175
|
-
|
|
3597
|
+
export { ZodType as Schema, ZodType as ZodSchema };
|
|
3598
|
+
export const late = {
|
|
4176
3599
|
object: ZodObject.lazycreate,
|
|
4177
3600
|
};
|
|
4178
|
-
var ZodFirstPartyTypeKind;
|
|
3601
|
+
export var ZodFirstPartyTypeKind;
|
|
4179
3602
|
(function (ZodFirstPartyTypeKind) {
|
|
4180
3603
|
ZodFirstPartyTypeKind["ZodString"] = "ZodString";
|
|
4181
3604
|
ZodFirstPartyTypeKind["ZodNumber"] = "ZodNumber";
|
|
@@ -4214,6 +3637,10 @@ var ZodFirstPartyTypeKind;
|
|
|
4214
3637
|
ZodFirstPartyTypeKind["ZodPipeline"] = "ZodPipeline";
|
|
4215
3638
|
ZodFirstPartyTypeKind["ZodReadonly"] = "ZodReadonly";
|
|
4216
3639
|
})(ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {}));
|
|
3640
|
+
// requires TS 4.4+
|
|
3641
|
+
class Class {
|
|
3642
|
+
constructor(..._) { }
|
|
3643
|
+
}
|
|
4217
3644
|
const instanceOfType = (
|
|
4218
3645
|
// const instanceOfType = <T extends new (...args: any[]) => any>(
|
|
4219
3646
|
cls, params = {
|
|
@@ -4256,7 +3683,7 @@ const pipelineType = ZodPipeline.create;
|
|
|
4256
3683
|
const ostring = () => stringType().optional();
|
|
4257
3684
|
const onumber = () => numberType().optional();
|
|
4258
3685
|
const oboolean = () => booleanType().optional();
|
|
4259
|
-
const coerce = {
|
|
3686
|
+
export const coerce = {
|
|
4260
3687
|
string: ((arg) => ZodString.create({ ...arg, coerce: true })),
|
|
4261
3688
|
number: ((arg) => ZodNumber.create({ ...arg, coerce: true })),
|
|
4262
3689
|
boolean: ((arg) => ZodBoolean.create({
|
|
@@ -4266,117 +3693,5 @@ const coerce = {
|
|
|
4266
3693
|
bigint: ((arg) => ZodBigInt.create({ ...arg, coerce: true })),
|
|
4267
3694
|
date: ((arg) => ZodDate.create({ ...arg, coerce: true })),
|
|
4268
3695
|
};
|
|
4269
|
-
|
|
4270
|
-
|
|
4271
|
-
var z = /*#__PURE__*/Object.freeze({
|
|
4272
|
-
__proto__: null,
|
|
4273
|
-
defaultErrorMap: errorMap,
|
|
4274
|
-
setErrorMap: setErrorMap,
|
|
4275
|
-
getErrorMap: getErrorMap,
|
|
4276
|
-
makeIssue: makeIssue,
|
|
4277
|
-
EMPTY_PATH: EMPTY_PATH,
|
|
4278
|
-
addIssueToContext: addIssueToContext,
|
|
4279
|
-
ParseStatus: ParseStatus,
|
|
4280
|
-
INVALID: INVALID,
|
|
4281
|
-
DIRTY: DIRTY,
|
|
4282
|
-
OK: OK,
|
|
4283
|
-
isAborted: isAborted,
|
|
4284
|
-
isDirty: isDirty,
|
|
4285
|
-
isValid: isValid,
|
|
4286
|
-
isAsync: isAsync,
|
|
4287
|
-
get util () { return util; },
|
|
4288
|
-
get objectUtil () { return objectUtil; },
|
|
4289
|
-
ZodParsedType: ZodParsedType,
|
|
4290
|
-
getParsedType: getParsedType,
|
|
4291
|
-
ZodType: ZodType,
|
|
4292
|
-
datetimeRegex: datetimeRegex,
|
|
4293
|
-
ZodString: ZodString,
|
|
4294
|
-
ZodNumber: ZodNumber,
|
|
4295
|
-
ZodBigInt: ZodBigInt,
|
|
4296
|
-
ZodBoolean: ZodBoolean,
|
|
4297
|
-
ZodDate: ZodDate,
|
|
4298
|
-
ZodSymbol: ZodSymbol,
|
|
4299
|
-
ZodUndefined: ZodUndefined,
|
|
4300
|
-
ZodNull: ZodNull,
|
|
4301
|
-
ZodAny: ZodAny,
|
|
4302
|
-
ZodUnknown: ZodUnknown,
|
|
4303
|
-
ZodNever: ZodNever,
|
|
4304
|
-
ZodVoid: ZodVoid,
|
|
4305
|
-
ZodArray: ZodArray,
|
|
4306
|
-
ZodObject: ZodObject,
|
|
4307
|
-
ZodUnion: ZodUnion,
|
|
4308
|
-
ZodDiscriminatedUnion: ZodDiscriminatedUnion,
|
|
4309
|
-
ZodIntersection: ZodIntersection,
|
|
4310
|
-
ZodTuple: ZodTuple,
|
|
4311
|
-
ZodRecord: ZodRecord,
|
|
4312
|
-
ZodMap: ZodMap,
|
|
4313
|
-
ZodSet: ZodSet,
|
|
4314
|
-
ZodFunction: ZodFunction,
|
|
4315
|
-
ZodLazy: ZodLazy,
|
|
4316
|
-
ZodLiteral: ZodLiteral,
|
|
4317
|
-
ZodEnum: ZodEnum,
|
|
4318
|
-
ZodNativeEnum: ZodNativeEnum,
|
|
4319
|
-
ZodPromise: ZodPromise,
|
|
4320
|
-
ZodEffects: ZodEffects,
|
|
4321
|
-
ZodTransformer: ZodEffects,
|
|
4322
|
-
ZodOptional: ZodOptional,
|
|
4323
|
-
ZodNullable: ZodNullable,
|
|
4324
|
-
ZodDefault: ZodDefault,
|
|
4325
|
-
ZodCatch: ZodCatch,
|
|
4326
|
-
ZodNaN: ZodNaN,
|
|
4327
|
-
BRAND: BRAND,
|
|
4328
|
-
ZodBranded: ZodBranded,
|
|
4329
|
-
ZodPipeline: ZodPipeline,
|
|
4330
|
-
ZodReadonly: ZodReadonly,
|
|
4331
|
-
custom: custom,
|
|
4332
|
-
Schema: ZodType,
|
|
4333
|
-
ZodSchema: ZodType,
|
|
4334
|
-
late: late,
|
|
4335
|
-
get ZodFirstPartyTypeKind () { return ZodFirstPartyTypeKind; },
|
|
4336
|
-
coerce: coerce,
|
|
4337
|
-
any: anyType,
|
|
4338
|
-
array: arrayType,
|
|
4339
|
-
bigint: bigIntType,
|
|
4340
|
-
boolean: booleanType,
|
|
4341
|
-
date: dateType,
|
|
4342
|
-
discriminatedUnion: discriminatedUnionType,
|
|
4343
|
-
effect: effectsType,
|
|
4344
|
-
'enum': enumType,
|
|
4345
|
-
'function': functionType,
|
|
4346
|
-
'instanceof': instanceOfType,
|
|
4347
|
-
intersection: intersectionType,
|
|
4348
|
-
lazy: lazyType,
|
|
4349
|
-
literal: literalType,
|
|
4350
|
-
map: mapType,
|
|
4351
|
-
nan: nanType,
|
|
4352
|
-
nativeEnum: nativeEnumType,
|
|
4353
|
-
never: neverType,
|
|
4354
|
-
'null': nullType,
|
|
4355
|
-
nullable: nullableType,
|
|
4356
|
-
number: numberType,
|
|
4357
|
-
object: objectType,
|
|
4358
|
-
oboolean: oboolean,
|
|
4359
|
-
onumber: onumber,
|
|
4360
|
-
optional: optionalType,
|
|
4361
|
-
ostring: ostring,
|
|
4362
|
-
pipeline: pipelineType,
|
|
4363
|
-
preprocess: preprocessType,
|
|
4364
|
-
promise: promiseType,
|
|
4365
|
-
record: recordType,
|
|
4366
|
-
set: setType,
|
|
4367
|
-
strictObject: strictObjectType,
|
|
4368
|
-
string: stringType,
|
|
4369
|
-
symbol: symbolType,
|
|
4370
|
-
transformer: effectsType,
|
|
4371
|
-
tuple: tupleType,
|
|
4372
|
-
'undefined': undefinedType,
|
|
4373
|
-
union: unionType,
|
|
4374
|
-
unknown: unknownType,
|
|
4375
|
-
'void': voidType,
|
|
4376
|
-
NEVER: NEVER,
|
|
4377
|
-
ZodIssueCode: ZodIssueCode,
|
|
4378
|
-
quotelessJson: quotelessJson,
|
|
4379
|
-
ZodError: ZodError
|
|
4380
|
-
});
|
|
4381
|
-
|
|
4382
|
-
export { BRAND, DIRTY, EMPTY_PATH, INVALID, NEVER, OK, ParseStatus, ZodType as Schema, ZodAny, ZodArray, ZodBigInt, ZodBoolean, ZodBranded, ZodCatch, ZodDate, ZodDefault, ZodDiscriminatedUnion, ZodEffects, ZodEnum, ZodError, ZodFirstPartyTypeKind, ZodFunction, ZodIntersection, ZodIssueCode, ZodLazy, ZodLiteral, ZodMap, ZodNaN, ZodNativeEnum, ZodNever, ZodNull, ZodNullable, ZodNumber, ZodObject, ZodOptional, ZodParsedType, ZodPipeline, ZodPromise, ZodReadonly, ZodRecord, ZodType as ZodSchema, ZodSet, ZodString, ZodSymbol, ZodEffects as ZodTransformer, ZodTuple, ZodType, ZodUndefined, ZodUnion, ZodUnknown, ZodVoid, addIssueToContext, anyType as any, arrayType as array, bigIntType as bigint, booleanType as boolean, coerce, custom, dateType as date, datetimeRegex, z as default, errorMap as defaultErrorMap, discriminatedUnionType as discriminatedUnion, effectsType as effect, enumType as enum, functionType as function, getErrorMap, getParsedType, instanceOfType as instanceof, intersectionType as intersection, isAborted, isAsync, isDirty, isValid, late, lazyType as lazy, literalType as literal, makeIssue, mapType as map, nanType as nan, nativeEnumType as nativeEnum, neverType as never, nullType as null, nullableType as nullable, numberType as number, objectType as object, objectUtil, oboolean, onumber, optionalType as optional, ostring, pipelineType as pipeline, preprocessType as preprocess, promiseType as promise, quotelessJson, recordType as record, setType as set, setErrorMap, strictObjectType as strictObject, stringType as string, symbolType as symbol, effectsType as transformer, tupleType as tuple, undefinedType as undefined, unionType as union, unknownType as unknown, util, voidType as void, z };
|
|
3696
|
+
export { anyType as any, arrayType as array, bigIntType as bigint, booleanType as boolean, dateType as date, discriminatedUnionType as discriminatedUnion, effectsType as effect, enumType as enum, functionType as function, instanceOfType as instanceof, intersectionType as intersection, lazyType as lazy, literalType as literal, mapType as map, nanType as nan, nativeEnumType as nativeEnum, neverType as never, nullType as null, nullableType as nullable, numberType as number, objectType as object, oboolean, onumber, optionalType as optional, ostring, pipelineType as pipeline, preprocessType as preprocess, promiseType as promise, recordType as record, setType as set, strictObjectType as strictObject, stringType as string, symbolType as symbol, effectsType as transformer, tupleType as tuple, undefinedType as undefined, unionType as union, unknownType as unknown, voidType as void, };
|
|
3697
|
+
export const NEVER = INVALID;
|