@openclaw/firecrawl-plugin 2026.9.4 → 2026.9.6
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/assets/activity.svg +31 -0
- package/assets/icon.png +0 -0
- package/dist/{firecrawl-client-BPFpIblh.js → .setup/firecrawl-client-hBjAoE8s.mjs} +25 -26
- package/dist/{firecrawl-fetch-provider-CIpxLKLq.js → .setup/firecrawl-fetch-provider-DH8FdBjV.mjs} +1 -1
- package/dist/{firecrawl-search-provider-80szkO8A.js → .setup/firecrawl-search-provider-8H0Cu9l0.mjs} +1 -1
- package/dist/api.js +1 -1
- package/dist/index.js +3 -3
- package/dist/web-fetch-contract-api.js +1 -1
- package/dist/web-fetch-provider.js +1 -1
- package/dist/web-search-contract-api.js +1 -1
- package/dist/web-search-provider.js +1 -1
- package/node_modules/typebox/build/compile/validator.d.mts +1 -1
- package/node_modules/typebox/build/compile/validator.mjs +1 -1
- package/node_modules/typebox/build/format/idna/idn-hostname.mjs +7 -5
- package/node_modules/typebox/build/format/iri.mjs +5 -1
- package/node_modules/typebox/build/guard/emit.mjs +2 -4
- package/node_modules/typebox/build/guard/guard.mjs +6 -18
- package/node_modules/typebox/build/guard/string.mjs +16 -24
- package/node_modules/typebox/build/schema/build.mjs +2 -2
- package/node_modules/typebox/build/schema/check.mjs +1 -1
- package/node_modules/typebox/build/schema/compile.d.mts +3 -2
- package/node_modules/typebox/build/schema/compile.mjs +8 -8
- package/node_modules/typebox/build/schema/engine/_context.d.mts +6 -7
- package/node_modules/typebox/build/schema/engine/_context.mjs +23 -15
- package/node_modules/typebox/build/schema/engine/_functions.d.mts +2 -2
- package/node_modules/typebox/build/schema/engine/_functions.mjs +1 -1
- package/node_modules/typebox/build/schema/engine/_reducer.d.mts +3 -3
- package/node_modules/typebox/build/schema/engine/_refine.d.mts +5 -5
- package/node_modules/typebox/build/schema/engine/_refine.mjs +4 -7
- package/node_modules/typebox/build/schema/engine/_stack.d.mts +34 -16
- package/node_modules/typebox/build/schema/engine/_stack.mjs +148 -104
- package/node_modules/typebox/build/schema/engine/additionalItems.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/additionalProperties.d.mts +8 -8
- package/node_modules/typebox/build/schema/engine/additionalProperties.mjs +26 -18
- package/node_modules/typebox/build/schema/engine/allOf.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/allOf.mjs +3 -3
- package/node_modules/typebox/build/schema/engine/anyOf.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/anyOf.mjs +5 -10
- package/node_modules/typebox/build/schema/engine/boolean.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/boolean.mjs +2 -6
- package/node_modules/typebox/build/schema/engine/const.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/const.mjs +2 -6
- package/node_modules/typebox/build/schema/engine/contains.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/contains.mjs +2 -6
- package/node_modules/typebox/build/schema/engine/dependencies.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/dependencies.mjs +3 -6
- package/node_modules/typebox/build/schema/engine/dependentRequired.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/dependentRequired.mjs +2 -6
- package/node_modules/typebox/build/schema/engine/dependentSchemas.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/dynamicRef.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/dynamicRef.mjs +11 -7
- package/node_modules/typebox/build/schema/engine/enum.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/enum.mjs +2 -6
- package/node_modules/typebox/build/schema/engine/exclusiveMaximum.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/exclusiveMaximum.mjs +2 -6
- package/node_modules/typebox/build/schema/engine/exclusiveMinimum.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/exclusiveMinimum.mjs +2 -6
- package/node_modules/typebox/build/schema/engine/format.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/format.mjs +2 -6
- package/node_modules/typebox/build/schema/engine/if.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/if.mjs +7 -15
- package/node_modules/typebox/build/schema/engine/items.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/items.mjs +1 -1
- package/node_modules/typebox/build/schema/engine/maxContains.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/maxContains.mjs +2 -6
- package/node_modules/typebox/build/schema/engine/maxItems.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/maxItems.mjs +2 -6
- package/node_modules/typebox/build/schema/engine/maxLength.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/maxLength.mjs +2 -6
- package/node_modules/typebox/build/schema/engine/maxProperties.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/maxProperties.mjs +2 -6
- package/node_modules/typebox/build/schema/engine/maximum.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/maximum.mjs +2 -6
- package/node_modules/typebox/build/schema/engine/minContains.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/minContains.mjs +2 -6
- package/node_modules/typebox/build/schema/engine/minItems.d.mts +5 -5
- package/node_modules/typebox/build/schema/engine/minItems.mjs +2 -6
- package/node_modules/typebox/build/schema/engine/minLength.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/minLength.mjs +2 -6
- package/node_modules/typebox/build/schema/engine/minProperties.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/minProperties.mjs +2 -6
- package/node_modules/typebox/build/schema/engine/minimum.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/minimum.mjs +2 -6
- package/node_modules/typebox/build/schema/engine/multipleOf.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/multipleOf.mjs +2 -6
- package/node_modules/typebox/build/schema/engine/not.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/not.mjs +4 -8
- package/node_modules/typebox/build/schema/engine/oneOf.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/oneOf.mjs +6 -11
- package/node_modules/typebox/build/schema/engine/pattern.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/pattern.mjs +3 -7
- package/node_modules/typebox/build/schema/engine/patternProperties.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/patternProperties.mjs +1 -1
- package/node_modules/typebox/build/schema/engine/prefixItems.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/prefixItems.mjs +1 -1
- package/node_modules/typebox/build/schema/engine/properties.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/properties.mjs +1 -1
- package/node_modules/typebox/build/schema/engine/propertyNames.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/propertyNames.mjs +4 -10
- package/node_modules/typebox/build/schema/engine/recursiveRef.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/recursiveRef.mjs +11 -7
- package/node_modules/typebox/build/schema/engine/ref.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/ref.mjs +19 -15
- package/node_modules/typebox/build/schema/engine/required.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/required.mjs +2 -6
- package/node_modules/typebox/build/schema/engine/schema.d.mts +7 -7
- package/node_modules/typebox/build/schema/engine/schema.mjs +137 -133
- package/node_modules/typebox/build/schema/engine/type.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/type.mjs +2 -6
- package/node_modules/typebox/build/schema/engine/unevaluatedItems.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/unevaluatedItems.mjs +5 -9
- package/node_modules/typebox/build/schema/engine/unevaluatedProperties.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/unevaluatedProperties.mjs +5 -9
- package/node_modules/typebox/build/schema/engine/uniqueItems.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/uniqueItems.mjs +2 -6
- package/node_modules/typebox/build/schema/errors.d.mts +2 -2
- package/node_modules/typebox/build/schema/errors.mjs +8 -14
- package/node_modules/typebox/build/schema/intern/index.d.mts +1 -0
- package/node_modules/typebox/build/schema/intern/index.mjs +1 -0
- package/node_modules/typebox/build/schema/intern/intern.d.mts +11 -0
- package/node_modules/typebox/build/schema/intern/intern.mjs +293 -0
- package/node_modules/typebox/build/schema/meta/draft_2019_09.d.mts +2 -0
- package/node_modules/typebox/build/schema/meta/draft_2019_09.mjs +288 -0
- package/node_modules/typebox/build/schema/meta/draft_2020_12.d.mts +2 -0
- package/node_modules/typebox/build/schema/meta/draft_2020_12.mjs +300 -0
- package/node_modules/typebox/build/schema/meta/draft_3.d.mts +2 -0
- package/node_modules/typebox/build/schema/meta/draft_3.mjs +143 -0
- package/node_modules/typebox/build/schema/meta/draft_4.d.mts +2 -0
- package/node_modules/typebox/build/schema/meta/draft_4.mjs +149 -0
- package/node_modules/typebox/build/schema/meta/draft_6.d.mts +2 -0
- package/node_modules/typebox/build/schema/meta/draft_6.mjs +155 -0
- package/node_modules/typebox/build/schema/meta/draft_7.d.mts +2 -0
- package/node_modules/typebox/build/schema/meta/draft_7.mjs +172 -0
- package/node_modules/typebox/build/schema/meta/index.d.mts +2 -0
- package/node_modules/typebox/build/schema/meta/index.mjs +2 -0
- package/node_modules/typebox/build/schema/meta/meta.d.mts +9 -0
- package/node_modules/typebox/build/schema/meta/meta.mjs +15 -0
- package/node_modules/typebox/build/schema/meta/schema.d.mts +6 -0
- package/node_modules/typebox/build/schema/meta/schema.mjs +1 -0
- package/node_modules/typebox/build/schema/parse.d.mts +1 -0
- package/node_modules/typebox/build/schema/parse.mjs +10 -5
- package/node_modules/typebox/build/schema/resolve/resolve.d.mts +8 -3
- package/node_modules/typebox/build/schema/resolve/resolve.mjs +268 -139
- package/node_modules/typebox/build/schema/schema.d.mts +2 -0
- package/node_modules/typebox/build/schema/schema.mjs +2 -0
- package/node_modules/typebox/build/value/errors/errors.d.mts +2 -12
- package/node_modules/typebox/build/value/errors/errors.mjs +2 -7
- package/node_modules/typebox/package.json +1 -1
- package/node_modules/typebox/readme.md +59 -89
- package/node_modules/zod/README.md +29 -2
- package/node_modules/zod/compile.cjs +96 -0
- package/node_modules/zod/compile.d.cts +1 -0
- package/node_modules/zod/compile.d.ts +1 -0
- package/node_modules/zod/compile.js +52 -0
- package/node_modules/zod/index.cjs +21 -2
- package/node_modules/zod/index.d.cts +1 -2
- package/node_modules/zod/index.d.ts +1 -2
- package/node_modules/zod/index.js +5 -2
- package/node_modules/zod/locales/index.cjs +19 -0
- package/node_modules/zod/mini/index.cjs +19 -0
- package/node_modules/zod/package.json +20 -8
- package/node_modules/zod/src/compile.ts +56 -0
- package/node_modules/zod/src/index.ts +5 -2
- package/node_modules/zod/src/v3/ZodError.ts +22 -12
- package/node_modules/zod/src/v3/helpers/errorUtil.ts +1 -1
- package/node_modules/zod/src/v3/tests/error.test.ts +35 -0
- package/node_modules/zod/src/v3/tests/intersection.test.ts +18 -0
- package/node_modules/zod/src/v3/tests/language-server.test.ts +1 -2
- package/node_modules/zod/src/v3/tests/object.test.ts +3 -6
- package/node_modules/zod/src/v3/tests/readonly.test.ts +0 -80
- package/node_modules/zod/src/v3/tests/string.test.ts +6 -0
- package/node_modules/zod/src/v3/types.ts +5 -5
- package/node_modules/zod/src/v4/classic/checks.ts +1 -0
- package/node_modules/zod/src/v4/classic/compat.ts +26 -18
- package/node_modules/zod/src/v4/classic/deep-partial.ts +76 -0
- package/node_modules/zod/src/v4/classic/errors.ts +59 -44
- package/node_modules/zod/src/v4/classic/external.ts +14 -9
- package/node_modules/zod/src/v4/classic/from-json-schema.ts +363 -78
- package/node_modules/zod/src/v4/classic/in-out.ts +45 -0
- package/node_modules/zod/src/v4/classic/index.ts +2 -2
- package/node_modules/zod/src/v4/classic/iso.ts +2 -72
- package/node_modules/zod/src/v4/classic/parse.ts +10 -4
- package/node_modules/zod/src/v4/classic/schemas.ts +640 -375
- package/node_modules/zod/src/v4/classic/tests/apply.test.ts +27 -0
- package/node_modules/zod/src/v4/classic/tests/array.test.ts +2 -2
- package/node_modules/zod/src/v4/classic/tests/assignability.test.ts +186 -0
- package/node_modules/zod/src/v4/classic/tests/bigint.test.ts +36 -1
- package/node_modules/zod/src/v4/classic/tests/catch.test.ts +278 -0
- package/node_modules/zod/src/v4/classic/tests/codec-examples.test.ts +1 -2
- package/node_modules/zod/src/v4/classic/tests/codec.test.ts +2 -1
- package/node_modules/zod/src/v4/classic/tests/continuability.test.ts +3 -3
- package/node_modules/zod/src/v4/classic/tests/credit-card.test.ts +76 -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 +30 -0
- package/node_modules/zod/src/v4/classic/tests/datetime.test.ts +32 -18
- 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 +46 -0
- package/node_modules/zod/src/v4/classic/tests/detached-methods.test.ts +31 -7
- package/node_modules/zod/src/v4/classic/tests/discriminated-unions.test.ts +261 -13
- package/node_modules/zod/src/v4/classic/tests/enum.test.ts +20 -0
- package/node_modules/zod/src/v4/classic/tests/error-utils.test.ts +112 -2
- package/node_modules/zod/src/v4/classic/tests/error.test.ts +403 -6
- package/node_modules/zod/src/v4/classic/tests/from-json-schema.test.ts +582 -10
- package/node_modules/zod/src/v4/classic/tests/function.test.ts +31 -0
- package/node_modules/zod/src/v4/classic/tests/global-config.test.ts +2 -9
- package/node_modules/zod/src/v4/classic/tests/hash.test.ts +1 -2
- 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 +21 -2
- 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 +67 -0
- package/node_modules/zod/src/v4/classic/tests/intersection.test.ts +136 -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 +3 -10
- package/node_modules/zod/src/v4/classic/tests/lazy.test.ts +36 -1
- package/node_modules/zod/src/v4/classic/tests/literal.test.ts +12 -1
- package/node_modules/zod/src/v4/classic/tests/map.test.ts +12 -0
- package/node_modules/zod/src/v4/classic/tests/number.test.ts +85 -9
- package/node_modules/zod/src/v4/classic/tests/object.test.ts +301 -12
- 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 +49 -16
- package/node_modules/zod/src/v4/classic/tests/partial.test.ts +51 -4
- package/node_modules/zod/src/v4/classic/tests/prefault.test.ts +70 -0
- package/node_modules/zod/src/v4/classic/tests/preprocess-types.test.ts +20 -2
- package/node_modules/zod/src/v4/classic/tests/properties.test.ts +141 -0
- package/node_modules/zod/src/v4/classic/tests/readonly.test.ts +0 -68
- package/node_modules/zod/src/v4/classic/tests/record.test.ts +186 -18
- package/node_modules/zod/src/v4/classic/tests/recursive-types.test.ts +79 -3
- package/node_modules/zod/src/v4/classic/tests/redos.test.ts +68 -0
- package/node_modules/zod/src/v4/classic/tests/refine.test.ts +60 -0
- package/node_modules/zod/src/v4/classic/tests/set.test.ts +9 -0
- package/node_modules/zod/src/v4/classic/tests/standard-schema.test.ts +19 -0
- package/node_modules/zod/src/v4/classic/tests/string.test.ts +222 -6
- package/node_modules/zod/src/v4/classic/tests/stringbool.test.ts +18 -0
- package/node_modules/zod/src/v4/classic/tests/template-literal.test.ts +44 -3
- package/node_modules/zod/src/v4/classic/tests/to-json-schema.test.ts +1812 -204
- package/node_modules/zod/src/v4/classic/tests/tuple.test.ts +45 -30
- package/node_modules/zod/src/v4/classic/tests/union.test.ts +39 -2
- package/node_modules/zod/src/v4/classic/tests/validate.test.ts +645 -0
- package/node_modules/zod/src/v4/classic/tests/validations.test.ts +2 -2
- package/node_modules/zod/src/v4/core/api.ts +87 -35
- package/node_modules/zod/src/v4/core/checks.ts +119 -146
- package/node_modules/zod/src/v4/core/compile.ts +2313 -0
- package/node_modules/zod/src/v4/core/core.ts +99 -22
- package/node_modules/zod/src/v4/core/doc.ts +17 -9
- package/node_modules/zod/src/v4/core/errors.ts +113 -25
- package/node_modules/zod/src/v4/core/index.ts +3 -0
- package/node_modules/zod/src/v4/core/json-schema-generator.ts +8 -3
- package/node_modules/zod/src/v4/core/json-schema-processors.ts +424 -156
- package/node_modules/zod/src/v4/core/json-schema.ts +2 -1
- package/node_modules/zod/src/v4/core/memoizer.ts +331 -0
- package/node_modules/zod/src/v4/core/parse.ts +164 -50
- package/node_modules/zod/src/v4/core/regexes.ts +42 -15
- package/node_modules/zod/src/v4/core/registries.ts +2 -2
- package/node_modules/zod/src/v4/core/schemas.ts +1000 -538
- 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/locales/el.test.ts +1 -2
- package/node_modules/zod/src/v4/core/tests/locales/es.test.ts +1 -2
- package/node_modules/zod/src/v4/core/tests/locales/fr.test.ts +3 -3
- package/node_modules/zod/src/v4/core/tests/locales/parity.test.ts +42 -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/polyfill-collision.test.ts +46 -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 +283 -48
- package/node_modules/zod/src/v4/core/util.ts +454 -157
- package/node_modules/zod/src/v4/core/versions.ts +2 -2
- package/node_modules/zod/src/v4/core/visit.ts +193 -0
- package/node_modules/zod/src/v4/index.ts +3 -3
- package/node_modules/zod/src/v4/locales/ar.ts +5 -0
- package/node_modules/zod/src/v4/locales/az.ts +5 -0
- package/node_modules/zod/src/v4/locales/be.ts +12 -0
- package/node_modules/zod/src/v4/locales/bg.ts +5 -0
- package/node_modules/zod/src/v4/locales/bn.ts +123 -0
- package/node_modules/zod/src/v4/locales/ca.ts +5 -0
- package/node_modules/zod/src/v4/locales/ckb.ts +140 -0
- package/node_modules/zod/src/v4/locales/cs.ts +5 -0
- package/node_modules/zod/src/v4/locales/da.ts +7 -2
- package/node_modules/zod/src/v4/locales/de.ts +5 -0
- package/node_modules/zod/src/v4/locales/el.ts +3 -0
- package/node_modules/zod/src/v4/locales/en.ts +17 -4
- package/node_modules/zod/src/v4/locales/eo.ts +5 -0
- package/node_modules/zod/src/v4/locales/es.ts +4 -0
- package/node_modules/zod/src/v4/locales/fa.ts +5 -0
- package/node_modules/zod/src/v4/locales/fi.ts +5 -0
- package/node_modules/zod/src/v4/locales/fr-CA.ts +5 -0
- package/node_modules/zod/src/v4/locales/fr.ts +21 -14
- package/node_modules/zod/src/v4/locales/gu.ts +123 -0
- package/node_modules/zod/src/v4/locales/he.ts +8 -1
- package/node_modules/zod/src/v4/locales/hi.ts +126 -0
- package/node_modules/zod/src/v4/locales/hr.ts +4 -0
- package/node_modules/zod/src/v4/locales/hu.ts +5 -0
- package/node_modules/zod/src/v4/locales/hy.ts +11 -0
- package/node_modules/zod/src/v4/locales/id.ts +5 -0
- package/node_modules/zod/src/v4/locales/index.ts +11 -0
- package/node_modules/zod/src/v4/locales/is.ts +5 -0
- package/node_modules/zod/src/v4/locales/it.ts +5 -0
- package/node_modules/zod/src/v4/locales/ja.ts +5 -0
- package/node_modules/zod/src/v4/locales/ka.ts +5 -0
- package/node_modules/zod/src/v4/locales/km.ts +5 -0
- package/node_modules/zod/src/v4/locales/kn.ts +126 -0
- package/node_modules/zod/src/v4/locales/ko.ts +5 -0
- package/node_modules/zod/src/v4/locales/lt.ts +4 -0
- package/node_modules/zod/src/v4/locales/mk.ts +5 -0
- package/node_modules/zod/src/v4/locales/ms.ts +5 -0
- package/node_modules/zod/src/v4/locales/ne.ts +128 -0
- package/node_modules/zod/src/v4/locales/nl.ts +5 -0
- package/node_modules/zod/src/v4/locales/nn.ts +121 -0
- package/node_modules/zod/src/v4/locales/no.ts +7 -2
- package/node_modules/zod/src/v4/locales/ota.ts +5 -0
- package/node_modules/zod/src/v4/locales/pl.ts +5 -0
- package/node_modules/zod/src/v4/locales/ps.ts +5 -0
- package/node_modules/zod/src/v4/locales/pt-BR.ts +161 -0
- package/node_modules/zod/src/v4/locales/pt.ts +101 -58
- package/node_modules/zod/src/v4/locales/ro.ts +3 -0
- package/node_modules/zod/src/v4/locales/ru.ts +12 -0
- package/node_modules/zod/src/v4/locales/sk.ts +123 -0
- package/node_modules/zod/src/v4/locales/sl.ts +5 -0
- package/node_modules/zod/src/v4/locales/sv.ts +7 -2
- package/node_modules/zod/src/v4/locales/ta.ts +5 -0
- package/node_modules/zod/src/v4/locales/tg.ts +135 -0
- package/node_modules/zod/src/v4/locales/th.ts +5 -0
- package/node_modules/zod/src/v4/locales/tk.ts +113 -0
- package/node_modules/zod/src/v4/locales/tr.ts +5 -0
- package/node_modules/zod/src/v4/locales/uk.ts +5 -0
- package/node_modules/zod/src/v4/locales/ur.ts +5 -0
- package/node_modules/zod/src/v4/locales/uz.ts +3 -0
- package/node_modules/zod/src/v4/locales/vi.ts +5 -0
- package/node_modules/zod/src/v4/locales/yo.ts +5 -0
- package/node_modules/zod/src/v4/locales/zh-CN.ts +5 -0
- package/node_modules/zod/src/v4/locales/zh-TW.ts +5 -0
- package/node_modules/zod/src/v4/mini/checks.ts +1 -0
- package/node_modules/zod/src/v4/mini/deep-partial.ts +73 -0
- package/node_modules/zod/src/v4/mini/external.ts +12 -1
- package/node_modules/zod/src/v4/mini/in-out.ts +45 -0
- package/node_modules/zod/src/v4/mini/parse.ts +2 -0
- package/node_modules/zod/src/v4/mini/schemas.ts +167 -63
- package/node_modules/zod/src/v4/mini/tests/apply.test.ts +33 -0
- package/node_modules/zod/src/v4/mini/tests/assignability.test.ts +62 -1
- package/node_modules/zod/src/v4/mini/tests/checks.test.ts +14 -0
- package/node_modules/zod/src/v4/mini/tests/codec.test.ts +35 -1
- package/node_modules/zod/src/v4/mini/tests/computed.test.ts +11 -17
- 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 +23 -4
- package/node_modules/zod/src/v4/mini/tests/functions.test.ts +9 -0
- package/node_modules/zod/src/v4/mini/tests/index.test.ts +158 -5
- package/node_modules/zod/src/v4/mini/tests/number.test.ts +14 -0
- package/node_modules/zod/src/v4/mini/tests/object.test.ts +65 -0
- package/node_modules/zod/src/v4/mini/tests/recursive-types.test.ts +16 -0
- package/node_modules/zod/src/v4/mini/tests/string.test.ts +44 -0
- package/node_modules/zod/v3/ZodError.cjs +41 -12
- package/node_modules/zod/v3/ZodError.d.cts +1 -1
- package/node_modules/zod/v3/ZodError.d.ts +1 -1
- package/node_modules/zod/v3/ZodError.js +22 -12
- package/node_modules/zod/v3/errors.cjs +19 -0
- package/node_modules/zod/v3/external.cjs +19 -0
- package/node_modules/zod/v3/helpers/enumUtil.cjs +19 -0
- package/node_modules/zod/v3/helpers/errorUtil.cjs +20 -1
- package/node_modules/zod/v3/helpers/errorUtil.js +1 -1
- package/node_modules/zod/v3/helpers/parseUtil.cjs +19 -0
- package/node_modules/zod/v3/helpers/partialUtil.cjs +19 -0
- package/node_modules/zod/v3/helpers/typeAliases.cjs +19 -0
- package/node_modules/zod/v3/helpers/util.cjs +19 -0
- package/node_modules/zod/v3/index.cjs +19 -0
- package/node_modules/zod/v3/standard-schema.cjs +19 -0
- package/node_modules/zod/v3/types.cjs +26 -5
- package/node_modules/zod/v3/types.js +7 -5
- package/node_modules/zod/v4/classic/checks.cjs +21 -1
- package/node_modules/zod/v4/classic/checks.d.cts +1 -1
- package/node_modules/zod/v4/classic/checks.d.ts +1 -1
- package/node_modules/zod/v4/classic/checks.js +1 -1
- package/node_modules/zod/v4/classic/coerce.cjs +19 -0
- package/node_modules/zod/v4/classic/compat.cjs +19 -0
- package/node_modules/zod/v4/classic/compat.d.cts +9 -11
- package/node_modules/zod/v4/classic/compat.d.ts +9 -11
- 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 +62 -34
- package/node_modules/zod/v4/classic/errors.d.cts +3 -4
- package/node_modules/zod/v4/classic/errors.d.ts +3 -4
- package/node_modules/zod/v4/classic/errors.js +43 -34
- package/node_modules/zod/v4/classic/external.cjs +51 -27
- package/node_modules/zod/v4/classic/external.d.cts +5 -2
- package/node_modules/zod/v4/classic/external.d.ts +5 -2
- package/node_modules/zod/v4/classic/external.js +5 -8
- package/node_modules/zod/v4/classic/from-json-schema.cjs +376 -75
- package/node_modules/zod/v4/classic/from-json-schema.js +357 -75
- 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 +21 -2
- package/node_modules/zod/v4/classic/index.d.cts +1 -2
- package/node_modules/zod/v4/classic/index.d.ts +1 -2
- package/node_modules/zod/v4/classic/index.js +2 -2
- package/node_modules/zod/v4/classic/iso.cjs +30 -22
- package/node_modules/zod/v4/classic/iso.d.cts +2 -17
- package/node_modules/zod/v4/classic/iso.d.ts +2 -17
- package/node_modules/zod/v4/classic/iso.js +2 -17
- package/node_modules/zod/v4/classic/parse.cjs +23 -1
- package/node_modules/zod/v4/classic/parse.d.cts +17 -4
- package/node_modules/zod/v4/classic/parse.d.ts +17 -4
- package/node_modules/zod/v4/classic/parse.js +1 -0
- package/node_modules/zod/v4/classic/schemas.cjs +591 -426
- package/node_modules/zod/v4/classic/schemas.d.cts +68 -19
- package/node_modules/zod/v4/classic/schemas.d.ts +68 -19
- package/node_modules/zod/v4/classic/schemas.js +564 -424
- package/node_modules/zod/v4/core/api.cjs +66 -24
- package/node_modules/zod/v4/core/api.d.cts +22 -12
- package/node_modules/zod/v4/core/api.d.ts +22 -12
- package/node_modules/zod/v4/core/api.js +44 -24
- package/node_modules/zod/v4/core/checks.cjs +88 -128
- package/node_modules/zod/v4/core/checks.d.cts +29 -13
- package/node_modules/zod/v4/core/checks.d.ts +29 -13
- package/node_modules/zod/v4/core/checks.js +68 -127
- package/node_modules/zod/v4/core/compile.cjs +1908 -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 +1858 -0
- package/node_modules/zod/v4/core/core.cjs +101 -19
- package/node_modules/zod/v4/core/core.d.cts +16 -4
- package/node_modules/zod/v4/core/core.d.ts +16 -4
- package/node_modules/zod/v4/core/core.js +83 -20
- package/node_modules/zod/v4/core/doc.cjs +31 -9
- package/node_modules/zod/v4/core/doc.d.cts +3 -1
- package/node_modules/zod/v4/core/doc.d.ts +3 -1
- package/node_modules/zod/v4/core/doc.js +12 -9
- package/node_modules/zod/v4/core/errors.cjs +126 -25
- package/node_modules/zod/v4/core/errors.d.cts +4 -0
- package/node_modules/zod/v4/core/errors.d.ts +4 -0
- package/node_modules/zod/v4/core/errors.js +107 -25
- package/node_modules/zod/v4/core/index.cjs +24 -1
- package/node_modules/zod/v4/core/index.d.cts +3 -0
- package/node_modules/zod/v4/core/index.d.ts +3 -0
- package/node_modules/zod/v4/core/index.js +3 -0
- package/node_modules/zod/v4/core/json-schema-generator.cjs +24 -1
- package/node_modules/zod/v4/core/json-schema-generator.d.cts +2 -2
- package/node_modules/zod/v4/core/json-schema-generator.d.ts +2 -2
- package/node_modules/zod/v4/core/json-schema-generator.js +6 -2
- package/node_modules/zod/v4/core/json-schema-processors.cjs +441 -156
- package/node_modules/zod/v4/core/json-schema-processors.d.cts +16 -0
- package/node_modules/zod/v4/core/json-schema-processors.d.ts +16 -0
- package/node_modules/zod/v4/core/json-schema-processors.js +400 -158
- package/node_modules/zod/v4/core/json-schema.cjs +19 -0
- package/node_modules/zod/v4/core/json-schema.d.cts +2 -1
- package/node_modules/zod/v4/core/json-schema.d.ts +2 -1
- 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/parse.cjs +148 -46
- package/node_modules/zod/v4/core/parse.d.cts +14 -11
- package/node_modules/zod/v4/core/parse.d.ts +14 -11
- package/node_modules/zod/v4/core/parse.js +127 -45
- package/node_modules/zod/v4/core/regexes.cjs +54 -17
- package/node_modules/zod/v4/core/regexes.d.cts +5 -0
- package/node_modules/zod/v4/core/regexes.d.ts +5 -0
- package/node_modules/zod/v4/core/regexes.js +32 -15
- package/node_modules/zod/v4/core/registries.cjs +19 -0
- package/node_modules/zod/v4/core/registries.js +2 -2
- package/node_modules/zod/v4/core/schemas.cjs +785 -386
- package/node_modules/zod/v4/core/schemas.d.cts +123 -34
- package/node_modules/zod/v4/core/schemas.d.ts +123 -34
- package/node_modules/zod/v4/core/schemas.js +753 -386
- package/node_modules/zod/v4/core/standard-schema.cjs +19 -0
- package/node_modules/zod/v4/core/to-json-schema.cjs +269 -45
- package/node_modules/zod/v4/core/to-json-schema.d.cts +45 -5
- package/node_modules/zod/v4/core/to-json-schema.d.ts +45 -5
- package/node_modules/zod/v4/core/to-json-schema.js +247 -44
- package/node_modules/zod/v4/core/util.cjs +372 -157
- package/node_modules/zod/v4/core/util.d.cts +79 -1
- package/node_modules/zod/v4/core/util.d.ts +79 -1
- package/node_modules/zod/v4/core/util.js +341 -156
- package/node_modules/zod/v4/core/versions.cjs +21 -2
- package/node_modules/zod/v4/core/versions.d.cts +1 -1
- package/node_modules/zod/v4/core/versions.d.ts +1 -1
- package/node_modules/zod/v4/core/versions.js +2 -2
- 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 +34 -5
- package/node_modules/zod/v4/index.d.cts +2 -2
- package/node_modules/zod/v4/index.d.ts +2 -2
- package/node_modules/zod/v4/index.js +3 -2
- package/node_modules/zod/v4/locales/ar.cjs +5 -0
- package/node_modules/zod/v4/locales/ar.js +5 -0
- package/node_modules/zod/v4/locales/az.cjs +5 -0
- package/node_modules/zod/v4/locales/az.js +5 -0
- package/node_modules/zod/v4/locales/be.cjs +12 -0
- package/node_modules/zod/v4/locales/be.js +12 -0
- package/node_modules/zod/v4/locales/bg.cjs +5 -0
- package/node_modules/zod/v4/locales/bg.js +5 -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 +5 -0
- package/node_modules/zod/v4/locales/ca.js +5 -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 +5 -0
- package/node_modules/zod/v4/locales/cs.js +5 -0
- package/node_modules/zod/v4/locales/da.cjs +7 -2
- package/node_modules/zod/v4/locales/da.js +7 -2
- package/node_modules/zod/v4/locales/de.cjs +5 -0
- package/node_modules/zod/v4/locales/de.js +5 -0
- package/node_modules/zod/v4/locales/el.cjs +3 -0
- package/node_modules/zod/v4/locales/el.js +3 -0
- package/node_modules/zod/v4/locales/en.cjs +16 -4
- package/node_modules/zod/v4/locales/en.js +16 -4
- package/node_modules/zod/v4/locales/eo.cjs +5 -0
- package/node_modules/zod/v4/locales/eo.js +5 -0
- package/node_modules/zod/v4/locales/es.cjs +4 -0
- package/node_modules/zod/v4/locales/es.js +4 -0
- package/node_modules/zod/v4/locales/fa.cjs +5 -0
- package/node_modules/zod/v4/locales/fa.js +5 -0
- package/node_modules/zod/v4/locales/fi.cjs +5 -0
- package/node_modules/zod/v4/locales/fi.js +5 -0
- package/node_modules/zod/v4/locales/fr-CA.cjs +5 -0
- package/node_modules/zod/v4/locales/fr-CA.js +5 -0
- package/node_modules/zod/v4/locales/fr.cjs +18 -14
- package/node_modules/zod/v4/locales/fr.js +18 -14
- 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 +7 -0
- package/node_modules/zod/v4/locales/he.js +7 -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 +4 -0
- package/node_modules/zod/v4/locales/hr.js +4 -0
- package/node_modules/zod/v4/locales/hu.cjs +5 -0
- package/node_modules/zod/v4/locales/hu.js +5 -0
- package/node_modules/zod/v4/locales/hy.cjs +11 -0
- package/node_modules/zod/v4/locales/hy.js +11 -0
- package/node_modules/zod/v4/locales/id.cjs +5 -0
- package/node_modules/zod/v4/locales/id.js +5 -0
- package/node_modules/zod/v4/locales/index.cjs +43 -2
- package/node_modules/zod/v4/locales/index.d.cts +11 -0
- package/node_modules/zod/v4/locales/index.d.ts +11 -0
- package/node_modules/zod/v4/locales/index.js +11 -0
- package/node_modules/zod/v4/locales/is.cjs +5 -0
- package/node_modules/zod/v4/locales/is.js +5 -0
- package/node_modules/zod/v4/locales/it.cjs +5 -0
- package/node_modules/zod/v4/locales/it.js +5 -0
- package/node_modules/zod/v4/locales/ja.cjs +5 -0
- package/node_modules/zod/v4/locales/ja.js +5 -0
- package/node_modules/zod/v4/locales/ka.cjs +5 -0
- package/node_modules/zod/v4/locales/ka.js +5 -0
- package/node_modules/zod/v4/locales/km.cjs +5 -0
- package/node_modules/zod/v4/locales/km.js +5 -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 +5 -0
- package/node_modules/zod/v4/locales/ko.js +5 -0
- package/node_modules/zod/v4/locales/lt.cjs +4 -0
- package/node_modules/zod/v4/locales/lt.js +4 -0
- package/node_modules/zod/v4/locales/mk.cjs +5 -0
- package/node_modules/zod/v4/locales/mk.js +5 -0
- package/node_modules/zod/v4/locales/ms.cjs +5 -0
- package/node_modules/zod/v4/locales/ms.js +5 -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 +5 -0
- package/node_modules/zod/v4/locales/nl.js +5 -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 +7 -2
- package/node_modules/zod/v4/locales/no.js +7 -2
- package/node_modules/zod/v4/locales/ota.cjs +5 -0
- package/node_modules/zod/v4/locales/ota.js +5 -0
- package/node_modules/zod/v4/locales/pl.cjs +5 -0
- package/node_modules/zod/v4/locales/pl.js +5 -0
- package/node_modules/zod/v4/locales/ps.cjs +5 -0
- package/node_modules/zod/v4/locales/ps.js +5 -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 +89 -55
- package/node_modules/zod/v4/locales/pt.js +89 -55
- package/node_modules/zod/v4/locales/ro.cjs +3 -0
- package/node_modules/zod/v4/locales/ro.js +3 -0
- package/node_modules/zod/v4/locales/ru.cjs +12 -0
- package/node_modules/zod/v4/locales/ru.js +12 -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 +5 -0
- package/node_modules/zod/v4/locales/sl.js +5 -0
- package/node_modules/zod/v4/locales/sv.cjs +7 -2
- package/node_modules/zod/v4/locales/sv.js +7 -2
- package/node_modules/zod/v4/locales/ta.cjs +5 -0
- package/node_modules/zod/v4/locales/ta.js +5 -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 +5 -0
- package/node_modules/zod/v4/locales/th.js +5 -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 +5 -0
- package/node_modules/zod/v4/locales/tr.js +5 -0
- package/node_modules/zod/v4/locales/uk.cjs +5 -0
- package/node_modules/zod/v4/locales/uk.js +5 -0
- package/node_modules/zod/v4/locales/ur.cjs +5 -0
- package/node_modules/zod/v4/locales/ur.js +5 -0
- package/node_modules/zod/v4/locales/uz.cjs +3 -0
- package/node_modules/zod/v4/locales/uz.js +3 -0
- package/node_modules/zod/v4/locales/vi.cjs +5 -0
- package/node_modules/zod/v4/locales/vi.js +5 -0
- package/node_modules/zod/v4/locales/yo.cjs +5 -0
- package/node_modules/zod/v4/locales/yo.js +5 -0
- package/node_modules/zod/v4/locales/zh-CN.cjs +5 -0
- package/node_modules/zod/v4/locales/zh-CN.js +5 -0
- package/node_modules/zod/v4/locales/zh-TW.cjs +5 -0
- package/node_modules/zod/v4/locales/zh-TW.js +5 -0
- package/node_modules/zod/v4/mini/checks.cjs +21 -1
- package/node_modules/zod/v4/mini/checks.d.cts +1 -1
- package/node_modules/zod/v4/mini/checks.d.ts +1 -1
- package/node_modules/zod/v4/mini/checks.js +1 -1
- package/node_modules/zod/v4/mini/coerce.cjs +19 -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 +33 -1
- package/node_modules/zod/v4/mini/external.d.cts +5 -2
- package/node_modules/zod/v4/mini/external.d.ts +5 -2
- package/node_modules/zod/v4/mini/external.js +3 -1
- 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 +19 -0
- package/node_modules/zod/v4/mini/iso.cjs +19 -0
- package/node_modules/zod/v4/mini/parse.cjs +22 -1
- package/node_modules/zod/v4/mini/parse.d.cts +1 -1
- package/node_modules/zod/v4/mini/parse.d.ts +1 -1
- package/node_modules/zod/v4/mini/parse.js +1 -1
- package/node_modules/zod/v4/mini/schemas.cjs +117 -53
- package/node_modules/zod/v4/mini/schemas.d.cts +49 -14
- package/node_modules/zod/v4/mini/schemas.d.ts +49 -14
- package/node_modules/zod/v4/mini/schemas.js +92 -51
- package/node_modules/zod/v4-mini/index.cjs +19 -0
- package/openclaw.plugin.json +15 -1
- package/package.json +9 -7
- package/node_modules/zod/src/v4/core/config.ts +0 -15
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as checks from "./checks.js";
|
|
2
2
|
import * as core from "./core.js";
|
|
3
3
|
import { Doc } from "./doc.js";
|
|
4
|
-
import { parse, parseAsync
|
|
4
|
+
import { parse, parseAsync } from "./parse.js";
|
|
5
5
|
import * as regexes from "./regexes.js";
|
|
6
6
|
import * as util from "./util.js";
|
|
7
7
|
import { version } from "./versions.js";
|
|
@@ -11,19 +11,20 @@ export const $ZodType = /*@__PURE__*/ core.$constructor("$ZodType", (inst, def)
|
|
|
11
11
|
inst._zod.def = def; // set _def property
|
|
12
12
|
inst._zod.bag = inst._zod.bag || {}; // initialize _bag object
|
|
13
13
|
inst._zod.version = version;
|
|
14
|
-
const
|
|
14
|
+
const defChecks = inst._zod.def.checks;
|
|
15
15
|
// if inst is itself a checks.$ZodCheck, run it as a check
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
const checks = inst._zod.traits.has("$ZodCheck")
|
|
17
|
+
? [inst, ...(defChecks ?? [])]
|
|
18
|
+
: defChecks?.length
|
|
19
|
+
? [...defChecks]
|
|
20
|
+
: [];
|
|
19
21
|
for (const ch of checks) {
|
|
20
22
|
for (const fn of ch._zod.onattach) {
|
|
21
23
|
fn(inst);
|
|
22
24
|
}
|
|
23
25
|
}
|
|
24
26
|
if (checks.length === 0) {
|
|
25
|
-
// deferred initializer
|
|
26
|
-
// inst._zod.parse is not yet defined
|
|
27
|
+
// deferred initializer inst._zod.parse is not yet defined
|
|
27
28
|
(_a = inst._zod).deferred ?? (_a.deferred = []);
|
|
28
29
|
inst._zod.deferred?.push(() => {
|
|
29
30
|
inst._zod.run = inst._zod.parse;
|
|
@@ -31,6 +32,8 @@ export const $ZodType = /*@__PURE__*/ core.$constructor("$ZodType", (inst, def)
|
|
|
31
32
|
}
|
|
32
33
|
else {
|
|
33
34
|
const runChecks = (payload, checks, ctx) => {
|
|
35
|
+
if (payload.memo)
|
|
36
|
+
return payload;
|
|
34
37
|
let isAborted = util.aborted(payload);
|
|
35
38
|
let asyncResult;
|
|
36
39
|
for (const ch of checks) {
|
|
@@ -55,6 +58,7 @@ export const $ZodType = /*@__PURE__*/ core.$constructor("$ZodType", (inst, def)
|
|
|
55
58
|
const nextLen = payload.issues.length;
|
|
56
59
|
if (nextLen === currLen)
|
|
57
60
|
return;
|
|
61
|
+
util.attachSchema(payload.issues, currLen, inst);
|
|
58
62
|
if (!isAborted)
|
|
59
63
|
isAborted = util.aborted(payload, currLen);
|
|
60
64
|
});
|
|
@@ -63,6 +67,7 @@ export const $ZodType = /*@__PURE__*/ core.$constructor("$ZodType", (inst, def)
|
|
|
63
67
|
const nextLen = payload.issues.length;
|
|
64
68
|
if (nextLen === currLen)
|
|
65
69
|
continue;
|
|
70
|
+
util.attachSchema(payload.issues, currLen, inst);
|
|
66
71
|
if (!isAborted)
|
|
67
72
|
isAborted = util.aborted(payload, currLen);
|
|
68
73
|
}
|
|
@@ -94,8 +99,7 @@ export const $ZodType = /*@__PURE__*/ core.$constructor("$ZodType", (inst, def)
|
|
|
94
99
|
return inst._zod.parse(payload, ctx);
|
|
95
100
|
}
|
|
96
101
|
if (ctx.direction === "backward") {
|
|
97
|
-
// run canary
|
|
98
|
-
// initial pass (no checks)
|
|
102
|
+
// run canary initial pass (no checks)
|
|
99
103
|
const canary = inst._zod.parse({ value: payload.value, issues: [] }, { ...ctx, skipChecks: true });
|
|
100
104
|
if (canary instanceof Promise) {
|
|
101
105
|
return canary.then((canary) => {
|
|
@@ -114,25 +118,44 @@ export const $ZodType = /*@__PURE__*/ core.$constructor("$ZodType", (inst, def)
|
|
|
114
118
|
return runChecks(result, checks, ctx);
|
|
115
119
|
};
|
|
116
120
|
}
|
|
117
|
-
|
|
118
|
-
|
|
121
|
+
}, {
|
|
122
|
+
// Wrappers extend this by installing a richer factory over it; reading it eagerly would defeat the laziness.
|
|
123
|
+
get "~standard"() {
|
|
124
|
+
return util.hide(this, "~standard", standardProps(this));
|
|
125
|
+
},
|
|
126
|
+
set "~standard"(value) {
|
|
127
|
+
util.own(this, "~standard", value);
|
|
128
|
+
},
|
|
129
|
+
});
|
|
130
|
+
/** The Standard Schema surface for `inst`. Shared so wrappers can extend it without forcing it. */
|
|
131
|
+
// a Standard Schema result only reports issues, so a failure finalizes them straight off the raw payload: no ZodError, and no lazy result to read through
|
|
132
|
+
const toStandardResult = (r, ctx) => r.issues.length ? { issues: r.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config())) } : { value: r.value };
|
|
133
|
+
async function validateAsync(inst, value) {
|
|
134
|
+
const ctx = { async: true };
|
|
135
|
+
return toStandardResult((await inst._zod.run({ value, issues: [] }, ctx)), ctx);
|
|
136
|
+
}
|
|
137
|
+
export function standardProps(inst) {
|
|
138
|
+
return {
|
|
119
139
|
validate: (value) => {
|
|
140
|
+
const ctx = { async: false };
|
|
120
141
|
try {
|
|
121
|
-
const r =
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
catch (_) {
|
|
125
|
-
return safeParseAsync(inst, value).then((r) => (r.success ? { value: r.data } : { issues: r.error?.issues }));
|
|
142
|
+
const r = inst._zod.run({ value, issues: [] }, ctx);
|
|
143
|
+
if (!(r instanceof Promise))
|
|
144
|
+
return toStandardResult(r, ctx);
|
|
126
145
|
}
|
|
146
|
+
catch (_) { }
|
|
147
|
+
// async function so a synchronously throwing check rejects instead of escaping validate
|
|
148
|
+
return validateAsync(inst, value);
|
|
127
149
|
},
|
|
128
150
|
vendor: "zod",
|
|
129
151
|
version: 1,
|
|
130
|
-
}
|
|
131
|
-
}
|
|
152
|
+
};
|
|
153
|
+
}
|
|
132
154
|
export { clone } from "./util.js";
|
|
133
155
|
export const $ZodString = /*@__PURE__*/ core.$constructor("$ZodString", (inst, def) => {
|
|
134
156
|
$ZodType.init(inst, def);
|
|
135
|
-
|
|
157
|
+
// a format's own pattern, else unbounded; a template literal derives the check-aware form itself
|
|
158
|
+
inst._zod.pattern = def.pattern ?? regexes.anyString;
|
|
136
159
|
inst._zod.parse = (payload, _) => {
|
|
137
160
|
if (def.coerce)
|
|
138
161
|
try {
|
|
@@ -184,66 +207,115 @@ export const $ZodEmail = /*@__PURE__*/ core.$constructor("$ZodEmail", (inst, def
|
|
|
184
207
|
def.pattern ?? (def.pattern = regexes.email);
|
|
185
208
|
$ZodStringFormat.init(inst, def);
|
|
186
209
|
});
|
|
210
|
+
/** The `://` guard rejected the input before the URL constructor saw it. */
|
|
211
|
+
export const URL_BAD_FORMAT = 1;
|
|
212
|
+
/** The URL parser rejected the input. */
|
|
213
|
+
export const URL_UNPARSEABLE = 2;
|
|
214
|
+
export function canParseURL(input) {
|
|
215
|
+
try {
|
|
216
|
+
if (typeof URL !== "undefined" && typeof URL.canParse === "function")
|
|
217
|
+
return URL.canParse(input);
|
|
218
|
+
new URL(input);
|
|
219
|
+
return true;
|
|
220
|
+
}
|
|
221
|
+
catch {
|
|
222
|
+
return false;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
export function validateURL(trimmed, def) {
|
|
226
|
+
if (!("normalize" in def) && !("hostname" in def) && !("protocol" in def)) {
|
|
227
|
+
return canParseURL(trimmed) || URL_UNPARSEABLE;
|
|
228
|
+
}
|
|
229
|
+
return parseURLObject(trimmed, def);
|
|
230
|
+
}
|
|
231
|
+
/** Parses a URL while preserving the non-normalizing HTTP guard. */
|
|
232
|
+
export function parseURLObject(trimmed, def) {
|
|
233
|
+
// When normalize is off, require :// for http/https URLs. This prevents strings like "http:example.com" or "https:/path" from being silently accepted
|
|
234
|
+
if (!def.normalize && def.protocol?.source === regexes.httpProtocol.source && !/^https?:\/\//i.test(trimmed)) {
|
|
235
|
+
return URL_BAD_FORMAT;
|
|
236
|
+
}
|
|
237
|
+
try {
|
|
238
|
+
if (typeof URL !== "undefined") {
|
|
239
|
+
const URLStatic = URL;
|
|
240
|
+
if (typeof URLStatic.parse === "function")
|
|
241
|
+
return URLStatic.parse(trimmed) ?? URL_UNPARSEABLE;
|
|
242
|
+
}
|
|
243
|
+
// @ts-ignore
|
|
244
|
+
return new URL(trimmed);
|
|
245
|
+
}
|
|
246
|
+
catch {
|
|
247
|
+
return URL_UNPARSEABLE;
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
const asciiTabOrNewline = /[\t\n\r]/g;
|
|
251
|
+
/** The URL parser deletes every ASCII tab, LF and CR from its input before it parses, so `new URL("https://exa\nmple.com")` reports on `example.com`. Applying the same deletion to the returned value closes the half of that divergence which can move the host; the parser's other rewrite, stripping C0 controls at the edges, cannot. */
|
|
252
|
+
export function stripTabAndNewline(value) {
|
|
253
|
+
return value.replace(asciiTabOrNewline, "");
|
|
254
|
+
}
|
|
255
|
+
export function urlHostnameOk(url, hostname) {
|
|
256
|
+
hostname.lastIndex = 0;
|
|
257
|
+
return hostname.test(url.hostname);
|
|
258
|
+
}
|
|
259
|
+
export function urlProtocolOk(url, protocol) {
|
|
260
|
+
protocol.lastIndex = 0;
|
|
261
|
+
return protocol.test(url.protocol.endsWith(":") ? url.protocol.slice(0, -1) : url.protocol);
|
|
262
|
+
}
|
|
187
263
|
export const $ZodURL = /*@__PURE__*/ core.$constructor("$ZodURL", (inst, def) => {
|
|
188
264
|
$ZodStringFormat.init(inst, def);
|
|
189
265
|
inst._zod.check = (payload) => {
|
|
190
266
|
try {
|
|
191
267
|
// Trim whitespace from input
|
|
192
268
|
const trimmed = payload.value.trim();
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
});
|
|
205
|
-
return;
|
|
206
|
-
}
|
|
269
|
+
const url = validateURL(trimmed, def);
|
|
270
|
+
if (url === URL_BAD_FORMAT) {
|
|
271
|
+
payload.issues.push({
|
|
272
|
+
code: "invalid_format",
|
|
273
|
+
format: "url",
|
|
274
|
+
note: "Invalid URL format",
|
|
275
|
+
input: payload.value,
|
|
276
|
+
inst,
|
|
277
|
+
continue: !def.abort,
|
|
278
|
+
});
|
|
279
|
+
return;
|
|
207
280
|
}
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
pattern: def.hostname.source,
|
|
218
|
-
input: payload.value,
|
|
219
|
-
inst,
|
|
220
|
-
continue: !def.abort,
|
|
221
|
-
});
|
|
222
|
-
}
|
|
281
|
+
if (url === URL_UNPARSEABLE) {
|
|
282
|
+
payload.issues.push({
|
|
283
|
+
code: "invalid_format",
|
|
284
|
+
format: "url",
|
|
285
|
+
input: payload.value,
|
|
286
|
+
inst,
|
|
287
|
+
continue: !def.abort,
|
|
288
|
+
});
|
|
289
|
+
return;
|
|
223
290
|
}
|
|
224
|
-
if (
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
payload.issues.push({
|
|
228
|
-
code: "invalid_format",
|
|
229
|
-
format: "url",
|
|
230
|
-
note: "Invalid protocol",
|
|
231
|
-
pattern: def.protocol.source,
|
|
232
|
-
input: payload.value,
|
|
233
|
-
inst,
|
|
234
|
-
continue: !def.abort,
|
|
235
|
-
});
|
|
236
|
-
}
|
|
291
|
+
if (url === true) {
|
|
292
|
+
payload.value = stripTabAndNewline(trimmed);
|
|
293
|
+
return;
|
|
237
294
|
}
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
295
|
+
if (def.hostname && !urlHostnameOk(url, def.hostname)) {
|
|
296
|
+
payload.issues.push({
|
|
297
|
+
code: "invalid_format",
|
|
298
|
+
format: "url",
|
|
299
|
+
note: "Invalid hostname",
|
|
300
|
+
pattern: def.hostname.source,
|
|
301
|
+
input: payload.value,
|
|
302
|
+
inst,
|
|
303
|
+
continue: !def.abort,
|
|
304
|
+
});
|
|
242
305
|
}
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
306
|
+
if (def.protocol && !urlProtocolOk(url, def.protocol)) {
|
|
307
|
+
payload.issues.push({
|
|
308
|
+
code: "invalid_format",
|
|
309
|
+
format: "url",
|
|
310
|
+
note: "Invalid protocol",
|
|
311
|
+
pattern: def.protocol.source,
|
|
312
|
+
input: payload.value,
|
|
313
|
+
inst,
|
|
314
|
+
continue: !def.abort,
|
|
315
|
+
});
|
|
246
316
|
}
|
|
317
|
+
// Set the output value based on normalize flag
|
|
318
|
+
payload.value = def.normalize ? url.href : stripTabAndNewline(trimmed);
|
|
247
319
|
return;
|
|
248
320
|
}
|
|
249
321
|
catch (_) {
|
|
@@ -262,7 +334,9 @@ export const $ZodEmoji = /*@__PURE__*/ core.$constructor("$ZodEmoji", (inst, def
|
|
|
262
334
|
$ZodStringFormat.init(inst, def);
|
|
263
335
|
});
|
|
264
336
|
export const $ZodNanoID = /*@__PURE__*/ core.$constructor("$ZodNanoID", (inst, def) => {
|
|
265
|
-
def.
|
|
337
|
+
if (def.length !== undefined && (!Number.isInteger(def.length) || def.length < 1))
|
|
338
|
+
throw new Error(`Invalid nanoid length: ${def.length}`);
|
|
339
|
+
def.pattern ?? (def.pattern = def.length === undefined ? regexes.nanoid : regexes.nanoidOfLength(def.length));
|
|
266
340
|
$ZodStringFormat.init(inst, def);
|
|
267
341
|
});
|
|
268
342
|
/**
|
|
@@ -309,19 +383,19 @@ export const $ZodISODuration = /*@__PURE__*/ core.$constructor("$ZodISODuration"
|
|
|
309
383
|
export const $ZodIPv4 = /*@__PURE__*/ core.$constructor("$ZodIPv4", (inst, def) => {
|
|
310
384
|
def.pattern ?? (def.pattern = regexes.ipv4);
|
|
311
385
|
$ZodStringFormat.init(inst, def);
|
|
312
|
-
inst._zod.bag.format = `ipv4`;
|
|
313
386
|
});
|
|
387
|
+
/** An IPv6 address is written with hex digits, colons and dots, and nothing else. The guard is what makes the check below an IPv6 check: `new URL("http://[...]")` parses an authority, not an address, so `@` and `\` re-delimit it and `"::@1\\"` validates against the host `0.0.0.1`. The URL parser also deletes ASCII tab, LF and CR rather than failing, which is how `"::1\n"` validated as `::1`. */
|
|
388
|
+
const ipv6Alphabet = /^[0-9a-fA-F:.]+$/;
|
|
389
|
+
export function isValidIPv6(value) {
|
|
390
|
+
if (!ipv6Alphabet.test(value))
|
|
391
|
+
return false;
|
|
392
|
+
return canParseURL(`http://[${value}]`);
|
|
393
|
+
}
|
|
314
394
|
export const $ZodIPv6 = /*@__PURE__*/ core.$constructor("$ZodIPv6", (inst, def) => {
|
|
315
395
|
def.pattern ?? (def.pattern = regexes.ipv6);
|
|
316
396
|
$ZodStringFormat.init(inst, def);
|
|
317
|
-
inst._zod.bag.format = `ipv6`;
|
|
318
397
|
inst._zod.check = (payload) => {
|
|
319
|
-
|
|
320
|
-
// @ts-ignore
|
|
321
|
-
new URL(`http://[${payload.value}]`);
|
|
322
|
-
// return;
|
|
323
|
-
}
|
|
324
|
-
catch {
|
|
398
|
+
if (!isValidIPv6(payload.value)) {
|
|
325
399
|
payload.issues.push({
|
|
326
400
|
code: "invalid_format",
|
|
327
401
|
format: "ipv6",
|
|
@@ -335,32 +409,30 @@ export const $ZodIPv6 = /*@__PURE__*/ core.$constructor("$ZodIPv6", (inst, def)
|
|
|
335
409
|
export const $ZodMAC = /*@__PURE__*/ core.$constructor("$ZodMAC", (inst, def) => {
|
|
336
410
|
def.pattern ?? (def.pattern = regexes.mac(def.delimiter));
|
|
337
411
|
$ZodStringFormat.init(inst, def);
|
|
338
|
-
inst._zod.bag.format = `mac`;
|
|
339
412
|
});
|
|
340
413
|
export const $ZodCIDRv4 = /*@__PURE__*/ core.$constructor("$ZodCIDRv4", (inst, def) => {
|
|
341
414
|
def.pattern ?? (def.pattern = regexes.cidrv4);
|
|
342
415
|
$ZodStringFormat.init(inst, def);
|
|
343
416
|
});
|
|
417
|
+
export function isValidCIDRv6(value) {
|
|
418
|
+
const parts = value.split("/");
|
|
419
|
+
if (parts.length !== 2)
|
|
420
|
+
return false;
|
|
421
|
+
const [address, prefix] = parts;
|
|
422
|
+
if (!prefix)
|
|
423
|
+
return false;
|
|
424
|
+
const prefixNum = Number(prefix);
|
|
425
|
+
if (`${prefixNum}` !== prefix)
|
|
426
|
+
return false;
|
|
427
|
+
if (prefixNum < 0 || prefixNum > 128)
|
|
428
|
+
return false;
|
|
429
|
+
return isValidIPv6(address);
|
|
430
|
+
}
|
|
344
431
|
export const $ZodCIDRv6 = /*@__PURE__*/ core.$constructor("$ZodCIDRv6", (inst, def) => {
|
|
345
432
|
def.pattern ?? (def.pattern = regexes.cidrv6); // not used for validation
|
|
346
433
|
$ZodStringFormat.init(inst, def);
|
|
347
434
|
inst._zod.check = (payload) => {
|
|
348
|
-
|
|
349
|
-
try {
|
|
350
|
-
if (parts.length !== 2)
|
|
351
|
-
throw new Error();
|
|
352
|
-
const [address, prefix] = parts;
|
|
353
|
-
if (!prefix)
|
|
354
|
-
throw new Error();
|
|
355
|
-
const prefixNum = Number(prefix);
|
|
356
|
-
if (`${prefixNum}` !== prefix)
|
|
357
|
-
throw new Error();
|
|
358
|
-
if (prefixNum < 0 || prefixNum > 128)
|
|
359
|
-
throw new Error();
|
|
360
|
-
// @ts-ignore
|
|
361
|
-
new URL(`http://[${address}]`);
|
|
362
|
-
}
|
|
363
|
-
catch {
|
|
435
|
+
if (!isValidCIDRv6(payload.value)) {
|
|
364
436
|
payload.issues.push({
|
|
365
437
|
code: "invalid_format",
|
|
366
438
|
format: "cidrv6",
|
|
@@ -389,10 +461,11 @@ export function isValidBase64(data) {
|
|
|
389
461
|
return false;
|
|
390
462
|
}
|
|
391
463
|
}
|
|
464
|
+
// lax on purpose: the quantified regexes.base64 overflows the regex stack on multi-MB input and its leading ^$| alternation leaks through template-literal composition; isValidBase64 enforces length and padding
|
|
465
|
+
export const base64Charset = /^[0-9a-zA-Z+/]*={0,2}$/;
|
|
392
466
|
export const $ZodBase64 = /*@__PURE__*/ core.$constructor("$ZodBase64", (inst, def) => {
|
|
393
|
-
def.pattern ?? (def.pattern =
|
|
467
|
+
def.pattern ?? (def.pattern = base64Charset);
|
|
394
468
|
$ZodStringFormat.init(inst, def);
|
|
395
|
-
inst._zod.bag.contentEncoding = "base64";
|
|
396
469
|
inst._zod.check = (payload) => {
|
|
397
470
|
if (isValidBase64(payload.value))
|
|
398
471
|
return;
|
|
@@ -405,18 +478,19 @@ export const $ZodBase64 = /*@__PURE__*/ core.$constructor("$ZodBase64", (inst, d
|
|
|
405
478
|
});
|
|
406
479
|
};
|
|
407
480
|
});
|
|
408
|
-
//////////////////////////////
|
|
481
|
+
////////////////////////////// ZodBase64URL //////////////////////////////
|
|
482
|
+
// lax on purpose: the quantified regexes.base64url overflows the regex stack on multi-MB input; isValidBase64 enforces length on the padded string
|
|
483
|
+
export const base64urlCharset = /^[A-Za-z0-9_-]*$/;
|
|
409
484
|
export function isValidBase64URL(data) {
|
|
410
|
-
if (!
|
|
485
|
+
if (!base64urlCharset.test(data))
|
|
411
486
|
return false;
|
|
412
487
|
const base64 = data.replace(/[-_]/g, (c) => (c === "-" ? "+" : "/"));
|
|
413
488
|
const padded = base64.padEnd(Math.ceil(base64.length / 4) * 4, "=");
|
|
414
489
|
return isValidBase64(padded);
|
|
415
490
|
}
|
|
416
491
|
export const $ZodBase64URL = /*@__PURE__*/ core.$constructor("$ZodBase64URL", (inst, def) => {
|
|
417
|
-
def.pattern ?? (def.pattern =
|
|
492
|
+
def.pattern ?? (def.pattern = base64urlCharset);
|
|
418
493
|
$ZodStringFormat.init(inst, def);
|
|
419
|
-
inst._zod.bag.contentEncoding = "base64url";
|
|
420
494
|
inst._zod.check = (payload) => {
|
|
421
495
|
if (isValidBase64URL(payload.value))
|
|
422
496
|
return;
|
|
@@ -433,6 +507,77 @@ export const $ZodE164 = /*@__PURE__*/ core.$constructor("$ZodE164", (inst, def)
|
|
|
433
507
|
def.pattern ?? (def.pattern = regexes.e164);
|
|
434
508
|
$ZodStringFormat.init(inst, def);
|
|
435
509
|
});
|
|
510
|
+
////////////////////////////// ZodCreditCard //////////////////////////////
|
|
511
|
+
const CC_SANITIZE = /[- ]/g;
|
|
512
|
+
/** Luhn checksum on a digit-only string. Adapted from valibot (MIT). */
|
|
513
|
+
function isLuhnAlgo(digits) {
|
|
514
|
+
let length = digits.length;
|
|
515
|
+
let bit = 1;
|
|
516
|
+
let sum = 0;
|
|
517
|
+
while (length) {
|
|
518
|
+
const value = digits.charCodeAt(--length) - 48;
|
|
519
|
+
bit ^= 1;
|
|
520
|
+
sum += bit ? [0, 2, 4, 6, 8, 1, 3, 5, 7, 9][value] : value;
|
|
521
|
+
}
|
|
522
|
+
return sum % 10 === 0;
|
|
523
|
+
}
|
|
524
|
+
export function isValidCreditCard(input) {
|
|
525
|
+
if (!regexes.creditCard.test(input))
|
|
526
|
+
return false;
|
|
527
|
+
return isLuhnAlgo(input.replace(CC_SANITIZE, ""));
|
|
528
|
+
}
|
|
529
|
+
export const $ZodCreditCard = /*@__PURE__*/ core.$constructor("$ZodCreditCard", (inst, def) => {
|
|
530
|
+
// Shape only — the Luhn check below is not expressible as a pattern, so consumers of `pattern` (JSON Schema, template literals) get the length and separator rules alone.
|
|
531
|
+
def.pattern ?? (def.pattern = regexes.creditCard);
|
|
532
|
+
$ZodStringFormat.init(inst, def);
|
|
533
|
+
inst._zod.check = (payload) => {
|
|
534
|
+
if (isValidCreditCard(payload.value))
|
|
535
|
+
return;
|
|
536
|
+
payload.issues.push({
|
|
537
|
+
code: "invalid_format",
|
|
538
|
+
format: "credit_card",
|
|
539
|
+
input: payload.value,
|
|
540
|
+
inst,
|
|
541
|
+
continue: !def.abort,
|
|
542
|
+
});
|
|
543
|
+
};
|
|
544
|
+
});
|
|
545
|
+
////////////////////////////// ZodIBAN //////////////////////////////
|
|
546
|
+
// iso 7064 mod 97-10 checksum without BigInt
|
|
547
|
+
function isIso7064Mod97(iban) {
|
|
548
|
+
let remainder = 0;
|
|
549
|
+
const len = iban.length;
|
|
550
|
+
for (let i = 4; i < len; i++) {
|
|
551
|
+
const code = iban.charCodeAt(i);
|
|
552
|
+
remainder = (code >= 65 ? remainder * 100 + (code - 55) : remainder * 10 + (code - 48)) % 97;
|
|
553
|
+
}
|
|
554
|
+
for (let i = 0; i < 4; i++) {
|
|
555
|
+
const code = iban.charCodeAt(i);
|
|
556
|
+
remainder = (code >= 65 ? remainder * 100 + (code - 55) : remainder * 10 + (code - 48)) % 97;
|
|
557
|
+
}
|
|
558
|
+
return remainder === 1;
|
|
559
|
+
}
|
|
560
|
+
export function isValidIBAN(input) {
|
|
561
|
+
if (!regexes.iban.test(input))
|
|
562
|
+
return false;
|
|
563
|
+
return isIso7064Mod97(input);
|
|
564
|
+
}
|
|
565
|
+
export const $ZodIBAN = /*@__PURE__*/ core.$constructor("$ZodIBAN", (inst, def) => {
|
|
566
|
+
// shape only — checksum is not expressible as a pattern
|
|
567
|
+
def.pattern ?? (def.pattern = regexes.iban);
|
|
568
|
+
$ZodStringFormat.init(inst, def);
|
|
569
|
+
inst._zod.check = (payload) => {
|
|
570
|
+
if (isValidIBAN(payload.value))
|
|
571
|
+
return;
|
|
572
|
+
payload.issues.push({
|
|
573
|
+
code: "invalid_format",
|
|
574
|
+
format: "iban",
|
|
575
|
+
input: payload.value,
|
|
576
|
+
inst,
|
|
577
|
+
continue: !def.abort,
|
|
578
|
+
});
|
|
579
|
+
};
|
|
580
|
+
});
|
|
436
581
|
////////////////////////////// ZodJWT //////////////////////////////
|
|
437
582
|
export function isValidJWT(token, algorithm = null) {
|
|
438
583
|
try {
|
|
@@ -486,7 +631,7 @@ export const $ZodCustomStringFormat = /*@__PURE__*/ core.$constructor("$ZodCusto
|
|
|
486
631
|
});
|
|
487
632
|
export const $ZodNumber = /*@__PURE__*/ core.$constructor("$ZodNumber", (inst, def) => {
|
|
488
633
|
$ZodType.init(inst, def);
|
|
489
|
-
inst._zod.pattern =
|
|
634
|
+
inst._zod.pattern = regexes.number;
|
|
490
635
|
inst._zod.parse = (payload, _ctx) => {
|
|
491
636
|
if (def.coerce)
|
|
492
637
|
try {
|
|
@@ -501,7 +646,7 @@ export const $ZodNumber = /*@__PURE__*/ core.$constructor("$ZodNumber", (inst, d
|
|
|
501
646
|
? Number.isNaN(input)
|
|
502
647
|
? "NaN"
|
|
503
648
|
: !Number.isFinite(input)
|
|
504
|
-
?
|
|
649
|
+
? String(input)
|
|
505
650
|
: undefined
|
|
506
651
|
: undefined;
|
|
507
652
|
payload.issues.push({
|
|
@@ -679,6 +824,8 @@ function handleArrayResult(result, final, index) {
|
|
|
679
824
|
}
|
|
680
825
|
export const $ZodArray = /*@__PURE__*/ core.$constructor("$ZodArray", (inst, def) => {
|
|
681
826
|
$ZodType.init(inst, def);
|
|
827
|
+
const memo = core.globalConfig.memoizer;
|
|
828
|
+
memo?.attach(inst);
|
|
682
829
|
inst._zod.parse = (payload, ctx) => {
|
|
683
830
|
const input = payload.value;
|
|
684
831
|
if (!Array.isArray(input)) {
|
|
@@ -690,8 +837,9 @@ export const $ZodArray = /*@__PURE__*/ core.$constructor("$ZodArray", (inst, def
|
|
|
690
837
|
});
|
|
691
838
|
return payload;
|
|
692
839
|
}
|
|
693
|
-
payload.value = Array(input.length);
|
|
840
|
+
payload.value = memo ? memo.alloc(inst, payload, Array(input.length), ctx) : Array(input.length);
|
|
694
841
|
const proms = [];
|
|
842
|
+
const abortEarly = ctx?.abortEarly;
|
|
695
843
|
for (let i = 0; i < input.length; i++) {
|
|
696
844
|
const item = input[i];
|
|
697
845
|
const result = def.element._zod.run({
|
|
@@ -703,6 +851,9 @@ export const $ZodArray = /*@__PURE__*/ core.$constructor("$ZodArray", (inst, def
|
|
|
703
851
|
}
|
|
704
852
|
else {
|
|
705
853
|
handleArrayResult(result, payload, i);
|
|
854
|
+
// the element's payload is authoritative here, since handleArrayResult forwards every issue; an object's is not, because it drops a failed absent optional
|
|
855
|
+
if (abortEarly && result.issues.length !== 0 && util.aborted(result))
|
|
856
|
+
break;
|
|
706
857
|
}
|
|
707
858
|
}
|
|
708
859
|
if (proms.length) {
|
|
@@ -711,16 +862,21 @@ export const $ZodArray = /*@__PURE__*/ core.$constructor("$ZodArray", (inst, def
|
|
|
711
862
|
return payload; //handleArrayResultsAsync(parseResults, final);
|
|
712
863
|
};
|
|
713
864
|
});
|
|
714
|
-
function handlePropertyResult(result, final, key, input,
|
|
865
|
+
function handlePropertyResult(result, final, key, input, optin, optout) {
|
|
715
866
|
const isPresent = key in input;
|
|
867
|
+
const isOptionalOut = optout === "optional";
|
|
868
|
+
// The middle rung means "absence permitted, nothing supplied in its place", so an absent key contributes nothing — whatever the schema made of `undefined` is invented, not substituted. Only `optional` reaches this with a value: `defaulted` substitutes, and a schema that isn't optional-out has to keep the key.
|
|
869
|
+
if (!isPresent && isOptionalOut && optin === "optional") {
|
|
870
|
+
return;
|
|
871
|
+
}
|
|
716
872
|
if (result.issues.length) {
|
|
717
873
|
// For optional-in/out schemas, ignore errors on absent keys.
|
|
718
|
-
if (
|
|
874
|
+
if (optin !== undefined && isOptionalOut && !isPresent) {
|
|
719
875
|
return;
|
|
720
876
|
}
|
|
721
877
|
final.issues.push(...util.prefixIssues(key, result.issues));
|
|
722
878
|
}
|
|
723
|
-
if (!isPresent &&
|
|
879
|
+
if (!isPresent && optin === undefined) {
|
|
724
880
|
if (!result.issues.length) {
|
|
725
881
|
final.issues.push({
|
|
726
882
|
code: "invalid_type",
|
|
@@ -732,7 +888,7 @@ function handlePropertyResult(result, final, key, input, isOptionalIn, isOptiona
|
|
|
732
888
|
return;
|
|
733
889
|
}
|
|
734
890
|
if (result.value === undefined) {
|
|
735
|
-
if (isPresent) {
|
|
891
|
+
if (isPresent || (optin === "defaulted" && !isOptionalOut)) {
|
|
736
892
|
final.value[key] = undefined;
|
|
737
893
|
}
|
|
738
894
|
}
|
|
@@ -740,46 +896,64 @@ function handlePropertyResult(result, final, key, input, isOptionalIn, isOptiona
|
|
|
740
896
|
final.value[key] = result.value;
|
|
741
897
|
}
|
|
742
898
|
}
|
|
899
|
+
// one shared instance; a fresh [] per schema cost 56 bytes retained
|
|
900
|
+
const NO_SYMBOL_KEYS = [];
|
|
743
901
|
function normalizeDef(def) {
|
|
744
902
|
const keys = Object.keys(def.shape);
|
|
745
|
-
|
|
903
|
+
const ownSymbols = Object.getOwnPropertySymbols(def.shape);
|
|
904
|
+
const symbolKeys = ownSymbols.length ? ownSymbols : NO_SYMBOL_KEYS;
|
|
905
|
+
// aliases `keys` when there are no symbols, so a string-only shape keeps one array
|
|
906
|
+
const allKeys = symbolKeys.length ? [...keys, ...symbolKeys] : keys;
|
|
907
|
+
for (const k of allKeys) {
|
|
746
908
|
if (!def.shape?.[k]?._zod?.traits?.has("$ZodType")) {
|
|
747
|
-
throw new Error(`Invalid element at key "${k}": expected a Zod schema`);
|
|
909
|
+
throw new Error(`Invalid element at key "${String(k)}": expected a Zod schema`);
|
|
748
910
|
}
|
|
749
911
|
}
|
|
750
912
|
const okeys = util.optionalKeys(def.shape);
|
|
751
913
|
return {
|
|
752
914
|
...def,
|
|
753
|
-
|
|
915
|
+
allKeys,
|
|
916
|
+
symbolKeys,
|
|
917
|
+
// string-only: handleCatchall matches it against `for...in`, which never yields a symbol
|
|
754
918
|
keySet: new Set(keys),
|
|
755
919
|
numKeys: keys.length,
|
|
756
920
|
optionalKeys: new Set(okeys),
|
|
757
921
|
};
|
|
758
922
|
}
|
|
759
|
-
function handleCatchall(proms, input, payload, ctx, def, inst) {
|
|
923
|
+
function handleCatchall(proms, input, payload, ctx, def, inst, abortEarly) {
|
|
760
924
|
const unrecognized = [];
|
|
761
925
|
const keySet = def.keySet;
|
|
762
926
|
const _catchall = def.catchall._zod;
|
|
763
927
|
const t = _catchall.def.type;
|
|
764
|
-
const
|
|
765
|
-
const
|
|
928
|
+
const optin = _catchall.optin;
|
|
929
|
+
const optout = _catchall.optout;
|
|
930
|
+
// starts at 0, not the current length: the shape phase already ran and may have aborted
|
|
931
|
+
let seen = 0;
|
|
766
932
|
for (const key in input) {
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
933
|
+
if (abortEarly && payload.issues.length !== seen) {
|
|
934
|
+
if (util.aborted(payload, seen))
|
|
935
|
+
break;
|
|
936
|
+
seen = payload.issues.length;
|
|
937
|
+
}
|
|
938
|
+
// Must precede the __proto__ branch: a declared key is not unrecognized, even though the shape loop deliberately strips __proto__ from the parsed output.
|
|
771
939
|
if (keySet.has(key))
|
|
772
940
|
continue;
|
|
941
|
+
// Don't copy an undeclared __proto__ into the result; assignment to a plain {} would replace the result prototype. But in strict mode it is still an unknown key, so report it before skipping.
|
|
942
|
+
if (key === "__proto__") {
|
|
943
|
+
if (t === "never")
|
|
944
|
+
unrecognized.push(key);
|
|
945
|
+
continue;
|
|
946
|
+
}
|
|
773
947
|
if (t === "never") {
|
|
774
948
|
unrecognized.push(key);
|
|
775
949
|
continue;
|
|
776
950
|
}
|
|
777
951
|
const r = _catchall.run({ value: input[key], issues: [] }, ctx);
|
|
778
952
|
if (r instanceof Promise) {
|
|
779
|
-
proms.push(r.then((r) => handlePropertyResult(r, payload, key, input,
|
|
953
|
+
proms.push(r.then((r) => handlePropertyResult(r, payload, key, input, optin, optout)));
|
|
780
954
|
}
|
|
781
955
|
else {
|
|
782
|
-
handlePropertyResult(r, payload, key, input,
|
|
956
|
+
handlePropertyResult(r, payload, key, input, optin, optout);
|
|
783
957
|
}
|
|
784
958
|
}
|
|
785
959
|
if (unrecognized.length) {
|
|
@@ -788,6 +962,8 @@ function handleCatchall(proms, input, payload, ctx, def, inst) {
|
|
|
788
962
|
keys: unrecognized,
|
|
789
963
|
input,
|
|
790
964
|
inst,
|
|
965
|
+
// Describes the shape of the input, not the validity of the parsed value, so it never aborts. The parse still fails; the schema's own checks just get to run first, and an enclosing intersection can reconcile the key against a sibling operand.
|
|
966
|
+
continue: true,
|
|
791
967
|
});
|
|
792
968
|
}
|
|
793
969
|
if (!proms.length)
|
|
@@ -799,30 +975,35 @@ function handleCatchall(proms, input, payload, ctx, def, inst) {
|
|
|
799
975
|
export const $ZodObject = /*@__PURE__*/ core.$constructor("$ZodObject", (inst, def) => {
|
|
800
976
|
// requires cast because technically $ZodObject doesn't extend
|
|
801
977
|
$ZodType.init(inst, def);
|
|
802
|
-
// const sh = def.shape;
|
|
803
978
|
const desc = Object.getOwnPropertyDescriptor(def, "shape");
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
979
|
+
// a cloned def carries its source's accessor, which knows the shape it answers from; adopting that keeps the clone's keys readable without running it
|
|
980
|
+
const sh = desc?.get ? desc.get.raw : (def.shape ?? {});
|
|
981
|
+
if (sh) {
|
|
982
|
+
// Freezes the shape on first read, so its getters resolve once and every later read sees the same schemas.
|
|
983
|
+
const get = () => {
|
|
984
|
+
const newSh = { ...sh };
|
|
985
|
+
Object.defineProperty(def, "shape", { value: newSh });
|
|
986
|
+
get.raw = newSh;
|
|
987
|
+
return newSh;
|
|
988
|
+
};
|
|
989
|
+
get.raw = sh;
|
|
990
|
+
Object.defineProperty(def, "shape", { get });
|
|
815
991
|
}
|
|
816
992
|
const _normalized = util.cached(() => normalizeDef(def));
|
|
817
|
-
util.
|
|
818
|
-
const shape = def.shape;
|
|
993
|
+
util.defineLazyInternal(inst, "propValues", (zod) => {
|
|
994
|
+
const shape = zod.def.shape;
|
|
819
995
|
const propValues = {};
|
|
820
996
|
for (const key in shape) {
|
|
821
997
|
const field = shape[key]._zod;
|
|
822
998
|
if (field.values) {
|
|
823
|
-
|
|
999
|
+
if (!Object.prototype.hasOwnProperty.call(propValues, key)) {
|
|
1000
|
+
util.assignProp(propValues, key, new Set());
|
|
1001
|
+
}
|
|
824
1002
|
for (const v of field.values)
|
|
825
1003
|
propValues[key].add(v);
|
|
1004
|
+
// An omittable slot reads back as undefined at a discriminator lookup, so it has to claim undefined: two options that can both omit the key are not discriminable on it.
|
|
1005
|
+
if (field.optin !== undefined)
|
|
1006
|
+
propValues[key].add(undefined);
|
|
826
1007
|
}
|
|
827
1008
|
}
|
|
828
1009
|
return propValues;
|
|
@@ -830,6 +1011,8 @@ export const $ZodObject = /*@__PURE__*/ core.$constructor("$ZodObject", (inst, d
|
|
|
830
1011
|
const isObject = util.isObject;
|
|
831
1012
|
const catchall = def.catchall;
|
|
832
1013
|
let value;
|
|
1014
|
+
const memo = core.globalConfig.memoizer;
|
|
1015
|
+
memo?.attach(inst);
|
|
833
1016
|
inst._zod.parse = (payload, ctx) => {
|
|
834
1017
|
value ?? (value = _normalized.value);
|
|
835
1018
|
const input = payload.value;
|
|
@@ -842,25 +1025,34 @@ export const $ZodObject = /*@__PURE__*/ core.$constructor("$ZodObject", (inst, d
|
|
|
842
1025
|
});
|
|
843
1026
|
return payload;
|
|
844
1027
|
}
|
|
845
|
-
payload.value = {};
|
|
1028
|
+
payload.value = memo ? memo.alloc(inst, payload, {}, ctx) : {};
|
|
846
1029
|
const proms = [];
|
|
847
1030
|
const shape = value.shape;
|
|
848
|
-
|
|
1031
|
+
const abortEarly = ctx?.abortEarly;
|
|
1032
|
+
let seen = payload.issues.length;
|
|
1033
|
+
for (const key of value.allKeys) {
|
|
1034
|
+
if (abortEarly && payload.issues.length !== seen) {
|
|
1035
|
+
if (util.aborted(payload, seen))
|
|
1036
|
+
break;
|
|
1037
|
+
seen = payload.issues.length;
|
|
1038
|
+
}
|
|
1039
|
+
if (key === "__proto__")
|
|
1040
|
+
continue;
|
|
849
1041
|
const el = shape[key];
|
|
850
|
-
const
|
|
851
|
-
const
|
|
1042
|
+
const optin = el._zod.optin;
|
|
1043
|
+
const optout = el._zod.optout;
|
|
852
1044
|
const r = el._zod.run({ value: input[key], issues: [] }, ctx);
|
|
853
1045
|
if (r instanceof Promise) {
|
|
854
|
-
proms.push(r.then((r) => handlePropertyResult(r, payload, key, input,
|
|
1046
|
+
proms.push(r.then((r) => handlePropertyResult(r, payload, key, input, optin, optout)));
|
|
855
1047
|
}
|
|
856
1048
|
else {
|
|
857
|
-
handlePropertyResult(r, payload, key, input,
|
|
1049
|
+
handlePropertyResult(r, payload, key, input, optin, optout);
|
|
858
1050
|
}
|
|
859
1051
|
}
|
|
860
1052
|
if (!catchall) {
|
|
861
1053
|
return proms.length ? Promise.all(proms).then(() => payload) : payload;
|
|
862
1054
|
}
|
|
863
|
-
return handleCatchall(proms, input, payload, ctx, _normalized.value, inst);
|
|
1055
|
+
return handleCatchall(proms, input, payload, ctx, _normalized.value, inst, abortEarly === true);
|
|
864
1056
|
};
|
|
865
1057
|
});
|
|
866
1058
|
export const $ZodObjectJIT = /*@__PURE__*/ core.$constructor("$ZodObjectJIT", (inst, def) => {
|
|
@@ -868,58 +1060,65 @@ export const $ZodObjectJIT = /*@__PURE__*/ core.$constructor("$ZodObjectJIT", (i
|
|
|
868
1060
|
$ZodObject.init(inst, def);
|
|
869
1061
|
const superParse = inst._zod.parse;
|
|
870
1062
|
const _normalized = util.cached(() => normalizeDef(def));
|
|
1063
|
+
const memo = core.globalConfig.memoizer;
|
|
871
1064
|
const generateFastpass = (shape) => {
|
|
872
|
-
const doc = new Doc(["shape", "payload", "ctx"]);
|
|
873
1065
|
const normalized = _normalized.value;
|
|
874
|
-
const
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
}
|
|
1066
|
+
const syms = normalized.symbolKeys;
|
|
1067
|
+
// a symbol has no source literal, so it is read as `syms[i]` off the closed-over scope
|
|
1068
|
+
const doc = new Doc(["payload", "ctx"], { shape, inst, memo, syms });
|
|
1069
|
+
const parseStr = (k) => `shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`;
|
|
1070
|
+
// prefixes in place, like util.prefixIssues. newResult must land before the early return: a catchall runs after this and would otherwise write onto the caller's input
|
|
1071
|
+
const prefixStr = (id, k) => `
|
|
1072
|
+
let ${id}_ab = false;
|
|
1073
|
+
for (let i = 0; i < ${id}.issues.length; i++) {
|
|
1074
|
+
const iss = ${id}.issues[i];
|
|
1075
|
+
iss.path = iss.path ? [${k}, ...iss.path] : [${k}];
|
|
1076
|
+
payload.issues.push(iss);
|
|
1077
|
+
if (iss.continue !== true) ${id}_ab = true;
|
|
1078
|
+
}
|
|
1079
|
+
if (${id}_ab && ctx && ctx.abortEarly) {
|
|
1080
|
+
payload.value = newResult;
|
|
1081
|
+
return payload;
|
|
1082
|
+
}`;
|
|
878
1083
|
doc.write(`const input = payload.value;`);
|
|
879
1084
|
const ids = Object.create(null);
|
|
880
1085
|
let counter = 0;
|
|
881
|
-
for (const key of normalized.
|
|
1086
|
+
for (const key of normalized.allKeys) {
|
|
882
1087
|
ids[key] = `key_${counter++}`;
|
|
883
1088
|
}
|
|
884
1089
|
// A: preserve key order {
|
|
885
|
-
doc.write(`const newResult = {};`);
|
|
886
|
-
for (const key of normalized.
|
|
1090
|
+
doc.write(memo ? `const newResult = memo.alloc(inst, payload, {}, ctx);` : `const newResult = {};`);
|
|
1091
|
+
for (const key of normalized.allKeys) {
|
|
1092
|
+
if (key === "__proto__")
|
|
1093
|
+
continue;
|
|
887
1094
|
const id = ids[key];
|
|
888
|
-
const k = util.esc(key);
|
|
1095
|
+
const k = typeof key === "symbol" ? `syms[${syms.indexOf(key)}]` : util.esc(key);
|
|
1096
|
+
const isPresent = `${k} in input`;
|
|
889
1097
|
const schema = shape[key];
|
|
890
|
-
const
|
|
1098
|
+
const optin = schema?._zod?.optin;
|
|
1099
|
+
const isOptionalIn = optin !== undefined;
|
|
891
1100
|
const isOptionalOut = schema?._zod?.optout === "optional";
|
|
892
|
-
doc.write(`const ${id} = ${parseStr(
|
|
1101
|
+
doc.write(`const ${id} = ${parseStr(k)};`);
|
|
893
1102
|
if (isOptionalIn && isOptionalOut) {
|
|
894
|
-
// For optional-in/out schemas, ignore errors on absent keys
|
|
1103
|
+
// For optional-in/out schemas, ignore errors on absent keys — and, like the interpreted path, drop the value produced alongside them. The middle rung goes further: it permits absence without supplying anything in its place, so an absent key contributes nothing at all.
|
|
1104
|
+
const assign = optin === "optional" ? `${id}_present` : `${id}.value !== undefined || ${id}_present`;
|
|
895
1105
|
doc.write(`
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
...iss,
|
|
900
|
-
path: iss.path ? [${k}, ...iss.path] : [${k}]
|
|
901
|
-
})));
|
|
1106
|
+
const ${id}_present = ${isPresent};
|
|
1107
|
+
if (!${id}.issues.length || ${id}_present) {
|
|
1108
|
+
if (${id}.issues.length) {${prefixStr(id, k)}
|
|
902
1109
|
}
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
if (${k} in input) {
|
|
907
|
-
newResult[${k}] = undefined;
|
|
1110
|
+
|
|
1111
|
+
if (${assign}) {
|
|
1112
|
+
newResult[${k}] = ${id}.value;
|
|
908
1113
|
}
|
|
909
|
-
} else {
|
|
910
|
-
newResult[${k}] = ${id}.value;
|
|
911
1114
|
}
|
|
912
|
-
|
|
1115
|
+
|
|
913
1116
|
`);
|
|
914
1117
|
}
|
|
915
1118
|
else if (!isOptionalIn) {
|
|
916
1119
|
doc.write(`
|
|
917
|
-
const ${id}_present = ${
|
|
918
|
-
if (${id}.issues.length) {
|
|
919
|
-
payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
|
|
920
|
-
...iss,
|
|
921
|
-
path: iss.path ? [${k}, ...iss.path] : [${k}]
|
|
922
|
-
})));
|
|
1120
|
+
const ${id}_present = ${isPresent};
|
|
1121
|
+
if (${id}.issues.length) {${prefixStr(id, k)}
|
|
923
1122
|
}
|
|
924
1123
|
if (!${id}_present && !${id}.issues.length) {
|
|
925
1124
|
payload.issues.push({
|
|
@@ -928,42 +1127,39 @@ export const $ZodObjectJIT = /*@__PURE__*/ core.$constructor("$ZodObjectJIT", (i
|
|
|
928
1127
|
input: undefined,
|
|
929
1128
|
path: [${k}]
|
|
930
1129
|
});
|
|
1130
|
+
if (ctx && ctx.abortEarly) {
|
|
1131
|
+
payload.value = newResult;
|
|
1132
|
+
return payload;
|
|
1133
|
+
}
|
|
931
1134
|
}
|
|
932
1135
|
|
|
933
1136
|
if (${id}_present) {
|
|
934
|
-
|
|
935
|
-
newResult[${k}] = undefined;
|
|
936
|
-
} else {
|
|
937
|
-
newResult[${k}] = ${id}.value;
|
|
938
|
-
}
|
|
1137
|
+
newResult[${k}] = ${id}.value;
|
|
939
1138
|
}
|
|
940
1139
|
|
|
941
1140
|
`);
|
|
942
1141
|
}
|
|
943
1142
|
else {
|
|
944
1143
|
doc.write(`
|
|
945
|
-
if (${id}.issues.length) {
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
newResult[${k}] = undefined;
|
|
955
|
-
}
|
|
956
|
-
} else {
|
|
1144
|
+
if (${id}.issues.length) {${prefixStr(id, k)}
|
|
1145
|
+
}
|
|
1146
|
+
`);
|
|
1147
|
+
if (optin === "defaulted") {
|
|
1148
|
+
doc.write(`newResult[${k}] = ${id}.value;`);
|
|
1149
|
+
}
|
|
1150
|
+
else {
|
|
1151
|
+
doc.write(`
|
|
1152
|
+
if (${id}.value !== undefined || ${isPresent}) {
|
|
957
1153
|
newResult[${k}] = ${id}.value;
|
|
958
1154
|
}
|
|
959
|
-
|
|
960
1155
|
`);
|
|
1156
|
+
}
|
|
961
1157
|
}
|
|
962
1158
|
}
|
|
963
1159
|
doc.write(`payload.value = newResult;`);
|
|
964
1160
|
doc.write(`return payload;`);
|
|
965
|
-
|
|
966
|
-
return (
|
|
1161
|
+
// closing `shape` in is what pays: turbofan specializes the parser against that one shape object, so every `shape[k]._zod.run` folds to a known callee. as a parameter it stays a generic load and measures 13% slower even with the forwarding frame gone
|
|
1162
|
+
return doc.compile();
|
|
967
1163
|
};
|
|
968
1164
|
let fastpass;
|
|
969
1165
|
const isObject = util.isObject;
|
|
@@ -991,7 +1187,7 @@ export const $ZodObjectJIT = /*@__PURE__*/ core.$constructor("$ZodObjectJIT", (i
|
|
|
991
1187
|
payload = fastpass(payload, ctx);
|
|
992
1188
|
if (!catchall)
|
|
993
1189
|
return payload;
|
|
994
|
-
return handleCatchall([], input, payload, ctx, value, inst);
|
|
1190
|
+
return handleCatchall([], input, payload, ctx, value, inst, ctx?.abortEarly === true);
|
|
995
1191
|
}
|
|
996
1192
|
return superParse(payload, ctx);
|
|
997
1193
|
};
|
|
@@ -1018,17 +1214,21 @@ function handleUnionResults(results, final, inst, ctx) {
|
|
|
1018
1214
|
}
|
|
1019
1215
|
export const $ZodUnion = /*@__PURE__*/ core.$constructor("$ZodUnion", (inst, def) => {
|
|
1020
1216
|
$ZodType.init(inst, def);
|
|
1021
|
-
util.
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1217
|
+
util.defineLazyInternal(inst, "optin", (zod) => zod.def.options.some((o) => o._zod.optin === "defaulted")
|
|
1218
|
+
? "defaulted"
|
|
1219
|
+
: zod.def.options.some((o) => o._zod.optin !== undefined)
|
|
1220
|
+
? "optional"
|
|
1221
|
+
: undefined);
|
|
1222
|
+
util.defineLazyInternal(inst, "optout", (zod) => zod.def.options.some((o) => o._zod.optout === "optional") ? "optional" : undefined);
|
|
1223
|
+
util.defineLazyInternal(inst, "values", (zod) => {
|
|
1224
|
+
if (zod.def.options.every((o) => o._zod.values)) {
|
|
1225
|
+
return new Set(zod.def.options.flatMap((option) => Array.from(option._zod.values)));
|
|
1026
1226
|
}
|
|
1027
1227
|
return undefined;
|
|
1028
1228
|
});
|
|
1029
|
-
util.
|
|
1030
|
-
if (def.options.every((o) => o._zod.pattern)) {
|
|
1031
|
-
const patterns = def.options.map((o) => o._zod.pattern);
|
|
1229
|
+
util.defineLazyInternal(inst, "pattern", (zod) => {
|
|
1230
|
+
if (zod.def.options.every((o) => o._zod.pattern)) {
|
|
1231
|
+
const patterns = zod.def.options.map((o) => o._zod.pattern);
|
|
1032
1232
|
return new RegExp(`^(${patterns.map((p) => util.cleanRegex(p.source)).join("|")})$`);
|
|
1033
1233
|
}
|
|
1034
1234
|
return undefined;
|
|
@@ -1063,12 +1263,16 @@ export const $ZodUnion = /*@__PURE__*/ core.$constructor("$ZodUnion", (inst, def
|
|
|
1063
1263
|
};
|
|
1064
1264
|
});
|
|
1065
1265
|
function handleExclusiveUnionResults(results, final, inst, ctx) {
|
|
1066
|
-
const
|
|
1067
|
-
|
|
1068
|
-
|
|
1266
|
+
const matches = [];
|
|
1267
|
+
for (let i = 0; i < results.length; i++) {
|
|
1268
|
+
if (results[i].issues.length === 0)
|
|
1269
|
+
matches.push(i);
|
|
1270
|
+
}
|
|
1271
|
+
if (matches.length === 1) {
|
|
1272
|
+
final.value = results[matches[0]].value;
|
|
1069
1273
|
return final;
|
|
1070
1274
|
}
|
|
1071
|
-
if (
|
|
1275
|
+
if (matches.length === 0) {
|
|
1072
1276
|
// No matches - same as regular union
|
|
1073
1277
|
final.issues.push({
|
|
1074
1278
|
code: "invalid_union",
|
|
@@ -1085,6 +1289,7 @@ function handleExclusiveUnionResults(results, final, inst, ctx) {
|
|
|
1085
1289
|
inst,
|
|
1086
1290
|
errors: [],
|
|
1087
1291
|
inclusive: false,
|
|
1292
|
+
matches,
|
|
1088
1293
|
});
|
|
1089
1294
|
}
|
|
1090
1295
|
return final;
|
|
@@ -1119,44 +1324,75 @@ export const $ZodXor = /*@__PURE__*/ core.$constructor("$ZodXor", (inst, def) =>
|
|
|
1119
1324
|
});
|
|
1120
1325
|
};
|
|
1121
1326
|
});
|
|
1327
|
+
/** Returns the option whose discriminator claims `value`, or throws if ambiguous. */
|
|
1328
|
+
export function getDiscriminatedOption(union, value) {
|
|
1329
|
+
const internals = union._zod;
|
|
1330
|
+
let map = internals.bag.optionsMap;
|
|
1331
|
+
if (!map) {
|
|
1332
|
+
map = discriminatorMap(internals.def);
|
|
1333
|
+
internals.bag.optionsMap = map;
|
|
1334
|
+
}
|
|
1335
|
+
const option = map.get(value);
|
|
1336
|
+
if (option === null)
|
|
1337
|
+
throw new Error(`Ambiguous discriminator value "${String(value)}"`);
|
|
1338
|
+
return option;
|
|
1339
|
+
}
|
|
1340
|
+
function discriminatorMap(def) {
|
|
1341
|
+
const map = new Map();
|
|
1342
|
+
for (const option of def.options) {
|
|
1343
|
+
const values = option._zod.propValues?.[def.discriminator];
|
|
1344
|
+
if (!values || values.size === 0)
|
|
1345
|
+
throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(option)}"`);
|
|
1346
|
+
for (const value of values) {
|
|
1347
|
+
if (map.has(value)) {
|
|
1348
|
+
if (value !== undefined)
|
|
1349
|
+
throw new Error(`Duplicate discriminator value "${String(value)}"`);
|
|
1350
|
+
// keep the collision marked so a later member cannot reclaim it
|
|
1351
|
+
map.set(value, null);
|
|
1352
|
+
}
|
|
1353
|
+
else {
|
|
1354
|
+
map.set(value, option);
|
|
1355
|
+
}
|
|
1356
|
+
}
|
|
1357
|
+
}
|
|
1358
|
+
return map;
|
|
1359
|
+
}
|
|
1122
1360
|
export const $ZodDiscriminatedUnion =
|
|
1123
1361
|
/*@__PURE__*/
|
|
1124
1362
|
core.$constructor("$ZodDiscriminatedUnion", (inst, def) => {
|
|
1125
1363
|
def.inclusive = false;
|
|
1126
1364
|
$ZodUnion.init(inst, def);
|
|
1127
1365
|
const _super = inst._zod.parse;
|
|
1128
|
-
util.
|
|
1366
|
+
util.defineLazyInternal(inst, "propValues", (zod) => {
|
|
1129
1367
|
const propValues = {};
|
|
1130
|
-
|
|
1368
|
+
let undefinedCount = 0;
|
|
1369
|
+
for (const option of zod.def.options) {
|
|
1131
1370
|
const pv = option._zod.propValues;
|
|
1132
1371
|
if (!pv || Object.keys(pv).length === 0)
|
|
1133
|
-
throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(option)}"`);
|
|
1372
|
+
throw new Error(`Invalid discriminated union option at index "${zod.def.options.indexOf(option)}"`);
|
|
1373
|
+
if (pv[zod.def.discriminator]?.has(undefined))
|
|
1374
|
+
undefinedCount++;
|
|
1134
1375
|
for (const [k, v] of Object.entries(pv)) {
|
|
1135
|
-
if (!propValues
|
|
1136
|
-
propValues
|
|
1376
|
+
if (!Object.prototype.hasOwnProperty.call(propValues, k)) {
|
|
1377
|
+
util.assignProp(propValues, k, new Set());
|
|
1378
|
+
}
|
|
1137
1379
|
for (const val of v) {
|
|
1138
1380
|
propValues[k].add(val);
|
|
1139
1381
|
}
|
|
1140
1382
|
}
|
|
1141
1383
|
}
|
|
1384
|
+
if (!zod.def.unionFallback && undefinedCount > 1)
|
|
1385
|
+
propValues[zod.def.discriminator]?.delete(undefined);
|
|
1142
1386
|
return propValues;
|
|
1143
1387
|
});
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
const
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
if (!values || values.size === 0)
|
|
1150
|
-
throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(o)}"`);
|
|
1151
|
-
for (const v of values) {
|
|
1152
|
-
if (map.has(v)) {
|
|
1153
|
-
throw new Error(`Duplicate discriminator value "${String(v)}"`);
|
|
1154
|
-
}
|
|
1155
|
-
map.set(v, o);
|
|
1156
|
-
}
|
|
1388
|
+
// Checked now rather than in the lookup map below, so an option that lacks the discriminator fails at the `discriminatedUnion` call instead of on the first object parsed. Options whose shape cannot be enumerated without resolving it — pipes and lazies — are left to the map.
|
|
1389
|
+
def.options.forEach((option, i) => {
|
|
1390
|
+
const propShape = util.rawShape(option._zod.def);
|
|
1391
|
+
if (propShape && !Object.prototype.hasOwnProperty.call(propShape, def.discriminator)) {
|
|
1392
|
+
throw new Error(`Invalid discriminated union option at index "${i}"`);
|
|
1157
1393
|
}
|
|
1158
|
-
return map;
|
|
1159
1394
|
});
|
|
1395
|
+
const disc = util.cached(() => discriminatorMap(def));
|
|
1160
1396
|
inst._zod.parse = (payload, ctx) => {
|
|
1161
1397
|
const input = payload.value;
|
|
1162
1398
|
if (!util.isObject(input)) {
|
|
@@ -1168,14 +1404,15 @@ core.$constructor("$ZodDiscriminatedUnion", (inst, def) => {
|
|
|
1168
1404
|
});
|
|
1169
1405
|
return payload;
|
|
1170
1406
|
}
|
|
1171
|
-
const
|
|
1172
|
-
|
|
1407
|
+
const value = input?.[def.discriminator];
|
|
1408
|
+
const opt = disc.value.get(value);
|
|
1409
|
+
// forward metadata cannot choose an encoder for an absent tag
|
|
1410
|
+
if (opt && (value !== undefined || ctx.direction !== "backward")) {
|
|
1173
1411
|
return opt._zod.run(payload, ctx);
|
|
1174
1412
|
}
|
|
1175
1413
|
// Fall back to union matching when the fast discriminator path fails:
|
|
1176
1414
|
// - explicitly enabled via unionFallback, or
|
|
1177
|
-
// - during backward direction (encode), since codec-based discriminators
|
|
1178
|
-
// have different values in forward vs backward directions
|
|
1415
|
+
// - during backward direction (encode), since codec-based discriminators have different values in forward vs backward directions
|
|
1179
1416
|
if (def.unionFallback || ctx.direction === "backward") {
|
|
1180
1417
|
return _super(payload, ctx);
|
|
1181
1418
|
}
|
|
@@ -1185,7 +1422,7 @@ core.$constructor("$ZodDiscriminatedUnion", (inst, def) => {
|
|
|
1185
1422
|
errors: [],
|
|
1186
1423
|
note: "No matching discriminator",
|
|
1187
1424
|
discriminator: def.discriminator,
|
|
1188
|
-
options: Array.from(disc.value.keys()),
|
|
1425
|
+
options: Array.from(disc.value.keys()).filter((value) => disc.value.get(value) !== null),
|
|
1189
1426
|
input,
|
|
1190
1427
|
path: [def.discriminator],
|
|
1191
1428
|
inst,
|
|
@@ -1208,7 +1445,7 @@ export const $ZodIntersection = /*@__PURE__*/ core.$constructor("$ZodIntersectio
|
|
|
1208
1445
|
return handleIntersectionResults(payload, left, right);
|
|
1209
1446
|
};
|
|
1210
1447
|
});
|
|
1211
|
-
function mergeValues(a, b) {
|
|
1448
|
+
export function mergeValues(a, b) {
|
|
1212
1449
|
// const aType = parse.t(a);
|
|
1213
1450
|
// const bType = parse.t(b);
|
|
1214
1451
|
if (a === b) {
|
|
@@ -1221,7 +1458,11 @@ function mergeValues(a, b) {
|
|
|
1221
1458
|
const bKeys = Object.keys(b);
|
|
1222
1459
|
const sharedKeys = Object.keys(a).filter((key) => bKeys.indexOf(key) !== -1);
|
|
1223
1460
|
const newObj = { ...a, ...b };
|
|
1461
|
+
if (Object.prototype.hasOwnProperty.call(newObj, "__proto__"))
|
|
1462
|
+
delete newObj.__proto__;
|
|
1224
1463
|
for (const key of sharedKeys) {
|
|
1464
|
+
if (key === "__proto__")
|
|
1465
|
+
continue;
|
|
1225
1466
|
const sharedValue = mergeValues(a[key], b[key]);
|
|
1226
1467
|
if (!sharedValue.valid) {
|
|
1227
1468
|
return {
|
|
@@ -1255,43 +1496,55 @@ function mergeValues(a, b) {
|
|
|
1255
1496
|
return { valid: false, mergeErrorPath: [] };
|
|
1256
1497
|
}
|
|
1257
1498
|
function handleIntersectionResults(result, left, right) {
|
|
1258
|
-
// Track which side(s)
|
|
1499
|
+
// Track which side(s) reject each key. A key rejection is reported only when BOTH sides reject it, so a key owned by one branch survives the other's key schema. strictObject reports these as unrecognized_keys; a record with an open key schema reports one invalid_key per key.
|
|
1259
1500
|
const unrecKeys = new Map();
|
|
1260
1501
|
let unrecIssue;
|
|
1261
|
-
|
|
1262
|
-
|
|
1502
|
+
const keyIssues = new Map();
|
|
1503
|
+
const collect = (iss, side) => {
|
|
1504
|
+
let keys;
|
|
1505
|
+
if (iss.code === "unrecognized_keys" && !iss.path?.length) {
|
|
1263
1506
|
unrecIssue ?? (unrecIssue = iss);
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1507
|
+
keys = iss.keys;
|
|
1508
|
+
}
|
|
1509
|
+
else if (iss.code === "invalid_key" && iss.origin === "record" && iss.path?.length === 1) {
|
|
1510
|
+
const k = String(iss.path[0]);
|
|
1511
|
+
if (!keyIssues.has(k))
|
|
1512
|
+
keyIssues.set(k, iss);
|
|
1513
|
+
keys = [k];
|
|
1269
1514
|
}
|
|
1270
1515
|
else {
|
|
1271
|
-
|
|
1516
|
+
return false;
|
|
1517
|
+
}
|
|
1518
|
+
for (const k of keys) {
|
|
1519
|
+
if (!unrecKeys.has(k))
|
|
1520
|
+
unrecKeys.set(k, {});
|
|
1521
|
+
unrecKeys.get(k)[side] = true;
|
|
1272
1522
|
}
|
|
1523
|
+
return true;
|
|
1524
|
+
};
|
|
1525
|
+
for (const iss of left.issues) {
|
|
1526
|
+
if (!collect(iss, "l"))
|
|
1527
|
+
result.issues.push(iss);
|
|
1273
1528
|
}
|
|
1274
1529
|
for (const iss of right.issues) {
|
|
1275
|
-
if (iss
|
|
1276
|
-
for (const k of iss.keys) {
|
|
1277
|
-
if (!unrecKeys.has(k))
|
|
1278
|
-
unrecKeys.set(k, {});
|
|
1279
|
-
unrecKeys.get(k).r = true;
|
|
1280
|
-
}
|
|
1281
|
-
}
|
|
1282
|
-
else {
|
|
1530
|
+
if (!collect(iss, "r"))
|
|
1283
1531
|
result.issues.push(iss);
|
|
1284
|
-
}
|
|
1285
1532
|
}
|
|
1286
|
-
// Report only keys
|
|
1533
|
+
// Report only keys rejected by BOTH sides
|
|
1287
1534
|
const bothKeys = [...unrecKeys].filter(([, f]) => f.l && f.r).map(([k]) => k);
|
|
1288
|
-
if (bothKeys.length
|
|
1289
|
-
|
|
1535
|
+
if (bothKeys.length) {
|
|
1536
|
+
const aggregated = unrecIssue ? bothKeys.filter((k) => unrecIssue.keys.includes(k)) : [];
|
|
1537
|
+
if (aggregated.length)
|
|
1538
|
+
result.issues.push({ ...unrecIssue, keys: aggregated });
|
|
1539
|
+
for (const k of bothKeys) {
|
|
1540
|
+
if (!aggregated.includes(k) && keyIssues.has(k))
|
|
1541
|
+
result.issues.push(keyIssues.get(k));
|
|
1542
|
+
}
|
|
1290
1543
|
}
|
|
1291
|
-
if (util.aborted(result))
|
|
1292
|
-
return result;
|
|
1293
1544
|
const merged = mergeValues(left.value, right.value);
|
|
1294
1545
|
if (!merged.valid) {
|
|
1546
|
+
if (util.aborted(result))
|
|
1547
|
+
return result;
|
|
1295
1548
|
throw new Error(`Unmergable intersection. Error path: ` + `${JSON.stringify(merged.mergeErrorPath)}`);
|
|
1296
1549
|
}
|
|
1297
1550
|
result.value = merged.data;
|
|
@@ -1300,6 +1553,8 @@ function handleIntersectionResults(result, left, right) {
|
|
|
1300
1553
|
export const $ZodTuple = /*@__PURE__*/ core.$constructor("$ZodTuple", (inst, def) => {
|
|
1301
1554
|
$ZodType.init(inst, def);
|
|
1302
1555
|
const items = def.items;
|
|
1556
|
+
const memo = core.globalConfig.memoizer;
|
|
1557
|
+
memo?.attach(inst);
|
|
1303
1558
|
inst._zod.parse = (payload, ctx) => {
|
|
1304
1559
|
const input = payload.value;
|
|
1305
1560
|
if (!Array.isArray(input)) {
|
|
@@ -1311,7 +1566,7 @@ export const $ZodTuple = /*@__PURE__*/ core.$constructor("$ZodTuple", (inst, def
|
|
|
1311
1566
|
});
|
|
1312
1567
|
return payload;
|
|
1313
1568
|
}
|
|
1314
|
-
payload.value = [];
|
|
1569
|
+
payload.value = memo ? memo.alloc(inst, payload, [], ctx) : [];
|
|
1315
1570
|
const proms = [];
|
|
1316
1571
|
const optinStart = getTupleOptStart(items, "optin");
|
|
1317
1572
|
const optoutStart = getTupleOptStart(items, "optout");
|
|
@@ -1338,11 +1593,11 @@ export const $ZodTuple = /*@__PURE__*/ core.$constructor("$ZodTuple", (inst, def
|
|
|
1338
1593
|
});
|
|
1339
1594
|
}
|
|
1340
1595
|
}
|
|
1341
|
-
// Run every item in parallel, collecting results into an indexed
|
|
1342
|
-
// array. The post-processing in `handleTupleResults` walks them in
|
|
1343
|
-
// order so it can decide whether an absent optional-output error can
|
|
1344
|
-
// truncate the tail or must be reported to preserve required output.
|
|
1596
|
+
// Run every item in parallel, collecting results into an indexed array. The post-processing in `handleTupleResults` walks them in order so it can decide whether an absent optional-output error can truncate the tail or must be reported to preserve required output.
|
|
1345
1597
|
const itemResults = new Array(items.length);
|
|
1598
|
+
// only tracked when there is a rest loop to skip
|
|
1599
|
+
const abortEarly = def.rest ? ctx?.abortEarly : undefined;
|
|
1600
|
+
let itemAborted = false;
|
|
1346
1601
|
for (let i = 0; i < items.length; i++) {
|
|
1347
1602
|
const r = items[i]._zod.run({ value: input[i], issues: [] }, ctx);
|
|
1348
1603
|
if (r instanceof Promise) {
|
|
@@ -1352,12 +1607,21 @@ export const $ZodTuple = /*@__PURE__*/ core.$constructor("$ZodTuple", (inst, def
|
|
|
1352
1607
|
}
|
|
1353
1608
|
else {
|
|
1354
1609
|
itemResults[i] = r;
|
|
1610
|
+
if (abortEarly && !itemAborted && r.issues.length)
|
|
1611
|
+
itemAborted = util.aborted(r);
|
|
1355
1612
|
}
|
|
1356
1613
|
}
|
|
1357
|
-
|
|
1614
|
+
// sound because rest is non-empty exactly when every fixed index is present, the one case handleTupleResults cannot discard an item's issues
|
|
1615
|
+
if (def.rest && !itemAborted) {
|
|
1358
1616
|
let i = items.length - 1;
|
|
1359
1617
|
const rest = input.slice(items.length);
|
|
1618
|
+
let seen = payload.issues.length;
|
|
1360
1619
|
for (const el of rest) {
|
|
1620
|
+
if (abortEarly && payload.issues.length !== seen) {
|
|
1621
|
+
if (util.aborted(payload, seen))
|
|
1622
|
+
break;
|
|
1623
|
+
seen = payload.issues.length;
|
|
1624
|
+
}
|
|
1361
1625
|
i++;
|
|
1362
1626
|
const result = def.rest._zod.run({ value: el, issues: [] }, ctx);
|
|
1363
1627
|
if (result instanceof Promise) {
|
|
@@ -1376,7 +1640,9 @@ export const $ZodTuple = /*@__PURE__*/ core.$constructor("$ZodTuple", (inst, def
|
|
|
1376
1640
|
});
|
|
1377
1641
|
function getTupleOptStart(items, key) {
|
|
1378
1642
|
for (let i = items.length - 1; i >= 0; i--) {
|
|
1379
|
-
|
|
1643
|
+
// optin is a three-rung ladder so any rung above `undefined` permits an absent slot; optout stays two-valued.
|
|
1644
|
+
const omittable = key === "optin" ? items[i]._zod.optin !== undefined : items[i]._zod.optout === "optional";
|
|
1645
|
+
if (!omittable)
|
|
1380
1646
|
return i + 1;
|
|
1381
1647
|
}
|
|
1382
1648
|
return 0;
|
|
@@ -1388,12 +1654,15 @@ function handleTupleResult(result, final, index) {
|
|
|
1388
1654
|
final.value[index] = result.value;
|
|
1389
1655
|
}
|
|
1390
1656
|
function handleTupleResults(itemResults, final, items, input, optoutStart) {
|
|
1391
|
-
// Walk results in order. Mirror $ZodObject's swallow-on-absent-optional
|
|
1392
|
-
// rule, but only after `optoutStart`: the first index where the output
|
|
1393
|
-
// tuple tail can be absent.
|
|
1657
|
+
// Walk results in order. Mirror $ZodObject's swallow-on-absent-optional rule, but only after `optoutStart`: the first index where the output tuple tail can be absent.
|
|
1394
1658
|
for (let i = 0; i < items.length; i++) {
|
|
1395
1659
|
const r = itemResults[i];
|
|
1396
1660
|
const isPresent = i < input.length;
|
|
1661
|
+
// The array analog of `handlePropertyResult`'s absent-key early return: the middle rung permits absence without supplying anything in its place, so the tail truncates here instead of materializing whatever the item made of `undefined`.
|
|
1662
|
+
if (!isPresent && i >= optoutStart && items[i]._zod.optin === "optional") {
|
|
1663
|
+
final.value.length = i;
|
|
1664
|
+
break;
|
|
1665
|
+
}
|
|
1397
1666
|
if (r.issues.length) {
|
|
1398
1667
|
if (!isPresent && i >= optoutStart) {
|
|
1399
1668
|
final.value.length = i;
|
|
@@ -1421,6 +1690,8 @@ function handleTupleResults(itemResults, final, items, input, optoutStart) {
|
|
|
1421
1690
|
}
|
|
1422
1691
|
export const $ZodRecord = /*@__PURE__*/ core.$constructor("$ZodRecord", (inst, def) => {
|
|
1423
1692
|
$ZodType.init(inst, def);
|
|
1693
|
+
const memo = core.globalConfig.memoizer;
|
|
1694
|
+
memo?.attach(inst);
|
|
1424
1695
|
inst._zod.parse = (payload, ctx) => {
|
|
1425
1696
|
const input = payload.value;
|
|
1426
1697
|
if (!util.isPlainObject(input)) {
|
|
@@ -1432,14 +1703,18 @@ export const $ZodRecord = /*@__PURE__*/ core.$constructor("$ZodRecord", (inst, d
|
|
|
1432
1703
|
});
|
|
1433
1704
|
return payload;
|
|
1434
1705
|
}
|
|
1706
|
+
// no guard in either loop below: a record's invalid_key aborts but an enclosing intersection can reconcile it, so a stopped loop hides keys the sibling does not own and the intersection then rejects nothing
|
|
1435
1707
|
const proms = [];
|
|
1436
1708
|
const values = def.keyType._zod.values;
|
|
1437
|
-
if (values) {
|
|
1438
|
-
payload.value = {};
|
|
1709
|
+
if (values && !def.partial) {
|
|
1710
|
+
payload.value = memo ? memo.alloc(inst, payload, {}, ctx) : {};
|
|
1439
1711
|
const recordKeys = new Set();
|
|
1440
1712
|
for (const key of values) {
|
|
1441
1713
|
if (typeof key === "string" || typeof key === "number" || typeof key === "symbol") {
|
|
1442
1714
|
recordKeys.add(typeof key === "number" ? key.toString() : key);
|
|
1715
|
+
// A declared __proto__ is stripped but is not an unrecognized key.
|
|
1716
|
+
if (key === "__proto__")
|
|
1717
|
+
continue;
|
|
1443
1718
|
const keyResult = def.keyType._zod.run({ value: key, issues: [] }, ctx);
|
|
1444
1719
|
if (keyResult instanceof Promise) {
|
|
1445
1720
|
throw new Error("Async schemas not supported in object keys currently");
|
|
@@ -1456,6 +1731,8 @@ export const $ZodRecord = /*@__PURE__*/ core.$constructor("$ZodRecord", (inst, d
|
|
|
1456
1731
|
continue;
|
|
1457
1732
|
}
|
|
1458
1733
|
const outKey = keyResult.value;
|
|
1734
|
+
if (outKey === "__proto__")
|
|
1735
|
+
continue;
|
|
1459
1736
|
const result = def.valueType._zod.run({ value: input[key], issues: [] }, ctx);
|
|
1460
1737
|
if (result instanceof Promise) {
|
|
1461
1738
|
proms.push(result.then((result) => {
|
|
@@ -1476,8 +1753,16 @@ export const $ZodRecord = /*@__PURE__*/ core.$constructor("$ZodRecord", (inst, d
|
|
|
1476
1753
|
let unrecognized;
|
|
1477
1754
|
for (const key in input) {
|
|
1478
1755
|
if (!recordKeys.has(key)) {
|
|
1479
|
-
|
|
1480
|
-
|
|
1756
|
+
if (def.mode === "loose") {
|
|
1757
|
+
// skip __proto__ so it can't replace the result prototype via the assignment setter on the plain {} we build into
|
|
1758
|
+
if (key === "__proto__")
|
|
1759
|
+
continue;
|
|
1760
|
+
payload.value[key] = input[key];
|
|
1761
|
+
}
|
|
1762
|
+
else {
|
|
1763
|
+
unrecognized = unrecognized ?? [];
|
|
1764
|
+
unrecognized.push(key);
|
|
1765
|
+
}
|
|
1481
1766
|
}
|
|
1482
1767
|
}
|
|
1483
1768
|
if (unrecognized && unrecognized.length > 0) {
|
|
@@ -1486,11 +1771,14 @@ export const $ZodRecord = /*@__PURE__*/ core.$constructor("$ZodRecord", (inst, d
|
|
|
1486
1771
|
input,
|
|
1487
1772
|
inst,
|
|
1488
1773
|
keys: unrecognized,
|
|
1774
|
+
continue: true,
|
|
1489
1775
|
});
|
|
1490
1776
|
}
|
|
1491
1777
|
}
|
|
1492
1778
|
else {
|
|
1493
|
-
payload.value = {};
|
|
1779
|
+
payload.value = memo ? memo.alloc(inst, payload, {}, ctx) : {};
|
|
1780
|
+
// An enumerable key schema declares which keys the record owns, so a key outside the set is unrecognized. A non-enumerable one (regex, refine) is a constraint every key must satisfy, so a failing key is invalid. Only the former is reconcilable against the other side of an intersection.
|
|
1781
|
+
let unrecognized;
|
|
1494
1782
|
// Reflect.ownKeys for Symbol-key support; filter non-enumerable to match z.object()
|
|
1495
1783
|
for (const key of Reflect.ownKeys(input)) {
|
|
1496
1784
|
if (key === "__proto__")
|
|
@@ -1501,8 +1789,7 @@ export const $ZodRecord = /*@__PURE__*/ core.$constructor("$ZodRecord", (inst, d
|
|
|
1501
1789
|
if (keyResult instanceof Promise) {
|
|
1502
1790
|
throw new Error("Async schemas not supported in object keys currently");
|
|
1503
1791
|
}
|
|
1504
|
-
// Numeric string fallback: if key is a numeric string and failed, retry with Number(key)
|
|
1505
|
-
// This handles z.number(), z.literal([1, 2, 3]), and unions containing numeric literals
|
|
1792
|
+
// Numeric string fallback: if key is a numeric string and failed, retry with Number(key). This handles z.number(), z.literal([1, 2, 3]), and unions containing numeric literals
|
|
1506
1793
|
const checkNumericKey = typeof key === "string" && regexes.number.test(key) && keyResult.issues.length;
|
|
1507
1794
|
if (checkNumericKey) {
|
|
1508
1795
|
const retryResult = def.keyType._zod.run({ value: Number(key), issues: [] }, ctx);
|
|
@@ -1518,6 +1805,10 @@ export const $ZodRecord = /*@__PURE__*/ core.$constructor("$ZodRecord", (inst, d
|
|
|
1518
1805
|
// Pass through unchanged
|
|
1519
1806
|
payload.value[key] = input[key];
|
|
1520
1807
|
}
|
|
1808
|
+
else if (values) {
|
|
1809
|
+
unrecognized = unrecognized ?? [];
|
|
1810
|
+
unrecognized.push(key);
|
|
1811
|
+
}
|
|
1521
1812
|
else {
|
|
1522
1813
|
// Default "strict" behavior: error on invalid key
|
|
1523
1814
|
payload.issues.push({
|
|
@@ -1531,22 +1822,35 @@ export const $ZodRecord = /*@__PURE__*/ core.$constructor("$ZodRecord", (inst, d
|
|
|
1531
1822
|
}
|
|
1532
1823
|
continue;
|
|
1533
1824
|
}
|
|
1825
|
+
// the guard above tests the raw input key, but the key schema can normalize an ordinary key into __proto__; re-check the key we actually write under
|
|
1826
|
+
const outKey = keyResult.value;
|
|
1827
|
+
if (outKey === "__proto__")
|
|
1828
|
+
continue;
|
|
1534
1829
|
const result = def.valueType._zod.run({ value: input[key], issues: [] }, ctx);
|
|
1535
1830
|
if (result instanceof Promise) {
|
|
1536
1831
|
proms.push(result.then((result) => {
|
|
1537
1832
|
if (result.issues.length) {
|
|
1538
1833
|
payload.issues.push(...util.prefixIssues(key, result.issues));
|
|
1539
1834
|
}
|
|
1540
|
-
payload.value[
|
|
1835
|
+
payload.value[outKey] = result.value;
|
|
1541
1836
|
}));
|
|
1542
1837
|
}
|
|
1543
1838
|
else {
|
|
1544
1839
|
if (result.issues.length) {
|
|
1545
1840
|
payload.issues.push(...util.prefixIssues(key, result.issues));
|
|
1546
1841
|
}
|
|
1547
|
-
payload.value[
|
|
1842
|
+
payload.value[outKey] = result.value;
|
|
1548
1843
|
}
|
|
1549
1844
|
}
|
|
1845
|
+
if (unrecognized && unrecognized.length > 0) {
|
|
1846
|
+
payload.issues.push({
|
|
1847
|
+
code: "unrecognized_keys",
|
|
1848
|
+
input,
|
|
1849
|
+
inst,
|
|
1850
|
+
keys: unrecognized,
|
|
1851
|
+
continue: true,
|
|
1852
|
+
});
|
|
1853
|
+
}
|
|
1550
1854
|
}
|
|
1551
1855
|
if (proms.length) {
|
|
1552
1856
|
return Promise.all(proms).then(() => payload);
|
|
@@ -1556,6 +1860,8 @@ export const $ZodRecord = /*@__PURE__*/ core.$constructor("$ZodRecord", (inst, d
|
|
|
1556
1860
|
});
|
|
1557
1861
|
export const $ZodMap = /*@__PURE__*/ core.$constructor("$ZodMap", (inst, def) => {
|
|
1558
1862
|
$ZodType.init(inst, def);
|
|
1863
|
+
const memo = core.globalConfig.memoizer;
|
|
1864
|
+
memo?.attach(inst);
|
|
1559
1865
|
inst._zod.parse = (payload, ctx) => {
|
|
1560
1866
|
const input = payload.value;
|
|
1561
1867
|
if (!(input instanceof Map)) {
|
|
@@ -1568,8 +1874,15 @@ export const $ZodMap = /*@__PURE__*/ core.$constructor("$ZodMap", (inst, def) =>
|
|
|
1568
1874
|
return payload;
|
|
1569
1875
|
}
|
|
1570
1876
|
const proms = [];
|
|
1571
|
-
payload.value = new Map();
|
|
1877
|
+
payload.value = memo ? memo.alloc(inst, payload, new Map(), ctx) : new Map();
|
|
1878
|
+
const abortEarly = ctx?.abortEarly;
|
|
1879
|
+
let seen = payload.issues.length;
|
|
1572
1880
|
for (const [key, value] of input) {
|
|
1881
|
+
if (abortEarly && payload.issues.length !== seen) {
|
|
1882
|
+
if (util.aborted(payload, seen))
|
|
1883
|
+
break;
|
|
1884
|
+
seen = payload.issues.length;
|
|
1885
|
+
}
|
|
1573
1886
|
const keyResult = def.keyType._zod.run({ value: key, issues: [] }, ctx);
|
|
1574
1887
|
const valueResult = def.valueType._zod.run({ value: value, issues: [] }, ctx);
|
|
1575
1888
|
if (keyResult instanceof Promise || valueResult instanceof Promise) {
|
|
@@ -1620,6 +1933,8 @@ function handleMapResult(keyResult, valueResult, final, key, input, inst, ctx) {
|
|
|
1620
1933
|
}
|
|
1621
1934
|
export const $ZodSet = /*@__PURE__*/ core.$constructor("$ZodSet", (inst, def) => {
|
|
1622
1935
|
$ZodType.init(inst, def);
|
|
1936
|
+
const memo = core.globalConfig.memoizer;
|
|
1937
|
+
memo?.attach(inst);
|
|
1623
1938
|
inst._zod.parse = (payload, ctx) => {
|
|
1624
1939
|
const input = payload.value;
|
|
1625
1940
|
if (!(input instanceof Set)) {
|
|
@@ -1632,8 +1947,15 @@ export const $ZodSet = /*@__PURE__*/ core.$constructor("$ZodSet", (inst, def) =>
|
|
|
1632
1947
|
return payload;
|
|
1633
1948
|
}
|
|
1634
1949
|
const proms = [];
|
|
1635
|
-
payload.value = new Set();
|
|
1950
|
+
payload.value = memo ? memo.alloc(inst, payload, new Set(), ctx) : new Set();
|
|
1951
|
+
const abortEarly = ctx?.abortEarly;
|
|
1952
|
+
let seen = payload.issues.length;
|
|
1636
1953
|
for (const item of input) {
|
|
1954
|
+
if (abortEarly && payload.issues.length !== seen) {
|
|
1955
|
+
if (util.aborted(payload, seen))
|
|
1956
|
+
break;
|
|
1957
|
+
seen = payload.issues.length;
|
|
1958
|
+
}
|
|
1637
1959
|
const result = def.valueType._zod.run({ value: item, issues: [] }, ctx);
|
|
1638
1960
|
if (result instanceof Promise) {
|
|
1639
1961
|
proms.push(result.then((result) => handleSetResult(result, payload)));
|
|
@@ -1657,10 +1979,11 @@ export const $ZodEnum = /*@__PURE__*/ core.$constructor("$ZodEnum", (inst, def)
|
|
|
1657
1979
|
const values = util.getEnumValues(def.entries);
|
|
1658
1980
|
const valuesSet = new Set(values);
|
|
1659
1981
|
inst._zod.values = valuesSet;
|
|
1660
|
-
inst
|
|
1661
|
-
.filter((k) => util.propertyKeyTypes.has(typeof k))
|
|
1662
|
-
|
|
1663
|
-
.join("|")})$`);
|
|
1982
|
+
util.defineLazyInternal(inst, "pattern", (zod) => {
|
|
1983
|
+
const patternValues = util.getEnumValues(zod.def.entries).filter((k) => util.propertyKeyTypes.has(typeof k));
|
|
1984
|
+
// unmatchable fallback, RE2-safe: an empty alternation would compile to /^()$/, which matches ""
|
|
1985
|
+
return new RegExp(patternValues.length ? `^(${patternValues.map((o) => util.escapeRegex(o.toString())).join("|")})$` : "^[^\\s\\S]$");
|
|
1986
|
+
});
|
|
1664
1987
|
inst._zod.parse = (payload, _ctx) => {
|
|
1665
1988
|
const input = payload.value;
|
|
1666
1989
|
if (valuesSet.has(input)) {
|
|
@@ -1677,14 +2000,17 @@ export const $ZodEnum = /*@__PURE__*/ core.$constructor("$ZodEnum", (inst, def)
|
|
|
1677
2000
|
});
|
|
1678
2001
|
export const $ZodLiteral = /*@__PURE__*/ core.$constructor("$ZodLiteral", (inst, def) => {
|
|
1679
2002
|
$ZodType.init(inst, def);
|
|
1680
|
-
if (def.values.length === 0) {
|
|
1681
|
-
throw new Error("Cannot create literal schema with no valid values");
|
|
1682
|
-
}
|
|
1683
2003
|
const values = new Set(def.values);
|
|
1684
2004
|
inst._zod.values = values;
|
|
1685
|
-
inst
|
|
1686
|
-
|
|
1687
|
-
|
|
2005
|
+
util.defineLazyInternal(inst, "pattern", (zod) => {
|
|
2006
|
+
const vals = zod.def.values;
|
|
2007
|
+
// unmatchable fallback, RE2-safe: an empty alternation would compile to /^()$/, which matches ""
|
|
2008
|
+
return new RegExp(vals.length
|
|
2009
|
+
? `^(${vals
|
|
2010
|
+
.map((o) => typeof o === "string" ? util.escapeRegex(o) : o ? util.escapeRegex(o.toString()) : String(o))
|
|
2011
|
+
.join("|")})$`
|
|
2012
|
+
: "^[^\\s\\S]$");
|
|
2013
|
+
});
|
|
1688
2014
|
inst._zod.parse = (payload, _ctx) => {
|
|
1689
2015
|
const input = payload.value;
|
|
1690
2016
|
if (values.has(input)) {
|
|
@@ -1718,6 +2044,7 @@ export const $ZodFile = /*@__PURE__*/ core.$constructor("$ZodFile", (inst, def)
|
|
|
1718
2044
|
export const $ZodTransform = /*@__PURE__*/ core.$constructor("$ZodTransform", (inst, def) => {
|
|
1719
2045
|
$ZodType.init(inst, def);
|
|
1720
2046
|
inst._zod.optin = "optional";
|
|
2047
|
+
core.globalConfig.memoizer?.guard(inst);
|
|
1721
2048
|
inst._zod.parse = (payload, ctx) => {
|
|
1722
2049
|
if (ctx.direction === "backward") {
|
|
1723
2050
|
throw new core.$ZodEncodeError(inst.constructor.name);
|
|
@@ -1727,7 +2054,6 @@ export const $ZodTransform = /*@__PURE__*/ core.$constructor("$ZodTransform", (i
|
|
|
1727
2054
|
const output = _out instanceof Promise ? _out : Promise.resolve(_out);
|
|
1728
2055
|
return output.then((output) => {
|
|
1729
2056
|
payload.value = output;
|
|
1730
|
-
payload.fallback = true;
|
|
1731
2057
|
return payload;
|
|
1732
2058
|
});
|
|
1733
2059
|
}
|
|
@@ -1735,37 +2061,37 @@ export const $ZodTransform = /*@__PURE__*/ core.$constructor("$ZodTransform", (i
|
|
|
1735
2061
|
throw new core.$ZodAsyncError();
|
|
1736
2062
|
}
|
|
1737
2063
|
payload.value = _out;
|
|
1738
|
-
payload.fallback = true;
|
|
1739
2064
|
return payload;
|
|
1740
2065
|
};
|
|
1741
2066
|
});
|
|
1742
|
-
function handleOptionalResult(
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
return result;
|
|
2067
|
+
function handleOptionalResult(payload, result) {
|
|
2068
|
+
// A substituting schema that still failed has no usable answer; yield undefined. Its issues are simply dropped: it ran on a payload of its own, so there is no shared array to truncate and nothing of the caller's to lose with it.
|
|
2069
|
+
payload.value = result.issues.length ? undefined : result.value;
|
|
2070
|
+
return payload;
|
|
1747
2071
|
}
|
|
1748
2072
|
export const $ZodOptional = /*@__PURE__*/ core.$constructor("$ZodOptional", (inst, def) => {
|
|
1749
2073
|
$ZodType.init(inst, def);
|
|
1750
|
-
|
|
2074
|
+
// .optional() propagates absence rather than substituting for it, so a defaulted inner keeps its rung.
|
|
2075
|
+
util.defineLazyInternal(inst, "optin", (zod) => zod.def.innerType._zod.optin === "defaulted" ? "defaulted" : "optional");
|
|
1751
2076
|
inst._zod.optout = "optional";
|
|
1752
|
-
util.
|
|
1753
|
-
|
|
2077
|
+
util.defineLazyInternal(inst, "values", (zod) => {
|
|
2078
|
+
const values = zod.def.innerType._zod.values;
|
|
2079
|
+
return values ? new Set([...values, undefined]) : undefined;
|
|
1754
2080
|
});
|
|
1755
|
-
util.
|
|
1756
|
-
const pattern = def.innerType._zod.pattern;
|
|
2081
|
+
util.defineLazyInternal(inst, "pattern", (zod) => {
|
|
2082
|
+
const pattern = zod.def.innerType._zod.pattern;
|
|
1757
2083
|
return pattern ? new RegExp(`^(${util.cleanRegex(pattern.source)})?$`) : undefined;
|
|
1758
2084
|
});
|
|
1759
2085
|
inst._zod.parse = (payload, ctx) => {
|
|
1760
|
-
if (def.innerType._zod.optin === "optional") {
|
|
1761
|
-
const input = payload.value;
|
|
1762
|
-
const result = def.innerType._zod.run(payload, ctx);
|
|
1763
|
-
if (result instanceof Promise)
|
|
1764
|
-
return result.then((r) => handleOptionalResult(r, input));
|
|
1765
|
-
return handleOptionalResult(result, input);
|
|
1766
|
-
}
|
|
1767
2086
|
if (payload.value === undefined) {
|
|
1768
|
-
|
|
2087
|
+
// Only the top rung substitutes a value for absence; everything else leaves it intact, which is what .optional() means.
|
|
2088
|
+
if (def.innerType._zod.optin !== "defaulted")
|
|
2089
|
+
return payload;
|
|
2090
|
+
// Its own payload, for the same reason $ZodCatch gets one: a pipe forwards an unrecognized key through the caller's issues array, and this must not read that as the substituting schema failing and drop it.
|
|
2091
|
+
const result = def.innerType._zod.run({ value: payload.value, issues: [] }, ctx);
|
|
2092
|
+
if (result instanceof Promise)
|
|
2093
|
+
return result.then((result) => handleOptionalResult(payload, result));
|
|
2094
|
+
return handleOptionalResult(payload, result);
|
|
1769
2095
|
}
|
|
1770
2096
|
return def.innerType._zod.run(payload, ctx);
|
|
1771
2097
|
};
|
|
@@ -1774,8 +2100,8 @@ export const $ZodExactOptional = /*@__PURE__*/ core.$constructor("$ZodExactOptio
|
|
|
1774
2100
|
// Call parent init - inherits optin/optout = "optional"
|
|
1775
2101
|
$ZodOptional.init(inst, def);
|
|
1776
2102
|
// Override values/pattern to NOT add undefined
|
|
1777
|
-
util.
|
|
1778
|
-
util.
|
|
2103
|
+
util.defineLazyInternal(inst, "values", (zod) => zod.def.innerType._zod.values);
|
|
2104
|
+
util.defineLazyInternal(inst, "pattern", (zod) => zod.def.innerType._zod.pattern);
|
|
1779
2105
|
// Override parse to just delegate (no undefined handling)
|
|
1780
2106
|
inst._zod.parse = (payload, ctx) => {
|
|
1781
2107
|
return def.innerType._zod.run(payload, ctx);
|
|
@@ -1783,14 +2109,14 @@ export const $ZodExactOptional = /*@__PURE__*/ core.$constructor("$ZodExactOptio
|
|
|
1783
2109
|
});
|
|
1784
2110
|
export const $ZodNullable = /*@__PURE__*/ core.$constructor("$ZodNullable", (inst, def) => {
|
|
1785
2111
|
$ZodType.init(inst, def);
|
|
1786
|
-
util.
|
|
1787
|
-
util.
|
|
1788
|
-
util.
|
|
1789
|
-
const pattern = def.innerType._zod.pattern;
|
|
2112
|
+
util.defineLazyInternal(inst, "optin", (zod) => zod.def.innerType._zod.optin);
|
|
2113
|
+
util.defineLazyInternal(inst, "optout", (zod) => zod.def.innerType._zod.optout);
|
|
2114
|
+
util.defineLazyInternal(inst, "pattern", (zod) => {
|
|
2115
|
+
const pattern = zod.def.innerType._zod.pattern;
|
|
1790
2116
|
return pattern ? new RegExp(`^(${util.cleanRegex(pattern.source)}|null)$`) : undefined;
|
|
1791
2117
|
});
|
|
1792
|
-
util.
|
|
1793
|
-
return def.innerType._zod.values ? new Set([...def.innerType._zod.values, null]) : undefined;
|
|
2118
|
+
util.defineLazyInternal(inst, "values", (zod) => {
|
|
2119
|
+
return zod.def.innerType._zod.values ? new Set([...zod.def.innerType._zod.values, null]) : undefined;
|
|
1794
2120
|
});
|
|
1795
2121
|
inst._zod.parse = (payload, ctx) => {
|
|
1796
2122
|
// Forward direction (decode): allow null to pass through
|
|
@@ -1802,8 +2128,8 @@ export const $ZodNullable = /*@__PURE__*/ core.$constructor("$ZodNullable", (ins
|
|
|
1802
2128
|
export const $ZodDefault = /*@__PURE__*/ core.$constructor("$ZodDefault", (inst, def) => {
|
|
1803
2129
|
$ZodType.init(inst, def);
|
|
1804
2130
|
// inst._zod.qin = "true";
|
|
1805
|
-
inst._zod.optin = "
|
|
1806
|
-
util.
|
|
2131
|
+
inst._zod.optin = "defaulted";
|
|
2132
|
+
util.defineLazyInternal(inst, "values", (zod) => zod.def.innerType._zod.values);
|
|
1807
2133
|
inst._zod.parse = (payload, ctx) => {
|
|
1808
2134
|
if (ctx.direction === "backward") {
|
|
1809
2135
|
return def.innerType._zod.run(payload, ctx);
|
|
@@ -1832,8 +2158,8 @@ function handleDefaultResult(payload, def) {
|
|
|
1832
2158
|
}
|
|
1833
2159
|
export const $ZodPrefault = /*@__PURE__*/ core.$constructor("$ZodPrefault", (inst, def) => {
|
|
1834
2160
|
$ZodType.init(inst, def);
|
|
1835
|
-
inst._zod.optin = "
|
|
1836
|
-
util.
|
|
2161
|
+
inst._zod.optin = "defaulted";
|
|
2162
|
+
util.defineLazyInternal(inst, "values", (zod) => zod.def.innerType._zod.values);
|
|
1837
2163
|
inst._zod.parse = (payload, ctx) => {
|
|
1838
2164
|
if (ctx.direction === "backward") {
|
|
1839
2165
|
return def.innerType._zod.run(payload, ctx);
|
|
@@ -1847,8 +2173,8 @@ export const $ZodPrefault = /*@__PURE__*/ core.$constructor("$ZodPrefault", (ins
|
|
|
1847
2173
|
});
|
|
1848
2174
|
export const $ZodNonOptional = /*@__PURE__*/ core.$constructor("$ZodNonOptional", (inst, def) => {
|
|
1849
2175
|
$ZodType.init(inst, def);
|
|
1850
|
-
util.
|
|
1851
|
-
const v = def.innerType._zod.values;
|
|
2176
|
+
util.defineLazyInternal(inst, "values", (zod) => {
|
|
2177
|
+
const v = zod.def.innerType._zod.values;
|
|
1852
2178
|
return v ? new Set([...v].filter((x) => x !== undefined)) : undefined;
|
|
1853
2179
|
});
|
|
1854
2180
|
inst._zod.parse = (payload, ctx) => {
|
|
@@ -1887,47 +2213,40 @@ export const $ZodSuccess = /*@__PURE__*/ core.$constructor("$ZodSuccess", (inst,
|
|
|
1887
2213
|
return payload;
|
|
1888
2214
|
};
|
|
1889
2215
|
});
|
|
2216
|
+
function handleCatchResult(payload, result, def, ctx) {
|
|
2217
|
+
if (!result.issues.length) {
|
|
2218
|
+
payload.value = result.value;
|
|
2219
|
+
// The value carries up, so the flag describing it has to carry with it: a back-edge into a node still being parsed must not be frozen by an enclosing readonly, and its checks belong to the node itself. Guarded so the ordinary case adds no own property.
|
|
2220
|
+
if (result.memo)
|
|
2221
|
+
payload.memo = true;
|
|
2222
|
+
return payload;
|
|
2223
|
+
}
|
|
2224
|
+
// Spread the inner's own payload, not ours: `value` has to stay the input the catch was handed, and the inner ran on a payload of its own so its issues are already private to this call.
|
|
2225
|
+
payload.value = def.catchValue({
|
|
2226
|
+
...result,
|
|
2227
|
+
value: payload.value,
|
|
2228
|
+
error: {
|
|
2229
|
+
issues: result.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config())),
|
|
2230
|
+
},
|
|
2231
|
+
input: payload.value,
|
|
2232
|
+
});
|
|
2233
|
+
return payload;
|
|
2234
|
+
}
|
|
1890
2235
|
export const $ZodCatch = /*@__PURE__*/ core.$constructor("$ZodCatch", (inst, def) => {
|
|
1891
2236
|
$ZodType.init(inst, def);
|
|
1892
|
-
inst._zod.optin
|
|
1893
|
-
util.
|
|
1894
|
-
util.
|
|
2237
|
+
util.defineLazyInternal(inst, "optin", (zod) => zod.def.innerType._zod.optin === "defaulted" ? "defaulted" : "optional");
|
|
2238
|
+
util.defineLazyInternal(inst, "optout", (zod) => zod.def.innerType._zod.optout);
|
|
2239
|
+
util.defineLazyInternal(inst, "values", (zod) => zod.def.innerType._zod.values);
|
|
1895
2240
|
inst._zod.parse = (payload, ctx) => {
|
|
1896
2241
|
if (ctx.direction === "backward") {
|
|
1897
2242
|
return def.innerType._zod.run(payload, ctx);
|
|
1898
2243
|
}
|
|
1899
2244
|
// Forward direction (decode): apply catch logic
|
|
1900
|
-
const result = def.innerType._zod.run(payload, ctx);
|
|
2245
|
+
const result = def.innerType._zod.run({ value: payload.value, issues: [] }, ctx);
|
|
1901
2246
|
if (result instanceof Promise) {
|
|
1902
|
-
return result.then((result) =>
|
|
1903
|
-
payload.value = result.value;
|
|
1904
|
-
if (result.issues.length) {
|
|
1905
|
-
payload.value = def.catchValue({
|
|
1906
|
-
...payload,
|
|
1907
|
-
error: {
|
|
1908
|
-
issues: result.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config())),
|
|
1909
|
-
},
|
|
1910
|
-
input: payload.value,
|
|
1911
|
-
});
|
|
1912
|
-
payload.issues = [];
|
|
1913
|
-
payload.fallback = true;
|
|
1914
|
-
}
|
|
1915
|
-
return payload;
|
|
1916
|
-
});
|
|
2247
|
+
return result.then((result) => handleCatchResult(payload, result, def, ctx));
|
|
1917
2248
|
}
|
|
1918
|
-
payload
|
|
1919
|
-
if (result.issues.length) {
|
|
1920
|
-
payload.value = def.catchValue({
|
|
1921
|
-
...payload,
|
|
1922
|
-
error: {
|
|
1923
|
-
issues: result.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config())),
|
|
1924
|
-
},
|
|
1925
|
-
input: payload.value,
|
|
1926
|
-
});
|
|
1927
|
-
payload.issues = [];
|
|
1928
|
-
payload.fallback = true;
|
|
1929
|
-
}
|
|
1930
|
-
return payload;
|
|
2249
|
+
return handleCatchResult(payload, result, def, ctx);
|
|
1931
2250
|
};
|
|
1932
2251
|
});
|
|
1933
2252
|
export const $ZodNaN = /*@__PURE__*/ core.$constructor("$ZodNaN", (inst, def) => {
|
|
@@ -1947,10 +2266,10 @@ export const $ZodNaN = /*@__PURE__*/ core.$constructor("$ZodNaN", (inst, def) =>
|
|
|
1947
2266
|
});
|
|
1948
2267
|
export const $ZodPipe = /*@__PURE__*/ core.$constructor("$ZodPipe", (inst, def) => {
|
|
1949
2268
|
$ZodType.init(inst, def);
|
|
1950
|
-
util.
|
|
1951
|
-
util.
|
|
1952
|
-
util.
|
|
1953
|
-
util.
|
|
2269
|
+
util.defineLazyInternal(inst, "values", (zod) => zod.def.in._zod.values);
|
|
2270
|
+
util.defineLazyInternal(inst, "optin", (zod) => zod.def.in._zod.optin);
|
|
2271
|
+
util.defineLazyInternal(inst, "optout", (zod) => zod.def.out._zod.optout);
|
|
2272
|
+
util.defineLazyInternal(inst, "propValues", (zod) => zod.def.in._zod.propValues);
|
|
1954
2273
|
inst._zod.parse = (payload, ctx) => {
|
|
1955
2274
|
if (ctx.direction === "backward") {
|
|
1956
2275
|
const right = def.out._zod.run(payload, ctx);
|
|
@@ -1967,19 +2286,20 @@ export const $ZodPipe = /*@__PURE__*/ core.$constructor("$ZodPipe", (inst, def)
|
|
|
1967
2286
|
};
|
|
1968
2287
|
});
|
|
1969
2288
|
function handlePipeResult(left, next, ctx) {
|
|
1970
|
-
|
|
2289
|
+
// Any issue stops the pipe, so a failing refinement never feeds its transform. An unrecognized key is the exception: it describes the input's extra properties, not the value being piped, and an enclosing intersection may yet reconcile it.
|
|
2290
|
+
if (left.issues.some((iss) => iss.code !== "unrecognized_keys")) {
|
|
1971
2291
|
// prevent further checks
|
|
1972
2292
|
left.aborted = true;
|
|
1973
2293
|
return left;
|
|
1974
2294
|
}
|
|
1975
|
-
return next._zod.run({ value: left.value, issues: left.issues
|
|
2295
|
+
return next._zod.run({ value: left.value, issues: left.issues }, ctx);
|
|
1976
2296
|
}
|
|
1977
2297
|
export const $ZodCodec = /*@__PURE__*/ core.$constructor("$ZodCodec", (inst, def) => {
|
|
1978
2298
|
$ZodType.init(inst, def);
|
|
1979
|
-
util.
|
|
1980
|
-
util.
|
|
1981
|
-
util.
|
|
1982
|
-
util.
|
|
2299
|
+
util.defineLazyInternal(inst, "values", (zod) => zod.def.in._zod.values);
|
|
2300
|
+
util.defineLazyInternal(inst, "optin", (zod) => zod.def.in._zod.optin);
|
|
2301
|
+
util.defineLazyInternal(inst, "optout", (zod) => zod.def.out._zod.optout);
|
|
2302
|
+
util.defineLazyInternal(inst, "propValues", (zod) => zod.def.in._zod.propValues);
|
|
1983
2303
|
inst._zod.parse = (payload, ctx) => {
|
|
1984
2304
|
const direction = ctx.direction || "forward";
|
|
1985
2305
|
if (direction === "forward") {
|
|
@@ -2033,10 +2353,10 @@ export const $ZodPreprocess = /*@__PURE__*/ core.$constructor("$ZodPreprocess",
|
|
|
2033
2353
|
});
|
|
2034
2354
|
export const $ZodReadonly = /*@__PURE__*/ core.$constructor("$ZodReadonly", (inst, def) => {
|
|
2035
2355
|
$ZodType.init(inst, def);
|
|
2036
|
-
util.
|
|
2037
|
-
util.
|
|
2038
|
-
util.
|
|
2039
|
-
util.
|
|
2356
|
+
util.defineLazyInternal(inst, "propValues", (zod) => zod.def.innerType._zod.propValues);
|
|
2357
|
+
util.defineLazyInternal(inst, "values", (zod) => zod.def.innerType._zod.values);
|
|
2358
|
+
util.defineLazyInternal(inst, "optin", (zod) => zod.def.innerType?._zod?.optin);
|
|
2359
|
+
util.defineLazyInternal(inst, "optout", (zod) => zod.def.innerType?._zod?.optout);
|
|
2040
2360
|
inst._zod.parse = (payload, ctx) => {
|
|
2041
2361
|
if (ctx.direction === "backward") {
|
|
2042
2362
|
return def.innerType._zod.run(payload, ctx);
|
|
@@ -2049,25 +2369,72 @@ export const $ZodReadonly = /*@__PURE__*/ core.$constructor("$ZodReadonly", (ins
|
|
|
2049
2369
|
};
|
|
2050
2370
|
});
|
|
2051
2371
|
function handleReadonlyResult(payload) {
|
|
2052
|
-
|
|
2372
|
+
// A repeat visit hands back a node that is still being built; freezing it here would make the rest of its keys fail to assign.
|
|
2373
|
+
if (!payload.memo)
|
|
2374
|
+
payload.value = Object.freeze(payload.value);
|
|
2053
2375
|
return payload;
|
|
2054
2376
|
}
|
|
2377
|
+
// a leaf's pattern source with its own checks folded in: the last pattern-carrying check wins, else length bounds narrow the catch-all, else an integer format narrows the number form. the fold lives here instead of on `_zod.pattern` so a bundle without template literals never pays for it
|
|
2378
|
+
function leafPattern(schema) {
|
|
2379
|
+
const def = schema._zod.def;
|
|
2380
|
+
let pattern = def.pattern;
|
|
2381
|
+
let isInt = !!def.format?.includes("int");
|
|
2382
|
+
let minimum;
|
|
2383
|
+
let maximum;
|
|
2384
|
+
for (const ch of def.checks ?? []) {
|
|
2385
|
+
const d = ch._zod.def;
|
|
2386
|
+
if (d.pattern)
|
|
2387
|
+
pattern = d.pattern;
|
|
2388
|
+
isInt || (isInt = !!d.format?.includes("int"));
|
|
2389
|
+
const lo = d.minimum ?? d.length;
|
|
2390
|
+
const hi = d.maximum ?? d.length;
|
|
2391
|
+
if (lo !== undefined && (minimum === undefined || lo > minimum))
|
|
2392
|
+
minimum = lo;
|
|
2393
|
+
if (hi !== undefined && (maximum === undefined || hi < maximum))
|
|
2394
|
+
maximum = hi;
|
|
2395
|
+
}
|
|
2396
|
+
if (pattern)
|
|
2397
|
+
return pattern.source;
|
|
2398
|
+
// an empty range matches nothing at runtime, and `{8,5}` is not a legal quantifier
|
|
2399
|
+
if (minimum !== undefined && maximum !== undefined && minimum > maximum)
|
|
2400
|
+
return "(?!)";
|
|
2401
|
+
if (minimum !== undefined || maximum !== undefined)
|
|
2402
|
+
return regexes.string({ minimum, maximum }).source;
|
|
2403
|
+
const own = schema._zod.pattern;
|
|
2404
|
+
return (isInt && own === regexes.number ? regexes.integer : own)?.source;
|
|
2405
|
+
}
|
|
2406
|
+
// a part's pattern source. a wrapper's pattern embeds its inner pattern's source verbatim, so the folded form is substituted in place without knowing the wrapper's own composition; a union's options are joined the way the union builds its own pattern
|
|
2407
|
+
function partPattern(schema) {
|
|
2408
|
+
const def = schema._zod.def;
|
|
2409
|
+
const own = schema._zod.pattern?.source;
|
|
2410
|
+
// lazy resolves its inner on the internals, not the def
|
|
2411
|
+
const inner = def.innerType ?? schema._zod.innerType;
|
|
2412
|
+
if (inner) {
|
|
2413
|
+
const before = inner._zod.pattern?.source;
|
|
2414
|
+
const after = partPattern(inner);
|
|
2415
|
+
if (own && before && after && after !== before) {
|
|
2416
|
+
return own.replace(util.cleanRegex(before), () => util.cleanRegex(after));
|
|
2417
|
+
}
|
|
2418
|
+
return own;
|
|
2419
|
+
}
|
|
2420
|
+
if (def.options) {
|
|
2421
|
+
const sources = def.options.map(partPattern);
|
|
2422
|
+
if (sources.every(Boolean))
|
|
2423
|
+
return `^(${sources.map((s) => util.cleanRegex(s)).join("|")})$`;
|
|
2424
|
+
}
|
|
2425
|
+
return leafPattern(schema);
|
|
2426
|
+
}
|
|
2055
2427
|
export const $ZodTemplateLiteral = /*@__PURE__*/ core.$constructor("$ZodTemplateLiteral", (inst, def) => {
|
|
2056
2428
|
$ZodType.init(inst, def);
|
|
2057
2429
|
const regexParts = [];
|
|
2058
2430
|
for (const part of def.parts) {
|
|
2059
2431
|
if (typeof part === "object" && part !== null) {
|
|
2060
2432
|
// is Zod schema
|
|
2061
|
-
|
|
2062
|
-
|
|
2433
|
+
const source = partPattern(part);
|
|
2434
|
+
if (!source) {
|
|
2063
2435
|
throw new Error(`Invalid template literal part, no pattern found: ${[...part._zod.traits].shift()}`);
|
|
2064
2436
|
}
|
|
2065
|
-
|
|
2066
|
-
if (!source)
|
|
2067
|
-
throw new Error(`Invalid template literal part: ${part._zod.traits}`);
|
|
2068
|
-
const start = source.startsWith("^") ? 1 : 0;
|
|
2069
|
-
const end = source.endsWith("$") ? source.length - 1 : source.length;
|
|
2070
|
-
regexParts.push(source.slice(start, end));
|
|
2437
|
+
regexParts.push(util.cleanRegex(source));
|
|
2071
2438
|
}
|
|
2072
2439
|
else if (part === null || util.primitiveTypes.has(typeof part)) {
|
|
2073
2440
|
regexParts.push(util.escapeRegex(`${part}`));
|
|
@@ -2103,33 +2470,35 @@ export const $ZodTemplateLiteral = /*@__PURE__*/ core.$constructor("$ZodTemplate
|
|
|
2103
2470
|
});
|
|
2104
2471
|
export const $ZodFunction = /*@__PURE__*/ core.$constructor("$ZodFunction", (inst, def) => {
|
|
2105
2472
|
$ZodType.init(inst, def);
|
|
2106
|
-
|
|
2473
|
+
// Defined, not assigned: the classic prototype exposes `_def` as a getter with no setter.
|
|
2474
|
+
Object.defineProperty(inst, "_def", { value: def });
|
|
2107
2475
|
inst._zod.def = def;
|
|
2108
2476
|
inst.implement = (func) => {
|
|
2109
2477
|
if (typeof func !== "function") {
|
|
2110
2478
|
throw new Error("implement() must be called with a function");
|
|
2111
2479
|
}
|
|
2112
|
-
|
|
2480
|
+
// Defined inline so the closure stays anonymous: binding it to a `const` first names it, which costs 256 bytes per implemented function.
|
|
2481
|
+
return Object.defineProperty(function (...args) {
|
|
2113
2482
|
const parsedArgs = inst._def.input ? parse(inst._def.input, args) : args;
|
|
2114
2483
|
const result = Reflect.apply(func, this, parsedArgs);
|
|
2115
2484
|
if (inst._def.output) {
|
|
2116
2485
|
return parse(inst._def.output, result);
|
|
2117
2486
|
}
|
|
2118
2487
|
return result;
|
|
2119
|
-
};
|
|
2488
|
+
}, "_zod", { value: inst._zod, enumerable: false });
|
|
2120
2489
|
};
|
|
2121
2490
|
inst.implementAsync = (func) => {
|
|
2122
2491
|
if (typeof func !== "function") {
|
|
2123
2492
|
throw new Error("implementAsync() must be called with a function");
|
|
2124
2493
|
}
|
|
2125
|
-
return async function (...args) {
|
|
2494
|
+
return Object.defineProperty(async function (...args) {
|
|
2126
2495
|
const parsedArgs = inst._def.input ? await parseAsync(inst._def.input, args) : args;
|
|
2127
2496
|
const result = await Reflect.apply(func, this, parsedArgs);
|
|
2128
2497
|
if (inst._def.output) {
|
|
2129
2498
|
return await parseAsync(inst._def.output, result);
|
|
2130
2499
|
}
|
|
2131
2500
|
return result;
|
|
2132
|
-
};
|
|
2501
|
+
}, "_zod", { value: inst._zod, enumerable: false });
|
|
2133
2502
|
};
|
|
2134
2503
|
inst._zod.parse = (payload, _ctx) => {
|
|
2135
2504
|
if (typeof payload.value !== "function") {
|
|
@@ -2188,19 +2557,17 @@ export const $ZodPromise = /*@__PURE__*/ core.$constructor("$ZodPromise", (inst,
|
|
|
2188
2557
|
});
|
|
2189
2558
|
export const $ZodLazy = /*@__PURE__*/ core.$constructor("$ZodLazy", (inst, def) => {
|
|
2190
2559
|
$ZodType.init(inst, def);
|
|
2191
|
-
// Cache the resolved inner type on the shared `def` so all clones of this
|
|
2192
|
-
// lazy (e.g. via `.describe()`/`.meta()`) share the same inner instance,
|
|
2193
|
-
// preserving identity for cycle detection on recursive schemas.
|
|
2560
|
+
// Cache the resolved inner type on the shared `def` so all clones of this lazy (e.g. via `.describe()`/`.meta()`) share the same inner instance, preserving identity for cycle detection on recursive schemas.
|
|
2194
2561
|
util.defineLazy(inst._zod, "innerType", () => {
|
|
2195
2562
|
const d = def;
|
|
2196
2563
|
if (!d._cachedInner)
|
|
2197
2564
|
d._cachedInner = def.getter();
|
|
2198
2565
|
return d._cachedInner;
|
|
2199
2566
|
});
|
|
2200
|
-
util.
|
|
2201
|
-
util.
|
|
2202
|
-
util.
|
|
2203
|
-
util.
|
|
2567
|
+
util.defineLazyInternal(inst, "pattern", (zod) => zod.innerType?._zod?.pattern);
|
|
2568
|
+
util.defineLazyInternal(inst, "propValues", (zod) => zod.innerType?._zod?.propValues);
|
|
2569
|
+
util.defineLazyInternal(inst, "optin", (zod) => zod.innerType?._zod?.optin ?? undefined);
|
|
2570
|
+
util.defineLazyInternal(inst, "optout", (zod) => zod.innerType?._zod?.optout ?? undefined);
|
|
2204
2571
|
inst._zod.parse = (payload, ctx) => {
|
|
2205
2572
|
const inner = inst._zod.innerType;
|
|
2206
2573
|
return inner._zod.run(payload, ctx);
|