zod 3.25.21 → 3.25.22
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/package.json +2 -2
- package/dist/cjs/v3/tests/all-errors.test.js +0 -147
- package/dist/cjs/v3/tests/anyunknown.test.js +0 -47
- package/dist/cjs/v3/tests/array.test.js +0 -80
- package/dist/cjs/v3/tests/async-parsing.test.js +0 -381
- package/dist/cjs/v3/tests/async-refinements.test.js +0 -60
- package/dist/cjs/v3/tests/base.test.js +0 -47
- package/dist/cjs/v3/tests/bigint.test.js +0 -74
- package/dist/cjs/v3/tests/branded.test.js +0 -58
- package/dist/cjs/v3/tests/catch.test.js +0 -181
- package/dist/cjs/v3/tests/coerce.test.js +0 -152
- package/dist/cjs/v3/tests/complex.test.js +0 -78
- package/dist/cjs/v3/tests/custom.test.js +0 -51
- package/dist/cjs/v3/tests/date.test.js +0 -49
- package/dist/cjs/v3/tests/deepmasking.test.js +0 -187
- package/dist/cjs/v3/tests/default.test.js +0 -86
- package/dist/cjs/v3/tests/description.test.js +0 -51
- package/dist/cjs/v3/tests/discriminated-unions.test.js +0 -321
- package/dist/cjs/v3/tests/enum.test.js +0 -91
- package/dist/cjs/v3/tests/error.test.js +0 -526
- package/dist/cjs/v3/tests/firstparty.test.js +0 -109
- package/dist/cjs/v3/tests/firstpartyschematypes.test.js +0 -8
- package/dist/cjs/v3/tests/function.test.js +0 -236
- package/dist/cjs/v3/tests/generics.test.js +0 -67
- package/dist/cjs/v3/tests/instanceof.test.js +0 -60
- package/dist/cjs/v3/tests/intersection.test.js +0 -111
- package/dist/cjs/v3/tests/language-server.source.js +0 -71
- package/dist/cjs/v3/tests/language-server.test.js +0 -177
- package/dist/cjs/v3/tests/literal.test.js +0 -55
- package/dist/cjs/v3/tests/map.test.js +0 -112
- package/dist/cjs/v3/tests/masking.test.js +0 -5
- package/dist/cjs/v3/tests/mocker.test.js +0 -19
- package/dist/cjs/v3/tests/nan.test.js +0 -42
- package/dist/cjs/v3/tests/nativeEnum.test.js +0 -100
- package/dist/cjs/v3/tests/nullable.test.js +0 -65
- package/dist/cjs/v3/tests/number.test.js +0 -189
- package/dist/cjs/v3/tests/object-augmentation.test.js +0 -50
- package/dist/cjs/v3/tests/object-in-es5-env.test.js +0 -49
- package/dist/cjs/v3/tests/object.test.js +0 -352
- package/dist/cjs/v3/tests/optional.test.js +0 -65
- package/dist/cjs/v3/tests/parseUtil.test.js +0 -20
- package/dist/cjs/v3/tests/parser.test.js +0 -55
- package/dist/cjs/v3/tests/partials.test.js +0 -201
- package/dist/cjs/v3/tests/pickomit.test.js +0 -113
- package/dist/cjs/v3/tests/pipeline.test.js +0 -50
- package/dist/cjs/v3/tests/preprocess.test.js +0 -181
- package/dist/cjs/v3/tests/primitive.test.js +0 -385
- package/dist/cjs/v3/tests/promise.test.js +0 -98
- package/dist/cjs/v3/tests/readonly.test.js +0 -190
- package/dist/cjs/v3/tests/record.test.js +0 -153
- package/dist/cjs/v3/tests/recursive.test.js +0 -161
- package/dist/cjs/v3/tests/refine.test.js +0 -279
- package/dist/cjs/v3/tests/safeparse.test.js +0 -46
- package/dist/cjs/v3/tests/set.test.js +0 -144
- package/dist/cjs/v3/tests/standard-schema.test.js +0 -102
- package/dist/cjs/v3/tests/string.test.js +0 -842
- package/dist/cjs/v3/tests/transformer.test.js +0 -218
- package/dist/cjs/v3/tests/tuple.test.js +0 -97
- package/dist/cjs/v3/tests/unions.test.js +0 -75
- package/dist/cjs/v3/tests/validations.test.js +0 -155
- package/dist/cjs/v3/tests/void.test.js +0 -36
- package/dist/cjs/v4/classic/tests/anyunknown.test.js +0 -45
- package/dist/cjs/v4/classic/tests/array.test.js +0 -249
- package/dist/cjs/v4/classic/tests/assignability.test.js +0 -110
- package/dist/cjs/v4/classic/tests/async-parsing.test.js +0 -364
- package/dist/cjs/v4/classic/tests/async-refinements.test.js +0 -82
- package/dist/cjs/v4/classic/tests/base.test.js +0 -31
- package/dist/cjs/v4/classic/tests/bigint.test.js +0 -73
- package/dist/cjs/v4/classic/tests/brand.test.js +0 -60
- package/dist/cjs/v4/classic/tests/catch.test.js +0 -214
- package/dist/cjs/v4/classic/tests/coalesce.test.js +0 -18
- package/dist/cjs/v4/classic/tests/coerce.test.js +0 -175
- package/dist/cjs/v4/classic/tests/custom.test.js +0 -38
- package/dist/cjs/v4/classic/tests/date.test.js +0 -48
- package/dist/cjs/v4/classic/tests/default.test.js +0 -88
- package/dist/cjs/v4/classic/tests/description.test.js +0 -51
- package/dist/cjs/v4/classic/tests/discriminated-unions.test.js +0 -540
- package/dist/cjs/v4/classic/tests/enum.test.js +0 -260
- package/dist/cjs/v4/classic/tests/error-utils.test.js +0 -411
- package/dist/cjs/v4/classic/tests/error.test.js +0 -651
- package/dist/cjs/v4/classic/tests/file.test.js +0 -68
- package/dist/cjs/v4/classic/tests/firstparty.test.js +0 -198
- package/dist/cjs/v4/classic/tests/function.test.js +0 -219
- package/dist/cjs/v4/classic/tests/generics.test.js +0 -72
- package/dist/cjs/v4/classic/tests/index.test.js +0 -765
- package/dist/cjs/v4/classic/tests/instanceof.test.js +0 -58
- package/dist/cjs/v4/classic/tests/intersection.test.js +0 -134
- package/dist/cjs/v4/classic/tests/json-schema.test.js +0 -1707
- package/dist/cjs/v4/classic/tests/json.test.js +0 -105
- package/dist/cjs/v4/classic/tests/lazy.test.js +0 -185
- package/dist/cjs/v4/classic/tests/literal.test.js +0 -94
- package/dist/cjs/v4/classic/tests/map.test.js +0 -193
- package/dist/cjs/v4/classic/tests/nan.test.js +0 -42
- package/dist/cjs/v4/classic/tests/nested-refine.test.js +0 -180
- package/dist/cjs/v4/classic/tests/nonoptional.test.js +0 -80
- package/dist/cjs/v4/classic/tests/nullable.test.js +0 -43
- package/dist/cjs/v4/classic/tests/number.test.js +0 -241
- package/dist/cjs/v4/classic/tests/object.test.js +0 -405
- package/dist/cjs/v4/classic/tests/optional.test.js +0 -98
- package/dist/cjs/v4/classic/tests/partial.test.js +0 -137
- package/dist/cjs/v4/classic/tests/pickomit.test.js +0 -125
- package/dist/cjs/v4/classic/tests/pipe.test.js +0 -92
- package/dist/cjs/v4/classic/tests/prefault.test.js +0 -22
- package/dist/cjs/v4/classic/tests/preprocess.test.js +0 -273
- package/dist/cjs/v4/classic/tests/primitive.test.js +0 -184
- package/dist/cjs/v4/classic/tests/promise.test.js +0 -91
- package/dist/cjs/v4/classic/tests/readonly.test.js +0 -241
- package/dist/cjs/v4/classic/tests/record.test.js +0 -307
- package/dist/cjs/v4/classic/tests/recursive-types.test.js +0 -108
- package/dist/cjs/v4/classic/tests/refine.test.js +0 -402
- package/dist/cjs/v4/classic/tests/registries.test.js +0 -155
- package/dist/cjs/v4/classic/tests/set.test.js +0 -182
- package/dist/cjs/v4/classic/tests/standard-schema.test.js +0 -77
- package/dist/cjs/v4/classic/tests/string-formats.test.js +0 -49
- package/dist/cjs/v4/classic/tests/string.test.js +0 -980
- package/dist/cjs/v4/classic/tests/template-literal.test.js +0 -705
- package/dist/cjs/v4/classic/tests/transform.test.js +0 -239
- package/dist/cjs/v4/classic/tests/tuple.test.js +0 -166
- package/dist/cjs/v4/classic/tests/union.test.js +0 -107
- package/dist/cjs/v4/classic/tests/validations.test.js +0 -301
- package/dist/cjs/v4/classic/tests/void.test.js +0 -34
- package/dist/cjs/v4/core/tests/index.test.js +0 -66
- package/dist/cjs/v4/core/tests/locales/be.test.js +0 -123
- package/dist/cjs/v4/core/tests/locales/en.test.js +0 -21
- package/dist/cjs/v4/core/tests/locales/ru.test.js +0 -123
- package/dist/cjs/v4/core/tests/locales/tr.test.js +0 -79
- package/dist/cjs/v4/mini/tests/assignability.test.js +0 -104
- package/dist/cjs/v4/mini/tests/brand.test.js +0 -58
- package/dist/cjs/v4/mini/tests/checks.test.js +0 -147
- package/dist/cjs/v4/mini/tests/computed.test.js +0 -55
- package/dist/cjs/v4/mini/tests/error.test.js +0 -45
- package/dist/cjs/v4/mini/tests/functions.test.js +0 -37
- package/dist/cjs/v4/mini/tests/index.test.js +0 -763
- package/dist/cjs/v4/mini/tests/number.test.js +0 -109
- package/dist/cjs/v4/mini/tests/object.test.js +0 -122
- package/dist/cjs/v4/mini/tests/prototypes.test.js +0 -44
- package/dist/cjs/v4/mini/tests/recursive-types.test.js +0 -106
- package/dist/cjs/v4/mini/tests/string.test.js +0 -265
- package/dist/types/v3/tests/all-errors.test.d.ts +0 -1
- package/dist/types/v3/tests/anyunknown.test.d.ts +0 -1
- package/dist/types/v3/tests/array.test.d.ts +0 -1
- package/dist/types/v3/tests/async-parsing.test.d.ts +0 -1
- package/dist/types/v3/tests/async-refinements.test.d.ts +0 -1
- package/dist/types/v3/tests/base.test.d.ts +0 -1
- package/dist/types/v3/tests/bigint.test.d.ts +0 -1
- package/dist/types/v3/tests/branded.test.d.ts +0 -1
- package/dist/types/v3/tests/catch.test.d.ts +0 -1
- package/dist/types/v3/tests/coerce.test.d.ts +0 -1
- package/dist/types/v3/tests/complex.test.d.ts +0 -1
- package/dist/types/v3/tests/custom.test.d.ts +0 -1
- package/dist/types/v3/tests/date.test.d.ts +0 -1
- package/dist/types/v3/tests/deepmasking.test.d.ts +0 -1
- package/dist/types/v3/tests/default.test.d.ts +0 -1
- package/dist/types/v3/tests/description.test.d.ts +0 -1
- package/dist/types/v3/tests/discriminated-unions.test.d.ts +0 -1
- package/dist/types/v3/tests/enum.test.d.ts +0 -1
- package/dist/types/v3/tests/error.test.d.ts +0 -1
- package/dist/types/v3/tests/firstparty.test.d.ts +0 -1
- package/dist/types/v3/tests/firstpartyschematypes.test.d.ts +0 -1
- package/dist/types/v3/tests/function.test.d.ts +0 -1
- package/dist/types/v3/tests/generics.test.d.ts +0 -1
- package/dist/types/v3/tests/instanceof.test.d.ts +0 -1
- package/dist/types/v3/tests/intersection.test.d.ts +0 -1
- package/dist/types/v3/tests/language-server.source.d.ts +0 -70
- package/dist/types/v3/tests/language-server.test.d.ts +0 -1
- package/dist/types/v3/tests/literal.test.d.ts +0 -1
- package/dist/types/v3/tests/map.test.d.ts +0 -1
- package/dist/types/v3/tests/masking.test.d.ts +0 -1
- package/dist/types/v3/tests/mocker.test.d.ts +0 -1
- package/dist/types/v3/tests/nan.test.d.ts +0 -1
- package/dist/types/v3/tests/nativeEnum.test.d.ts +0 -1
- package/dist/types/v3/tests/nullable.test.d.ts +0 -1
- package/dist/types/v3/tests/number.test.d.ts +0 -1
- package/dist/types/v3/tests/object-augmentation.test.d.ts +0 -1
- package/dist/types/v3/tests/object-in-es5-env.test.d.ts +0 -1
- package/dist/types/v3/tests/object.test.d.ts +0 -1
- package/dist/types/v3/tests/optional.test.d.ts +0 -1
- package/dist/types/v3/tests/parseUtil.test.d.ts +0 -1
- package/dist/types/v3/tests/parser.test.d.ts +0 -1
- package/dist/types/v3/tests/partials.test.d.ts +0 -1
- package/dist/types/v3/tests/pickomit.test.d.ts +0 -1
- package/dist/types/v3/tests/pipeline.test.d.ts +0 -1
- package/dist/types/v3/tests/preprocess.test.d.ts +0 -1
- package/dist/types/v3/tests/primitive.test.d.ts +0 -1
- package/dist/types/v3/tests/promise.test.d.ts +0 -1
- package/dist/types/v3/tests/readonly.test.d.ts +0 -1
- package/dist/types/v3/tests/record.test.d.ts +0 -1
- package/dist/types/v3/tests/recursive.test.d.ts +0 -1
- package/dist/types/v3/tests/refine.test.d.ts +0 -1
- package/dist/types/v3/tests/safeparse.test.d.ts +0 -1
- package/dist/types/v3/tests/set.test.d.ts +0 -1
- package/dist/types/v3/tests/standard-schema.test.d.ts +0 -1
- package/dist/types/v3/tests/string.test.d.ts +0 -1
- package/dist/types/v3/tests/transformer.test.d.ts +0 -1
- package/dist/types/v3/tests/tuple.test.d.ts +0 -1
- package/dist/types/v3/tests/unions.test.d.ts +0 -1
- package/dist/types/v3/tests/validations.test.d.ts +0 -1
- package/dist/types/v3/tests/void.test.d.ts +0 -1
- package/dist/types/v4/classic/tests/anyunknown.test.d.ts +0 -1
- package/dist/types/v4/classic/tests/array.test.d.ts +0 -1
- package/dist/types/v4/classic/tests/assignability.test.d.ts +0 -1
- package/dist/types/v4/classic/tests/async-parsing.test.d.ts +0 -1
- package/dist/types/v4/classic/tests/async-refinements.test.d.ts +0 -1
- package/dist/types/v4/classic/tests/base.test.d.ts +0 -1
- package/dist/types/v4/classic/tests/bigint.test.d.ts +0 -1
- package/dist/types/v4/classic/tests/brand.test.d.ts +0 -1
- package/dist/types/v4/classic/tests/catch.test.d.ts +0 -1
- package/dist/types/v4/classic/tests/coalesce.test.d.ts +0 -1
- package/dist/types/v4/classic/tests/coerce.test.d.ts +0 -1
- package/dist/types/v4/classic/tests/custom.test.d.ts +0 -1
- package/dist/types/v4/classic/tests/date.test.d.ts +0 -1
- package/dist/types/v4/classic/tests/default.test.d.ts +0 -1
- package/dist/types/v4/classic/tests/description.test.d.ts +0 -1
- package/dist/types/v4/classic/tests/discriminated-unions.test.d.ts +0 -1
- package/dist/types/v4/classic/tests/enum.test.d.ts +0 -1
- package/dist/types/v4/classic/tests/error-utils.test.d.ts +0 -1
- package/dist/types/v4/classic/tests/error.test.d.ts +0 -1
- package/dist/types/v4/classic/tests/file.test.d.ts +0 -1
- package/dist/types/v4/classic/tests/firstparty.test.d.ts +0 -1
- package/dist/types/v4/classic/tests/function.test.d.ts +0 -1
- package/dist/types/v4/classic/tests/generics.test.d.ts +0 -1
- package/dist/types/v4/classic/tests/index.test.d.ts +0 -1
- package/dist/types/v4/classic/tests/instanceof.test.d.ts +0 -1
- package/dist/types/v4/classic/tests/intersection.test.d.ts +0 -1
- package/dist/types/v4/classic/tests/json-schema.test.d.ts +0 -1
- package/dist/types/v4/classic/tests/json.test.d.ts +0 -1
- package/dist/types/v4/classic/tests/lazy.test.d.ts +0 -1
- package/dist/types/v4/classic/tests/literal.test.d.ts +0 -1
- package/dist/types/v4/classic/tests/map.test.d.ts +0 -1
- package/dist/types/v4/classic/tests/nan.test.d.ts +0 -1
- package/dist/types/v4/classic/tests/nested-refine.test.d.ts +0 -1
- package/dist/types/v4/classic/tests/nonoptional.test.d.ts +0 -1
- package/dist/types/v4/classic/tests/nullable.test.d.ts +0 -1
- package/dist/types/v4/classic/tests/number.test.d.ts +0 -1
- package/dist/types/v4/classic/tests/object.test.d.ts +0 -1
- package/dist/types/v4/classic/tests/optional.test.d.ts +0 -1
- package/dist/types/v4/classic/tests/partial.test.d.ts +0 -1
- package/dist/types/v4/classic/tests/pickomit.test.d.ts +0 -1
- package/dist/types/v4/classic/tests/pipe.test.d.ts +0 -1
- package/dist/types/v4/classic/tests/prefault.test.d.ts +0 -1
- package/dist/types/v4/classic/tests/preprocess.test.d.ts +0 -1
- package/dist/types/v4/classic/tests/primitive.test.d.ts +0 -1
- package/dist/types/v4/classic/tests/promise.test.d.ts +0 -1
- package/dist/types/v4/classic/tests/readonly.test.d.ts +0 -1
- package/dist/types/v4/classic/tests/record.test.d.ts +0 -1
- package/dist/types/v4/classic/tests/recursive-types.test.d.ts +0 -1
- package/dist/types/v4/classic/tests/refine.test.d.ts +0 -1
- package/dist/types/v4/classic/tests/registries.test.d.ts +0 -1
- package/dist/types/v4/classic/tests/set.test.d.ts +0 -1
- package/dist/types/v4/classic/tests/standard-schema.test.d.ts +0 -1
- package/dist/types/v4/classic/tests/string-formats.test.d.ts +0 -1
- package/dist/types/v4/classic/tests/string.test.d.ts +0 -1
- package/dist/types/v4/classic/tests/template-literal.test.d.ts +0 -1
- package/dist/types/v4/classic/tests/transform.test.d.ts +0 -1
- package/dist/types/v4/classic/tests/tuple.test.d.ts +0 -1
- package/dist/types/v4/classic/tests/union.test.d.ts +0 -1
- package/dist/types/v4/classic/tests/validations.test.d.ts +0 -1
- package/dist/types/v4/classic/tests/void.test.d.ts +0 -1
- package/dist/types/v4/core/tests/index.test.d.ts +0 -1
- package/dist/types/v4/core/tests/locales/be.test.d.ts +0 -1
- package/dist/types/v4/core/tests/locales/en.test.d.ts +0 -1
- package/dist/types/v4/core/tests/locales/ru.test.d.ts +0 -1
- package/dist/types/v4/core/tests/locales/tr.test.d.ts +0 -1
- package/dist/types/v4/mini/tests/assignability.test.d.ts +0 -1
- package/dist/types/v4/mini/tests/brand.test.d.ts +0 -1
- package/dist/types/v4/mini/tests/checks.test.d.ts +0 -1
- package/dist/types/v4/mini/tests/computed.test.d.ts +0 -1
- package/dist/types/v4/mini/tests/error.test.d.ts +0 -1
- package/dist/types/v4/mini/tests/functions.test.d.ts +0 -1
- package/dist/types/v4/mini/tests/index.test.d.ts +0 -1
- package/dist/types/v4/mini/tests/number.test.d.ts +0 -1
- package/dist/types/v4/mini/tests/object.test.d.ts +0 -1
- package/dist/types/v4/mini/tests/prototypes.test.d.ts +0 -1
- package/dist/types/v4/mini/tests/recursive-types.test.d.ts +0 -1
- package/dist/types/v4/mini/tests/string.test.d.ts +0 -1
- package/src/index.ts +0 -4
- package/src/v3/ZodError.ts +0 -329
- package/src/v3/benchmarks/datetime.ts +0 -58
- package/src/v3/benchmarks/discriminatedUnion.ts +0 -80
- package/src/v3/benchmarks/index.ts +0 -59
- package/src/v3/benchmarks/ipv4.ts +0 -57
- package/src/v3/benchmarks/object.ts +0 -69
- package/src/v3/benchmarks/primitives.ts +0 -162
- package/src/v3/benchmarks/realworld.ts +0 -63
- package/src/v3/benchmarks/string.ts +0 -55
- package/src/v3/benchmarks/union.ts +0 -80
- package/src/v3/errors.ts +0 -13
- package/src/v3/external.ts +0 -6
- package/src/v3/helpers/enumUtil.ts +0 -17
- package/src/v3/helpers/errorUtil.ts +0 -8
- package/src/v3/helpers/parseUtil.ts +0 -176
- package/src/v3/helpers/partialUtil.ts +0 -34
- package/src/v3/helpers/typeAliases.ts +0 -2
- package/src/v3/helpers/util.ts +0 -224
- package/src/v3/index.ts +0 -4
- package/src/v3/locales/en.ts +0 -120
- package/src/v3/standard-schema.ts +0 -113
- package/src/v3/tests/Mocker.ts +0 -54
- package/src/v3/tests/all-errors.test.ts +0 -157
- package/src/v3/tests/anyunknown.test.ts +0 -28
- package/src/v3/tests/array.test.ts +0 -71
- package/src/v3/tests/async-parsing.test.ts +0 -388
- package/src/v3/tests/async-refinements.test.ts +0 -46
- package/src/v3/tests/base.test.ts +0 -29
- package/src/v3/tests/bigint.test.ts +0 -55
- package/src/v3/tests/branded.test.ts +0 -53
- package/src/v3/tests/catch.test.ts +0 -220
- package/src/v3/tests/coerce.test.ts +0 -133
- package/src/v3/tests/complex.test.ts +0 -56
- package/src/v3/tests/custom.test.ts +0 -31
- package/src/v3/tests/date.test.ts +0 -32
- package/src/v3/tests/deepmasking.test.ts +0 -186
- package/src/v3/tests/default.test.ts +0 -112
- package/src/v3/tests/description.test.ts +0 -33
- package/src/v3/tests/discriminated-unions.test.ts +0 -315
- package/src/v3/tests/enum.test.ts +0 -80
- package/src/v3/tests/error.test.ts +0 -551
- package/src/v3/tests/firstparty.test.ts +0 -87
- package/src/v3/tests/firstpartyschematypes.test.ts +0 -21
- package/src/v3/tests/function.test.ts +0 -257
- package/src/v3/tests/generics.test.ts +0 -48
- package/src/v3/tests/instanceof.test.ts +0 -37
- package/src/v3/tests/intersection.test.ts +0 -110
- package/src/v3/tests/language-server.source.ts +0 -76
- package/src/v3/tests/language-server.test.ts +0 -207
- package/src/v3/tests/literal.test.ts +0 -36
- package/src/v3/tests/map.test.ts +0 -110
- package/src/v3/tests/masking.test.ts +0 -4
- package/src/v3/tests/mocker.test.ts +0 -19
- package/src/v3/tests/nan.test.ts +0 -21
- package/src/v3/tests/nativeEnum.test.ts +0 -87
- package/src/v3/tests/nullable.test.ts +0 -42
- package/src/v3/tests/number.test.ts +0 -176
- package/src/v3/tests/object-augmentation.test.ts +0 -29
- package/src/v3/tests/object-in-es5-env.test.ts +0 -29
- package/src/v3/tests/object.test.ts +0 -434
- package/src/v3/tests/optional.test.ts +0 -42
- package/src/v3/tests/parseUtil.test.ts +0 -23
- package/src/v3/tests/parser.test.ts +0 -41
- package/src/v3/tests/partials.test.ts +0 -243
- package/src/v3/tests/pickomit.test.ts +0 -111
- package/src/v3/tests/pipeline.test.ts +0 -29
- package/src/v3/tests/preprocess.test.ts +0 -188
- package/src/v3/tests/primitive.test.ts +0 -440
- package/src/v3/tests/promise.test.ts +0 -90
- package/src/v3/tests/readonly.test.ts +0 -194
- package/src/v3/tests/record.test.ts +0 -171
- package/src/v3/tests/recursive.test.ts +0 -197
- package/src/v3/tests/refine.test.ts +0 -297
- package/src/v3/tests/safeparse.test.ts +0 -27
- package/src/v3/tests/set.test.ts +0 -142
- package/src/v3/tests/standard-schema.test.ts +0 -83
- package/src/v3/tests/string.test.ts +0 -916
- package/src/v3/tests/transformer.test.ts +0 -233
- package/src/v3/tests/tuple.test.ts +0 -90
- package/src/v3/tests/unions.test.ts +0 -57
- package/src/v3/tests/validations.test.ts +0 -133
- package/src/v3/tests/void.test.ts +0 -15
- package/src/v3/types.ts +0 -5135
- package/src/v4/classic/checks.ts +0 -30
- package/src/v4/classic/coerce.ts +0 -27
- package/src/v4/classic/compat.ts +0 -76
- package/src/v4/classic/errors.ts +0 -75
- package/src/v4/classic/external.ts +0 -31
- package/src/v4/classic/index.ts +0 -5
- package/src/v4/classic/iso.ts +0 -90
- package/src/v4/classic/parse.ts +0 -33
- package/src/v4/classic/schemas.ts +0 -2062
- package/src/v4/classic/tests/anyunknown.test.ts +0 -26
- package/src/v4/classic/tests/array.test.ts +0 -257
- package/src/v4/classic/tests/assignability.test.ts +0 -124
- package/src/v4/classic/tests/async-parsing.test.ts +0 -381
- package/src/v4/classic/tests/async-refinements.test.ts +0 -68
- package/src/v4/classic/tests/base.test.ts +0 -7
- package/src/v4/classic/tests/bigint.test.ts +0 -54
- package/src/v4/classic/tests/brand.test.ts +0 -57
- package/src/v4/classic/tests/catch.test.ts +0 -252
- package/src/v4/classic/tests/coalesce.test.ts +0 -20
- package/src/v4/classic/tests/coerce.test.ts +0 -160
- package/src/v4/classic/tests/custom.test.ts +0 -16
- package/src/v4/classic/tests/date.test.ts +0 -31
- package/src/v4/classic/tests/default.test.ts +0 -114
- package/src/v4/classic/tests/description.test.ts +0 -32
- package/src/v4/classic/tests/discriminated-unions.test.ts +0 -566
- package/src/v4/classic/tests/enum.test.ts +0 -285
- package/src/v4/classic/tests/error-utils.test.ts +0 -480
- package/src/v4/classic/tests/error.test.ts +0 -698
- package/src/v4/classic/tests/file.test.ts +0 -52
- package/src/v4/classic/tests/firstparty.test.ts +0 -177
- package/src/v4/classic/tests/function.test.ts +0 -230
- package/src/v4/classic/tests/generics.test.ts +0 -58
- package/src/v4/classic/tests/index.test.ts +0 -909
- package/src/v4/classic/tests/instanceof.test.ts +0 -34
- package/src/v4/classic/tests/intersection.test.ts +0 -171
- package/src/v4/classic/tests/json-schema.test.ts +0 -1810
- package/src/v4/classic/tests/json.test.ts +0 -108
- package/src/v4/classic/tests/lazy.test.ts +0 -227
- package/src/v4/classic/tests/literal.test.ts +0 -82
- package/src/v4/classic/tests/map.test.ts +0 -196
- package/src/v4/classic/tests/nan.test.ts +0 -21
- package/src/v4/classic/tests/nested-refine.test.ts +0 -165
- package/src/v4/classic/tests/nonoptional.test.ts +0 -86
- package/src/v4/classic/tests/nullable.test.ts +0 -22
- package/src/v4/classic/tests/number.test.ts +0 -242
- package/src/v4/classic/tests/object.test.ts +0 -493
- package/src/v4/classic/tests/optional.test.ts +0 -103
- package/src/v4/classic/tests/partial.test.ts +0 -147
- package/src/v4/classic/tests/pickomit.test.ts +0 -125
- package/src/v4/classic/tests/pipe.test.ts +0 -81
- package/src/v4/classic/tests/prefault.test.ts +0 -37
- package/src/v4/classic/tests/preprocess.test.ts +0 -272
- package/src/v4/classic/tests/primitive.test.ts +0 -175
- package/src/v4/classic/tests/promise.test.ts +0 -81
- package/src/v4/classic/tests/readonly.test.ts +0 -252
- package/src/v4/classic/tests/record.test.ts +0 -332
- package/src/v4/classic/tests/recursive-types.test.ts +0 -126
- package/src/v4/classic/tests/refine.test.ts +0 -423
- package/src/v4/classic/tests/registries.test.ts +0 -159
- package/src/v4/classic/tests/set.test.ts +0 -179
- package/src/v4/classic/tests/standard-schema.test.ts +0 -57
- package/src/v4/classic/tests/string-formats.test.ts +0 -31
- package/src/v4/classic/tests/string.test.ts +0 -1081
- package/src/v4/classic/tests/template-literal.test.ts +0 -758
- package/src/v4/classic/tests/transform.test.ts +0 -250
- package/src/v4/classic/tests/tuple.test.ts +0 -163
- package/src/v4/classic/tests/union.test.ts +0 -94
- package/src/v4/classic/tests/validations.test.ts +0 -277
- package/src/v4/classic/tests/void.test.ts +0 -12
- package/src/v4/core/api.ts +0 -1533
- package/src/v4/core/checks.ts +0 -1282
- package/src/v4/core/config.ts +0 -15
- package/src/v4/core/core.ts +0 -98
- package/src/v4/core/doc.ts +0 -45
- package/src/v4/core/errors.ts +0 -433
- package/src/v4/core/function.ts +0 -143
- package/src/v4/core/index.ts +0 -15
- package/src/v4/core/json-schema.ts +0 -106
- package/src/v4/core/parse.ts +0 -94
- package/src/v4/core/regexes.ts +0 -133
- package/src/v4/core/registries.ts +0 -89
- package/src/v4/core/schemas.ts +0 -3802
- package/src/v4/core/standard-schema.ts +0 -64
- package/src/v4/core/tests/index.test.ts +0 -46
- package/src/v4/core/tests/locales/be.test.ts +0 -124
- package/src/v4/core/tests/locales/en.test.ts +0 -22
- package/src/v4/core/tests/locales/ru.test.ts +0 -128
- package/src/v4/core/tests/locales/tr.test.ts +0 -69
- package/src/v4/core/to-json-schema.ts +0 -790
- package/src/v4/core/util.ts +0 -750
- package/src/v4/core/versions.ts +0 -5
- package/src/v4/core/zsf.ts +0 -323
- package/src/v4/index.ts +0 -4
- package/src/v4/locales/ar.ts +0 -125
- package/src/v4/locales/az.ts +0 -121
- package/src/v4/locales/be.ts +0 -185
- package/src/v4/locales/ca.ts +0 -127
- package/src/v4/locales/cs.ts +0 -142
- package/src/v4/locales/de.ts +0 -124
- package/src/v4/locales/en.ts +0 -127
- package/src/v4/locales/es.ts +0 -124
- package/src/v4/locales/fa.ts +0 -134
- package/src/v4/locales/fi.ts +0 -131
- package/src/v4/locales/fr.ts +0 -124
- package/src/v4/locales/frCA.ts +0 -126
- package/src/v4/locales/he.ts +0 -125
- package/src/v4/locales/hu.ts +0 -126
- package/src/v4/locales/id.ts +0 -124
- package/src/v4/locales/index.ts +0 -34
- package/src/v4/locales/it.ts +0 -125
- package/src/v4/locales/ja.ts +0 -122
- package/src/v4/locales/ko.ts +0 -131
- package/src/v4/locales/mk.ts +0 -127
- package/src/v4/locales/ms.ts +0 -124
- package/src/v4/locales/no.ts +0 -124
- package/src/v4/locales/ota.ts +0 -125
- package/src/v4/locales/pl.ts +0 -125
- package/src/v4/locales/pt.ts +0 -123
- package/src/v4/locales/ru.ts +0 -185
- package/src/v4/locales/sl.ts +0 -125
- package/src/v4/locales/ta.ts +0 -125
- package/src/v4/locales/th.ts +0 -126
- package/src/v4/locales/tr.ts +0 -121
- package/src/v4/locales/ua.ts +0 -126
- package/src/v4/locales/ur.ts +0 -126
- package/src/v4/locales/vi.ts +0 -125
- package/src/v4/locales/zh-CN.ts +0 -123
- package/src/v4/locales/zh-tw.ts +0 -125
- package/src/v4/mini/checks.ts +0 -32
- package/src/v4/mini/coerce.ts +0 -22
- package/src/v4/mini/external.ts +0 -26
- package/src/v4/mini/index.ts +0 -3
- package/src/v4/mini/iso.ts +0 -62
- package/src/v4/mini/parse.ts +0 -1
- package/src/v4/mini/schemas.ts +0 -1556
- package/src/v4/mini/tests/assignability.test.ts +0 -117
- package/src/v4/mini/tests/brand.test.ts +0 -51
- package/src/v4/mini/tests/checks.test.ts +0 -144
- package/src/v4/mini/tests/computed.test.ts +0 -36
- package/src/v4/mini/tests/error.test.ts +0 -22
- package/src/v4/mini/tests/functions.test.ts +0 -43
- package/src/v4/mini/tests/index.test.ts +0 -914
- package/src/v4/mini/tests/number.test.ts +0 -95
- package/src/v4/mini/tests/object.test.ts +0 -139
- package/src/v4/mini/tests/prototypes.test.ts +0 -23
- package/src/v4/mini/tests/recursive-types.test.ts +0 -124
- package/src/v4/mini/tests/string.test.ts +0 -284
package/src/v4/mini/schemas.ts
DELETED
|
@@ -1,1556 +0,0 @@
|
|
|
1
|
-
import * as core from "zod/v4/core";
|
|
2
|
-
import { util } from "zod/v4/core";
|
|
3
|
-
import * as parse from "./parse.js";
|
|
4
|
-
|
|
5
|
-
export * as coerce from "./coerce.js";
|
|
6
|
-
export * as iso from "./iso.js";
|
|
7
|
-
|
|
8
|
-
type SomeType = core.$ZodType;
|
|
9
|
-
|
|
10
|
-
export interface ZodMiniType<out Output = unknown, out Input = unknown> extends core.$ZodType<Output, Input> {
|
|
11
|
-
check(...checks: (core.CheckFn<this["_zod"]["output"]> | core.$ZodCheck<this["_zod"]["output"]>)[]): this;
|
|
12
|
-
clone(def?: this["_zod"]["def"], params?: { parent: boolean }): this;
|
|
13
|
-
register<R extends core.$ZodRegistry>(
|
|
14
|
-
registry: R,
|
|
15
|
-
...meta: this extends R["_schema"]
|
|
16
|
-
? undefined extends R["_meta"]
|
|
17
|
-
? [core.$ZodRegistry<R["_meta"], this>["_meta"]?]
|
|
18
|
-
: [core.$ZodRegistry<R["_meta"], this>["_meta"]]
|
|
19
|
-
: ["Incompatible schema"]
|
|
20
|
-
): this;
|
|
21
|
-
brand<T extends PropertyKey = PropertyKey>(
|
|
22
|
-
value?: T
|
|
23
|
-
): PropertyKey extends T ? this : this & Record<"_zod", Record<"~output", core.output<this> & core.$brand<T>>>;
|
|
24
|
-
|
|
25
|
-
def: this["_zod"]["def"];
|
|
26
|
-
|
|
27
|
-
parse(data: unknown, params?: core.ParseContext<core.$ZodIssue>): core.output<this>;
|
|
28
|
-
safeParse(data: unknown, params?: core.ParseContext<core.$ZodIssue>): util.SafeParseResult<core.output<this>>;
|
|
29
|
-
parseAsync(data: unknown, params?: core.ParseContext<core.$ZodIssue>): Promise<core.output<this>>;
|
|
30
|
-
safeParseAsync(
|
|
31
|
-
data: unknown,
|
|
32
|
-
params?: core.ParseContext<core.$ZodIssue>
|
|
33
|
-
): Promise<util.SafeParseResult<core.output<this>>>;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export const ZodMiniType: core.$constructor<ZodMiniType> = /*@__PURE__*/ core.$constructor(
|
|
37
|
-
"ZodMiniType",
|
|
38
|
-
(inst, def) => {
|
|
39
|
-
if (!inst._zod) throw new Error("Uninitialized schema in mixin ZodMiniType.");
|
|
40
|
-
|
|
41
|
-
core.$ZodType.init(inst, def);
|
|
42
|
-
inst.def = def;
|
|
43
|
-
inst.parse = (data, params) => parse.parse(inst, data, params, { callee: inst.parse });
|
|
44
|
-
inst.safeParse = (data, params) => parse.safeParse(inst, data, params);
|
|
45
|
-
inst.parseAsync = async (data, params) => parse.parseAsync(inst, data, params, { callee: inst.parseAsync });
|
|
46
|
-
inst.safeParseAsync = async (data, params) => parse.safeParseAsync(inst, data, params);
|
|
47
|
-
inst.check = (...checks) => {
|
|
48
|
-
return inst.clone(
|
|
49
|
-
{
|
|
50
|
-
...def,
|
|
51
|
-
checks: [
|
|
52
|
-
...(def.checks ?? []),
|
|
53
|
-
...checks.map((ch) =>
|
|
54
|
-
typeof ch === "function" ? { _zod: { check: ch, def: { check: "custom" }, onattach: [] } } : ch
|
|
55
|
-
),
|
|
56
|
-
],
|
|
57
|
-
}
|
|
58
|
-
// { parent: true }
|
|
59
|
-
);
|
|
60
|
-
};
|
|
61
|
-
inst.clone = (_def, params) => core.clone(inst, _def, params);
|
|
62
|
-
inst.brand = () => inst as any;
|
|
63
|
-
inst.register = ((reg: any, meta: any) => {
|
|
64
|
-
reg.add(inst, meta);
|
|
65
|
-
return inst;
|
|
66
|
-
}) as any;
|
|
67
|
-
}
|
|
68
|
-
);
|
|
69
|
-
|
|
70
|
-
// ZodMiniString
|
|
71
|
-
export interface ZodMiniString<Input = unknown> extends ZodMiniType {
|
|
72
|
-
_zod: core.$ZodStringInternals<Input>;
|
|
73
|
-
}
|
|
74
|
-
export const ZodMiniString: core.$constructor<ZodMiniString> = /*@__PURE__*/ core.$constructor(
|
|
75
|
-
"ZodMiniString",
|
|
76
|
-
(inst, def) => {
|
|
77
|
-
core.$ZodString.init(inst, def);
|
|
78
|
-
ZodMiniType.init(inst, def);
|
|
79
|
-
}
|
|
80
|
-
);
|
|
81
|
-
|
|
82
|
-
export function string(params?: string | core.$ZodStringParams): ZodMiniString<string> {
|
|
83
|
-
return core._string(ZodMiniString, params) as any;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
// ZodMiniStringFormat
|
|
87
|
-
export interface ZodMiniStringFormat<Format extends core.$ZodStringFormats = core.$ZodStringFormats>
|
|
88
|
-
extends ZodMiniString {
|
|
89
|
-
_zod: core.$ZodStringFormatInternals<Format>;
|
|
90
|
-
}
|
|
91
|
-
export const ZodMiniStringFormat: core.$constructor<ZodMiniStringFormat> = /*@__PURE__*/ core.$constructor(
|
|
92
|
-
"ZodMiniStringFormat",
|
|
93
|
-
(inst, def) => {
|
|
94
|
-
core.$ZodStringFormat.init(inst, def);
|
|
95
|
-
ZodMiniString.init(inst, def);
|
|
96
|
-
}
|
|
97
|
-
);
|
|
98
|
-
|
|
99
|
-
// ZodMiniEmail
|
|
100
|
-
export interface ZodMiniEmail extends ZodMiniStringFormat<"email"> {
|
|
101
|
-
_zod: core.$ZodEmailInternals;
|
|
102
|
-
}
|
|
103
|
-
export const ZodMiniEmail: core.$constructor<ZodMiniEmail> = /*@__PURE__*/ core.$constructor(
|
|
104
|
-
"ZodMiniEmail",
|
|
105
|
-
(inst, def) => {
|
|
106
|
-
core.$ZodEmail.init(inst, def);
|
|
107
|
-
ZodMiniStringFormat.init(inst, def);
|
|
108
|
-
}
|
|
109
|
-
);
|
|
110
|
-
|
|
111
|
-
export function email(params?: string | core.$ZodEmailParams): ZodMiniEmail {
|
|
112
|
-
return core._email(ZodMiniEmail, params);
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
// ZodMiniGUID
|
|
116
|
-
export interface ZodMiniGUID extends ZodMiniStringFormat<"guid"> {
|
|
117
|
-
_zod: core.$ZodGUIDInternals;
|
|
118
|
-
}
|
|
119
|
-
export const ZodMiniGUID: core.$constructor<ZodMiniGUID> = /*@__PURE__*/ core.$constructor(
|
|
120
|
-
"ZodMiniGUID",
|
|
121
|
-
(inst, def) => {
|
|
122
|
-
core.$ZodGUID.init(inst, def);
|
|
123
|
-
ZodMiniStringFormat.init(inst, def);
|
|
124
|
-
}
|
|
125
|
-
);
|
|
126
|
-
|
|
127
|
-
export function guid(params?: string | core.$ZodGUIDParams): ZodMiniGUID {
|
|
128
|
-
return core._guid(ZodMiniGUID, params);
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
// ZodMiniUUID
|
|
132
|
-
export interface ZodMiniUUID extends ZodMiniStringFormat<"uuid"> {
|
|
133
|
-
_zod: core.$ZodUUIDInternals;
|
|
134
|
-
}
|
|
135
|
-
export const ZodMiniUUID: core.$constructor<ZodMiniUUID> = /*@__PURE__*/ core.$constructor(
|
|
136
|
-
"ZodMiniUUID",
|
|
137
|
-
(inst, def) => {
|
|
138
|
-
core.$ZodUUID.init(inst, def);
|
|
139
|
-
ZodMiniStringFormat.init(inst, def);
|
|
140
|
-
}
|
|
141
|
-
);
|
|
142
|
-
|
|
143
|
-
export function uuid(params?: string | core.$ZodUUIDParams): ZodMiniUUID {
|
|
144
|
-
return core._uuid(ZodMiniUUID, params);
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
export function uuidv4(params?: string | core.$ZodUUIDv4Params): ZodMiniUUID {
|
|
148
|
-
return core._uuidv4(ZodMiniUUID, params);
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
// ZodMiniUUIDv6
|
|
152
|
-
|
|
153
|
-
export function uuidv6(params?: string | core.$ZodUUIDv6Params): ZodMiniUUID {
|
|
154
|
-
return core._uuidv6(ZodMiniUUID, params);
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
// ZodMiniUUIDv7
|
|
158
|
-
|
|
159
|
-
export function uuidv7(params?: string | core.$ZodUUIDv7Params): ZodMiniUUID {
|
|
160
|
-
return core._uuidv7(ZodMiniUUID, params);
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
// ZodMiniURL
|
|
164
|
-
export interface ZodMiniURL extends ZodMiniStringFormat<"url"> {
|
|
165
|
-
_zod: core.$ZodURLInternals;
|
|
166
|
-
}
|
|
167
|
-
export const ZodMiniURL: core.$constructor<ZodMiniURL> = /*@__PURE__*/ core.$constructor("ZodMiniURL", (inst, def) => {
|
|
168
|
-
core.$ZodURL.init(inst, def);
|
|
169
|
-
ZodMiniStringFormat.init(inst, def);
|
|
170
|
-
});
|
|
171
|
-
|
|
172
|
-
export function url(params?: string | core.$ZodURLParams): ZodMiniURL {
|
|
173
|
-
return core._url(ZodMiniURL, params);
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
// ZodMiniEmoji
|
|
177
|
-
export interface ZodMiniEmoji extends ZodMiniStringFormat<"emoji"> {
|
|
178
|
-
_zod: core.$ZodEmojiInternals;
|
|
179
|
-
}
|
|
180
|
-
export const ZodMiniEmoji: core.$constructor<ZodMiniEmoji> = /*@__PURE__*/ core.$constructor(
|
|
181
|
-
"ZodMiniEmoji",
|
|
182
|
-
(inst, def) => {
|
|
183
|
-
core.$ZodEmoji.init(inst, def);
|
|
184
|
-
ZodMiniStringFormat.init(inst, def);
|
|
185
|
-
}
|
|
186
|
-
);
|
|
187
|
-
|
|
188
|
-
export function emoji(params?: string | core.$ZodEmojiParams): ZodMiniEmoji {
|
|
189
|
-
return core._emoji(ZodMiniEmoji, params);
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
// ZodMiniNanoID
|
|
193
|
-
export interface ZodMiniNanoID extends ZodMiniStringFormat<"nanoid"> {
|
|
194
|
-
_zod: core.$ZodNanoIDInternals;
|
|
195
|
-
}
|
|
196
|
-
export const ZodMiniNanoID: core.$constructor<ZodMiniNanoID> = /*@__PURE__*/ core.$constructor(
|
|
197
|
-
"ZodMiniNanoID",
|
|
198
|
-
(inst, def) => {
|
|
199
|
-
core.$ZodNanoID.init(inst, def);
|
|
200
|
-
ZodMiniStringFormat.init(inst, def);
|
|
201
|
-
}
|
|
202
|
-
);
|
|
203
|
-
|
|
204
|
-
export function nanoid(params?: string | core.$ZodNanoIDParams): ZodMiniNanoID {
|
|
205
|
-
return core._nanoid(ZodMiniNanoID, params);
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
// ZodMiniCUID
|
|
209
|
-
export interface ZodMiniCUID extends ZodMiniStringFormat<"cuid"> {
|
|
210
|
-
_zod: core.$ZodCUIDInternals;
|
|
211
|
-
}
|
|
212
|
-
export const ZodMiniCUID: core.$constructor<ZodMiniCUID> = /*@__PURE__*/ core.$constructor(
|
|
213
|
-
"ZodMiniCUID",
|
|
214
|
-
(inst, def) => {
|
|
215
|
-
core.$ZodCUID.init(inst, def);
|
|
216
|
-
ZodMiniStringFormat.init(inst, def);
|
|
217
|
-
}
|
|
218
|
-
);
|
|
219
|
-
|
|
220
|
-
export function cuid(params?: string | core.$ZodCUIDParams): ZodMiniCUID {
|
|
221
|
-
return core._cuid(ZodMiniCUID, params);
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
// ZodMiniCUID2
|
|
225
|
-
export interface ZodMiniCUID2 extends ZodMiniStringFormat<"cuid2"> {
|
|
226
|
-
_zod: core.$ZodCUID2Internals;
|
|
227
|
-
}
|
|
228
|
-
export const ZodMiniCUID2: core.$constructor<ZodMiniCUID2> = /*@__PURE__*/ core.$constructor(
|
|
229
|
-
"ZodMiniCUID2",
|
|
230
|
-
(inst, def) => {
|
|
231
|
-
core.$ZodCUID2.init(inst, def);
|
|
232
|
-
ZodMiniStringFormat.init(inst, def);
|
|
233
|
-
}
|
|
234
|
-
);
|
|
235
|
-
|
|
236
|
-
export function cuid2(params?: string | core.$ZodCUID2Params): ZodMiniCUID2 {
|
|
237
|
-
return core._cuid2(ZodMiniCUID2, params);
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
// ZodMiniULID
|
|
241
|
-
export interface ZodMiniULID extends ZodMiniStringFormat<"ulid"> {
|
|
242
|
-
_zod: core.$ZodULIDInternals;
|
|
243
|
-
}
|
|
244
|
-
export const ZodMiniULID: core.$constructor<ZodMiniULID> = /*@__PURE__*/ core.$constructor(
|
|
245
|
-
"ZodMiniULID",
|
|
246
|
-
(inst, def) => {
|
|
247
|
-
core.$ZodULID.init(inst, def);
|
|
248
|
-
ZodMiniStringFormat.init(inst, def);
|
|
249
|
-
}
|
|
250
|
-
);
|
|
251
|
-
|
|
252
|
-
export function ulid(params?: string | core.$ZodULIDParams): ZodMiniULID {
|
|
253
|
-
return core._ulid(ZodMiniULID, params);
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
// ZodMiniXID
|
|
257
|
-
export interface ZodMiniXID extends ZodMiniStringFormat<"xid"> {
|
|
258
|
-
_zod: core.$ZodXIDInternals;
|
|
259
|
-
}
|
|
260
|
-
export const ZodMiniXID: core.$constructor<ZodMiniXID> = /*@__PURE__*/ core.$constructor("ZodMiniXID", (inst, def) => {
|
|
261
|
-
core.$ZodXID.init(inst, def);
|
|
262
|
-
ZodMiniStringFormat.init(inst, def);
|
|
263
|
-
});
|
|
264
|
-
|
|
265
|
-
export function xid(params?: string | core.$ZodXIDParams): ZodMiniXID {
|
|
266
|
-
return core._xid(ZodMiniXID, params);
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
// ZodMiniKSUID
|
|
270
|
-
export interface ZodMiniKSUID extends ZodMiniStringFormat<"ksuid"> {
|
|
271
|
-
_zod: core.$ZodKSUIDInternals;
|
|
272
|
-
}
|
|
273
|
-
export const ZodMiniKSUID: core.$constructor<ZodMiniKSUID> = /*@__PURE__*/ core.$constructor(
|
|
274
|
-
"ZodMiniKSUID",
|
|
275
|
-
(inst, def) => {
|
|
276
|
-
core.$ZodKSUID.init(inst, def);
|
|
277
|
-
ZodMiniStringFormat.init(inst, def);
|
|
278
|
-
}
|
|
279
|
-
);
|
|
280
|
-
|
|
281
|
-
export function ksuid(params?: string | core.$ZodKSUIDParams): ZodMiniKSUID {
|
|
282
|
-
return core._ksuid(ZodMiniKSUID, params);
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
// ZodMiniIP
|
|
286
|
-
// export interface ZodMiniIP extends ZodMiniStringFormat<"ip"> {
|
|
287
|
-
// _zod: core.$ZodIPInternals;
|
|
288
|
-
// }
|
|
289
|
-
// export const ZodMiniIP: core.$constructor<ZodMiniIP> = /*@__PURE__*/ core.$constructor("ZodMiniIP", (inst, def) => {
|
|
290
|
-
// core.$ZodIP.init(inst, def);
|
|
291
|
-
// ZodMiniStringFormat.init(inst, def);
|
|
292
|
-
// });
|
|
293
|
-
|
|
294
|
-
// export function ip(params?: string | core.$ZodIPParams): ZodMiniIP {
|
|
295
|
-
// return core._ip(ZodMiniIP, params);
|
|
296
|
-
// }
|
|
297
|
-
|
|
298
|
-
// ZodMiniIPv4
|
|
299
|
-
export interface ZodMiniIPv4 extends ZodMiniStringFormat<"ipv4"> {
|
|
300
|
-
_zod: core.$ZodIPv4Internals;
|
|
301
|
-
}
|
|
302
|
-
export const ZodMiniIPv4: core.$constructor<ZodMiniIPv4> = /*@__PURE__*/ core.$constructor(
|
|
303
|
-
"ZodMiniIPv4",
|
|
304
|
-
(inst, def) => {
|
|
305
|
-
core.$ZodIPv4.init(inst, def);
|
|
306
|
-
ZodMiniStringFormat.init(inst, def);
|
|
307
|
-
}
|
|
308
|
-
);
|
|
309
|
-
|
|
310
|
-
export function ipv4(params?: string | core.$ZodIPv4Params): ZodMiniIPv4 {
|
|
311
|
-
return core._ipv4(ZodMiniIPv4, params);
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
// ZodMiniIPv6
|
|
315
|
-
export interface ZodMiniIPv6 extends ZodMiniStringFormat<"ipv6"> {
|
|
316
|
-
_zod: core.$ZodIPv6Internals;
|
|
317
|
-
}
|
|
318
|
-
export const ZodMiniIPv6: core.$constructor<ZodMiniIPv6> = /*@__PURE__*/ core.$constructor(
|
|
319
|
-
"ZodMiniIPv6",
|
|
320
|
-
(inst, def) => {
|
|
321
|
-
core.$ZodIPv6.init(inst, def);
|
|
322
|
-
ZodMiniStringFormat.init(inst, def);
|
|
323
|
-
}
|
|
324
|
-
);
|
|
325
|
-
|
|
326
|
-
export function ipv6(params?: string | core.$ZodIPv6Params): ZodMiniIPv6 {
|
|
327
|
-
return core._ipv6(ZodMiniIPv6, params);
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
// ZodMiniCIDRv4
|
|
331
|
-
export interface ZodMiniCIDRv4 extends ZodMiniStringFormat<"cidrv4"> {
|
|
332
|
-
_zod: core.$ZodCIDRv4Internals;
|
|
333
|
-
}
|
|
334
|
-
export const ZodMiniCIDRv4: core.$constructor<ZodMiniCIDRv4> = /*@__PURE__*/ core.$constructor(
|
|
335
|
-
"ZodMiniCIDRv4",
|
|
336
|
-
(inst, def) => {
|
|
337
|
-
core.$ZodCIDRv4.init(inst, def);
|
|
338
|
-
ZodMiniStringFormat.init(inst, def);
|
|
339
|
-
}
|
|
340
|
-
);
|
|
341
|
-
|
|
342
|
-
export function cidrv4(params?: string | core.$ZodCIDRv4Params): ZodMiniCIDRv4 {
|
|
343
|
-
return core._cidrv4(ZodMiniCIDRv4, params);
|
|
344
|
-
}
|
|
345
|
-
|
|
346
|
-
// ZodMiniCIDRv6
|
|
347
|
-
export interface ZodMiniCIDRv6 extends ZodMiniStringFormat<"cidrv6"> {
|
|
348
|
-
_zod: core.$ZodCIDRv6Internals;
|
|
349
|
-
}
|
|
350
|
-
export const ZodMiniCIDRv6: core.$constructor<ZodMiniCIDRv6> = /*@__PURE__*/ core.$constructor(
|
|
351
|
-
"ZodMiniCIDRv6",
|
|
352
|
-
(inst, def) => {
|
|
353
|
-
core.$ZodCIDRv6.init(inst, def);
|
|
354
|
-
ZodMiniStringFormat.init(inst, def);
|
|
355
|
-
}
|
|
356
|
-
);
|
|
357
|
-
|
|
358
|
-
export function cidrv6(params?: string | core.$ZodCIDRv6Params): ZodMiniCIDRv6 {
|
|
359
|
-
return core._cidrv6(ZodMiniCIDRv6, params);
|
|
360
|
-
}
|
|
361
|
-
|
|
362
|
-
// ZodMiniBase64
|
|
363
|
-
export interface ZodMiniBase64 extends ZodMiniStringFormat<"base64"> {
|
|
364
|
-
_zod: core.$ZodBase64Internals;
|
|
365
|
-
}
|
|
366
|
-
export const ZodMiniBase64: core.$constructor<ZodMiniBase64> = /*@__PURE__*/ core.$constructor(
|
|
367
|
-
"ZodMiniBase64",
|
|
368
|
-
(inst, def) => {
|
|
369
|
-
core.$ZodBase64.init(inst, def);
|
|
370
|
-
ZodMiniStringFormat.init(inst, def);
|
|
371
|
-
}
|
|
372
|
-
);
|
|
373
|
-
export function base64(params?: string | core.$ZodBase64Params): ZodMiniBase64 {
|
|
374
|
-
return core._base64(ZodMiniBase64, params);
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
// ZodMiniBase64URL
|
|
378
|
-
export interface ZodMiniBase64URL extends ZodMiniStringFormat<"base64url"> {
|
|
379
|
-
_zod: core.$ZodBase64URLInternals;
|
|
380
|
-
}
|
|
381
|
-
export const ZodMiniBase64URL: core.$constructor<ZodMiniBase64URL> = /*@__PURE__*/ core.$constructor(
|
|
382
|
-
"ZodMiniBase64URL",
|
|
383
|
-
(inst, def) => {
|
|
384
|
-
core.$ZodBase64URL.init(inst, def);
|
|
385
|
-
ZodMiniStringFormat.init(inst, def);
|
|
386
|
-
}
|
|
387
|
-
);
|
|
388
|
-
export function base64url(params?: string | core.$ZodBase64URLParams): ZodMiniBase64URL {
|
|
389
|
-
return core._base64url(ZodMiniBase64URL, params);
|
|
390
|
-
}
|
|
391
|
-
|
|
392
|
-
// ZodMiniE164
|
|
393
|
-
export interface ZodMiniE164 extends ZodMiniStringFormat<"e164"> {
|
|
394
|
-
_zod: core.$ZodE164Internals;
|
|
395
|
-
}
|
|
396
|
-
export const ZodMiniE164: core.$constructor<ZodMiniE164> = /*@__PURE__*/ core.$constructor(
|
|
397
|
-
"ZodMiniE164",
|
|
398
|
-
(inst, def) => {
|
|
399
|
-
core.$ZodE164.init(inst, def);
|
|
400
|
-
ZodMiniStringFormat.init(inst, def);
|
|
401
|
-
}
|
|
402
|
-
);
|
|
403
|
-
|
|
404
|
-
export function e164(params?: string | core.$ZodE164Params): ZodMiniE164 {
|
|
405
|
-
return core._e164(ZodMiniE164, params);
|
|
406
|
-
}
|
|
407
|
-
|
|
408
|
-
// ZodMiniJWT
|
|
409
|
-
export interface ZodMiniJWT extends ZodMiniStringFormat<"jwt"> {
|
|
410
|
-
_zod: core.$ZodJWTInternals;
|
|
411
|
-
}
|
|
412
|
-
export const ZodMiniJWT: core.$constructor<ZodMiniJWT> = /*@__PURE__*/ core.$constructor("ZodMiniJWT", (inst, def) => {
|
|
413
|
-
core.$ZodJWT.init(inst, def);
|
|
414
|
-
ZodMiniStringFormat.init(inst, def);
|
|
415
|
-
});
|
|
416
|
-
|
|
417
|
-
export function jwt(params?: string | core.$ZodJWTParams): ZodMiniJWT {
|
|
418
|
-
return core._jwt(ZodMiniJWT, params);
|
|
419
|
-
}
|
|
420
|
-
|
|
421
|
-
// ZodMiniNumber
|
|
422
|
-
export interface ZodMiniNumber<Input = unknown> extends ZodMiniType {
|
|
423
|
-
_zod: core.$ZodNumberInternals<Input>;
|
|
424
|
-
}
|
|
425
|
-
export const ZodMiniNumber: core.$constructor<ZodMiniNumber> = /*@__PURE__*/ core.$constructor(
|
|
426
|
-
"ZodMiniNumber",
|
|
427
|
-
(inst, def) => {
|
|
428
|
-
core.$ZodNumber.init(inst, def);
|
|
429
|
-
ZodMiniType.init(inst, def);
|
|
430
|
-
}
|
|
431
|
-
);
|
|
432
|
-
|
|
433
|
-
export function number(params?: string | core.$ZodNumberParams): ZodMiniNumber<number> {
|
|
434
|
-
return core._number(ZodMiniNumber, params) as any;
|
|
435
|
-
}
|
|
436
|
-
|
|
437
|
-
// ZodMiniNumberFormat
|
|
438
|
-
export interface ZodMiniNumberFormat extends ZodMiniNumber {
|
|
439
|
-
_zod: core.$ZodNumberFormatInternals;
|
|
440
|
-
}
|
|
441
|
-
export const ZodMiniNumberFormat: core.$constructor<ZodMiniNumberFormat> = /*@__PURE__*/ core.$constructor(
|
|
442
|
-
"ZodMiniNumberFormat",
|
|
443
|
-
(inst, def) => {
|
|
444
|
-
core.$ZodNumberFormat.init(inst, def);
|
|
445
|
-
ZodMiniNumber.init(inst, def);
|
|
446
|
-
}
|
|
447
|
-
);
|
|
448
|
-
|
|
449
|
-
// int
|
|
450
|
-
|
|
451
|
-
export function int(params?: string | core.$ZodCheckNumberFormatParams): ZodMiniNumberFormat {
|
|
452
|
-
return core._int(ZodMiniNumberFormat, params);
|
|
453
|
-
}
|
|
454
|
-
|
|
455
|
-
// float32
|
|
456
|
-
|
|
457
|
-
export function float32(params?: string | core.$ZodCheckNumberFormatParams): ZodMiniNumberFormat {
|
|
458
|
-
return core._float32(ZodMiniNumberFormat, params);
|
|
459
|
-
}
|
|
460
|
-
|
|
461
|
-
// float64
|
|
462
|
-
|
|
463
|
-
export function float64(params?: string | core.$ZodCheckNumberFormatParams): ZodMiniNumberFormat {
|
|
464
|
-
return core._float64(ZodMiniNumberFormat, params);
|
|
465
|
-
}
|
|
466
|
-
|
|
467
|
-
// int32
|
|
468
|
-
|
|
469
|
-
export function int32(params?: string | core.$ZodCheckNumberFormatParams): ZodMiniNumberFormat {
|
|
470
|
-
return core._int32(ZodMiniNumberFormat, params);
|
|
471
|
-
}
|
|
472
|
-
|
|
473
|
-
// uint32
|
|
474
|
-
|
|
475
|
-
export function uint32(params?: string | core.$ZodCheckNumberFormatParams): ZodMiniNumberFormat {
|
|
476
|
-
return core._uint32(ZodMiniNumberFormat, params);
|
|
477
|
-
}
|
|
478
|
-
|
|
479
|
-
// ZodMiniBoolean
|
|
480
|
-
export interface ZodMiniBoolean<T = unknown> extends ZodMiniType {
|
|
481
|
-
_zod: core.$ZodBooleanInternals<T>;
|
|
482
|
-
}
|
|
483
|
-
export const ZodMiniBoolean: core.$constructor<ZodMiniBoolean> = /*@__PURE__*/ core.$constructor(
|
|
484
|
-
"ZodMiniBoolean",
|
|
485
|
-
(inst, def) => {
|
|
486
|
-
core.$ZodBoolean.init(inst, def);
|
|
487
|
-
ZodMiniType.init(inst, def);
|
|
488
|
-
}
|
|
489
|
-
);
|
|
490
|
-
|
|
491
|
-
export function boolean(params?: string | core.$ZodBooleanParams): ZodMiniBoolean<boolean> {
|
|
492
|
-
return core._boolean(ZodMiniBoolean, params) as any;
|
|
493
|
-
}
|
|
494
|
-
|
|
495
|
-
// ZodMiniBigInt
|
|
496
|
-
export interface ZodMiniBigInt<T = unknown> extends ZodMiniType {
|
|
497
|
-
_zod: core.$ZodBigIntInternals<T>;
|
|
498
|
-
}
|
|
499
|
-
export const ZodMiniBigInt: core.$constructor<ZodMiniBigInt> = /*@__PURE__*/ core.$constructor(
|
|
500
|
-
"ZodMiniBigInt",
|
|
501
|
-
(inst, def) => {
|
|
502
|
-
core.$ZodBigInt.init(inst, def);
|
|
503
|
-
ZodMiniType.init(inst, def);
|
|
504
|
-
}
|
|
505
|
-
);
|
|
506
|
-
|
|
507
|
-
export function bigint(params?: string | core.$ZodBigIntParams): ZodMiniBigInt<bigint> {
|
|
508
|
-
return core._bigint(ZodMiniBigInt, params) as any;
|
|
509
|
-
}
|
|
510
|
-
|
|
511
|
-
// bigint formats
|
|
512
|
-
|
|
513
|
-
// ZodMiniBigIntFormat
|
|
514
|
-
export interface ZodMiniBigIntFormat extends ZodMiniType {
|
|
515
|
-
_zod: core.$ZodBigIntFormatInternals;
|
|
516
|
-
}
|
|
517
|
-
export const ZodMiniBigIntFormat: core.$constructor<ZodMiniBigIntFormat> = /*@__PURE__*/ core.$constructor(
|
|
518
|
-
"ZodMiniBigIntFormat",
|
|
519
|
-
(inst, def) => {
|
|
520
|
-
core.$ZodBigIntFormat.init(inst, def);
|
|
521
|
-
ZodMiniBigInt.init(inst, def);
|
|
522
|
-
}
|
|
523
|
-
);
|
|
524
|
-
|
|
525
|
-
// int64
|
|
526
|
-
|
|
527
|
-
export function int64(params?: string | core.$ZodBigIntFormatParams): ZodMiniBigIntFormat {
|
|
528
|
-
return core._int64(ZodMiniBigIntFormat, params);
|
|
529
|
-
}
|
|
530
|
-
|
|
531
|
-
// uint64
|
|
532
|
-
|
|
533
|
-
export function uint64(params?: string | core.$ZodBigIntFormatParams): ZodMiniBigIntFormat {
|
|
534
|
-
return core._uint64(ZodMiniBigIntFormat, params);
|
|
535
|
-
}
|
|
536
|
-
|
|
537
|
-
// ZodMiniSymbol
|
|
538
|
-
export interface ZodMiniSymbol extends ZodMiniType {
|
|
539
|
-
_zod: core.$ZodSymbolInternals;
|
|
540
|
-
}
|
|
541
|
-
export const ZodMiniSymbol: core.$constructor<ZodMiniSymbol> = /*@__PURE__*/ core.$constructor(
|
|
542
|
-
"ZodMiniSymbol",
|
|
543
|
-
(inst, def) => {
|
|
544
|
-
core.$ZodSymbol.init(inst, def);
|
|
545
|
-
ZodMiniType.init(inst, def);
|
|
546
|
-
}
|
|
547
|
-
);
|
|
548
|
-
|
|
549
|
-
export function symbol(params?: string | core.$ZodSymbolParams): ZodMiniSymbol {
|
|
550
|
-
return core._symbol(ZodMiniSymbol, params) as any;
|
|
551
|
-
}
|
|
552
|
-
|
|
553
|
-
// ZodMiniUndefined
|
|
554
|
-
export interface ZodMiniUndefined extends ZodMiniType {
|
|
555
|
-
_zod: core.$ZodUndefinedInternals;
|
|
556
|
-
}
|
|
557
|
-
export const ZodMiniUndefined: core.$constructor<ZodMiniUndefined> = /*@__PURE__*/ core.$constructor(
|
|
558
|
-
"ZodMiniUndefined",
|
|
559
|
-
(inst, def) => {
|
|
560
|
-
core.$ZodUndefined.init(inst, def);
|
|
561
|
-
ZodMiniType.init(inst, def);
|
|
562
|
-
}
|
|
563
|
-
);
|
|
564
|
-
|
|
565
|
-
function _undefined(params?: string | core.$ZodUndefinedParams): ZodMiniUndefined {
|
|
566
|
-
return core._undefined(ZodMiniUndefined, params) as any;
|
|
567
|
-
}
|
|
568
|
-
export { _undefined as undefined };
|
|
569
|
-
|
|
570
|
-
// ZodMiniNull
|
|
571
|
-
export interface ZodMiniNull extends ZodMiniType {
|
|
572
|
-
_zod: core.$ZodNullInternals;
|
|
573
|
-
}
|
|
574
|
-
export const ZodMiniNull: core.$constructor<ZodMiniNull> = /*@__PURE__*/ core.$constructor(
|
|
575
|
-
"ZodMiniNull",
|
|
576
|
-
(inst, def) => {
|
|
577
|
-
core.$ZodNull.init(inst, def);
|
|
578
|
-
ZodMiniType.init(inst, def);
|
|
579
|
-
}
|
|
580
|
-
);
|
|
581
|
-
|
|
582
|
-
function _null(params?: string | core.$ZodNullParams): ZodMiniNull {
|
|
583
|
-
return core._null(ZodMiniNull, params) as any;
|
|
584
|
-
}
|
|
585
|
-
export { _null as null };
|
|
586
|
-
|
|
587
|
-
// ZodMiniAny
|
|
588
|
-
export interface ZodMiniAny extends ZodMiniType {
|
|
589
|
-
_zod: core.$ZodAnyInternals;
|
|
590
|
-
}
|
|
591
|
-
export const ZodMiniAny: core.$constructor<ZodMiniAny> = /*@__PURE__*/ core.$constructor("ZodMiniAny", (inst, def) => {
|
|
592
|
-
core.$ZodAny.init(inst, def);
|
|
593
|
-
ZodMiniType.init(inst, def);
|
|
594
|
-
});
|
|
595
|
-
|
|
596
|
-
export function any(): ZodMiniAny {
|
|
597
|
-
return core._any(ZodMiniAny) as any;
|
|
598
|
-
}
|
|
599
|
-
|
|
600
|
-
// ZodMiniUnknown
|
|
601
|
-
export interface ZodMiniUnknown extends ZodMiniType {
|
|
602
|
-
_zod: core.$ZodUnknownInternals;
|
|
603
|
-
}
|
|
604
|
-
export const ZodMiniUnknown: core.$constructor<ZodMiniUnknown> = /*@__PURE__*/ core.$constructor(
|
|
605
|
-
"ZodMiniUnknown",
|
|
606
|
-
(inst, def) => {
|
|
607
|
-
core.$ZodUnknown.init(inst, def);
|
|
608
|
-
ZodMiniType.init(inst, def);
|
|
609
|
-
}
|
|
610
|
-
);
|
|
611
|
-
|
|
612
|
-
export function unknown(): ZodMiniUnknown {
|
|
613
|
-
return core._unknown(ZodMiniUnknown) as any;
|
|
614
|
-
}
|
|
615
|
-
|
|
616
|
-
// ZodMiniNever
|
|
617
|
-
export interface ZodMiniNever extends ZodMiniType {
|
|
618
|
-
_zod: core.$ZodNeverInternals;
|
|
619
|
-
}
|
|
620
|
-
export const ZodMiniNever: core.$constructor<ZodMiniNever> = /*@__PURE__*/ core.$constructor(
|
|
621
|
-
"ZodMiniNever",
|
|
622
|
-
(inst, def) => {
|
|
623
|
-
core.$ZodNever.init(inst, def);
|
|
624
|
-
ZodMiniType.init(inst, def);
|
|
625
|
-
}
|
|
626
|
-
);
|
|
627
|
-
|
|
628
|
-
export function never(params?: string | core.$ZodNeverParams): ZodMiniNever {
|
|
629
|
-
return core._never(ZodMiniNever, params) as any;
|
|
630
|
-
}
|
|
631
|
-
|
|
632
|
-
// ZodMiniVoid
|
|
633
|
-
export interface ZodMiniVoid extends ZodMiniType {
|
|
634
|
-
_zod: core.$ZodVoidInternals;
|
|
635
|
-
}
|
|
636
|
-
export const ZodMiniVoid: core.$constructor<ZodMiniVoid> = /*@__PURE__*/ core.$constructor(
|
|
637
|
-
"ZodMiniVoid",
|
|
638
|
-
(inst, def) => {
|
|
639
|
-
core.$ZodVoid.init(inst, def);
|
|
640
|
-
ZodMiniType.init(inst, def);
|
|
641
|
-
}
|
|
642
|
-
);
|
|
643
|
-
|
|
644
|
-
function _void(params?: string | core.$ZodVoidParams): ZodMiniVoid {
|
|
645
|
-
return core._void(ZodMiniVoid, params) as any;
|
|
646
|
-
}
|
|
647
|
-
export { _void as void };
|
|
648
|
-
|
|
649
|
-
// ZodMiniDate
|
|
650
|
-
export interface ZodMiniDate<T = unknown> extends ZodMiniType {
|
|
651
|
-
_zod: core.$ZodDateInternals<T>;
|
|
652
|
-
}
|
|
653
|
-
|
|
654
|
-
export const ZodMiniDate: core.$constructor<ZodMiniDate> = /*@__PURE__*/ core.$constructor(
|
|
655
|
-
"ZodMiniDate",
|
|
656
|
-
(inst, def) => {
|
|
657
|
-
core.$ZodDate.init(inst, def);
|
|
658
|
-
ZodMiniType.init(inst, def);
|
|
659
|
-
}
|
|
660
|
-
);
|
|
661
|
-
|
|
662
|
-
export function date(params?: string | core.$ZodDateParams): ZodMiniDate<Date> {
|
|
663
|
-
return core._date(ZodMiniDate, params) as any;
|
|
664
|
-
}
|
|
665
|
-
|
|
666
|
-
// ZodMiniArray
|
|
667
|
-
export interface ZodMiniArray<T extends SomeType = SomeType> extends ZodMiniType {
|
|
668
|
-
_zod: core.$ZodArrayInternals<T>;
|
|
669
|
-
}
|
|
670
|
-
export const ZodMiniArray: core.$constructor<ZodMiniArray> = /*@__PURE__*/ core.$constructor(
|
|
671
|
-
"ZodMiniArray",
|
|
672
|
-
(inst, def) => {
|
|
673
|
-
core.$ZodArray.init(inst, def);
|
|
674
|
-
ZodMiniType.init(inst, def);
|
|
675
|
-
}
|
|
676
|
-
);
|
|
677
|
-
|
|
678
|
-
export function array<T extends SomeType>(element: T, params?: string | core.$ZodArrayParams): ZodMiniArray<T>;
|
|
679
|
-
export function array<T extends SomeType>(element: SomeType, params?: any): ZodMiniArray<T> {
|
|
680
|
-
return new ZodMiniArray({
|
|
681
|
-
type: "array",
|
|
682
|
-
element,
|
|
683
|
-
// get element() {
|
|
684
|
-
// return element;
|
|
685
|
-
// },
|
|
686
|
-
...util.normalizeParams(params),
|
|
687
|
-
}) as ZodMiniArray<T>;
|
|
688
|
-
}
|
|
689
|
-
|
|
690
|
-
// .keyof
|
|
691
|
-
export function keyof<T extends ZodMiniObject>(schema: T): ZodMiniLiteral<keyof T["shape"]> {
|
|
692
|
-
const shape = schema._zod.def.shape;
|
|
693
|
-
return literal(Object.keys(shape)) as any;
|
|
694
|
-
}
|
|
695
|
-
|
|
696
|
-
// ZodMiniObject
|
|
697
|
-
export interface ZodMiniObject<
|
|
698
|
-
/** @ts-ignore Cast variance */
|
|
699
|
-
out Shape extends core.$ZodShape = core.$ZodShape,
|
|
700
|
-
out Config extends core.$ZodObjectConfig = core.$ZodObjectConfig,
|
|
701
|
-
> extends ZodMiniType {
|
|
702
|
-
_zod: core.$ZodObjectInternals<Shape, Config>;
|
|
703
|
-
shape: Shape;
|
|
704
|
-
}
|
|
705
|
-
export const ZodMiniObject: core.$constructor<ZodMiniObject> = /*@__PURE__*/ core.$constructor(
|
|
706
|
-
"ZodMiniObject",
|
|
707
|
-
(inst, def) => {
|
|
708
|
-
core.$ZodObject.init(inst, def);
|
|
709
|
-
ZodMiniType.init(inst, def);
|
|
710
|
-
}
|
|
711
|
-
);
|
|
712
|
-
export function object<T extends core.$ZodLooseShape = Record<never, SomeType>>(
|
|
713
|
-
shape?: T,
|
|
714
|
-
params?: string | core.$ZodObjectParams
|
|
715
|
-
): ZodMiniObject<T, core.$strip> {
|
|
716
|
-
const def: core.$ZodObjectDef = {
|
|
717
|
-
type: "object",
|
|
718
|
-
get shape() {
|
|
719
|
-
util.assignProp(this, "shape", { ...shape });
|
|
720
|
-
return this.shape;
|
|
721
|
-
},
|
|
722
|
-
...util.normalizeParams(params),
|
|
723
|
-
};
|
|
724
|
-
return new ZodMiniObject(def) as any;
|
|
725
|
-
}
|
|
726
|
-
|
|
727
|
-
// strictObject
|
|
728
|
-
|
|
729
|
-
export function strictObject<T extends core.$ZodLooseShape>(
|
|
730
|
-
shape: T,
|
|
731
|
-
params?: string | core.$ZodObjectParams
|
|
732
|
-
): ZodMiniObject<T, core.$strict> {
|
|
733
|
-
return new ZodMiniObject({
|
|
734
|
-
type: "object",
|
|
735
|
-
// shape: shape as core.$ZodLooseShape,
|
|
736
|
-
get shape() {
|
|
737
|
-
util.assignProp(this, "shape", { ...shape });
|
|
738
|
-
return this.shape;
|
|
739
|
-
},
|
|
740
|
-
// get optional() {
|
|
741
|
-
// return util.optionalKeys(shape);
|
|
742
|
-
// },
|
|
743
|
-
catchall: never(),
|
|
744
|
-
...util.normalizeParams(params),
|
|
745
|
-
}) as any;
|
|
746
|
-
}
|
|
747
|
-
|
|
748
|
-
// looseObject
|
|
749
|
-
|
|
750
|
-
export function looseObject<T extends core.$ZodLooseShape>(
|
|
751
|
-
shape: T,
|
|
752
|
-
params?: string | core.$ZodObjectParams
|
|
753
|
-
): ZodMiniObject<T, core.$loose> {
|
|
754
|
-
return new ZodMiniObject({
|
|
755
|
-
type: "object",
|
|
756
|
-
// shape: shape as core.$ZodLooseShape,
|
|
757
|
-
get shape() {
|
|
758
|
-
util.assignProp(this, "shape", { ...shape });
|
|
759
|
-
return this.shape;
|
|
760
|
-
},
|
|
761
|
-
// get optional() {
|
|
762
|
-
// return util.optionalKeys(shape);
|
|
763
|
-
// },
|
|
764
|
-
catchall: unknown(),
|
|
765
|
-
...util.normalizeParams(params),
|
|
766
|
-
}) as any;
|
|
767
|
-
}
|
|
768
|
-
|
|
769
|
-
// object methods
|
|
770
|
-
export function extend<T extends ZodMiniObject, U extends core.$ZodLooseShape>(
|
|
771
|
-
schema: T,
|
|
772
|
-
shape: U
|
|
773
|
-
): ZodMiniObject<util.Extend<T["shape"], U>, T["_zod"]["config"]> {
|
|
774
|
-
return util.extend(schema, shape);
|
|
775
|
-
}
|
|
776
|
-
|
|
777
|
-
/** @deprecated Identical to `z.extend(A, B)` */
|
|
778
|
-
export function merge<T extends ZodMiniObject, U extends ZodMiniObject>(
|
|
779
|
-
a: T,
|
|
780
|
-
b: U
|
|
781
|
-
): ZodMiniObject<util.Extend<T["shape"], U["shape"]>, T["_zod"]["config"]>;
|
|
782
|
-
export function merge(schema: ZodMiniObject, shape: any): ZodMiniObject {
|
|
783
|
-
return util.extend(schema, shape);
|
|
784
|
-
}
|
|
785
|
-
|
|
786
|
-
export function pick<T extends ZodMiniObject, M extends util.Mask<keyof T["shape"]>>(
|
|
787
|
-
schema: T,
|
|
788
|
-
mask: M
|
|
789
|
-
): ZodMiniObject<util.Flatten<Pick<T["shape"], keyof T["shape"] & keyof M>>, T["_zod"]["config"]> {
|
|
790
|
-
return util.pick(schema, mask as any);
|
|
791
|
-
}
|
|
792
|
-
|
|
793
|
-
// .omit
|
|
794
|
-
|
|
795
|
-
export function omit<T extends ZodMiniObject, const M extends util.Mask<keyof T["shape"]>>(
|
|
796
|
-
schema: T,
|
|
797
|
-
mask: M
|
|
798
|
-
): ZodMiniObject<util.Flatten<Omit<T["shape"], keyof M>>, T["_zod"]["config"]> {
|
|
799
|
-
return util.omit(schema, mask);
|
|
800
|
-
}
|
|
801
|
-
|
|
802
|
-
export function partial<T extends ZodMiniObject>(
|
|
803
|
-
schema: T
|
|
804
|
-
): ZodMiniObject<
|
|
805
|
-
{
|
|
806
|
-
[k in keyof T["shape"]]: ZodMiniOptional<T["shape"][k]>;
|
|
807
|
-
},
|
|
808
|
-
T["_zod"]["config"]
|
|
809
|
-
>;
|
|
810
|
-
export function partial<T extends ZodMiniObject, M extends util.Mask<keyof T["shape"]>>(
|
|
811
|
-
schema: T,
|
|
812
|
-
mask: M
|
|
813
|
-
): ZodMiniObject<
|
|
814
|
-
{
|
|
815
|
-
[k in keyof T["shape"]]: k extends keyof M ? ZodMiniOptional<T["shape"][k]> : T["shape"][k];
|
|
816
|
-
},
|
|
817
|
-
T["_zod"]["config"]
|
|
818
|
-
>;
|
|
819
|
-
export function partial(schema: ZodMiniObject, mask?: object) {
|
|
820
|
-
return util.partial(ZodMiniOptional, schema, mask);
|
|
821
|
-
}
|
|
822
|
-
|
|
823
|
-
export type RequiredInterfaceShape<
|
|
824
|
-
Shape extends core.$ZodLooseShape,
|
|
825
|
-
Keys extends PropertyKey = keyof Shape,
|
|
826
|
-
> = util.Identity<
|
|
827
|
-
{
|
|
828
|
-
[k in keyof Shape as k extends Keys ? k : never]: ZodMiniNonOptional<Shape[k]>;
|
|
829
|
-
} & {
|
|
830
|
-
[k in keyof Shape as k extends Keys ? never : k]: Shape[k];
|
|
831
|
-
}
|
|
832
|
-
>;
|
|
833
|
-
|
|
834
|
-
export function required<T extends ZodMiniObject>(
|
|
835
|
-
schema: T
|
|
836
|
-
): ZodMiniObject<
|
|
837
|
-
{
|
|
838
|
-
[k in keyof T["shape"]]: ZodMiniNonOptional<T["shape"][k]>;
|
|
839
|
-
},
|
|
840
|
-
T["_zod"]["config"]
|
|
841
|
-
>;
|
|
842
|
-
export function required<T extends ZodMiniObject, M extends util.Mask<keyof T["shape"]>>(
|
|
843
|
-
schema: T,
|
|
844
|
-
mask: M
|
|
845
|
-
): ZodMiniObject<
|
|
846
|
-
util.Extend<
|
|
847
|
-
T["shape"],
|
|
848
|
-
{
|
|
849
|
-
[k in keyof M & keyof T["shape"]]: ZodMiniNonOptional<T["shape"][k]>;
|
|
850
|
-
}
|
|
851
|
-
>,
|
|
852
|
-
T["_zod"]["config"]
|
|
853
|
-
>;
|
|
854
|
-
export function required(schema: ZodMiniObject, mask?: object) {
|
|
855
|
-
return util.required(ZodMiniNonOptional, schema, mask);
|
|
856
|
-
}
|
|
857
|
-
|
|
858
|
-
// ZodMiniUnion
|
|
859
|
-
export interface ZodMiniUnion<T extends readonly SomeType[] = readonly SomeType[]> extends ZodMiniType {
|
|
860
|
-
_zod: core.$ZodUnionInternals<T>;
|
|
861
|
-
}
|
|
862
|
-
export const ZodMiniUnion: core.$constructor<ZodMiniUnion> = /*@__PURE__*/ core.$constructor(
|
|
863
|
-
"ZodMiniUnion",
|
|
864
|
-
(inst, def) => {
|
|
865
|
-
core.$ZodUnion.init(inst, def);
|
|
866
|
-
ZodMiniType.init(inst, def);
|
|
867
|
-
}
|
|
868
|
-
);
|
|
869
|
-
|
|
870
|
-
export function union<const T extends readonly SomeType[]>(
|
|
871
|
-
options: T,
|
|
872
|
-
params?: string | core.$ZodUnionParams
|
|
873
|
-
): ZodMiniUnion<T> {
|
|
874
|
-
return new ZodMiniUnion({
|
|
875
|
-
type: "union",
|
|
876
|
-
options,
|
|
877
|
-
...util.normalizeParams(params),
|
|
878
|
-
}) as ZodMiniUnion<T>;
|
|
879
|
-
}
|
|
880
|
-
|
|
881
|
-
// ZodMiniDiscriminatedUnion
|
|
882
|
-
export interface ZodMiniDiscriminatedUnion<Options extends readonly SomeType[] = readonly SomeType[]>
|
|
883
|
-
extends ZodMiniUnion<Options> {
|
|
884
|
-
_zod: core.$ZodDiscriminatedUnionInternals<Options>;
|
|
885
|
-
}
|
|
886
|
-
export const ZodMiniDiscriminatedUnion: core.$constructor<ZodMiniDiscriminatedUnion> = /*@__PURE__*/ core.$constructor(
|
|
887
|
-
"ZodMiniDiscriminatedUnion",
|
|
888
|
-
(inst, def) => {
|
|
889
|
-
core.$ZodDiscriminatedUnion.init(inst, def);
|
|
890
|
-
ZodMiniType.init(inst, def);
|
|
891
|
-
}
|
|
892
|
-
);
|
|
893
|
-
|
|
894
|
-
export interface $ZodTypeDiscriminableInternals extends core.$ZodTypeInternals {
|
|
895
|
-
disc: util.DiscriminatorMap;
|
|
896
|
-
}
|
|
897
|
-
|
|
898
|
-
export interface $ZodTypeDiscriminable extends ZodMiniType {
|
|
899
|
-
_zod: $ZodTypeDiscriminableInternals;
|
|
900
|
-
}
|
|
901
|
-
|
|
902
|
-
export function discriminatedUnion<Types extends readonly [$ZodTypeDiscriminable, ...$ZodTypeDiscriminable[]]>(
|
|
903
|
-
discriminator: string,
|
|
904
|
-
options: Types,
|
|
905
|
-
params?: string | core.$ZodDiscriminatedUnionParams
|
|
906
|
-
): ZodMiniDiscriminatedUnion<Types> {
|
|
907
|
-
return new ZodMiniDiscriminatedUnion({
|
|
908
|
-
type: "union",
|
|
909
|
-
options,
|
|
910
|
-
discriminator,
|
|
911
|
-
...util.normalizeParams(params),
|
|
912
|
-
}) as ZodMiniDiscriminatedUnion<Types>;
|
|
913
|
-
}
|
|
914
|
-
|
|
915
|
-
// ZodMiniIntersection
|
|
916
|
-
export interface ZodMiniIntersection<A extends SomeType = SomeType, B extends SomeType = SomeType> extends ZodMiniType {
|
|
917
|
-
_zod: core.$ZodIntersectionInternals<A, B>;
|
|
918
|
-
}
|
|
919
|
-
export const ZodMiniIntersection: core.$constructor<ZodMiniIntersection> = /*@__PURE__*/ core.$constructor(
|
|
920
|
-
"ZodMiniIntersection",
|
|
921
|
-
(inst, def) => {
|
|
922
|
-
core.$ZodIntersection.init(inst, def);
|
|
923
|
-
ZodMiniType.init(inst, def);
|
|
924
|
-
}
|
|
925
|
-
);
|
|
926
|
-
|
|
927
|
-
export function intersection<T extends SomeType, U extends SomeType>(left: T, right: U): ZodMiniIntersection<T, U> {
|
|
928
|
-
return new ZodMiniIntersection({
|
|
929
|
-
type: "intersection",
|
|
930
|
-
left,
|
|
931
|
-
right,
|
|
932
|
-
}) as ZodMiniIntersection<T, U>;
|
|
933
|
-
}
|
|
934
|
-
|
|
935
|
-
// ZodMiniTuple
|
|
936
|
-
export interface ZodMiniTuple<
|
|
937
|
-
T extends util.TupleItems = util.TupleItems,
|
|
938
|
-
Rest extends SomeType | null = SomeType | null,
|
|
939
|
-
> extends ZodMiniType {
|
|
940
|
-
_zod: core.$ZodTupleInternals<T, Rest>;
|
|
941
|
-
}
|
|
942
|
-
export const ZodMiniTuple: core.$constructor<ZodMiniTuple> = /*@__PURE__*/ core.$constructor(
|
|
943
|
-
"ZodMiniTuple",
|
|
944
|
-
(inst, def) => {
|
|
945
|
-
core.$ZodTuple.init(inst, def);
|
|
946
|
-
ZodMiniType.init(inst, def);
|
|
947
|
-
}
|
|
948
|
-
);
|
|
949
|
-
|
|
950
|
-
export function tuple<T extends readonly [SomeType, ...SomeType[]]>(
|
|
951
|
-
items: T,
|
|
952
|
-
params?: string | core.$ZodTupleParams
|
|
953
|
-
): ZodMiniTuple<T, null>;
|
|
954
|
-
export function tuple<T extends readonly [SomeType, ...SomeType[]], Rest extends SomeType>(
|
|
955
|
-
items: T,
|
|
956
|
-
rest: Rest,
|
|
957
|
-
params?: string | core.$ZodTupleParams
|
|
958
|
-
): ZodMiniTuple<T, Rest>;
|
|
959
|
-
export function tuple(items: [], params?: string | core.$ZodTupleParams): ZodMiniTuple<[], null>;
|
|
960
|
-
export function tuple(
|
|
961
|
-
items: SomeType[],
|
|
962
|
-
_paramsOrRest?: string | core.$ZodTupleParams | SomeType,
|
|
963
|
-
_params?: string | core.$ZodTupleParams
|
|
964
|
-
) {
|
|
965
|
-
const hasRest = _paramsOrRest instanceof core.$ZodType;
|
|
966
|
-
const params = hasRest ? _params : _paramsOrRest;
|
|
967
|
-
const rest = hasRest ? _paramsOrRest : null;
|
|
968
|
-
return new ZodMiniTuple({
|
|
969
|
-
type: "tuple",
|
|
970
|
-
items,
|
|
971
|
-
rest,
|
|
972
|
-
...util.normalizeParams(params),
|
|
973
|
-
});
|
|
974
|
-
}
|
|
975
|
-
|
|
976
|
-
// ZodMiniRecord
|
|
977
|
-
export interface ZodMiniRecord<Key extends core.$ZodRecordKey = core.$ZodRecordKey, Value extends SomeType = SomeType>
|
|
978
|
-
extends ZodMiniType {
|
|
979
|
-
_zod: core.$ZodRecordInternals<Key, Value>;
|
|
980
|
-
}
|
|
981
|
-
export const ZodMiniRecord: core.$constructor<ZodMiniRecord> = /*@__PURE__*/ core.$constructor(
|
|
982
|
-
"ZodMiniRecord",
|
|
983
|
-
(inst, def) => {
|
|
984
|
-
core.$ZodRecord.init(inst, def);
|
|
985
|
-
ZodMiniType.init(inst, def);
|
|
986
|
-
}
|
|
987
|
-
);
|
|
988
|
-
|
|
989
|
-
export function record<Key extends core.$ZodRecordKey, Value extends SomeType>(
|
|
990
|
-
keyType: Key,
|
|
991
|
-
valueType: Value,
|
|
992
|
-
params?: string | core.$ZodRecordParams
|
|
993
|
-
): ZodMiniRecord<Key, Value> {
|
|
994
|
-
return new ZodMiniRecord({
|
|
995
|
-
type: "record",
|
|
996
|
-
keyType,
|
|
997
|
-
valueType,
|
|
998
|
-
...util.normalizeParams(params),
|
|
999
|
-
}) as ZodMiniRecord<Key, Value>;
|
|
1000
|
-
}
|
|
1001
|
-
export function partialRecord<Key extends core.$ZodRecordKey, Value extends SomeType>(
|
|
1002
|
-
keyType: Key,
|
|
1003
|
-
valueType: Value,
|
|
1004
|
-
params?: string | core.$ZodRecordParams
|
|
1005
|
-
): ZodMiniRecord<ZodMiniUnion<[Key, ZodMiniNever]>, Value> {
|
|
1006
|
-
return new ZodMiniRecord({
|
|
1007
|
-
type: "record",
|
|
1008
|
-
keyType: union([keyType, never()]),
|
|
1009
|
-
valueType,
|
|
1010
|
-
...util.normalizeParams(params),
|
|
1011
|
-
}) as ZodMiniRecord<Key, Value>;
|
|
1012
|
-
}
|
|
1013
|
-
|
|
1014
|
-
// ZodMiniMap
|
|
1015
|
-
export interface ZodMiniMap<Key extends SomeType = SomeType, Value extends SomeType = SomeType> extends ZodMiniType {
|
|
1016
|
-
_zod: core.$ZodMapInternals<Key, Value>;
|
|
1017
|
-
}
|
|
1018
|
-
export const ZodMiniMap: core.$constructor<ZodMiniMap> = /*@__PURE__*/ core.$constructor("ZodMiniMap", (inst, def) => {
|
|
1019
|
-
core.$ZodMap.init(inst, def);
|
|
1020
|
-
ZodMiniType.init(inst, def);
|
|
1021
|
-
});
|
|
1022
|
-
|
|
1023
|
-
export function map<Key extends SomeType, Value extends SomeType>(
|
|
1024
|
-
keyType: Key,
|
|
1025
|
-
valueType: Value,
|
|
1026
|
-
params?: string | core.$ZodMapParams
|
|
1027
|
-
): ZodMiniMap<Key, Value> {
|
|
1028
|
-
return new ZodMiniMap({
|
|
1029
|
-
type: "map",
|
|
1030
|
-
keyType,
|
|
1031
|
-
valueType,
|
|
1032
|
-
...util.normalizeParams(params),
|
|
1033
|
-
}) as ZodMiniMap<Key, Value>;
|
|
1034
|
-
}
|
|
1035
|
-
|
|
1036
|
-
// ZodMiniSet
|
|
1037
|
-
export interface ZodMiniSet<T extends SomeType = SomeType> extends ZodMiniType {
|
|
1038
|
-
_zod: core.$ZodSetInternals<T>;
|
|
1039
|
-
}
|
|
1040
|
-
export const ZodMiniSet: core.$constructor<ZodMiniSet> = /*@__PURE__*/ core.$constructor("ZodMiniSet", (inst, def) => {
|
|
1041
|
-
core.$ZodSet.init(inst, def);
|
|
1042
|
-
ZodMiniType.init(inst, def);
|
|
1043
|
-
});
|
|
1044
|
-
|
|
1045
|
-
export function set<Value extends SomeType>(valueType: Value, params?: string | core.$ZodSetParams): ZodMiniSet<Value> {
|
|
1046
|
-
return new ZodMiniSet({
|
|
1047
|
-
type: "set",
|
|
1048
|
-
valueType,
|
|
1049
|
-
...util.normalizeParams(params),
|
|
1050
|
-
}) as ZodMiniSet<Value>;
|
|
1051
|
-
}
|
|
1052
|
-
|
|
1053
|
-
// ZodMiniEnum
|
|
1054
|
-
export interface ZodMiniEnum<T extends util.EnumLike = util.EnumLike> extends ZodMiniType {
|
|
1055
|
-
_zod: core.$ZodEnumInternals<T>;
|
|
1056
|
-
}
|
|
1057
|
-
export const ZodMiniEnum: core.$constructor<ZodMiniEnum> = /*@__PURE__*/ core.$constructor(
|
|
1058
|
-
"ZodMiniEnum",
|
|
1059
|
-
(inst, def) => {
|
|
1060
|
-
core.$ZodEnum.init(inst, def);
|
|
1061
|
-
ZodMiniType.init(inst, def);
|
|
1062
|
-
}
|
|
1063
|
-
);
|
|
1064
|
-
|
|
1065
|
-
function _enum<const T extends readonly string[]>(
|
|
1066
|
-
values: T,
|
|
1067
|
-
params?: string | core.$ZodEnumParams
|
|
1068
|
-
): ZodMiniEnum<util.ToEnum<T[number]>>;
|
|
1069
|
-
function _enum<T extends util.EnumLike>(entries: T, params?: string | core.$ZodEnumParams): ZodMiniEnum<T>;
|
|
1070
|
-
function _enum(values: any, params?: string | core.$ZodEnumParams) {
|
|
1071
|
-
const entries: any = Array.isArray(values) ? Object.fromEntries(values.map((v) => [v, v])) : values;
|
|
1072
|
-
|
|
1073
|
-
return new ZodMiniEnum({
|
|
1074
|
-
type: "enum",
|
|
1075
|
-
entries,
|
|
1076
|
-
...util.normalizeParams(params),
|
|
1077
|
-
}) as any;
|
|
1078
|
-
}
|
|
1079
|
-
export { _enum as enum };
|
|
1080
|
-
|
|
1081
|
-
/** @deprecated This API has been merged into `z.enum()`. Use `z.enum()` instead.
|
|
1082
|
-
*
|
|
1083
|
-
* ```ts
|
|
1084
|
-
* enum Colors { red, green, blue }
|
|
1085
|
-
* z.enum(Colors);
|
|
1086
|
-
* ```
|
|
1087
|
-
*/
|
|
1088
|
-
export function nativeEnum<T extends util.EnumLike>(entries: T, params?: string | core.$ZodEnumParams): ZodMiniEnum<T> {
|
|
1089
|
-
return new ZodMiniEnum({
|
|
1090
|
-
type: "enum",
|
|
1091
|
-
entries,
|
|
1092
|
-
...util.normalizeParams(params),
|
|
1093
|
-
}) as any as ZodMiniEnum<T>;
|
|
1094
|
-
}
|
|
1095
|
-
|
|
1096
|
-
// ZodMiniLiteral
|
|
1097
|
-
export interface ZodMiniLiteral<T extends util.Primitive = util.Primitive> extends ZodMiniType {
|
|
1098
|
-
_zod: core.$ZodLiteralInternals<T>;
|
|
1099
|
-
}
|
|
1100
|
-
export const ZodMiniLiteral: core.$constructor<ZodMiniLiteral> = /*@__PURE__*/ core.$constructor(
|
|
1101
|
-
"ZodMiniLiteral",
|
|
1102
|
-
(inst, def) => {
|
|
1103
|
-
core.$ZodLiteral.init(inst, def);
|
|
1104
|
-
ZodMiniType.init(inst, def);
|
|
1105
|
-
}
|
|
1106
|
-
);
|
|
1107
|
-
|
|
1108
|
-
export function literal<const T extends Array<util.Literal>>(
|
|
1109
|
-
value: T,
|
|
1110
|
-
params?: string | core.$ZodLiteralParams
|
|
1111
|
-
): ZodMiniLiteral<T[number]>;
|
|
1112
|
-
export function literal<const T extends util.Literal>(
|
|
1113
|
-
value: T,
|
|
1114
|
-
params?: string | core.$ZodLiteralParams
|
|
1115
|
-
): ZodMiniLiteral<T>;
|
|
1116
|
-
export function literal(value: any, params: any) {
|
|
1117
|
-
return new ZodMiniLiteral({
|
|
1118
|
-
type: "literal",
|
|
1119
|
-
values: Array.isArray(value) ? value : [value],
|
|
1120
|
-
...util.normalizeParams(params),
|
|
1121
|
-
});
|
|
1122
|
-
}
|
|
1123
|
-
|
|
1124
|
-
// ZodMiniFile
|
|
1125
|
-
export interface ZodMiniFile extends ZodMiniType {
|
|
1126
|
-
_zod: core.$ZodFileInternals;
|
|
1127
|
-
}
|
|
1128
|
-
export const ZodMiniFile: core.$constructor<ZodMiniFile> = /*@__PURE__*/ core.$constructor(
|
|
1129
|
-
"ZodMiniFile",
|
|
1130
|
-
(inst, def) => {
|
|
1131
|
-
core.$ZodFile.init(inst, def);
|
|
1132
|
-
ZodMiniType.init(inst, def);
|
|
1133
|
-
}
|
|
1134
|
-
);
|
|
1135
|
-
|
|
1136
|
-
export function file(params?: string | core.$ZodFileParams): ZodMiniFile {
|
|
1137
|
-
return core._file(ZodMiniFile, params) as any;
|
|
1138
|
-
}
|
|
1139
|
-
|
|
1140
|
-
// ZodMiniTransform
|
|
1141
|
-
export interface ZodMiniTransform<O = unknown, I = unknown> extends ZodMiniType {
|
|
1142
|
-
_zod: core.$ZodTransformInternals<O, I>;
|
|
1143
|
-
}
|
|
1144
|
-
export const ZodMiniTransform: core.$constructor<ZodMiniTransform> = /*@__PURE__*/ core.$constructor(
|
|
1145
|
-
"ZodMiniTransform",
|
|
1146
|
-
(inst, def) => {
|
|
1147
|
-
core.$ZodTransform.init(inst, def);
|
|
1148
|
-
ZodMiniType.init(inst, def);
|
|
1149
|
-
}
|
|
1150
|
-
);
|
|
1151
|
-
|
|
1152
|
-
export function transform<I = unknown, O = I>(
|
|
1153
|
-
fn: (input: I, ctx: core.ParsePayload) => O
|
|
1154
|
-
): ZodMiniTransform<Awaited<O>, I> {
|
|
1155
|
-
return new ZodMiniTransform({
|
|
1156
|
-
type: "transform",
|
|
1157
|
-
transform: fn as any,
|
|
1158
|
-
}) as any;
|
|
1159
|
-
}
|
|
1160
|
-
|
|
1161
|
-
// ZodMiniOptional
|
|
1162
|
-
export interface ZodMiniOptional<T extends SomeType = SomeType> extends ZodMiniType {
|
|
1163
|
-
_zod: core.$ZodOptionalInternals<T>;
|
|
1164
|
-
}
|
|
1165
|
-
export const ZodMiniOptional: core.$constructor<ZodMiniOptional> = /*@__PURE__*/ core.$constructor(
|
|
1166
|
-
"ZodMiniOptional",
|
|
1167
|
-
(inst, def) => {
|
|
1168
|
-
core.$ZodOptional.init(inst, def);
|
|
1169
|
-
ZodMiniType.init(inst, def);
|
|
1170
|
-
}
|
|
1171
|
-
);
|
|
1172
|
-
|
|
1173
|
-
export function optional<T extends SomeType>(innerType: T): ZodMiniOptional<T> {
|
|
1174
|
-
return new ZodMiniOptional({
|
|
1175
|
-
type: "optional",
|
|
1176
|
-
innerType,
|
|
1177
|
-
}) as ZodMiniOptional<T>;
|
|
1178
|
-
}
|
|
1179
|
-
|
|
1180
|
-
// ZodMiniNullable
|
|
1181
|
-
export interface ZodMiniNullable<T extends SomeType = SomeType> extends ZodMiniType {
|
|
1182
|
-
_zod: core.$ZodNullableInternals<T>;
|
|
1183
|
-
}
|
|
1184
|
-
export const ZodMiniNullable: core.$constructor<ZodMiniNullable> = /*@__PURE__*/ core.$constructor(
|
|
1185
|
-
"ZodMiniNullable",
|
|
1186
|
-
(inst, def) => {
|
|
1187
|
-
core.$ZodNullable.init(inst, def);
|
|
1188
|
-
ZodMiniType.init(inst, def);
|
|
1189
|
-
}
|
|
1190
|
-
);
|
|
1191
|
-
|
|
1192
|
-
export function nullable<T extends SomeType>(innerType: T): ZodMiniNullable<T> {
|
|
1193
|
-
return new ZodMiniNullable({
|
|
1194
|
-
type: "nullable",
|
|
1195
|
-
innerType,
|
|
1196
|
-
}) as ZodMiniNullable<T>;
|
|
1197
|
-
}
|
|
1198
|
-
|
|
1199
|
-
// nullish
|
|
1200
|
-
export function nullish<T extends SomeType>(innerType: T): ZodMiniOptional<ZodMiniNullable<T>> {
|
|
1201
|
-
return optional(nullable(innerType));
|
|
1202
|
-
}
|
|
1203
|
-
|
|
1204
|
-
// ZodMiniDefault
|
|
1205
|
-
export interface ZodMiniDefault<T extends SomeType = SomeType> extends ZodMiniType {
|
|
1206
|
-
_zod: core.$ZodDefaultInternals<T>;
|
|
1207
|
-
}
|
|
1208
|
-
export const ZodMiniDefault: core.$constructor<ZodMiniDefault> = /*@__PURE__*/ core.$constructor(
|
|
1209
|
-
"ZodMiniDefault",
|
|
1210
|
-
(inst, def) => {
|
|
1211
|
-
core.$ZodDefault.init(inst, def);
|
|
1212
|
-
ZodMiniType.init(inst, def);
|
|
1213
|
-
}
|
|
1214
|
-
);
|
|
1215
|
-
|
|
1216
|
-
export function _default<T extends SomeType>(
|
|
1217
|
-
innerType: T,
|
|
1218
|
-
defaultValue: util.NoUndefined<core.output<T>> | (() => util.NoUndefined<core.output<T>>)
|
|
1219
|
-
): ZodMiniDefault<T> {
|
|
1220
|
-
return new ZodMiniDefault({
|
|
1221
|
-
type: "default",
|
|
1222
|
-
innerType,
|
|
1223
|
-
get defaultValue() {
|
|
1224
|
-
return typeof defaultValue === "function" ? (defaultValue as Function)() : defaultValue;
|
|
1225
|
-
},
|
|
1226
|
-
}) as ZodMiniDefault<T>;
|
|
1227
|
-
}
|
|
1228
|
-
|
|
1229
|
-
// ZodMiniPrefault
|
|
1230
|
-
export interface ZodMiniPrefault<T extends SomeType = SomeType> extends ZodMiniType {
|
|
1231
|
-
_zod: core.$ZodPrefaultInternals<T>;
|
|
1232
|
-
}
|
|
1233
|
-
export const ZodMiniPrefault: core.$constructor<ZodMiniPrefault> = /*@__PURE__*/ core.$constructor(
|
|
1234
|
-
"ZodMiniPrefault",
|
|
1235
|
-
(inst, def) => {
|
|
1236
|
-
core.$ZodPrefault.init(inst, def);
|
|
1237
|
-
ZodMiniType.init(inst, def);
|
|
1238
|
-
}
|
|
1239
|
-
);
|
|
1240
|
-
export function prefault<T extends SomeType>(
|
|
1241
|
-
innerType: T,
|
|
1242
|
-
defaultValue: util.NoUndefined<core.input<T>> | (() => util.NoUndefined<core.input<T>>)
|
|
1243
|
-
): ZodMiniPrefault<T> {
|
|
1244
|
-
return new ZodMiniPrefault({
|
|
1245
|
-
type: "prefault",
|
|
1246
|
-
innerType,
|
|
1247
|
-
get defaultValue() {
|
|
1248
|
-
return typeof defaultValue === "function" ? (defaultValue as Function)() : defaultValue;
|
|
1249
|
-
},
|
|
1250
|
-
}) as ZodMiniPrefault<T>;
|
|
1251
|
-
}
|
|
1252
|
-
|
|
1253
|
-
// ZodMiniNonOptional
|
|
1254
|
-
export interface ZodMiniNonOptional<T extends SomeType = SomeType> extends ZodMiniType {
|
|
1255
|
-
_zod: core.$ZodNonOptionalInternals<T>;
|
|
1256
|
-
}
|
|
1257
|
-
export const ZodMiniNonOptional: core.$constructor<ZodMiniNonOptional> = /*@__PURE__*/ core.$constructor(
|
|
1258
|
-
"ZodMiniNonOptional",
|
|
1259
|
-
(inst, def) => {
|
|
1260
|
-
core.$ZodNonOptional.init(inst, def);
|
|
1261
|
-
ZodMiniType.init(inst, def);
|
|
1262
|
-
}
|
|
1263
|
-
);
|
|
1264
|
-
|
|
1265
|
-
export function nonoptional<T extends SomeType>(
|
|
1266
|
-
innerType: T,
|
|
1267
|
-
params?: string | core.$ZodNonOptionalParams
|
|
1268
|
-
): ZodMiniNonOptional<T> {
|
|
1269
|
-
return new ZodMiniNonOptional({
|
|
1270
|
-
type: "nonoptional",
|
|
1271
|
-
innerType,
|
|
1272
|
-
...util.normalizeParams(params),
|
|
1273
|
-
}) as ZodMiniNonOptional<T>;
|
|
1274
|
-
}
|
|
1275
|
-
|
|
1276
|
-
// ZodMiniSuccess
|
|
1277
|
-
export interface ZodMiniSuccess<T extends SomeType = SomeType> extends ZodMiniType {
|
|
1278
|
-
_zod: core.$ZodSuccessInternals<T>;
|
|
1279
|
-
}
|
|
1280
|
-
export const ZodMiniSuccess: core.$constructor<ZodMiniSuccess> = /*@__PURE__*/ core.$constructor(
|
|
1281
|
-
"ZodMiniSuccess",
|
|
1282
|
-
(inst, def) => {
|
|
1283
|
-
core.$ZodSuccess.init(inst, def);
|
|
1284
|
-
ZodMiniType.init(inst, def);
|
|
1285
|
-
}
|
|
1286
|
-
);
|
|
1287
|
-
|
|
1288
|
-
export function success<T extends SomeType>(innerType: T): ZodMiniSuccess<T> {
|
|
1289
|
-
return new ZodMiniSuccess({
|
|
1290
|
-
type: "success",
|
|
1291
|
-
innerType,
|
|
1292
|
-
}) as ZodMiniSuccess<T>;
|
|
1293
|
-
}
|
|
1294
|
-
|
|
1295
|
-
// ZodMiniCatch
|
|
1296
|
-
export interface ZodMiniCatch<T extends SomeType = SomeType> extends ZodMiniType {
|
|
1297
|
-
_zod: core.$ZodCatchInternals<T>;
|
|
1298
|
-
}
|
|
1299
|
-
export const ZodMiniCatch: core.$constructor<ZodMiniCatch> = /*@__PURE__*/ core.$constructor(
|
|
1300
|
-
"ZodMiniCatch",
|
|
1301
|
-
(inst, def) => {
|
|
1302
|
-
core.$ZodCatch.init(inst, def);
|
|
1303
|
-
ZodMiniType.init(inst, def);
|
|
1304
|
-
}
|
|
1305
|
-
);
|
|
1306
|
-
|
|
1307
|
-
function _catch<T extends SomeType>(
|
|
1308
|
-
innerType: T,
|
|
1309
|
-
catchValue: core.output<T> | ((ctx: core.$ZodCatchCtx) => core.output<T>)
|
|
1310
|
-
): ZodMiniCatch<T> {
|
|
1311
|
-
return new ZodMiniCatch({
|
|
1312
|
-
type: "catch",
|
|
1313
|
-
innerType,
|
|
1314
|
-
catchValue: (typeof catchValue === "function" ? catchValue : () => catchValue) as (
|
|
1315
|
-
ctx: core.$ZodCatchCtx
|
|
1316
|
-
) => core.output<T>,
|
|
1317
|
-
}) as ZodMiniCatch<T>;
|
|
1318
|
-
}
|
|
1319
|
-
export { _catch as catch };
|
|
1320
|
-
|
|
1321
|
-
// ZodMiniNaN
|
|
1322
|
-
export interface ZodMiniNaN extends ZodMiniType {
|
|
1323
|
-
_zod: core.$ZodNaNInternals;
|
|
1324
|
-
}
|
|
1325
|
-
export const ZodMiniNaN: core.$constructor<ZodMiniNaN> = /*@__PURE__*/ core.$constructor("ZodMiniNaN", (inst, def) => {
|
|
1326
|
-
core.$ZodNaN.init(inst, def);
|
|
1327
|
-
ZodMiniType.init(inst, def);
|
|
1328
|
-
});
|
|
1329
|
-
|
|
1330
|
-
export function nan(params?: string | core.$ZodNaNParams): ZodMiniNaN {
|
|
1331
|
-
return core._nan(ZodMiniNaN, params) as any;
|
|
1332
|
-
}
|
|
1333
|
-
|
|
1334
|
-
// ZodMiniPipe
|
|
1335
|
-
export interface ZodMiniPipe<A extends SomeType = SomeType, B extends SomeType = SomeType> extends ZodMiniType {
|
|
1336
|
-
_zod: core.$ZodPipeInternals<A, B>;
|
|
1337
|
-
}
|
|
1338
|
-
export const ZodMiniPipe: core.$constructor<ZodMiniPipe> = /*@__PURE__*/ core.$constructor(
|
|
1339
|
-
"ZodMiniPipe",
|
|
1340
|
-
(inst, def) => {
|
|
1341
|
-
core.$ZodPipe.init(inst, def);
|
|
1342
|
-
ZodMiniType.init(inst, def);
|
|
1343
|
-
}
|
|
1344
|
-
);
|
|
1345
|
-
|
|
1346
|
-
export function pipe<
|
|
1347
|
-
const A extends core.$ZodType,
|
|
1348
|
-
B extends core.$ZodType<unknown, core.output<A>> = core.$ZodType<unknown, core.output<A>>,
|
|
1349
|
-
>(in_: A, out: B | core.$ZodType<unknown, core.output<A>>, params?: string | core.$ZodPipeParams): ZodMiniPipe<A, B>;
|
|
1350
|
-
export function pipe(in_: core.$ZodType, out: core.$ZodType) {
|
|
1351
|
-
return new ZodMiniPipe({
|
|
1352
|
-
type: "pipe",
|
|
1353
|
-
in: in_,
|
|
1354
|
-
out,
|
|
1355
|
-
});
|
|
1356
|
-
}
|
|
1357
|
-
|
|
1358
|
-
// /** @deprecated Use `z.pipe()` and `z.transform()` instead. */
|
|
1359
|
-
// export function preprocess<A, U extends core.$ZodType>(
|
|
1360
|
-
// fn: (arg: unknown, ctx: core.ParsePayload) => A,
|
|
1361
|
-
// schema: U,
|
|
1362
|
-
// params?: ZodPreprocessParams
|
|
1363
|
-
// ): ZodPipe<ZodTransform<A, unknown>, U> {
|
|
1364
|
-
// return pipe(transform(fn as any, params), schema as any, params);
|
|
1365
|
-
// }
|
|
1366
|
-
|
|
1367
|
-
// ZodMiniReadonly
|
|
1368
|
-
export interface ZodMiniReadonly<T extends SomeType = SomeType> extends ZodMiniType {
|
|
1369
|
-
_zod: core.$ZodReadonlyInternals<T>;
|
|
1370
|
-
}
|
|
1371
|
-
export const ZodMiniReadonly: core.$constructor<ZodMiniReadonly> = /*@__PURE__*/ core.$constructor(
|
|
1372
|
-
"ZodMiniReadonly",
|
|
1373
|
-
(inst, def) => {
|
|
1374
|
-
core.$ZodReadonly.init(inst, def);
|
|
1375
|
-
ZodMiniType.init(inst, def);
|
|
1376
|
-
}
|
|
1377
|
-
);
|
|
1378
|
-
|
|
1379
|
-
export function readonly<T extends SomeType>(innerType: T): ZodMiniReadonly<T> {
|
|
1380
|
-
return new ZodMiniReadonly({
|
|
1381
|
-
type: "readonly",
|
|
1382
|
-
innerType,
|
|
1383
|
-
}) as ZodMiniReadonly<T>;
|
|
1384
|
-
}
|
|
1385
|
-
|
|
1386
|
-
// ZodMiniTemplateLiteral
|
|
1387
|
-
export interface ZodMiniTemplateLiteral<Template extends string = string> extends ZodMiniType {
|
|
1388
|
-
_zod: core.$ZodTemplateLiteralInternals<Template>;
|
|
1389
|
-
}
|
|
1390
|
-
export const ZodMiniTemplateLiteral: core.$constructor<ZodMiniTemplateLiteral> = /*@__PURE__*/ core.$constructor(
|
|
1391
|
-
"ZodMiniTemplateLiteral",
|
|
1392
|
-
(inst, def) => {
|
|
1393
|
-
core.$ZodTemplateLiteral.init(inst, def);
|
|
1394
|
-
ZodMiniType.init(inst, def);
|
|
1395
|
-
}
|
|
1396
|
-
);
|
|
1397
|
-
|
|
1398
|
-
export function templateLiteral<const Parts extends core.$ZodTemplateLiteralPart[]>(
|
|
1399
|
-
parts: Parts,
|
|
1400
|
-
params?: string | core.$ZodTemplateLiteralParams
|
|
1401
|
-
): ZodMiniTemplateLiteral<core.$PartsToTemplateLiteral<Parts>> {
|
|
1402
|
-
return new ZodMiniTemplateLiteral({
|
|
1403
|
-
type: "template_literal",
|
|
1404
|
-
parts,
|
|
1405
|
-
...util.normalizeParams(params),
|
|
1406
|
-
}) as any;
|
|
1407
|
-
}
|
|
1408
|
-
|
|
1409
|
-
// ZodMiniLazy
|
|
1410
|
-
export interface ZodMiniLazy<T extends SomeType = SomeType> extends ZodMiniType {
|
|
1411
|
-
_zod: core.$ZodLazyInternals<T>;
|
|
1412
|
-
}
|
|
1413
|
-
export const ZodMiniLazy: core.$constructor<ZodMiniLazy> = /*@__PURE__*/ core.$constructor(
|
|
1414
|
-
"ZodMiniLazy",
|
|
1415
|
-
(inst, def) => {
|
|
1416
|
-
core.$ZodLazy.init(inst, def);
|
|
1417
|
-
ZodMiniType.init(inst, def);
|
|
1418
|
-
}
|
|
1419
|
-
);
|
|
1420
|
-
|
|
1421
|
-
// export function lazy<T extends object>(getter: () => T): T {
|
|
1422
|
-
// return util.createTransparentProxy<T>(getter);
|
|
1423
|
-
// }
|
|
1424
|
-
function _lazy<T extends SomeType>(getter: () => T): ZodMiniLazy<T> {
|
|
1425
|
-
return new ZodMiniLazy({
|
|
1426
|
-
type: "lazy",
|
|
1427
|
-
getter,
|
|
1428
|
-
}) as ZodMiniLazy<T>;
|
|
1429
|
-
}
|
|
1430
|
-
export { _lazy as lazy };
|
|
1431
|
-
|
|
1432
|
-
// ZodMiniPromise
|
|
1433
|
-
export interface ZodMiniPromise<T extends SomeType = SomeType> extends ZodMiniType {
|
|
1434
|
-
_zod: core.$ZodPromiseInternals<T>;
|
|
1435
|
-
}
|
|
1436
|
-
export const ZodMiniPromise: core.$constructor<ZodMiniPromise> = /*@__PURE__*/ core.$constructor(
|
|
1437
|
-
"ZodMiniPromise",
|
|
1438
|
-
(inst, def) => {
|
|
1439
|
-
core.$ZodPromise.init(inst, def);
|
|
1440
|
-
ZodMiniType.init(inst, def);
|
|
1441
|
-
}
|
|
1442
|
-
);
|
|
1443
|
-
|
|
1444
|
-
export function promise<T extends SomeType>(innerType: T): ZodMiniPromise<T> {
|
|
1445
|
-
return new ZodMiniPromise({
|
|
1446
|
-
type: "promise",
|
|
1447
|
-
innerType,
|
|
1448
|
-
}) as ZodMiniPromise<T>;
|
|
1449
|
-
}
|
|
1450
|
-
|
|
1451
|
-
// ZodMiniCustom
|
|
1452
|
-
export interface ZodMiniCustom<O = unknown, I = unknown> extends ZodMiniType {
|
|
1453
|
-
_zod: core.$ZodCustomInternals<O, I>;
|
|
1454
|
-
}
|
|
1455
|
-
export const ZodMiniCustom: core.$constructor<ZodMiniCustom> = /*@__PURE__*/ core.$constructor(
|
|
1456
|
-
"ZodMiniCustom",
|
|
1457
|
-
(inst, def) => {
|
|
1458
|
-
core.$ZodCustom.init(inst, def);
|
|
1459
|
-
ZodMiniType.init(inst, def);
|
|
1460
|
-
}
|
|
1461
|
-
);
|
|
1462
|
-
|
|
1463
|
-
// custom checks
|
|
1464
|
-
export function check<O = unknown>(fn: core.CheckFn<O>, params?: string | core.$ZodCustomParams): core.$ZodCheck<O> {
|
|
1465
|
-
const ch = new core.$ZodCheck({
|
|
1466
|
-
check: "custom",
|
|
1467
|
-
...util.normalizeParams(params),
|
|
1468
|
-
});
|
|
1469
|
-
|
|
1470
|
-
ch._zod.check = fn;
|
|
1471
|
-
return ch;
|
|
1472
|
-
}
|
|
1473
|
-
|
|
1474
|
-
// ZodCustom
|
|
1475
|
-
function _custom<O = unknown, I = O>(
|
|
1476
|
-
fn: (data: O) => unknown,
|
|
1477
|
-
_params: string | core.$ZodCustomParams | undefined,
|
|
1478
|
-
Class: util.Constructor<ZodMiniCustom, [core.$ZodCustomDef]>
|
|
1479
|
-
): ZodMiniCustom<O, I> {
|
|
1480
|
-
const params = util.normalizeParams(_params);
|
|
1481
|
-
const schema = new Class({
|
|
1482
|
-
type: "custom",
|
|
1483
|
-
check: "custom",
|
|
1484
|
-
fn: fn as any,
|
|
1485
|
-
...params,
|
|
1486
|
-
});
|
|
1487
|
-
|
|
1488
|
-
return schema as any;
|
|
1489
|
-
}
|
|
1490
|
-
|
|
1491
|
-
// refine
|
|
1492
|
-
export function refine<T>(
|
|
1493
|
-
fn: (arg: NoInfer<T>) => util.MaybeAsync<unknown>,
|
|
1494
|
-
_params: string | core.$ZodCustomParams = {}
|
|
1495
|
-
): core.$ZodCheck<T> {
|
|
1496
|
-
return _custom(fn, _params, ZodMiniCustom);
|
|
1497
|
-
}
|
|
1498
|
-
|
|
1499
|
-
// custom schema
|
|
1500
|
-
export function custom<O = unknown, I = O>(
|
|
1501
|
-
fn?: (data: O) => unknown,
|
|
1502
|
-
_params?: string | core.$ZodCustomParams | undefined
|
|
1503
|
-
): ZodMiniCustom<O, I> {
|
|
1504
|
-
return _custom(fn ?? (() => true), _params, ZodMiniCustom);
|
|
1505
|
-
}
|
|
1506
|
-
|
|
1507
|
-
// instanceof
|
|
1508
|
-
abstract class Class {
|
|
1509
|
-
constructor(..._args: any[]) {}
|
|
1510
|
-
}
|
|
1511
|
-
function _instanceof<T extends typeof Class>(
|
|
1512
|
-
cls: T,
|
|
1513
|
-
params: core.$ZodCustomParams = {
|
|
1514
|
-
error: `Input not instance of ${cls.name}`,
|
|
1515
|
-
}
|
|
1516
|
-
): ZodMiniCustom<InstanceType<T>> {
|
|
1517
|
-
const inst = custom((data) => data instanceof cls, params);
|
|
1518
|
-
inst._zod.bag.Class = cls;
|
|
1519
|
-
return inst as any;
|
|
1520
|
-
}
|
|
1521
|
-
export { _instanceof as instanceof };
|
|
1522
|
-
|
|
1523
|
-
// stringbool
|
|
1524
|
-
export const stringbool: (
|
|
1525
|
-
_params?: string | core.$ZodStringBoolParams
|
|
1526
|
-
) => ZodMiniPipe<ZodMiniUnknown, ZodMiniBoolean<boolean>> = /* @__PURE__ */ core._stringbool.bind(null, {
|
|
1527
|
-
Pipe: ZodMiniPipe,
|
|
1528
|
-
Boolean: ZodMiniBoolean,
|
|
1529
|
-
Unknown: ZodMiniUnknown,
|
|
1530
|
-
}) as any;
|
|
1531
|
-
|
|
1532
|
-
// json
|
|
1533
|
-
export type ZodMiniJSONSchema = ZodMiniLazy<
|
|
1534
|
-
ZodMiniUnion<
|
|
1535
|
-
[
|
|
1536
|
-
ZodMiniString<string>,
|
|
1537
|
-
ZodMiniNumber<number>,
|
|
1538
|
-
ZodMiniBoolean<boolean>,
|
|
1539
|
-
ZodMiniNull,
|
|
1540
|
-
ZodMiniArray<ZodMiniJSONSchema>,
|
|
1541
|
-
ZodMiniRecord<ZodMiniString<string>, ZodMiniJSONSchema>,
|
|
1542
|
-
]
|
|
1543
|
-
>
|
|
1544
|
-
> & {
|
|
1545
|
-
_zod: {
|
|
1546
|
-
input: util.JSONType;
|
|
1547
|
-
output: util.JSONType;
|
|
1548
|
-
};
|
|
1549
|
-
};
|
|
1550
|
-
|
|
1551
|
-
export function json(): ZodMiniJSONSchema {
|
|
1552
|
-
const jsonSchema: ZodMiniJSONSchema = _lazy(() => {
|
|
1553
|
-
return union([string(), number(), boolean(), _null(), array(jsonSchema), record(string(), jsonSchema)]);
|
|
1554
|
-
}) as ZodMiniJSONSchema;
|
|
1555
|
-
return jsonSchema;
|
|
1556
|
-
}
|