@openclaw/firecrawl-plugin 2026.9.8 → 2026.10.1-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/.setup/{firecrawl-client-S2gdb9zo.mjs → firecrawl-client-Bqyr6x90.mjs} +58 -104
- package/dist/.setup/{firecrawl-fetch-provider-Cq_h8okw.mjs → firecrawl-fetch-provider-CcYAp_u6.mjs} +1 -1
- package/dist/.setup/{firecrawl-search-provider-DzEHIoq7.mjs → firecrawl-search-provider-lAiZ3IJ5.mjs} +1 -1
- package/dist/api.js +1 -1
- package/dist/index.js +17 -28
- 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/package.json +6 -8
- package/node_modules/zod/LICENSE +0 -21
- package/node_modules/zod/README.md +0 -218
- package/node_modules/zod/compile.cjs +0 -96
- package/node_modules/zod/compile.d.cts +0 -1
- package/node_modules/zod/compile.d.ts +0 -1
- package/node_modules/zod/compile.js +0 -52
- package/node_modules/zod/index.cjs +0 -52
- package/node_modules/zod/index.d.cts +0 -3
- package/node_modules/zod/index.d.ts +0 -3
- package/node_modules/zod/index.js +0 -7
- package/node_modules/zod/locales/index.cjs +0 -36
- package/node_modules/zod/locales/index.d.cts +0 -1
- package/node_modules/zod/locales/index.d.ts +0 -1
- package/node_modules/zod/locales/index.js +0 -1
- package/node_modules/zod/locales/package.json +0 -7
- package/node_modules/zod/mini/index.cjs +0 -51
- package/node_modules/zod/mini/index.d.cts +0 -3
- package/node_modules/zod/mini/index.d.ts +0 -3
- package/node_modules/zod/mini/index.js +0 -3
- package/node_modules/zod/mini/package.json +0 -7
- package/node_modules/zod/package.json +0 -147
- package/node_modules/zod/src/compile.ts +0 -56
- package/node_modules/zod/src/index.ts +0 -7
- package/node_modules/zod/src/locales/index.ts +0 -1
- package/node_modules/zod/src/mini/index.ts +0 -3
- package/node_modules/zod/src/v3/ZodError.ts +0 -340
- package/node_modules/zod/src/v3/benchmarks/datetime.ts +0 -58
- package/node_modules/zod/src/v3/benchmarks/discriminatedUnion.ts +0 -80
- package/node_modules/zod/src/v3/benchmarks/index.ts +0 -59
- package/node_modules/zod/src/v3/benchmarks/ipv4.ts +0 -57
- package/node_modules/zod/src/v3/benchmarks/object.ts +0 -69
- package/node_modules/zod/src/v3/benchmarks/primitives.ts +0 -162
- package/node_modules/zod/src/v3/benchmarks/realworld.ts +0 -63
- package/node_modules/zod/src/v3/benchmarks/string.ts +0 -55
- package/node_modules/zod/src/v3/benchmarks/union.ts +0 -80
- package/node_modules/zod/src/v3/errors.ts +0 -13
- package/node_modules/zod/src/v3/external.ts +0 -6
- package/node_modules/zod/src/v3/helpers/enumUtil.ts +0 -17
- package/node_modules/zod/src/v3/helpers/errorUtil.ts +0 -8
- package/node_modules/zod/src/v3/helpers/parseUtil.ts +0 -176
- package/node_modules/zod/src/v3/helpers/partialUtil.ts +0 -34
- package/node_modules/zod/src/v3/helpers/typeAliases.ts +0 -2
- package/node_modules/zod/src/v3/helpers/util.ts +0 -224
- package/node_modules/zod/src/v3/index.ts +0 -4
- package/node_modules/zod/src/v3/locales/en.ts +0 -124
- package/node_modules/zod/src/v3/standard-schema.ts +0 -113
- package/node_modules/zod/src/v3/tests/Mocker.ts +0 -54
- package/node_modules/zod/src/v3/tests/all-errors.test.ts +0 -157
- package/node_modules/zod/src/v3/tests/anyunknown.test.ts +0 -28
- package/node_modules/zod/src/v3/tests/array.test.ts +0 -71
- package/node_modules/zod/src/v3/tests/async-parsing.test.ts +0 -388
- package/node_modules/zod/src/v3/tests/async-refinements.test.ts +0 -46
- package/node_modules/zod/src/v3/tests/base.test.ts +0 -29
- package/node_modules/zod/src/v3/tests/bigint.test.ts +0 -55
- package/node_modules/zod/src/v3/tests/branded.test.ts +0 -53
- package/node_modules/zod/src/v3/tests/catch.test.ts +0 -220
- package/node_modules/zod/src/v3/tests/coerce.test.ts +0 -133
- package/node_modules/zod/src/v3/tests/complex.test.ts +0 -70
- package/node_modules/zod/src/v3/tests/custom.test.ts +0 -31
- package/node_modules/zod/src/v3/tests/date.test.ts +0 -32
- package/node_modules/zod/src/v3/tests/deepmasking.test.ts +0 -186
- package/node_modules/zod/src/v3/tests/default.test.ts +0 -112
- package/node_modules/zod/src/v3/tests/description.test.ts +0 -33
- package/node_modules/zod/src/v3/tests/discriminated-unions.test.ts +0 -315
- package/node_modules/zod/src/v3/tests/enum.test.ts +0 -80
- package/node_modules/zod/src/v3/tests/error.test.ts +0 -586
- package/node_modules/zod/src/v3/tests/firstparty.test.ts +0 -87
- package/node_modules/zod/src/v3/tests/firstpartyschematypes.test.ts +0 -21
- package/node_modules/zod/src/v3/tests/function.test.ts +0 -261
- package/node_modules/zod/src/v3/tests/generics.test.ts +0 -48
- package/node_modules/zod/src/v3/tests/instanceof.test.ts +0 -37
- package/node_modules/zod/src/v3/tests/intersection.test.ts +0 -128
- package/node_modules/zod/src/v3/tests/language-server.source.ts +0 -76
- package/node_modules/zod/src/v3/tests/language-server.test.ts +0 -206
- package/node_modules/zod/src/v3/tests/literal.test.ts +0 -36
- package/node_modules/zod/src/v3/tests/map.test.ts +0 -110
- package/node_modules/zod/src/v3/tests/masking.test.ts +0 -4
- package/node_modules/zod/src/v3/tests/mocker.test.ts +0 -19
- package/node_modules/zod/src/v3/tests/nan.test.ts +0 -24
- package/node_modules/zod/src/v3/tests/nativeEnum.test.ts +0 -87
- package/node_modules/zod/src/v3/tests/nullable.test.ts +0 -42
- package/node_modules/zod/src/v3/tests/number.test.ts +0 -176
- package/node_modules/zod/src/v3/tests/object-augmentation.test.ts +0 -29
- package/node_modules/zod/src/v3/tests/object-in-es5-env.test.ts +0 -29
- package/node_modules/zod/src/v3/tests/object.test.ts +0 -431
- package/node_modules/zod/src/v3/tests/optional.test.ts +0 -42
- package/node_modules/zod/src/v3/tests/parseUtil.test.ts +0 -23
- package/node_modules/zod/src/v3/tests/parser.test.ts +0 -41
- package/node_modules/zod/src/v3/tests/partials.test.ts +0 -243
- package/node_modules/zod/src/v3/tests/pickomit.test.ts +0 -111
- package/node_modules/zod/src/v3/tests/pipeline.test.ts +0 -29
- package/node_modules/zod/src/v3/tests/preprocess.test.ts +0 -186
- package/node_modules/zod/src/v3/tests/primitive.test.ts +0 -440
- package/node_modules/zod/src/v3/tests/promise.test.ts +0 -90
- package/node_modules/zod/src/v3/tests/readonly.test.ts +0 -114
- package/node_modules/zod/src/v3/tests/record.test.ts +0 -171
- package/node_modules/zod/src/v3/tests/recursive.test.ts +0 -197
- package/node_modules/zod/src/v3/tests/refine.test.ts +0 -313
- package/node_modules/zod/src/v3/tests/safeparse.test.ts +0 -27
- package/node_modules/zod/src/v3/tests/set.test.ts +0 -142
- package/node_modules/zod/src/v3/tests/standard-schema.test.ts +0 -83
- package/node_modules/zod/src/v3/tests/string.test.ts +0 -922
- package/node_modules/zod/src/v3/tests/transformer.test.ts +0 -233
- package/node_modules/zod/src/v3/tests/tuple.test.ts +0 -90
- package/node_modules/zod/src/v3/tests/unions.test.ts +0 -57
- package/node_modules/zod/src/v3/tests/validations.test.ts +0 -133
- package/node_modules/zod/src/v3/tests/void.test.ts +0 -15
- package/node_modules/zod/src/v3/types.ts +0 -5138
- package/node_modules/zod/src/v4/classic/checks.ts +0 -33
- package/node_modules/zod/src/v4/classic/coerce.ts +0 -27
- package/node_modules/zod/src/v4/classic/compat.ts +0 -78
- package/node_modules/zod/src/v4/classic/deep-partial.ts +0 -76
- package/node_modules/zod/src/v4/classic/errors.ts +0 -97
- package/node_modules/zod/src/v4/classic/external.ts +0 -57
- package/node_modules/zod/src/v4/classic/from-json-schema.ts +0 -944
- package/node_modules/zod/src/v4/classic/in-out.ts +0 -45
- package/node_modules/zod/src/v4/classic/index.ts +0 -5
- package/node_modules/zod/src/v4/classic/iso.ts +0 -20
- package/node_modules/zod/src/v4/classic/parse.ts +0 -88
- package/node_modules/zod/src/v4/classic/schemas.ts +0 -2937
- package/node_modules/zod/src/v4/classic/tests/anyunknown.test.ts +0 -26
- package/node_modules/zod/src/v4/classic/tests/apply.test.ts +0 -86
- package/node_modules/zod/src/v4/classic/tests/array.test.ts +0 -264
- package/node_modules/zod/src/v4/classic/tests/assignability.test.ts +0 -402
- package/node_modules/zod/src/v4/classic/tests/async-parsing.test.ts +0 -381
- package/node_modules/zod/src/v4/classic/tests/async-refinements.test.ts +0 -68
- package/node_modules/zod/src/v4/classic/tests/base.test.ts +0 -7
- package/node_modules/zod/src/v4/classic/tests/bigint.test.ts +0 -89
- package/node_modules/zod/src/v4/classic/tests/brand.test.ts +0 -106
- package/node_modules/zod/src/v4/classic/tests/catch.test.ts +0 -604
- package/node_modules/zod/src/v4/classic/tests/coalesce.test.ts +0 -20
- package/node_modules/zod/src/v4/classic/tests/codec-examples.test.ts +0 -572
- package/node_modules/zod/src/v4/classic/tests/codec.test.ts +0 -704
- package/node_modules/zod/src/v4/classic/tests/coerce.test.ts +0 -160
- package/node_modules/zod/src/v4/classic/tests/continuability.test.ts +0 -374
- package/node_modules/zod/src/v4/classic/tests/credit-card.test.ts +0 -76
- package/node_modules/zod/src/v4/classic/tests/custom.test.ts +0 -40
- package/node_modules/zod/src/v4/classic/tests/cyclic-data.test.ts +0 -985
- package/node_modules/zod/src/v4/classic/tests/date.test.ts +0 -92
- package/node_modules/zod/src/v4/classic/tests/datetime.test.ts +0 -316
- package/node_modules/zod/src/v4/classic/tests/deep-partial.test.ts +0 -380
- package/node_modules/zod/src/v4/classic/tests/default-locale.test.ts +0 -32
- package/node_modules/zod/src/v4/classic/tests/default.test.ts +0 -455
- package/node_modules/zod/src/v4/classic/tests/describe-meta-checks.test.ts +0 -27
- package/node_modules/zod/src/v4/classic/tests/description.test.ts +0 -32
- package/node_modules/zod/src/v4/classic/tests/detached-methods.test.ts +0 -221
- package/node_modules/zod/src/v4/classic/tests/discriminated-unions.test.ts +0 -942
- package/node_modules/zod/src/v4/classic/tests/enum.test.ts +0 -305
- package/node_modules/zod/src/v4/classic/tests/error-utils.test.ts +0 -917
- package/node_modules/zod/src/v4/classic/tests/error.test.ts +0 -1108
- package/node_modules/zod/src/v4/classic/tests/file.test.ts +0 -96
- package/node_modules/zod/src/v4/classic/tests/firstparty.test.ts +0 -179
- package/node_modules/zod/src/v4/classic/tests/fix-json-issue.test.ts +0 -26
- package/node_modules/zod/src/v4/classic/tests/from-json-schema.test.ts +0 -1467
- package/node_modules/zod/src/v4/classic/tests/function.test.ts +0 -391
- package/node_modules/zod/src/v4/classic/tests/generics.test.ts +0 -72
- package/node_modules/zod/src/v4/classic/tests/global-config.test.ts +0 -32
- package/node_modules/zod/src/v4/classic/tests/hash.test.ts +0 -67
- package/node_modules/zod/src/v4/classic/tests/iban.test.ts +0 -81
- package/node_modules/zod/src/v4/classic/tests/in-out.test.ts +0 -159
- package/node_modules/zod/src/v4/classic/tests/index.test.ts +0 -958
- package/node_modules/zod/src/v4/classic/tests/instance-footprint.test.ts +0 -319
- package/node_modules/zod/src/v4/classic/tests/instanceof.test.ts +0 -127
- package/node_modules/zod/src/v4/classic/tests/intersection.test.ts +0 -334
- package/node_modules/zod/src/v4/classic/tests/issue-schema.test.ts +0 -215
- package/node_modules/zod/src/v4/classic/tests/jitless-allows-eval.test.ts +0 -39
- package/node_modules/zod/src/v4/classic/tests/json.test.ts +0 -109
- package/node_modules/zod/src/v4/classic/tests/lazy.test.ts +0 -262
- package/node_modules/zod/src/v4/classic/tests/literal.test.ts +0 -128
- package/node_modules/zod/src/v4/classic/tests/locales_ka.test.ts +0 -29
- package/node_modules/zod/src/v4/classic/tests/locales_ro.test.ts +0 -24
- package/node_modules/zod/src/v4/classic/tests/map.test.ts +0 -342
- package/node_modules/zod/src/v4/classic/tests/nan.test.ts +0 -21
- package/node_modules/zod/src/v4/classic/tests/nested-refine.test.ts +0 -168
- package/node_modules/zod/src/v4/classic/tests/nonoptional.test.ts +0 -101
- package/node_modules/zod/src/v4/classic/tests/nullable.test.ts +0 -22
- package/node_modules/zod/src/v4/classic/tests/number.test.ts +0 -401
- package/node_modules/zod/src/v4/classic/tests/object.test.ts +0 -1006
- package/node_modules/zod/src/v4/classic/tests/optin-ladder.test.ts +0 -235
- package/node_modules/zod/src/v4/classic/tests/optional.test.ts +0 -366
- package/node_modules/zod/src/v4/classic/tests/partial.test.ts +0 -497
- package/node_modules/zod/src/v4/classic/tests/pickomit.test.ts +0 -211
- package/node_modules/zod/src/v4/classic/tests/pipe.test.ts +0 -101
- package/node_modules/zod/src/v4/classic/tests/prefault.test.ts +0 -144
- package/node_modules/zod/src/v4/classic/tests/preprocess-types.test.ts +0 -44
- package/node_modules/zod/src/v4/classic/tests/preprocess.test.ts +0 -351
- package/node_modules/zod/src/v4/classic/tests/primitive.test.ts +0 -175
- package/node_modules/zod/src/v4/classic/tests/promise.test.ts +0 -81
- package/node_modules/zod/src/v4/classic/tests/properties.test.ts +0 -141
- package/node_modules/zod/src/v4/classic/tests/prototypes.test.ts +0 -23
- package/node_modules/zod/src/v4/classic/tests/readonly.test.ts +0 -184
- package/node_modules/zod/src/v4/classic/tests/record.test.ts +0 -885
- package/node_modules/zod/src/v4/classic/tests/recursive-types.test.ts +0 -707
- package/node_modules/zod/src/v4/classic/tests/redos.test.ts +0 -68
- package/node_modules/zod/src/v4/classic/tests/refine.test.ts +0 -693
- package/node_modules/zod/src/v4/classic/tests/registries.test.ts +0 -243
- package/node_modules/zod/src/v4/classic/tests/set.test.ts +0 -190
- package/node_modules/zod/src/v4/classic/tests/standard-schema.test.ts +0 -153
- package/node_modules/zod/src/v4/classic/tests/string-formats.test.ts +0 -125
- package/node_modules/zod/src/v4/classic/tests/string.test.ts +0 -1440
- package/node_modules/zod/src/v4/classic/tests/stringbool.test.ts +0 -124
- package/node_modules/zod/src/v4/classic/tests/template-literal.test.ts +0 -812
- package/node_modules/zod/src/v4/classic/tests/to-json-schema-methods.test.ts +0 -438
- package/node_modules/zod/src/v4/classic/tests/to-json-schema.test.ts +0 -4733
- package/node_modules/zod/src/v4/classic/tests/transform.test.ts +0 -378
- package/node_modules/zod/src/v4/classic/tests/tuple.test.ts +0 -511
- package/node_modules/zod/src/v4/classic/tests/union.test.ts +0 -310
- package/node_modules/zod/src/v4/classic/tests/url.test.ts +0 -13
- package/node_modules/zod/src/v4/classic/tests/validate.test.ts +0 -645
- package/node_modules/zod/src/v4/classic/tests/validations.test.ts +0 -283
- package/node_modules/zod/src/v4/classic/tests/void.test.ts +0 -12
- package/node_modules/zod/src/v4/core/api.ts +0 -1875
- package/node_modules/zod/src/v4/core/checks.ts +0 -1266
- package/node_modules/zod/src/v4/core/compile.ts +0 -2313
- package/node_modules/zod/src/v4/core/core.ts +0 -230
- package/node_modules/zod/src/v4/core/doc.ts +0 -52
- package/node_modules/zod/src/v4/core/errors.ts +0 -543
- package/node_modules/zod/src/v4/core/index.ts +0 -19
- package/node_modules/zod/src/v4/core/json-schema-generator.ts +0 -131
- package/node_modules/zod/src/v4/core/json-schema-processors.ts +0 -934
- package/node_modules/zod/src/v4/core/json-schema.ts +0 -148
- package/node_modules/zod/src/v4/core/memoizer.ts +0 -331
- package/node_modules/zod/src/v4/core/parse.ts +0 -309
- package/node_modules/zod/src/v4/core/regexes.ts +0 -217
- package/node_modules/zod/src/v4/core/registries.ts +0 -105
- package/node_modules/zod/src/v4/core/schemas.ts +0 -5192
- package/node_modules/zod/src/v4/core/standard-schema.ts +0 -159
- package/node_modules/zod/src/v4/core/tests/cached.test.ts +0 -54
- package/node_modules/zod/src/v4/core/tests/compile-differential.test.ts +0 -1004
- package/node_modules/zod/src/v4/core/tests/compile-generative.test.ts +0 -445
- package/node_modules/zod/src/v4/core/tests/compile-global.test.ts +0 -89
- package/node_modules/zod/src/v4/core/tests/compile-off-by-default.test.ts +0 -26
- package/node_modules/zod/src/v4/core/tests/compile-stats.test.ts +0 -34
- package/node_modules/zod/src/v4/core/tests/compile.test.ts +0 -2036
- package/node_modules/zod/src/v4/core/tests/email-regex.test.ts +0 -140
- package/node_modules/zod/src/v4/core/tests/extend.test.ts +0 -59
- package/node_modules/zod/src/v4/core/tests/index.test.ts +0 -46
- package/node_modules/zod/src/v4/core/tests/locales/be.test.ts +0 -124
- package/node_modules/zod/src/v4/core/tests/locales/el.test.ts +0 -214
- package/node_modules/zod/src/v4/core/tests/locales/en.test.ts +0 -22
- package/node_modules/zod/src/v4/core/tests/locales/es.test.ts +0 -180
- package/node_modules/zod/src/v4/core/tests/locales/fr.test.ts +0 -72
- package/node_modules/zod/src/v4/core/tests/locales/he.test.ts +0 -379
- package/node_modules/zod/src/v4/core/tests/locales/hr.test.ts +0 -163
- package/node_modules/zod/src/v4/core/tests/locales/nl.test.ts +0 -46
- package/node_modules/zod/src/v4/core/tests/locales/parity.test.ts +0 -42
- package/node_modules/zod/src/v4/core/tests/locales/ru.test.ts +0 -128
- package/node_modules/zod/src/v4/core/tests/locales/tg.test.ts +0 -85
- package/node_modules/zod/src/v4/core/tests/locales/tk.test.ts +0 -69
- package/node_modules/zod/src/v4/core/tests/locales/tr.test.ts +0 -69
- package/node_modules/zod/src/v4/core/tests/locales/uz.test.ts +0 -105
- package/node_modules/zod/src/v4/core/tests/polyfill-collision.test.ts +0 -46
- package/node_modules/zod/src/v4/core/tests/record-constructor.test.ts +0 -125
- package/node_modules/zod/src/v4/core/tests/recursive-tuples.test.ts +0 -45
- package/node_modules/zod/src/v4/core/tests/treeshake.test.ts +0 -51
- package/node_modules/zod/src/v4/core/tests/url-no-canparse.test.ts +0 -133
- package/node_modules/zod/src/v4/core/to-json-schema.ts +0 -857
- package/node_modules/zod/src/v4/core/util.ts +0 -1280
- package/node_modules/zod/src/v4/core/versions.ts +0 -5
- package/node_modules/zod/src/v4/core/visit.ts +0 -193
- package/node_modules/zod/src/v4/core/zsf.ts +0 -323
- package/node_modules/zod/src/v4/index.ts +0 -4
- package/node_modules/zod/src/v4/locales/ar.ts +0 -120
- package/node_modules/zod/src/v4/locales/az.ts +0 -116
- package/node_modules/zod/src/v4/locales/be.ts +0 -188
- package/node_modules/zod/src/v4/locales/bg.ts +0 -133
- package/node_modules/zod/src/v4/locales/bn.ts +0 -123
- package/node_modules/zod/src/v4/locales/ca.ts +0 -121
- package/node_modules/zod/src/v4/locales/ckb.ts +0 -140
- package/node_modules/zod/src/v4/locales/cs.ts +0 -123
- package/node_modules/zod/src/v4/locales/da.ts +0 -128
- package/node_modules/zod/src/v4/locales/de.ts +0 -121
- package/node_modules/zod/src/v4/locales/el.ts +0 -124
- package/node_modules/zod/src/v4/locales/en.ts +0 -136
- package/node_modules/zod/src/v4/locales/eo.ts +0 -123
- package/node_modules/zod/src/v4/locales/es.ts +0 -145
- package/node_modules/zod/src/v4/locales/fa.ts +0 -131
- package/node_modules/zod/src/v4/locales/fi.ts +0 -126
- package/node_modules/zod/src/v4/locales/fr-CA.ts +0 -121
- package/node_modules/zod/src/v4/locales/fr.ts +0 -139
- package/node_modules/zod/src/v4/locales/gu.ts +0 -123
- package/node_modules/zod/src/v4/locales/he.ts +0 -253
- package/node_modules/zod/src/v4/locales/hi.ts +0 -126
- package/node_modules/zod/src/v4/locales/hr.ts +0 -135
- package/node_modules/zod/src/v4/locales/hu.ts +0 -122
- package/node_modules/zod/src/v4/locales/hy.ts +0 -175
- package/node_modules/zod/src/v4/locales/id.ts +0 -120
- package/node_modules/zod/src/v4/locales/index.ts +0 -63
- package/node_modules/zod/src/v4/locales/is.ts +0 -124
- package/node_modules/zod/src/v4/locales/it.ts +0 -121
- package/node_modules/zod/src/v4/locales/ja.ts +0 -119
- package/node_modules/zod/src/v4/locales/ka.ts +0 -128
- package/node_modules/zod/src/v4/locales/kh.ts +0 -7
- package/node_modules/zod/src/v4/locales/km.ts +0 -124
- package/node_modules/zod/src/v4/locales/kn.ts +0 -126
- package/node_modules/zod/src/v4/locales/ko.ts +0 -126
- package/node_modules/zod/src/v4/locales/lt.ts +0 -243
- package/node_modules/zod/src/v4/locales/mk.ts +0 -123
- package/node_modules/zod/src/v4/locales/ms.ts +0 -120
- package/node_modules/zod/src/v4/locales/ne.ts +0 -128
- package/node_modules/zod/src/v4/locales/nl.ts +0 -126
- package/node_modules/zod/src/v4/locales/nn.ts +0 -121
- package/node_modules/zod/src/v4/locales/no.ts +0 -121
- package/node_modules/zod/src/v4/locales/ota.ts +0 -122
- package/node_modules/zod/src/v4/locales/pl.ts +0 -123
- package/node_modules/zod/src/v4/locales/ps.ts +0 -131
- package/node_modules/zod/src/v4/locales/pt-BR.ts +0 -161
- package/node_modules/zod/src/v4/locales/pt.ts +0 -159
- package/node_modules/zod/src/v4/locales/ro.ts +0 -132
- package/node_modules/zod/src/v4/locales/ru.ts +0 -188
- package/node_modules/zod/src/v4/locales/sk.ts +0 -123
- package/node_modules/zod/src/v4/locales/sl.ts +0 -123
- package/node_modules/zod/src/v4/locales/sv.ts +0 -124
- package/node_modules/zod/src/v4/locales/ta.ts +0 -123
- package/node_modules/zod/src/v4/locales/tg.ts +0 -135
- package/node_modules/zod/src/v4/locales/th.ts +0 -124
- package/node_modules/zod/src/v4/locales/tk.ts +0 -113
- package/node_modules/zod/src/v4/locales/tr.ts +0 -116
- package/node_modules/zod/src/v4/locales/ua.ts +0 -7
- package/node_modules/zod/src/v4/locales/uk.ts +0 -122
- package/node_modules/zod/src/v4/locales/ur.ts +0 -124
- package/node_modules/zod/src/v4/locales/uz.ts +0 -120
- package/node_modules/zod/src/v4/locales/vi.ts +0 -122
- package/node_modules/zod/src/v4/locales/yo.ts +0 -129
- package/node_modules/zod/src/v4/locales/zh-CN.ts +0 -121
- package/node_modules/zod/src/v4/locales/zh-TW.ts +0 -120
- package/node_modules/zod/src/v4/mini/checks.ts +0 -33
- package/node_modules/zod/src/v4/mini/coerce.ts +0 -27
- package/node_modules/zod/src/v4/mini/deep-partial.ts +0 -73
- package/node_modules/zod/src/v4/mini/external.ts +0 -52
- package/node_modules/zod/src/v4/mini/in-out.ts +0 -45
- package/node_modules/zod/src/v4/mini/index.ts +0 -3
- package/node_modules/zod/src/v4/mini/iso.ts +0 -66
- package/node_modules/zod/src/v4/mini/parse.ts +0 -16
- package/node_modules/zod/src/v4/mini/schemas.ts +0 -2051
- package/node_modules/zod/src/v4/mini/tests/apply.test.ts +0 -57
- package/node_modules/zod/src/v4/mini/tests/assignability.test.ts +0 -190
- package/node_modules/zod/src/v4/mini/tests/brand.test.ts +0 -94
- package/node_modules/zod/src/v4/mini/tests/checks.test.ts +0 -158
- package/node_modules/zod/src/v4/mini/tests/codec.test.ts +0 -582
- package/node_modules/zod/src/v4/mini/tests/computed.test.ts +0 -30
- package/node_modules/zod/src/v4/mini/tests/cyclic-data.test.ts +0 -84
- package/node_modules/zod/src/v4/mini/tests/deep-partial.test.ts +0 -54
- package/node_modules/zod/src/v4/mini/tests/error.test.ts +0 -41
- package/node_modules/zod/src/v4/mini/tests/functions.test.ts +0 -14
- package/node_modules/zod/src/v4/mini/tests/index.test.ts +0 -1146
- package/node_modules/zod/src/v4/mini/tests/number.test.ts +0 -109
- package/node_modules/zod/src/v4/mini/tests/object.test.ts +0 -292
- package/node_modules/zod/src/v4/mini/tests/prototypes.test.ts +0 -43
- package/node_modules/zod/src/v4/mini/tests/recursive-types.test.ts +0 -341
- package/node_modules/zod/src/v4/mini/tests/standard-schema.test.ts +0 -50
- package/node_modules/zod/src/v4/mini/tests/string.test.ts +0 -396
- package/node_modules/zod/src/v4-mini/index.ts +0 -3
- package/node_modules/zod/v3/ZodError.cjs +0 -167
- package/node_modules/zod/v3/ZodError.d.cts +0 -164
- package/node_modules/zod/v3/ZodError.d.ts +0 -164
- package/node_modules/zod/v3/ZodError.js +0 -143
- package/node_modules/zod/v3/errors.cjs +0 -36
- package/node_modules/zod/v3/errors.d.cts +0 -5
- package/node_modules/zod/v3/errors.d.ts +0 -5
- package/node_modules/zod/v3/errors.js +0 -9
- package/node_modules/zod/v3/external.cjs +0 -41
- package/node_modules/zod/v3/external.d.cts +0 -6
- package/node_modules/zod/v3/external.d.ts +0 -6
- package/node_modules/zod/v3/external.js +0 -6
- package/node_modules/zod/v3/helpers/enumUtil.cjs +0 -21
- package/node_modules/zod/v3/helpers/enumUtil.d.cts +0 -8
- package/node_modules/zod/v3/helpers/enumUtil.d.ts +0 -8
- package/node_modules/zod/v3/helpers/enumUtil.js +0 -1
- package/node_modules/zod/v3/helpers/errorUtil.cjs +0 -28
- package/node_modules/zod/v3/helpers/errorUtil.d.cts +0 -9
- package/node_modules/zod/v3/helpers/errorUtil.d.ts +0 -9
- package/node_modules/zod/v3/helpers/errorUtil.js +0 -6
- package/node_modules/zod/v3/helpers/parseUtil.cjs +0 -143
- package/node_modules/zod/v3/helpers/parseUtil.d.cts +0 -78
- package/node_modules/zod/v3/helpers/parseUtil.d.ts +0 -78
- package/node_modules/zod/v3/helpers/parseUtil.js +0 -109
- package/node_modules/zod/v3/helpers/partialUtil.cjs +0 -21
- package/node_modules/zod/v3/helpers/partialUtil.d.cts +0 -8
- package/node_modules/zod/v3/helpers/partialUtil.d.ts +0 -8
- package/node_modules/zod/v3/helpers/partialUtil.js +0 -1
- package/node_modules/zod/v3/helpers/typeAliases.cjs +0 -21
- package/node_modules/zod/v3/helpers/typeAliases.d.cts +0 -2
- package/node_modules/zod/v3/helpers/typeAliases.d.ts +0 -2
- package/node_modules/zod/v3/helpers/typeAliases.js +0 -1
- package/node_modules/zod/v3/helpers/util.cjs +0 -156
- package/node_modules/zod/v3/helpers/util.d.cts +0 -85
- package/node_modules/zod/v3/helpers/util.d.ts +0 -85
- package/node_modules/zod/v3/helpers/util.js +0 -133
- package/node_modules/zod/v3/index.cjs +0 -52
- package/node_modules/zod/v3/index.d.cts +0 -4
- package/node_modules/zod/v3/index.d.ts +0 -4
- package/node_modules/zod/v3/index.js +0 -4
- package/node_modules/zod/v3/locales/en.cjs +0 -112
- package/node_modules/zod/v3/locales/en.d.cts +0 -3
- package/node_modules/zod/v3/locales/en.d.ts +0 -3
- package/node_modules/zod/v3/locales/en.js +0 -109
- package/node_modules/zod/v3/package.json +0 -7
- package/node_modules/zod/v3/standard-schema.cjs +0 -21
- package/node_modules/zod/v3/standard-schema.d.cts +0 -102
- package/node_modules/zod/v3/standard-schema.d.ts +0 -102
- package/node_modules/zod/v3/standard-schema.js +0 -1
- package/node_modules/zod/v3/types.cjs +0 -3798
- package/node_modules/zod/v3/types.d.cts +0 -1034
- package/node_modules/zod/v3/types.d.ts +0 -1034
- package/node_modules/zod/v3/types.js +0 -3697
- package/node_modules/zod/v4/classic/checks.cjs +0 -53
- package/node_modules/zod/v4/classic/checks.d.cts +0 -1
- package/node_modules/zod/v4/classic/checks.d.ts +0 -1
- package/node_modules/zod/v4/classic/checks.js +0 -1
- package/node_modules/zod/v4/classic/coerce.cjs +0 -66
- package/node_modules/zod/v4/classic/coerce.d.cts +0 -17
- package/node_modules/zod/v4/classic/coerce.d.ts +0 -17
- package/node_modules/zod/v4/classic/coerce.js +0 -17
- package/node_modules/zod/v4/classic/compat.cjs +0 -80
- package/node_modules/zod/v4/classic/compat.d.cts +0 -48
- package/node_modules/zod/v4/classic/compat.d.ts +0 -48
- package/node_modules/zod/v4/classic/compat.js +0 -31
- package/node_modules/zod/v4/classic/deep-partial.cjs +0 -58
- package/node_modules/zod/v4/classic/deep-partial.d.cts +0 -14
- package/node_modules/zod/v4/classic/deep-partial.d.ts +0 -14
- package/node_modules/zod/v4/classic/deep-partial.js +0 -13
- package/node_modules/zod/v4/classic/errors.cjs +0 -102
- package/node_modules/zod/v4/classic/errors.d.cts +0 -29
- package/node_modules/zod/v4/classic/errors.d.ts +0 -29
- package/node_modules/zod/v4/classic/errors.js +0 -57
- package/node_modules/zod/v4/classic/external.cjs +0 -97
- package/node_modules/zod/v4/classic/external.d.cts +0 -19
- package/node_modules/zod/v4/classic/external.d.ts +0 -19
- package/node_modules/zod/v4/classic/external.js +0 -17
- package/node_modules/zod/v4/classic/from-json-schema.cjs +0 -926
- package/node_modules/zod/v4/classic/from-json-schema.d.cts +0 -12
- package/node_modules/zod/v4/classic/from-json-schema.d.ts +0 -12
- package/node_modules/zod/v4/classic/from-json-schema.js +0 -881
- package/node_modules/zod/v4/classic/in-out.cjs +0 -82
- package/node_modules/zod/v4/classic/in-out.d.cts +0 -8
- package/node_modules/zod/v4/classic/in-out.d.ts +0 -8
- package/node_modules/zod/v4/classic/in-out.js +0 -36
- package/node_modules/zod/v4/classic/index.cjs +0 -52
- package/node_modules/zod/v4/classic/index.d.cts +0 -3
- package/node_modules/zod/v4/classic/index.d.ts +0 -3
- package/node_modules/zod/v4/classic/index.js +0 -4
- package/node_modules/zod/v4/classic/iso.cjs +0 -68
- package/node_modules/zod/v4/classic/iso.d.cts +0 -7
- package/node_modules/zod/v4/classic/iso.d.ts +0 -7
- package/node_modules/zod/v4/classic/iso.js +0 -15
- package/node_modules/zod/v4/classic/package.json +0 -7
- package/node_modules/zod/v4/classic/parse.cjs +0 -63
- package/node_modules/zod/v4/classic/parse.d.cts +0 -44
- package/node_modules/zod/v4/classic/parse.d.ts +0 -44
- package/node_modules/zod/v4/classic/parse.js +0 -16
- package/node_modules/zod/v4/classic/schemas.cjs +0 -1676
- package/node_modules/zod/v4/classic/schemas.d.cts +0 -816
- package/node_modules/zod/v4/classic/schemas.d.ts +0 -816
- package/node_modules/zod/v4/classic/schemas.js +0 -1535
- package/node_modules/zod/v4/core/api.cjs +0 -1269
- package/node_modules/zod/v4/core/api.d.cts +0 -335
- package/node_modules/zod/v4/core/api.d.ts +0 -335
- package/node_modules/zod/v4/core/api.js +0 -1107
- package/node_modules/zod/v4/core/checks.cjs +0 -561
- package/node_modules/zod/v4/core/checks.d.cts +0 -294
- package/node_modules/zod/v4/core/checks.d.ts +0 -294
- package/node_modules/zod/v4/core/checks.js +0 -516
- package/node_modules/zod/v4/core/compile.cjs +0 -1908
- package/node_modules/zod/v4/core/compile.d.cts +0 -65
- package/node_modules/zod/v4/core/compile.d.ts +0 -65
- package/node_modules/zod/v4/core/compile.js +0 -1858
- package/node_modules/zod/v4/core/core.cjs +0 -167
- package/node_modules/zod/v4/core/core.d.cts +0 -82
- package/node_modules/zod/v4/core/core.d.ts +0 -82
- package/node_modules/zod/v4/core/core.js +0 -141
- package/node_modules/zod/v4/core/doc.cjs +0 -61
- package/node_modules/zod/v4/core/doc.d.cts +0 -16
- package/node_modules/zod/v4/core/doc.d.ts +0 -16
- package/node_modules/zod/v4/core/doc.js +0 -38
- package/node_modules/zod/v4/core/errors.cjs +0 -317
- package/node_modules/zod/v4/core/errors.d.cts +0 -225
- package/node_modules/zod/v4/core/errors.d.ts +0 -225
- package/node_modules/zod/v4/core/errors.js +0 -267
- package/node_modules/zod/v4/core/index.cjs +0 -70
- package/node_modules/zod/v4/core/index.d.cts +0 -19
- package/node_modules/zod/v4/core/index.d.ts +0 -19
- package/node_modules/zod/v4/core/index.js +0 -19
- package/node_modules/zod/v4/core/json-schema-generator.cjs +0 -122
- package/node_modules/zod/v4/core/json-schema-generator.d.cts +0 -65
- package/node_modules/zod/v4/core/json-schema-generator.d.ts +0 -65
- package/node_modules/zod/v4/core/json-schema-generator.js +0 -99
- package/node_modules/zod/v4/core/json-schema-processors.cjs +0 -929
- package/node_modules/zod/v4/core/json-schema-processors.d.cts +0 -65
- package/node_modules/zod/v4/core/json-schema-processors.d.ts +0 -65
- package/node_modules/zod/v4/core/json-schema-processors.js +0 -843
- package/node_modules/zod/v4/core/json-schema.cjs +0 -21
- package/node_modules/zod/v4/core/json-schema.d.cts +0 -89
- package/node_modules/zod/v4/core/json-schema.d.ts +0 -89
- package/node_modules/zod/v4/core/json-schema.js +0 -1
- package/node_modules/zod/v4/core/memoizer.cjs +0 -360
- package/node_modules/zod/v4/core/memoizer.d.cts +0 -15
- package/node_modules/zod/v4/core/memoizer.d.ts +0 -15
- package/node_modules/zod/v4/core/memoizer.js +0 -311
- package/node_modules/zod/v4/core/package.json +0 -7
- package/node_modules/zod/v4/core/parse.cjs +0 -233
- package/node_modules/zod/v4/core/parse.d.cts +0 -52
- package/node_modules/zod/v4/core/parse.d.ts +0 -52
- package/node_modules/zod/v4/core/parse.js +0 -175
- package/node_modules/zod/v4/core/regexes.cjs +0 -209
- package/node_modules/zod/v4/core/regexes.d.cts +0 -90
- package/node_modules/zod/v4/core/regexes.d.ts +0 -90
- package/node_modules/zod/v4/core/regexes.js +0 -156
- package/node_modules/zod/v4/core/registries.cjs +0 -75
- package/node_modules/zod/v4/core/registries.d.cts +0 -35
- package/node_modules/zod/v4/core/registries.d.ts +0 -35
- package/node_modules/zod/v4/core/registries.js +0 -51
- package/node_modules/zod/v4/core/schemas.cjs +0 -2669
- package/node_modules/zod/v4/core/schemas.d.cts +0 -1273
- package/node_modules/zod/v4/core/schemas.d.ts +0 -1273
- package/node_modules/zod/v4/core/schemas.js +0 -2606
- package/node_modules/zod/v4/core/standard-schema.cjs +0 -21
- package/node_modules/zod/v4/core/standard-schema.d.cts +0 -126
- package/node_modules/zod/v4/core/standard-schema.d.ts +0 -126
- package/node_modules/zod/v4/core/standard-schema.js +0 -1
- package/node_modules/zod/v4/core/to-json-schema.cjs +0 -681
- package/node_modules/zod/v4/core/to-json-schema.d.cts +0 -154
- package/node_modules/zod/v4/core/to-json-schema.d.ts +0 -154
- package/node_modules/zod/v4/core/to-json-schema.js +0 -651
- package/node_modules/zod/v4/core/util.cjs +0 -949
- package/node_modules/zod/v4/core/util.d.cts +0 -278
- package/node_modules/zod/v4/core/util.d.ts +0 -278
- package/node_modules/zod/v4/core/util.js +0 -859
- package/node_modules/zod/v4/core/versions.cjs +0 -27
- package/node_modules/zod/v4/core/versions.d.cts +0 -5
- package/node_modules/zod/v4/core/versions.d.ts +0 -5
- package/node_modules/zod/v4/core/versions.js +0 -5
- package/node_modules/zod/v4/core/visit.cjs +0 -214
- package/node_modules/zod/v4/core/visit.d.cts +0 -30
- package/node_modules/zod/v4/core/visit.d.ts +0 -30
- package/node_modules/zod/v4/core/visit.js +0 -169
- package/node_modules/zod/v4/index.cjs +0 -51
- package/node_modules/zod/v4/index.d.cts +0 -3
- package/node_modules/zod/v4/index.d.ts +0 -3
- package/node_modules/zod/v4/index.js +0 -4
- package/node_modules/zod/v4/locales/ar.cjs +0 -138
- package/node_modules/zod/v4/locales/ar.d.cts +0 -5
- package/node_modules/zod/v4/locales/ar.d.ts +0 -4
- package/node_modules/zod/v4/locales/ar.js +0 -111
- package/node_modules/zod/v4/locales/az.cjs +0 -137
- package/node_modules/zod/v4/locales/az.d.cts +0 -5
- package/node_modules/zod/v4/locales/az.d.ts +0 -4
- package/node_modules/zod/v4/locales/az.js +0 -110
- package/node_modules/zod/v4/locales/be.cjs +0 -195
- package/node_modules/zod/v4/locales/be.d.cts +0 -5
- package/node_modules/zod/v4/locales/be.d.ts +0 -4
- package/node_modules/zod/v4/locales/be.js +0 -168
- package/node_modules/zod/v4/locales/bg.cjs +0 -152
- package/node_modules/zod/v4/locales/bg.d.cts +0 -5
- package/node_modules/zod/v4/locales/bg.d.ts +0 -4
- package/node_modules/zod/v4/locales/bg.js +0 -125
- package/node_modules/zod/v4/locales/bn.cjs +0 -140
- package/node_modules/zod/v4/locales/bn.d.cts +0 -5
- package/node_modules/zod/v4/locales/bn.d.ts +0 -4
- package/node_modules/zod/v4/locales/bn.js +0 -113
- package/node_modules/zod/v4/locales/ca.cjs +0 -139
- package/node_modules/zod/v4/locales/ca.d.cts +0 -5
- package/node_modules/zod/v4/locales/ca.d.ts +0 -4
- package/node_modules/zod/v4/locales/ca.js +0 -112
- package/node_modules/zod/v4/locales/ckb.cjs +0 -160
- package/node_modules/zod/v4/locales/ckb.d.cts +0 -5
- package/node_modules/zod/v4/locales/ckb.d.ts +0 -4
- package/node_modules/zod/v4/locales/ckb.js +0 -133
- package/node_modules/zod/v4/locales/cs.cjs +0 -143
- package/node_modules/zod/v4/locales/cs.d.cts +0 -5
- package/node_modules/zod/v4/locales/cs.d.ts +0 -4
- package/node_modules/zod/v4/locales/cs.js +0 -116
- package/node_modules/zod/v4/locales/da.cjs +0 -147
- package/node_modules/zod/v4/locales/da.d.cts +0 -5
- package/node_modules/zod/v4/locales/da.d.ts +0 -4
- package/node_modules/zod/v4/locales/da.js +0 -120
- package/node_modules/zod/v4/locales/de.cjs +0 -140
- package/node_modules/zod/v4/locales/de.d.cts +0 -5
- package/node_modules/zod/v4/locales/de.d.ts +0 -4
- package/node_modules/zod/v4/locales/de.js +0 -113
- package/node_modules/zod/v4/locales/el.cjs +0 -139
- package/node_modules/zod/v4/locales/el.d.cts +0 -5
- package/node_modules/zod/v4/locales/el.d.ts +0 -4
- package/node_modules/zod/v4/locales/el.js +0 -112
- package/node_modules/zod/v4/locales/en.cjs +0 -152
- package/node_modules/zod/v4/locales/en.d.cts +0 -5
- package/node_modules/zod/v4/locales/en.d.ts +0 -4
- package/node_modules/zod/v4/locales/en.js +0 -125
- package/node_modules/zod/v4/locales/eo.cjs +0 -141
- package/node_modules/zod/v4/locales/eo.d.cts +0 -5
- package/node_modules/zod/v4/locales/eo.d.ts +0 -4
- package/node_modules/zod/v4/locales/eo.js +0 -114
- package/node_modules/zod/v4/locales/es.cjs +0 -163
- package/node_modules/zod/v4/locales/es.d.cts +0 -5
- package/node_modules/zod/v4/locales/es.d.ts +0 -4
- package/node_modules/zod/v4/locales/es.js +0 -136
- package/node_modules/zod/v4/locales/fa.cjs +0 -146
- package/node_modules/zod/v4/locales/fa.d.cts +0 -5
- package/node_modules/zod/v4/locales/fa.d.ts +0 -4
- package/node_modules/zod/v4/locales/fa.js +0 -119
- package/node_modules/zod/v4/locales/fi.cjs +0 -144
- package/node_modules/zod/v4/locales/fi.d.cts +0 -5
- package/node_modules/zod/v4/locales/fi.d.ts +0 -4
- package/node_modules/zod/v4/locales/fi.js +0 -117
- package/node_modules/zod/v4/locales/fr-CA.cjs +0 -139
- package/node_modules/zod/v4/locales/fr-CA.d.cts +0 -5
- package/node_modules/zod/v4/locales/fr-CA.d.ts +0 -4
- package/node_modules/zod/v4/locales/fr-CA.js +0 -112
- package/node_modules/zod/v4/locales/fr.cjs +0 -156
- package/node_modules/zod/v4/locales/fr.d.cts +0 -5
- package/node_modules/zod/v4/locales/fr.d.ts +0 -4
- package/node_modules/zod/v4/locales/fr.js +0 -129
- package/node_modules/zod/v4/locales/gu.cjs +0 -140
- package/node_modules/zod/v4/locales/gu.d.cts +0 -5
- package/node_modules/zod/v4/locales/gu.d.ts +0 -4
- package/node_modules/zod/v4/locales/gu.js +0 -113
- package/node_modules/zod/v4/locales/he.cjs +0 -248
- package/node_modules/zod/v4/locales/he.d.cts +0 -5
- package/node_modules/zod/v4/locales/he.d.ts +0 -4
- package/node_modules/zod/v4/locales/he.js +0 -221
- package/node_modules/zod/v4/locales/hi.cjs +0 -138
- package/node_modules/zod/v4/locales/hi.d.cts +0 -5
- package/node_modules/zod/v4/locales/hi.d.ts +0 -4
- package/node_modules/zod/v4/locales/hi.js +0 -111
- package/node_modules/zod/v4/locales/hr.cjs +0 -153
- package/node_modules/zod/v4/locales/hr.d.cts +0 -5
- package/node_modules/zod/v4/locales/hr.d.ts +0 -4
- package/node_modules/zod/v4/locales/hr.js +0 -126
- package/node_modules/zod/v4/locales/hu.cjs +0 -140
- package/node_modules/zod/v4/locales/hu.d.cts +0 -5
- package/node_modules/zod/v4/locales/hu.d.ts +0 -4
- package/node_modules/zod/v4/locales/hu.js +0 -113
- package/node_modules/zod/v4/locales/hy.cjs +0 -185
- package/node_modules/zod/v4/locales/hy.d.cts +0 -5
- package/node_modules/zod/v4/locales/hy.d.ts +0 -4
- package/node_modules/zod/v4/locales/hy.js +0 -158
- package/node_modules/zod/v4/locales/id.cjs +0 -138
- package/node_modules/zod/v4/locales/id.d.cts +0 -5
- package/node_modules/zod/v4/locales/id.d.ts +0 -4
- package/node_modules/zod/v4/locales/id.js +0 -111
- package/node_modules/zod/v4/locales/index.cjs +0 -152
- package/node_modules/zod/v4/locales/index.d.cts +0 -63
- package/node_modules/zod/v4/locales/index.d.ts +0 -63
- package/node_modules/zod/v4/locales/index.js +0 -63
- package/node_modules/zod/v4/locales/is.cjs +0 -141
- package/node_modules/zod/v4/locales/is.d.cts +0 -5
- package/node_modules/zod/v4/locales/is.d.ts +0 -4
- package/node_modules/zod/v4/locales/is.js +0 -114
- package/node_modules/zod/v4/locales/it.cjs +0 -140
- package/node_modules/zod/v4/locales/it.d.cts +0 -5
- package/node_modules/zod/v4/locales/it.d.ts +0 -4
- package/node_modules/zod/v4/locales/it.js +0 -113
- package/node_modules/zod/v4/locales/ja.cjs +0 -139
- package/node_modules/zod/v4/locales/ja.d.cts +0 -5
- package/node_modules/zod/v4/locales/ja.d.ts +0 -4
- package/node_modules/zod/v4/locales/ja.js +0 -112
- package/node_modules/zod/v4/locales/ka.cjs +0 -144
- package/node_modules/zod/v4/locales/ka.d.cts +0 -5
- package/node_modules/zod/v4/locales/ka.d.ts +0 -4
- package/node_modules/zod/v4/locales/ka.js +0 -117
- package/node_modules/zod/v4/locales/kh.cjs +0 -12
- package/node_modules/zod/v4/locales/kh.d.cts +0 -5
- package/node_modules/zod/v4/locales/kh.d.ts +0 -5
- package/node_modules/zod/v4/locales/kh.js +0 -5
- package/node_modules/zod/v4/locales/km.cjs +0 -142
- package/node_modules/zod/v4/locales/km.d.cts +0 -5
- package/node_modules/zod/v4/locales/km.d.ts +0 -4
- package/node_modules/zod/v4/locales/km.js +0 -115
- package/node_modules/zod/v4/locales/kn.cjs +0 -143
- package/node_modules/zod/v4/locales/kn.d.cts +0 -5
- package/node_modules/zod/v4/locales/kn.d.ts +0 -4
- package/node_modules/zod/v4/locales/kn.js +0 -116
- package/node_modules/zod/v4/locales/ko.cjs +0 -143
- package/node_modules/zod/v4/locales/ko.d.cts +0 -5
- package/node_modules/zod/v4/locales/ko.d.ts +0 -4
- package/node_modules/zod/v4/locales/ko.js +0 -116
- package/node_modules/zod/v4/locales/lt.cjs +0 -234
- package/node_modules/zod/v4/locales/lt.d.cts +0 -5
- package/node_modules/zod/v4/locales/lt.d.ts +0 -4
- package/node_modules/zod/v4/locales/lt.js +0 -207
- package/node_modules/zod/v4/locales/mk.cjs +0 -141
- package/node_modules/zod/v4/locales/mk.d.cts +0 -5
- package/node_modules/zod/v4/locales/mk.d.ts +0 -4
- package/node_modules/zod/v4/locales/mk.js +0 -114
- package/node_modules/zod/v4/locales/ms.cjs +0 -139
- package/node_modules/zod/v4/locales/ms.d.cts +0 -5
- package/node_modules/zod/v4/locales/ms.d.ts +0 -4
- package/node_modules/zod/v4/locales/ms.js +0 -112
- package/node_modules/zod/v4/locales/ne.cjs +0 -138
- package/node_modules/zod/v4/locales/ne.d.cts +0 -5
- package/node_modules/zod/v4/locales/ne.d.ts +0 -4
- package/node_modules/zod/v4/locales/ne.js +0 -111
- package/node_modules/zod/v4/locales/nl.cjs +0 -142
- package/node_modules/zod/v4/locales/nl.d.cts +0 -5
- package/node_modules/zod/v4/locales/nl.d.ts +0 -4
- package/node_modules/zod/v4/locales/nl.js +0 -115
- package/node_modules/zod/v4/locales/nn.cjs +0 -140
- package/node_modules/zod/v4/locales/nn.d.cts +0 -5
- package/node_modules/zod/v4/locales/nn.d.ts +0 -4
- package/node_modules/zod/v4/locales/nn.js +0 -113
- package/node_modules/zod/v4/locales/no.cjs +0 -140
- package/node_modules/zod/v4/locales/no.d.cts +0 -5
- package/node_modules/zod/v4/locales/no.d.ts +0 -4
- package/node_modules/zod/v4/locales/no.js +0 -113
- package/node_modules/zod/v4/locales/ota.cjs +0 -141
- package/node_modules/zod/v4/locales/ota.d.cts +0 -5
- package/node_modules/zod/v4/locales/ota.d.ts +0 -4
- package/node_modules/zod/v4/locales/ota.js +0 -114
- package/node_modules/zod/v4/locales/package.json +0 -7
- package/node_modules/zod/v4/locales/pl.cjs +0 -141
- package/node_modules/zod/v4/locales/pl.d.cts +0 -5
- package/node_modules/zod/v4/locales/pl.d.ts +0 -4
- package/node_modules/zod/v4/locales/pl.js +0 -114
- package/node_modules/zod/v4/locales/ps.cjs +0 -146
- package/node_modules/zod/v4/locales/ps.d.cts +0 -5
- package/node_modules/zod/v4/locales/ps.d.ts +0 -4
- package/node_modules/zod/v4/locales/ps.js +0 -119
- package/node_modules/zod/v4/locales/pt-BR.cjs +0 -170
- package/node_modules/zod/v4/locales/pt-BR.d.cts +0 -5
- package/node_modules/zod/v4/locales/pt-BR.d.ts +0 -4
- package/node_modules/zod/v4/locales/pt-BR.js +0 -143
- package/node_modules/zod/v4/locales/pt.cjs +0 -169
- package/node_modules/zod/v4/locales/pt.d.cts +0 -5
- package/node_modules/zod/v4/locales/pt.d.ts +0 -4
- package/node_modules/zod/v4/locales/pt.js +0 -142
- package/node_modules/zod/v4/locales/ro.cjs +0 -149
- package/node_modules/zod/v4/locales/ro.d.cts +0 -5
- package/node_modules/zod/v4/locales/ro.d.ts +0 -4
- package/node_modules/zod/v4/locales/ro.js +0 -122
- package/node_modules/zod/v4/locales/ru.cjs +0 -195
- package/node_modules/zod/v4/locales/ru.d.cts +0 -5
- package/node_modules/zod/v4/locales/ru.d.ts +0 -4
- package/node_modules/zod/v4/locales/ru.js +0 -168
- package/node_modules/zod/v4/locales/sk.cjs +0 -143
- package/node_modules/zod/v4/locales/sk.d.cts +0 -5
- package/node_modules/zod/v4/locales/sk.d.ts +0 -4
- package/node_modules/zod/v4/locales/sk.js +0 -116
- package/node_modules/zod/v4/locales/sl.cjs +0 -141
- package/node_modules/zod/v4/locales/sl.d.cts +0 -5
- package/node_modules/zod/v4/locales/sl.d.ts +0 -4
- package/node_modules/zod/v4/locales/sl.js +0 -114
- package/node_modules/zod/v4/locales/sv.cjs +0 -142
- package/node_modules/zod/v4/locales/sv.d.cts +0 -5
- package/node_modules/zod/v4/locales/sv.d.ts +0 -4
- package/node_modules/zod/v4/locales/sv.js +0 -115
- package/node_modules/zod/v4/locales/ta.cjs +0 -142
- package/node_modules/zod/v4/locales/ta.d.cts +0 -5
- package/node_modules/zod/v4/locales/ta.d.ts +0 -4
- package/node_modules/zod/v4/locales/ta.js +0 -115
- package/node_modules/zod/v4/locales/tg.cjs +0 -144
- package/node_modules/zod/v4/locales/tg.d.cts +0 -5
- package/node_modules/zod/v4/locales/tg.d.ts +0 -4
- package/node_modules/zod/v4/locales/tg.js +0 -117
- package/node_modules/zod/v4/locales/th.cjs +0 -142
- package/node_modules/zod/v4/locales/th.d.cts +0 -5
- package/node_modules/zod/v4/locales/th.d.ts +0 -4
- package/node_modules/zod/v4/locales/th.js +0 -115
- package/node_modules/zod/v4/locales/tk.cjs +0 -134
- package/node_modules/zod/v4/locales/tk.d.cts +0 -5
- package/node_modules/zod/v4/locales/tk.d.ts +0 -4
- package/node_modules/zod/v4/locales/tk.js +0 -107
- package/node_modules/zod/v4/locales/tr.cjs +0 -137
- package/node_modules/zod/v4/locales/tr.d.cts +0 -5
- package/node_modules/zod/v4/locales/tr.d.ts +0 -4
- package/node_modules/zod/v4/locales/tr.js +0 -110
- package/node_modules/zod/v4/locales/ua.cjs +0 -12
- package/node_modules/zod/v4/locales/ua.d.cts +0 -5
- package/node_modules/zod/v4/locales/ua.d.ts +0 -5
- package/node_modules/zod/v4/locales/ua.js +0 -5
- package/node_modules/zod/v4/locales/uk.cjs +0 -140
- package/node_modules/zod/v4/locales/uk.d.cts +0 -5
- package/node_modules/zod/v4/locales/uk.d.ts +0 -4
- package/node_modules/zod/v4/locales/uk.js +0 -113
- package/node_modules/zod/v4/locales/ur.cjs +0 -142
- package/node_modules/zod/v4/locales/ur.d.cts +0 -5
- package/node_modules/zod/v4/locales/ur.d.ts +0 -4
- package/node_modules/zod/v4/locales/ur.js +0 -115
- package/node_modules/zod/v4/locales/uz.cjs +0 -140
- package/node_modules/zod/v4/locales/uz.d.cts +0 -5
- package/node_modules/zod/v4/locales/uz.d.ts +0 -4
- package/node_modules/zod/v4/locales/uz.js +0 -113
- package/node_modules/zod/v4/locales/vi.cjs +0 -140
- package/node_modules/zod/v4/locales/vi.d.cts +0 -5
- package/node_modules/zod/v4/locales/vi.d.ts +0 -4
- package/node_modules/zod/v4/locales/vi.js +0 -113
- package/node_modules/zod/v4/locales/yo.cjs +0 -139
- package/node_modules/zod/v4/locales/yo.d.cts +0 -5
- package/node_modules/zod/v4/locales/yo.d.ts +0 -4
- package/node_modules/zod/v4/locales/yo.js +0 -112
- package/node_modules/zod/v4/locales/zh-CN.cjs +0 -141
- package/node_modules/zod/v4/locales/zh-CN.d.cts +0 -5
- package/node_modules/zod/v4/locales/zh-CN.d.ts +0 -4
- package/node_modules/zod/v4/locales/zh-CN.js +0 -114
- package/node_modules/zod/v4/locales/zh-TW.cjs +0 -139
- package/node_modules/zod/v4/locales/zh-TW.d.cts +0 -5
- package/node_modules/zod/v4/locales/zh-TW.d.ts +0 -4
- package/node_modules/zod/v4/locales/zh-TW.js +0 -112
- package/node_modules/zod/v4/mini/checks.cjs +0 -54
- package/node_modules/zod/v4/mini/checks.d.cts +0 -1
- package/node_modules/zod/v4/mini/checks.d.ts +0 -1
- package/node_modules/zod/v4/mini/checks.js +0 -1
- package/node_modules/zod/v4/mini/coerce.cjs +0 -71
- package/node_modules/zod/v4/mini/coerce.d.cts +0 -7
- package/node_modules/zod/v4/mini/coerce.d.ts +0 -7
- package/node_modules/zod/v4/mini/coerce.js +0 -22
- package/node_modules/zod/v4/mini/deep-partial.cjs +0 -58
- package/node_modules/zod/v4/mini/deep-partial.d.cts +0 -14
- package/node_modules/zod/v4/mini/deep-partial.d.ts +0 -14
- package/node_modules/zod/v4/mini/deep-partial.js +0 -13
- package/node_modules/zod/v4/mini/external.cjs +0 -95
- package/node_modules/zod/v4/mini/external.d.cts +0 -16
- package/node_modules/zod/v4/mini/external.d.ts +0 -16
- package/node_modules/zod/v4/mini/external.js +0 -16
- package/node_modules/zod/v4/mini/in-out.cjs +0 -82
- package/node_modules/zod/v4/mini/in-out.d.cts +0 -8
- package/node_modules/zod/v4/mini/in-out.d.ts +0 -8
- package/node_modules/zod/v4/mini/in-out.js +0 -36
- package/node_modules/zod/v4/mini/index.cjs +0 -51
- package/node_modules/zod/v4/mini/index.d.cts +0 -3
- package/node_modules/zod/v4/mini/index.d.ts +0 -3
- package/node_modules/zod/v4/mini/index.js +0 -3
- package/node_modules/zod/v4/mini/iso.cjs +0 -83
- package/node_modules/zod/v4/mini/iso.d.cts +0 -22
- package/node_modules/zod/v4/mini/iso.d.ts +0 -22
- package/node_modules/zod/v4/mini/iso.js +0 -34
- package/node_modules/zod/v4/mini/package.json +0 -7
- package/node_modules/zod/v4/mini/parse.cjs +0 -37
- package/node_modules/zod/v4/mini/parse.d.cts +0 -1
- package/node_modules/zod/v4/mini/parse.d.ts +0 -1
- package/node_modules/zod/v4/mini/parse.js +0 -1
- package/node_modules/zod/v4/mini/schemas.cjs +0 -1147
- package/node_modules/zod/v4/mini/schemas.d.cts +0 -480
- package/node_modules/zod/v4/mini/schemas.d.ts +0 -480
- package/node_modules/zod/v4/mini/schemas.js +0 -1002
- package/node_modules/zod/v4/package.json +0 -7
- package/node_modules/zod/v4-mini/index.cjs +0 -51
- package/node_modules/zod/v4-mini/index.d.cts +0 -3
- package/node_modules/zod/v4-mini/index.d.ts +0 -3
- package/node_modules/zod/v4-mini/index.js +0 -3
- package/node_modules/zod/v4-mini/package.json +0 -7
|
@@ -1,985 +0,0 @@
|
|
|
1
|
-
import v8 from "node:v8";
|
|
2
|
-
import vm from "node:vm";
|
|
3
|
-
import { expect, test } from "vitest";
|
|
4
|
-
import * as z from "zod/v4";
|
|
5
|
-
|
|
6
|
-
test("parses a self-referential object and preserves identity", () => {
|
|
7
|
-
const Node: any = z.object({
|
|
8
|
-
id: z.number(),
|
|
9
|
-
get self() {
|
|
10
|
-
return Node;
|
|
11
|
-
},
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
const input: any = { id: 1 };
|
|
15
|
-
input.self = input;
|
|
16
|
-
|
|
17
|
-
const result = Node.parse(input);
|
|
18
|
-
expect(result.id).toBe(1);
|
|
19
|
-
expect(result.self).toBe(result);
|
|
20
|
-
expect(result).not.toBe(input);
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
test("validates a node against every schema that reaches it", () => {
|
|
24
|
-
const A: any = z.object({
|
|
25
|
-
x: z.string(),
|
|
26
|
-
get b() {
|
|
27
|
-
return B;
|
|
28
|
-
},
|
|
29
|
-
});
|
|
30
|
-
const B: any = z.object({
|
|
31
|
-
y: z.number(),
|
|
32
|
-
get a() {
|
|
33
|
-
return A;
|
|
34
|
-
},
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
const input: any = { x: "s", y: 1 };
|
|
38
|
-
input.b = input;
|
|
39
|
-
input.a = input;
|
|
40
|
-
|
|
41
|
-
const result = A.parse(input);
|
|
42
|
-
expect(Object.keys(result).sort()).toEqual(["b", "x"]);
|
|
43
|
-
expect(Object.keys(result.b).sort()).toEqual(["a", "y"]);
|
|
44
|
-
expect(result.b.y).toBe(1);
|
|
45
|
-
expect(result.b.a).toBe(result);
|
|
46
|
-
|
|
47
|
-
const bad: any = { x: "s", y: "not a number" };
|
|
48
|
-
bad.b = bad;
|
|
49
|
-
bad.a = bad;
|
|
50
|
-
expect(A.safeParse(bad).success).toBe(false);
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
test("breaks cycles through every container", () => {
|
|
54
|
-
const cases: [string, () => { schema: any; input: any }][] = [
|
|
55
|
-
[
|
|
56
|
-
"array",
|
|
57
|
-
() => {
|
|
58
|
-
const S: any = z.object({
|
|
59
|
-
id: z.number(),
|
|
60
|
-
get kids() {
|
|
61
|
-
return z.array(S);
|
|
62
|
-
},
|
|
63
|
-
});
|
|
64
|
-
const a: any = { id: 1, kids: [] };
|
|
65
|
-
a.kids.push(a);
|
|
66
|
-
return { schema: S, input: a };
|
|
67
|
-
},
|
|
68
|
-
],
|
|
69
|
-
[
|
|
70
|
-
"record",
|
|
71
|
-
() => {
|
|
72
|
-
const S: any = z.object({
|
|
73
|
-
id: z.number(),
|
|
74
|
-
get kids() {
|
|
75
|
-
return z.record(z.string(), S);
|
|
76
|
-
},
|
|
77
|
-
});
|
|
78
|
-
const a: any = { id: 1, kids: {} };
|
|
79
|
-
a.kids.self = a;
|
|
80
|
-
return { schema: S, input: a };
|
|
81
|
-
},
|
|
82
|
-
],
|
|
83
|
-
[
|
|
84
|
-
"tuple",
|
|
85
|
-
() => {
|
|
86
|
-
const S: any = z.object({
|
|
87
|
-
id: z.number(),
|
|
88
|
-
get pair() {
|
|
89
|
-
return z.tuple([z.number(), S]);
|
|
90
|
-
},
|
|
91
|
-
});
|
|
92
|
-
const a: any = { id: 1 };
|
|
93
|
-
a.pair = [1, a];
|
|
94
|
-
return { schema: S, input: a };
|
|
95
|
-
},
|
|
96
|
-
],
|
|
97
|
-
[
|
|
98
|
-
"set",
|
|
99
|
-
() => {
|
|
100
|
-
const S: any = z.object({
|
|
101
|
-
id: z.number(),
|
|
102
|
-
get peers() {
|
|
103
|
-
return z.set(S);
|
|
104
|
-
},
|
|
105
|
-
});
|
|
106
|
-
const a: any = { id: 1, peers: new Set() };
|
|
107
|
-
a.peers.add(a);
|
|
108
|
-
return { schema: S, input: a };
|
|
109
|
-
},
|
|
110
|
-
],
|
|
111
|
-
[
|
|
112
|
-
"map",
|
|
113
|
-
() => {
|
|
114
|
-
const S: any = z.object({
|
|
115
|
-
id: z.number(),
|
|
116
|
-
get links() {
|
|
117
|
-
return z.map(z.string(), S);
|
|
118
|
-
},
|
|
119
|
-
});
|
|
120
|
-
const a: any = { id: 1, links: new Map() };
|
|
121
|
-
a.links.set("s", a);
|
|
122
|
-
return { schema: S, input: a };
|
|
123
|
-
},
|
|
124
|
-
],
|
|
125
|
-
[
|
|
126
|
-
"union",
|
|
127
|
-
() => {
|
|
128
|
-
const S: any = z.object({
|
|
129
|
-
id: z.number(),
|
|
130
|
-
get self() {
|
|
131
|
-
return z.union([z.string(), S]);
|
|
132
|
-
},
|
|
133
|
-
});
|
|
134
|
-
const a: any = { id: 1 };
|
|
135
|
-
a.self = a;
|
|
136
|
-
return { schema: S, input: a };
|
|
137
|
-
},
|
|
138
|
-
],
|
|
139
|
-
[
|
|
140
|
-
"discriminated union",
|
|
141
|
-
() => {
|
|
142
|
-
const S: any = z.discriminatedUnion("kind", [
|
|
143
|
-
z.object({ kind: z.literal("leaf"), v: z.number() }),
|
|
144
|
-
z.object({
|
|
145
|
-
kind: z.literal("branch"),
|
|
146
|
-
get next() {
|
|
147
|
-
return S;
|
|
148
|
-
},
|
|
149
|
-
}),
|
|
150
|
-
]);
|
|
151
|
-
const a: any = { kind: "branch" };
|
|
152
|
-
a.next = a;
|
|
153
|
-
return { schema: S, input: a };
|
|
154
|
-
},
|
|
155
|
-
],
|
|
156
|
-
[
|
|
157
|
-
"lazy",
|
|
158
|
-
() => {
|
|
159
|
-
const S: any = z.object({ id: z.number(), self: z.lazy(() => S) });
|
|
160
|
-
const a: any = { id: 1 };
|
|
161
|
-
a.self = a;
|
|
162
|
-
return { schema: S, input: a };
|
|
163
|
-
},
|
|
164
|
-
],
|
|
165
|
-
[
|
|
166
|
-
"mutual recursion five hops apart",
|
|
167
|
-
() => {
|
|
168
|
-
const A: any = z.object({
|
|
169
|
-
get b() {
|
|
170
|
-
return B;
|
|
171
|
-
},
|
|
172
|
-
});
|
|
173
|
-
const B: any = z.object({
|
|
174
|
-
get c() {
|
|
175
|
-
return C;
|
|
176
|
-
},
|
|
177
|
-
});
|
|
178
|
-
const C: any = z.object({
|
|
179
|
-
get d() {
|
|
180
|
-
return D;
|
|
181
|
-
},
|
|
182
|
-
});
|
|
183
|
-
const D: any = z.object({
|
|
184
|
-
get e() {
|
|
185
|
-
return E;
|
|
186
|
-
},
|
|
187
|
-
});
|
|
188
|
-
const E: any = z.object({
|
|
189
|
-
get a() {
|
|
190
|
-
return A;
|
|
191
|
-
},
|
|
192
|
-
});
|
|
193
|
-
const a: any = {};
|
|
194
|
-
a.b = { c: { d: { e: { a } } } };
|
|
195
|
-
return { schema: A, input: a };
|
|
196
|
-
},
|
|
197
|
-
],
|
|
198
|
-
];
|
|
199
|
-
|
|
200
|
-
for (const [name, build] of cases) {
|
|
201
|
-
for (const jitless of [false, true]) {
|
|
202
|
-
const { schema, input } = build();
|
|
203
|
-
expect(() => schema.parse(input, { jitless }), `${name} (jitless: ${jitless})`).not.toThrow();
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
});
|
|
207
|
-
|
|
208
|
-
test("checks run once per node and never against a half-built object", () => {
|
|
209
|
-
const seen: number[] = [];
|
|
210
|
-
const Node: any = z
|
|
211
|
-
.object({
|
|
212
|
-
id: z.number(),
|
|
213
|
-
get self() {
|
|
214
|
-
return Node;
|
|
215
|
-
},
|
|
216
|
-
})
|
|
217
|
-
.refine((value: any) => {
|
|
218
|
-
seen.push(Object.keys(value).length);
|
|
219
|
-
return true;
|
|
220
|
-
});
|
|
221
|
-
|
|
222
|
-
const input: any = { id: 1 };
|
|
223
|
-
input.self = input;
|
|
224
|
-
Node.parse(input);
|
|
225
|
-
|
|
226
|
-
expect(seen).toEqual([2]);
|
|
227
|
-
});
|
|
228
|
-
|
|
229
|
-
test("reports a failing check inside a cycle", () => {
|
|
230
|
-
const Node: any = z
|
|
231
|
-
.object({
|
|
232
|
-
id: z.number(),
|
|
233
|
-
get self() {
|
|
234
|
-
return Node;
|
|
235
|
-
},
|
|
236
|
-
})
|
|
237
|
-
.refine((value: any) => value.id > 100, "too small");
|
|
238
|
-
|
|
239
|
-
const input: any = { id: 1 };
|
|
240
|
-
input.self = input;
|
|
241
|
-
expect(Node.safeParse(input).success).toBe(false);
|
|
242
|
-
});
|
|
243
|
-
|
|
244
|
-
test("reports an invalid value inside a cycle once, at its own path", () => {
|
|
245
|
-
const Node: any = z.object({
|
|
246
|
-
id: z.number(),
|
|
247
|
-
get self() {
|
|
248
|
-
return Node;
|
|
249
|
-
},
|
|
250
|
-
});
|
|
251
|
-
|
|
252
|
-
const input: any = { id: "nope" };
|
|
253
|
-
input.self = input;
|
|
254
|
-
|
|
255
|
-
const result = Node.safeParse(input);
|
|
256
|
-
expect(result.success).toBe(false);
|
|
257
|
-
expect(result.error!.issues).toHaveLength(1);
|
|
258
|
-
expect(result.error!.issues[0].path).toEqual(["id"]);
|
|
259
|
-
});
|
|
260
|
-
|
|
261
|
-
test("rejects a cycle that closes through a transform", () => {
|
|
262
|
-
const Inner: any = z.object({
|
|
263
|
-
name: z.string(),
|
|
264
|
-
get self() {
|
|
265
|
-
return Wrapped;
|
|
266
|
-
},
|
|
267
|
-
});
|
|
268
|
-
const Wrapped: any = Inner.transform((value: any) => ({ wrapped: value }));
|
|
269
|
-
|
|
270
|
-
const input: any = { name: "x" };
|
|
271
|
-
input.self = input;
|
|
272
|
-
|
|
273
|
-
expect(() => Wrapped.parse(input)).toThrow(/reference cycle/);
|
|
274
|
-
});
|
|
275
|
-
|
|
276
|
-
test("leaves a transform that is not on the cycle alone", () => {
|
|
277
|
-
const Node: any = z.object({
|
|
278
|
-
n: z.number().transform((value: number) => value * 2),
|
|
279
|
-
get self() {
|
|
280
|
-
return Node;
|
|
281
|
-
},
|
|
282
|
-
});
|
|
283
|
-
|
|
284
|
-
const input: any = { n: 21 };
|
|
285
|
-
input.self = input;
|
|
286
|
-
|
|
287
|
-
const result = Node.parse(input);
|
|
288
|
-
expect(result.n).toBe(42);
|
|
289
|
-
expect(result.self).toBe(result);
|
|
290
|
-
});
|
|
291
|
-
|
|
292
|
-
test("encodes through a cycle", () => {
|
|
293
|
-
const Stringified = z.codec(z.string(), z.number(), {
|
|
294
|
-
decode: (value) => Number(value),
|
|
295
|
-
encode: (value) => String(value),
|
|
296
|
-
});
|
|
297
|
-
const Node: any = z.object({
|
|
298
|
-
n: Stringified,
|
|
299
|
-
get self() {
|
|
300
|
-
return Node;
|
|
301
|
-
},
|
|
302
|
-
});
|
|
303
|
-
|
|
304
|
-
const input: any = { n: 5 };
|
|
305
|
-
input.self = input;
|
|
306
|
-
|
|
307
|
-
const result: any = z.encode(Node, input);
|
|
308
|
-
expect(result.n).toBe("5");
|
|
309
|
-
expect(result.self).toBe(result);
|
|
310
|
-
});
|
|
311
|
-
|
|
312
|
-
test("keeps separate parses independent", () => {
|
|
313
|
-
const Node: any = z.object({
|
|
314
|
-
id: z.number(),
|
|
315
|
-
get self() {
|
|
316
|
-
return Node;
|
|
317
|
-
},
|
|
318
|
-
});
|
|
319
|
-
|
|
320
|
-
const input: any = { id: 1 };
|
|
321
|
-
input.self = input;
|
|
322
|
-
|
|
323
|
-
const first = Node.parse(input);
|
|
324
|
-
const second = Node.parse(input);
|
|
325
|
-
expect(first).not.toBe(second);
|
|
326
|
-
expect(first.self).toBe(first);
|
|
327
|
-
expect(second.self).toBe(second);
|
|
328
|
-
|
|
329
|
-
const bad: any = { id: "x" };
|
|
330
|
-
bad.self = bad;
|
|
331
|
-
expect(Node.safeParse(bad).success).toBe(false);
|
|
332
|
-
expect(Node.safeParse(input).success).toBe(true);
|
|
333
|
-
});
|
|
334
|
-
|
|
335
|
-
test("parses a cycle asynchronously", async () => {
|
|
336
|
-
const Node: any = z.object({
|
|
337
|
-
id: z.number().refine(async (value: number) => value > 0),
|
|
338
|
-
get self() {
|
|
339
|
-
return Node;
|
|
340
|
-
},
|
|
341
|
-
});
|
|
342
|
-
|
|
343
|
-
const input: any = { id: 1 };
|
|
344
|
-
input.self = input;
|
|
345
|
-
|
|
346
|
-
const result = await Node.parseAsync(input);
|
|
347
|
-
expect(result.self).toBe(result);
|
|
348
|
-
|
|
349
|
-
const bad: any = { id: -1 };
|
|
350
|
-
bad.self = bad;
|
|
351
|
-
expect((await Node.safeParseAsync(bad)).success).toBe(false);
|
|
352
|
-
});
|
|
353
|
-
|
|
354
|
-
test("a non-recursive schema still copies a shared reference twice", () => {
|
|
355
|
-
const Leaf = z.object({ v: z.number() });
|
|
356
|
-
const Pair = z.object({ a: Leaf, b: Leaf });
|
|
357
|
-
|
|
358
|
-
const shared = { v: 1 };
|
|
359
|
-
const result = Pair.parse({ a: shared, b: shared });
|
|
360
|
-
|
|
361
|
-
expect(result.a).not.toBe(result.b);
|
|
362
|
-
expect(result.a.v).toBe(1);
|
|
363
|
-
expect(result.b.v).toBe(1);
|
|
364
|
-
});
|
|
365
|
-
|
|
366
|
-
test("a recursive schema shares one output node per input node", () => {
|
|
367
|
-
const Node: any = z.object({
|
|
368
|
-
v: z.number(),
|
|
369
|
-
get kids() {
|
|
370
|
-
return z.array(Node);
|
|
371
|
-
},
|
|
372
|
-
});
|
|
373
|
-
|
|
374
|
-
const shared: any = { v: 1, kids: [] };
|
|
375
|
-
const result = Node.parse({ v: 0, kids: [shared, shared] });
|
|
376
|
-
|
|
377
|
-
expect(result.kids[0]).toBe(result.kids[1]);
|
|
378
|
-
});
|
|
379
|
-
|
|
380
|
-
test("sync and async agree on a shared reference", async () => {
|
|
381
|
-
const build = (asyncCheck: boolean) => {
|
|
382
|
-
const Node: any = z.object({
|
|
383
|
-
v: asyncCheck ? z.number().refine(async (n: number) => n >= 0) : z.number(),
|
|
384
|
-
get kids() {
|
|
385
|
-
return z.array(Node);
|
|
386
|
-
},
|
|
387
|
-
});
|
|
388
|
-
return Node;
|
|
389
|
-
};
|
|
390
|
-
|
|
391
|
-
const shared: any = { v: 1, kids: [] };
|
|
392
|
-
const input = { v: 0, kids: [shared, shared] };
|
|
393
|
-
|
|
394
|
-
const syncResult = build(false).parse(input);
|
|
395
|
-
const asyncResult = await build(true).parseAsync(input);
|
|
396
|
-
|
|
397
|
-
expect(syncResult.kids[0]).toBe(syncResult.kids[1]);
|
|
398
|
-
expect(asyncResult.kids[0]).toBe(asyncResult.kids[1]);
|
|
399
|
-
});
|
|
400
|
-
|
|
401
|
-
test("a cycle through .readonly() keeps the node intact", () => {
|
|
402
|
-
const Node: any = z.object({
|
|
403
|
-
id: z.number(),
|
|
404
|
-
get self() {
|
|
405
|
-
return Node.readonly();
|
|
406
|
-
},
|
|
407
|
-
});
|
|
408
|
-
|
|
409
|
-
const input: any = { id: 1 };
|
|
410
|
-
input.self = input;
|
|
411
|
-
|
|
412
|
-
// Freezing a node that is still being built would make its remaining keys fail to assign, silently, because generated code is not strict mode.
|
|
413
|
-
const result = Node.parse(input);
|
|
414
|
-
expect(Object.keys(result).sort()).toEqual(["id", "self"]);
|
|
415
|
-
expect(result.self).toBe(result);
|
|
416
|
-
});
|
|
417
|
-
|
|
418
|
-
test("a cycle through z.intersection validates but does not mirror the graph", () => {
|
|
419
|
-
const Node: any = z.object({
|
|
420
|
-
id: z.number(),
|
|
421
|
-
get self() {
|
|
422
|
-
return z.intersection(Node, z.object({ id: z.number() }));
|
|
423
|
-
},
|
|
424
|
-
});
|
|
425
|
-
|
|
426
|
-
const input: any = { id: 7 };
|
|
427
|
-
input.self = input;
|
|
428
|
-
|
|
429
|
-
// The merged value is built after both sides are parsed, so it cannot be the object a back-edge already resolved to. Values are right, the graph is not.
|
|
430
|
-
const result = Node.parse(input);
|
|
431
|
-
expect(result.id).toBe(7);
|
|
432
|
-
expect(result.self.id).toBe(7);
|
|
433
|
-
expect(result.self).not.toBe(result);
|
|
434
|
-
expect(result.self.self).toBeUndefined();
|
|
435
|
-
|
|
436
|
-
const bad: any = { id: "nope" };
|
|
437
|
-
bad.self = bad;
|
|
438
|
-
expect(Node.safeParse(bad).success).toBe(false);
|
|
439
|
-
});
|
|
440
|
-
|
|
441
|
-
test("keeps two cycles and a shared node distinct in one input", () => {
|
|
442
|
-
const Node: any = z.object({
|
|
443
|
-
id: z.number(),
|
|
444
|
-
get kids() {
|
|
445
|
-
return z.array(Node);
|
|
446
|
-
},
|
|
447
|
-
});
|
|
448
|
-
|
|
449
|
-
const shared: any = { id: 9, kids: [] };
|
|
450
|
-
const root: any = { id: 0, kids: [shared, shared] };
|
|
451
|
-
root.kids.push(root);
|
|
452
|
-
|
|
453
|
-
const result = Node.parse(root);
|
|
454
|
-
expect(result.kids[0]).toBe(result.kids[1]);
|
|
455
|
-
expect(result.kids[2]).toBe(result);
|
|
456
|
-
});
|
|
457
|
-
|
|
458
|
-
test("closes a cycle through a Map key and a Set member", () => {
|
|
459
|
-
const Keyed: any = z.object({
|
|
460
|
-
id: z.number(),
|
|
461
|
-
get keyed() {
|
|
462
|
-
return z.map(Keyed, z.string());
|
|
463
|
-
},
|
|
464
|
-
});
|
|
465
|
-
const k: any = { id: 1, keyed: new Map() };
|
|
466
|
-
k.keyed.set(k, "v");
|
|
467
|
-
const keyedOut = Keyed.parse(k);
|
|
468
|
-
expect([...keyedOut.keyed.keys()][0]).toBe(keyedOut);
|
|
469
|
-
|
|
470
|
-
const Peered: any = z.object({
|
|
471
|
-
id: z.number(),
|
|
472
|
-
get peers() {
|
|
473
|
-
return z.set(Peered);
|
|
474
|
-
},
|
|
475
|
-
});
|
|
476
|
-
const p: any = { id: 1, peers: new Set() };
|
|
477
|
-
p.peers.add(p);
|
|
478
|
-
const peeredOut = Peered.parse(p);
|
|
479
|
-
expect([...peeredOut.peers][0]).toBe(peeredOut);
|
|
480
|
-
});
|
|
481
|
-
|
|
482
|
-
test("does not mutate the input, and tolerates a frozen one", () => {
|
|
483
|
-
const Node: any = z.object({
|
|
484
|
-
id: z.number(),
|
|
485
|
-
get self() {
|
|
486
|
-
return Node;
|
|
487
|
-
},
|
|
488
|
-
});
|
|
489
|
-
|
|
490
|
-
const input: any = { id: 1 };
|
|
491
|
-
input.self = input;
|
|
492
|
-
Object.freeze(input);
|
|
493
|
-
|
|
494
|
-
const result = Node.parse(input);
|
|
495
|
-
expect(result).not.toBe(input);
|
|
496
|
-
expect(result.self).toBe(result);
|
|
497
|
-
expect(Reflect.ownKeys(input)).toEqual(["id", "self"]);
|
|
498
|
-
});
|
|
499
|
-
|
|
500
|
-
test("keys identity on the schema, not just the input", () => {
|
|
501
|
-
const Node: any = z.object({
|
|
502
|
-
id: z.number(),
|
|
503
|
-
get self() {
|
|
504
|
-
return Node.optional();
|
|
505
|
-
},
|
|
506
|
-
});
|
|
507
|
-
const Partial: any = Node.partial();
|
|
508
|
-
|
|
509
|
-
const input: any = { id: 1 };
|
|
510
|
-
input.self = input;
|
|
511
|
-
|
|
512
|
-
// `Partial` and `Node` are different schemas, so the root and the node its cycle points back to are different output objects. Same rule that lets one input node be validated against two schemas in mutual recursion.
|
|
513
|
-
const result = Partial.parse(input);
|
|
514
|
-
expect(result.self).not.toBe(result);
|
|
515
|
-
expect(result.self.self).toBe(result.self);
|
|
516
|
-
expect(result.id).toBe(1);
|
|
517
|
-
expect(result.self.id).toBe(1);
|
|
518
|
-
});
|
|
519
|
-
|
|
520
|
-
test("keeps concurrent async parses of one schema independent", async () => {
|
|
521
|
-
const Node: any = z.object({
|
|
522
|
-
id: z.number().refine(async (n: number) => {
|
|
523
|
-
await new Promise((r) => setTimeout(r, 5 + (n % 3)));
|
|
524
|
-
return true;
|
|
525
|
-
}),
|
|
526
|
-
get self() {
|
|
527
|
-
return Node;
|
|
528
|
-
},
|
|
529
|
-
});
|
|
530
|
-
|
|
531
|
-
const make = (id: number) => {
|
|
532
|
-
const o: any = { id };
|
|
533
|
-
o.self = o;
|
|
534
|
-
return o;
|
|
535
|
-
};
|
|
536
|
-
|
|
537
|
-
const [a, b, c] = await Promise.all([Node.parseAsync(make(1)), Node.parseAsync(make(2)), Node.parseAsync(make(3))]);
|
|
538
|
-
|
|
539
|
-
expect([a.id, b.id, c.id]).toEqual([1, 2, 3]);
|
|
540
|
-
expect(a.self).toBe(a);
|
|
541
|
-
expect(b.self).toBe(b);
|
|
542
|
-
expect(c.self).toBe(c);
|
|
543
|
-
});
|
|
544
|
-
|
|
545
|
-
test("runs checks once per reference, as it does without a cycle", () => {
|
|
546
|
-
let calls = 0;
|
|
547
|
-
const Node: any = z
|
|
548
|
-
.object({
|
|
549
|
-
id: z.number(),
|
|
550
|
-
get kids() {
|
|
551
|
-
return z.array(Node);
|
|
552
|
-
},
|
|
553
|
-
})
|
|
554
|
-
.refine(() => {
|
|
555
|
-
calls++;
|
|
556
|
-
return true;
|
|
557
|
-
});
|
|
558
|
-
|
|
559
|
-
const shared: any = { id: 1, kids: [] };
|
|
560
|
-
Node.parse({ id: 0, kids: [shared, shared] });
|
|
561
|
-
|
|
562
|
-
// Memoization skips the container's parse, not the checks layered on it.
|
|
563
|
-
expect(calls).toBe(3);
|
|
564
|
-
});
|
|
565
|
-
|
|
566
|
-
test("a schema wrapped at the root adds one node and no more", () => {
|
|
567
|
-
const Node: any = z.object({
|
|
568
|
-
id: z.number(),
|
|
569
|
-
get self() {
|
|
570
|
-
return Node.optional();
|
|
571
|
-
},
|
|
572
|
-
});
|
|
573
|
-
|
|
574
|
-
const input: any = { id: 1 };
|
|
575
|
-
input.self = input;
|
|
576
|
-
|
|
577
|
-
// The root is keyed on the wrapper, everything under it on `Node`, so the graph closes one level down rather than at the root. It does not compound: stacking wrappers still yields exactly two nodes.
|
|
578
|
-
const count = (root: any) => {
|
|
579
|
-
const seen: any[] = [];
|
|
580
|
-
let n = root;
|
|
581
|
-
while (n && !seen.includes(n)) {
|
|
582
|
-
seen.push(n);
|
|
583
|
-
n = n.self;
|
|
584
|
-
}
|
|
585
|
-
return seen.length;
|
|
586
|
-
};
|
|
587
|
-
|
|
588
|
-
expect(count(Node.parse(input))).toBe(1);
|
|
589
|
-
expect(count(Node.partial().parse(input))).toBe(2);
|
|
590
|
-
expect(count(Node.partial().partial().parse(input))).toBe(2);
|
|
591
|
-
expect(count(Node.extend({ extra: z.string().optional() }).parse(input))).toBe(2);
|
|
592
|
-
});
|
|
593
|
-
|
|
594
|
-
test("resolves a recursive reference once, however it is written", () => {
|
|
595
|
-
// This is what bounds the above: core caches a shape getter and a lazy getter, so a getter returning a fresh clone still yields a finite schema graph rather than a new schema per node.
|
|
596
|
-
let getterCalls = 0;
|
|
597
|
-
const ViaGetter: any = z.object({
|
|
598
|
-
id: z.number(),
|
|
599
|
-
get self() {
|
|
600
|
-
getterCalls++;
|
|
601
|
-
return ViaGetter.partial();
|
|
602
|
-
},
|
|
603
|
-
});
|
|
604
|
-
|
|
605
|
-
let lazyCalls = 0;
|
|
606
|
-
const ViaLazy: any = z.object({
|
|
607
|
-
id: z.number(),
|
|
608
|
-
self: z.lazy(() => {
|
|
609
|
-
lazyCalls++;
|
|
610
|
-
return ViaLazy.partial();
|
|
611
|
-
}),
|
|
612
|
-
});
|
|
613
|
-
|
|
614
|
-
const input: any = { id: 1 };
|
|
615
|
-
input.self = input;
|
|
616
|
-
|
|
617
|
-
expect(() => ViaGetter.parse(input)).not.toThrow();
|
|
618
|
-
expect(() => ViaLazy.parse(input)).not.toThrow();
|
|
619
|
-
expect(getterCalls).toBe(1);
|
|
620
|
-
expect(lazyCalls).toBe(1);
|
|
621
|
-
});
|
|
622
|
-
|
|
623
|
-
// The second visitor of a shared node must not prefix onto the first visitor's path.
|
|
624
|
-
test.each([false, true])("prefixes a shared node's issues once per reference (jitless: %s)", (jitless) => {
|
|
625
|
-
z.config({ jitless });
|
|
626
|
-
try {
|
|
627
|
-
const Node: any = z.object({
|
|
628
|
-
name: z.string(),
|
|
629
|
-
get left() {
|
|
630
|
-
return z.optional(Node);
|
|
631
|
-
},
|
|
632
|
-
get right() {
|
|
633
|
-
return z.optional(Node);
|
|
634
|
-
},
|
|
635
|
-
});
|
|
636
|
-
|
|
637
|
-
const shared: any = { name: 123 };
|
|
638
|
-
const result = Node.safeParse({ name: "root", left: shared, right: shared });
|
|
639
|
-
|
|
640
|
-
expect(result.success).toBe(false);
|
|
641
|
-
expect(result.error.issues.map((iss: any) => iss.path)).toEqual([
|
|
642
|
-
["left", "name"],
|
|
643
|
-
["right", "name"],
|
|
644
|
-
]);
|
|
645
|
-
} finally {
|
|
646
|
-
z.config({ jitless: false });
|
|
647
|
-
}
|
|
648
|
-
});
|
|
649
|
-
|
|
650
|
-
test("the default memoizer is installed before the first container reads it", () => {
|
|
651
|
-
// the delete manufactures the fresh-process state; a container with only getter keys then constructs no leaf before the config read
|
|
652
|
-
delete z.config().memoizer;
|
|
653
|
-
const Node: any = z.object({
|
|
654
|
-
get self() {
|
|
655
|
-
return Node;
|
|
656
|
-
},
|
|
657
|
-
});
|
|
658
|
-
const input: any = {};
|
|
659
|
-
input.self = input;
|
|
660
|
-
const out = Node.parse(input);
|
|
661
|
-
expect(out.self).toBe(out);
|
|
662
|
-
});
|
|
663
|
-
|
|
664
|
-
test("guards a transform built before any container", () => {
|
|
665
|
-
// the guard attaches at construction, so a transform predating the first container must still get the default
|
|
666
|
-
delete z.config().memoizer;
|
|
667
|
-
const wrap = z.transform((value: any) => ({ wrapped: value }));
|
|
668
|
-
const Inner: any = z.object({
|
|
669
|
-
name: z.string(),
|
|
670
|
-
get self() {
|
|
671
|
-
return Wrapped;
|
|
672
|
-
},
|
|
673
|
-
});
|
|
674
|
-
const Wrapped: any = z.pipe(Inner, wrap);
|
|
675
|
-
|
|
676
|
-
const input: any = { name: "x" };
|
|
677
|
-
input.self = input;
|
|
678
|
-
|
|
679
|
-
expect(() => Wrapped.parse(input)).toThrow(/reference cycle/);
|
|
680
|
-
});
|
|
681
|
-
|
|
682
|
-
test("detects a cycle reachable only through a merged catchall", () => {
|
|
683
|
-
const Cyclic: any = z.object({
|
|
684
|
-
id: z.string(),
|
|
685
|
-
get next() {
|
|
686
|
-
return z.optional(Root);
|
|
687
|
-
},
|
|
688
|
-
});
|
|
689
|
-
const Root: any = z.object({ tag: z.string() }).merge(z.object({}).catchall(Cyclic));
|
|
690
|
-
|
|
691
|
-
const input: any = { tag: "root" };
|
|
692
|
-
input.child = { id: "1", next: input };
|
|
693
|
-
|
|
694
|
-
const out: any = Root.parse(input);
|
|
695
|
-
expect(out.child.next).toBe(out);
|
|
696
|
-
});
|
|
697
|
-
|
|
698
|
-
// the per-type switch can only enumerate kinds Zod ships, so an unknown `def.type` falls back to scanning the def; without it a cycle through a third-party container overflows the stack
|
|
699
|
-
test("detects a cycle through a user-defined container type", () => {
|
|
700
|
-
const MyBox: any = z.core.$constructor("MyBox", (inst: any, def: any) => {
|
|
701
|
-
z.core.$ZodType.init(inst, def);
|
|
702
|
-
inst._zod.parse = (payload: any, ctx: any) => {
|
|
703
|
-
if (payload.value === null || typeof payload.value !== "object") return payload;
|
|
704
|
-
const inner = def.inner._zod.run({ value: payload.value.v, issues: [] }, ctx);
|
|
705
|
-
payload.value = { v: inner.value };
|
|
706
|
-
return payload;
|
|
707
|
-
};
|
|
708
|
-
});
|
|
709
|
-
|
|
710
|
-
const Node: any = z.object({
|
|
711
|
-
id: z.string(),
|
|
712
|
-
get boxed() {
|
|
713
|
-
return z.optional(new MyBox({ type: "mybox", inner: z.lazy(() => Node) }));
|
|
714
|
-
},
|
|
715
|
-
});
|
|
716
|
-
|
|
717
|
-
const input: any = { id: "1" };
|
|
718
|
-
input.boxed = { v: input };
|
|
719
|
-
|
|
720
|
-
const out: any = Node.parse(input);
|
|
721
|
-
expect(out.boxed.v).toBe(out);
|
|
722
|
-
});
|
|
723
|
-
|
|
724
|
-
// #6526: a factory returns fresh instances, so the identity walk never revisits a node; it descends until the stack overflows unless it stops at the deferred edge
|
|
725
|
-
test("parses a factory-built recursive schema", () => {
|
|
726
|
-
const Node = (): any =>
|
|
727
|
-
z.object({
|
|
728
|
-
id: z.number(),
|
|
729
|
-
get kids() {
|
|
730
|
-
return z.array(Node());
|
|
731
|
-
},
|
|
732
|
-
});
|
|
733
|
-
|
|
734
|
-
const S = z.object({ root: Node() });
|
|
735
|
-
const out = S.parse({ root: { id: 1, kids: [{ id: 2, kids: [] }] } });
|
|
736
|
-
expect(out.root.kids[0].id).toBe(2);
|
|
737
|
-
expect(S.safeParse({ root: { id: 1, kids: [{ id: "x", kids: [] }] } }).success).toBe(false);
|
|
738
|
-
});
|
|
739
|
-
|
|
740
|
-
test("parses a factory-built recursive discriminated union at the root and nested", () => {
|
|
741
|
-
const Geometry = (): any =>
|
|
742
|
-
z.discriminatedUnion("type", [
|
|
743
|
-
z.object({ type: z.literal("Point"), coordinates: z.array(z.number()) }),
|
|
744
|
-
z.looseObject({
|
|
745
|
-
type: z.literal("GeometryCollection"),
|
|
746
|
-
get geometries() {
|
|
747
|
-
return z.array(Geometry());
|
|
748
|
-
},
|
|
749
|
-
}),
|
|
750
|
-
]);
|
|
751
|
-
|
|
752
|
-
const collection = { type: "GeometryCollection", geometries: [{ type: "Point", coordinates: [1, 2] }] };
|
|
753
|
-
expect(Geometry().parse(collection).geometries[0].coordinates).toEqual([1, 2]);
|
|
754
|
-
expect(z.object({ g: Geometry() }).parse({ g: collection }).g.type).toBe("GeometryCollection");
|
|
755
|
-
});
|
|
756
|
-
|
|
757
|
-
test("the walk reports a cycle for a deferred edge instead of resolving it", () => {
|
|
758
|
-
const Node = (): any =>
|
|
759
|
-
z.object({
|
|
760
|
-
get self() {
|
|
761
|
-
return Node();
|
|
762
|
-
},
|
|
763
|
-
});
|
|
764
|
-
expect(z.core.isRecursiveSchema(Node())).toBe(true);
|
|
765
|
-
|
|
766
|
-
// conservative by design: a getter that closes no cycle is reported too, and pays only the memoizer it keeps
|
|
767
|
-
const Leaf = z.object({ id: z.string() });
|
|
768
|
-
const forward: any = z.object({
|
|
769
|
-
get leaf() {
|
|
770
|
-
return Leaf;
|
|
771
|
-
},
|
|
772
|
-
});
|
|
773
|
-
expect(z.core.isRecursiveSchema(forward)).toBe(true);
|
|
774
|
-
|
|
775
|
-
// a lazy is followed one hop, which is what lets z.compile see past it; past that hop it is deferred like any other edge
|
|
776
|
-
expect(z.core.isRecursiveSchema(z.lazy(() => Leaf) as any)).toBe(false);
|
|
777
|
-
expect(z.core.isRecursiveSchema(z.lazy(() => z.lazy(() => Leaf)) as any)).toBe(true);
|
|
778
|
-
});
|
|
779
|
-
|
|
780
|
-
// the builders answer `shape` from an accessor that resolves the source's getters, so the walk has to reach the source schema itself
|
|
781
|
-
test("parses a factory-built recursive schema through every object builder", () => {
|
|
782
|
-
const wraps: [string, (base: () => any) => any][] = [
|
|
783
|
-
["extend", (b) => b().extend({ x: z.string() })],
|
|
784
|
-
["safeExtend", (b) => b().safeExtend({ x: z.string() })],
|
|
785
|
-
["merge", (b) => z.object({ x: z.string() }).merge(b())],
|
|
786
|
-
["partial", (b) => b().partial()],
|
|
787
|
-
["required", (b) => b().required()],
|
|
788
|
-
["pick", (b) => b().pick({ self: true })],
|
|
789
|
-
["omit", (b) => b().omit({ y: true })],
|
|
790
|
-
["chained", (b) => b().extend({ x: z.string() }).partial()],
|
|
791
|
-
// rebuilds the def without touching the shape, so the clone carries the source's accessor rather than a shape of its own
|
|
792
|
-
["strict", (b) => b().extend({ x: z.string() }).strict()],
|
|
793
|
-
["catchall", (b) => b().extend({ x: z.string() }).catchall(z.unknown())],
|
|
794
|
-
["meta", (b) => b().extend({ x: z.string() }).meta({ id: "node" })],
|
|
795
|
-
];
|
|
796
|
-
|
|
797
|
-
for (const [name, wrap] of wraps) {
|
|
798
|
-
const Node = (): any =>
|
|
799
|
-
wrap(() =>
|
|
800
|
-
z.object({
|
|
801
|
-
y: z.string(),
|
|
802
|
-
get self() {
|
|
803
|
-
return z.optional(Node());
|
|
804
|
-
},
|
|
805
|
-
})
|
|
806
|
-
);
|
|
807
|
-
const S = z.object({ r: Node() });
|
|
808
|
-
for (const attempt of ["first", "second"]) {
|
|
809
|
-
expect(() => S.safeParse({ r: { y: "s", x: "s" } }), `${name} (${attempt} parse)`).not.toThrow();
|
|
810
|
-
}
|
|
811
|
-
}
|
|
812
|
-
});
|
|
813
|
-
|
|
814
|
-
test("an ordinary builder stays exact, so it still compiles", () => {
|
|
815
|
-
const plain = z.object({ a: z.string(), b: z.number() });
|
|
816
|
-
const derived: [string, any][] = [
|
|
817
|
-
["extend", plain.extend({ c: z.boolean() })],
|
|
818
|
-
["merge", plain.merge(z.object({ d: z.string() }))],
|
|
819
|
-
["partial", plain.partial()],
|
|
820
|
-
["required", plain.partial().required()],
|
|
821
|
-
["pick", plain.pick({ a: true })],
|
|
822
|
-
["omit", plain.omit({ a: true })],
|
|
823
|
-
["strict", plain.extend({ c: z.boolean() }).strict()],
|
|
824
|
-
["catchall", plain.extend({ c: z.boolean() }).catchall(z.unknown())],
|
|
825
|
-
["meta", plain.extend({ c: z.boolean() }).meta({ id: "plain" })],
|
|
826
|
-
];
|
|
827
|
-
for (const [name, schema] of derived) {
|
|
828
|
-
expect(z.core.isRecursiveSchema(schema), name).toBe(false);
|
|
829
|
-
expect(() => z.compile(schema, { strict: true }), name).not.toThrow();
|
|
830
|
-
}
|
|
831
|
-
});
|
|
832
|
-
|
|
833
|
-
// a derived shape mirrors its source's descriptors, so dropping or overwriting the key that carries the cycle leaves nothing deferred and the walk is exact before anything parses
|
|
834
|
-
test("a builder that drops the recursive key ends up exact", () => {
|
|
835
|
-
const Node: any = z.object({
|
|
836
|
-
id: z.number(),
|
|
837
|
-
get self() {
|
|
838
|
-
return z.optional(Node);
|
|
839
|
-
},
|
|
840
|
-
});
|
|
841
|
-
|
|
842
|
-
const derived: [string, any, any][] = [
|
|
843
|
-
["omit", Node.omit({ self: true }), { id: 1 }],
|
|
844
|
-
["pick", Node.pick({ id: true }), { id: 1 }],
|
|
845
|
-
["extend overwrites it", Node.extend({ self: z.string() }), { id: 1, self: "x" }],
|
|
846
|
-
];
|
|
847
|
-
for (const [name, schema, input] of derived) {
|
|
848
|
-
expect(z.core.isRecursiveSchema(schema), name).toBe(false);
|
|
849
|
-
expect(() => z.compile(schema, { strict: true }), name).not.toThrow();
|
|
850
|
-
expect(schema.parse(input), name).toEqual(input);
|
|
851
|
-
}
|
|
852
|
-
|
|
853
|
-
// the branch that stays is still found
|
|
854
|
-
const kept = Node.extend({ x: z.string() });
|
|
855
|
-
expect(z.core.isRecursiveSchema(kept)).toBe(true);
|
|
856
|
-
});
|
|
857
|
-
|
|
858
|
-
// resolving a lazy runs user code, which can re-enter the walk; a walk that kept its certainty outside its own frames would have the inner one clobber the outer
|
|
859
|
-
test("a nested walk can't corrupt the one that resolved into it", () => {
|
|
860
|
-
const Node: any = z.object({
|
|
861
|
-
id: z.number(),
|
|
862
|
-
self: z.lazy(() => {
|
|
863
|
-
z.compile(z.string(), { strict: true });
|
|
864
|
-
return z.optional(Node);
|
|
865
|
-
}),
|
|
866
|
-
});
|
|
867
|
-
|
|
868
|
-
const omitted = Node.omit({ self: true });
|
|
869
|
-
// exact before anything parses: the mirrored shape kept only `id`, so nothing here is deferred
|
|
870
|
-
expect(z.core.isRecursiveSchema(omitted)).toBe(false);
|
|
871
|
-
omitted.parse({ id: 1 });
|
|
872
|
-
expect(z.core.isRecursiveSchema(omitted)).toBe(false);
|
|
873
|
-
expect(() => z.compile(omitted, { strict: true })).not.toThrow();
|
|
874
|
-
|
|
875
|
-
const shared = { id: 1 };
|
|
876
|
-
const out: any = z.object({ a: omitted, b: omitted }).parse({ a: shared, b: shared });
|
|
877
|
-
expect(out.a).not.toBe(out.b);
|
|
878
|
-
expect(z.core.isRecursiveSchema(Node)).toBe(true);
|
|
879
|
-
});
|
|
880
|
-
|
|
881
|
-
test("detects a cycle that closes through a builder", () => {
|
|
882
|
-
const Node: any = z
|
|
883
|
-
.object({
|
|
884
|
-
id: z.number(),
|
|
885
|
-
get self() {
|
|
886
|
-
return z.optional(Node);
|
|
887
|
-
},
|
|
888
|
-
})
|
|
889
|
-
.extend({ x: z.string() });
|
|
890
|
-
|
|
891
|
-
const input: any = { id: 1, x: "s" };
|
|
892
|
-
input.self = input;
|
|
893
|
-
const out = Node.parse(input);
|
|
894
|
-
expect(out.self).toBe(out);
|
|
895
|
-
});
|
|
896
|
-
|
|
897
|
-
test("a deferred edge stops being assumed a cycle once the graph resolves", () => {
|
|
898
|
-
const Leaf = z.object({ n: z.number() });
|
|
899
|
-
const Forward: any = z.object({
|
|
900
|
-
get a() {
|
|
901
|
-
return Leaf;
|
|
902
|
-
},
|
|
903
|
-
});
|
|
904
|
-
expect(z.core.isRecursiveSchema(Forward)).toBe(true);
|
|
905
|
-
Forward.parse({ a: { n: 1 } });
|
|
906
|
-
// the parse resolved the getter, so the walk can follow it and drop the assumption
|
|
907
|
-
expect(z.core.isRecursiveSchema(Forward)).toBe(false);
|
|
908
|
-
|
|
909
|
-
// a factory hands back a fresh subtree every time, so no parse ever resolves it into a finite graph
|
|
910
|
-
const Node = (): any =>
|
|
911
|
-
z.object({
|
|
912
|
-
get kids() {
|
|
913
|
-
return z.array(Node());
|
|
914
|
-
},
|
|
915
|
-
});
|
|
916
|
-
const Generated = Node();
|
|
917
|
-
expect(z.core.isRecursiveSchema(Generated)).toBe(true);
|
|
918
|
-
Generated.parse({ kids: [] });
|
|
919
|
-
expect(z.core.isRecursiveSchema(Generated)).toBe(true);
|
|
920
|
-
|
|
921
|
-
// a lazy that closes a real cycle stays recursive however often it resolves
|
|
922
|
-
const Cyclic: any = z.object({ id: z.number(), self: z.lazy(() => z.optional(Cyclic)) });
|
|
923
|
-
Cyclic.parse({ id: 1 });
|
|
924
|
-
expect(z.core.isRecursiveSchema(Cyclic)).toBe(true);
|
|
925
|
-
});
|
|
926
|
-
|
|
927
|
-
// `z.object` resolves its shape by spread, so a non-enumerable key is no part of it
|
|
928
|
-
test("a non-enumerable key does not count for z.object", () => {
|
|
929
|
-
const object = (enumerable: boolean) => {
|
|
930
|
-
const shape: Record<string, any> = { id: z.number() };
|
|
931
|
-
const O: any = z.object(shape);
|
|
932
|
-
Object.defineProperty(shape, "next", { value: z.lazy(() => z.optional(O)), enumerable, configurable: true });
|
|
933
|
-
return O;
|
|
934
|
-
};
|
|
935
|
-
expect(z.core.isRecursiveSchema(object(true))).toBe(true);
|
|
936
|
-
// the spread drops it, so nothing can ever parse it
|
|
937
|
-
expect(z.core.isRecursiveSchema(object(false))).toBe(false);
|
|
938
|
-
});
|
|
939
|
-
|
|
940
|
-
test("the walk stays exact where nothing is deferred", () => {
|
|
941
|
-
let deep: any = z.string();
|
|
942
|
-
for (let i = 0; i < 300; i++) deep = z.object({ v: deep });
|
|
943
|
-
expect(z.core.isRecursiveSchema(deep)).toBe(false);
|
|
944
|
-
});
|
|
945
|
-
|
|
946
|
-
test("parses a factory-built recursive schema through z.lazy", () => {
|
|
947
|
-
const Node = (): any =>
|
|
948
|
-
z.object({
|
|
949
|
-
id: z.number(),
|
|
950
|
-
child: z.lazy(() => z.optional(Node())),
|
|
951
|
-
});
|
|
952
|
-
|
|
953
|
-
const out = z.object({ root: Node() }).parse({ root: { id: 1, child: { id: 2, child: undefined } } });
|
|
954
|
-
expect(out.root.child.id).toBe(2);
|
|
955
|
-
});
|
|
956
|
-
|
|
957
|
-
test("a finished parse pins nothing on the schema", async () => {
|
|
958
|
-
// es2020 is the target, and its lib predates WeakRef
|
|
959
|
-
type Weak<T extends object> = { deref(): T | undefined };
|
|
960
|
-
const { WeakRef: Weak } = globalThis as unknown as { WeakRef: new <T extends object>(target: T) => Weak<T> };
|
|
961
|
-
// vitest carries no --expose-gc, so reach the collector the way node's own tests do
|
|
962
|
-
v8.setFlagsFromString("--expose-gc");
|
|
963
|
-
const gc = vm.runInNewContext("gc") as () => void;
|
|
964
|
-
|
|
965
|
-
const Node: any = z.object({
|
|
966
|
-
id: z.number(),
|
|
967
|
-
get next() {
|
|
968
|
-
return z.optional(Node);
|
|
969
|
-
},
|
|
970
|
-
});
|
|
971
|
-
|
|
972
|
-
const ref = ((): Weak<object> => {
|
|
973
|
-
const input = { id: 1, next: { id: 2, next: undefined } };
|
|
974
|
-
Node.parse(input);
|
|
975
|
-
return new Weak(input);
|
|
976
|
-
})();
|
|
977
|
-
|
|
978
|
-
for (let attempt = 0; attempt < 10 && ref.deref(); attempt++) {
|
|
979
|
-
// the input stays on the stack until a macrotask boundary
|
|
980
|
-
await new Promise((resolve) => setTimeout(resolve, 0));
|
|
981
|
-
gc();
|
|
982
|
-
}
|
|
983
|
-
|
|
984
|
-
expect(ref.deref()).toBeUndefined();
|
|
985
|
-
});
|