@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,82 @@
|
|
|
1
|
+
import type * as errors from "./errors.js";
|
|
2
|
+
import type * as schemas from "./schemas.js";
|
|
3
|
+
import type { Class, ProtoOf } from "./util.js";
|
|
4
|
+
type ZodTrait = {
|
|
5
|
+
_zod: {
|
|
6
|
+
def: any;
|
|
7
|
+
[k: string]: any;
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
export interface $constructor<T extends ZodTrait, D = T["_zod"]["def"]> {
|
|
11
|
+
new (def: D): T;
|
|
12
|
+
init(inst: T, def: D): asserts inst is T;
|
|
13
|
+
}
|
|
14
|
+
export interface $constructorParams {
|
|
15
|
+
Parent?: typeof Class;
|
|
16
|
+
}
|
|
17
|
+
/** A special constant with type `never` */
|
|
18
|
+
export declare const NEVER: never;
|
|
19
|
+
export declare function $constructor<T extends ZodTrait, D = T["_zod"]["def"]>(name: string, initializer: (inst: T, def: D) => void,
|
|
20
|
+
/** This trait's members, installed once on every prototype that composes it. They cannot be declared in the initializer above: that runs per instance, and the prototype is shared. */
|
|
21
|
+
proto?: ProtoOf<T>, params?: $constructorParams): $constructor<T, D>;
|
|
22
|
+
export declare const $brand: unique symbol;
|
|
23
|
+
export type $brand<T extends string | number | symbol = string | number | symbol> = {
|
|
24
|
+
[$brand]: {
|
|
25
|
+
[k in T]: true;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
export type $ZodBranded<T extends schemas.SomeType, Brand extends string | number | symbol, Dir extends "in" | "out" | "inout" = "out"> = T & (Dir extends "inout" ? {
|
|
29
|
+
_zod: {
|
|
30
|
+
input: input<T> & $brand<Brand>;
|
|
31
|
+
output: output<T> & $brand<Brand>;
|
|
32
|
+
};
|
|
33
|
+
} : Dir extends "in" ? {
|
|
34
|
+
_zod: {
|
|
35
|
+
input: input<T> & $brand<Brand>;
|
|
36
|
+
};
|
|
37
|
+
} : {
|
|
38
|
+
_zod: {
|
|
39
|
+
output: output<T> & $brand<Brand>;
|
|
40
|
+
};
|
|
41
|
+
});
|
|
42
|
+
export type $ZodNarrow<T extends schemas.SomeType, Out> = T & {
|
|
43
|
+
_zod: {
|
|
44
|
+
output: Out;
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
export declare class $ZodAsyncError extends Error {
|
|
48
|
+
constructor();
|
|
49
|
+
}
|
|
50
|
+
export declare class $ZodEncodeError extends Error {
|
|
51
|
+
constructor(name: string);
|
|
52
|
+
}
|
|
53
|
+
export type input<T> = T extends {
|
|
54
|
+
_zod: {
|
|
55
|
+
input: any;
|
|
56
|
+
};
|
|
57
|
+
} ? T["_zod"]["input"] : unknown;
|
|
58
|
+
export type output<T> = T extends {
|
|
59
|
+
_zod: {
|
|
60
|
+
output: any;
|
|
61
|
+
};
|
|
62
|
+
} ? T["_zod"]["output"] : unknown;
|
|
63
|
+
export type { output as infer };
|
|
64
|
+
export interface $ZodConfig {
|
|
65
|
+
/** Custom error map. Overrides `config().localeError`. */
|
|
66
|
+
customError?: errors.$ZodErrorMap | undefined;
|
|
67
|
+
/** Localized error map. Lowest priority. */
|
|
68
|
+
localeError?: errors.$ZodErrorMap | undefined;
|
|
69
|
+
/** Disable JIT schema compilation. Useful in environments that disallow `eval`. */
|
|
70
|
+
jitless?: boolean | undefined;
|
|
71
|
+
/** Enables parsing input that contains reference cycles. Read when a schema is constructed. */
|
|
72
|
+
memoizer?: schemas.$ZodMemoizer | undefined;
|
|
73
|
+
/**
|
|
74
|
+
* Internal: post-processor invoked on every freshly-constructed schema
|
|
75
|
+
* instance, after init and deferred fns run. Set by `import "zod/compile"`
|
|
76
|
+
* to install AOT compilation. Not part of the public API.
|
|
77
|
+
* @internal
|
|
78
|
+
*/
|
|
79
|
+
postProcessor?: ((inst: any) => void) | undefined;
|
|
80
|
+
}
|
|
81
|
+
export declare const globalConfig: $ZodConfig;
|
|
82
|
+
export declare function config(newConfig?: Partial<$ZodConfig>): $ZodConfig;
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
var _a;
|
|
2
|
+
import { members as installMembers } from "./util.js";
|
|
3
|
+
/** A special constant with type `never` */
|
|
4
|
+
export const NEVER = /*@__PURE__*/ Object.freeze({
|
|
5
|
+
status: "aborted",
|
|
6
|
+
});
|
|
7
|
+
/* Shared descriptor for installing `_zod`; defineProperty reads it
|
|
8
|
+
* synchronously, so reusing one object avoids a per-instance allocation. */
|
|
9
|
+
const _zodDesc = { value: undefined, enumerable: false };
|
|
10
|
+
// null where suppressing the capture would be unrecoverable: `parse()` puts the frames back with `captureStackTrace`, so without it the throw would lose its stack. also latched to null once `stackTraceLimit` proves unassignable, which a realm can do at any point by hardening Error
|
|
11
|
+
let _E = "captureStackTrace" in Error ? Error : null;
|
|
12
|
+
// v8 captures a stack trace inside the Error constructor, which dominates a failed parse; costs only the frames, and parse() restores those. the constructor must RUN: Object.create is cheaper and passes instanceof, but Error.isError and util.types.isNativeError check an internal slot
|
|
13
|
+
function newError(Definition) {
|
|
14
|
+
const E = _E;
|
|
15
|
+
if (E) {
|
|
16
|
+
const saved = E.stackTraceLimit;
|
|
17
|
+
if (typeof saved === "number") {
|
|
18
|
+
try {
|
|
19
|
+
E.stackTraceLimit = 0;
|
|
20
|
+
}
|
|
21
|
+
catch {
|
|
22
|
+
_E = null;
|
|
23
|
+
return new Definition();
|
|
24
|
+
}
|
|
25
|
+
try {
|
|
26
|
+
return new Definition();
|
|
27
|
+
}
|
|
28
|
+
finally {
|
|
29
|
+
E.stackTraceLimit = saved;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return new Definition();
|
|
34
|
+
}
|
|
35
|
+
export /*@__NO_SIDE_EFFECTS__*/ function $constructor(name, initializer,
|
|
36
|
+
/** This trait's members, installed once on every prototype that composes it. They cannot be declared in the initializer above: that runs per instance, and the prototype is shared. */
|
|
37
|
+
proto, params) {
|
|
38
|
+
// Prototype for this constructor's `_zod` internals. Lazily-derived fields (`values`, `pattern`, `optin`, …) install here once rather than as an accessor on every instance.
|
|
39
|
+
const zodProto = {};
|
|
40
|
+
// Assigning the fields in the constructor body is what gives instances in-object slots; building the object literally and reparenting it costs a second allocation and a generic property copy.
|
|
41
|
+
function Internals(def) {
|
|
42
|
+
this.def = def;
|
|
43
|
+
this.constr = _;
|
|
44
|
+
this.traits = new Set();
|
|
45
|
+
}
|
|
46
|
+
Internals.prototype = zodProto;
|
|
47
|
+
const protoMembers = proto;
|
|
48
|
+
// One trait's members land on every prototype whose chain composes it, so the answer is per prototype rather than per trait.
|
|
49
|
+
const initialized = protoMembers && new WeakSet();
|
|
50
|
+
function init(inst, def) {
|
|
51
|
+
if (!inst._zod) {
|
|
52
|
+
_zodDesc.value = new Internals(def);
|
|
53
|
+
try {
|
|
54
|
+
Object.defineProperty(inst, "_zod", _zodDesc);
|
|
55
|
+
}
|
|
56
|
+
finally {
|
|
57
|
+
// Cleared even on throw, so the shared descriptor never leaks one instance's internals into the next.
|
|
58
|
+
_zodDesc.value = undefined;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
if (inst._zod.traits.has(name)) {
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
inst._zod.traits.add(name);
|
|
65
|
+
initializer(inst, def);
|
|
66
|
+
if (initialized) {
|
|
67
|
+
// `super(def)` from a user subclass gives `this` a prototype the subclass owns, and installing there would overwrite whatever the subclass declared. `constr` built the instance, so its prototype is the one below the subclass's that should carry the members. A receiver whose chain never reaches that prototype installs on its own, which for a plain object handed straight to `init` means `Object.prototype` — unchanged from before.
|
|
68
|
+
const own = Object.getPrototypeOf(inst);
|
|
69
|
+
const ctorProto = inst._zod.constr.prototype;
|
|
70
|
+
let up = own;
|
|
71
|
+
while (up && up !== ctorProto)
|
|
72
|
+
up = Object.getPrototypeOf(up);
|
|
73
|
+
const target = up ?? own;
|
|
74
|
+
if (!initialized.has(target)) {
|
|
75
|
+
initialized.add(target);
|
|
76
|
+
installMembers(target, protoMembers);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
// support prototype modifications; for-in avoids the array allocation of Object.keys on the (usually empty) prototype
|
|
80
|
+
const proto = _.prototype;
|
|
81
|
+
for (const k in proto) {
|
|
82
|
+
if (!Object.prototype.hasOwnProperty.call(proto, k))
|
|
83
|
+
continue;
|
|
84
|
+
if (!(k in inst)) {
|
|
85
|
+
inst[k] = proto[k].bind(inst);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
// doesn't work if Parent has a constructor with arguments
|
|
90
|
+
const Parent = params?.Parent ?? Object;
|
|
91
|
+
class Definition extends Parent {
|
|
92
|
+
}
|
|
93
|
+
Object.defineProperty(Definition, "name", { value: name });
|
|
94
|
+
function _(def) {
|
|
95
|
+
const inst = params?.Parent ? newError(Definition) : this;
|
|
96
|
+
init(inst, def);
|
|
97
|
+
const deferred = inst._zod.deferred;
|
|
98
|
+
if (deferred) {
|
|
99
|
+
for (const fn of deferred) {
|
|
100
|
+
fn();
|
|
101
|
+
}
|
|
102
|
+
// Released: initializers run once, and the list would otherwise be retained for the schema's lifetime.
|
|
103
|
+
inst._zod.deferred = undefined;
|
|
104
|
+
}
|
|
105
|
+
// Global post-processor hook. Internal: installed by `import "zod/compile"` to enable AOT compilation for every constructed schema. Runs last, once the instance is fully built, because it hands the instance to compile(). The post-processor is expected to be reentrancy-guarded by its own implementation.
|
|
106
|
+
const pp = globalThis.__zod_globalConfig?.postProcessor;
|
|
107
|
+
if (pp)
|
|
108
|
+
pp(inst);
|
|
109
|
+
return inst;
|
|
110
|
+
}
|
|
111
|
+
Object.defineProperty(_, "init", { value: init });
|
|
112
|
+
Object.defineProperty(_, Symbol.hasInstance, {
|
|
113
|
+
value: (inst) => {
|
|
114
|
+
if (params?.Parent && inst instanceof params.Parent)
|
|
115
|
+
return true;
|
|
116
|
+
return inst?._zod?.traits?.has(name);
|
|
117
|
+
},
|
|
118
|
+
});
|
|
119
|
+
Object.defineProperty(_, "name", { value: name });
|
|
120
|
+
return _;
|
|
121
|
+
}
|
|
122
|
+
////////////////////////////// UTILITIES ///////////////////////////////////////
|
|
123
|
+
export const $brand = /*@__PURE__*/ Symbol("zod_brand");
|
|
124
|
+
export class $ZodAsyncError extends Error {
|
|
125
|
+
constructor() {
|
|
126
|
+
super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
export class $ZodEncodeError extends Error {
|
|
130
|
+
constructor(name) {
|
|
131
|
+
super(`Encountered unidirectional transform during encode: ${name}`);
|
|
132
|
+
this.name = "ZodEncodeError";
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
(_a = globalThis).__zod_globalConfig ?? (_a.__zod_globalConfig = {});
|
|
136
|
+
export const globalConfig = globalThis.__zod_globalConfig;
|
|
137
|
+
export function config(newConfig) {
|
|
138
|
+
if (newConfig)
|
|
139
|
+
Object.assign(globalConfig, newConfig);
|
|
140
|
+
return globalConfig;
|
|
141
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
type ModeWriter = (doc: Doc, modes: {
|
|
2
|
+
execution: "sync" | "async";
|
|
3
|
+
}) => void;
|
|
4
|
+
export declare class Doc {
|
|
5
|
+
args: string[];
|
|
6
|
+
/** Bindings the compiled function closes over, by name. */
|
|
7
|
+
closed: Record<string, unknown>;
|
|
8
|
+
content: string[];
|
|
9
|
+
indent: number;
|
|
10
|
+
constructor(args?: string[], closed?: Record<string, unknown>);
|
|
11
|
+
indented(fn: (doc: Doc) => void): void;
|
|
12
|
+
write(fn: ModeWriter): void;
|
|
13
|
+
write(line: string): void;
|
|
14
|
+
compile(): any;
|
|
15
|
+
}
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export class Doc {
|
|
2
|
+
constructor(args = [], closed = {}) {
|
|
3
|
+
this.content = [];
|
|
4
|
+
this.indent = 0;
|
|
5
|
+
this.args = args;
|
|
6
|
+
this.closed = closed;
|
|
7
|
+
}
|
|
8
|
+
indented(fn) {
|
|
9
|
+
this.indent += 1;
|
|
10
|
+
fn(this);
|
|
11
|
+
this.indent -= 1;
|
|
12
|
+
}
|
|
13
|
+
write(arg) {
|
|
14
|
+
if (typeof arg === "function") {
|
|
15
|
+
arg(this, { execution: "sync" });
|
|
16
|
+
arg(this, { execution: "async" });
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
const content = arg;
|
|
20
|
+
const lines = content.split("\n").filter((x) => x);
|
|
21
|
+
const minIndent = Math.min(...lines.map((x) => x.length - x.trimStart().length));
|
|
22
|
+
const dedented = lines.map((x) => x.slice(minIndent)).map((x) => " ".repeat(this.indent * 2) + x);
|
|
23
|
+
for (const line of dedented) {
|
|
24
|
+
this.content.push(line);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
compile() {
|
|
28
|
+
const F = Function;
|
|
29
|
+
const content = this?.content ?? [``];
|
|
30
|
+
const factory = new F(...Object.keys(this.closed), `return function (${this.args.join(", ")}) {\n${content.join("\n")}\n};`);
|
|
31
|
+
return factory(...Object.values(this.closed));
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
import type { $ZodCheck, $ZodStringFormats } from "./checks.js";
|
|
2
|
+
import { $constructor } from "./core.js";
|
|
3
|
+
import type { $ZodType } from "./schemas.js";
|
|
4
|
+
import type { StandardSchemaV1 } from "./standard-schema.js";
|
|
5
|
+
import * as util from "./util.js";
|
|
6
|
+
export interface $ZodIssueBase {
|
|
7
|
+
readonly code?: string;
|
|
8
|
+
readonly input?: unknown;
|
|
9
|
+
readonly path: PropertyKey[];
|
|
10
|
+
readonly message: string;
|
|
11
|
+
}
|
|
12
|
+
export type $ZodInvalidTypeExpected = "string" | "number" | "int" | "boolean" | "bigint" | "symbol" | "undefined" | "null" | "never" | "void" | "date" | "array" | "object" | "tuple" | "record" | "map" | "set" | "file" | "nonoptional" | "nan" | "function" | (string & {});
|
|
13
|
+
export interface $ZodIssueInvalidType<Input = unknown> extends $ZodIssueBase {
|
|
14
|
+
readonly code: "invalid_type";
|
|
15
|
+
readonly expected: $ZodInvalidTypeExpected;
|
|
16
|
+
readonly input?: Input;
|
|
17
|
+
}
|
|
18
|
+
export interface $ZodIssueTooBig<Input = unknown> extends $ZodIssueBase {
|
|
19
|
+
readonly code: "too_big";
|
|
20
|
+
readonly origin: "number" | "int" | "bigint" | "date" | "string" | "array" | "set" | "file" | (string & {});
|
|
21
|
+
readonly maximum: number | bigint;
|
|
22
|
+
readonly inclusive?: boolean;
|
|
23
|
+
readonly exact?: boolean;
|
|
24
|
+
readonly input?: Input;
|
|
25
|
+
}
|
|
26
|
+
export interface $ZodIssueTooSmall<Input = unknown> extends $ZodIssueBase {
|
|
27
|
+
readonly code: "too_small";
|
|
28
|
+
readonly origin: "number" | "int" | "bigint" | "date" | "string" | "array" | "set" | "file" | (string & {});
|
|
29
|
+
readonly minimum: number | bigint;
|
|
30
|
+
/** True if the allowable range includes the minimum */
|
|
31
|
+
readonly inclusive?: boolean;
|
|
32
|
+
/** True if the allowed value is fixed (e.g.` z.length(5)`), not a range (`z.minLength(5)`) */
|
|
33
|
+
readonly exact?: boolean;
|
|
34
|
+
readonly input?: Input;
|
|
35
|
+
}
|
|
36
|
+
export interface $ZodIssueInvalidStringFormat extends $ZodIssueBase {
|
|
37
|
+
readonly code: "invalid_format";
|
|
38
|
+
readonly format: $ZodStringFormats | (string & {});
|
|
39
|
+
readonly pattern?: string;
|
|
40
|
+
readonly input?: string;
|
|
41
|
+
}
|
|
42
|
+
export interface $ZodIssueNotMultipleOf<Input extends number | bigint = number | bigint> extends $ZodIssueBase {
|
|
43
|
+
readonly code: "not_multiple_of";
|
|
44
|
+
readonly divisor: number;
|
|
45
|
+
readonly input?: Input;
|
|
46
|
+
}
|
|
47
|
+
export interface $ZodIssueUnrecognizedKeys extends $ZodIssueBase {
|
|
48
|
+
readonly code: "unrecognized_keys";
|
|
49
|
+
readonly keys: string[];
|
|
50
|
+
readonly input?: Record<string, unknown>;
|
|
51
|
+
}
|
|
52
|
+
interface $ZodIssueInvalidUnionNoMatch extends $ZodIssueBase {
|
|
53
|
+
readonly code: "invalid_union";
|
|
54
|
+
readonly errors: $ZodIssue[][];
|
|
55
|
+
readonly input?: unknown;
|
|
56
|
+
readonly discriminator?: string | undefined;
|
|
57
|
+
readonly options?: util.Primitive[];
|
|
58
|
+
readonly inclusive?: true;
|
|
59
|
+
}
|
|
60
|
+
interface $ZodIssueInvalidUnionMultipleMatch extends $ZodIssueBase {
|
|
61
|
+
readonly code: "invalid_union";
|
|
62
|
+
readonly errors: [];
|
|
63
|
+
readonly input?: unknown;
|
|
64
|
+
readonly discriminator?: string | undefined;
|
|
65
|
+
readonly inclusive: false;
|
|
66
|
+
/** Indices of the options that matched */
|
|
67
|
+
readonly matches: number[];
|
|
68
|
+
}
|
|
69
|
+
export type $ZodIssueInvalidUnion = $ZodIssueInvalidUnionNoMatch | $ZodIssueInvalidUnionMultipleMatch;
|
|
70
|
+
export interface $ZodIssueInvalidKey<Input = unknown> extends $ZodIssueBase {
|
|
71
|
+
readonly code: "invalid_key";
|
|
72
|
+
readonly origin: "map" | "record";
|
|
73
|
+
readonly issues: $ZodIssue[];
|
|
74
|
+
readonly input?: Input;
|
|
75
|
+
}
|
|
76
|
+
export interface $ZodIssueInvalidElement<Input = unknown> extends $ZodIssueBase {
|
|
77
|
+
readonly code: "invalid_element";
|
|
78
|
+
readonly origin: "map" | "set";
|
|
79
|
+
readonly key: unknown;
|
|
80
|
+
readonly issues: $ZodIssue[];
|
|
81
|
+
readonly input?: Input;
|
|
82
|
+
}
|
|
83
|
+
export interface $ZodIssueInvalidValue<Input = unknown> extends $ZodIssueBase {
|
|
84
|
+
readonly code: "invalid_value";
|
|
85
|
+
readonly values: util.Primitive[];
|
|
86
|
+
readonly input?: Input;
|
|
87
|
+
}
|
|
88
|
+
export interface $ZodIssueCustom extends $ZodIssueBase {
|
|
89
|
+
readonly code: "custom";
|
|
90
|
+
readonly params?: Record<string, any> | undefined;
|
|
91
|
+
readonly input?: unknown;
|
|
92
|
+
}
|
|
93
|
+
export interface $ZodIssueStringCommonFormats extends $ZodIssueInvalidStringFormat {
|
|
94
|
+
format: Exclude<$ZodStringFormats, "regex" | "jwt" | "starts_with" | "ends_with" | "includes">;
|
|
95
|
+
}
|
|
96
|
+
export interface $ZodIssueStringInvalidRegex extends $ZodIssueInvalidStringFormat {
|
|
97
|
+
format: "regex";
|
|
98
|
+
pattern: string;
|
|
99
|
+
}
|
|
100
|
+
export interface $ZodIssueStringInvalidJWT extends $ZodIssueInvalidStringFormat {
|
|
101
|
+
format: "jwt";
|
|
102
|
+
algorithm?: string;
|
|
103
|
+
}
|
|
104
|
+
export interface $ZodIssueStringStartsWith extends $ZodIssueInvalidStringFormat {
|
|
105
|
+
format: "starts_with";
|
|
106
|
+
prefix: string;
|
|
107
|
+
}
|
|
108
|
+
export interface $ZodIssueStringEndsWith extends $ZodIssueInvalidStringFormat {
|
|
109
|
+
format: "ends_with";
|
|
110
|
+
suffix: string;
|
|
111
|
+
}
|
|
112
|
+
export interface $ZodIssueStringIncludes extends $ZodIssueInvalidStringFormat {
|
|
113
|
+
format: "includes";
|
|
114
|
+
includes: string;
|
|
115
|
+
}
|
|
116
|
+
export type $ZodStringFormatIssues = $ZodIssueStringCommonFormats | $ZodIssueStringInvalidRegex | $ZodIssueStringInvalidJWT | $ZodIssueStringStartsWith | $ZodIssueStringEndsWith | $ZodIssueStringIncludes;
|
|
117
|
+
export type $ZodIssue = $ZodIssueInvalidType | $ZodIssueTooBig | $ZodIssueTooSmall | $ZodIssueInvalidStringFormat | $ZodIssueNotMultipleOf | $ZodIssueUnrecognizedKeys | $ZodIssueInvalidUnion | $ZodIssueInvalidKey | $ZodIssueInvalidElement | $ZodIssueInvalidValue | $ZodIssueCustom;
|
|
118
|
+
export type $ZodIssueCode = $ZodIssue["code"];
|
|
119
|
+
export type $ZodInternalIssue<T extends $ZodIssueBase = $ZodIssue> = T extends any ? RawIssue<T> : never;
|
|
120
|
+
type RawIssue<T extends $ZodIssueBase> = T extends any ? util.Flatten<util.MakePartial<T, "message" | "path"> & {
|
|
121
|
+
/** The input data */
|
|
122
|
+
readonly input: unknown;
|
|
123
|
+
/** The schema or check that originated this issue. */
|
|
124
|
+
readonly inst?: $ZodType | $ZodCheck;
|
|
125
|
+
/** The schema that owns the issue. Equal to `inst` when a schema originated the issue, and the schema the check was attached to when a check did. */
|
|
126
|
+
readonly schema?: $ZodType | undefined;
|
|
127
|
+
/** If `true`, Zod will continue executing checks/refinements after this issue. */
|
|
128
|
+
readonly continue?: boolean | undefined;
|
|
129
|
+
} & Record<string, unknown>> : never;
|
|
130
|
+
export type $ZodRawIssue<T extends $ZodIssueBase = $ZodIssue> = $ZodInternalIssue<T>;
|
|
131
|
+
export interface $ZodErrorMap<T extends $ZodIssueBase = $ZodIssue> {
|
|
132
|
+
(issue: $ZodRawIssue<T>): {
|
|
133
|
+
message: string;
|
|
134
|
+
} | string | undefined | null;
|
|
135
|
+
}
|
|
136
|
+
export interface $ZodError<T = unknown> extends Error {
|
|
137
|
+
type: T;
|
|
138
|
+
issues: $ZodIssue[];
|
|
139
|
+
_zod: {
|
|
140
|
+
output: T;
|
|
141
|
+
def: $ZodIssue[];
|
|
142
|
+
};
|
|
143
|
+
stack?: string;
|
|
144
|
+
name: string;
|
|
145
|
+
}
|
|
146
|
+
export declare const $ZodError: $constructor<$ZodError>;
|
|
147
|
+
interface $ZodRealError<T = any> extends $ZodError<T> {
|
|
148
|
+
}
|
|
149
|
+
export declare const $ZodRealError: $constructor<$ZodRealError>;
|
|
150
|
+
export type $ZodFlattenedError<T, U = string> = _FlattenedError<T, U>;
|
|
151
|
+
type _FlattenedError<T, U = string> = {
|
|
152
|
+
formErrors: U[];
|
|
153
|
+
fieldErrors: {
|
|
154
|
+
[P in keyof T]?: U[];
|
|
155
|
+
};
|
|
156
|
+
};
|
|
157
|
+
export declare function flattenError<T>(error: $ZodError<T>): _FlattenedError<T>;
|
|
158
|
+
export declare function flattenError<T, U>(error: $ZodError<T>, mapper?: (issue: $ZodIssue) => U): _FlattenedError<T, U>;
|
|
159
|
+
type _ZodFormattedError<T, U = string> = T extends [any, ...any[]] ? {
|
|
160
|
+
[K in keyof T]?: $ZodFormattedError<T[K], U>;
|
|
161
|
+
} : T extends any[] ? {
|
|
162
|
+
[k: number]: $ZodFormattedError<T[number], U>;
|
|
163
|
+
} : T extends object ? util.Flatten<{
|
|
164
|
+
[K in keyof T]?: $ZodFormattedError<T[K], U>;
|
|
165
|
+
}> : any;
|
|
166
|
+
export type $ZodFormattedError<T, U = string> = {
|
|
167
|
+
_errors: U[];
|
|
168
|
+
} & util.Flatten<_ZodFormattedError<T, U>>;
|
|
169
|
+
export declare function formatError<T>(error: $ZodError<T>): $ZodFormattedError<T>;
|
|
170
|
+
export declare function formatError<T, U>(error: $ZodError<T>, mapper?: (issue: $ZodIssue) => U): $ZodFormattedError<T, U>;
|
|
171
|
+
export type $ZodErrorTree<T, U = string> = T extends util.Primitive ? {
|
|
172
|
+
errors: U[];
|
|
173
|
+
} : T extends [any, ...any[]] ? {
|
|
174
|
+
errors: U[];
|
|
175
|
+
items?: {
|
|
176
|
+
[K in keyof T]?: $ZodErrorTree<T[K], U>;
|
|
177
|
+
};
|
|
178
|
+
} : T extends any[] ? {
|
|
179
|
+
errors: U[];
|
|
180
|
+
items?: Array<$ZodErrorTree<T[number], U>>;
|
|
181
|
+
} : T extends object ? {
|
|
182
|
+
errors: U[];
|
|
183
|
+
properties?: {
|
|
184
|
+
[K in keyof T]?: $ZodErrorTree<T[K], U>;
|
|
185
|
+
};
|
|
186
|
+
} : {
|
|
187
|
+
errors: U[];
|
|
188
|
+
};
|
|
189
|
+
export declare function treeifyError<T>(error: $ZodError<T>): $ZodErrorTree<T>;
|
|
190
|
+
export declare function treeifyError<T, U>(error: $ZodError<T>, mapper?: (issue: $ZodIssue) => U): $ZodErrorTree<T, U>;
|
|
191
|
+
/** Format a ZodError as a human-readable string in the following form.
|
|
192
|
+
*
|
|
193
|
+
* From
|
|
194
|
+
*
|
|
195
|
+
* ```ts
|
|
196
|
+
* ZodError {
|
|
197
|
+
* issues: [
|
|
198
|
+
* {
|
|
199
|
+
* expected: 'string',
|
|
200
|
+
* code: 'invalid_type',
|
|
201
|
+
* path: [ 'username' ],
|
|
202
|
+
* message: 'Invalid input: expected string'
|
|
203
|
+
* },
|
|
204
|
+
* {
|
|
205
|
+
* expected: 'number',
|
|
206
|
+
* code: 'invalid_type',
|
|
207
|
+
* path: [ 'favoriteNumbers', 1 ],
|
|
208
|
+
* message: 'Invalid input: expected number'
|
|
209
|
+
* }
|
|
210
|
+
* ];
|
|
211
|
+
* }
|
|
212
|
+
* ```
|
|
213
|
+
*
|
|
214
|
+
* to
|
|
215
|
+
*
|
|
216
|
+
* ```
|
|
217
|
+
* username
|
|
218
|
+
* ✖ Expected number, received string at "username
|
|
219
|
+
* favoriteNumbers[0]
|
|
220
|
+
* ✖ Invalid input: expected number
|
|
221
|
+
* ```
|
|
222
|
+
*/
|
|
223
|
+
export declare function toDotPath(_path: readonly (string | number | symbol | StandardSchemaV1.PathSegment)[]): string;
|
|
224
|
+
export declare function prettifyError(error: StandardSchemaV1.FailureResult): string;
|
|
225
|
+
export {};
|