@es-joy/jsoe 0.24.3 → 0.25.1
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/.claude/settings.local.json +9 -0
- package/.ncurc.cjs +2 -2
- package/CHANGES.md +51 -0
- package/README.md +23 -13
- package/badges/coverage-badge.svg +1 -1
- package/dist/eslint.config.d.ts +3 -0
- package/dist/eslint.config.d.ts.map +1 -0
- package/dist/formatAndTypeChoices.d.ts +28 -30
- package/dist/formatAndTypeChoices.d.ts.map +1 -1
- package/dist/formats/indexedDBKey.d.ts.map +1 -1
- package/dist/formats/schema.d.ts +46 -3
- package/dist/formats/schema.d.ts.map +1 -1
- package/dist/formats/structuredCloning.d.ts +3 -0
- package/dist/formats/structuredCloning.d.ts.map +1 -1
- package/dist/formats.d.ts +24 -6
- package/dist/formats.d.ts.map +1 -1
- package/dist/fundamentalTypes/BooleanObjectType.d.ts.map +1 -1
- package/dist/fundamentalTypes/NumberObjectType.d.ts.map +1 -1
- package/dist/fundamentalTypes/StringObjectType.d.ts.map +1 -1
- package/dist/fundamentalTypes/arrayReferenceType.d.ts.map +1 -1
- package/dist/fundamentalTypes/arrayType.d.ts +7 -0
- package/dist/fundamentalTypes/arrayType.d.ts.map +1 -1
- package/dist/fundamentalTypes/bigintObjectType.d.ts.map +1 -1
- package/dist/fundamentalTypes/bigintType.d.ts +10 -0
- package/dist/fundamentalTypes/bigintType.d.ts.map +1 -1
- package/dist/fundamentalTypes/blobType.d.ts.map +1 -1
- package/dist/fundamentalTypes/booleanType.d.ts.map +1 -1
- package/dist/fundamentalTypes/catchType.d.ts +2 -2
- package/dist/fundamentalTypes/catchType.d.ts.map +1 -1
- package/dist/fundamentalTypes/dateType.d.ts.map +1 -1
- package/dist/fundamentalTypes/domexceptionType.d.ts.map +1 -1
- package/dist/fundamentalTypes/enumType.d.ts +2 -2
- package/dist/fundamentalTypes/enumType.d.ts.map +1 -1
- package/dist/fundamentalTypes/errorType.d.ts.map +1 -1
- package/dist/fundamentalTypes/fileType.d.ts +6 -0
- package/dist/fundamentalTypes/fileType.d.ts.map +1 -1
- package/dist/fundamentalTypes/functionType.d.ts.map +1 -1
- package/dist/fundamentalTypes/literalType.d.ts +3 -2
- package/dist/fundamentalTypes/literalType.d.ts.map +1 -1
- package/dist/fundamentalTypes/looseRecordType.d.ts +6 -0
- package/dist/fundamentalTypes/looseRecordType.d.ts.map +1 -0
- package/dist/fundamentalTypes/nanType.d.ts.map +1 -1
- package/dist/fundamentalTypes/neverType.d.ts +2 -2
- package/dist/fundamentalTypes/neverType.d.ts.map +1 -1
- package/dist/fundamentalTypes/noneditableType.d.ts.map +1 -1
- package/dist/fundamentalTypes/nullType.d.ts.map +1 -1
- package/dist/fundamentalTypes/numberType.d.ts.map +1 -1
- package/dist/fundamentalTypes/promiseType.d.ts.map +1 -1
- package/dist/fundamentalTypes/regexpType.d.ts.map +1 -1
- package/dist/fundamentalTypes/stringType.d.ts.map +1 -1
- package/dist/fundamentalTypes/symbolType.d.ts.map +1 -1
- package/dist/fundamentalTypes/undefinedType.d.ts.map +1 -1
- package/dist/fundamentalTypes/voidType.d.ts +2 -2
- package/dist/fundamentalTypes/voidType.d.ts.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -1
- package/dist/index.js.map +1 -1
- package/dist/rollup.config.d.ts +30 -0
- package/dist/rollup.config.d.ts.map +1 -0
- package/dist/server.d.ts +2 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/src/formatAndTypeChoices.d.ts +108 -0
- package/dist/src/formatAndTypeChoices.d.ts.map +1 -0
- package/dist/src/formats/arbitraryJS.d.ts +4 -0
- package/dist/src/formats/arbitraryJS.d.ts.map +1 -0
- package/dist/src/formats/indexedDBKey.d.ts +4 -0
- package/dist/src/formats/indexedDBKey.d.ts.map +1 -0
- package/dist/src/formats/json.d.ts +4 -0
- package/dist/src/formats/json.d.ts.map +1 -0
- package/dist/src/formats/schema.d.ts +17 -0
- package/dist/src/formats/schema.d.ts.map +1 -0
- package/dist/src/formats/structuredCloning.d.ts +19 -0
- package/dist/src/formats/structuredCloning.d.ts.map +1 -0
- package/dist/src/formats.d.ts +135 -0
- package/dist/src/formats.d.ts.map +1 -0
- package/dist/src/fundamentalTypes/BooleanObjectType.d.ts +8 -0
- package/dist/src/fundamentalTypes/BooleanObjectType.d.ts.map +1 -0
- package/dist/src/fundamentalTypes/NumberObjectType.d.ts +6 -0
- package/dist/src/fundamentalTypes/NumberObjectType.d.ts.map +1 -0
- package/dist/src/fundamentalTypes/StringObjectType.d.ts +6 -0
- package/dist/src/fundamentalTypes/StringObjectType.d.ts.map +1 -0
- package/dist/src/fundamentalTypes/arrayReferenceType.d.ts +8 -0
- package/dist/src/fundamentalTypes/arrayReferenceType.d.ts.map +1 -0
- package/dist/src/fundamentalTypes/arrayType.d.ts +29 -0
- package/dist/src/fundamentalTypes/arrayType.d.ts.map +1 -0
- package/dist/src/fundamentalTypes/bigintObjectType.d.ts +6 -0
- package/dist/src/fundamentalTypes/bigintObjectType.d.ts.map +1 -0
- package/dist/src/fundamentalTypes/bigintType.d.ts +6 -0
- package/dist/src/fundamentalTypes/bigintType.d.ts.map +1 -0
- package/dist/src/fundamentalTypes/blobType.d.ts +11 -0
- package/dist/src/fundamentalTypes/blobType.d.ts.map +1 -0
- package/dist/src/fundamentalTypes/booleanType.d.ts +8 -0
- package/dist/src/fundamentalTypes/booleanType.d.ts.map +1 -0
- package/dist/src/fundamentalTypes/catchType.d.ts +6 -0
- package/dist/src/fundamentalTypes/catchType.d.ts.map +1 -0
- package/dist/src/fundamentalTypes/dateType.d.ts +26 -0
- package/dist/src/fundamentalTypes/dateType.d.ts.map +1 -0
- package/dist/src/fundamentalTypes/domexceptionType.d.ts +6 -0
- package/dist/src/fundamentalTypes/domexceptionType.d.ts.map +1 -0
- package/dist/src/fundamentalTypes/enumType.d.ts +6 -0
- package/dist/src/fundamentalTypes/enumType.d.ts.map +1 -0
- package/dist/src/fundamentalTypes/errorType.d.ts +6 -0
- package/dist/src/fundamentalTypes/errorType.d.ts.map +1 -0
- package/dist/src/fundamentalTypes/fileType.d.ts +13 -0
- package/dist/src/fundamentalTypes/fileType.d.ts.map +1 -0
- package/dist/src/fundamentalTypes/filelistType.d.ts +6 -0
- package/dist/src/fundamentalTypes/filelistType.d.ts.map +1 -0
- package/dist/src/fundamentalTypes/functionType.d.ts +7 -0
- package/dist/src/fundamentalTypes/functionType.d.ts.map +1 -0
- package/dist/src/fundamentalTypes/literalType.d.ts +6 -0
- package/dist/src/fundamentalTypes/literalType.d.ts.map +1 -0
- package/dist/src/fundamentalTypes/mapType.d.ts +6 -0
- package/dist/src/fundamentalTypes/mapType.d.ts.map +1 -0
- package/dist/src/fundamentalTypes/nanType.d.ts +6 -0
- package/dist/src/fundamentalTypes/nanType.d.ts.map +1 -0
- package/dist/src/fundamentalTypes/neverType.d.ts +6 -0
- package/dist/src/fundamentalTypes/neverType.d.ts.map +1 -0
- package/dist/src/fundamentalTypes/noneditableType.d.ts +6 -0
- package/dist/src/fundamentalTypes/noneditableType.d.ts.map +1 -0
- package/dist/src/fundamentalTypes/nullType.d.ts +6 -0
- package/dist/src/fundamentalTypes/nullType.d.ts.map +1 -0
- package/dist/src/fundamentalTypes/numberType.d.ts +6 -0
- package/dist/src/fundamentalTypes/numberType.d.ts.map +1 -0
- package/dist/src/fundamentalTypes/objectReferenceType.d.ts +8 -0
- package/dist/src/fundamentalTypes/objectReferenceType.d.ts.map +1 -0
- package/dist/src/fundamentalTypes/objectType.d.ts +6 -0
- package/dist/src/fundamentalTypes/objectType.d.ts.map +1 -0
- package/dist/src/fundamentalTypes/promiseType.d.ts +6 -0
- package/dist/src/fundamentalTypes/promiseType.d.ts.map +1 -0
- package/dist/src/fundamentalTypes/recordType.d.ts +6 -0
- package/dist/src/fundamentalTypes/recordType.d.ts.map +1 -0
- package/dist/src/fundamentalTypes/regexpType.d.ts +8 -0
- package/dist/src/fundamentalTypes/regexpType.d.ts.map +1 -0
- package/dist/src/fundamentalTypes/setType.d.ts +6 -0
- package/dist/src/fundamentalTypes/setType.d.ts.map +1 -0
- package/dist/src/fundamentalTypes/sparseUndefinedType.d.ts +6 -0
- package/dist/src/fundamentalTypes/sparseUndefinedType.d.ts.map +1 -0
- package/dist/src/fundamentalTypes/stringType.d.ts +6 -0
- package/dist/src/fundamentalTypes/stringType.d.ts.map +1 -0
- package/dist/src/fundamentalTypes/symbolType.d.ts +8 -0
- package/dist/src/fundamentalTypes/symbolType.d.ts.map +1 -0
- package/dist/src/fundamentalTypes/tupleType.d.ts +6 -0
- package/dist/src/fundamentalTypes/tupleType.d.ts.map +1 -0
- package/dist/src/fundamentalTypes/undefinedType.d.ts +6 -0
- package/dist/src/fundamentalTypes/undefinedType.d.ts.map +1 -0
- package/dist/src/fundamentalTypes/voidType.d.ts +6 -0
- package/dist/src/fundamentalTypes/voidType.d.ts.map +1 -0
- package/dist/src/index.d.ts +12 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/subTypes/blobHTMLType.d.ts +20 -0
- package/dist/src/subTypes/blobHTMLType.d.ts.map +1 -0
- package/dist/src/subTypes/falseType.d.ts +8 -0
- package/dist/src/subTypes/falseType.d.ts.map +1 -0
- package/dist/src/subTypes/trueType.d.ts +8 -0
- package/dist/src/subTypes/trueType.d.ts.map +1 -0
- package/dist/src/superTypes/SpecialNumberType.d.ts +6 -0
- package/dist/src/superTypes/SpecialNumberType.d.ts.map +1 -0
- package/dist/src/superTypes/SpecialRealNumberType.d.ts +6 -0
- package/dist/src/superTypes/SpecialRealNumberType.d.ts.map +1 -0
- package/dist/src/superTypes/buffersourceType.d.ts +8 -0
- package/dist/src/superTypes/buffersourceType.d.ts.map +1 -0
- package/dist/src/superTypes/dommatrixType.d.ts +6 -0
- package/dist/src/superTypes/dommatrixType.d.ts.map +1 -0
- package/dist/src/superTypes/dompointType.d.ts +6 -0
- package/dist/src/superTypes/dompointType.d.ts.map +1 -0
- package/dist/src/superTypes/domrectType.d.ts +6 -0
- package/dist/src/superTypes/domrectType.d.ts.map +1 -0
- package/dist/src/superTypes/errorsSpecialType.d.ts +8 -0
- package/dist/src/superTypes/errorsSpecialType.d.ts.map +1 -0
- package/dist/src/typeChoices.d.ts +140 -0
- package/dist/src/typeChoices.d.ts.map +1 -0
- package/dist/src/types.d.ts +758 -0
- package/dist/src/types.d.ts.map +1 -0
- package/dist/src/utils/FileList.d.ts +26 -0
- package/dist/src/utils/FileList.d.ts.map +1 -0
- package/dist/src/utils/dialogs.d.ts +111 -0
- package/dist/src/utils/dialogs.d.ts.map +1 -0
- package/dist/src/utils/jsonPointer.d.ts +46 -0
- package/dist/src/utils/jsonPointer.d.ts.map +1 -0
- package/dist/src/utils/media.d.ts +18 -0
- package/dist/src/utils/media.d.ts.map +1 -0
- package/dist/src/utils/objects.d.ts +16 -0
- package/dist/src/utils/objects.d.ts.map +1 -0
- package/dist/src/utils/templateUtils.d.ts +59 -0
- package/dist/src/utils/templateUtils.d.ts.map +1 -0
- package/dist/src/utils/types.d.ts +2 -0
- package/dist/src/utils/types.d.ts.map +1 -0
- package/dist/src/vendor-imports.d.ts +4 -0
- package/dist/src/vendor-imports.d.ts.map +1 -0
- package/dist/subTypes/blobHTMLType.d.ts.map +1 -1
- package/dist/superTypes/SpecialRealNumberType.d.ts.map +1 -1
- package/dist/superTypes/buffersourceType.d.ts.map +1 -1
- package/dist/superTypes/dommatrixType.d.ts.map +1 -1
- package/dist/superTypes/dompointType.d.ts.map +1 -1
- package/dist/superTypes/domrectType.d.ts.map +1 -1
- package/dist/superTypes/errorsSpecialType.d.ts.map +1 -1
- package/dist/typeChoices.d.ts +21 -87
- package/dist/typeChoices.d.ts.map +1 -1
- package/dist/types.d.ts +90 -64
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/FileList.d.ts +4 -3
- package/dist/utils/FileList.d.ts.map +1 -1
- package/dist/utils/dialogs.d.ts +4 -4
- package/dist/utils/dialogs.d.ts.map +1 -1
- package/dist/utils/media.d.ts.map +1 -1
- package/dist/utils/schemaMeta.d.ts +92 -0
- package/dist/utils/schemaMeta.d.ts.map +1 -0
- package/dist/utils/templateUtils.d.ts +3 -3
- package/dist/utils/templateUtils.d.ts.map +1 -1
- package/dist/utils/timing.d.ts +2 -0
- package/dist/utils/timing.d.ts.map +1 -0
- package/dist/utils/types.d.ts +1 -0
- package/dist/utils/types.d.ts.map +1 -1
- package/dist/vendor-imports.d.ts +3 -1
- package/docs/proposals/schema-meta.md +233 -0
- package/eslint.config.js +51 -4
- package/licenseInfo.json +1 -1
- package/package.json +52 -42
- package/pnpm-workspace.yaml +57 -0
- package/rollup.config.js +20 -18
- package/server.js +3 -3
- package/src/deepEqual.js.map +1 -1
- package/src/formatAndTypeChoices.js +62 -58
- package/src/formats/indexedDBKey.js +3 -4
- package/src/formats/schema.js +824 -475
- package/src/formats/structuredCloning.js +189 -79
- package/src/formats.js +17 -5
- package/src/fundamentalTypes/BooleanObjectType.js +4 -5
- package/src/fundamentalTypes/NumberObjectType.js +4 -4
- package/src/fundamentalTypes/StringObjectType.js +3 -4
- package/src/fundamentalTypes/arrayReferenceType.js +0 -2
- package/src/fundamentalTypes/arrayType.js +624 -389
- package/src/fundamentalTypes/bigintObjectType.js +3 -2
- package/src/fundamentalTypes/bigintType.js +79 -17
- package/src/fundamentalTypes/blobType.js +35 -35
- package/src/fundamentalTypes/booleanType.js +16 -8
- package/src/fundamentalTypes/dateType.js +6 -8
- package/src/fundamentalTypes/domexceptionType.js +5 -4
- package/src/fundamentalTypes/errorType.js +39 -32
- package/src/fundamentalTypes/fileType.js +238 -52
- package/src/fundamentalTypes/functionType.js +61 -41
- package/src/fundamentalTypes/nanType.js +5 -4
- package/src/fundamentalTypes/noneditableType.js +4 -3
- package/src/fundamentalTypes/nullType.js +3 -2
- package/src/fundamentalTypes/numberType.js +72 -20
- package/src/fundamentalTypes/promiseType.js +16 -40
- package/src/fundamentalTypes/regexpType.js +7 -13
- package/src/fundamentalTypes/stringType.js +176 -110
- package/src/fundamentalTypes/symbolType.js +3 -2
- package/src/fundamentalTypes/undefinedType.js +3 -2
- package/src/index.js +6 -5
- package/src/jsoe.css +107 -8
- package/src/subTypes/blobHTMLType.js +23 -10
- package/src/superTypes/SpecialNumberType.js +6 -6
- package/src/superTypes/SpecialRealNumberType.js +10 -9
- package/src/superTypes/buffersourceType.js +86 -75
- package/src/superTypes/dommatrixType.js +6 -5
- package/src/superTypes/dompointType.js +6 -5
- package/src/superTypes/domrectType.js +6 -5
- package/src/superTypes/errorsSpecialType.js +54 -35
- package/src/typeChoices.js +399 -54
- package/src/types.js +157 -97
- package/src/utils/FileList.js +3 -3
- package/src/utils/dialogs.js +5 -7
- package/src/utils/jsonPointer.js +1 -1
- package/src/utils/media.js +1 -0
- package/src/utils/schemaMeta.js +257 -0
- package/src/utils/templateUtils.js +3 -3
- package/src/utils/timing.js +12 -0
- package/src/utils/types.js +19 -0
- package/src/vendor-imports.js +10 -2
- package/tsconfig.json +2 -0
- package/vendor/acorn/dist/acorn.d.mts +46 -5
- package/vendor/acorn/dist/acorn.d.ts +46 -5
- package/vendor/acorn/dist/acorn.js +394 -117
- package/vendor/acorn/dist/acorn.mjs +394 -117
- package/vendor/acorn/dist/bin.js +1 -1
- package/vendor/jamilih/dist/{jml-es.js → jml.mjs} +590 -312
- package/vendor/jamilih/package.json +1 -1
- package/vendor/mime/dist/types/other.js +719 -0
- package/vendor/mime/dist/types/standard.js +366 -0
- package/vendor/typeson-registry/dist/index.js +519 -99
- package/vendor/zod/classic/checks.d.ts +1 -0
- package/vendor/zod/classic/checks.js +1 -0
- package/vendor/zod/classic/coerce.d.ts +17 -0
- package/vendor/zod/classic/coerce.js +17 -0
- package/vendor/zod/classic/compat.d.ts +48 -0
- package/vendor/zod/classic/compat.js +31 -0
- package/vendor/zod/classic/deep-partial.d.ts +14 -0
- package/vendor/zod/classic/deep-partial.js +13 -0
- package/vendor/zod/classic/errors.d.ts +29 -0
- package/vendor/zod/classic/errors.js +57 -0
- package/vendor/zod/classic/external.d.ts +19 -0
- package/vendor/zod/classic/external.js +17 -0
- package/vendor/zod/classic/from-json-schema.d.ts +12 -0
- package/vendor/zod/classic/from-json-schema.js +660 -0
- package/vendor/zod/classic/in-out.d.ts +8 -0
- package/vendor/zod/classic/in-out.js +36 -0
- package/vendor/zod/classic/index.d.ts +3 -0
- package/vendor/zod/classic/index.js +4 -0
- package/vendor/zod/classic/iso.d.ts +7 -0
- package/vendor/zod/classic/iso.js +15 -0
- package/vendor/zod/classic/package.json +7 -0
- package/vendor/zod/classic/parse.d.ts +44 -0
- package/vendor/zod/classic/parse.js +16 -0
- package/vendor/zod/classic/schemas.d.ts +802 -0
- package/vendor/zod/classic/schemas.js +1491 -0
- package/vendor/zod/core/api.d.ts +329 -0
- package/vendor/zod/core/api.js +1104 -0
- package/vendor/zod/core/checks.d.ts +278 -0
- package/vendor/zod/core/checks.js +581 -0
- package/vendor/zod/core/compile.d.ts +51 -0
- package/vendor/zod/core/compile.js +1783 -0
- package/vendor/zod/core/core.d.ts +82 -0
- package/vendor/zod/core/core.js +141 -0
- package/vendor/zod/core/doc.d.ts +16 -0
- package/vendor/zod/core/doc.js +33 -0
- package/vendor/zod/core/errors.d.ts +225 -0
- package/vendor/zod/core/errors.js +270 -0
- package/vendor/zod/core/index.d.ts +19 -0
- package/vendor/zod/core/index.js +19 -0
- package/vendor/zod/core/json-schema-generator.d.ts +65 -0
- package/vendor/zod/core/json-schema-generator.js +99 -0
- package/vendor/zod/core/json-schema-processors.d.ts +49 -0
- package/vendor/zod/core/json-schema-processors.js +747 -0
- package/vendor/zod/core/json-schema.d.ts +89 -0
- package/vendor/zod/core/memoizer.d.ts +15 -0
- package/vendor/zod/core/memoizer.js +265 -0
- package/vendor/zod/core/package.json +7 -0
- package/vendor/zod/core/parse.d.ts +52 -0
- package/vendor/zod/core/parse.js +154 -0
- package/vendor/zod/core/regexes.d.ts +87 -0
- package/vendor/zod/core/regexes.js +150 -0
- package/vendor/zod/core/registries.d.ts +35 -0
- package/vendor/zod/core/registries.js +51 -0
- package/vendor/zod/core/schemas.d.ts +1253 -0
- package/vendor/zod/core/schemas.js +2440 -0
- package/vendor/zod/core/standard-schema.d.ts +126 -0
- package/vendor/zod/core/to-json-schema.d.ts +153 -0
- package/vendor/zod/core/to-json-schema.js +650 -0
- package/vendor/zod/core/util.d.ts +257 -0
- package/vendor/zod/core/util.js +846 -0
- package/vendor/zod/core/versions.d.ts +5 -0
- package/vendor/zod/core/versions.js +5 -0
- package/vendor/zod/core/visit.d.ts +30 -0
- package/vendor/zod/core/visit.js +169 -0
- package/vendor/zod/index.d.ts +3 -0
- package/vendor/zod/index.js +4 -0
- package/vendor/zod/locales/ar.d.ts +4 -0
- package/vendor/zod/locales/ar.js +109 -0
- package/vendor/zod/locales/az.d.ts +4 -0
- package/vendor/zod/locales/az.js +108 -0
- package/vendor/zod/locales/be.d.ts +4 -0
- package/vendor/zod/locales/be.js +166 -0
- package/vendor/zod/locales/bg.d.ts +4 -0
- package/vendor/zod/locales/bg.js +123 -0
- package/vendor/zod/locales/bn.d.ts +4 -0
- package/vendor/zod/locales/bn.js +111 -0
- package/vendor/zod/locales/ca.d.ts +4 -0
- package/vendor/zod/locales/ca.js +110 -0
- package/vendor/zod/locales/ckb.d.ts +4 -0
- package/vendor/zod/locales/ckb.js +131 -0
- package/vendor/zod/locales/cs.d.ts +4 -0
- package/vendor/zod/locales/cs.js +114 -0
- package/vendor/zod/locales/da.d.ts +4 -0
- package/vendor/zod/locales/da.js +118 -0
- package/vendor/zod/locales/de.d.ts +4 -0
- package/vendor/zod/locales/de.js +111 -0
- package/vendor/zod/locales/el.d.ts +4 -0
- package/vendor/zod/locales/el.js +110 -0
- package/vendor/zod/locales/en.d.ts +4 -0
- package/vendor/zod/locales/en.js +123 -0
- package/vendor/zod/locales/eo.d.ts +4 -0
- package/vendor/zod/locales/eo.js +112 -0
- package/vendor/zod/locales/es.d.ts +4 -0
- package/vendor/zod/locales/es.js +134 -0
- package/vendor/zod/locales/fa.d.ts +4 -0
- package/vendor/zod/locales/fa.js +117 -0
- package/vendor/zod/locales/fi.d.ts +4 -0
- package/vendor/zod/locales/fi.js +115 -0
- package/vendor/zod/locales/fr-CA.d.ts +4 -0
- package/vendor/zod/locales/fr-CA.js +110 -0
- package/vendor/zod/locales/fr.d.ts +4 -0
- package/vendor/zod/locales/fr.js +127 -0
- package/vendor/zod/locales/gu.d.ts +4 -0
- package/vendor/zod/locales/gu.js +111 -0
- package/vendor/zod/locales/he.d.ts +4 -0
- package/vendor/zod/locales/he.js +219 -0
- package/vendor/zod/locales/hi.d.ts +4 -0
- package/vendor/zod/locales/hi.js +109 -0
- package/vendor/zod/locales/hr.d.ts +4 -0
- package/vendor/zod/locales/hr.js +124 -0
- package/vendor/zod/locales/hu.d.ts +4 -0
- package/vendor/zod/locales/hu.js +111 -0
- package/vendor/zod/locales/hy.d.ts +4 -0
- package/vendor/zod/locales/hy.js +156 -0
- package/vendor/zod/locales/id.d.ts +4 -0
- package/vendor/zod/locales/id.js +109 -0
- package/vendor/zod/locales/index.d.ts +62 -0
- package/vendor/zod/locales/index.js +62 -0
- package/vendor/zod/locales/is.d.ts +4 -0
- package/vendor/zod/locales/is.js +112 -0
- package/vendor/zod/locales/it.d.ts +4 -0
- package/vendor/zod/locales/it.js +111 -0
- package/vendor/zod/locales/ja.d.ts +4 -0
- package/vendor/zod/locales/ja.js +110 -0
- package/vendor/zod/locales/ka.d.ts +4 -0
- package/vendor/zod/locales/ka.js +115 -0
- package/vendor/zod/locales/kh.d.ts +5 -0
- package/vendor/zod/locales/kh.js +5 -0
- package/vendor/zod/locales/km.d.ts +4 -0
- package/vendor/zod/locales/km.js +113 -0
- package/vendor/zod/locales/kn.d.ts +4 -0
- package/vendor/zod/locales/kn.js +114 -0
- package/vendor/zod/locales/ko.d.ts +4 -0
- package/vendor/zod/locales/ko.js +114 -0
- package/vendor/zod/locales/lt.d.ts +4 -0
- package/vendor/zod/locales/lt.js +205 -0
- package/vendor/zod/locales/mk.d.ts +4 -0
- package/vendor/zod/locales/mk.js +112 -0
- package/vendor/zod/locales/ms.d.ts +4 -0
- package/vendor/zod/locales/ms.js +110 -0
- package/vendor/zod/locales/ne.d.ts +4 -0
- package/vendor/zod/locales/ne.js +109 -0
- package/vendor/zod/locales/nl.d.ts +4 -0
- package/vendor/zod/locales/nl.js +113 -0
- package/vendor/zod/locales/nn.d.ts +4 -0
- package/vendor/zod/locales/nn.js +111 -0
- package/vendor/zod/locales/no.d.ts +4 -0
- package/vendor/zod/locales/no.js +111 -0
- package/vendor/zod/locales/ota.d.ts +4 -0
- package/vendor/zod/locales/ota.js +112 -0
- package/vendor/zod/locales/package.json +7 -0
- package/vendor/zod/locales/pl.d.ts +4 -0
- package/vendor/zod/locales/pl.js +112 -0
- package/vendor/zod/locales/ps.d.ts +4 -0
- package/vendor/zod/locales/ps.js +117 -0
- package/vendor/zod/locales/pt-BR.d.ts +4 -0
- package/vendor/zod/locales/pt-BR.js +141 -0
- package/vendor/zod/locales/pt.d.ts +4 -0
- package/vendor/zod/locales/pt.js +140 -0
- package/vendor/zod/locales/ro.d.ts +4 -0
- package/vendor/zod/locales/ro.js +120 -0
- package/vendor/zod/locales/ru.d.ts +4 -0
- package/vendor/zod/locales/ru.js +166 -0
- package/vendor/zod/locales/sk.d.ts +4 -0
- package/vendor/zod/locales/sk.js +114 -0
- package/vendor/zod/locales/sl.d.ts +4 -0
- package/vendor/zod/locales/sl.js +112 -0
- package/vendor/zod/locales/sv.d.ts +4 -0
- package/vendor/zod/locales/sv.js +113 -0
- package/vendor/zod/locales/ta.d.ts +4 -0
- package/vendor/zod/locales/ta.js +113 -0
- package/vendor/zod/locales/th.d.ts +4 -0
- package/vendor/zod/locales/th.js +113 -0
- package/vendor/zod/locales/tk.d.ts +4 -0
- package/vendor/zod/locales/tk.js +105 -0
- package/vendor/zod/locales/tr.d.ts +4 -0
- package/vendor/zod/locales/tr.js +108 -0
- package/vendor/zod/locales/ua.d.ts +5 -0
- package/vendor/zod/locales/ua.js +5 -0
- package/vendor/zod/locales/uk.d.ts +4 -0
- package/vendor/zod/locales/uk.js +111 -0
- package/vendor/zod/locales/ur.d.ts +4 -0
- package/vendor/zod/locales/ur.js +113 -0
- package/vendor/zod/locales/uz.d.ts +4 -0
- package/vendor/zod/locales/uz.js +111 -0
- package/vendor/zod/locales/vi.d.ts +4 -0
- package/vendor/zod/locales/vi.js +111 -0
- package/vendor/zod/locales/yo.d.ts +4 -0
- package/vendor/zod/locales/yo.js +110 -0
- package/vendor/zod/locales/zh-CN.d.ts +4 -0
- package/vendor/zod/locales/zh-CN.js +112 -0
- package/vendor/zod/locales/zh-TW.d.ts +4 -0
- package/vendor/zod/locales/zh-TW.js +110 -0
- package/vendor/zod/mini/checks.d.ts +1 -0
- package/vendor/zod/mini/checks.js +1 -0
- package/vendor/zod/mini/coerce.d.ts +7 -0
- package/vendor/zod/mini/coerce.js +22 -0
- package/vendor/zod/mini/deep-partial.d.ts +14 -0
- package/vendor/zod/mini/deep-partial.js +13 -0
- package/vendor/zod/mini/external.d.ts +16 -0
- package/vendor/zod/mini/external.js +16 -0
- package/vendor/zod/mini/in-out.d.ts +8 -0
- package/vendor/zod/mini/in-out.js +36 -0
- package/vendor/zod/mini/index.d.ts +3 -0
- package/vendor/zod/mini/index.js +3 -0
- package/vendor/zod/mini/iso.d.ts +22 -0
- package/vendor/zod/mini/iso.js +34 -0
- package/vendor/zod/mini/package.json +7 -0
- package/vendor/zod/mini/parse.d.ts +1 -0
- package/vendor/zod/mini/parse.js +1 -0
- package/vendor/zod/mini/schemas.d.ts +475 -0
- package/vendor/zod/mini/schemas.js +987 -0
- package/vendor/zod/package.json +7 -0
- package/vendor/zodexy/dist/esm/index.js +1274 -0
- package/vendor/zodexy/dist/index.js +1088 -0
- package/vendor/zodexy/dist/schema.zodexy.json +1036 -0
- package/dist/fundamentalTypes/nativeEnumType.d.ts +0 -6
- package/dist/fundamentalTypes/nativeEnumType.d.ts.map +0 -1
- package/src/fundamentalTypes/catchType.js +0 -140
- package/src/fundamentalTypes/enumType.js +0 -52
- package/src/fundamentalTypes/literalType.js +0 -81
- package/src/fundamentalTypes/nativeEnumType.js +0 -157
- package/src/fundamentalTypes/neverType.js +0 -49
- package/src/fundamentalTypes/recordType.js +0 -42
- package/src/fundamentalTypes/tupleType.js +0 -39
- package/src/fundamentalTypes/voidType.js +0 -48
- package/vendor/zod/lib/index.mjs +0 -4236
- package/vendor/zodex/dist/esm/dezerialize.d.ts +0 -26
- package/vendor/zodex/dist/esm/dezerialize.js +0 -393
- package/vendor/zodex/dist/esm/index.d.ts +0 -9
- package/vendor/zodex/dist/esm/index.js +0 -4
- package/vendor/zodex/dist/esm/infer.d.ts +0 -29
- package/vendor/zodex/dist/esm/package.json +0 -1
- package/vendor/zodex/dist/esm/types.d.ts +0 -201
- package/vendor/zodex/dist/esm/types.js +0 -13
- package/vendor/zodex/dist/esm/ui.d.ts +0 -23
- package/vendor/zodex/dist/esm/ui.js +0 -10
- package/vendor/zodex/dist/esm/zerialize.d.ts +0 -50
- package/vendor/zodex/dist/esm/zerialize.js +0 -417
- package/vendor/zodex/dist/esm/zod-types.d.ts +0 -11
- /package/vendor/{zodex/dist/esm/infer.js → zod/core/json-schema.js} +0 -0
- /package/vendor/{zodex/dist/esm/zod-types.js → zod/core/standard-schema.js} +0 -0
|
@@ -0,0 +1,987 @@
|
|
|
1
|
+
import * as core from "../core/index.js";
|
|
2
|
+
import * as util from "../core/util.js";
|
|
3
|
+
import * as parse from "./parse.js";
|
|
4
|
+
export const ZodMiniType = /*@__PURE__*/ core.$constructor("ZodMiniType", (inst, def) => {
|
|
5
|
+
if (!inst._zod)
|
|
6
|
+
throw new Error("Uninitialized schema in ZodMiniType.");
|
|
7
|
+
core.$ZodType.init(inst, def);
|
|
8
|
+
inst.def = def;
|
|
9
|
+
inst.type = def.type;
|
|
10
|
+
}, {
|
|
11
|
+
// `with` is an alias for `check`: the same function object, not a wrapper.
|
|
12
|
+
get with() {
|
|
13
|
+
return this.check;
|
|
14
|
+
},
|
|
15
|
+
set with(value) {
|
|
16
|
+
util.own(this, "with", value);
|
|
17
|
+
},
|
|
18
|
+
parse(data, params) {
|
|
19
|
+
return parse.parse(this, data, params, { callee: this.parse });
|
|
20
|
+
},
|
|
21
|
+
parseAsync(data, params) {
|
|
22
|
+
return parse.parseAsync(this, data, params, { callee: this.parseAsync });
|
|
23
|
+
},
|
|
24
|
+
safeParse(data, params) {
|
|
25
|
+
return parse.safeParse(this, data, params);
|
|
26
|
+
},
|
|
27
|
+
safeParseAsync(data, params) {
|
|
28
|
+
return parse.safeParseAsync(this, data, params);
|
|
29
|
+
},
|
|
30
|
+
check(...checks) {
|
|
31
|
+
const def = this.def;
|
|
32
|
+
return this.clone({
|
|
33
|
+
...def,
|
|
34
|
+
checks: [
|
|
35
|
+
...(def.checks ?? []),
|
|
36
|
+
...checks.map((ch) => typeof ch === "function" ? { _zod: { check: ch, def: { check: "custom" }, onattach: [] } } : ch),
|
|
37
|
+
],
|
|
38
|
+
}, { parent: true });
|
|
39
|
+
},
|
|
40
|
+
clone(_def, params) {
|
|
41
|
+
return core.clone(this, _def, params);
|
|
42
|
+
},
|
|
43
|
+
brand() {
|
|
44
|
+
return this;
|
|
45
|
+
},
|
|
46
|
+
register(reg, meta) {
|
|
47
|
+
reg.add(this, meta);
|
|
48
|
+
return this;
|
|
49
|
+
},
|
|
50
|
+
apply(fn, ...args) {
|
|
51
|
+
return args.length === 0 ? fn(this) : fn(this, ...args);
|
|
52
|
+
},
|
|
53
|
+
});
|
|
54
|
+
export const ZodMiniString = /*@__PURE__*/ core.$constructor("ZodMiniString", (inst, def) => {
|
|
55
|
+
core.$ZodString.init(inst, def);
|
|
56
|
+
ZodMiniType.init(inst, def);
|
|
57
|
+
});
|
|
58
|
+
// @__NO_SIDE_EFFECTS__
|
|
59
|
+
export function string(params) {
|
|
60
|
+
return core._string(ZodMiniString, params);
|
|
61
|
+
}
|
|
62
|
+
export const ZodMiniStringFormat = /*@__PURE__*/ core.$constructor("ZodMiniStringFormat", (inst, def) => {
|
|
63
|
+
core.$ZodStringFormat.init(inst, def);
|
|
64
|
+
ZodMiniString.init(inst, def);
|
|
65
|
+
});
|
|
66
|
+
export const ZodMiniEmail = /*@__PURE__*/ core.$constructor("ZodMiniEmail", (inst, def) => {
|
|
67
|
+
core.$ZodEmail.init(inst, def);
|
|
68
|
+
ZodMiniStringFormat.init(inst, def);
|
|
69
|
+
});
|
|
70
|
+
// @__NO_SIDE_EFFECTS__
|
|
71
|
+
export function email(params) {
|
|
72
|
+
return core._email(ZodMiniEmail, params);
|
|
73
|
+
}
|
|
74
|
+
export const ZodMiniGUID = /*@__PURE__*/ core.$constructor("ZodMiniGUID", (inst, def) => {
|
|
75
|
+
core.$ZodGUID.init(inst, def);
|
|
76
|
+
ZodMiniStringFormat.init(inst, def);
|
|
77
|
+
});
|
|
78
|
+
// @__NO_SIDE_EFFECTS__
|
|
79
|
+
export function guid(params) {
|
|
80
|
+
return core._guid(ZodMiniGUID, params);
|
|
81
|
+
}
|
|
82
|
+
export const ZodMiniUUID = /*@__PURE__*/ core.$constructor("ZodMiniUUID", (inst, def) => {
|
|
83
|
+
core.$ZodUUID.init(inst, def);
|
|
84
|
+
ZodMiniStringFormat.init(inst, def);
|
|
85
|
+
});
|
|
86
|
+
// @__NO_SIDE_EFFECTS__
|
|
87
|
+
export function uuid(params) {
|
|
88
|
+
return core._uuid(ZodMiniUUID, params);
|
|
89
|
+
}
|
|
90
|
+
// @__NO_SIDE_EFFECTS__
|
|
91
|
+
export function uuidv4(params) {
|
|
92
|
+
return core._uuidv4(ZodMiniUUID, params);
|
|
93
|
+
}
|
|
94
|
+
// ZodMiniUUIDv6
|
|
95
|
+
// @__NO_SIDE_EFFECTS__
|
|
96
|
+
export function uuidv6(params) {
|
|
97
|
+
return core._uuidv6(ZodMiniUUID, params);
|
|
98
|
+
}
|
|
99
|
+
// ZodMiniUUIDv7
|
|
100
|
+
// @__NO_SIDE_EFFECTS__
|
|
101
|
+
export function uuidv7(params) {
|
|
102
|
+
return core._uuidv7(ZodMiniUUID, params);
|
|
103
|
+
}
|
|
104
|
+
export const ZodMiniURL = /*@__PURE__*/ core.$constructor("ZodMiniURL", (inst, def) => {
|
|
105
|
+
core.$ZodURL.init(inst, def);
|
|
106
|
+
ZodMiniStringFormat.init(inst, def);
|
|
107
|
+
});
|
|
108
|
+
// @__NO_SIDE_EFFECTS__
|
|
109
|
+
export function url(params) {
|
|
110
|
+
return core._url(ZodMiniURL, params);
|
|
111
|
+
}
|
|
112
|
+
// @__NO_SIDE_EFFECTS__
|
|
113
|
+
export function httpUrl(params) {
|
|
114
|
+
return core._url(ZodMiniURL, {
|
|
115
|
+
protocol: core.regexes.httpProtocol,
|
|
116
|
+
hostname: core.regexes.domain,
|
|
117
|
+
...util.normalizeParams(params),
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
export const ZodMiniEmoji = /*@__PURE__*/ core.$constructor("ZodMiniEmoji", (inst, def) => {
|
|
121
|
+
core.$ZodEmoji.init(inst, def);
|
|
122
|
+
ZodMiniStringFormat.init(inst, def);
|
|
123
|
+
});
|
|
124
|
+
// @__NO_SIDE_EFFECTS__
|
|
125
|
+
export function emoji(params) {
|
|
126
|
+
return core._emoji(ZodMiniEmoji, params);
|
|
127
|
+
}
|
|
128
|
+
export const ZodMiniNanoID = /*@__PURE__*/ core.$constructor("ZodMiniNanoID", (inst, def) => {
|
|
129
|
+
core.$ZodNanoID.init(inst, def);
|
|
130
|
+
ZodMiniStringFormat.init(inst, def);
|
|
131
|
+
});
|
|
132
|
+
// @__NO_SIDE_EFFECTS__
|
|
133
|
+
export function nanoid(params) {
|
|
134
|
+
return core._nanoid(ZodMiniNanoID, params);
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* @deprecated CUID v1 is deprecated by its authors due to information leakage
|
|
138
|
+
* (timestamps embedded in the id). Use {@link ZodMiniCUID2} instead.
|
|
139
|
+
* See https://github.com/paralleldrive/cuid.
|
|
140
|
+
*/
|
|
141
|
+
export const ZodMiniCUID = /*@__PURE__*/ core.$constructor("ZodMiniCUID", (inst, def) => {
|
|
142
|
+
core.$ZodCUID.init(inst, def);
|
|
143
|
+
ZodMiniStringFormat.init(inst, def);
|
|
144
|
+
});
|
|
145
|
+
/**
|
|
146
|
+
* Validates a CUID v1 string.
|
|
147
|
+
*
|
|
148
|
+
* @deprecated CUID v1 is deprecated by its authors due to information leakage
|
|
149
|
+
* (timestamps embedded in the id). Use {@link cuid2 | `z.cuid2()`} instead.
|
|
150
|
+
* See https://github.com/paralleldrive/cuid.
|
|
151
|
+
*/
|
|
152
|
+
// @__NO_SIDE_EFFECTS__
|
|
153
|
+
export function cuid(params) {
|
|
154
|
+
return core._cuid(ZodMiniCUID, params);
|
|
155
|
+
}
|
|
156
|
+
export const ZodMiniCUID2 = /*@__PURE__*/ core.$constructor("ZodMiniCUID2", (inst, def) => {
|
|
157
|
+
core.$ZodCUID2.init(inst, def);
|
|
158
|
+
ZodMiniStringFormat.init(inst, def);
|
|
159
|
+
});
|
|
160
|
+
// @__NO_SIDE_EFFECTS__
|
|
161
|
+
export function cuid2(params) {
|
|
162
|
+
return core._cuid2(ZodMiniCUID2, params);
|
|
163
|
+
}
|
|
164
|
+
export const ZodMiniULID = /*@__PURE__*/ core.$constructor("ZodMiniULID", (inst, def) => {
|
|
165
|
+
core.$ZodULID.init(inst, def);
|
|
166
|
+
ZodMiniStringFormat.init(inst, def);
|
|
167
|
+
});
|
|
168
|
+
// @__NO_SIDE_EFFECTS__
|
|
169
|
+
export function ulid(params) {
|
|
170
|
+
return core._ulid(ZodMiniULID, params);
|
|
171
|
+
}
|
|
172
|
+
export const ZodMiniXID = /*@__PURE__*/ core.$constructor("ZodMiniXID", (inst, def) => {
|
|
173
|
+
core.$ZodXID.init(inst, def);
|
|
174
|
+
ZodMiniStringFormat.init(inst, def);
|
|
175
|
+
});
|
|
176
|
+
// @__NO_SIDE_EFFECTS__
|
|
177
|
+
export function xid(params) {
|
|
178
|
+
return core._xid(ZodMiniXID, params);
|
|
179
|
+
}
|
|
180
|
+
export const ZodMiniKSUID = /*@__PURE__*/ core.$constructor("ZodMiniKSUID", (inst, def) => {
|
|
181
|
+
core.$ZodKSUID.init(inst, def);
|
|
182
|
+
ZodMiniStringFormat.init(inst, def);
|
|
183
|
+
});
|
|
184
|
+
// @__NO_SIDE_EFFECTS__
|
|
185
|
+
export function ksuid(params) {
|
|
186
|
+
return core._ksuid(ZodMiniKSUID, params);
|
|
187
|
+
}
|
|
188
|
+
export const ZodMiniIPv4 = /*@__PURE__*/ core.$constructor("ZodMiniIPv4", (inst, def) => {
|
|
189
|
+
core.$ZodIPv4.init(inst, def);
|
|
190
|
+
ZodMiniStringFormat.init(inst, def);
|
|
191
|
+
});
|
|
192
|
+
// @__NO_SIDE_EFFECTS__
|
|
193
|
+
export function ipv4(params) {
|
|
194
|
+
return core._ipv4(ZodMiniIPv4, params);
|
|
195
|
+
}
|
|
196
|
+
export const ZodMiniIPv6 = /*@__PURE__*/ core.$constructor("ZodMiniIPv6", (inst, def) => {
|
|
197
|
+
core.$ZodIPv6.init(inst, def);
|
|
198
|
+
ZodMiniStringFormat.init(inst, def);
|
|
199
|
+
});
|
|
200
|
+
// @__NO_SIDE_EFFECTS__
|
|
201
|
+
export function ipv6(params) {
|
|
202
|
+
return core._ipv6(ZodMiniIPv6, params);
|
|
203
|
+
}
|
|
204
|
+
export const ZodMiniCIDRv4 = /*@__PURE__*/ core.$constructor("ZodMiniCIDRv4", (inst, def) => {
|
|
205
|
+
core.$ZodCIDRv4.init(inst, def);
|
|
206
|
+
ZodMiniStringFormat.init(inst, def);
|
|
207
|
+
});
|
|
208
|
+
// @__NO_SIDE_EFFECTS__
|
|
209
|
+
export function cidrv4(params) {
|
|
210
|
+
return core._cidrv4(ZodMiniCIDRv4, params);
|
|
211
|
+
}
|
|
212
|
+
export const ZodMiniCIDRv6 = /*@__PURE__*/ core.$constructor("ZodMiniCIDRv6", (inst, def) => {
|
|
213
|
+
core.$ZodCIDRv6.init(inst, def);
|
|
214
|
+
ZodMiniStringFormat.init(inst, def);
|
|
215
|
+
});
|
|
216
|
+
// @__NO_SIDE_EFFECTS__
|
|
217
|
+
export function cidrv6(params) {
|
|
218
|
+
return core._cidrv6(ZodMiniCIDRv6, params);
|
|
219
|
+
}
|
|
220
|
+
export const ZodMiniMAC = /*@__PURE__*/ core.$constructor("ZodMiniMAC", (inst, def) => {
|
|
221
|
+
core.$ZodMAC.init(inst, def);
|
|
222
|
+
ZodMiniStringFormat.init(inst, def);
|
|
223
|
+
});
|
|
224
|
+
// @__NO_SIDE_EFFECTS__
|
|
225
|
+
export function mac(params) {
|
|
226
|
+
return core._mac(ZodMiniMAC, params);
|
|
227
|
+
}
|
|
228
|
+
export const ZodMiniBase64 = /*@__PURE__*/ core.$constructor("ZodMiniBase64", (inst, def) => {
|
|
229
|
+
core.$ZodBase64.init(inst, def);
|
|
230
|
+
ZodMiniStringFormat.init(inst, def);
|
|
231
|
+
});
|
|
232
|
+
// @__NO_SIDE_EFFECTS__
|
|
233
|
+
export function base64(params) {
|
|
234
|
+
return core._base64(ZodMiniBase64, params);
|
|
235
|
+
}
|
|
236
|
+
export const ZodMiniBase64URL = /*@__PURE__*/ core.$constructor("ZodMiniBase64URL", (inst, def) => {
|
|
237
|
+
core.$ZodBase64URL.init(inst, def);
|
|
238
|
+
ZodMiniStringFormat.init(inst, def);
|
|
239
|
+
});
|
|
240
|
+
// @__NO_SIDE_EFFECTS__
|
|
241
|
+
export function base64url(params) {
|
|
242
|
+
return core._base64url(ZodMiniBase64URL, params);
|
|
243
|
+
}
|
|
244
|
+
export const ZodMiniE164 = /*@__PURE__*/ core.$constructor("ZodMiniE164", (inst, def) => {
|
|
245
|
+
core.$ZodE164.init(inst, def);
|
|
246
|
+
ZodMiniStringFormat.init(inst, def);
|
|
247
|
+
});
|
|
248
|
+
// @__NO_SIDE_EFFECTS__
|
|
249
|
+
export function e164(params) {
|
|
250
|
+
return core._e164(ZodMiniE164, params);
|
|
251
|
+
}
|
|
252
|
+
export const ZodMiniCreditCard = /*@__PURE__*/ core.$constructor("ZodMiniCreditCard", (inst, def) => {
|
|
253
|
+
core.$ZodCreditCard.init(inst, def);
|
|
254
|
+
ZodMiniStringFormat.init(inst, def);
|
|
255
|
+
});
|
|
256
|
+
// @__NO_SIDE_EFFECTS__
|
|
257
|
+
export function creditCard(params) {
|
|
258
|
+
return core._creditCard(ZodMiniCreditCard, params);
|
|
259
|
+
}
|
|
260
|
+
export const ZodMiniJWT = /*@__PURE__*/ core.$constructor("ZodMiniJWT", (inst, def) => {
|
|
261
|
+
core.$ZodJWT.init(inst, def);
|
|
262
|
+
ZodMiniStringFormat.init(inst, def);
|
|
263
|
+
});
|
|
264
|
+
// @__NO_SIDE_EFFECTS__
|
|
265
|
+
export function jwt(params) {
|
|
266
|
+
return core._jwt(ZodMiniJWT, params);
|
|
267
|
+
}
|
|
268
|
+
export const ZodMiniCustomStringFormat = /*@__PURE__*/ core.$constructor("ZodMiniCustomStringFormat", (inst, def) => {
|
|
269
|
+
core.$ZodCustomStringFormat.init(inst, def);
|
|
270
|
+
ZodMiniStringFormat.init(inst, def);
|
|
271
|
+
});
|
|
272
|
+
// @__NO_SIDE_EFFECTS__
|
|
273
|
+
export function stringFormat(format, fnOrRegex, _params = {}) {
|
|
274
|
+
return core._stringFormat(ZodMiniCustomStringFormat, format, fnOrRegex, _params);
|
|
275
|
+
}
|
|
276
|
+
// @__NO_SIDE_EFFECTS__
|
|
277
|
+
export function hostname(_params) {
|
|
278
|
+
return core._stringFormat(ZodMiniCustomStringFormat, "hostname", core.regexes.hostname, _params);
|
|
279
|
+
}
|
|
280
|
+
// @__NO_SIDE_EFFECTS__
|
|
281
|
+
export function hex(_params) {
|
|
282
|
+
return core._stringFormat(ZodMiniCustomStringFormat, "hex", core.regexes.hex, _params);
|
|
283
|
+
}
|
|
284
|
+
// @__NO_SIDE_EFFECTS__
|
|
285
|
+
export function hash(alg, params) {
|
|
286
|
+
const enc = params?.enc ?? "hex";
|
|
287
|
+
const format = `${alg}_${enc}`;
|
|
288
|
+
const regex = core.regexes[format];
|
|
289
|
+
// check for unrecognized format
|
|
290
|
+
if (!regex)
|
|
291
|
+
throw new Error(`Unrecognized hash format: ${format}`);
|
|
292
|
+
return core._stringFormat(ZodMiniCustomStringFormat, format, regex, params);
|
|
293
|
+
}
|
|
294
|
+
export const ZodMiniNumber = /*@__PURE__*/ core.$constructor("ZodMiniNumber", (inst, def) => {
|
|
295
|
+
core.$ZodNumber.init(inst, def);
|
|
296
|
+
ZodMiniType.init(inst, def);
|
|
297
|
+
});
|
|
298
|
+
// @__NO_SIDE_EFFECTS__
|
|
299
|
+
export function number(params) {
|
|
300
|
+
return core._number(ZodMiniNumber, params);
|
|
301
|
+
}
|
|
302
|
+
export const ZodMiniNumberFormat = /*@__PURE__*/ core.$constructor("ZodMiniNumberFormat", (inst, def) => {
|
|
303
|
+
core.$ZodNumberFormat.init(inst, def);
|
|
304
|
+
ZodMiniNumber.init(inst, def);
|
|
305
|
+
});
|
|
306
|
+
export function int(params) {
|
|
307
|
+
return core._int(ZodMiniNumberFormat, params);
|
|
308
|
+
}
|
|
309
|
+
export function float32(params) {
|
|
310
|
+
return core._float32(ZodMiniNumberFormat, params);
|
|
311
|
+
}
|
|
312
|
+
export function float64(params) {
|
|
313
|
+
return core._float64(ZodMiniNumberFormat, params);
|
|
314
|
+
}
|
|
315
|
+
export function int32(params) {
|
|
316
|
+
return core._int32(ZodMiniNumberFormat, params);
|
|
317
|
+
}
|
|
318
|
+
export function uint32(params) {
|
|
319
|
+
return core._uint32(ZodMiniNumberFormat, params);
|
|
320
|
+
}
|
|
321
|
+
export const ZodMiniBoolean = /*@__PURE__*/ core.$constructor("ZodMiniBoolean", (inst, def) => {
|
|
322
|
+
core.$ZodBoolean.init(inst, def);
|
|
323
|
+
ZodMiniType.init(inst, def);
|
|
324
|
+
});
|
|
325
|
+
// @__NO_SIDE_EFFECTS__
|
|
326
|
+
export function boolean(params) {
|
|
327
|
+
return core._boolean(ZodMiniBoolean, params);
|
|
328
|
+
}
|
|
329
|
+
export const ZodMiniBigInt = /*@__PURE__*/ core.$constructor("ZodMiniBigInt", (inst, def) => {
|
|
330
|
+
core.$ZodBigInt.init(inst, def);
|
|
331
|
+
ZodMiniType.init(inst, def);
|
|
332
|
+
});
|
|
333
|
+
// @__NO_SIDE_EFFECTS__
|
|
334
|
+
export function bigint(params) {
|
|
335
|
+
return core._bigint(ZodMiniBigInt, params);
|
|
336
|
+
}
|
|
337
|
+
export const ZodMiniBigIntFormat = /*@__PURE__*/ core.$constructor("ZodMiniBigIntFormat", (inst, def) => {
|
|
338
|
+
core.$ZodBigIntFormat.init(inst, def);
|
|
339
|
+
ZodMiniBigInt.init(inst, def);
|
|
340
|
+
});
|
|
341
|
+
export function int64(params) {
|
|
342
|
+
return core._int64(ZodMiniBigIntFormat, params);
|
|
343
|
+
}
|
|
344
|
+
export function uint64(params) {
|
|
345
|
+
return core._uint64(ZodMiniBigIntFormat, params);
|
|
346
|
+
}
|
|
347
|
+
export const ZodMiniSymbol = /*@__PURE__*/ core.$constructor("ZodMiniSymbol", (inst, def) => {
|
|
348
|
+
core.$ZodSymbol.init(inst, def);
|
|
349
|
+
ZodMiniType.init(inst, def);
|
|
350
|
+
});
|
|
351
|
+
// @__NO_SIDE_EFFECTS__
|
|
352
|
+
export function symbol(params) {
|
|
353
|
+
return core._symbol(ZodMiniSymbol, params);
|
|
354
|
+
}
|
|
355
|
+
export const ZodMiniUndefined = /*@__PURE__*/ core.$constructor("ZodMiniUndefined", (inst, def) => {
|
|
356
|
+
core.$ZodUndefined.init(inst, def);
|
|
357
|
+
ZodMiniType.init(inst, def);
|
|
358
|
+
});
|
|
359
|
+
// @__NO_SIDE_EFFECTS__
|
|
360
|
+
function _undefined(params) {
|
|
361
|
+
return core._undefined(ZodMiniUndefined, params);
|
|
362
|
+
}
|
|
363
|
+
export { _undefined as undefined };
|
|
364
|
+
export const ZodMiniNull = /*@__PURE__*/ core.$constructor("ZodMiniNull", (inst, def) => {
|
|
365
|
+
core.$ZodNull.init(inst, def);
|
|
366
|
+
ZodMiniType.init(inst, def);
|
|
367
|
+
});
|
|
368
|
+
// @__NO_SIDE_EFFECTS__
|
|
369
|
+
function _null(params) {
|
|
370
|
+
return core._null(ZodMiniNull, params);
|
|
371
|
+
}
|
|
372
|
+
export { _null as null };
|
|
373
|
+
export const ZodMiniAny = /*@__PURE__*/ core.$constructor("ZodMiniAny", (inst, def) => {
|
|
374
|
+
core.$ZodAny.init(inst, def);
|
|
375
|
+
ZodMiniType.init(inst, def);
|
|
376
|
+
});
|
|
377
|
+
// @__NO_SIDE_EFFECTS__
|
|
378
|
+
export function any() {
|
|
379
|
+
return core._any(ZodMiniAny);
|
|
380
|
+
}
|
|
381
|
+
export const ZodMiniUnknown = /*@__PURE__*/ core.$constructor("ZodMiniUnknown", (inst, def) => {
|
|
382
|
+
core.$ZodUnknown.init(inst, def);
|
|
383
|
+
ZodMiniType.init(inst, def);
|
|
384
|
+
});
|
|
385
|
+
// @__NO_SIDE_EFFECTS__
|
|
386
|
+
export function unknown() {
|
|
387
|
+
return core._unknown(ZodMiniUnknown);
|
|
388
|
+
}
|
|
389
|
+
export const ZodMiniNever = /*@__PURE__*/ core.$constructor("ZodMiniNever", (inst, def) => {
|
|
390
|
+
core.$ZodNever.init(inst, def);
|
|
391
|
+
ZodMiniType.init(inst, def);
|
|
392
|
+
});
|
|
393
|
+
// @__NO_SIDE_EFFECTS__
|
|
394
|
+
export function never(params) {
|
|
395
|
+
return core._never(ZodMiniNever, params);
|
|
396
|
+
}
|
|
397
|
+
export const ZodMiniVoid = /*@__PURE__*/ core.$constructor("ZodMiniVoid", (inst, def) => {
|
|
398
|
+
core.$ZodVoid.init(inst, def);
|
|
399
|
+
ZodMiniType.init(inst, def);
|
|
400
|
+
});
|
|
401
|
+
// @__NO_SIDE_EFFECTS__
|
|
402
|
+
function _void(params) {
|
|
403
|
+
return core._void(ZodMiniVoid, params);
|
|
404
|
+
}
|
|
405
|
+
export { _void as void };
|
|
406
|
+
export const ZodMiniDate = /*@__PURE__*/ core.$constructor("ZodMiniDate", (inst, def) => {
|
|
407
|
+
core.$ZodDate.init(inst, def);
|
|
408
|
+
ZodMiniType.init(inst, def);
|
|
409
|
+
});
|
|
410
|
+
// @__NO_SIDE_EFFECTS__
|
|
411
|
+
export function date(params) {
|
|
412
|
+
return core._date(ZodMiniDate, params);
|
|
413
|
+
}
|
|
414
|
+
export const ZodMiniArray = /*@__PURE__*/ core.$constructor("ZodMiniArray", (inst, def) => {
|
|
415
|
+
core.$ZodArray.init(inst, def);
|
|
416
|
+
ZodMiniType.init(inst, def);
|
|
417
|
+
});
|
|
418
|
+
// @__NO_SIDE_EFFECTS__
|
|
419
|
+
export function array(element, params) {
|
|
420
|
+
return new ZodMiniArray({
|
|
421
|
+
type: "array",
|
|
422
|
+
element: element,
|
|
423
|
+
...util.normalizeParams(params),
|
|
424
|
+
});
|
|
425
|
+
}
|
|
426
|
+
// .keyof
|
|
427
|
+
// @__NO_SIDE_EFFECTS__
|
|
428
|
+
export function keyof(schema) {
|
|
429
|
+
const shape = schema._zod.def.shape;
|
|
430
|
+
return _enum(Object.keys(shape));
|
|
431
|
+
}
|
|
432
|
+
export const ZodMiniObject = /*@__PURE__*/ core.$constructor("ZodMiniObject", (inst, def) => {
|
|
433
|
+
core.$ZodObject.init(inst, def);
|
|
434
|
+
ZodMiniType.init(inst, def);
|
|
435
|
+
util.installLazyProp(inst, "shape", (self) => self._zod.def.shape, false);
|
|
436
|
+
});
|
|
437
|
+
// @__NO_SIDE_EFFECTS__
|
|
438
|
+
export function object(shape, params) {
|
|
439
|
+
const def = {
|
|
440
|
+
type: "object",
|
|
441
|
+
shape: shape ?? {},
|
|
442
|
+
...util.normalizeParams(params),
|
|
443
|
+
};
|
|
444
|
+
return new ZodMiniObject(def);
|
|
445
|
+
}
|
|
446
|
+
// strictObject
|
|
447
|
+
// @__NO_SIDE_EFFECTS__
|
|
448
|
+
export function strictObject(shape, params) {
|
|
449
|
+
return new ZodMiniObject({
|
|
450
|
+
type: "object",
|
|
451
|
+
shape,
|
|
452
|
+
catchall: never(),
|
|
453
|
+
...util.normalizeParams(params),
|
|
454
|
+
});
|
|
455
|
+
}
|
|
456
|
+
// looseObject
|
|
457
|
+
// @__NO_SIDE_EFFECTS__
|
|
458
|
+
export function looseObject(shape, params) {
|
|
459
|
+
return new ZodMiniObject({
|
|
460
|
+
type: "object",
|
|
461
|
+
shape,
|
|
462
|
+
catchall: unknown(),
|
|
463
|
+
...util.normalizeParams(params),
|
|
464
|
+
});
|
|
465
|
+
}
|
|
466
|
+
// object methods
|
|
467
|
+
// @__NO_SIDE_EFFECTS__
|
|
468
|
+
export function extend(schema, shape) {
|
|
469
|
+
return util.extend(schema, shape);
|
|
470
|
+
}
|
|
471
|
+
// @__NO_SIDE_EFFECTS__
|
|
472
|
+
export function safeExtend(schema, shape) {
|
|
473
|
+
return util.safeExtend(schema, shape);
|
|
474
|
+
}
|
|
475
|
+
/**
|
|
476
|
+
* @deprecated Use [`z.extend(A, B.shape)`](https://zod.dev/api?id=extend) instead.
|
|
477
|
+
*/
|
|
478
|
+
// @__NO_SIDE_EFFECTS__
|
|
479
|
+
export function merge(a, b) {
|
|
480
|
+
return util.merge(a, b);
|
|
481
|
+
}
|
|
482
|
+
// @__NO_SIDE_EFFECTS__
|
|
483
|
+
export function pick(schema, mask) {
|
|
484
|
+
return util.pick(schema, mask);
|
|
485
|
+
}
|
|
486
|
+
// .omit
|
|
487
|
+
// @__NO_SIDE_EFFECTS__
|
|
488
|
+
export function omit(schema, mask) {
|
|
489
|
+
return util.omit(schema, mask);
|
|
490
|
+
}
|
|
491
|
+
// @__NO_SIDE_EFFECTS__
|
|
492
|
+
export function partial(schema, mask) {
|
|
493
|
+
const def = schema._zod.def;
|
|
494
|
+
if (def.type !== "tuple")
|
|
495
|
+
return util.partial(ZodMiniOptional, schema, mask);
|
|
496
|
+
// a refinement was authored against the full arity; partialing would run it on a shorter array
|
|
497
|
+
if (def.checks?.length)
|
|
498
|
+
throw new Error(".partial() cannot be used on tuple schemas containing refinements");
|
|
499
|
+
return util.clone(schema, {
|
|
500
|
+
...def,
|
|
501
|
+
items: def.items.map((item) => new ZodMiniOptional({ type: "optional", innerType: item })),
|
|
502
|
+
});
|
|
503
|
+
}
|
|
504
|
+
// @__NO_SIDE_EFFECTS__
|
|
505
|
+
export function exactPartial(schema, mask) {
|
|
506
|
+
return util.partial(ZodMiniExactOptional, schema, mask, "exactPartial");
|
|
507
|
+
}
|
|
508
|
+
// @__NO_SIDE_EFFECTS__
|
|
509
|
+
export function required(schema, mask) {
|
|
510
|
+
return util.required(ZodMiniNonOptional, schema, mask);
|
|
511
|
+
}
|
|
512
|
+
// @__NO_SIDE_EFFECTS__
|
|
513
|
+
export function catchall(inst, catchall) {
|
|
514
|
+
return inst.clone({ ...inst._zod.def, catchall: catchall });
|
|
515
|
+
}
|
|
516
|
+
export const ZodMiniUnion = /*@__PURE__*/ core.$constructor("ZodMiniUnion", (inst, def) => {
|
|
517
|
+
core.$ZodUnion.init(inst, def);
|
|
518
|
+
ZodMiniType.init(inst, def);
|
|
519
|
+
});
|
|
520
|
+
// @__NO_SIDE_EFFECTS__
|
|
521
|
+
export function union(options, params) {
|
|
522
|
+
return new ZodMiniUnion({
|
|
523
|
+
type: "union",
|
|
524
|
+
options: options,
|
|
525
|
+
...util.normalizeParams(params),
|
|
526
|
+
});
|
|
527
|
+
}
|
|
528
|
+
export const ZodMiniXor = /*@__PURE__*/ core.$constructor("ZodMiniXor", (inst, def) => {
|
|
529
|
+
ZodMiniUnion.init(inst, def);
|
|
530
|
+
core.$ZodXor.init(inst, def);
|
|
531
|
+
});
|
|
532
|
+
/** Creates an exclusive union (XOR) where exactly one option must match.
|
|
533
|
+
* Unlike regular unions that succeed when any option matches, xor fails if
|
|
534
|
+
* zero or more than one option matches the input. */
|
|
535
|
+
export function xor(options, params) {
|
|
536
|
+
return new ZodMiniXor({
|
|
537
|
+
type: "union",
|
|
538
|
+
options: options,
|
|
539
|
+
inclusive: false,
|
|
540
|
+
...util.normalizeParams(params),
|
|
541
|
+
});
|
|
542
|
+
}
|
|
543
|
+
export const ZodMiniDiscriminatedUnion = /*@__PURE__*/ core.$constructor("ZodMiniDiscriminatedUnion", (inst, def) => {
|
|
544
|
+
core.$ZodDiscriminatedUnion.init(inst, def);
|
|
545
|
+
ZodMiniType.init(inst, def);
|
|
546
|
+
});
|
|
547
|
+
// @__NO_SIDE_EFFECTS__
|
|
548
|
+
export function discriminatedUnion(discriminator, options, params) {
|
|
549
|
+
return new ZodMiniDiscriminatedUnion({
|
|
550
|
+
type: "union",
|
|
551
|
+
options: options,
|
|
552
|
+
discriminator,
|
|
553
|
+
...util.normalizeParams(params),
|
|
554
|
+
});
|
|
555
|
+
}
|
|
556
|
+
export const ZodMiniIntersection = /*@__PURE__*/ core.$constructor("ZodMiniIntersection", (inst, def) => {
|
|
557
|
+
core.$ZodIntersection.init(inst, def);
|
|
558
|
+
ZodMiniType.init(inst, def);
|
|
559
|
+
});
|
|
560
|
+
// @__NO_SIDE_EFFECTS__
|
|
561
|
+
export function intersection(left, right) {
|
|
562
|
+
return new ZodMiniIntersection({
|
|
563
|
+
type: "intersection",
|
|
564
|
+
left: left,
|
|
565
|
+
right: right,
|
|
566
|
+
});
|
|
567
|
+
}
|
|
568
|
+
export const ZodMiniTuple = /*@__PURE__*/ core.$constructor("ZodMiniTuple", (inst, def) => {
|
|
569
|
+
core.$ZodTuple.init(inst, def);
|
|
570
|
+
ZodMiniType.init(inst, def);
|
|
571
|
+
});
|
|
572
|
+
// @__NO_SIDE_EFFECTS__
|
|
573
|
+
export function tuple(items, _paramsOrRest, _params) {
|
|
574
|
+
const hasRest = _paramsOrRest instanceof core.$ZodType;
|
|
575
|
+
const params = hasRest ? _params : _paramsOrRest;
|
|
576
|
+
const rest = hasRest ? _paramsOrRest : null;
|
|
577
|
+
return new ZodMiniTuple({
|
|
578
|
+
type: "tuple",
|
|
579
|
+
items: items,
|
|
580
|
+
rest,
|
|
581
|
+
...util.normalizeParams(params),
|
|
582
|
+
});
|
|
583
|
+
}
|
|
584
|
+
export const ZodMiniRecord = /*@__PURE__*/ core.$constructor("ZodMiniRecord", (inst, def) => {
|
|
585
|
+
core.$ZodRecord.init(inst, def);
|
|
586
|
+
ZodMiniType.init(inst, def);
|
|
587
|
+
});
|
|
588
|
+
// @__NO_SIDE_EFFECTS__
|
|
589
|
+
export function record(keyType, valueType, params) {
|
|
590
|
+
// v3-compat: z.record(valueType, params?) — defaults keyType to z.string()
|
|
591
|
+
if (!valueType || !valueType._zod) {
|
|
592
|
+
return new ZodMiniRecord({
|
|
593
|
+
type: "record",
|
|
594
|
+
keyType: string(),
|
|
595
|
+
valueType: keyType,
|
|
596
|
+
...util.normalizeParams(valueType),
|
|
597
|
+
});
|
|
598
|
+
}
|
|
599
|
+
return new ZodMiniRecord({
|
|
600
|
+
type: "record",
|
|
601
|
+
keyType,
|
|
602
|
+
valueType: valueType,
|
|
603
|
+
...util.normalizeParams(params),
|
|
604
|
+
});
|
|
605
|
+
}
|
|
606
|
+
// @__NO_SIDE_EFFECTS__
|
|
607
|
+
export function partialRecord(keyType, valueType, params) {
|
|
608
|
+
return new ZodMiniRecord({
|
|
609
|
+
type: "record",
|
|
610
|
+
keyType,
|
|
611
|
+
valueType: valueType,
|
|
612
|
+
...util.normalizeParams(params),
|
|
613
|
+
partial: true,
|
|
614
|
+
});
|
|
615
|
+
}
|
|
616
|
+
export function looseRecord(keyType, valueType, params) {
|
|
617
|
+
return new ZodMiniRecord({
|
|
618
|
+
type: "record",
|
|
619
|
+
keyType,
|
|
620
|
+
valueType: valueType,
|
|
621
|
+
mode: "loose",
|
|
622
|
+
...util.normalizeParams(params),
|
|
623
|
+
});
|
|
624
|
+
}
|
|
625
|
+
export const ZodMiniMap = /*@__PURE__*/ core.$constructor("ZodMiniMap", (inst, def) => {
|
|
626
|
+
core.$ZodMap.init(inst, def);
|
|
627
|
+
ZodMiniType.init(inst, def);
|
|
628
|
+
});
|
|
629
|
+
// @__NO_SIDE_EFFECTS__
|
|
630
|
+
export function map(keyType, valueType, params) {
|
|
631
|
+
return new ZodMiniMap({
|
|
632
|
+
type: "map",
|
|
633
|
+
keyType: keyType,
|
|
634
|
+
valueType: valueType,
|
|
635
|
+
...util.normalizeParams(params),
|
|
636
|
+
});
|
|
637
|
+
}
|
|
638
|
+
export const ZodMiniSet = /*@__PURE__*/ core.$constructor("ZodMiniSet", (inst, def) => {
|
|
639
|
+
core.$ZodSet.init(inst, def);
|
|
640
|
+
ZodMiniType.init(inst, def);
|
|
641
|
+
});
|
|
642
|
+
// @__NO_SIDE_EFFECTS__
|
|
643
|
+
export function set(valueType, params) {
|
|
644
|
+
return new ZodMiniSet({
|
|
645
|
+
type: "set",
|
|
646
|
+
valueType: valueType,
|
|
647
|
+
...util.normalizeParams(params),
|
|
648
|
+
});
|
|
649
|
+
}
|
|
650
|
+
export const ZodMiniEnum = /*@__PURE__*/ core.$constructor("ZodMiniEnum", (inst, def) => {
|
|
651
|
+
core.$ZodEnum.init(inst, def);
|
|
652
|
+
ZodMiniType.init(inst, def);
|
|
653
|
+
inst.options = Object.values(def.entries);
|
|
654
|
+
});
|
|
655
|
+
// @__NO_SIDE_EFFECTS__
|
|
656
|
+
function _enum(values, params) {
|
|
657
|
+
const entries = Array.isArray(values) ? Object.fromEntries(values.map((v) => [v, v])) : values;
|
|
658
|
+
return new ZodMiniEnum({
|
|
659
|
+
type: "enum",
|
|
660
|
+
entries,
|
|
661
|
+
...util.normalizeParams(params),
|
|
662
|
+
});
|
|
663
|
+
}
|
|
664
|
+
export { _enum as enum };
|
|
665
|
+
// @__NO_SIDE_EFFECTS__
|
|
666
|
+
/** @deprecated This API has been merged into `z.enum()`. Use `z.enum()` instead.
|
|
667
|
+
*
|
|
668
|
+
* ```ts
|
|
669
|
+
* enum Colors { red, green, blue }
|
|
670
|
+
* z.enum(Colors);
|
|
671
|
+
* ```
|
|
672
|
+
*/
|
|
673
|
+
export function nativeEnum(entries, params) {
|
|
674
|
+
return new ZodMiniEnum({
|
|
675
|
+
type: "enum",
|
|
676
|
+
entries,
|
|
677
|
+
...util.normalizeParams(params),
|
|
678
|
+
});
|
|
679
|
+
}
|
|
680
|
+
export const ZodMiniLiteral = /*@__PURE__*/ core.$constructor("ZodMiniLiteral", (inst, def) => {
|
|
681
|
+
core.$ZodLiteral.init(inst, def);
|
|
682
|
+
ZodMiniType.init(inst, def);
|
|
683
|
+
});
|
|
684
|
+
// @__NO_SIDE_EFFECTS__
|
|
685
|
+
export function literal(value, params) {
|
|
686
|
+
return new ZodMiniLiteral({
|
|
687
|
+
type: "literal",
|
|
688
|
+
values: Array.isArray(value) ? value : [value],
|
|
689
|
+
...util.normalizeParams(params),
|
|
690
|
+
});
|
|
691
|
+
}
|
|
692
|
+
export const ZodMiniFile = /*@__PURE__*/ core.$constructor("ZodMiniFile", (inst, def) => {
|
|
693
|
+
core.$ZodFile.init(inst, def);
|
|
694
|
+
ZodMiniType.init(inst, def);
|
|
695
|
+
});
|
|
696
|
+
// @__NO_SIDE_EFFECTS__
|
|
697
|
+
export function file(params) {
|
|
698
|
+
return core._file(ZodMiniFile, params);
|
|
699
|
+
}
|
|
700
|
+
export const ZodMiniTransform = /*@__PURE__*/ core.$constructor("ZodMiniTransform", (inst, def) => {
|
|
701
|
+
core.$ZodTransform.init(inst, def);
|
|
702
|
+
ZodMiniType.init(inst, def);
|
|
703
|
+
});
|
|
704
|
+
// @__NO_SIDE_EFFECTS__
|
|
705
|
+
export function transform(fn) {
|
|
706
|
+
return new ZodMiniTransform({
|
|
707
|
+
type: "transform",
|
|
708
|
+
transform: fn,
|
|
709
|
+
});
|
|
710
|
+
}
|
|
711
|
+
export const ZodMiniOptional = /*@__PURE__*/ core.$constructor("ZodMiniOptional", (inst, def) => {
|
|
712
|
+
core.$ZodOptional.init(inst, def);
|
|
713
|
+
ZodMiniType.init(inst, def);
|
|
714
|
+
});
|
|
715
|
+
// @__NO_SIDE_EFFECTS__
|
|
716
|
+
export function optional(innerType) {
|
|
717
|
+
return new ZodMiniOptional({
|
|
718
|
+
type: "optional",
|
|
719
|
+
innerType: innerType,
|
|
720
|
+
});
|
|
721
|
+
}
|
|
722
|
+
export const ZodMiniExactOptional = /*@__PURE__*/ core.$constructor("ZodMiniExactOptional", (inst, def) => {
|
|
723
|
+
core.$ZodExactOptional.init(inst, def);
|
|
724
|
+
ZodMiniType.init(inst, def);
|
|
725
|
+
});
|
|
726
|
+
// @__NO_SIDE_EFFECTS__
|
|
727
|
+
export function exactOptional(innerType) {
|
|
728
|
+
return new ZodMiniExactOptional({
|
|
729
|
+
type: "optional",
|
|
730
|
+
innerType: innerType,
|
|
731
|
+
});
|
|
732
|
+
}
|
|
733
|
+
export const ZodMiniNullable = /*@__PURE__*/ core.$constructor("ZodMiniNullable", (inst, def) => {
|
|
734
|
+
core.$ZodNullable.init(inst, def);
|
|
735
|
+
ZodMiniType.init(inst, def);
|
|
736
|
+
});
|
|
737
|
+
// @__NO_SIDE_EFFECTS__
|
|
738
|
+
export function nullable(innerType) {
|
|
739
|
+
return new ZodMiniNullable({
|
|
740
|
+
type: "nullable",
|
|
741
|
+
innerType: innerType,
|
|
742
|
+
});
|
|
743
|
+
}
|
|
744
|
+
// nullish
|
|
745
|
+
// @__NO_SIDE_EFFECTS__
|
|
746
|
+
export function nullish(innerType) {
|
|
747
|
+
return optional(nullable(innerType));
|
|
748
|
+
}
|
|
749
|
+
export const ZodMiniDefault = /*@__PURE__*/ core.$constructor("ZodMiniDefault", (inst, def) => {
|
|
750
|
+
core.$ZodDefault.init(inst, def);
|
|
751
|
+
ZodMiniType.init(inst, def);
|
|
752
|
+
});
|
|
753
|
+
// @__NO_SIDE_EFFECTS__
|
|
754
|
+
export function _default(innerType, defaultValue) {
|
|
755
|
+
return new ZodMiniDefault({
|
|
756
|
+
type: "default",
|
|
757
|
+
innerType: innerType,
|
|
758
|
+
get defaultValue() {
|
|
759
|
+
return typeof defaultValue === "function" ? defaultValue() : util.shallowClone(defaultValue);
|
|
760
|
+
},
|
|
761
|
+
});
|
|
762
|
+
}
|
|
763
|
+
export const ZodMiniPrefault = /*@__PURE__*/ core.$constructor("ZodMiniPrefault", (inst, def) => {
|
|
764
|
+
core.$ZodPrefault.init(inst, def);
|
|
765
|
+
ZodMiniType.init(inst, def);
|
|
766
|
+
});
|
|
767
|
+
// @__NO_SIDE_EFFECTS__
|
|
768
|
+
export function prefault(innerType, defaultValue) {
|
|
769
|
+
return new ZodMiniPrefault({
|
|
770
|
+
type: "prefault",
|
|
771
|
+
innerType: innerType,
|
|
772
|
+
get defaultValue() {
|
|
773
|
+
return typeof defaultValue === "function" ? defaultValue() : util.shallowClone(defaultValue);
|
|
774
|
+
},
|
|
775
|
+
});
|
|
776
|
+
}
|
|
777
|
+
export const ZodMiniNonOptional = /*@__PURE__*/ core.$constructor("ZodMiniNonOptional", (inst, def) => {
|
|
778
|
+
core.$ZodNonOptional.init(inst, def);
|
|
779
|
+
ZodMiniType.init(inst, def);
|
|
780
|
+
});
|
|
781
|
+
// @__NO_SIDE_EFFECTS__
|
|
782
|
+
export function nonoptional(innerType, params) {
|
|
783
|
+
return new ZodMiniNonOptional({
|
|
784
|
+
type: "nonoptional",
|
|
785
|
+
innerType: innerType,
|
|
786
|
+
...util.normalizeParams(params),
|
|
787
|
+
});
|
|
788
|
+
}
|
|
789
|
+
export const ZodMiniSuccess = /*@__PURE__*/ core.$constructor("ZodMiniSuccess", (inst, def) => {
|
|
790
|
+
core.$ZodSuccess.init(inst, def);
|
|
791
|
+
ZodMiniType.init(inst, def);
|
|
792
|
+
});
|
|
793
|
+
// @__NO_SIDE_EFFECTS__
|
|
794
|
+
export function success(innerType) {
|
|
795
|
+
return new ZodMiniSuccess({
|
|
796
|
+
type: "success",
|
|
797
|
+
innerType: innerType,
|
|
798
|
+
});
|
|
799
|
+
}
|
|
800
|
+
export const ZodMiniCatch = /*@__PURE__*/ core.$constructor("ZodMiniCatch", (inst, def) => {
|
|
801
|
+
core.$ZodCatch.init(inst, def);
|
|
802
|
+
ZodMiniType.init(inst, def);
|
|
803
|
+
});
|
|
804
|
+
// @__NO_SIDE_EFFECTS__
|
|
805
|
+
function _catch(innerType, catchValue) {
|
|
806
|
+
return new ZodMiniCatch({
|
|
807
|
+
type: "catch",
|
|
808
|
+
innerType: innerType,
|
|
809
|
+
catchValue: (typeof catchValue === "function" ? catchValue : core.util.constantCatch(catchValue)),
|
|
810
|
+
});
|
|
811
|
+
}
|
|
812
|
+
export { _catch as catch };
|
|
813
|
+
export const ZodMiniNaN = /*@__PURE__*/ core.$constructor("ZodMiniNaN", (inst, def) => {
|
|
814
|
+
core.$ZodNaN.init(inst, def);
|
|
815
|
+
ZodMiniType.init(inst, def);
|
|
816
|
+
});
|
|
817
|
+
// @__NO_SIDE_EFFECTS__
|
|
818
|
+
export function nan(params) {
|
|
819
|
+
return core._nan(ZodMiniNaN, params);
|
|
820
|
+
}
|
|
821
|
+
export const ZodMiniPipe = /*@__PURE__*/ core.$constructor("ZodMiniPipe", (inst, def) => {
|
|
822
|
+
core.$ZodPipe.init(inst, def);
|
|
823
|
+
ZodMiniType.init(inst, def);
|
|
824
|
+
});
|
|
825
|
+
// @__NO_SIDE_EFFECTS__
|
|
826
|
+
export function pipe(in_, out) {
|
|
827
|
+
return new ZodMiniPipe({
|
|
828
|
+
type: "pipe",
|
|
829
|
+
in: in_,
|
|
830
|
+
out: out,
|
|
831
|
+
});
|
|
832
|
+
}
|
|
833
|
+
export const ZodMiniCodec = /*@__PURE__*/ core.$constructor("ZodMiniCodec", (inst, def) => {
|
|
834
|
+
ZodMiniPipe.init(inst, def);
|
|
835
|
+
core.$ZodCodec.init(inst, def);
|
|
836
|
+
});
|
|
837
|
+
// @__NO_SIDE_EFFECTS__
|
|
838
|
+
export function codec(in_, out, params) {
|
|
839
|
+
return new ZodMiniCodec({
|
|
840
|
+
type: "pipe",
|
|
841
|
+
in: in_,
|
|
842
|
+
out: out,
|
|
843
|
+
transform: params.decode,
|
|
844
|
+
reverseTransform: params.encode,
|
|
845
|
+
});
|
|
846
|
+
}
|
|
847
|
+
// @__NO_SIDE_EFFECTS__
|
|
848
|
+
export function invertCodec(codec) {
|
|
849
|
+
const def = codec._zod.def;
|
|
850
|
+
return new ZodMiniCodec({
|
|
851
|
+
type: "pipe",
|
|
852
|
+
in: def.out,
|
|
853
|
+
out: def.in,
|
|
854
|
+
transform: def.reverseTransform,
|
|
855
|
+
reverseTransform: def.transform,
|
|
856
|
+
});
|
|
857
|
+
}
|
|
858
|
+
export const ZodMiniReadonly = /*@__PURE__*/ core.$constructor("ZodMiniReadonly", (inst, def) => {
|
|
859
|
+
core.$ZodReadonly.init(inst, def);
|
|
860
|
+
ZodMiniType.init(inst, def);
|
|
861
|
+
});
|
|
862
|
+
// @__NO_SIDE_EFFECTS__
|
|
863
|
+
export function readonly(innerType) {
|
|
864
|
+
return new ZodMiniReadonly({
|
|
865
|
+
type: "readonly",
|
|
866
|
+
innerType: innerType,
|
|
867
|
+
});
|
|
868
|
+
}
|
|
869
|
+
export const ZodMiniTemplateLiteral = /*@__PURE__*/ core.$constructor("ZodMiniTemplateLiteral", (inst, def) => {
|
|
870
|
+
core.$ZodTemplateLiteral.init(inst, def);
|
|
871
|
+
ZodMiniType.init(inst, def);
|
|
872
|
+
});
|
|
873
|
+
// @__NO_SIDE_EFFECTS__
|
|
874
|
+
export function templateLiteral(parts, params) {
|
|
875
|
+
return new ZodMiniTemplateLiteral({
|
|
876
|
+
type: "template_literal",
|
|
877
|
+
parts,
|
|
878
|
+
...util.normalizeParams(params),
|
|
879
|
+
});
|
|
880
|
+
}
|
|
881
|
+
export const ZodMiniLazy = /*@__PURE__*/ core.$constructor("ZodMiniLazy", (inst, def) => {
|
|
882
|
+
core.$ZodLazy.init(inst, def);
|
|
883
|
+
ZodMiniType.init(inst, def);
|
|
884
|
+
});
|
|
885
|
+
// export function lazy<T extends object>(getter: () => T): T {
|
|
886
|
+
// return util.createTransparentProxy<T>(getter);
|
|
887
|
+
// }
|
|
888
|
+
// @__NO_SIDE_EFFECTS__
|
|
889
|
+
function _lazy(getter) {
|
|
890
|
+
return new ZodMiniLazy({
|
|
891
|
+
type: "lazy",
|
|
892
|
+
getter: getter,
|
|
893
|
+
});
|
|
894
|
+
}
|
|
895
|
+
export { _lazy as lazy };
|
|
896
|
+
export const ZodMiniPromise = /*@__PURE__*/ core.$constructor("ZodMiniPromise", (inst, def) => {
|
|
897
|
+
core.$ZodPromise.init(inst, def);
|
|
898
|
+
ZodMiniType.init(inst, def);
|
|
899
|
+
});
|
|
900
|
+
// @__NO_SIDE_EFFECTS__
|
|
901
|
+
export function promise(innerType) {
|
|
902
|
+
return new ZodMiniPromise({
|
|
903
|
+
type: "promise",
|
|
904
|
+
innerType: innerType,
|
|
905
|
+
});
|
|
906
|
+
}
|
|
907
|
+
export const ZodMiniCustom = /*@__PURE__*/ core.$constructor("ZodMiniCustom", (inst, def) => {
|
|
908
|
+
core.$ZodCustom.init(inst, def);
|
|
909
|
+
ZodMiniType.init(inst, def);
|
|
910
|
+
});
|
|
911
|
+
// custom checks
|
|
912
|
+
// @__NO_SIDE_EFFECTS__
|
|
913
|
+
export function check(fn, params) {
|
|
914
|
+
const ch = new core.$ZodCheck({
|
|
915
|
+
check: "custom",
|
|
916
|
+
...util.normalizeParams(params),
|
|
917
|
+
});
|
|
918
|
+
ch._zod.check = fn;
|
|
919
|
+
return ch;
|
|
920
|
+
}
|
|
921
|
+
// ZodCustom custom schema
|
|
922
|
+
// @__NO_SIDE_EFFECTS__
|
|
923
|
+
export function custom(fn, _params) {
|
|
924
|
+
return core._custom(ZodMiniCustom, fn ?? (() => true), _params);
|
|
925
|
+
}
|
|
926
|
+
// refine
|
|
927
|
+
// @__NO_SIDE_EFFECTS__
|
|
928
|
+
export function refine(fn, _params = {}) {
|
|
929
|
+
return core._refine(ZodMiniCustom, fn, _params);
|
|
930
|
+
}
|
|
931
|
+
// superRefine
|
|
932
|
+
// @__NO_SIDE_EFFECTS__
|
|
933
|
+
export function superRefine(fn, params) {
|
|
934
|
+
return core._superRefine(fn, params);
|
|
935
|
+
}
|
|
936
|
+
// Re-export describe and meta from core
|
|
937
|
+
export const describe = core.describe;
|
|
938
|
+
export const meta = core.meta;
|
|
939
|
+
// instanceof
|
|
940
|
+
class Class {
|
|
941
|
+
constructor(..._args) { }
|
|
942
|
+
}
|
|
943
|
+
// @__NO_SIDE_EFFECTS__
|
|
944
|
+
function _instanceof(cls, params = {}) {
|
|
945
|
+
const inst = custom((data) => data instanceof cls, params);
|
|
946
|
+
inst._zod.bag.Class = cls;
|
|
947
|
+
// Override check to emit invalid_type instead of custom
|
|
948
|
+
inst._zod.check = (payload) => {
|
|
949
|
+
if (!(payload.value instanceof cls)) {
|
|
950
|
+
payload.issues.push({
|
|
951
|
+
code: "invalid_type",
|
|
952
|
+
expected: cls.name,
|
|
953
|
+
input: payload.value,
|
|
954
|
+
inst,
|
|
955
|
+
path: [...(inst._zod.def.path ?? [])],
|
|
956
|
+
});
|
|
957
|
+
}
|
|
958
|
+
};
|
|
959
|
+
return inst;
|
|
960
|
+
}
|
|
961
|
+
export { _instanceof as instanceof };
|
|
962
|
+
// stringbool
|
|
963
|
+
export const stringbool = (...args) => core._stringbool({
|
|
964
|
+
Codec: ZodMiniCodec,
|
|
965
|
+
Boolean: ZodMiniBoolean,
|
|
966
|
+
String: ZodMiniString,
|
|
967
|
+
}, ...args);
|
|
968
|
+
// @__NO_SIDE_EFFECTS__
|
|
969
|
+
export function json() {
|
|
970
|
+
const jsonSchema = _lazy(() => {
|
|
971
|
+
return union([string(), number(), boolean(), _null(), array(jsonSchema), record(string(), jsonSchema)]);
|
|
972
|
+
});
|
|
973
|
+
return jsonSchema;
|
|
974
|
+
}
|
|
975
|
+
export const ZodMiniFunction = /*@__PURE__*/ core.$constructor("ZodMiniFunction", (inst, def) => {
|
|
976
|
+
core.$ZodFunction.init(inst, def);
|
|
977
|
+
ZodMiniType.init(inst, def);
|
|
978
|
+
});
|
|
979
|
+
// @__NO_SIDE_EFFECTS__
|
|
980
|
+
export function _function(params) {
|
|
981
|
+
return new ZodMiniFunction({
|
|
982
|
+
type: "function",
|
|
983
|
+
input: Array.isArray(params?.input) ? tuple(params?.input) : (params?.input ?? array(unknown())),
|
|
984
|
+
output: params?.output ?? unknown(),
|
|
985
|
+
});
|
|
986
|
+
}
|
|
987
|
+
export { _function as function };
|