zod 3.26.0-canary.20250619T152955 → 3.26.0-canary.20250702T200737
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/README.md +2 -2
- package/{dist/cjs/v3/index.js → index.cjs} +2 -2
- package/index.d.cts +4 -0
- package/index.d.ts +4 -0
- package/index.js +4 -0
- package/package.json +63 -80
- package/{dist/cjs/v3/ZodError.js → v3/ZodError.cjs} +4 -3
- package/v3/ZodError.d.cts +164 -0
- package/{dist/esm/v3 → v3}/ZodError.js +3 -2
- package/{dist/cjs/v3/errors.js → v3/errors.cjs} +1 -1
- package/v3/errors.d.cts +5 -0
- package/{dist/cjs/v3/external.js → v3/external.cjs} +6 -6
- package/v3/external.d.cts +6 -0
- package/v3/helpers/enumUtil.d.ts +8 -0
- package/v3/helpers/errorUtil.d.ts +9 -0
- package/{dist/cjs/v3/helpers/parseUtil.js → v3/helpers/parseUtil.cjs} +2 -2
- package/v3/helpers/parseUtil.d.cts +78 -0
- package/v3/helpers/partialUtil.d.cts +8 -0
- package/v3/helpers/typeAliases.d.ts +2 -0
- package/v3/helpers/util.d.ts +85 -0
- package/{dist/cjs/v4/classic/index.js → v3/index.cjs} +2 -2
- package/v3/index.d.cts +4 -0
- package/v3/index.d.ts +3 -2
- package/v3/index.js +4 -1
- package/{dist/cjs/v3/locales/en.js → v3/locales/en.cjs} +2 -2
- package/v3/locales/en.d.cts +3 -0
- package/v3/standard-schema.d.ts +102 -0
- package/{dist/cjs/v3/types.js → v3/types.cjs} +7 -5
- package/v3/types.d.cts +1031 -0
- package/{dist/esm/v3 → v3}/types.js +2 -0
- package/{dist/cjs/v4/classic/checks.js → v4/classic/checks.cjs} +29 -29
- package/v4/classic/checks.d.cts +1 -0
- package/{dist/types/v4 → v4}/classic/checks.d.ts +1 -1
- package/{dist/esm/v4 → v4}/classic/checks.js +1 -1
- package/{dist/cjs/v4/classic/coerce.js → v4/classic/coerce.cjs} +2 -2
- package/v4/classic/coerce.d.cts +17 -0
- package/{dist/types/v4 → v4}/classic/coerce.d.ts +1 -1
- package/{dist/esm/v4 → v4}/classic/coerce.js +1 -1
- package/{dist/cjs/v4/classic/compat.js → v4/classic/compat.cjs} +4 -4
- package/v4/classic/compat.d.cts +48 -0
- package/{dist/types/v4 → v4}/classic/compat.d.ts +3 -3
- package/{dist/esm/v4 → v4}/classic/compat.js +2 -2
- package/{dist/cjs/v4/classic/errors.js → v4/classic/errors.cjs} +3 -3
- package/v4/classic/errors.d.cts +30 -0
- package/{dist/types/v4 → v4}/classic/errors.d.ts +3 -3
- package/{dist/esm/v4 → v4}/classic/errors.js +2 -2
- package/{dist/cjs/v4/classic/external.js → v4/classic/external.cjs} +29 -29
- package/v4/classic/external.d.cts +13 -0
- package/{dist/types/v4 → v4}/classic/external.d.ts +3 -3
- package/{dist/esm/v4 → v4}/classic/external.js +4 -4
- package/v4/classic/index.cjs +33 -0
- package/v4/classic/index.d.cts +4 -0
- package/{dist/cjs/v4/classic/iso.js → v4/classic/iso.cjs} +2 -2
- package/v4/classic/iso.d.cts +22 -0
- package/{dist/types/v4 → v4}/classic/iso.d.ts +1 -1
- package/{dist/esm/v4 → v4}/classic/iso.js +1 -1
- package/{dist/cjs/v4/classic/parse.js → v4/classic/parse.cjs} +2 -2
- package/v4/classic/parse.d.cts +23 -0
- package/{dist/types/v4 → v4}/classic/parse.d.ts +1 -1
- package/{dist/esm/v4 → v4}/classic/parse.js +1 -1
- package/{dist/cjs/v4/classic/schemas.js → v4/classic/schemas.cjs} +38 -38
- package/v4/classic/schemas.d.cts +629 -0
- package/{dist/types/v4 → v4}/classic/schemas.d.ts +2 -2
- package/{dist/esm/v4 → v4}/classic/schemas.js +2 -2
- package/{dist/cjs/v4/core/api.js → v4/core/api.cjs} +3 -3
- package/v4/core/api.d.cts +284 -0
- package/{dist/cjs/v4/core/checks.js → v4/core/checks.cjs} +3 -3
- package/v4/core/checks.d.cts +277 -0
- package/v4/core/core.d.cts +47 -0
- package/v4/core/doc.d.ts +14 -0
- package/{dist/cjs/v4/core/errors.js → v4/core/errors.cjs} +2 -2
- package/v4/core/errors.d.cts +204 -0
- package/{dist/cjs/v4/core/function.js → v4/core/function.cjs} +4 -4
- package/v4/core/function.d.cts +52 -0
- package/{dist/cjs/v4/core/index.js → v4/core/index.cjs} +15 -15
- package/v4/core/index.d.cts +15 -0
- package/v4/core/index.d.ts +15 -1
- package/v4/core/index.js +15 -1
- package/v4/core/json-schema.d.ts +87 -0
- package/{dist/cjs/v4/core/parse.js → v4/core/parse.cjs} +3 -3
- package/v4/core/parse.d.cts +25 -0
- package/v4/core/regexes.d.ts +62 -0
- package/v4/core/registries.d.cts +34 -0
- package/{dist/cjs/v4/core/schemas.js → v4/core/schemas.cjs} +13 -10
- package/v4/core/schemas.d.cts +1015 -0
- package/{dist/esm/v4 → v4}/core/schemas.js +5 -2
- package/v4/core/standard-schema.d.ts +55 -0
- package/{dist/cjs/v4/core/to-json-schema.js → v4/core/to-json-schema.cjs} +2 -2
- package/v4/core/to-json-schema.d.cts +84 -0
- package/{dist/cjs/v4/core/util.js → v4/core/util.cjs} +3 -4
- package/v4/core/util.d.cts +183 -0
- package/{dist/esm/v4 → v4}/core/util.js +3 -4
- package/v4/core/versions.d.ts +5 -0
- package/{dist/cjs/index.js → v4/index.cjs} +2 -2
- package/v4/index.d.cts +3 -0
- package/v4/index.d.ts +3 -3
- package/v4/index.js +3 -1
- package/{dist/cjs/v4/locales/ar.js → v4/locales/ar.cjs} +1 -1
- package/v4/locales/ar.d.cts +4 -0
- package/{dist/cjs/v4/locales/az.js → v4/locales/az.cjs} +1 -1
- package/v4/locales/az.d.cts +4 -0
- package/{dist/cjs/v4/locales/be.js → v4/locales/be.cjs} +1 -1
- package/v4/locales/be.d.cts +4 -0
- package/{dist/cjs/v4/locales/ca.js → v4/locales/ca.cjs} +1 -1
- package/v4/locales/ca.d.cts +4 -0
- package/{dist/cjs/v4/locales/cs.js → v4/locales/cs.cjs} +1 -1
- package/v4/locales/cs.d.cts +4 -0
- package/{dist/cjs/v4/locales/de.js → v4/locales/de.cjs} +1 -1
- package/v4/locales/de.d.cts +4 -0
- package/{dist/cjs/v4/locales/en.js → v4/locales/en.cjs} +1 -1
- package/{dist/types/v4/locales/en.d.ts → v4/locales/en.d.cts} +1 -1
- package/v4/locales/en.d.ts +5 -2
- package/v4/locales/en.js +117 -2
- package/{dist/cjs/v4/locales/es.js → v4/locales/es.cjs} +1 -1
- package/v4/locales/es.d.cts +4 -0
- package/{dist/cjs/v4/locales/fa.js → v4/locales/fa.cjs} +1 -1
- package/v4/locales/fa.d.cts +4 -0
- package/{dist/cjs/v4/locales/fi.js → v4/locales/fi.cjs} +1 -1
- package/v4/locales/fi.d.cts +4 -0
- package/{dist/cjs/v4/locales/fr-CA.js → v4/locales/fr-CA.cjs} +1 -1
- package/v4/locales/fr-CA.d.cts +4 -0
- package/{dist/cjs/v4/locales/fr.js → v4/locales/fr.cjs} +1 -1
- package/v4/locales/fr.d.cts +4 -0
- package/{dist/cjs/v4/locales/he.js → v4/locales/he.cjs} +1 -1
- package/v4/locales/he.d.cts +4 -0
- package/{dist/cjs/v4/locales/hu.js → v4/locales/hu.cjs} +1 -1
- package/v4/locales/hu.d.cts +4 -0
- package/{dist/cjs/v4/locales/id.js → v4/locales/id.cjs} +1 -1
- package/v4/locales/id.d.cts +4 -0
- package/{dist/cjs/v4/locales/index.js → v4/locales/index.cjs} +38 -38
- package/v4/locales/index.d.cts +38 -0
- package/v4/locales/index.d.ts +38 -1
- package/v4/locales/index.js +38 -1
- package/{dist/cjs/v4/locales/it.js → v4/locales/it.cjs} +1 -1
- package/v4/locales/it.d.cts +4 -0
- package/{dist/cjs/v4/locales/ja.js → v4/locales/ja.cjs} +1 -1
- package/v4/locales/ja.d.cts +4 -0
- package/{dist/cjs/v4/locales/kh.js → v4/locales/kh.cjs} +1 -1
- package/v4/locales/kh.d.cts +4 -0
- package/{dist/cjs/v4/locales/ko.js → v4/locales/ko.cjs} +1 -1
- package/v4/locales/ko.d.cts +4 -0
- package/{dist/cjs/v4/locales/mk.js → v4/locales/mk.cjs} +1 -1
- package/v4/locales/mk.d.cts +4 -0
- package/{dist/cjs/v4/locales/ms.js → v4/locales/ms.cjs} +1 -1
- package/v4/locales/ms.d.cts +4 -0
- package/{dist/cjs/v4/locales/nl.js → v4/locales/nl.cjs} +1 -1
- package/v4/locales/nl.d.cts +4 -0
- package/{dist/cjs/v4/locales/no.js → v4/locales/no.cjs} +1 -1
- package/v4/locales/no.d.cts +4 -0
- package/{dist/cjs/v4/locales/ota.js → v4/locales/ota.cjs} +1 -1
- package/v4/locales/ota.d.cts +4 -0
- package/{dist/cjs/v4/locales/pl.js → v4/locales/pl.cjs} +1 -1
- package/v4/locales/pl.d.cts +4 -0
- package/{dist/cjs/v4/locales/ps.js → v4/locales/ps.cjs} +1 -1
- package/v4/locales/ps.d.cts +4 -0
- package/{dist/cjs/v4/locales/pt.js → v4/locales/pt.cjs} +1 -1
- package/v4/locales/pt.d.cts +4 -0
- package/{dist/cjs/v4/locales/ru.js → v4/locales/ru.cjs} +1 -1
- package/v4/locales/ru.d.cts +4 -0
- package/{dist/cjs/v4/locales/sl.js → v4/locales/sl.cjs} +1 -1
- package/v4/locales/sl.d.cts +4 -0
- package/{dist/cjs/v4/locales/sv.js → v4/locales/sv.cjs} +1 -1
- package/v4/locales/sv.d.cts +4 -0
- package/{dist/cjs/v4/locales/ta.js → v4/locales/ta.cjs} +1 -1
- package/v4/locales/ta.d.cts +4 -0
- package/{dist/cjs/v4/locales/th.js → v4/locales/th.cjs} +1 -1
- package/v4/locales/th.d.cts +4 -0
- package/{dist/cjs/v4/locales/tr.js → v4/locales/tr.cjs} +1 -1
- package/v4/locales/tr.d.cts +5 -0
- package/{dist/cjs/v4/locales/ua.js → v4/locales/ua.cjs} +1 -1
- package/v4/locales/ua.d.cts +4 -0
- package/{dist/cjs/v4/locales/ur.js → v4/locales/ur.cjs} +1 -1
- package/v4/locales/ur.d.cts +4 -0
- package/{dist/cjs/v4/locales/vi.js → v4/locales/vi.cjs} +1 -1
- package/v4/locales/vi.d.cts +4 -0
- package/{dist/cjs/v4/locales/zh-CN.js → v4/locales/zh-CN.cjs} +1 -1
- package/v4/locales/zh-CN.d.cts +4 -0
- package/{dist/cjs/v4/locales/zh-TW.js → v4/locales/zh-TW.cjs} +1 -1
- package/v4/locales/zh-TW.d.cts +4 -0
- package/{dist/cjs/v4/mini/checks.js → v4/mini/checks.cjs} +31 -31
- package/v4/mini/checks.d.cts +1 -0
- package/{dist/types/v4 → v4}/mini/checks.d.ts +1 -1
- package/{dist/esm/v4 → v4}/mini/checks.js +1 -1
- package/{dist/cjs/v4/mini/coerce.js → v4/mini/coerce.cjs} +2 -2
- package/v4/mini/coerce.d.cts +7 -0
- package/{dist/types/v4 → v4}/mini/coerce.d.ts +1 -1
- package/{dist/esm/v4 → v4}/mini/coerce.js +1 -1
- package/{dist/cjs/v4/mini/external.js → v4/mini/external.cjs} +24 -24
- package/v4/mini/external.d.cts +11 -0
- package/{dist/types/v4 → v4}/mini/external.d.ts +3 -3
- package/{dist/esm/v4 → v4}/mini/external.js +2 -2
- package/{dist/cjs/v4/mini/index.js → v4/mini/index.cjs} +2 -2
- package/v4/mini/index.d.cts +3 -0
- package/{dist/cjs/v4/mini/iso.js → v4/mini/iso.cjs} +2 -2
- package/v4/mini/iso.d.cts +22 -0
- package/{dist/types/v4 → v4}/mini/iso.d.ts +1 -1
- package/{dist/esm/v4 → v4}/mini/iso.js +1 -1
- package/{dist/cjs/v4/mini/parse.js → v4/mini/parse.cjs} +5 -5
- package/v4/mini/parse.d.cts +1 -0
- package/v4/mini/parse.d.ts +1 -0
- package/v4/mini/parse.js +1 -0
- package/{dist/cjs/v4/mini/schemas.js → v4/mini/schemas.cjs} +30 -30
- package/v4/mini/schemas.d.cts +356 -0
- package/{dist/types/v4 → v4}/mini/schemas.d.ts +2 -2
- package/{dist/esm/v4 → v4}/mini/schemas.js +2 -2
- package/{dist/cjs/v4/index.js → v4-mini/index.cjs} +1 -6
- package/v4-mini/index.d.cts +1 -0
- package/v4-mini/index.d.ts +1 -1
- package/v4-mini/index.js +1 -1
- package/dist/cjs/package.json +0 -3
- package/dist/cjs/v3/benchmarks/datetime.js +0 -54
- package/dist/cjs/v3/benchmarks/discriminatedUnion.js +0 -79
- package/dist/cjs/v3/benchmarks/index.js +0 -59
- package/dist/cjs/v3/benchmarks/ipv4.js +0 -54
- package/dist/cjs/v3/benchmarks/object.js +0 -70
- package/dist/cjs/v3/benchmarks/primitives.js +0 -159
- package/dist/cjs/v3/benchmarks/realworld.js +0 -56
- package/dist/cjs/v3/benchmarks/string.js +0 -55
- package/dist/cjs/v3/benchmarks/union.js +0 -79
- package/dist/cjs/v3/tests/Mocker.js +0 -57
- package/dist/cjs/v4/core/config.js +0 -10
- package/dist/cjs/v4/core/zsf.js +0 -172
- package/dist/esm/index.js +0 -3
- package/dist/esm/package.json +0 -3
- package/dist/esm/v3/benchmarks/datetime.js +0 -49
- package/dist/esm/v3/benchmarks/discriminatedUnion.js +0 -74
- package/dist/esm/v3/benchmarks/index.js +0 -54
- package/dist/esm/v3/benchmarks/ipv4.js +0 -49
- package/dist/esm/v3/benchmarks/object.js +0 -65
- package/dist/esm/v3/benchmarks/primitives.js +0 -154
- package/dist/esm/v3/benchmarks/realworld.js +0 -51
- package/dist/esm/v3/benchmarks/string.js +0 -50
- package/dist/esm/v3/benchmarks/union.js +0 -74
- package/dist/esm/v3/index.js +0 -4
- package/dist/esm/v3/tests/Mocker.js +0 -53
- package/dist/esm/v4/core/config.js +0 -6
- package/dist/esm/v4/core/index.js +0 -15
- package/dist/esm/v4/core/zsf.js +0 -171
- package/dist/esm/v4/index.js +0 -3
- package/dist/esm/v4/locales/en.js +0 -117
- package/dist/esm/v4/locales/index.js +0 -38
- package/dist/esm/v4/mini/parse.js +0 -1
- package/dist/types/index.d.ts +0 -3
- package/dist/types/package.json +0 -3
- package/dist/types/v3/benchmarks/datetime.d.ts +0 -5
- package/dist/types/v3/benchmarks/discriminatedUnion.d.ts +0 -5
- package/dist/types/v3/benchmarks/index.d.ts +0 -1
- package/dist/types/v3/benchmarks/ipv4.d.ts +0 -5
- package/dist/types/v3/benchmarks/object.d.ts +0 -5
- package/dist/types/v3/benchmarks/primitives.d.ts +0 -5
- package/dist/types/v3/benchmarks/realworld.d.ts +0 -5
- package/dist/types/v3/benchmarks/string.d.ts +0 -5
- package/dist/types/v3/benchmarks/union.d.ts +0 -5
- package/dist/types/v3/index.d.ts +0 -4
- package/dist/types/v3/tests/Mocker.d.ts +0 -17
- package/dist/types/v4/core/config.d.ts +0 -9
- package/dist/types/v4/core/index.d.ts +0 -15
- package/dist/types/v4/core/zsf.d.ts +0 -91
- package/dist/types/v4/index.d.ts +0 -3
- package/dist/types/v4/locales/index.d.ts +0 -38
- package/dist/types/v4/mini/parse.d.ts +0 -1
- /package/{dist/types/v3 → v3}/ZodError.d.ts +0 -0
- /package/{dist/types/v3 → v3}/errors.d.ts +0 -0
- /package/{dist/esm/v3 → v3}/errors.js +0 -0
- /package/{dist/types/v3 → v3}/external.d.ts +0 -0
- /package/{dist/esm/v3 → v3}/external.js +0 -0
- /package/{dist/cjs/v3/helpers/enumUtil.js → v3/helpers/enumUtil.cjs} +0 -0
- /package/{dist/types/v3/helpers/enumUtil.d.ts → v3/helpers/enumUtil.d.cts} +0 -0
- /package/{dist/esm/v3 → v3}/helpers/enumUtil.js +0 -0
- /package/{dist/cjs/v3/helpers/errorUtil.js → v3/helpers/errorUtil.cjs} +0 -0
- /package/{dist/types/v3/helpers/errorUtil.d.ts → v3/helpers/errorUtil.d.cts} +0 -0
- /package/{dist/esm/v3 → v3}/helpers/errorUtil.js +0 -0
- /package/{dist/types/v3 → v3}/helpers/parseUtil.d.ts +0 -0
- /package/{dist/esm/v3 → v3}/helpers/parseUtil.js +0 -0
- /package/{dist/cjs/v3/helpers/partialUtil.js → v3/helpers/partialUtil.cjs} +0 -0
- /package/{dist/types/v3 → v3}/helpers/partialUtil.d.ts +0 -0
- /package/{dist/esm/v3 → v3}/helpers/partialUtil.js +0 -0
- /package/{dist/cjs/v3/helpers/typeAliases.js → v3/helpers/typeAliases.cjs} +0 -0
- /package/{dist/types/v3/helpers/typeAliases.d.ts → v3/helpers/typeAliases.d.cts} +0 -0
- /package/{dist/esm/v3 → v3}/helpers/typeAliases.js +0 -0
- /package/{dist/cjs/v3/helpers/util.js → v3/helpers/util.cjs} +0 -0
- /package/{dist/types/v3/helpers/util.d.ts → v3/helpers/util.d.cts} +0 -0
- /package/{dist/esm/v3 → v3}/helpers/util.js +0 -0
- /package/{dist/types/v3 → v3}/locales/en.d.ts +0 -0
- /package/{dist/esm/v3 → v3}/locales/en.js +0 -0
- /package/{dist/cjs/v3/standard-schema.js → v3/standard-schema.cjs} +0 -0
- /package/{dist/types/v3/standard-schema.d.ts → v3/standard-schema.d.cts} +0 -0
- /package/{dist/esm/v3 → v3}/standard-schema.js +0 -0
- /package/{dist/types/v3 → v3}/types.d.ts +0 -0
- /package/{dist/types/v4 → v4}/classic/index.d.ts +0 -0
- /package/{dist/esm/v4 → v4}/classic/index.js +0 -0
- /package/{dist/types/v4 → v4}/core/api.d.ts +0 -0
- /package/{dist/esm/v4 → v4}/core/api.js +0 -0
- /package/{dist/types/v4 → v4}/core/checks.d.ts +0 -0
- /package/{dist/esm/v4 → v4}/core/checks.js +0 -0
- /package/{dist/cjs/v4/core/core.js → v4/core/core.cjs} +0 -0
- /package/{dist/types/v4 → v4}/core/core.d.ts +0 -0
- /package/{dist/esm/v4 → v4}/core/core.js +0 -0
- /package/{dist/cjs/v4/core/doc.js → v4/core/doc.cjs} +0 -0
- /package/{dist/types/v4/core/doc.d.ts → v4/core/doc.d.cts} +0 -0
- /package/{dist/esm/v4 → v4}/core/doc.js +0 -0
- /package/{dist/types/v4 → v4}/core/errors.d.ts +0 -0
- /package/{dist/esm/v4 → v4}/core/errors.js +0 -0
- /package/{dist/types/v4 → v4}/core/function.d.ts +0 -0
- /package/{dist/esm/v4 → v4}/core/function.js +0 -0
- /package/{dist/cjs/v4/core/json-schema.js → v4/core/json-schema.cjs} +0 -0
- /package/{dist/types/v4/core/json-schema.d.ts → v4/core/json-schema.d.cts} +0 -0
- /package/{dist/esm/v4 → v4}/core/json-schema.js +0 -0
- /package/{dist/types/v4 → v4}/core/parse.d.ts +0 -0
- /package/{dist/esm/v4 → v4}/core/parse.js +0 -0
- /package/{dist/cjs/v4/core/regexes.js → v4/core/regexes.cjs} +0 -0
- /package/{dist/types/v4/core/regexes.d.ts → v4/core/regexes.d.cts} +0 -0
- /package/{dist/esm/v4 → v4}/core/regexes.js +0 -0
- /package/{dist/cjs/v4/core/registries.js → v4/core/registries.cjs} +0 -0
- /package/{dist/types/v4 → v4}/core/registries.d.ts +0 -0
- /package/{dist/esm/v4 → v4}/core/registries.js +0 -0
- /package/{dist/types/v4 → v4}/core/schemas.d.ts +0 -0
- /package/{dist/cjs/v4/core/standard-schema.js → v4/core/standard-schema.cjs} +0 -0
- /package/{dist/types/v4/core/standard-schema.d.ts → v4/core/standard-schema.d.cts} +0 -0
- /package/{dist/esm/v4 → v4}/core/standard-schema.js +0 -0
- /package/{dist/types/v4 → v4}/core/to-json-schema.d.ts +0 -0
- /package/{dist/esm/v4 → v4}/core/to-json-schema.js +0 -0
- /package/{dist/types/v4 → v4}/core/util.d.ts +0 -0
- /package/{dist/cjs/v4/core/versions.js → v4/core/versions.cjs} +0 -0
- /package/{dist/types/v4/core/versions.d.ts → v4/core/versions.d.cts} +0 -0
- /package/{dist/esm/v4 → v4}/core/versions.js +0 -0
- /package/{dist/types/v4 → v4}/locales/ar.d.ts +0 -0
- /package/{dist/esm/v4 → v4}/locales/ar.js +0 -0
- /package/{dist/types/v4 → v4}/locales/az.d.ts +0 -0
- /package/{dist/esm/v4 → v4}/locales/az.js +0 -0
- /package/{dist/types/v4 → v4}/locales/be.d.ts +0 -0
- /package/{dist/esm/v4 → v4}/locales/be.js +0 -0
- /package/{dist/types/v4 → v4}/locales/ca.d.ts +0 -0
- /package/{dist/esm/v4 → v4}/locales/ca.js +0 -0
- /package/{dist/types/v4 → v4}/locales/cs.d.ts +0 -0
- /package/{dist/esm/v4 → v4}/locales/cs.js +0 -0
- /package/{dist/types/v4 → v4}/locales/de.d.ts +0 -0
- /package/{dist/esm/v4 → v4}/locales/de.js +0 -0
- /package/{dist/types/v4 → v4}/locales/es.d.ts +0 -0
- /package/{dist/esm/v4 → v4}/locales/es.js +0 -0
- /package/{dist/types/v4 → v4}/locales/fa.d.ts +0 -0
- /package/{dist/esm/v4 → v4}/locales/fa.js +0 -0
- /package/{dist/types/v4 → v4}/locales/fi.d.ts +0 -0
- /package/{dist/esm/v4 → v4}/locales/fi.js +0 -0
- /package/{dist/types/v4 → v4}/locales/fr-CA.d.ts +0 -0
- /package/{dist/esm/v4 → v4}/locales/fr-CA.js +0 -0
- /package/{dist/types/v4 → v4}/locales/fr.d.ts +0 -0
- /package/{dist/esm/v4 → v4}/locales/fr.js +0 -0
- /package/{dist/types/v4 → v4}/locales/he.d.ts +0 -0
- /package/{dist/esm/v4 → v4}/locales/he.js +0 -0
- /package/{dist/types/v4 → v4}/locales/hu.d.ts +0 -0
- /package/{dist/esm/v4 → v4}/locales/hu.js +0 -0
- /package/{dist/types/v4 → v4}/locales/id.d.ts +0 -0
- /package/{dist/esm/v4 → v4}/locales/id.js +0 -0
- /package/{dist/types/v4 → v4}/locales/it.d.ts +0 -0
- /package/{dist/esm/v4 → v4}/locales/it.js +0 -0
- /package/{dist/types/v4 → v4}/locales/ja.d.ts +0 -0
- /package/{dist/esm/v4 → v4}/locales/ja.js +0 -0
- /package/{dist/types/v4 → v4}/locales/kh.d.ts +0 -0
- /package/{dist/esm/v4 → v4}/locales/kh.js +0 -0
- /package/{dist/types/v4 → v4}/locales/ko.d.ts +0 -0
- /package/{dist/esm/v4 → v4}/locales/ko.js +0 -0
- /package/{dist/types/v4 → v4}/locales/mk.d.ts +0 -0
- /package/{dist/esm/v4 → v4}/locales/mk.js +0 -0
- /package/{dist/types/v4 → v4}/locales/ms.d.ts +0 -0
- /package/{dist/esm/v4 → v4}/locales/ms.js +0 -0
- /package/{dist/types/v4 → v4}/locales/nl.d.ts +0 -0
- /package/{dist/esm/v4 → v4}/locales/nl.js +0 -0
- /package/{dist/types/v4 → v4}/locales/no.d.ts +0 -0
- /package/{dist/esm/v4 → v4}/locales/no.js +0 -0
- /package/{dist/types/v4 → v4}/locales/ota.d.ts +0 -0
- /package/{dist/esm/v4 → v4}/locales/ota.js +0 -0
- /package/{dist/types/v4 → v4}/locales/pl.d.ts +0 -0
- /package/{dist/esm/v4 → v4}/locales/pl.js +0 -0
- /package/{dist/types/v4 → v4}/locales/ps.d.ts +0 -0
- /package/{dist/esm/v4 → v4}/locales/ps.js +0 -0
- /package/{dist/types/v4 → v4}/locales/pt.d.ts +0 -0
- /package/{dist/esm/v4 → v4}/locales/pt.js +0 -0
- /package/{dist/types/v4 → v4}/locales/ru.d.ts +0 -0
- /package/{dist/esm/v4 → v4}/locales/ru.js +0 -0
- /package/{dist/types/v4 → v4}/locales/sl.d.ts +0 -0
- /package/{dist/esm/v4 → v4}/locales/sl.js +0 -0
- /package/{dist/types/v4 → v4}/locales/sv.d.ts +0 -0
- /package/{dist/esm/v4 → v4}/locales/sv.js +0 -0
- /package/{dist/types/v4 → v4}/locales/ta.d.ts +0 -0
- /package/{dist/esm/v4 → v4}/locales/ta.js +0 -0
- /package/{dist/types/v4 → v4}/locales/th.d.ts +0 -0
- /package/{dist/esm/v4 → v4}/locales/th.js +0 -0
- /package/{dist/types/v4 → v4}/locales/tr.d.ts +0 -0
- /package/{dist/esm/v4 → v4}/locales/tr.js +0 -0
- /package/{dist/types/v4 → v4}/locales/ua.d.ts +0 -0
- /package/{dist/esm/v4 → v4}/locales/ua.js +0 -0
- /package/{dist/types/v4 → v4}/locales/ur.d.ts +0 -0
- /package/{dist/esm/v4 → v4}/locales/ur.js +0 -0
- /package/{dist/types/v4 → v4}/locales/vi.d.ts +0 -0
- /package/{dist/esm/v4 → v4}/locales/vi.js +0 -0
- /package/{dist/types/v4 → v4}/locales/zh-CN.d.ts +0 -0
- /package/{dist/esm/v4 → v4}/locales/zh-CN.js +0 -0
- /package/{dist/types/v4 → v4}/locales/zh-TW.d.ts +0 -0
- /package/{dist/esm/v4 → v4}/locales/zh-TW.js +0 -0
- /package/{dist/types/v4 → v4}/mini/index.d.ts +0 -0
- /package/{dist/esm/v4 → v4}/mini/index.js +0 -0
|
@@ -231,7 +231,6 @@ export const $ZodKSUID = /*@__PURE__*/ core.$constructor("$ZodKSUID", (inst, def
|
|
|
231
231
|
export const $ZodISODateTime = /*@__PURE__*/ core.$constructor("$ZodISODateTime", (inst, def) => {
|
|
232
232
|
def.pattern ?? (def.pattern = regexes.datetime(def));
|
|
233
233
|
$ZodStringFormat.init(inst, def);
|
|
234
|
-
const _super = inst._zod.check;
|
|
235
234
|
});
|
|
236
235
|
export const $ZodISODate = /*@__PURE__*/ core.$constructor("$ZodISODate", (inst, def) => {
|
|
237
236
|
def.pattern ?? (def.pattern = regexes.date);
|
|
@@ -240,7 +239,6 @@ export const $ZodISODate = /*@__PURE__*/ core.$constructor("$ZodISODate", (inst,
|
|
|
240
239
|
export const $ZodISOTime = /*@__PURE__*/ core.$constructor("$ZodISOTime", (inst, def) => {
|
|
241
240
|
def.pattern ?? (def.pattern = regexes.time(def));
|
|
242
241
|
$ZodStringFormat.init(inst, def);
|
|
243
|
-
const _super = inst._zod.check;
|
|
244
242
|
});
|
|
245
243
|
export const $ZodISODuration = /*@__PURE__*/ core.$constructor("$ZodISODuration", (inst, def) => {
|
|
246
244
|
def.pattern ?? (def.pattern = regexes.duration);
|
|
@@ -376,6 +374,8 @@ export function isValidJWT(token, algorithm = null) {
|
|
|
376
374
|
if (tokensParts.length !== 3)
|
|
377
375
|
return false;
|
|
378
376
|
const [header] = tokensParts;
|
|
377
|
+
if (!header)
|
|
378
|
+
return false;
|
|
379
379
|
const parsedHeader = JSON.parse(atob(header));
|
|
380
380
|
if ("typ" in parsedHeader && parsedHeader?.typ !== "JWT")
|
|
381
381
|
return false;
|
|
@@ -1416,6 +1416,9 @@ export const $ZodOptional = /*@__PURE__*/ core.$constructor("$ZodOptional", (ins
|
|
|
1416
1416
|
return pattern ? new RegExp(`^(${util.cleanRegex(pattern.source)})?$`) : undefined;
|
|
1417
1417
|
});
|
|
1418
1418
|
inst._zod.parse = (payload, ctx) => {
|
|
1419
|
+
if (def.innerType._zod.optin === "optional") {
|
|
1420
|
+
return def.innerType._zod.run(payload, ctx);
|
|
1421
|
+
}
|
|
1419
1422
|
if (payload.value === undefined) {
|
|
1420
1423
|
return payload;
|
|
1421
1424
|
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/** The Standard Schema interface. */
|
|
2
|
+
export interface StandardSchemaV1<Input = unknown, Output = Input> {
|
|
3
|
+
/** The Standard Schema properties. */
|
|
4
|
+
readonly "~standard": StandardSchemaV1.Props<Input, Output>;
|
|
5
|
+
}
|
|
6
|
+
export declare namespace StandardSchemaV1 {
|
|
7
|
+
/** The Standard Schema properties interface. */
|
|
8
|
+
interface Props<Input = unknown, Output = Input> {
|
|
9
|
+
/** The version number of the standard. */
|
|
10
|
+
readonly version: 1;
|
|
11
|
+
/** The vendor name of the schema library. */
|
|
12
|
+
readonly vendor: string;
|
|
13
|
+
/** Validates unknown input values. */
|
|
14
|
+
readonly validate: (value: unknown) => Result<Output> | Promise<Result<Output>>;
|
|
15
|
+
/** Inferred types associated with the schema. */
|
|
16
|
+
readonly types?: Types<Input, Output> | undefined;
|
|
17
|
+
}
|
|
18
|
+
/** The result interface of the validate function. */
|
|
19
|
+
type Result<Output> = SuccessResult<Output> | FailureResult;
|
|
20
|
+
/** The result interface if validation succeeds. */
|
|
21
|
+
interface SuccessResult<Output> {
|
|
22
|
+
/** The typed output value. */
|
|
23
|
+
readonly value: Output;
|
|
24
|
+
/** The non-existent issues. */
|
|
25
|
+
readonly issues?: undefined;
|
|
26
|
+
}
|
|
27
|
+
/** The result interface if validation fails. */
|
|
28
|
+
interface FailureResult {
|
|
29
|
+
/** The issues of failed validation. */
|
|
30
|
+
readonly issues: ReadonlyArray<Issue>;
|
|
31
|
+
}
|
|
32
|
+
/** The issue interface of the failure output. */
|
|
33
|
+
interface Issue {
|
|
34
|
+
/** The error message of the issue. */
|
|
35
|
+
readonly message: string;
|
|
36
|
+
/** The path of the issue, if any. */
|
|
37
|
+
readonly path?: ReadonlyArray<PropertyKey | PathSegment> | undefined;
|
|
38
|
+
}
|
|
39
|
+
/** The path segment interface of the issue. */
|
|
40
|
+
interface PathSegment {
|
|
41
|
+
/** The key representing a path segment. */
|
|
42
|
+
readonly key: PropertyKey;
|
|
43
|
+
}
|
|
44
|
+
/** The Standard Schema types interface. */
|
|
45
|
+
interface Types<Input = unknown, Output = Input> {
|
|
46
|
+
/** The input type of the schema. */
|
|
47
|
+
readonly input: Input;
|
|
48
|
+
/** The output type of the schema. */
|
|
49
|
+
readonly output: Output;
|
|
50
|
+
}
|
|
51
|
+
/** Infers the input type of a Standard Schema. */
|
|
52
|
+
type InferInput<Schema extends StandardSchemaV1> = NonNullable<Schema["~standard"]["types"]>["input"];
|
|
53
|
+
/** Infers the output type of a Standard Schema. */
|
|
54
|
+
type InferOutput<Schema extends StandardSchemaV1> = NonNullable<Schema["~standard"]["types"]>["output"];
|
|
55
|
+
}
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.JSONSchemaGenerator = void 0;
|
|
4
4
|
exports.toJSONSchema = toJSONSchema;
|
|
5
|
-
const registries_js_1 = require("./registries.
|
|
6
|
-
const util_js_1 = require("./util.
|
|
5
|
+
const registries_js_1 = require("./registries.cjs");
|
|
6
|
+
const util_js_1 = require("./util.cjs");
|
|
7
7
|
class JSONSchemaGenerator {
|
|
8
8
|
constructor(params) {
|
|
9
9
|
this.counter = 0;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import type * as JSONSchema from "./json-schema.cjs";
|
|
2
|
+
import { $ZodRegistry } from "./registries.cjs";
|
|
3
|
+
import type * as schemas from "./schemas.cjs";
|
|
4
|
+
interface JSONSchemaGeneratorParams {
|
|
5
|
+
/** A registry used to look up metadata for each schema. Any schema with an `id` property will be extracted as a $def.
|
|
6
|
+
* @default globalRegistry */
|
|
7
|
+
metadata?: $ZodRegistry<Record<string, any>>;
|
|
8
|
+
/** The JSON Schema version to target.
|
|
9
|
+
* - `"draft-2020-12"` — Default. JSON Schema Draft 2020-12
|
|
10
|
+
* - `"draft-7"` — JSON Schema Draft 7 */
|
|
11
|
+
target?: "draft-7" | "draft-2020-12";
|
|
12
|
+
/** How to handle unrepresentable types.
|
|
13
|
+
* - `"throw"` — Default. Unrepresentable types throw an error
|
|
14
|
+
* - `"any"` — Unrepresentable types become `{}` */
|
|
15
|
+
unrepresentable?: "throw" | "any";
|
|
16
|
+
/** Arbitrary custom logic that can be used to modify the generated JSON Schema. */
|
|
17
|
+
override?: (ctx: {
|
|
18
|
+
zodSchema: schemas.$ZodTypes;
|
|
19
|
+
jsonSchema: JSONSchema.BaseSchema;
|
|
20
|
+
}) => void;
|
|
21
|
+
/** Whether to extract the `"input"` or `"output"` type. Relevant to transforms, Error converting schema to JSONz, defaults, coerced primitives, etc.
|
|
22
|
+
* - `"output" — Default. Convert the output schema.
|
|
23
|
+
* - `"input"` — Convert the input schema. */
|
|
24
|
+
io?: "input" | "output";
|
|
25
|
+
}
|
|
26
|
+
interface ProcessParams {
|
|
27
|
+
schemaPath: schemas.$ZodType[];
|
|
28
|
+
path: (string | number)[];
|
|
29
|
+
}
|
|
30
|
+
interface EmitParams {
|
|
31
|
+
/** How to handle cycles.
|
|
32
|
+
* - `"ref"` — Default. Cycles will be broken using $defs
|
|
33
|
+
* - `"throw"` — Cycles will throw an error if encountered */
|
|
34
|
+
cycles?: "ref" | "throw";
|
|
35
|
+
reused?: "ref" | "inline";
|
|
36
|
+
external?: {
|
|
37
|
+
/** */
|
|
38
|
+
registry: $ZodRegistry<{
|
|
39
|
+
id?: string | undefined;
|
|
40
|
+
}>;
|
|
41
|
+
uri: (id: string) => string;
|
|
42
|
+
defs: Record<string, JSONSchema.BaseSchema>;
|
|
43
|
+
} | undefined;
|
|
44
|
+
}
|
|
45
|
+
interface Seen {
|
|
46
|
+
/** JSON Schema result for this Zod schema */
|
|
47
|
+
schema: JSONSchema.BaseSchema;
|
|
48
|
+
/** A cached version of the schema that doesn't get overwritten during ref resolution */
|
|
49
|
+
def?: JSONSchema.BaseSchema;
|
|
50
|
+
defId?: string | undefined;
|
|
51
|
+
/** Number of times this schema was encountered during traversal */
|
|
52
|
+
count: number;
|
|
53
|
+
/** Cycle path */
|
|
54
|
+
cycle?: (string | number)[] | undefined;
|
|
55
|
+
isParent?: boolean | undefined;
|
|
56
|
+
ref?: schemas.$ZodType | undefined | null;
|
|
57
|
+
}
|
|
58
|
+
export declare class JSONSchemaGenerator {
|
|
59
|
+
metadataRegistry: $ZodRegistry<Record<string, any>>;
|
|
60
|
+
target: "draft-7" | "draft-2020-12";
|
|
61
|
+
unrepresentable: "throw" | "any";
|
|
62
|
+
override: (ctx: {
|
|
63
|
+
zodSchema: schemas.$ZodTypes;
|
|
64
|
+
jsonSchema: JSONSchema.BaseSchema;
|
|
65
|
+
}) => void;
|
|
66
|
+
io: "input" | "output";
|
|
67
|
+
counter: number;
|
|
68
|
+
seen: Map<schemas.$ZodType, Seen>;
|
|
69
|
+
constructor(params?: JSONSchemaGeneratorParams);
|
|
70
|
+
process(schema: schemas.$ZodType, _params?: ProcessParams): JSONSchema.BaseSchema;
|
|
71
|
+
emit(schema: schemas.$ZodType, _params?: EmitParams): JSONSchema.BaseSchema;
|
|
72
|
+
}
|
|
73
|
+
interface ToJSONSchemaParams extends Omit<JSONSchemaGeneratorParams & EmitParams, "external"> {
|
|
74
|
+
}
|
|
75
|
+
interface RegistryToJSONSchemaParams extends Omit<JSONSchemaGeneratorParams & EmitParams, "external"> {
|
|
76
|
+
uri?: (id: string) => string;
|
|
77
|
+
}
|
|
78
|
+
export declare function toJSONSchema(schema: schemas.$ZodType, _params?: ToJSONSchemaParams): JSONSchema.BaseSchema;
|
|
79
|
+
export declare function toJSONSchema(registry: $ZodRegistry<{
|
|
80
|
+
id?: string | undefined;
|
|
81
|
+
}>, _params?: RegistryToJSONSchemaParams): {
|
|
82
|
+
schemas: Record<string, JSONSchema.BaseSchema>;
|
|
83
|
+
};
|
|
84
|
+
export {};
|
|
@@ -173,9 +173,6 @@ exports.allowsEval = cached(() => {
|
|
|
173
173
|
return false;
|
|
174
174
|
}
|
|
175
175
|
});
|
|
176
|
-
function _isObject(o) {
|
|
177
|
-
return Object.prototype.toString.call(o) === "[object Object]";
|
|
178
|
-
}
|
|
179
176
|
function isPlainObject(o) {
|
|
180
177
|
if (isObject(o) === false)
|
|
181
178
|
return false;
|
|
@@ -400,6 +397,7 @@ function partial(Class, schema, mask) {
|
|
|
400
397
|
}
|
|
401
398
|
if (!mask[key])
|
|
402
399
|
continue;
|
|
400
|
+
// if (oldShape[key]!._zod.optin === "optional") continue;
|
|
403
401
|
shape[key] = Class
|
|
404
402
|
? new Class({
|
|
405
403
|
type: "optional",
|
|
@@ -410,6 +408,7 @@ function partial(Class, schema, mask) {
|
|
|
410
408
|
}
|
|
411
409
|
else {
|
|
412
410
|
for (const key in oldShape) {
|
|
411
|
+
// if (oldShape[key]!._zod.optin === "optional") continue;
|
|
413
412
|
shape[key] = Class
|
|
414
413
|
? new Class({
|
|
415
414
|
type: "optional",
|
|
@@ -459,7 +458,7 @@ function required(Class, schema, mask) {
|
|
|
459
458
|
}
|
|
460
459
|
function aborted(x, startIndex = 0) {
|
|
461
460
|
for (let i = startIndex; i < x.issues.length; i++) {
|
|
462
|
-
if (x.issues[i]
|
|
461
|
+
if (x.issues[i]?.continue !== true)
|
|
463
462
|
return true;
|
|
464
463
|
}
|
|
465
464
|
return false;
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
import type * as checks from "./checks.cjs";
|
|
2
|
+
import type { $ZodConfig } from "./core.cjs";
|
|
3
|
+
import type * as errors from "./errors.cjs";
|
|
4
|
+
import type * as schemas from "./schemas.cjs";
|
|
5
|
+
export type JSONType = string | number | boolean | null | JSONType[] | {
|
|
6
|
+
[key: string]: JSONType;
|
|
7
|
+
};
|
|
8
|
+
export type JWTAlgorithm = "HS256" | "HS384" | "HS512" | "RS256" | "RS384" | "RS512" | "ES256" | "ES384" | "ES512" | "PS256" | "PS384" | "PS512" | "EdDSA" | (string & {});
|
|
9
|
+
export type IPVersion = "v4" | "v6";
|
|
10
|
+
export type MimeTypes = "application/json" | "application/xml" | "application/x-www-form-urlencoded" | "application/javascript" | "application/pdf" | "application/zip" | "application/vnd.ms-excel" | "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" | "application/msword" | "application/vnd.openxmlformats-officedocument.wordprocessingml.document" | "application/vnd.ms-powerpoint" | "application/vnd.openxmlformats-officedocument.presentationml.presentation" | "application/octet-stream" | "application/graphql" | "text/html" | "text/plain" | "text/css" | "text/javascript" | "text/csv" | "image/png" | "image/jpeg" | "image/gif" | "image/svg+xml" | "image/webp" | "audio/mpeg" | "audio/ogg" | "audio/wav" | "audio/webm" | "video/mp4" | "video/webm" | "video/ogg" | "font/woff" | "font/woff2" | "font/ttf" | "font/otf" | "multipart/form-data" | (string & {});
|
|
11
|
+
export type ParsedTypes = "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function" | "file" | "date" | "array" | "map" | "set" | "nan" | "null" | "promise";
|
|
12
|
+
export type AssertEqual<T, U> = (<V>() => V extends T ? 1 : 2) extends <V>() => V extends U ? 1 : 2 ? true : false;
|
|
13
|
+
export type AssertNotEqual<T, U> = (<V>() => V extends T ? 1 : 2) extends <V>() => V extends U ? 1 : 2 ? false : true;
|
|
14
|
+
export type AssertExtends<T, U> = T extends U ? T : never;
|
|
15
|
+
export type IsAny<T> = 0 extends 1 & T ? true : false;
|
|
16
|
+
export type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
|
|
17
|
+
export type OmitKeys<T, K extends string> = Pick<T, Exclude<keyof T, K>>;
|
|
18
|
+
export type MakePartial<T, K extends keyof T> = Omit<T, K> & InexactPartial<Pick<T, K>>;
|
|
19
|
+
export type MakeRequired<T, K extends keyof T> = Omit<T, K> & Required<Pick<T, K>>;
|
|
20
|
+
export type Exactly<T, X> = T & Record<Exclude<keyof X, keyof T>, never>;
|
|
21
|
+
export type NoUndefined<T> = T extends undefined ? never : T;
|
|
22
|
+
export type Whatever = {} | undefined | null;
|
|
23
|
+
export type LoosePartial<T extends object> = InexactPartial<T> & {
|
|
24
|
+
[k: string]: unknown;
|
|
25
|
+
};
|
|
26
|
+
export type Mask<Keys extends PropertyKey> = {
|
|
27
|
+
[K in Keys]?: true;
|
|
28
|
+
};
|
|
29
|
+
export type Writeable<T> = {
|
|
30
|
+
-readonly [P in keyof T]: T[P];
|
|
31
|
+
} & {};
|
|
32
|
+
export type InexactPartial<T> = {
|
|
33
|
+
[P in keyof T]?: T[P] | undefined;
|
|
34
|
+
};
|
|
35
|
+
export type EmptyObject = Record<string, never>;
|
|
36
|
+
export type BuiltIn = (((...args: any[]) => any) | (new (...args: any[]) => any)) | {
|
|
37
|
+
readonly [Symbol.toStringTag]: string;
|
|
38
|
+
} | Date | Error | Generator | Promise<unknown> | RegExp;
|
|
39
|
+
export type MakeReadonly<T> = T extends Map<infer K, infer V> ? ReadonlyMap<K, V> : T extends Set<infer V> ? ReadonlySet<V> : T extends [infer Head, ...infer Tail] ? readonly [Head, ...Tail] : T extends Array<infer V> ? ReadonlyArray<V> : T extends BuiltIn ? T : Readonly<T>;
|
|
40
|
+
export type SomeObject = Record<PropertyKey, any>;
|
|
41
|
+
export type Identity<T> = T;
|
|
42
|
+
export type Flatten<T> = Identity<{
|
|
43
|
+
[k in keyof T]: T[k];
|
|
44
|
+
}>;
|
|
45
|
+
export type Mapped<T> = {
|
|
46
|
+
[k in keyof T]: T[k];
|
|
47
|
+
};
|
|
48
|
+
export type Prettify<T> = {
|
|
49
|
+
[K in keyof T]: T[K];
|
|
50
|
+
} & {};
|
|
51
|
+
export type NoNeverKeys<T> = {
|
|
52
|
+
[k in keyof T]: [T[k]] extends [never] ? never : k;
|
|
53
|
+
}[keyof T];
|
|
54
|
+
export type NoNever<T> = Identity<{
|
|
55
|
+
[k in NoNeverKeys<T>]: k extends keyof T ? T[k] : never;
|
|
56
|
+
}>;
|
|
57
|
+
export type Extend<A extends SomeObject, B extends SomeObject> = Flatten<keyof A & keyof B extends never ? A & B : {
|
|
58
|
+
[K in keyof A as K extends keyof B ? never : K]: A[K];
|
|
59
|
+
} & {
|
|
60
|
+
[K in keyof B]: B[K];
|
|
61
|
+
}>;
|
|
62
|
+
export type TupleItems = ReadonlyArray<schemas.SomeType>;
|
|
63
|
+
export type AnyFunc = (...args: any[]) => any;
|
|
64
|
+
export type IsProp<T, K extends keyof T> = T[K] extends AnyFunc ? never : K;
|
|
65
|
+
export type MaybeAsync<T> = T | Promise<T>;
|
|
66
|
+
export type KeyOf<T> = keyof OmitIndexSignature<T>;
|
|
67
|
+
export type OmitIndexSignature<T> = {
|
|
68
|
+
[K in keyof T as string extends K ? never : K extends string ? K : never]: T[K];
|
|
69
|
+
};
|
|
70
|
+
export type ExtractIndexSignature<T> = {
|
|
71
|
+
[K in keyof T as string extends K ? K : K extends string ? never : K]: T[K];
|
|
72
|
+
};
|
|
73
|
+
export type Keys<T extends object> = keyof OmitIndexSignature<T>;
|
|
74
|
+
export type SchemaClass<T extends schemas.SomeType> = {
|
|
75
|
+
new (def: T["_zod"]["def"]): T;
|
|
76
|
+
};
|
|
77
|
+
export type EnumValue = string | number;
|
|
78
|
+
export type EnumLike = Readonly<Record<string, EnumValue>>;
|
|
79
|
+
export type ToEnum<T extends EnumValue> = Flatten<{
|
|
80
|
+
[k in T]: k;
|
|
81
|
+
}>;
|
|
82
|
+
export type KeysEnum<T extends object> = ToEnum<Exclude<keyof T, symbol>>;
|
|
83
|
+
export type KeysArray<T extends object> = Flatten<(keyof T & string)[]>;
|
|
84
|
+
export type Literal = string | number | bigint | boolean | null | undefined;
|
|
85
|
+
export type LiteralArray = Array<Literal>;
|
|
86
|
+
export type Primitive = string | number | symbol | bigint | boolean | null | undefined;
|
|
87
|
+
export type PrimitiveArray = Array<Primitive>;
|
|
88
|
+
export type HasSize = {
|
|
89
|
+
size: number;
|
|
90
|
+
};
|
|
91
|
+
export type HasLength = {
|
|
92
|
+
length: number;
|
|
93
|
+
};
|
|
94
|
+
export type Numeric = number | bigint | Date;
|
|
95
|
+
export type SafeParseResult<T> = SafeParseSuccess<T> | SafeParseError<T>;
|
|
96
|
+
export type SafeParseSuccess<T> = {
|
|
97
|
+
success: true;
|
|
98
|
+
data: T;
|
|
99
|
+
error?: never;
|
|
100
|
+
};
|
|
101
|
+
export type SafeParseError<T> = {
|
|
102
|
+
success: false;
|
|
103
|
+
data?: never;
|
|
104
|
+
error: errors.$ZodError<T>;
|
|
105
|
+
};
|
|
106
|
+
export type PropValues = Record<string, Set<Primitive>>;
|
|
107
|
+
export type PrimitiveSet = Set<Primitive>;
|
|
108
|
+
export declare function assertEqual<A, B>(val: AssertEqual<A, B>): AssertEqual<A, B>;
|
|
109
|
+
export declare function assertNotEqual<A, B>(val: AssertNotEqual<A, B>): AssertNotEqual<A, B>;
|
|
110
|
+
export declare function assertIs<T>(_arg: T): void;
|
|
111
|
+
export declare function assertNever(_x: never): never;
|
|
112
|
+
export declare function assert<T>(_: any): asserts _ is T;
|
|
113
|
+
export declare function getEnumValues(entries: EnumLike): EnumValue[];
|
|
114
|
+
export declare function joinValues<T extends Primitive[]>(array: T, separator?: string): string;
|
|
115
|
+
export declare function jsonStringifyReplacer(_: string, value: any): any;
|
|
116
|
+
export declare function cached<T>(getter: () => T): {
|
|
117
|
+
value: T;
|
|
118
|
+
};
|
|
119
|
+
export declare function nullish(input: any): boolean;
|
|
120
|
+
export declare function cleanRegex(source: string): string;
|
|
121
|
+
export declare function floatSafeRemainder(val: number, step: number): number;
|
|
122
|
+
export declare function defineLazy<T, K extends keyof T>(object: T, key: K, getter: () => T[K]): void;
|
|
123
|
+
export declare function assignProp<T extends object, K extends PropertyKey>(target: T, prop: K, value: K extends keyof T ? T[K] : any): void;
|
|
124
|
+
export declare function getElementAtPath(obj: any, path: (string | number)[] | null | undefined): any;
|
|
125
|
+
export declare function promiseAllObject<T extends object>(promisesObj: T): Promise<{
|
|
126
|
+
[k in keyof T]: Awaited<T[k]>;
|
|
127
|
+
}>;
|
|
128
|
+
export declare function randomString(length?: number): string;
|
|
129
|
+
export declare function esc(str: string): string;
|
|
130
|
+
export declare const captureStackTrace: typeof Error.captureStackTrace;
|
|
131
|
+
export declare function isObject(data: any): data is Record<PropertyKey, unknown>;
|
|
132
|
+
export declare const allowsEval: {
|
|
133
|
+
value: boolean;
|
|
134
|
+
};
|
|
135
|
+
export declare function isPlainObject(o: any): o is Record<PropertyKey, unknown>;
|
|
136
|
+
export declare function numKeys(data: any): number;
|
|
137
|
+
export declare const getParsedType: (data: any) => ParsedTypes;
|
|
138
|
+
export declare const propertyKeyTypes: Set<string>;
|
|
139
|
+
export declare const primitiveTypes: Set<string>;
|
|
140
|
+
export declare function escapeRegex(str: string): string;
|
|
141
|
+
export declare function clone<T extends schemas.$ZodType>(inst: T, def?: T["_zod"]["def"], params?: {
|
|
142
|
+
parent: boolean;
|
|
143
|
+
}): T;
|
|
144
|
+
export type EmptyToNever<T> = keyof T extends never ? never : T;
|
|
145
|
+
export type Normalize<T> = T extends undefined ? never : T extends Record<any, any> ? Flatten<{
|
|
146
|
+
[k in keyof Omit<T, "error" | "message">]: T[k];
|
|
147
|
+
} & ("error" extends keyof T ? {
|
|
148
|
+
error?: Exclude<T["error"], string>;
|
|
149
|
+
} : unknown)> : never;
|
|
150
|
+
export declare function normalizeParams<T>(_params: T): Normalize<T>;
|
|
151
|
+
export declare function createTransparentProxy<T extends object>(getter: () => T): T;
|
|
152
|
+
export declare function stringifyPrimitive(value: any): string;
|
|
153
|
+
export declare function optionalKeys(shape: schemas.$ZodShape): string[];
|
|
154
|
+
export type CleanKey<T extends PropertyKey> = T extends `?${infer K}` ? K : T extends `${infer K}?` ? K : T;
|
|
155
|
+
export type ToCleanMap<T extends schemas.$ZodLooseShape> = {
|
|
156
|
+
[k in keyof T]: k extends `?${infer K}` ? K : k extends `${infer K}?` ? K : k;
|
|
157
|
+
};
|
|
158
|
+
export type FromCleanMap<T extends schemas.$ZodLooseShape> = {
|
|
159
|
+
[k in keyof T as k extends `?${infer K}` ? K : k extends `${infer K}?` ? K : k]: k;
|
|
160
|
+
};
|
|
161
|
+
export declare const NUMBER_FORMAT_RANGES: Record<checks.$ZodNumberFormats, [number, number]>;
|
|
162
|
+
export declare const BIGINT_FORMAT_RANGES: Record<checks.$ZodBigIntFormats, [bigint, bigint]>;
|
|
163
|
+
export declare function pick(schema: schemas.$ZodObject, mask: Record<string, unknown>): any;
|
|
164
|
+
export declare function omit(schema: schemas.$ZodObject, mask: object): any;
|
|
165
|
+
export declare function extend(schema: schemas.$ZodObject, shape: schemas.$ZodShape): any;
|
|
166
|
+
export declare function merge(a: schemas.$ZodObject, b: schemas.$ZodObject): any;
|
|
167
|
+
export declare function partial(Class: SchemaClass<schemas.$ZodOptional> | null, schema: schemas.$ZodObject, mask: object | undefined): any;
|
|
168
|
+
export declare function required(Class: SchemaClass<schemas.$ZodNonOptional>, schema: schemas.$ZodObject, mask: object | undefined): any;
|
|
169
|
+
export type Constructor<T, Def extends any[] = any[]> = new (...args: Def) => T;
|
|
170
|
+
export declare function aborted(x: schemas.ParsePayload, startIndex?: number): boolean;
|
|
171
|
+
export declare function prefixIssues(path: PropertyKey, issues: errors.$ZodRawIssue[]): errors.$ZodRawIssue[];
|
|
172
|
+
export declare function unwrapMessage(message: string | {
|
|
173
|
+
message: string;
|
|
174
|
+
} | undefined | null): string | undefined;
|
|
175
|
+
export declare function finalizeIssue(iss: errors.$ZodRawIssue, ctx: schemas.ParseContextInternal | undefined, config: $ZodConfig): errors.$ZodIssue;
|
|
176
|
+
export declare function getSizableOrigin(input: any): "set" | "map" | "file" | "unknown";
|
|
177
|
+
export declare function getLengthableOrigin(input: any): "array" | "string" | "unknown";
|
|
178
|
+
export declare function issue(_iss: string, input: any, inst: any): errors.$ZodRawIssue;
|
|
179
|
+
export declare function issue(_iss: errors.$ZodRawIssue): errors.$ZodRawIssue;
|
|
180
|
+
export declare function cleanEnum(obj: Record<string, EnumValue>): EnumValue[];
|
|
181
|
+
export declare abstract class Class {
|
|
182
|
+
constructor(..._args: any[]);
|
|
183
|
+
}
|
|
@@ -129,9 +129,6 @@ export const allowsEval = cached(() => {
|
|
|
129
129
|
return false;
|
|
130
130
|
}
|
|
131
131
|
});
|
|
132
|
-
function _isObject(o) {
|
|
133
|
-
return Object.prototype.toString.call(o) === "[object Object]";
|
|
134
|
-
}
|
|
135
132
|
export function isPlainObject(o) {
|
|
136
133
|
if (isObject(o) === false)
|
|
137
134
|
return false;
|
|
@@ -355,6 +352,7 @@ export function partial(Class, schema, mask) {
|
|
|
355
352
|
}
|
|
356
353
|
if (!mask[key])
|
|
357
354
|
continue;
|
|
355
|
+
// if (oldShape[key]!._zod.optin === "optional") continue;
|
|
358
356
|
shape[key] = Class
|
|
359
357
|
? new Class({
|
|
360
358
|
type: "optional",
|
|
@@ -365,6 +363,7 @@ export function partial(Class, schema, mask) {
|
|
|
365
363
|
}
|
|
366
364
|
else {
|
|
367
365
|
for (const key in oldShape) {
|
|
366
|
+
// if (oldShape[key]!._zod.optin === "optional") continue;
|
|
368
367
|
shape[key] = Class
|
|
369
368
|
? new Class({
|
|
370
369
|
type: "optional",
|
|
@@ -414,7 +413,7 @@ export function required(Class, schema, mask) {
|
|
|
414
413
|
}
|
|
415
414
|
export function aborted(x, startIndex = 0) {
|
|
416
415
|
for (let i = startIndex; i < x.issues.length; i++) {
|
|
417
|
-
if (x.issues[i]
|
|
416
|
+
if (x.issues[i]?.continue !== true)
|
|
418
417
|
return true;
|
|
419
418
|
}
|
|
420
419
|
return false;
|
|
@@ -17,6 +17,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
17
17
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
18
|
};
|
|
19
19
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
-
const index_js_1 = __importDefault(require("./
|
|
21
|
-
__exportStar(require("./
|
|
20
|
+
const index_js_1 = __importDefault(require("./classic/index.cjs"));
|
|
21
|
+
__exportStar(require("./classic/index.cjs"), exports);
|
|
22
22
|
exports.default = index_js_1.default;
|
package/v4/index.d.cts
ADDED
package/v4/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import
|
|
2
|
-
export * from "
|
|
3
|
-
export default
|
|
1
|
+
import z4 from "./classic/index.js";
|
|
2
|
+
export * from "./classic/index.js";
|
|
3
|
+
export default z4;
|
package/v4/index.js
CHANGED
|
@@ -24,7 +24,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.default = default_1;
|
|
27
|
-
const util = __importStar(require("../core/util.
|
|
27
|
+
const util = __importStar(require("../core/util.cjs"));
|
|
28
28
|
const error = () => {
|
|
29
29
|
const Sizable = {
|
|
30
30
|
string: { unit: "حرف", verb: "أن يحوي" },
|
|
@@ -24,7 +24,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.default = default_1;
|
|
27
|
-
const util = __importStar(require("../core/util.
|
|
27
|
+
const util = __importStar(require("../core/util.cjs"));
|
|
28
28
|
const error = () => {
|
|
29
29
|
const Sizable = {
|
|
30
30
|
string: { unit: "simvol", verb: "olmalıdır" },
|
|
@@ -24,7 +24,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.default = default_1;
|
|
27
|
-
const util = __importStar(require("../core/util.
|
|
27
|
+
const util = __importStar(require("../core/util.cjs"));
|
|
28
28
|
function getBelarusianPlural(count, one, few, many) {
|
|
29
29
|
const absCount = Math.abs(count);
|
|
30
30
|
const lastDigit = absCount % 10;
|
|
@@ -24,7 +24,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.default = default_1;
|
|
27
|
-
const util = __importStar(require("../core/util.
|
|
27
|
+
const util = __importStar(require("../core/util.cjs"));
|
|
28
28
|
const error = () => {
|
|
29
29
|
const Sizable = {
|
|
30
30
|
string: { unit: "caràcters", verb: "contenir" },
|
|
@@ -24,7 +24,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.default = default_1;
|
|
27
|
-
const util = __importStar(require("../core/util.
|
|
27
|
+
const util = __importStar(require("../core/util.cjs"));
|
|
28
28
|
const error = () => {
|
|
29
29
|
const Sizable = {
|
|
30
30
|
string: { unit: "znaků", verb: "mít" },
|
|
@@ -24,7 +24,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.default = default_1;
|
|
27
|
-
const util = __importStar(require("../core/util.
|
|
27
|
+
const util = __importStar(require("../core/util.cjs"));
|
|
28
28
|
const error = () => {
|
|
29
29
|
const Sizable = {
|
|
30
30
|
string: { unit: "Zeichen", verb: "zu haben" },
|
|
@@ -25,7 +25,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.parsedType = void 0;
|
|
27
27
|
exports.default = default_1;
|
|
28
|
-
const util = __importStar(require("../core/util.
|
|
28
|
+
const util = __importStar(require("../core/util.cjs"));
|
|
29
29
|
const parsedType = (data) => {
|
|
30
30
|
const t = typeof data;
|
|
31
31
|
switch (t) {
|
package/v4/locales/en.d.ts
CHANGED
|
@@ -1,2 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
1
|
+
import type * as errors from "../core/errors.js";
|
|
2
|
+
export declare const parsedType: (data: any) => string;
|
|
3
|
+
export default function (): {
|
|
4
|
+
localeError: errors.$ZodErrorMap;
|
|
5
|
+
};
|