@openclaw/firecrawl-plugin 2026.9.3 → 2026.9.5
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-fetch-provider-CIpxLKLq.js → .setup/firecrawl-fetch-provider-BM5uWYri.mjs} +1 -1
- package/dist/{firecrawl-search-provider-80szkO8A.js → .setup/firecrawl-search-provider-CdDShG2T.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 +27 -0
- package/node_modules/zod/compile.cjs +77 -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 +2 -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/package.json +13 -2
- 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/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 +12 -9
- package/node_modules/zod/src/v4/classic/from-json-schema.ts +140 -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 +452 -262
- 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 +135 -0
- package/node_modules/zod/src/v4/classic/tests/bigint.test.ts +30 -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 +2 -2
- 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 +720 -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 +155 -13
- package/node_modules/zod/src/v4/classic/tests/enum.test.ts +11 -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 +274 -6
- package/node_modules/zod/src/v4/classic/tests/from-json-schema.test.ts +425 -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/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 +281 -0
- package/node_modules/zod/src/v4/classic/tests/instanceof.test.ts +47 -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 +183 -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 +46 -9
- package/node_modules/zod/src/v4/classic/tests/object.test.ts +245 -12
- package/node_modules/zod/src/v4/classic/tests/optin-ladder.test.ts +234 -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/preprocess-types.test.ts +20 -2
- 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 +33 -2
- 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/string.test.ts +127 -5
- 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 +11 -2
- package/node_modules/zod/src/v4/classic/tests/to-json-schema.test.ts +1585 -173
- 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 +76 -0
- package/node_modules/zod/src/v4/classic/tests/validations.test.ts +2 -2
- package/node_modules/zod/src/v4/core/api.ts +48 -12
- package/node_modules/zod/src/v4/core/checks.ts +57 -44
- package/node_modules/zod/src/v4/core/compile.ts +2188 -0
- package/node_modules/zod/src/v4/core/core.ts +98 -19
- package/node_modules/zod/src/v4/core/doc.ts +11 -7
- package/node_modules/zod/src/v4/core/errors.ts +115 -24
- package/node_modules/zod/src/v4/core/index.ts +3 -0
- package/node_modules/zod/src/v4/core/json-schema-generator.ts +6 -1
- package/node_modules/zod/src/v4/core/json-schema-processors.ts +257 -93
- package/node_modules/zod/src/v4/core/json-schema.ts +2 -1
- package/node_modules/zod/src/v4/core/memoizer.ts +284 -0
- package/node_modules/zod/src/v4/core/parse.ts +131 -38
- package/node_modules/zod/src/v4/core/regexes.ts +30 -13
- package/node_modules/zod/src/v4/core/registries.ts +2 -2
- package/node_modules/zod/src/v4/core/schemas.ts +759 -461
- package/node_modules/zod/src/v4/core/tests/compile-differential.test.ts +969 -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 +1639 -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/tk.test.ts +69 -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 +31 -0
- package/node_modules/zod/src/v4/core/to-json-schema.ts +275 -42
- package/node_modules/zod/src/v4/core/util.ts +268 -42
- 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 +3 -0
- package/node_modules/zod/src/v4/locales/az.ts +3 -0
- package/node_modules/zod/src/v4/locales/be.ts +10 -0
- package/node_modules/zod/src/v4/locales/bg.ts +3 -0
- package/node_modules/zod/src/v4/locales/bn.ts +121 -0
- package/node_modules/zod/src/v4/locales/ca.ts +3 -0
- package/node_modules/zod/src/v4/locales/ckb.ts +138 -0
- package/node_modules/zod/src/v4/locales/cs.ts +3 -0
- package/node_modules/zod/src/v4/locales/da.ts +5 -2
- package/node_modules/zod/src/v4/locales/de.ts +3 -0
- package/node_modules/zod/src/v4/locales/el.ts +1 -0
- package/node_modules/zod/src/v4/locales/en.ts +15 -4
- package/node_modules/zod/src/v4/locales/eo.ts +3 -0
- package/node_modules/zod/src/v4/locales/es.ts +2 -0
- package/node_modules/zod/src/v4/locales/fa.ts +3 -0
- package/node_modules/zod/src/v4/locales/fi.ts +3 -0
- package/node_modules/zod/src/v4/locales/fr-CA.ts +3 -0
- package/node_modules/zod/src/v4/locales/fr.ts +19 -14
- package/node_modules/zod/src/v4/locales/gu.ts +121 -0
- package/node_modules/zod/src/v4/locales/he.ts +6 -1
- package/node_modules/zod/src/v4/locales/hi.ts +124 -0
- package/node_modules/zod/src/v4/locales/hr.ts +2 -0
- package/node_modules/zod/src/v4/locales/hu.ts +3 -0
- package/node_modules/zod/src/v4/locales/hy.ts +9 -0
- package/node_modules/zod/src/v4/locales/id.ts +3 -0
- package/node_modules/zod/src/v4/locales/index.ts +10 -0
- package/node_modules/zod/src/v4/locales/is.ts +3 -0
- package/node_modules/zod/src/v4/locales/it.ts +3 -0
- package/node_modules/zod/src/v4/locales/ja.ts +3 -0
- package/node_modules/zod/src/v4/locales/ka.ts +3 -0
- package/node_modules/zod/src/v4/locales/km.ts +3 -0
- package/node_modules/zod/src/v4/locales/kn.ts +124 -0
- package/node_modules/zod/src/v4/locales/ko.ts +3 -0
- package/node_modules/zod/src/v4/locales/lt.ts +2 -0
- package/node_modules/zod/src/v4/locales/mk.ts +3 -0
- package/node_modules/zod/src/v4/locales/ms.ts +3 -0
- package/node_modules/zod/src/v4/locales/ne.ts +126 -0
- package/node_modules/zod/src/v4/locales/nl.ts +3 -0
- package/node_modules/zod/src/v4/locales/nn.ts +119 -0
- package/node_modules/zod/src/v4/locales/no.ts +5 -2
- package/node_modules/zod/src/v4/locales/ota.ts +3 -0
- package/node_modules/zod/src/v4/locales/pl.ts +3 -0
- package/node_modules/zod/src/v4/locales/ps.ts +3 -0
- package/node_modules/zod/src/v4/locales/pt-BR.ts +159 -0
- package/node_modules/zod/src/v4/locales/pt.ts +99 -58
- package/node_modules/zod/src/v4/locales/ro.ts +1 -0
- package/node_modules/zod/src/v4/locales/ru.ts +10 -0
- package/node_modules/zod/src/v4/locales/sk.ts +121 -0
- package/node_modules/zod/src/v4/locales/sl.ts +3 -0
- package/node_modules/zod/src/v4/locales/sv.ts +5 -2
- package/node_modules/zod/src/v4/locales/ta.ts +3 -0
- package/node_modules/zod/src/v4/locales/th.ts +3 -0
- package/node_modules/zod/src/v4/locales/tk.ts +111 -0
- package/node_modules/zod/src/v4/locales/tr.ts +3 -0
- package/node_modules/zod/src/v4/locales/uk.ts +3 -0
- package/node_modules/zod/src/v4/locales/ur.ts +3 -0
- package/node_modules/zod/src/v4/locales/uz.ts +1 -0
- package/node_modules/zod/src/v4/locales/vi.ts +3 -0
- package/node_modules/zod/src/v4/locales/yo.ts +3 -0
- package/node_modules/zod/src/v4/locales/zh-CN.ts +3 -0
- package/node_modules/zod/src/v4/locales/zh-TW.ts +3 -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 +10 -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 +135 -56
- 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/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 +72 -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/string.test.ts +21 -0
- package/node_modules/zod/v3/ZodError.cjs +22 -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/types.cjs +7 -5
- package/node_modules/zod/v3/types.js +7 -5
- package/node_modules/zod/v4/classic/checks.cjs +2 -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/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 +39 -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 +43 -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 +30 -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 +136 -75
- package/node_modules/zod/v4/classic/from-json-schema.js +136 -75
- package/node_modules/zod/v4/classic/in-out.cjs +63 -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 +2 -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 +11 -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 +4 -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 +498 -398
- package/node_modules/zod/v4/classic/schemas.d.cts +53 -18
- package/node_modules/zod/v4/classic/schemas.d.ts +53 -18
- package/node_modules/zod/v4/classic/schemas.js +492 -396
- package/node_modules/zod/v4/core/api.cjs +23 -4
- package/node_modules/zod/v4/core/api.d.cts +13 -9
- package/node_modules/zod/v4/core/api.d.ts +13 -9
- package/node_modules/zod/v4/core/api.js +21 -4
- package/node_modules/zod/v4/core/checks.cjs +37 -31
- package/node_modules/zod/v4/core/checks.d.cts +13 -13
- package/node_modules/zod/v4/core/checks.d.ts +13 -13
- package/node_modules/zod/v4/core/checks.js +37 -31
- package/node_modules/zod/v4/core/compile.cjs +1813 -0
- package/node_modules/zod/v4/core/compile.d.cts +51 -0
- package/node_modules/zod/v4/core/compile.d.ts +51 -0
- package/node_modules/zod/v4/core/compile.js +1783 -0
- package/node_modules/zod/v4/core/core.cjs +81 -18
- 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 +82 -19
- package/node_modules/zod/v4/core/doc.cjs +5 -7
- 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 +5 -7
- package/node_modules/zod/v4/core/errors.cjs +110 -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 +110 -25
- package/node_modules/zod/v4/core/index.cjs +5 -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 +4 -0
- 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 +4 -0
- package/node_modules/zod/v4/core/json-schema-processors.cjs +264 -95
- package/node_modules/zod/v4/core/json-schema-processors.js +243 -97
- 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 +272 -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 +265 -0
- package/node_modules/zod/v4/core/parse.cjs +96 -34
- 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 +94 -33
- package/node_modules/zod/v4/core/regexes.cjs +27 -15
- package/node_modules/zod/v4/core/regexes.d.cts +2 -0
- package/node_modules/zod/v4/core/regexes.d.ts +2 -0
- package/node_modules/zod/v4/core/regexes.js +24 -13
- package/node_modules/zod/v4/core/registries.js +2 -2
- package/node_modules/zod/v4/core/schemas.cjs +537 -326
- package/node_modules/zod/v4/core/schemas.d.cts +100 -31
- package/node_modules/zod/v4/core/schemas.d.ts +100 -31
- package/node_modules/zod/v4/core/schemas.js +526 -325
- package/node_modules/zod/v4/core/to-json-schema.cjs +242 -39
- package/node_modules/zod/v4/core/to-json-schema.d.cts +42 -3
- package/node_modules/zod/v4/core/to-json-schema.d.ts +42 -3
- package/node_modules/zod/v4/core/to-json-schema.js +241 -39
- package/node_modules/zod/v4/core/util.cjs +212 -31
- package/node_modules/zod/v4/core/util.d.cts +58 -1
- package/node_modules/zod/v4/core/util.d.ts +58 -1
- package/node_modules/zod/v4/core/util.js +202 -30
- package/node_modules/zod/v4/core/versions.cjs +2 -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 +195 -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 +15 -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 +3 -0
- package/node_modules/zod/v4/locales/ar.js +3 -0
- package/node_modules/zod/v4/locales/az.cjs +3 -0
- package/node_modules/zod/v4/locales/az.js +3 -0
- package/node_modules/zod/v4/locales/be.cjs +10 -0
- package/node_modules/zod/v4/locales/be.js +10 -0
- package/node_modules/zod/v4/locales/bg.cjs +3 -0
- package/node_modules/zod/v4/locales/bg.js +3 -0
- package/node_modules/zod/v4/locales/bn.cjs +138 -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 +111 -0
- package/node_modules/zod/v4/locales/ca.cjs +3 -0
- package/node_modules/zod/v4/locales/ca.js +3 -0
- package/node_modules/zod/v4/locales/ckb.cjs +158 -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 +131 -0
- package/node_modules/zod/v4/locales/cs.cjs +3 -0
- package/node_modules/zod/v4/locales/cs.js +3 -0
- package/node_modules/zod/v4/locales/da.cjs +5 -2
- package/node_modules/zod/v4/locales/da.js +5 -2
- package/node_modules/zod/v4/locales/de.cjs +3 -0
- package/node_modules/zod/v4/locales/de.js +3 -0
- package/node_modules/zod/v4/locales/el.cjs +1 -0
- package/node_modules/zod/v4/locales/el.js +1 -0
- package/node_modules/zod/v4/locales/en.cjs +14 -4
- package/node_modules/zod/v4/locales/en.js +14 -4
- package/node_modules/zod/v4/locales/eo.cjs +3 -0
- package/node_modules/zod/v4/locales/eo.js +3 -0
- package/node_modules/zod/v4/locales/es.cjs +2 -0
- package/node_modules/zod/v4/locales/es.js +2 -0
- package/node_modules/zod/v4/locales/fa.cjs +3 -0
- package/node_modules/zod/v4/locales/fa.js +3 -0
- package/node_modules/zod/v4/locales/fi.cjs +3 -0
- package/node_modules/zod/v4/locales/fi.js +3 -0
- package/node_modules/zod/v4/locales/fr-CA.cjs +3 -0
- package/node_modules/zod/v4/locales/fr-CA.js +3 -0
- package/node_modules/zod/v4/locales/fr.cjs +16 -14
- package/node_modules/zod/v4/locales/fr.js +16 -14
- package/node_modules/zod/v4/locales/gu.cjs +138 -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 +111 -0
- package/node_modules/zod/v4/locales/he.cjs +5 -0
- package/node_modules/zod/v4/locales/he.js +5 -0
- package/node_modules/zod/v4/locales/hi.cjs +136 -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 +109 -0
- package/node_modules/zod/v4/locales/hr.cjs +2 -0
- package/node_modules/zod/v4/locales/hr.js +2 -0
- package/node_modules/zod/v4/locales/hu.cjs +3 -0
- package/node_modules/zod/v4/locales/hu.js +3 -0
- package/node_modules/zod/v4/locales/hy.cjs +9 -0
- package/node_modules/zod/v4/locales/hy.js +9 -0
- package/node_modules/zod/v4/locales/id.cjs +3 -0
- package/node_modules/zod/v4/locales/id.js +3 -0
- package/node_modules/zod/v4/locales/index.cjs +22 -2
- package/node_modules/zod/v4/locales/index.d.cts +10 -0
- package/node_modules/zod/v4/locales/index.d.ts +10 -0
- package/node_modules/zod/v4/locales/index.js +10 -0
- package/node_modules/zod/v4/locales/is.cjs +3 -0
- package/node_modules/zod/v4/locales/is.js +3 -0
- package/node_modules/zod/v4/locales/it.cjs +3 -0
- package/node_modules/zod/v4/locales/it.js +3 -0
- package/node_modules/zod/v4/locales/ja.cjs +3 -0
- package/node_modules/zod/v4/locales/ja.js +3 -0
- package/node_modules/zod/v4/locales/ka.cjs +3 -0
- package/node_modules/zod/v4/locales/ka.js +3 -0
- package/node_modules/zod/v4/locales/km.cjs +3 -0
- package/node_modules/zod/v4/locales/km.js +3 -0
- package/node_modules/zod/v4/locales/kn.cjs +141 -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 +114 -0
- package/node_modules/zod/v4/locales/ko.cjs +3 -0
- package/node_modules/zod/v4/locales/ko.js +3 -0
- package/node_modules/zod/v4/locales/lt.cjs +2 -0
- package/node_modules/zod/v4/locales/lt.js +2 -0
- package/node_modules/zod/v4/locales/mk.cjs +3 -0
- package/node_modules/zod/v4/locales/mk.js +3 -0
- package/node_modules/zod/v4/locales/ms.cjs +3 -0
- package/node_modules/zod/v4/locales/ms.js +3 -0
- package/node_modules/zod/v4/locales/ne.cjs +136 -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 +109 -0
- package/node_modules/zod/v4/locales/nl.cjs +3 -0
- package/node_modules/zod/v4/locales/nl.js +3 -0
- package/node_modules/zod/v4/locales/nn.cjs +138 -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 +111 -0
- package/node_modules/zod/v4/locales/no.cjs +5 -2
- package/node_modules/zod/v4/locales/no.js +5 -2
- package/node_modules/zod/v4/locales/ota.cjs +3 -0
- package/node_modules/zod/v4/locales/ota.js +3 -0
- package/node_modules/zod/v4/locales/pl.cjs +3 -0
- package/node_modules/zod/v4/locales/pl.js +3 -0
- package/node_modules/zod/v4/locales/ps.cjs +3 -0
- package/node_modules/zod/v4/locales/ps.js +3 -0
- package/node_modules/zod/v4/locales/pt-BR.cjs +168 -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 +141 -0
- package/node_modules/zod/v4/locales/pt.cjs +87 -55
- package/node_modules/zod/v4/locales/pt.js +87 -55
- package/node_modules/zod/v4/locales/ro.cjs +1 -0
- package/node_modules/zod/v4/locales/ro.js +1 -0
- package/node_modules/zod/v4/locales/ru.cjs +10 -0
- package/node_modules/zod/v4/locales/ru.js +10 -0
- package/node_modules/zod/v4/locales/sk.cjs +141 -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 +114 -0
- package/node_modules/zod/v4/locales/sl.cjs +3 -0
- package/node_modules/zod/v4/locales/sl.js +3 -0
- package/node_modules/zod/v4/locales/sv.cjs +5 -2
- package/node_modules/zod/v4/locales/sv.js +5 -2
- package/node_modules/zod/v4/locales/ta.cjs +3 -0
- package/node_modules/zod/v4/locales/ta.js +3 -0
- package/node_modules/zod/v4/locales/th.cjs +3 -0
- package/node_modules/zod/v4/locales/th.js +3 -0
- package/node_modules/zod/v4/locales/tk.cjs +132 -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 +105 -0
- package/node_modules/zod/v4/locales/tr.cjs +3 -0
- package/node_modules/zod/v4/locales/tr.js +3 -0
- package/node_modules/zod/v4/locales/uk.cjs +3 -0
- package/node_modules/zod/v4/locales/uk.js +3 -0
- package/node_modules/zod/v4/locales/ur.cjs +3 -0
- package/node_modules/zod/v4/locales/ur.js +3 -0
- package/node_modules/zod/v4/locales/uz.cjs +1 -0
- package/node_modules/zod/v4/locales/uz.js +1 -0
- package/node_modules/zod/v4/locales/vi.cjs +3 -0
- package/node_modules/zod/v4/locales/vi.js +3 -0
- package/node_modules/zod/v4/locales/yo.cjs +3 -0
- package/node_modules/zod/v4/locales/yo.js +3 -0
- package/node_modules/zod/v4/locales/zh-CN.cjs +3 -0
- package/node_modules/zod/v4/locales/zh-CN.js +3 -0
- package/node_modules/zod/v4/locales/zh-TW.cjs +3 -0
- package/node_modules/zod/v4/locales/zh-TW.js +3 -0
- package/node_modules/zod/v4/mini/checks.cjs +2 -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/deep-partial.cjs +39 -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 +12 -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 +63 -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/parse.cjs +3 -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 +75 -47
- package/node_modules/zod/v4/mini/schemas.d.cts +43 -13
- package/node_modules/zod/v4/mini/schemas.d.ts +43 -13
- package/node_modules/zod/v4/mini/schemas.js +71 -45
- package/openclaw.plugin.json +15 -0
- package/package.json +9 -7
- package/node_modules/zod/src/v4/core/config.ts +0 -15
- /package/dist/{firecrawl-client-BPFpIblh.js → .setup/firecrawl-client-BPFpIblh.mjs} +0 -0
|
@@ -53,6 +53,36 @@ test("date max", () => {
|
|
|
53
53
|
`);
|
|
54
54
|
});
|
|
55
55
|
|
|
56
|
+
test("date min/max origin with numeric bound", () => {
|
|
57
|
+
const minRes = z.date().min(benchmarkDate.getTime()).safeParse(beforeBenchmarkDate);
|
|
58
|
+
expect(minRes.error!.issues).toMatchInlineSnapshot(`
|
|
59
|
+
[
|
|
60
|
+
{
|
|
61
|
+
"code": "too_small",
|
|
62
|
+
"inclusive": true,
|
|
63
|
+
"message": "Too small: expected date to be >=1667606400000",
|
|
64
|
+
"minimum": 1667606400000,
|
|
65
|
+
"origin": "date",
|
|
66
|
+
"path": [],
|
|
67
|
+
},
|
|
68
|
+
]
|
|
69
|
+
`);
|
|
70
|
+
|
|
71
|
+
const maxRes = z.date().max(benchmarkDate.getTime()).safeParse(afterBenchmarkDate);
|
|
72
|
+
expect(maxRes.error!.issues).toMatchInlineSnapshot(`
|
|
73
|
+
[
|
|
74
|
+
{
|
|
75
|
+
"code": "too_big",
|
|
76
|
+
"inclusive": true,
|
|
77
|
+
"maximum": 1667606400000,
|
|
78
|
+
"message": "Too big: expected date to be <=1667606400000",
|
|
79
|
+
"origin": "date",
|
|
80
|
+
"path": [],
|
|
81
|
+
},
|
|
82
|
+
]
|
|
83
|
+
`);
|
|
84
|
+
});
|
|
85
|
+
|
|
56
86
|
test("min max getters", () => {
|
|
57
87
|
expect(minCheck.minDate).toEqual(benchmarkDate);
|
|
58
88
|
expect(minCheck.min(afterBenchmarkDate).minDate).toEqual(afterBenchmarkDate);
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { checkSync } from "recheck";
|
|
2
1
|
import { expect, test } from "vitest";
|
|
3
2
|
import * as z from "zod/v4";
|
|
4
3
|
|
|
@@ -124,15 +123,36 @@ test("datetime parsing with local option", () => {
|
|
|
124
123
|
test("datetime parsing with local and offset", () => {
|
|
125
124
|
const a = z.string().datetime({ local: true, offset: true });
|
|
126
125
|
|
|
127
|
-
// expect(a.parse("2022-10-13T12:52")).toEqual("2022-10-13T12:52:00");
|
|
128
126
|
a.parse("2022-10-13T12:52:00");
|
|
129
127
|
a.parse("2022-10-13T12:52:00Z");
|
|
130
|
-
a.parse("2022-10-13T12:
|
|
128
|
+
a.parse("2022-10-13T12:52:00+02:00");
|
|
129
|
+
// `local` only makes the suffix optional; the unqualified form may still omit seconds
|
|
131
130
|
a.parse("2022-10-13T12:52");
|
|
132
|
-
a.parse("2022-10-13T12:52+02:00");
|
|
133
131
|
expect(() => a.parse("2022-10-13T12:52:00+02")).toThrow();
|
|
134
|
-
//
|
|
135
|
-
|
|
132
|
+
// a `Z` or an offset makes it RFC 3339, which mandates seconds
|
|
133
|
+
expect(() => a.parse("2022-10-13T12:52Z")).toThrow();
|
|
134
|
+
expect(() => a.parse("2022-10-13T12:52+02:00")).toThrow();
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
test("datetime requires seconds once a Z or offset is present", () => {
|
|
138
|
+
expect(z.iso.datetime().safeParse("2022-10-13T12:52Z").success).toEqual(false);
|
|
139
|
+
expect(z.iso.datetime().safeParse("2022-10-13T12:52:00Z").success).toEqual(true);
|
|
140
|
+
expect(z.iso.datetime().safeParse("2022-10-13T12:52:00.123Z").success).toEqual(true);
|
|
141
|
+
expect(z.iso.datetime({ offset: true }).safeParse("2022-10-13T12:52+02:00").success).toEqual(false);
|
|
142
|
+
expect(z.iso.datetime({ offset: true }).safeParse("2022-10-13T12:52:00+02:00").success).toEqual(true);
|
|
143
|
+
// an explicit precision still wins, and gives up `format: "date-time"` in exchange
|
|
144
|
+
expect(z.iso.datetime({ precision: -1 }).safeParse("2022-10-13T12:52Z").success).toEqual(true);
|
|
145
|
+
expect(z.toJSONSchema(z.iso.datetime()).format).toEqual("date-time");
|
|
146
|
+
expect(z.toJSONSchema(z.iso.datetime({ precision: -1 })).format).toEqual(undefined);
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
test("the documented migration union reproduces the old default", () => {
|
|
150
|
+
// no single precision covers both, so the docs point at this union — pin that it works
|
|
151
|
+
const mixed = z.union([z.iso.datetime(), z.iso.datetime({ precision: -1 })]);
|
|
152
|
+
expect(mixed.safeParse("2020-01-01T06:15Z").success).toEqual(true);
|
|
153
|
+
expect(mixed.safeParse("2020-01-01T06:15:00Z").success).toEqual(true);
|
|
154
|
+
expect(mixed.safeParse("2020-01-01T06:15:00.123Z").success).toEqual(true);
|
|
155
|
+
expect(mixed.safeParse("2020-01-01T06:15").success).toEqual(false);
|
|
136
156
|
});
|
|
137
157
|
|
|
138
158
|
test("date parsing", () => {
|
|
@@ -287,16 +307,10 @@ test("duration", () => {
|
|
|
287
307
|
}
|
|
288
308
|
});
|
|
289
309
|
|
|
290
|
-
test("
|
|
291
|
-
const
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
const e = z.string().date();
|
|
296
|
-
const f = z.string().time();
|
|
297
|
-
const g = z.string().duration();
|
|
298
|
-
for (const schema of [a, b, c, d, e, f, g]) {
|
|
299
|
-
const result = checkSync(schema._zod.pattern.source, "");
|
|
300
|
-
if (result.status !== "safe") throw Error("ReDoS issue");
|
|
310
|
+
test("datetime pattern has no empty alternation branch", () => {
|
|
311
|
+
for (const args of [{}, { local: true }, { offset: true }, { local: true, offset: true }]) {
|
|
312
|
+
const { pattern } = z.toJSONSchema(z.iso.datetime(args));
|
|
313
|
+
expect(pattern, JSON.stringify(args)).toBeDefined();
|
|
314
|
+
expect(pattern, JSON.stringify(args)).not.toMatch(/\|\||\(\?:\||\|\)/);
|
|
301
315
|
}
|
|
302
|
-
}
|
|
316
|
+
});
|
|
@@ -0,0 +1,380 @@
|
|
|
1
|
+
import { describe, expect, expectTypeOf, test } from "vitest";
|
|
2
|
+
import * as z from "zod";
|
|
3
|
+
import { visit } from "../../core/visit.js";
|
|
4
|
+
import { deepPartial } from "../deep-partial.js";
|
|
5
|
+
|
|
6
|
+
describe("deepPartial", () => {
|
|
7
|
+
test("makes shallow object optional", () => {
|
|
8
|
+
const schema = z.object({ a: z.string(), b: z.number() });
|
|
9
|
+
const partial = deepPartial(schema);
|
|
10
|
+
expect(partial.parse({})).toEqual({});
|
|
11
|
+
expect(partial.parse({ a: "x" })).toEqual({ a: "x" });
|
|
12
|
+
expect(partial.parse({ a: "x", b: 1 })).toEqual({ a: "x", b: 1 });
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
test("makes nested object optional at every level", () => {
|
|
16
|
+
const schema = z.object({
|
|
17
|
+
name: z.string(),
|
|
18
|
+
profile: z.object({
|
|
19
|
+
bio: z.string(),
|
|
20
|
+
age: z.number(),
|
|
21
|
+
}),
|
|
22
|
+
});
|
|
23
|
+
const partial = deepPartial(schema);
|
|
24
|
+
expect(partial.parse({})).toEqual({});
|
|
25
|
+
expect(partial.parse({ profile: {} })).toEqual({ profile: {} });
|
|
26
|
+
expect(partial.parse({ profile: { bio: "x" } })).toEqual({ profile: { bio: "x" } });
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
test("recurses through arrays", () => {
|
|
30
|
+
const schema = z.object({ items: z.array(z.object({ a: z.string(), b: z.number() })) });
|
|
31
|
+
const partial = deepPartial(schema);
|
|
32
|
+
expect(partial.parse({ items: [{}, { a: "x" }] })).toEqual({ items: [{}, { a: "x" }] });
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
test("recurses through tuples and rest", () => {
|
|
36
|
+
const schema = z.tuple([z.object({ a: z.string() }), z.object({ b: z.number() })], z.object({ c: z.boolean() }));
|
|
37
|
+
const partial = deepPartial(schema);
|
|
38
|
+
expect(partial.parse([{}, {}])).toEqual([{}, {}]);
|
|
39
|
+
expect(partial.parse([{}, {}, {}])).toEqual([{}, {}, {}]);
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
test("recurses through unions", () => {
|
|
43
|
+
const schema = z.union([z.object({ a: z.string() }), z.object({ b: z.number() })]);
|
|
44
|
+
const partial = deepPartial(schema);
|
|
45
|
+
expect(partial.parse({})).toEqual({});
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
test("recurses through optional/nullable wrappers", () => {
|
|
49
|
+
const schema = z.object({ x: z.object({ a: z.string() }).optional() });
|
|
50
|
+
const partial = deepPartial(schema);
|
|
51
|
+
expect(partial.parse({})).toEqual({});
|
|
52
|
+
expect(partial.parse({ x: {} })).toEqual({ x: {} });
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
test("terminates on recursive (lazy) schemas", () => {
|
|
56
|
+
const Node: z.ZodType = z.object({
|
|
57
|
+
name: z.string(),
|
|
58
|
+
children: z.array(z.lazy(() => Node)).optional(),
|
|
59
|
+
});
|
|
60
|
+
const partial = deepPartial(Node);
|
|
61
|
+
expect(partial.parse({})).toEqual({});
|
|
62
|
+
expect(partial.parse({ name: "root", children: [{ name: "child" }] })).toEqual({
|
|
63
|
+
name: "root",
|
|
64
|
+
children: [{ name: "child" }],
|
|
65
|
+
});
|
|
66
|
+
expect(partial.parse({ children: [{}] })).toEqual({ children: [{}] });
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
test("preserves primitives at leaves", () => {
|
|
70
|
+
const schema = z.object({ a: z.string().min(1), b: z.number().int() });
|
|
71
|
+
const partial = deepPartial(schema);
|
|
72
|
+
expect(() => partial.parse({ a: "" })).toThrow();
|
|
73
|
+
expect(() => partial.parse({ b: 1.5 })).toThrow();
|
|
74
|
+
expect(partial.parse({ a: "ok", b: 1 })).toEqual({ a: "ok", b: 1 });
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
test("keyof preserved on output type", () => {
|
|
78
|
+
const schema = z.object({
|
|
79
|
+
name: z.string(),
|
|
80
|
+
profile: z.object({ bio: z.string() }),
|
|
81
|
+
});
|
|
82
|
+
type Out = z.output<typeof schema> extends infer X ? X : never;
|
|
83
|
+
const partial = deepPartial(schema);
|
|
84
|
+
type PartialOut = z.output<typeof partial>;
|
|
85
|
+
expectTypeOf<keyof PartialOut>().toEqualTypeOf<keyof Out>();
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
test("preserves ZodObject structural type; `.shape` is accessible", () => {
|
|
89
|
+
const schema = z.object({
|
|
90
|
+
name: z.string(),
|
|
91
|
+
nested: z.object({ age: z.number() }),
|
|
92
|
+
});
|
|
93
|
+
const partial = deepPartial(schema);
|
|
94
|
+
expectTypeOf(partial).toExtend<z.ZodObject>();
|
|
95
|
+
// Each shape entry is a ZodOptional wrapping the deep-partialed inner.
|
|
96
|
+
expectTypeOf(partial.shape.name).toExtend<z.ZodOptional<z.ZodString>>();
|
|
97
|
+
expectTypeOf(partial.shape.nested).toExtend<z.ZodOptional<z.ZodObject>>();
|
|
98
|
+
// Nested shape access is still typed.
|
|
99
|
+
const innerShape = partial.shape.nested._zod.def.innerType.shape;
|
|
100
|
+
expectTypeOf(innerShape.age).toExtend<z.ZodOptional<z.ZodNumber>>();
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
test("recursive self-reference (via getter) is typeable (no TS depth explosion)", () => {
|
|
104
|
+
const Category = z.object({
|
|
105
|
+
name: z.string(),
|
|
106
|
+
get subcategories() {
|
|
107
|
+
return z.array(Category).optional();
|
|
108
|
+
},
|
|
109
|
+
});
|
|
110
|
+
const partial = deepPartial(Category);
|
|
111
|
+
expectTypeOf(partial).toExtend<z.ZodObject>();
|
|
112
|
+
// Should not blow up TS recursion depth. We don't assert on the inner recursive reference — depth-limited DeepPartial shells out after one unfold.
|
|
113
|
+
expect(partial.parse({ subcategories: [{}] })).toEqual({ subcategories: [{}] });
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
test("preserves ZodArray / ZodTuple / ZodUnion wrappers", () => {
|
|
117
|
+
const arr = deepPartial(z.array(z.object({ a: z.string() })));
|
|
118
|
+
expectTypeOf(arr).toExtend<z.ZodArray>();
|
|
119
|
+
|
|
120
|
+
const tup = deepPartial(z.tuple([z.object({ a: z.string() }), z.object({ b: z.number() })]));
|
|
121
|
+
expectTypeOf(tup).toExtend<z.ZodTuple>();
|
|
122
|
+
|
|
123
|
+
const uni = deepPartial(z.union([z.object({ a: z.string() }), z.object({ b: z.number() })]));
|
|
124
|
+
expectTypeOf(uni).toExtend<z.ZodUnion>();
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
test("3-level deep nesting", () => {
|
|
128
|
+
const schema = z.object({
|
|
129
|
+
a: z.object({
|
|
130
|
+
b: z.object({
|
|
131
|
+
c: z.object({ d: z.string() }),
|
|
132
|
+
}),
|
|
133
|
+
}),
|
|
134
|
+
});
|
|
135
|
+
const partial = deepPartial(schema);
|
|
136
|
+
expect(partial.parse({})).toEqual({});
|
|
137
|
+
expect(partial.parse({ a: {} })).toEqual({ a: {} });
|
|
138
|
+
expect(partial.parse({ a: { b: { c: {} } } })).toEqual({ a: { b: { c: {} } } });
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
test("discriminated union: degrades to plain union (discriminator becomes optional)", () => {
|
|
142
|
+
const schema = z.discriminatedUnion("kind", [
|
|
143
|
+
z.object({ kind: z.literal("a"), a: z.string() }),
|
|
144
|
+
z.object({ kind: z.literal("b"), b: z.number() }),
|
|
145
|
+
]);
|
|
146
|
+
const partial = deepPartial(schema);
|
|
147
|
+
expect(partial.parse({ kind: "a", a: "x" })).toEqual({ kind: "a", a: "x" });
|
|
148
|
+
expect(partial.parse({ kind: "b", b: 1 })).toEqual({ kind: "b", b: 1 });
|
|
149
|
+
expect(partial.parse({})).toEqual({});
|
|
150
|
+
});
|
|
151
|
+
|
|
152
|
+
test("intersection", () => {
|
|
153
|
+
const schema = z.intersection(z.object({ a: z.string() }), z.object({ b: z.number() }));
|
|
154
|
+
const partial = deepPartial(schema);
|
|
155
|
+
expect(partial.parse({})).toEqual({});
|
|
156
|
+
expect(partial.parse({ a: "x" })).toEqual({ a: "x" });
|
|
157
|
+
expect(partial.parse({ b: 1 })).toEqual({ b: 1 });
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
test("record / map / set value schemas are recursed", () => {
|
|
161
|
+
const rec = deepPartial(z.record(z.string(), z.object({ a: z.string() })));
|
|
162
|
+
expect(rec.parse({ k: {} })).toEqual({ k: {} });
|
|
163
|
+
|
|
164
|
+
const m = deepPartial(z.map(z.string(), z.object({ a: z.string() })));
|
|
165
|
+
expect(m.parse(new Map([["k", {}]]))).toEqual(new Map([["k", {}]]));
|
|
166
|
+
|
|
167
|
+
const s = deepPartial(z.set(z.object({ a: z.string() })));
|
|
168
|
+
expect(s.parse(new Set([{}]))).toEqual(new Set([{}]));
|
|
169
|
+
});
|
|
170
|
+
|
|
171
|
+
test("wrapper composition (optional + default + readonly)", () => {
|
|
172
|
+
const schema = z.object({
|
|
173
|
+
x: z.object({ a: z.string() }).default({ a: "hi" }).readonly(),
|
|
174
|
+
});
|
|
175
|
+
const partial = deepPartial(schema);
|
|
176
|
+
expect(partial.parse({})).toEqual({ x: { a: "hi" } });
|
|
177
|
+
expect(partial.parse({ x: {} })).toEqual({ x: {} });
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
test("transform standalone is left untouched", () => {
|
|
181
|
+
const schema = z.object({ a: z.string().transform((s) => s.length) });
|
|
182
|
+
const partial = deepPartial(schema);
|
|
183
|
+
expect(partial.parse({ a: "hi" })).toEqual({ a: 2 });
|
|
184
|
+
expect(partial.parse({})).toEqual({});
|
|
185
|
+
});
|
|
186
|
+
|
|
187
|
+
test("pipe input and output are both recursed", () => {
|
|
188
|
+
const schema = z.object({ a: z.string() }).pipe(z.object({ a: z.string() }));
|
|
189
|
+
const partial = deepPartial(schema);
|
|
190
|
+
expect(partial.parse({})).toEqual({});
|
|
191
|
+
});
|
|
192
|
+
|
|
193
|
+
test("tuple elements stay required — only *objects inside* become partial", () => {
|
|
194
|
+
const schema = z.tuple([z.object({ a: z.string() }), z.string()]);
|
|
195
|
+
const partial = deepPartial(schema);
|
|
196
|
+
// Positional items remain required: the second item (z.string) must be present.
|
|
197
|
+
expect(() => partial.parse([{}])).toThrow();
|
|
198
|
+
expect(partial.parse([{}, "x"])).toEqual([{}, "x"]);
|
|
199
|
+
// The object INSIDE the tuple has its fields made optional.
|
|
200
|
+
expect(partial.parse([{ a: "y" }, "x"])).toEqual([{ a: "y" }, "x"]);
|
|
201
|
+
});
|
|
202
|
+
|
|
203
|
+
test("intersection: both sides are deep-partialed independently", () => {
|
|
204
|
+
const schema = z.intersection(
|
|
205
|
+
z.object({ a: z.object({ inner: z.string() }) }),
|
|
206
|
+
z.object({ b: z.object({ inner: z.number() }) })
|
|
207
|
+
);
|
|
208
|
+
const partial = deepPartial(schema);
|
|
209
|
+
expectTypeOf(partial).toExtend<z.ZodIntersection>();
|
|
210
|
+
// Inner objects on either side accept their field as optional.
|
|
211
|
+
expect(partial.parse({ a: {}, b: {} })).toEqual({ a: {}, b: {} });
|
|
212
|
+
// Top-level props also optional (deepPartial partials both object sides).
|
|
213
|
+
expect(partial.parse({})).toEqual({});
|
|
214
|
+
});
|
|
215
|
+
|
|
216
|
+
test("ZodPromise: inner is recursed", () => {
|
|
217
|
+
const schema = z.promise(z.object({ a: z.string() }));
|
|
218
|
+
const partial = deepPartial(schema);
|
|
219
|
+
expectTypeOf(partial).toExtend<z.ZodPromise>();
|
|
220
|
+
});
|
|
221
|
+
|
|
222
|
+
test("ZodSuccess: inner is recursed", () => {
|
|
223
|
+
const schema = z.success(z.object({ a: z.string() }));
|
|
224
|
+
const partial = deepPartial(schema);
|
|
225
|
+
expectTypeOf(partial).toExtend<z.ZodSuccess>();
|
|
226
|
+
});
|
|
227
|
+
|
|
228
|
+
test("ZodCodec: both sides recursed; preserved as ZodCodec (not degraded to ZodPipe)", () => {
|
|
229
|
+
const schema = z.codec(z.object({ a: z.string() }), z.object({ a: z.string() }), {
|
|
230
|
+
decode: (v) => v,
|
|
231
|
+
encode: (v) => v,
|
|
232
|
+
});
|
|
233
|
+
const partial = deepPartial(schema);
|
|
234
|
+
expectTypeOf(partial).toExtend<z.ZodCodec>();
|
|
235
|
+
expect(partial.parse({})).toEqual({});
|
|
236
|
+
});
|
|
237
|
+
|
|
238
|
+
test("ZodPreprocess: inner is recursed; preserved as ZodPreprocess (not degraded to ZodPipe)", () => {
|
|
239
|
+
const schema = z.preprocess((v) => v, z.object({ a: z.string() }));
|
|
240
|
+
const partial = deepPartial(schema);
|
|
241
|
+
expectTypeOf(partial).toExtend<z.ZodPreprocess>();
|
|
242
|
+
expect(partial.parse({})).toEqual({});
|
|
243
|
+
});
|
|
244
|
+
|
|
245
|
+
test("catchall value schema is recursed; strict/loose catchalls are preserved", () => {
|
|
246
|
+
const partial = deepPartial(z.object({ a: z.string() }).catchall(z.object({ n: z.number() })));
|
|
247
|
+
expect(partial.parse({ extra: {} })).toEqual({ extra: {} });
|
|
248
|
+
expect(() => partial.parse({ extra: { n: "no" } })).toThrow();
|
|
249
|
+
// z.strictObject / z.looseObject encode their behavior as a catchall too.
|
|
250
|
+
expect(() => deepPartial(z.strictObject({ a: z.object({ b: z.string() }) })).parse({ zzz: 1 })).toThrow();
|
|
251
|
+
expect(deepPartial(z.looseObject({ a: z.object({ b: z.string() }) })).parse({ a: {}, zzz: 1 })).toEqual({
|
|
252
|
+
a: {},
|
|
253
|
+
zzz: 1,
|
|
254
|
+
});
|
|
255
|
+
});
|
|
256
|
+
|
|
257
|
+
test("discriminated union nested inside an array degrades and still matches", () => {
|
|
258
|
+
const schema = z.object({
|
|
259
|
+
shapes: z.array(
|
|
260
|
+
z.discriminatedUnion("kind", [
|
|
261
|
+
z.object({ kind: z.literal("circle"), meta: z.object({ id: z.string() }) }),
|
|
262
|
+
z.object({ kind: z.literal("square"), side: z.number() }),
|
|
263
|
+
])
|
|
264
|
+
),
|
|
265
|
+
});
|
|
266
|
+
const partial = deepPartial(schema);
|
|
267
|
+
const element = (partial.shape.shapes._zod.def.innerType as z.ZodArray)._zod.def.element;
|
|
268
|
+
expect(element._zod.def.type).toEqual("union");
|
|
269
|
+
expect((element._zod.def as { discriminator?: string }).discriminator).toBeUndefined();
|
|
270
|
+
expect(partial.parse({ shapes: [{ kind: "circle", meta: {} }, {}] })).toEqual({
|
|
271
|
+
shapes: [{ kind: "circle", meta: {} }, {}],
|
|
272
|
+
});
|
|
273
|
+
});
|
|
274
|
+
|
|
275
|
+
test("does not mutate the source schema", () => {
|
|
276
|
+
const inner = z.object({ b: z.string() });
|
|
277
|
+
const schema = z.object({ a: inner });
|
|
278
|
+
deepPartial(schema);
|
|
279
|
+
expect(schema.shape.a).toBe(inner);
|
|
280
|
+
expect(schema.safeParse({}).success).toEqual(false);
|
|
281
|
+
expect(inner.safeParse({}).success).toEqual(false);
|
|
282
|
+
});
|
|
283
|
+
});
|
|
284
|
+
|
|
285
|
+
describe("visit (internal)", () => {
|
|
286
|
+
test("identity callback returns the input schema unchanged", () => {
|
|
287
|
+
const schema = z.object({ a: z.string(), nested: z.object({ b: z.number() }) });
|
|
288
|
+
expect(visit(schema, (s) => s)).toBe(schema);
|
|
289
|
+
});
|
|
290
|
+
|
|
291
|
+
test("empty handler map returns the input schema unchanged", () => {
|
|
292
|
+
const schema = z.object({ a: z.string(), nested: z.object({ b: z.number() }) });
|
|
293
|
+
expect(visit(schema, {})).toBe(schema);
|
|
294
|
+
});
|
|
295
|
+
|
|
296
|
+
test("only nodes touched by a handler are re-cloned; siblings keep identity", () => {
|
|
297
|
+
const a = z.string();
|
|
298
|
+
const b = z.number();
|
|
299
|
+
const schema = z.object({ a, b });
|
|
300
|
+
const result = visit(schema, { number: () => z.string() }) as z.ZodType;
|
|
301
|
+
// `a` was not rewritten; its reference flows through.
|
|
302
|
+
expect((result._zod.def as any).shape.a).toBe(a);
|
|
303
|
+
// `b` was rewritten; parent is a new clone.
|
|
304
|
+
expect(result).not.toBe(schema);
|
|
305
|
+
});
|
|
306
|
+
|
|
307
|
+
test("callback: can target a specific def.type", () => {
|
|
308
|
+
const schema = z.object({ a: z.string(), b: z.number() });
|
|
309
|
+
const allStrings = visit(schema, (s) => (s._zod.def.type === "number" ? z.string() : s)) as z.ZodType;
|
|
310
|
+
expect(allStrings.parse({ a: "x", b: "y" } as any)).toEqual({ a: "x", b: "y" });
|
|
311
|
+
});
|
|
312
|
+
|
|
313
|
+
test("handler map: dispatches by kind; unhandled kinds pass through", () => {
|
|
314
|
+
const schema = z.object({ a: z.string(), b: z.number() });
|
|
315
|
+
const result = visit(schema, { number: () => z.string() }) as z.ZodType;
|
|
316
|
+
expect(result.parse({ a: "x", b: "y" } as any)).toEqual({ a: "x", b: "y" });
|
|
317
|
+
});
|
|
318
|
+
|
|
319
|
+
test("visits shared sub-schemas only once", () => {
|
|
320
|
+
const inner = z.object({ a: z.string() });
|
|
321
|
+
const schema = z.object({ x: inner, y: inner });
|
|
322
|
+
let calls = 0;
|
|
323
|
+
visit(schema, (s) => {
|
|
324
|
+
calls++;
|
|
325
|
+
return s;
|
|
326
|
+
});
|
|
327
|
+
// 3 unique nodes: schema, inner (shared), inner.shape.a (z.string()).
|
|
328
|
+
expect(calls).toBe(3);
|
|
329
|
+
});
|
|
330
|
+
|
|
331
|
+
test("root is cached: lazy self-reference does not re-invoke fn at parse-time", () => {
|
|
332
|
+
let calls = 0;
|
|
333
|
+
const Self: z.ZodType = z.object({ self: z.lazy(() => Self).optional() });
|
|
334
|
+
const result = visit(Self, (s) => {
|
|
335
|
+
calls++;
|
|
336
|
+
return s;
|
|
337
|
+
}) as z.ZodType;
|
|
338
|
+
const baseline = calls;
|
|
339
|
+
result.parse({ self: { self: { self: {} } } });
|
|
340
|
+
expect(calls).toBe(baseline);
|
|
341
|
+
});
|
|
342
|
+
|
|
343
|
+
test("unknown def.type falls through unchanged (handler map form)", () => {
|
|
344
|
+
const customSchema: any = z.string();
|
|
345
|
+
customSchema._zod.def = { ...customSchema._zod.def, type: "myCustomType" };
|
|
346
|
+
const result = visit(customSchema, { object: (o) => o });
|
|
347
|
+
expect(result).toBe(customSchema);
|
|
348
|
+
});
|
|
349
|
+
|
|
350
|
+
test("non-lazy (getter) cycle resolves through the cache instead of throwing", () => {
|
|
351
|
+
const Node = z.object({
|
|
352
|
+
name: z.string(),
|
|
353
|
+
get children() {
|
|
354
|
+
return z.array(Node);
|
|
355
|
+
},
|
|
356
|
+
});
|
|
357
|
+
// The rewrite has to reach the recursive reference, not just the top level.
|
|
358
|
+
const upper = visit(Node, { string: () => z.string().toUpperCase() }) as z.ZodType;
|
|
359
|
+
expect(upper.parse({ name: "a", children: [{ name: "b", children: [] }] })).toEqual({
|
|
360
|
+
name: "A",
|
|
361
|
+
children: [{ name: "B", children: [] }],
|
|
362
|
+
});
|
|
363
|
+
});
|
|
364
|
+
|
|
365
|
+
test("catchall is traversed like tuple rest", () => {
|
|
366
|
+
const schema = z.object({}).catchall(z.object({ n: z.string() }));
|
|
367
|
+
const result = visit(schema, { string: () => z.string().toUpperCase() }) as z.ZodType;
|
|
368
|
+
expect(result.parse({ k: { n: "a" } })).toEqual({ k: { n: "A" } });
|
|
369
|
+
});
|
|
370
|
+
|
|
371
|
+
test("an already-resolved lazy is still rewritten", () => {
|
|
372
|
+
const make = () => z.object({ x: z.lazy(() => z.object({ y: z.string() })) });
|
|
373
|
+
const cold = make();
|
|
374
|
+
const warm = make();
|
|
375
|
+
warm.safeParse({ x: { y: "a" } }); // memoizes $ZodLazy's inner type onto the def
|
|
376
|
+
// The memo must not ride along into the clone, or the new getter is never read.
|
|
377
|
+
expect(deepPartial(warm).safeParse({ x: {} }).success).toEqual(true);
|
|
378
|
+
expect(deepPartial(cold).safeParse({ x: {} }).success).toEqual(true);
|
|
379
|
+
});
|
|
380
|
+
});
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { beforeEach, expect, test } from "vitest";
|
|
2
|
+
import * as z from "zod/v4";
|
|
3
|
+
|
|
4
|
+
// English is the default locale and must register on first ZodType construction even when bundlers tree-shake `sideEffects: false` modules (#5953, #5725). Reset between tests so each one observes the lazy init.
|
|
5
|
+
beforeEach(() => {
|
|
6
|
+
z.config({ localeError: undefined });
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
test("first ZodType construction registers the English default locale", () => {
|
|
10
|
+
expect(z.config().localeError).toBeUndefined();
|
|
11
|
+
const schema = z.enum(["km", "mi"]);
|
|
12
|
+
expect(z.config().localeError).toBeDefined();
|
|
13
|
+
const result = schema.safeParse("feet");
|
|
14
|
+
expect(result.success).toBe(false);
|
|
15
|
+
expect(result.error!.issues[0].message).toBe('Invalid option: expected one of "km"|"mi"');
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
test("explicit locale set before schema construction is preserved", () => {
|
|
19
|
+
z.config(z.locales.fr());
|
|
20
|
+
const schema = z.enum(["km", "mi"]);
|
|
21
|
+
const result = schema.safeParse("feet");
|
|
22
|
+
expect(result.success).toBe(false);
|
|
23
|
+
expect(result.error!.issues[0].message).toBe('Option invalide : une valeur parmi "km"|"mi" attendue');
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
test("explicit locale set after schema construction overrides default", () => {
|
|
27
|
+
const schema = z.enum(["km", "mi"]);
|
|
28
|
+
z.config(z.locales.fr());
|
|
29
|
+
const result = schema.safeParse("feet");
|
|
30
|
+
expect(result.success).toBe(false);
|
|
31
|
+
expect(result.error!.issues[0].message).toBe('Option invalide : une valeur parmi "km"|"mi" attendue');
|
|
32
|
+
});
|
|
@@ -407,3 +407,49 @@ test("direction-aware defaults", () => {
|
|
|
407
407
|
}
|
|
408
408
|
`);
|
|
409
409
|
});
|
|
410
|
+
|
|
411
|
+
test("default factory runs once per parse inside a container", () => {
|
|
412
|
+
let calls = 0;
|
|
413
|
+
const schema = z.object({
|
|
414
|
+
a: z.string().default(() => {
|
|
415
|
+
calls++;
|
|
416
|
+
return "d";
|
|
417
|
+
}),
|
|
418
|
+
});
|
|
419
|
+
|
|
420
|
+
expect(schema.parse({})).toEqual({ a: "d" });
|
|
421
|
+
expect(calls).toBe(1);
|
|
422
|
+
|
|
423
|
+
// the key is present, so the factory has nothing to produce
|
|
424
|
+
expect(schema.parse({ a: "given" })).toEqual({ a: "given" });
|
|
425
|
+
expect(calls).toBe(1);
|
|
426
|
+
});
|
|
427
|
+
|
|
428
|
+
test("prefault factory runs once per parse inside a container", () => {
|
|
429
|
+
let calls = 0;
|
|
430
|
+
const schema = z.object({
|
|
431
|
+
a: z.string().prefault(() => {
|
|
432
|
+
calls++;
|
|
433
|
+
return "d";
|
|
434
|
+
}),
|
|
435
|
+
});
|
|
436
|
+
|
|
437
|
+
expect(schema.parse({})).toEqual({ a: "d" });
|
|
438
|
+
expect(calls).toBe(1);
|
|
439
|
+
});
|
|
440
|
+
|
|
441
|
+
test("default factory does not run at compile time", () => {
|
|
442
|
+
let calls = 0;
|
|
443
|
+
const compiled = z.compile(
|
|
444
|
+
z.object({
|
|
445
|
+
a: z.string().default(() => {
|
|
446
|
+
calls++;
|
|
447
|
+
return "d";
|
|
448
|
+
}),
|
|
449
|
+
})
|
|
450
|
+
);
|
|
451
|
+
|
|
452
|
+
expect(calls).toBe(0);
|
|
453
|
+
expect(compiled.parse({})).toEqual({ a: "d" });
|
|
454
|
+
expect(calls).toBe(1);
|
|
455
|
+
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { expect, test } from "vitest";
|
|
1
|
+
import { expect, test, vi } from "vitest";
|
|
2
2
|
import * as z from "zod/v4";
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -151,17 +151,19 @@ test("detached object methods work", () => {
|
|
|
151
151
|
const pick = schema.pick;
|
|
152
152
|
const omit = schema.omit;
|
|
153
153
|
const partial = schema.partial;
|
|
154
|
+
const exactPartial = schema.exactPartial;
|
|
154
155
|
const extend = schema.extend;
|
|
155
156
|
|
|
156
157
|
expect(Object.keys(pick({ a: true })._zod.def.shape)).toEqual(["a"]);
|
|
157
158
|
expect(Object.keys(omit({ a: true })._zod.def.shape)).toEqual(["b"]);
|
|
158
159
|
expect(partial().safeParse({}).success).toBe(true);
|
|
160
|
+
expect(exactPartial().safeParse({}).success).toBe(true);
|
|
161
|
+
expect(exactPartial().safeParse({ a: undefined }).success).toBe(false);
|
|
159
162
|
const extended = extend({ c: z.boolean() });
|
|
160
163
|
expect(Object.keys(extended._zod.def.shape).sort()).toEqual(["a", "b", "c"]);
|
|
161
164
|
});
|
|
162
165
|
|
|
163
|
-
// Sweep across many builder methods at once. If any of them break with the
|
|
164
|
-
// `const m = schema.foo; m(...)` pattern, this test will report which.
|
|
166
|
+
// Sweep across many builder methods at once. If any of them break with the `const m = schema.foo; m(...)` pattern, this test will report which.
|
|
165
167
|
test("broad sweep: detaching builder methods does not throw or produce a corrupt schema", () => {
|
|
166
168
|
const stringSchema = z.string();
|
|
167
169
|
const numberSchema = z.number();
|
|
@@ -177,13 +179,11 @@ test("broad sweep: detaching builder methods does not throw or produce a corrupt
|
|
|
177
179
|
|
|
178
180
|
try {
|
|
179
181
|
const result = detached(...args);
|
|
180
|
-
// If the detached call returned a schema, sanity-check it parses
|
|
181
|
-
// its base type. (e.g. `optional()` should accept its inner type.)
|
|
182
|
+
// If the detached call returned a schema, sanity-check it parses its base type. (e.g. `optional()` should accept its inner type.)
|
|
182
183
|
if (result && typeof result === "object" && "_zod" in result && typeof (result as any).safeParse === "function") {
|
|
183
184
|
const probeValue = target === stringSchema ? "x" : 1;
|
|
184
185
|
const r = (result as any).safeParse(probeValue);
|
|
185
|
-
// success or a clean failure are both fine — we only fail on throw or
|
|
186
|
-
// on a schema with corrupt internal state (innerType undefined etc).
|
|
186
|
+
// success or a clean failure are both fine — we only fail on throw or on a schema with corrupt internal state (innerType undefined etc).
|
|
187
187
|
if (r === undefined || (typeof r === "object" && !("success" in r))) {
|
|
188
188
|
broken.push({ method: methodName, reason: "safeParse returned malformed result" });
|
|
189
189
|
}
|
|
@@ -195,3 +195,27 @@ test("broad sweep: detaching builder methods does not throw or produce a corrupt
|
|
|
195
195
|
|
|
196
196
|
expect(broken).toEqual([]);
|
|
197
197
|
});
|
|
198
|
+
|
|
199
|
+
test("vi.spyOn wraps a prototype method that was never read", () => {
|
|
200
|
+
const schema = z.object({ a: z.string() });
|
|
201
|
+
const spy = vi.spyOn(schema, "safeParse").mockReturnValue({ success: true, data: { a: "mocked" } });
|
|
202
|
+
|
|
203
|
+
expect(schema.safeParse({})).toEqual({ success: true, data: { a: "mocked" } });
|
|
204
|
+
expect(spy).toHaveBeenCalledOnce();
|
|
205
|
+
|
|
206
|
+
spy.mockRestore();
|
|
207
|
+
expect(schema.safeParse({ a: "x" })).toEqual({ success: true, data: { a: "x" } });
|
|
208
|
+
expect(schema.safeParse({}).success).toBe(false);
|
|
209
|
+
|
|
210
|
+
const json = vi.spyOn(schema, "toJSONSchema").mockReturnValue({ type: "null" } as any);
|
|
211
|
+
expect(schema.toJSONSchema()).toEqual({ type: "null" });
|
|
212
|
+
json.mockRestore();
|
|
213
|
+
expect(schema.toJSONSchema().type).toBe("object");
|
|
214
|
+
});
|
|
215
|
+
|
|
216
|
+
test("a getter member answers a bare read without a receiver", () => {
|
|
217
|
+
const schema = z.string();
|
|
218
|
+
const get = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(schema), "spa")!.get!;
|
|
219
|
+
expect(get.call(undefined)).toBeUndefined();
|
|
220
|
+
expect(schema.spa).toBe(schema.safeParseAsync);
|
|
221
|
+
});
|