@willaimg/yatsp 4.3.6
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 +22 -0
- package/compile.cjs +96 -0
- package/compile.d.cts +1 -0
- package/compile.d.ts +1 -0
- package/compile.js +52 -0
- package/index.cjs +52 -0
- package/index.d.cts +3 -0
- package/index.d.ts +3 -0
- package/index.js +7 -0
- package/locales/index.cjs +36 -0
- package/locales/index.d.cts +1 -0
- package/locales/index.d.ts +1 -0
- package/locales/index.js +1 -0
- package/mini/index.cjs +51 -0
- package/mini/index.d.cts +3 -0
- package/mini/index.d.ts +3 -0
- package/mini/index.js +3 -0
- package/package.json +142 -0
- package/src/compile.ts +56 -0
- package/src/index.ts +7 -0
- package/src/locales/index.ts +1 -0
- package/src/mini/index.ts +3 -0
- package/src/v3/YatspError.ts +340 -0
- package/src/v3/benchmarks/datetime.ts +58 -0
- package/src/v3/benchmarks/discriminatedUnion.ts +80 -0
- package/src/v3/benchmarks/index.ts +59 -0
- package/src/v3/benchmarks/ipv4.ts +57 -0
- package/src/v3/benchmarks/object.ts +69 -0
- package/src/v3/benchmarks/primitives.ts +162 -0
- package/src/v3/benchmarks/realworld.ts +63 -0
- package/src/v3/benchmarks/string.ts +55 -0
- package/src/v3/benchmarks/union.ts +80 -0
- package/src/v3/errors.ts +13 -0
- package/src/v3/external.ts +6 -0
- package/src/v3/helpers/enumUtil.ts +17 -0
- package/src/v3/helpers/errorUtil.ts +8 -0
- package/src/v3/helpers/parseUtil.ts +176 -0
- package/src/v3/helpers/partialUtil.ts +34 -0
- package/src/v3/helpers/typeAliases.ts +2 -0
- package/src/v3/helpers/util.ts +224 -0
- package/src/v3/index.ts +4 -0
- package/src/v3/locales/en.ts +124 -0
- package/src/v3/standard-schema.ts +113 -0
- package/src/v3/tests/Mocker.ts +54 -0
- package/src/v3/tests/all-errors.test.ts +157 -0
- package/src/v3/tests/anyunknown.test.ts +28 -0
- package/src/v3/tests/array.test.ts +71 -0
- package/src/v3/tests/async-parsing.test.ts +388 -0
- package/src/v3/tests/async-refinements.test.ts +46 -0
- package/src/v3/tests/base.test.ts +29 -0
- package/src/v3/tests/bigint.test.ts +55 -0
- package/src/v3/tests/branded.test.ts +53 -0
- package/src/v3/tests/catch.test.ts +220 -0
- package/src/v3/tests/coerce.test.ts +133 -0
- package/src/v3/tests/complex.test.ts +70 -0
- package/src/v3/tests/custom.test.ts +31 -0
- package/src/v3/tests/date.test.ts +32 -0
- package/src/v3/tests/deepmasking.test.ts +186 -0
- package/src/v3/tests/default.test.ts +112 -0
- package/src/v3/tests/description.test.ts +33 -0
- package/src/v3/tests/discriminated-unions.test.ts +315 -0
- package/src/v3/tests/enum.test.ts +80 -0
- package/src/v3/tests/error.test.ts +586 -0
- package/src/v3/tests/firstparty.test.ts +87 -0
- package/src/v3/tests/firstpartyschematypes.test.ts +21 -0
- package/src/v3/tests/function.test.ts +261 -0
- package/src/v3/tests/generics.test.ts +48 -0
- package/src/v3/tests/instanceof.test.ts +37 -0
- package/src/v3/tests/intersection.test.ts +128 -0
- package/src/v3/tests/language-server.source.ts +76 -0
- package/src/v3/tests/language-server.test.ts +206 -0
- package/src/v3/tests/literal.test.ts +36 -0
- package/src/v3/tests/map.test.ts +110 -0
- package/src/v3/tests/masking.test.ts +4 -0
- package/src/v3/tests/mocker.test.ts +19 -0
- package/src/v3/tests/nan.test.ts +24 -0
- package/src/v3/tests/nativeEnum.test.ts +87 -0
- package/src/v3/tests/nullable.test.ts +42 -0
- package/src/v3/tests/number.test.ts +176 -0
- package/src/v3/tests/object-augmentation.test.ts +29 -0
- package/src/v3/tests/object-in-es5-env.test.ts +29 -0
- package/src/v3/tests/object.test.ts +431 -0
- package/src/v3/tests/optional.test.ts +42 -0
- package/src/v3/tests/parseUtil.test.ts +23 -0
- package/src/v3/tests/parser.test.ts +41 -0
- package/src/v3/tests/partials.test.ts +243 -0
- package/src/v3/tests/pickomit.test.ts +111 -0
- package/src/v3/tests/pipeline.test.ts +29 -0
- package/src/v3/tests/preprocess.test.ts +186 -0
- package/src/v3/tests/primitive.test.ts +440 -0
- package/src/v3/tests/promise.test.ts +90 -0
- package/src/v3/tests/readonly.test.ts +114 -0
- package/src/v3/tests/record.test.ts +171 -0
- package/src/v3/tests/recursive.test.ts +197 -0
- package/src/v3/tests/refine.test.ts +313 -0
- package/src/v3/tests/safeparse.test.ts +27 -0
- package/src/v3/tests/set.test.ts +142 -0
- package/src/v3/tests/standard-schema.test.ts +83 -0
- package/src/v3/tests/string.test.ts +922 -0
- package/src/v3/tests/transformer.test.ts +233 -0
- package/src/v3/tests/tuple.test.ts +90 -0
- package/src/v3/tests/unions.test.ts +57 -0
- package/src/v3/tests/validations.test.ts +133 -0
- package/src/v3/tests/void.test.ts +15 -0
- package/src/v3/types.ts +5162 -0
- package/src/v4/classic/checks.ts +33 -0
- package/src/v4/classic/coerce.ts +27 -0
- package/src/v4/classic/compat.ts +78 -0
- package/src/v4/classic/deep-partial.ts +76 -0
- package/src/v4/classic/errors.ts +97 -0
- package/src/v4/classic/external.ts +57 -0
- package/src/v4/classic/from-json-schema.ts +944 -0
- package/src/v4/classic/in-out.ts +45 -0
- package/src/v4/classic/index.ts +5 -0
- package/src/v4/classic/iso.ts +20 -0
- package/src/v4/classic/parse.ts +88 -0
- package/src/v4/classic/schemas.ts +2994 -0
- package/src/v4/classic/tests/anyunknown.test.ts +26 -0
- package/src/v4/classic/tests/apply.test.ts +86 -0
- package/src/v4/classic/tests/array.test.ts +264 -0
- package/src/v4/classic/tests/assignability.test.ts +402 -0
- package/src/v4/classic/tests/async-parsing.test.ts +381 -0
- package/src/v4/classic/tests/async-refinements.test.ts +68 -0
- package/src/v4/classic/tests/base.test.ts +7 -0
- package/src/v4/classic/tests/bigint.test.ts +89 -0
- package/src/v4/classic/tests/brand.test.ts +106 -0
- package/src/v4/classic/tests/catch.test.ts +604 -0
- package/src/v4/classic/tests/coalesce.test.ts +20 -0
- package/src/v4/classic/tests/codec-examples.test.ts +572 -0
- package/src/v4/classic/tests/codec.test.ts +704 -0
- package/src/v4/classic/tests/coerce.test.ts +160 -0
- package/src/v4/classic/tests/continuability.test.ts +374 -0
- package/src/v4/classic/tests/credit-card.test.ts +76 -0
- package/src/v4/classic/tests/custom.test.ts +40 -0
- package/src/v4/classic/tests/cyclic-data.test.ts +985 -0
- package/src/v4/classic/tests/date.test.ts +92 -0
- package/src/v4/classic/tests/datetime.test.ts +316 -0
- package/src/v4/classic/tests/deep-partial.test.ts +380 -0
- package/src/v4/classic/tests/default-locale.test.ts +32 -0
- package/src/v4/classic/tests/default.test.ts +455 -0
- package/src/v4/classic/tests/describe-meta-checks.test.ts +27 -0
- package/src/v4/classic/tests/description.test.ts +32 -0
- package/src/v4/classic/tests/detached-methods.test.ts +226 -0
- package/src/v4/classic/tests/discriminated-unions.test.ts +942 -0
- package/src/v4/classic/tests/enum.test.ts +305 -0
- package/src/v4/classic/tests/error-utils.test.ts +917 -0
- package/src/v4/classic/tests/error.test.ts +1108 -0
- package/src/v4/classic/tests/file.test.ts +96 -0
- package/src/v4/classic/tests/firstparty.test.ts +179 -0
- package/src/v4/classic/tests/fix-json-issue.test.ts +26 -0
- package/src/v4/classic/tests/from-json-schema.test.ts +1467 -0
- package/src/v4/classic/tests/function.test.ts +391 -0
- package/src/v4/classic/tests/generics.test.ts +72 -0
- package/src/v4/classic/tests/global-config.test.ts +32 -0
- package/src/v4/classic/tests/hash.test.ts +67 -0
- package/src/v4/classic/tests/iban.test.ts +81 -0
- package/src/v4/classic/tests/in-out.test.ts +159 -0
- package/src/v4/classic/tests/index.test.ts +958 -0
- package/src/v4/classic/tests/instance-footprint.test.ts +319 -0
- package/src/v4/classic/tests/instanceof.test.ts +127 -0
- package/src/v4/classic/tests/intersection.test.ts +334 -0
- package/src/v4/classic/tests/issue-schema.test.ts +215 -0
- package/src/v4/classic/tests/jitless-allows-eval.test.ts +39 -0
- package/src/v4/classic/tests/json.test.ts +109 -0
- package/src/v4/classic/tests/lazy.test.ts +262 -0
- package/src/v4/classic/tests/literal.test.ts +128 -0
- package/src/v4/classic/tests/locales_ka.test.ts +29 -0
- package/src/v4/classic/tests/locales_ro.test.ts +24 -0
- package/src/v4/classic/tests/map.test.ts +342 -0
- package/src/v4/classic/tests/nan.test.ts +21 -0
- package/src/v4/classic/tests/nested-refine.test.ts +168 -0
- package/src/v4/classic/tests/nonoptional.test.ts +101 -0
- package/src/v4/classic/tests/nullable.test.ts +22 -0
- package/src/v4/classic/tests/number.test.ts +401 -0
- package/src/v4/classic/tests/object.test.ts +1006 -0
- package/src/v4/classic/tests/optin-ladder.test.ts +235 -0
- package/src/v4/classic/tests/optional.test.ts +366 -0
- package/src/v4/classic/tests/partial.test.ts +497 -0
- package/src/v4/classic/tests/pickomit.test.ts +211 -0
- package/src/v4/classic/tests/pipe.test.ts +101 -0
- package/src/v4/classic/tests/prefault.test.ts +144 -0
- package/src/v4/classic/tests/preprocess-types.test.ts +44 -0
- package/src/v4/classic/tests/preprocess.test.ts +351 -0
- package/src/v4/classic/tests/primitive.test.ts +175 -0
- package/src/v4/classic/tests/promise.test.ts +81 -0
- package/src/v4/classic/tests/properties.test.ts +141 -0
- package/src/v4/classic/tests/prototypes.test.ts +23 -0
- package/src/v4/classic/tests/readonly.test.ts +184 -0
- package/src/v4/classic/tests/record.test.ts +885 -0
- package/src/v4/classic/tests/recursive-types.test.ts +707 -0
- package/src/v4/classic/tests/redos.test.ts +68 -0
- package/src/v4/classic/tests/refine.test.ts +693 -0
- package/src/v4/classic/tests/registries.test.ts +243 -0
- package/src/v4/classic/tests/set.test.ts +190 -0
- package/src/v4/classic/tests/standard-schema.test.ts +153 -0
- package/src/v4/classic/tests/string-formats.test.ts +125 -0
- package/src/v4/classic/tests/string.test.ts +1440 -0
- package/src/v4/classic/tests/stringbool.test.ts +124 -0
- package/src/v4/classic/tests/template-literal.test.ts +814 -0
- package/src/v4/classic/tests/to-json-schema-methods.test.ts +438 -0
- package/src/v4/classic/tests/to-json-schema.test.ts +4733 -0
- package/src/v4/classic/tests/transform.test.ts +378 -0
- package/src/v4/classic/tests/tuple.test.ts +511 -0
- package/src/v4/classic/tests/union.test.ts +310 -0
- package/src/v4/classic/tests/url.test.ts +13 -0
- package/src/v4/classic/tests/validate.test.ts +645 -0
- package/src/v4/classic/tests/validations.test.ts +283 -0
- package/src/v4/classic/tests/void.test.ts +12 -0
- package/src/v4/core/api.ts +1913 -0
- package/src/v4/core/checks.ts +1274 -0
- package/src/v4/core/compile.ts +2315 -0
- package/src/v4/core/core.ts +230 -0
- package/src/v4/core/doc.ts +52 -0
- package/src/v4/core/errors.ts +546 -0
- package/src/v4/core/index.ts +19 -0
- package/src/v4/core/json-schema-generator.ts +131 -0
- package/src/v4/core/json-schema-processors.ts +934 -0
- package/src/v4/core/json-schema.ts +148 -0
- package/src/v4/core/memoizer.ts +331 -0
- package/src/v4/core/parse.ts +309 -0
- package/src/v4/core/regexes.ts +217 -0
- package/src/v4/core/registries.ts +109 -0
- package/src/v4/core/schemas.ts +5295 -0
- package/src/v4/core/standard-schema.ts +159 -0
- package/src/v4/core/tests/cached.test.ts +54 -0
- package/src/v4/core/tests/compile-differential.test.ts +1004 -0
- package/src/v4/core/tests/compile-generative.test.ts +445 -0
- package/src/v4/core/tests/compile-global.test.ts +89 -0
- package/src/v4/core/tests/compile-off-by-default.test.ts +26 -0
- package/src/v4/core/tests/compile-stats.test.ts +34 -0
- package/src/v4/core/tests/compile.test.ts +2040 -0
- package/src/v4/core/tests/email-regex.test.ts +140 -0
- package/src/v4/core/tests/extend.test.ts +59 -0
- package/src/v4/core/tests/index.test.ts +46 -0
- package/src/v4/core/tests/locales/be.test.ts +124 -0
- package/src/v4/core/tests/locales/el.test.ts +214 -0
- package/src/v4/core/tests/locales/en.test.ts +22 -0
- package/src/v4/core/tests/locales/es.test.ts +180 -0
- package/src/v4/core/tests/locales/fr.test.ts +72 -0
- package/src/v4/core/tests/locales/he.test.ts +379 -0
- package/src/v4/core/tests/locales/hr.test.ts +163 -0
- package/src/v4/core/tests/locales/nl.test.ts +46 -0
- package/src/v4/core/tests/locales/parity.test.ts +42 -0
- package/src/v4/core/tests/locales/ru.test.ts +128 -0
- package/src/v4/core/tests/locales/tg.test.ts +85 -0
- package/src/v4/core/tests/locales/tk.test.ts +69 -0
- package/src/v4/core/tests/locales/tr.test.ts +69 -0
- package/src/v4/core/tests/locales/uz.test.ts +105 -0
- package/src/v4/core/tests/polyfill-collision.test.ts +46 -0
- package/src/v4/core/tests/record-constructor.test.ts +125 -0
- package/src/v4/core/tests/recursive-tuples.test.ts +45 -0
- package/src/v4/core/tests/treeshake.test.ts +51 -0
- package/src/v4/core/tests/url-no-canparse.test.ts +133 -0
- package/src/v4/core/to-json-schema.ts +857 -0
- package/src/v4/core/util.ts +1284 -0
- package/src/v4/core/versions.ts +5 -0
- package/src/v4/core/visit.ts +193 -0
- package/src/v4/core/zsf.ts +323 -0
- package/src/v4/index.ts +4 -0
- package/src/v4/locales/ar.ts +120 -0
- package/src/v4/locales/az.ts +116 -0
- package/src/v4/locales/be.ts +188 -0
- package/src/v4/locales/bg.ts +133 -0
- package/src/v4/locales/bn.ts +123 -0
- package/src/v4/locales/ca.ts +121 -0
- package/src/v4/locales/ckb.ts +140 -0
- package/src/v4/locales/cs.ts +123 -0
- package/src/v4/locales/da.ts +128 -0
- package/src/v4/locales/de.ts +121 -0
- package/src/v4/locales/el.ts +124 -0
- package/src/v4/locales/en.ts +136 -0
- package/src/v4/locales/eo.ts +123 -0
- package/src/v4/locales/es.ts +145 -0
- package/src/v4/locales/fa.ts +131 -0
- package/src/v4/locales/fi.ts +126 -0
- package/src/v4/locales/fr-CA.ts +121 -0
- package/src/v4/locales/fr.ts +139 -0
- package/src/v4/locales/gu.ts +123 -0
- package/src/v4/locales/he.ts +253 -0
- package/src/v4/locales/hi.ts +126 -0
- package/src/v4/locales/hr.ts +135 -0
- package/src/v4/locales/hu.ts +122 -0
- package/src/v4/locales/hy.ts +175 -0
- package/src/v4/locales/id.ts +120 -0
- package/src/v4/locales/index.ts +63 -0
- package/src/v4/locales/is.ts +124 -0
- package/src/v4/locales/it.ts +121 -0
- package/src/v4/locales/ja.ts +119 -0
- package/src/v4/locales/ka.ts +128 -0
- package/src/v4/locales/kh.ts +7 -0
- package/src/v4/locales/km.ts +124 -0
- package/src/v4/locales/kn.ts +126 -0
- package/src/v4/locales/ko.ts +126 -0
- package/src/v4/locales/lt.ts +243 -0
- package/src/v4/locales/mk.ts +123 -0
- package/src/v4/locales/ms.ts +120 -0
- package/src/v4/locales/ne.ts +128 -0
- package/src/v4/locales/nl.ts +126 -0
- package/src/v4/locales/nn.ts +121 -0
- package/src/v4/locales/no.ts +121 -0
- package/src/v4/locales/ota.ts +122 -0
- package/src/v4/locales/pl.ts +123 -0
- package/src/v4/locales/ps.ts +131 -0
- package/src/v4/locales/pt-BR.ts +161 -0
- package/src/v4/locales/pt.ts +159 -0
- package/src/v4/locales/ro.ts +132 -0
- package/src/v4/locales/ru.ts +188 -0
- package/src/v4/locales/sk.ts +123 -0
- package/src/v4/locales/sl.ts +123 -0
- package/src/v4/locales/sv.ts +124 -0
- package/src/v4/locales/ta.ts +123 -0
- package/src/v4/locales/tg.ts +135 -0
- package/src/v4/locales/th.ts +124 -0
- package/src/v4/locales/tk.ts +113 -0
- package/src/v4/locales/tr.ts +116 -0
- package/src/v4/locales/ua.ts +7 -0
- package/src/v4/locales/uk.ts +122 -0
- package/src/v4/locales/ur.ts +124 -0
- package/src/v4/locales/uz.ts +120 -0
- package/src/v4/locales/vi.ts +122 -0
- package/src/v4/locales/yo.ts +129 -0
- package/src/v4/locales/zh-CN.ts +121 -0
- package/src/v4/locales/zh-TW.ts +120 -0
- package/src/v4/mini/checks.ts +33 -0
- package/src/v4/mini/coerce.ts +27 -0
- package/src/v4/mini/deep-partial.ts +73 -0
- package/src/v4/mini/external.ts +52 -0
- package/src/v4/mini/in-out.ts +45 -0
- package/src/v4/mini/index.ts +3 -0
- package/src/v4/mini/iso.ts +66 -0
- package/src/v4/mini/parse.ts +16 -0
- package/src/v4/mini/schemas.ts +2093 -0
- package/src/v4/mini/tests/apply.test.ts +57 -0
- package/src/v4/mini/tests/assignability.test.ts +190 -0
- package/src/v4/mini/tests/brand.test.ts +94 -0
- package/src/v4/mini/tests/checks.test.ts +158 -0
- package/src/v4/mini/tests/codec.test.ts +582 -0
- package/src/v4/mini/tests/computed.test.ts +30 -0
- package/src/v4/mini/tests/cyclic-data.test.ts +84 -0
- package/src/v4/mini/tests/deep-partial.test.ts +54 -0
- package/src/v4/mini/tests/error.test.ts +41 -0
- package/src/v4/mini/tests/functions.test.ts +14 -0
- package/src/v4/mini/tests/index.test.ts +1148 -0
- package/src/v4/mini/tests/number.test.ts +109 -0
- package/src/v4/mini/tests/object.test.ts +292 -0
- package/src/v4/mini/tests/prototypes.test.ts +43 -0
- package/src/v4/mini/tests/recursive-types.test.ts +341 -0
- package/src/v4/mini/tests/standard-schema.test.ts +50 -0
- package/src/v4/mini/tests/string.test.ts +396 -0
- package/src/v4-mini/index.ts +3 -0
- package/v3/YatspError.cjs +167 -0
- package/v3/YatspError.d.cts +164 -0
- package/v3/YatspError.d.ts +164 -0
- package/v3/YatspError.js +143 -0
- package/v3/errors.cjs +36 -0
- package/v3/errors.d.cts +5 -0
- package/v3/errors.d.ts +5 -0
- package/v3/errors.js +9 -0
- package/v3/external.cjs +41 -0
- package/v3/external.d.cts +6 -0
- package/v3/external.d.ts +6 -0
- package/v3/external.js +6 -0
- package/v3/helpers/enumUtil.cjs +21 -0
- package/v3/helpers/enumUtil.d.cts +8 -0
- package/v3/helpers/enumUtil.d.ts +8 -0
- package/v3/helpers/enumUtil.js +1 -0
- package/v3/helpers/errorUtil.cjs +28 -0
- package/v3/helpers/errorUtil.d.cts +9 -0
- package/v3/helpers/errorUtil.d.ts +9 -0
- package/v3/helpers/errorUtil.js +6 -0
- package/v3/helpers/parseUtil.cjs +143 -0
- package/v3/helpers/parseUtil.d.cts +78 -0
- package/v3/helpers/parseUtil.d.ts +78 -0
- package/v3/helpers/parseUtil.js +109 -0
- package/v3/helpers/partialUtil.cjs +21 -0
- package/v3/helpers/partialUtil.d.cts +8 -0
- package/v3/helpers/partialUtil.d.ts +8 -0
- package/v3/helpers/partialUtil.js +1 -0
- package/v3/helpers/typeAliases.cjs +21 -0
- package/v3/helpers/typeAliases.d.cts +2 -0
- package/v3/helpers/typeAliases.d.ts +2 -0
- package/v3/helpers/typeAliases.js +1 -0
- package/v3/helpers/util.cjs +156 -0
- package/v3/helpers/util.d.cts +85 -0
- package/v3/helpers/util.d.ts +85 -0
- package/v3/helpers/util.js +133 -0
- package/v3/index.cjs +52 -0
- package/v3/index.d.cts +4 -0
- package/v3/index.d.ts +4 -0
- package/v3/index.js +4 -0
- package/v3/locales/en.cjs +112 -0
- package/v3/locales/en.d.cts +3 -0
- package/v3/locales/en.d.ts +3 -0
- package/v3/locales/en.js +109 -0
- package/v3/standard-schema.cjs +21 -0
- package/v3/standard-schema.d.cts +102 -0
- package/v3/standard-schema.d.ts +102 -0
- package/v3/standard-schema.js +1 -0
- package/v3/types.cjs +3798 -0
- package/v3/types.d.cts +1034 -0
- package/v3/types.d.ts +1034 -0
- package/v3/types.js +3697 -0
- package/v4/classic/checks.cjs +53 -0
- package/v4/classic/checks.d.cts +1 -0
- package/v4/classic/checks.d.ts +1 -0
- package/v4/classic/checks.js +1 -0
- package/v4/classic/coerce.cjs +66 -0
- package/v4/classic/coerce.d.cts +17 -0
- package/v4/classic/coerce.d.ts +17 -0
- package/v4/classic/coerce.js +17 -0
- package/v4/classic/compat.cjs +80 -0
- package/v4/classic/compat.d.cts +48 -0
- package/v4/classic/compat.d.ts +48 -0
- package/v4/classic/compat.js +31 -0
- package/v4/classic/deep-partial.cjs +58 -0
- package/v4/classic/deep-partial.d.cts +14 -0
- package/v4/classic/deep-partial.d.ts +14 -0
- package/v4/classic/deep-partial.js +13 -0
- package/v4/classic/errors.cjs +102 -0
- package/v4/classic/errors.d.cts +29 -0
- package/v4/classic/errors.d.ts +29 -0
- package/v4/classic/errors.js +57 -0
- package/v4/classic/external.cjs +97 -0
- package/v4/classic/external.d.cts +19 -0
- package/v4/classic/external.d.ts +19 -0
- package/v4/classic/external.js +17 -0
- package/v4/classic/from-json-schema.cjs +926 -0
- package/v4/classic/from-json-schema.d.cts +12 -0
- package/v4/classic/from-json-schema.d.ts +12 -0
- package/v4/classic/from-json-schema.js +881 -0
- package/v4/classic/in-out.cjs +82 -0
- package/v4/classic/in-out.d.cts +8 -0
- package/v4/classic/in-out.d.ts +8 -0
- package/v4/classic/in-out.js +36 -0
- package/v4/classic/index.cjs +52 -0
- package/v4/classic/index.d.cts +3 -0
- package/v4/classic/index.d.ts +3 -0
- package/v4/classic/index.js +4 -0
- package/v4/classic/iso.cjs +68 -0
- package/v4/classic/iso.d.cts +7 -0
- package/v4/classic/iso.d.ts +7 -0
- package/v4/classic/iso.js +15 -0
- package/v4/classic/parse.cjs +63 -0
- package/v4/classic/parse.d.cts +44 -0
- package/v4/classic/parse.d.ts +44 -0
- package/v4/classic/parse.js +16 -0
- package/v4/classic/schemas.cjs +1676 -0
- package/v4/classic/schemas.d.cts +816 -0
- package/v4/classic/schemas.d.ts +816 -0
- package/v4/classic/schemas.js +1535 -0
- package/v4/core/api.cjs +1269 -0
- package/v4/core/api.d.cts +335 -0
- package/v4/core/api.d.ts +335 -0
- package/v4/core/api.js +1107 -0
- package/v4/core/checks.cjs +561 -0
- package/v4/core/checks.d.cts +294 -0
- package/v4/core/checks.d.ts +294 -0
- package/v4/core/checks.js +516 -0
- package/v4/core/compile.cjs +1908 -0
- package/v4/core/compile.d.cts +65 -0
- package/v4/core/compile.d.ts +65 -0
- package/v4/core/compile.js +1858 -0
- package/v4/core/core.cjs +167 -0
- package/v4/core/core.d.cts +82 -0
- package/v4/core/core.d.ts +82 -0
- package/v4/core/core.js +141 -0
- package/v4/core/doc.cjs +61 -0
- package/v4/core/doc.d.cts +16 -0
- package/v4/core/doc.d.ts +16 -0
- package/v4/core/doc.js +38 -0
- package/v4/core/errors.cjs +317 -0
- package/v4/core/errors.d.cts +225 -0
- package/v4/core/errors.d.ts +225 -0
- package/v4/core/errors.js +267 -0
- package/v4/core/index.cjs +70 -0
- package/v4/core/index.d.cts +19 -0
- package/v4/core/index.d.ts +19 -0
- package/v4/core/index.js +19 -0
- package/v4/core/json-schema-generator.cjs +122 -0
- package/v4/core/json-schema-generator.d.cts +65 -0
- package/v4/core/json-schema-generator.d.ts +65 -0
- package/v4/core/json-schema-generator.js +99 -0
- package/v4/core/json-schema-processors.cjs +929 -0
- package/v4/core/json-schema-processors.d.cts +65 -0
- package/v4/core/json-schema-processors.d.ts +65 -0
- package/v4/core/json-schema-processors.js +843 -0
- package/v4/core/json-schema.cjs +21 -0
- package/v4/core/json-schema.d.cts +89 -0
- package/v4/core/json-schema.d.ts +89 -0
- package/v4/core/json-schema.js +1 -0
- package/v4/core/memoizer.cjs +360 -0
- package/v4/core/memoizer.d.cts +15 -0
- package/v4/core/memoizer.d.ts +15 -0
- package/v4/core/memoizer.js +311 -0
- package/v4/core/parse.cjs +233 -0
- package/v4/core/parse.d.cts +52 -0
- package/v4/core/parse.d.ts +52 -0
- package/v4/core/parse.js +175 -0
- package/v4/core/regexes.cjs +209 -0
- package/v4/core/regexes.d.cts +90 -0
- package/v4/core/regexes.d.ts +90 -0
- package/v4/core/regexes.js +156 -0
- package/v4/core/registries.cjs +76 -0
- package/v4/core/registries.d.cts +35 -0
- package/v4/core/registries.d.ts +35 -0
- package/v4/core/registries.js +52 -0
- package/v4/core/schemas.cjs +2669 -0
- package/v4/core/schemas.d.cts +1273 -0
- package/v4/core/schemas.d.ts +1273 -0
- package/v4/core/schemas.js +2606 -0
- package/v4/core/standard-schema.cjs +21 -0
- package/v4/core/standard-schema.d.cts +126 -0
- package/v4/core/standard-schema.d.ts +126 -0
- package/v4/core/standard-schema.js +1 -0
- package/v4/core/to-json-schema.cjs +681 -0
- package/v4/core/to-json-schema.d.cts +154 -0
- package/v4/core/to-json-schema.d.ts +154 -0
- package/v4/core/to-json-schema.js +651 -0
- package/v4/core/util.cjs +949 -0
- package/v4/core/util.d.cts +278 -0
- package/v4/core/util.d.ts +278 -0
- package/v4/core/util.js +859 -0
- package/v4/core/versions.cjs +27 -0
- package/v4/core/versions.d.cts +5 -0
- package/v4/core/versions.d.ts +5 -0
- package/v4/core/versions.js +5 -0
- package/v4/core/visit.cjs +214 -0
- package/v4/core/visit.d.cts +30 -0
- package/v4/core/visit.d.ts +30 -0
- package/v4/core/visit.js +169 -0
- package/v4/index.cjs +51 -0
- package/v4/index.d.cts +3 -0
- package/v4/index.d.ts +3 -0
- package/v4/index.js +4 -0
- package/v4/locales/ar.cjs +138 -0
- package/v4/locales/ar.d.cts +5 -0
- package/v4/locales/ar.d.ts +4 -0
- package/v4/locales/ar.js +111 -0
- package/v4/locales/az.cjs +137 -0
- package/v4/locales/az.d.cts +5 -0
- package/v4/locales/az.d.ts +4 -0
- package/v4/locales/az.js +110 -0
- package/v4/locales/be.cjs +195 -0
- package/v4/locales/be.d.cts +5 -0
- package/v4/locales/be.d.ts +4 -0
- package/v4/locales/be.js +168 -0
- package/v4/locales/bg.cjs +152 -0
- package/v4/locales/bg.d.cts +5 -0
- package/v4/locales/bg.d.ts +4 -0
- package/v4/locales/bg.js +125 -0
- package/v4/locales/bn.cjs +140 -0
- package/v4/locales/bn.d.cts +5 -0
- package/v4/locales/bn.d.ts +4 -0
- package/v4/locales/bn.js +113 -0
- package/v4/locales/ca.cjs +139 -0
- package/v4/locales/ca.d.cts +5 -0
- package/v4/locales/ca.d.ts +4 -0
- package/v4/locales/ca.js +112 -0
- package/v4/locales/ckb.cjs +160 -0
- package/v4/locales/ckb.d.cts +5 -0
- package/v4/locales/ckb.d.ts +4 -0
- package/v4/locales/ckb.js +133 -0
- package/v4/locales/cs.cjs +143 -0
- package/v4/locales/cs.d.cts +5 -0
- package/v4/locales/cs.d.ts +4 -0
- package/v4/locales/cs.js +116 -0
- package/v4/locales/da.cjs +147 -0
- package/v4/locales/da.d.cts +5 -0
- package/v4/locales/da.d.ts +4 -0
- package/v4/locales/da.js +120 -0
- package/v4/locales/de.cjs +140 -0
- package/v4/locales/de.d.cts +5 -0
- package/v4/locales/de.d.ts +4 -0
- package/v4/locales/de.js +113 -0
- package/v4/locales/el.cjs +139 -0
- package/v4/locales/el.d.cts +5 -0
- package/v4/locales/el.d.ts +4 -0
- package/v4/locales/el.js +112 -0
- package/v4/locales/en.cjs +152 -0
- package/v4/locales/en.d.cts +5 -0
- package/v4/locales/en.d.ts +4 -0
- package/v4/locales/en.js +125 -0
- package/v4/locales/eo.cjs +141 -0
- package/v4/locales/eo.d.cts +5 -0
- package/v4/locales/eo.d.ts +4 -0
- package/v4/locales/eo.js +114 -0
- package/v4/locales/es.cjs +163 -0
- package/v4/locales/es.d.cts +5 -0
- package/v4/locales/es.d.ts +4 -0
- package/v4/locales/es.js +136 -0
- package/v4/locales/fa.cjs +146 -0
- package/v4/locales/fa.d.cts +5 -0
- package/v4/locales/fa.d.ts +4 -0
- package/v4/locales/fa.js +119 -0
- package/v4/locales/fi.cjs +144 -0
- package/v4/locales/fi.d.cts +5 -0
- package/v4/locales/fi.d.ts +4 -0
- package/v4/locales/fi.js +117 -0
- package/v4/locales/fr-CA.cjs +139 -0
- package/v4/locales/fr-CA.d.cts +5 -0
- package/v4/locales/fr-CA.d.ts +4 -0
- package/v4/locales/fr-CA.js +112 -0
- package/v4/locales/fr.cjs +156 -0
- package/v4/locales/fr.d.cts +5 -0
- package/v4/locales/fr.d.ts +4 -0
- package/v4/locales/fr.js +129 -0
- package/v4/locales/gu.cjs +140 -0
- package/v4/locales/gu.d.cts +5 -0
- package/v4/locales/gu.d.ts +4 -0
- package/v4/locales/gu.js +113 -0
- package/v4/locales/he.cjs +248 -0
- package/v4/locales/he.d.cts +5 -0
- package/v4/locales/he.d.ts +4 -0
- package/v4/locales/he.js +221 -0
- package/v4/locales/hi.cjs +138 -0
- package/v4/locales/hi.d.cts +5 -0
- package/v4/locales/hi.d.ts +4 -0
- package/v4/locales/hi.js +111 -0
- package/v4/locales/hr.cjs +153 -0
- package/v4/locales/hr.d.cts +5 -0
- package/v4/locales/hr.d.ts +4 -0
- package/v4/locales/hr.js +126 -0
- package/v4/locales/hu.cjs +140 -0
- package/v4/locales/hu.d.cts +5 -0
- package/v4/locales/hu.d.ts +4 -0
- package/v4/locales/hu.js +113 -0
- package/v4/locales/hy.cjs +185 -0
- package/v4/locales/hy.d.cts +5 -0
- package/v4/locales/hy.d.ts +4 -0
- package/v4/locales/hy.js +158 -0
- package/v4/locales/id.cjs +138 -0
- package/v4/locales/id.d.cts +5 -0
- package/v4/locales/id.d.ts +4 -0
- package/v4/locales/id.js +111 -0
- package/v4/locales/index.cjs +152 -0
- package/v4/locales/index.d.cts +63 -0
- package/v4/locales/index.d.ts +63 -0
- package/v4/locales/index.js +63 -0
- package/v4/locales/is.cjs +141 -0
- package/v4/locales/is.d.cts +5 -0
- package/v4/locales/is.d.ts +4 -0
- package/v4/locales/is.js +114 -0
- package/v4/locales/it.cjs +140 -0
- package/v4/locales/it.d.cts +5 -0
- package/v4/locales/it.d.ts +4 -0
- package/v4/locales/it.js +113 -0
- package/v4/locales/ja.cjs +139 -0
- package/v4/locales/ja.d.cts +5 -0
- package/v4/locales/ja.d.ts +4 -0
- package/v4/locales/ja.js +112 -0
- package/v4/locales/ka.cjs +144 -0
- package/v4/locales/ka.d.cts +5 -0
- package/v4/locales/ka.d.ts +4 -0
- package/v4/locales/ka.js +117 -0
- package/v4/locales/kh.cjs +12 -0
- package/v4/locales/kh.d.cts +5 -0
- package/v4/locales/kh.d.ts +5 -0
- package/v4/locales/kh.js +5 -0
- package/v4/locales/km.cjs +142 -0
- package/v4/locales/km.d.cts +5 -0
- package/v4/locales/km.d.ts +4 -0
- package/v4/locales/km.js +115 -0
- package/v4/locales/kn.cjs +143 -0
- package/v4/locales/kn.d.cts +5 -0
- package/v4/locales/kn.d.ts +4 -0
- package/v4/locales/kn.js +116 -0
- package/v4/locales/ko.cjs +143 -0
- package/v4/locales/ko.d.cts +5 -0
- package/v4/locales/ko.d.ts +4 -0
- package/v4/locales/ko.js +116 -0
- package/v4/locales/lt.cjs +234 -0
- package/v4/locales/lt.d.cts +5 -0
- package/v4/locales/lt.d.ts +4 -0
- package/v4/locales/lt.js +207 -0
- package/v4/locales/mk.cjs +141 -0
- package/v4/locales/mk.d.cts +5 -0
- package/v4/locales/mk.d.ts +4 -0
- package/v4/locales/mk.js +114 -0
- package/v4/locales/ms.cjs +139 -0
- package/v4/locales/ms.d.cts +5 -0
- package/v4/locales/ms.d.ts +4 -0
- package/v4/locales/ms.js +112 -0
- package/v4/locales/ne.cjs +138 -0
- package/v4/locales/ne.d.cts +5 -0
- package/v4/locales/ne.d.ts +4 -0
- package/v4/locales/ne.js +111 -0
- package/v4/locales/nl.cjs +142 -0
- package/v4/locales/nl.d.cts +5 -0
- package/v4/locales/nl.d.ts +4 -0
- package/v4/locales/nl.js +115 -0
- package/v4/locales/nn.cjs +140 -0
- package/v4/locales/nn.d.cts +5 -0
- package/v4/locales/nn.d.ts +4 -0
- package/v4/locales/nn.js +113 -0
- package/v4/locales/no.cjs +140 -0
- package/v4/locales/no.d.cts +5 -0
- package/v4/locales/no.d.ts +4 -0
- package/v4/locales/no.js +113 -0
- package/v4/locales/ota.cjs +141 -0
- package/v4/locales/ota.d.cts +5 -0
- package/v4/locales/ota.d.ts +4 -0
- package/v4/locales/ota.js +114 -0
- package/v4/locales/pl.cjs +141 -0
- package/v4/locales/pl.d.cts +5 -0
- package/v4/locales/pl.d.ts +4 -0
- package/v4/locales/pl.js +114 -0
- package/v4/locales/ps.cjs +146 -0
- package/v4/locales/ps.d.cts +5 -0
- package/v4/locales/ps.d.ts +4 -0
- package/v4/locales/ps.js +119 -0
- package/v4/locales/pt-BR.cjs +170 -0
- package/v4/locales/pt-BR.d.cts +5 -0
- package/v4/locales/pt-BR.d.ts +4 -0
- package/v4/locales/pt-BR.js +143 -0
- package/v4/locales/pt.cjs +169 -0
- package/v4/locales/pt.d.cts +5 -0
- package/v4/locales/pt.d.ts +4 -0
- package/v4/locales/pt.js +142 -0
- package/v4/locales/ro.cjs +149 -0
- package/v4/locales/ro.d.cts +5 -0
- package/v4/locales/ro.d.ts +4 -0
- package/v4/locales/ro.js +122 -0
- package/v4/locales/ru.cjs +195 -0
- package/v4/locales/ru.d.cts +5 -0
- package/v4/locales/ru.d.ts +4 -0
- package/v4/locales/ru.js +168 -0
- package/v4/locales/sk.cjs +143 -0
- package/v4/locales/sk.d.cts +5 -0
- package/v4/locales/sk.d.ts +4 -0
- package/v4/locales/sk.js +116 -0
- package/v4/locales/sl.cjs +141 -0
- package/v4/locales/sl.d.cts +5 -0
- package/v4/locales/sl.d.ts +4 -0
- package/v4/locales/sl.js +114 -0
- package/v4/locales/sv.cjs +142 -0
- package/v4/locales/sv.d.cts +5 -0
- package/v4/locales/sv.d.ts +4 -0
- package/v4/locales/sv.js +115 -0
- package/v4/locales/ta.cjs +142 -0
- package/v4/locales/ta.d.cts +5 -0
- package/v4/locales/ta.d.ts +4 -0
- package/v4/locales/ta.js +115 -0
- package/v4/locales/tg.cjs +144 -0
- package/v4/locales/tg.d.cts +5 -0
- package/v4/locales/tg.d.ts +4 -0
- package/v4/locales/tg.js +117 -0
- package/v4/locales/th.cjs +142 -0
- package/v4/locales/th.d.cts +5 -0
- package/v4/locales/th.d.ts +4 -0
- package/v4/locales/th.js +115 -0
- package/v4/locales/tk.cjs +134 -0
- package/v4/locales/tk.d.cts +5 -0
- package/v4/locales/tk.d.ts +4 -0
- package/v4/locales/tk.js +107 -0
- package/v4/locales/tr.cjs +137 -0
- package/v4/locales/tr.d.cts +5 -0
- package/v4/locales/tr.d.ts +4 -0
- package/v4/locales/tr.js +110 -0
- package/v4/locales/ua.cjs +12 -0
- package/v4/locales/ua.d.cts +5 -0
- package/v4/locales/ua.d.ts +5 -0
- package/v4/locales/ua.js +5 -0
- package/v4/locales/uk.cjs +140 -0
- package/v4/locales/uk.d.cts +5 -0
- package/v4/locales/uk.d.ts +4 -0
- package/v4/locales/uk.js +113 -0
- package/v4/locales/ur.cjs +142 -0
- package/v4/locales/ur.d.cts +5 -0
- package/v4/locales/ur.d.ts +4 -0
- package/v4/locales/ur.js +115 -0
- package/v4/locales/uz.cjs +140 -0
- package/v4/locales/uz.d.cts +5 -0
- package/v4/locales/uz.d.ts +4 -0
- package/v4/locales/uz.js +113 -0
- package/v4/locales/vi.cjs +140 -0
- package/v4/locales/vi.d.cts +5 -0
- package/v4/locales/vi.d.ts +4 -0
- package/v4/locales/vi.js +113 -0
- package/v4/locales/yo.cjs +139 -0
- package/v4/locales/yo.d.cts +5 -0
- package/v4/locales/yo.d.ts +4 -0
- package/v4/locales/yo.js +112 -0
- package/v4/locales/zh-CN.cjs +141 -0
- package/v4/locales/zh-CN.d.cts +5 -0
- package/v4/locales/zh-CN.d.ts +4 -0
- package/v4/locales/zh-CN.js +114 -0
- package/v4/locales/zh-TW.cjs +139 -0
- package/v4/locales/zh-TW.d.cts +5 -0
- package/v4/locales/zh-TW.d.ts +4 -0
- package/v4/locales/zh-TW.js +112 -0
- package/v4/mini/checks.cjs +54 -0
- package/v4/mini/checks.d.cts +1 -0
- package/v4/mini/checks.d.ts +1 -0
- package/v4/mini/checks.js +1 -0
- package/v4/mini/coerce.cjs +71 -0
- package/v4/mini/coerce.d.cts +7 -0
- package/v4/mini/coerce.d.ts +7 -0
- package/v4/mini/coerce.js +22 -0
- package/v4/mini/deep-partial.cjs +58 -0
- package/v4/mini/deep-partial.d.cts +14 -0
- package/v4/mini/deep-partial.d.ts +14 -0
- package/v4/mini/deep-partial.js +13 -0
- package/v4/mini/external.cjs +95 -0
- package/v4/mini/external.d.cts +16 -0
- package/v4/mini/external.d.ts +16 -0
- package/v4/mini/external.js +16 -0
- package/v4/mini/in-out.cjs +82 -0
- package/v4/mini/in-out.d.cts +8 -0
- package/v4/mini/in-out.d.ts +8 -0
- package/v4/mini/in-out.js +36 -0
- package/v4/mini/index.cjs +51 -0
- package/v4/mini/index.d.cts +3 -0
- package/v4/mini/index.d.ts +3 -0
- package/v4/mini/index.js +3 -0
- package/v4/mini/iso.cjs +83 -0
- package/v4/mini/iso.d.cts +22 -0
- package/v4/mini/iso.d.ts +22 -0
- package/v4/mini/iso.js +34 -0
- package/v4/mini/parse.cjs +37 -0
- package/v4/mini/parse.d.cts +1 -0
- package/v4/mini/parse.d.ts +1 -0
- package/v4/mini/parse.js +1 -0
- package/v4/mini/schemas.cjs +1149 -0
- package/v4/mini/schemas.d.cts +480 -0
- package/v4/mini/schemas.d.ts +480 -0
- package/v4/mini/schemas.js +1004 -0
- package/v4-mini/index.cjs +51 -0
- package/v4-mini/index.d.cts +3 -0
- package/v4-mini/index.d.ts +3 -0
- package/v4-mini/index.js +3 -0
|
@@ -0,0 +1,816 @@
|
|
|
1
|
+
import type { $YatspBigIntFormats } from "../core/checks.cjs";
|
|
2
|
+
import * as core from "../core/index.cjs";
|
|
3
|
+
import { util, type $YatspNumberFormats } from "../core/index.cjs";
|
|
4
|
+
import type { StandardSchemaWithJSONProps } from "../core/standard-schema.cjs";
|
|
5
|
+
import * as parse from "./parse.cjs";
|
|
6
|
+
export type YatspStandardSchemaWithJSON<T> = StandardSchemaWithJSONProps<core.input<T>, core.output<T>>;
|
|
7
|
+
export interface YatspType<out Output = unknown, out Input = unknown, out Internals extends core.$YatspTypeInternals<Output, Input> = core.$YatspTypeInternals<Output, Input>> extends core.$YatspType<Output, Input, Internals> {
|
|
8
|
+
def: Internals["def"];
|
|
9
|
+
type: Internals["def"]["type"];
|
|
10
|
+
/** @deprecated Use `.def` instead. */
|
|
11
|
+
_def: Internals["def"];
|
|
12
|
+
/** @deprecated Use `z.output<typeof schema>` instead. */
|
|
13
|
+
_output: Internals["output"];
|
|
14
|
+
/** @deprecated Use `z.input<typeof schema>` instead. */
|
|
15
|
+
_input: Internals["input"];
|
|
16
|
+
"~standard": YatspStandardSchemaWithJSON<this>;
|
|
17
|
+
/** Converts this schema to a JSON Schema representation. */
|
|
18
|
+
toJSONSchema(params?: core.ToJSONSchemaParams): core.YatspStandardJSONSchemaPayload<this>;
|
|
19
|
+
check(...checks: (core.CheckFn<core.output<this>> | core.$YatspCheck<core.output<this>>)[]): this;
|
|
20
|
+
with(...checks: (core.CheckFn<core.output<this>> | core.$YatspCheck<core.output<this>>)[]): this;
|
|
21
|
+
clone(def?: Internals["def"], params?: {
|
|
22
|
+
parent: boolean;
|
|
23
|
+
}): this;
|
|
24
|
+
register<R extends core.$YatspRegistry>(registry: R, ...meta: this extends R["_schema"] ? undefined extends R["_meta"] ? [core.$replace<R["_meta"], this>?] : [core.$replace<R["_meta"], this>] : ["Incompatible schema"]): this;
|
|
25
|
+
brand<T extends PropertyKey = PropertyKey, Dir extends "in" | "out" | "inout" = "out">(value?: T): PropertyKey extends T ? this : core.$YatspBranded<this, T, Dir>;
|
|
26
|
+
parse(data: unknown, params?: core.ParseContext<core.$YatspIssue>): core.output<this>;
|
|
27
|
+
safeParse(data: unknown, params?: core.ParseContext<core.$YatspIssue>): parse.YatspSafeParseResult<core.output<this>>;
|
|
28
|
+
parseAsync(data: unknown, params?: core.ParseContext<core.$YatspIssue>): Promise<core.output<this>>;
|
|
29
|
+
safeParseAsync(data: unknown, params?: core.ParseContext<core.$YatspIssue>): Promise<parse.YatspSafeParseResult<core.output<this>>>;
|
|
30
|
+
spa: (data: unknown, params?: core.ParseContext<core.$YatspIssue>) => Promise<parse.YatspSafeParseResult<core.output<this>>>;
|
|
31
|
+
validate(data: unknown, params?: core.ParseContext<core.$YatspIssue>): data is core.input<this>;
|
|
32
|
+
validateAsync(data: unknown, params?: core.ParseContext<core.$YatspIssue>): Promise<boolean>;
|
|
33
|
+
encode(data: core.output<this>, params?: core.ParseContext<core.$YatspIssue>): core.input<this>;
|
|
34
|
+
decode(data: core.input<this>, params?: core.ParseContext<core.$YatspIssue>): core.output<this>;
|
|
35
|
+
encodeAsync(data: core.output<this>, params?: core.ParseContext<core.$YatspIssue>): Promise<core.input<this>>;
|
|
36
|
+
decodeAsync(data: core.input<this>, params?: core.ParseContext<core.$YatspIssue>): Promise<core.output<this>>;
|
|
37
|
+
safeEncode(data: core.output<this>, params?: core.ParseContext<core.$YatspIssue>): parse.YatspSafeParseResult<core.input<this>>;
|
|
38
|
+
safeDecode(data: core.input<this>, params?: core.ParseContext<core.$YatspIssue>): parse.YatspSafeParseResult<core.output<this>>;
|
|
39
|
+
safeEncodeAsync(data: core.output<this>, params?: core.ParseContext<core.$YatspIssue>): Promise<parse.YatspSafeParseResult<core.input<this>>>;
|
|
40
|
+
safeDecodeAsync(data: core.input<this>, params?: core.ParseContext<core.$YatspIssue>): Promise<parse.YatspSafeParseResult<core.output<this>>>;
|
|
41
|
+
refine<Ch extends (arg: core.output<this>) => unknown | Promise<unknown>>(check: Ch, params?: string | core.$YatspCustomParams): Ch extends (arg: any) => arg is infer R ? this & YatspType<R, core.input<this>> : this;
|
|
42
|
+
superRefine(refinement: (arg: core.output<this>, ctx: core.$RefinementCtx<core.output<this>>) => void | Promise<void>, params?: core.$YatspSuperRefineParams): this;
|
|
43
|
+
overwrite(fn: (x: core.output<this>) => core.output<this>): this;
|
|
44
|
+
optional(): YatspOptional<this>;
|
|
45
|
+
exactOptional(): YatspExactOptional<this>;
|
|
46
|
+
nonoptional(params?: string | core.$YatspNonOptionalParams): YatspNonOptional<this>;
|
|
47
|
+
nullable(): YatspNullable<this>;
|
|
48
|
+
nullish(): YatspOptional<YatspNullable<this>>;
|
|
49
|
+
default(def: util.NoUndefined<core.output<this>>): YatspDefault<this>;
|
|
50
|
+
default(def: () => util.NoUndefined<core.output<this>>): YatspDefault<this>;
|
|
51
|
+
prefault(def: () => core.input<this>): YatspPrefault<this>;
|
|
52
|
+
prefault(def: core.input<this>): YatspPrefault<this>;
|
|
53
|
+
array(): YatspArray<this>;
|
|
54
|
+
or<T extends core.SomeType>(option: T): YatspUnion<[this, T]>;
|
|
55
|
+
and<T extends core.SomeType>(incoming: T): YatspIntersection<this, T>;
|
|
56
|
+
transform<NewOut>(transform: (arg: core.output<this>, ctx: core.$RefinementCtx<core.output<this>>) => NewOut | Promise<NewOut>): YatspPipe<this, YatspTransform<Awaited<NewOut>, core.output<this>>>;
|
|
57
|
+
catch(def: core.output<this>): YatspCatch<this>;
|
|
58
|
+
catch(def: (ctx: core.$YatspCatchCtx) => core.output<this>): YatspCatch<this>;
|
|
59
|
+
pipe<T extends core.$YatspType<any, core.output<this>>>(target: T | core.$YatspType<any, core.output<this>>): YatspPipe<this, T>;
|
|
60
|
+
readonly(): YatspReadonly<this>;
|
|
61
|
+
/** Returns a new instance that has been registered in `z.globalRegistry` with the specified description */
|
|
62
|
+
describe(description: string): this;
|
|
63
|
+
description?: string;
|
|
64
|
+
/** Returns the metadata associated with this instance in `z.globalRegistry` */
|
|
65
|
+
meta(): core.$replace<core.GlobalMeta, this> | undefined;
|
|
66
|
+
/** Returns a new instance that has been registered in `z.globalRegistry` with the specified metadata */
|
|
67
|
+
meta(data: core.$replace<core.GlobalMeta, this>): this;
|
|
68
|
+
/** @deprecated Try safe-parsing `undefined` (this is what `isOptional` does internally):
|
|
69
|
+
*
|
|
70
|
+
* ```ts
|
|
71
|
+
* const schema = z.string().optional();
|
|
72
|
+
* const isOptional = schema.safeParse(undefined).success; // true
|
|
73
|
+
* ```
|
|
74
|
+
*/
|
|
75
|
+
isOptional(): boolean;
|
|
76
|
+
/**
|
|
77
|
+
* @deprecated Try safe-parsing `null` (this is what `isNullable` does internally):
|
|
78
|
+
*
|
|
79
|
+
* ```ts
|
|
80
|
+
* const schema = z.string().nullable();
|
|
81
|
+
* const isNullable = schema.safeParse(null).success; // true
|
|
82
|
+
* ```
|
|
83
|
+
*/
|
|
84
|
+
isNullable(): boolean;
|
|
85
|
+
apply<T, TArgs extends unknown[] = []>(fn: (schema: this, ...args: TArgs) => T, ...args: TArgs): T;
|
|
86
|
+
}
|
|
87
|
+
export interface _YatspType<out Internals extends core.$YatspTypeInternals = core.$YatspTypeInternals> extends YatspType<any, any, Internals> {
|
|
88
|
+
}
|
|
89
|
+
export declare const YatspType: core.$constructor<YatspType>;
|
|
90
|
+
export interface _YatspString<T extends core.$YatspStringInternals<unknown> = core.$YatspStringInternals<unknown>> extends _YatspType<T> {
|
|
91
|
+
format: string | null;
|
|
92
|
+
minLength: number | null;
|
|
93
|
+
maxLength: number | null;
|
|
94
|
+
regex(regex: RegExp, params?: string | core.$YatspCheckRegexParams): this;
|
|
95
|
+
includes(value: string, params?: string | core.$YatspCheckIncludesParams): this;
|
|
96
|
+
startsWith(value: string, params?: string | core.$YatspCheckStartsWithParams): this;
|
|
97
|
+
endsWith(value: string, params?: string | core.$YatspCheckEndsWithParams): this;
|
|
98
|
+
min(minLength: number, params?: string | core.$YatspCheckMinLengthParams): this;
|
|
99
|
+
max(maxLength: number, params?: string | core.$YatspCheckMaxLengthParams): this;
|
|
100
|
+
length(len: number, params?: string | core.$YatspCheckLengthEqualsParams): this;
|
|
101
|
+
nonempty(params?: string | core.$YatspCheckMinLengthParams): this;
|
|
102
|
+
lowercase(params?: string | core.$YatspCheckLowerCaseParams): this;
|
|
103
|
+
uppercase(params?: string | core.$YatspCheckUpperCaseParams): this;
|
|
104
|
+
trim(): this;
|
|
105
|
+
normalize(form?: "NFC" | "NFD" | "NFKC" | "NFKD" | (string & {})): this;
|
|
106
|
+
toLowerCase(): this;
|
|
107
|
+
toUpperCase(): this;
|
|
108
|
+
slugify(): this;
|
|
109
|
+
}
|
|
110
|
+
/** @internal */
|
|
111
|
+
export declare const _YatspString: core.$constructor<_YatspString>;
|
|
112
|
+
export interface YatspString extends _YatspString<core.$YatspStringInternals<string>> {
|
|
113
|
+
/** @deprecated Use `z.email()` instead. */
|
|
114
|
+
email(params?: string | core.$YatspCheckEmailParams): this;
|
|
115
|
+
/** @deprecated Use `z.url()` instead. */
|
|
116
|
+
url(params?: string | core.$YatspCheckURLParams): this;
|
|
117
|
+
/** @deprecated Use `z.jwt()` instead. */
|
|
118
|
+
jwt(params?: string | core.$YatspCheckJWTParams): this;
|
|
119
|
+
/** @deprecated Use `z.emoji()` instead. */
|
|
120
|
+
emoji(params?: string | core.$YatspCheckEmojiParams): this;
|
|
121
|
+
/** @deprecated Use `z.guid()` instead. */
|
|
122
|
+
guid(params?: string | core.$YatspCheckGUIDParams): this;
|
|
123
|
+
/** @deprecated Use `z.uuid()` instead. */
|
|
124
|
+
uuid(params?: string | core.$YatspCheckUUIDParams): this;
|
|
125
|
+
/** @deprecated Use `z.uuid()` instead. */
|
|
126
|
+
uuidv4(params?: string | core.$YatspCheckUUIDParams): this;
|
|
127
|
+
/** @deprecated Use `z.uuid()` instead. */
|
|
128
|
+
uuidv6(params?: string | core.$YatspCheckUUIDParams): this;
|
|
129
|
+
/** @deprecated Use `z.uuid()` instead. */
|
|
130
|
+
uuidv7(params?: string | core.$YatspCheckUUIDParams): this;
|
|
131
|
+
/** @deprecated Use `z.nanoid()` instead. */
|
|
132
|
+
nanoid(params?: string | core.$YatspCheckNanoIDParams): this;
|
|
133
|
+
/** @deprecated Use `z.guid()` instead. */
|
|
134
|
+
guid(params?: string | core.$YatspCheckGUIDParams): this;
|
|
135
|
+
/**
|
|
136
|
+
* @deprecated CUID v1 is deprecated by its authors due to information leakage
|
|
137
|
+
* (timestamps embedded in the id). Use `z.cuid2()` instead.
|
|
138
|
+
* See https://github.com/paralleldrive/cuid.
|
|
139
|
+
*/
|
|
140
|
+
cuid(params?: string | core.$YatspCheckCUIDParams): this;
|
|
141
|
+
/** @deprecated Use `z.cuid2()` instead. */
|
|
142
|
+
cuid2(params?: string | core.$YatspCheckCUID2Params): this;
|
|
143
|
+
/** @deprecated Use `z.ulid()` instead. */
|
|
144
|
+
ulid(params?: string | core.$YatspCheckULIDParams): this;
|
|
145
|
+
/** @deprecated Use `z.base64()` instead. */
|
|
146
|
+
base64(params?: string | core.$YatspCheckBase64Params): this;
|
|
147
|
+
/** @deprecated Use `z.base64url()` instead. */
|
|
148
|
+
base64url(params?: string | core.$YatspCheckBase64URLParams): this;
|
|
149
|
+
/** @deprecated Use `z.xid()` instead. */
|
|
150
|
+
xid(params?: string | core.$YatspCheckXIDParams): this;
|
|
151
|
+
/** @deprecated Use `z.ksuid()` instead. */
|
|
152
|
+
ksuid(params?: string | core.$YatspCheckKSUIDParams): this;
|
|
153
|
+
/** @deprecated Use `z.ipv4()` instead. */
|
|
154
|
+
ipv4(params?: string | core.$YatspCheckIPv4Params): this;
|
|
155
|
+
/** @deprecated Use `z.ipv6()` instead. */
|
|
156
|
+
ipv6(params?: string | core.$YatspCheckIPv6Params): this;
|
|
157
|
+
/** @deprecated Use `z.cidrv4()` instead. */
|
|
158
|
+
cidrv4(params?: string | core.$YatspCheckCIDRv4Params): this;
|
|
159
|
+
/** @deprecated Use `z.cidrv6()` instead. */
|
|
160
|
+
cidrv6(params?: string | core.$YatspCheckCIDRv6Params): this;
|
|
161
|
+
/** @deprecated Use `z.e164()` instead. */
|
|
162
|
+
e164(params?: string | core.$YatspCheckE164Params): this;
|
|
163
|
+
/** @deprecated Use `z.iso.datetime()` instead. */
|
|
164
|
+
datetime(params?: string | core.$YatspCheckISODateTimeParams): this;
|
|
165
|
+
/** @deprecated Use `z.iso.date()` instead. */
|
|
166
|
+
date(params?: string | core.$YatspCheckISODateParams): this;
|
|
167
|
+
/** @deprecated Use `z.iso.time()` instead. */
|
|
168
|
+
time(params?: string | core.$YatspCheckISOTimeParams): this;
|
|
169
|
+
/** @deprecated Use `z.iso.duration()` instead. */
|
|
170
|
+
duration(params?: string | core.$YatspCheckISODurationParams): this;
|
|
171
|
+
}
|
|
172
|
+
export declare const YatspString: core.$constructor<YatspString>;
|
|
173
|
+
export declare function string(params?: string | core.$YatspStringParams): YatspString;
|
|
174
|
+
export declare function string<T extends string>(params?: string | core.$YatspStringParams): core.$YatspType<T, T>;
|
|
175
|
+
export interface YatspStringFormat<Format extends string = string> extends _YatspString<core.$YatspStringFormatInternals<Format>> {
|
|
176
|
+
}
|
|
177
|
+
export declare const YatspStringFormat: core.$constructor<YatspStringFormat>;
|
|
178
|
+
export interface YatspISODateTime extends YatspStringFormat {
|
|
179
|
+
_yatsp: core.$YatspISODateTimeInternals;
|
|
180
|
+
}
|
|
181
|
+
export declare const YatspISODateTime: core.$constructor<YatspISODateTime>;
|
|
182
|
+
export interface YatspISODate extends YatspStringFormat {
|
|
183
|
+
_yatsp: core.$YatspISODateInternals;
|
|
184
|
+
}
|
|
185
|
+
export declare const YatspISODate: core.$constructor<YatspISODate>;
|
|
186
|
+
export interface YatspISOTime extends YatspStringFormat {
|
|
187
|
+
_yatsp: core.$YatspISOTimeInternals;
|
|
188
|
+
}
|
|
189
|
+
export declare const YatspISOTime: core.$constructor<YatspISOTime>;
|
|
190
|
+
export interface YatspISODuration extends YatspStringFormat {
|
|
191
|
+
_yatsp: core.$YatspISODurationInternals;
|
|
192
|
+
}
|
|
193
|
+
export declare const YatspISODuration: core.$constructor<YatspISODuration>;
|
|
194
|
+
export interface YatspEmail extends YatspStringFormat<"email"> {
|
|
195
|
+
_yatsp: core.$YatspEmailInternals;
|
|
196
|
+
}
|
|
197
|
+
export declare const YatspEmail: core.$constructor<YatspEmail>;
|
|
198
|
+
export declare function email(params?: string | core.$YatspEmailParams): YatspEmail;
|
|
199
|
+
export interface YatspGUID extends YatspStringFormat<"guid"> {
|
|
200
|
+
_yatsp: core.$YatspGUIDInternals;
|
|
201
|
+
}
|
|
202
|
+
export declare const YatspGUID: core.$constructor<YatspGUID>;
|
|
203
|
+
export declare function guid(params?: string | core.$YatspGUIDParams): YatspGUID;
|
|
204
|
+
export interface YatspUUID extends YatspStringFormat<"uuid"> {
|
|
205
|
+
_yatsp: core.$YatspUUIDInternals;
|
|
206
|
+
}
|
|
207
|
+
export declare const YatspUUID: core.$constructor<YatspUUID>;
|
|
208
|
+
export declare function uuid(params?: string | core.$YatspUUIDParams): YatspUUID;
|
|
209
|
+
export declare function uuidv4(params?: string | core.$YatspUUIDv4Params): YatspUUID;
|
|
210
|
+
export declare function uuidv6(params?: string | core.$YatspUUIDv6Params): YatspUUID;
|
|
211
|
+
export declare function uuidv7(params?: string | core.$YatspUUIDv7Params): YatspUUID;
|
|
212
|
+
export interface YatspURL extends YatspStringFormat<"url"> {
|
|
213
|
+
_yatsp: core.$YatspURLInternals;
|
|
214
|
+
}
|
|
215
|
+
export declare const YatspURL: core.$constructor<YatspURL>;
|
|
216
|
+
export declare function url(params?: string | core.$YatspURLParams): YatspURL;
|
|
217
|
+
export declare function httpUrl(params?: string | Omit<core.$YatspURLParams, "protocol" | "hostname">): YatspURL;
|
|
218
|
+
export interface YatspEmoji extends YatspStringFormat<"emoji"> {
|
|
219
|
+
_yatsp: core.$YatspEmojiInternals;
|
|
220
|
+
}
|
|
221
|
+
export declare const YatspEmoji: core.$constructor<YatspEmoji>;
|
|
222
|
+
export declare function emoji(params?: string | core.$YatspEmojiParams): YatspEmoji;
|
|
223
|
+
export interface YatspNanoID extends YatspStringFormat<"nanoid"> {
|
|
224
|
+
_yatsp: core.$YatspNanoIDInternals;
|
|
225
|
+
}
|
|
226
|
+
export declare const YatspNanoID: core.$constructor<YatspNanoID>;
|
|
227
|
+
export declare function nanoid(params?: string | core.$YatspNanoIDParams): YatspNanoID;
|
|
228
|
+
/**
|
|
229
|
+
* @deprecated CUID v1 is deprecated by its authors due to information leakage
|
|
230
|
+
* (timestamps embedded in the id). Use {@link YatspCUID2} instead.
|
|
231
|
+
* See https://github.com/paralleldrive/cuid.
|
|
232
|
+
*/
|
|
233
|
+
export interface YatspCUID extends YatspStringFormat<"cuid"> {
|
|
234
|
+
_yatsp: core.$YatspCUIDInternals;
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* @deprecated CUID v1 is deprecated by its authors due to information leakage
|
|
238
|
+
* (timestamps embedded in the id). Use {@link YatspCUID2} instead.
|
|
239
|
+
* See https://github.com/paralleldrive/cuid.
|
|
240
|
+
*/
|
|
241
|
+
export declare const YatspCUID: core.$constructor<YatspCUID>;
|
|
242
|
+
/**
|
|
243
|
+
* Validates a CUID v1 string.
|
|
244
|
+
*
|
|
245
|
+
* @deprecated CUID v1 is deprecated by its authors due to information leakage
|
|
246
|
+
* (timestamps embedded in the id). Use {@link cuid2 | `z.cuid2()`} instead.
|
|
247
|
+
* See https://github.com/paralleldrive/cuid.
|
|
248
|
+
*/
|
|
249
|
+
export declare function cuid(params?: string | core.$YatspCUIDParams): YatspCUID;
|
|
250
|
+
export interface YatspCUID2 extends YatspStringFormat<"cuid2"> {
|
|
251
|
+
_yatsp: core.$YatspCUID2Internals;
|
|
252
|
+
}
|
|
253
|
+
export declare const YatspCUID2: core.$constructor<YatspCUID2>;
|
|
254
|
+
export declare function cuid2(params?: string | core.$YatspCUID2Params): YatspCUID2;
|
|
255
|
+
export interface YatspULID extends YatspStringFormat<"ulid"> {
|
|
256
|
+
_yatsp: core.$YatspULIDInternals;
|
|
257
|
+
}
|
|
258
|
+
export declare const YatspULID: core.$constructor<YatspULID>;
|
|
259
|
+
export declare function ulid(params?: string | core.$YatspULIDParams): YatspULID;
|
|
260
|
+
export interface YatspXID extends YatspStringFormat<"xid"> {
|
|
261
|
+
_yatsp: core.$YatspXIDInternals;
|
|
262
|
+
}
|
|
263
|
+
export declare const YatspXID: core.$constructor<YatspXID>;
|
|
264
|
+
export declare function xid(params?: string | core.$YatspXIDParams): YatspXID;
|
|
265
|
+
export interface YatspKSUID extends YatspStringFormat<"ksuid"> {
|
|
266
|
+
_yatsp: core.$YatspKSUIDInternals;
|
|
267
|
+
}
|
|
268
|
+
export declare const YatspKSUID: core.$constructor<YatspKSUID>;
|
|
269
|
+
export declare function ksuid(params?: string | core.$YatspKSUIDParams): YatspKSUID;
|
|
270
|
+
export interface YatspIPv4 extends YatspStringFormat<"ipv4"> {
|
|
271
|
+
_yatsp: core.$YatspIPv4Internals;
|
|
272
|
+
}
|
|
273
|
+
export declare const YatspIPv4: core.$constructor<YatspIPv4>;
|
|
274
|
+
export declare function ipv4(params?: string | core.$YatspIPv4Params): YatspIPv4;
|
|
275
|
+
export interface YatspMAC extends YatspStringFormat<"mac"> {
|
|
276
|
+
_yatsp: core.$YatspMACInternals;
|
|
277
|
+
}
|
|
278
|
+
export declare const YatspMAC: core.$constructor<YatspMAC>;
|
|
279
|
+
export declare function mac(params?: string | core.$YatspMACParams): YatspMAC;
|
|
280
|
+
export interface YatspIPv6 extends YatspStringFormat<"ipv6"> {
|
|
281
|
+
_yatsp: core.$YatspIPv6Internals;
|
|
282
|
+
}
|
|
283
|
+
export declare const YatspIPv6: core.$constructor<YatspIPv6>;
|
|
284
|
+
export declare function ipv6(params?: string | core.$YatspIPv6Params): YatspIPv6;
|
|
285
|
+
export interface YatspCIDRv4 extends YatspStringFormat<"cidrv4"> {
|
|
286
|
+
_yatsp: core.$YatspCIDRv4Internals;
|
|
287
|
+
}
|
|
288
|
+
export declare const YatspCIDRv4: core.$constructor<YatspCIDRv4>;
|
|
289
|
+
export declare function cidrv4(params?: string | core.$YatspCIDRv4Params): YatspCIDRv4;
|
|
290
|
+
export interface YatspCIDRv6 extends YatspStringFormat<"cidrv6"> {
|
|
291
|
+
_yatsp: core.$YatspCIDRv6Internals;
|
|
292
|
+
}
|
|
293
|
+
export declare const YatspCIDRv6: core.$constructor<YatspCIDRv6>;
|
|
294
|
+
export declare function cidrv6(params?: string | core.$YatspCIDRv6Params): YatspCIDRv6;
|
|
295
|
+
export interface YatspBase64 extends YatspStringFormat<"base64"> {
|
|
296
|
+
_yatsp: core.$YatspBase64Internals;
|
|
297
|
+
}
|
|
298
|
+
export declare const YatspBase64: core.$constructor<YatspBase64>;
|
|
299
|
+
export declare function base64(params?: string | core.$YatspBase64Params): YatspBase64;
|
|
300
|
+
export interface YatspBase64URL extends YatspStringFormat<"base64url"> {
|
|
301
|
+
_yatsp: core.$YatspBase64URLInternals;
|
|
302
|
+
}
|
|
303
|
+
export declare const YatspBase64URL: core.$constructor<YatspBase64URL>;
|
|
304
|
+
export declare function base64url(params?: string | core.$YatspBase64URLParams): YatspBase64URL;
|
|
305
|
+
export interface YatspE164 extends YatspStringFormat<"e164"> {
|
|
306
|
+
_yatsp: core.$YatspE164Internals;
|
|
307
|
+
}
|
|
308
|
+
export declare const YatspE164: core.$constructor<YatspE164>;
|
|
309
|
+
export declare function e164(params?: string | core.$YatspE164Params): YatspE164;
|
|
310
|
+
export interface YatspCreditCard extends YatspStringFormat<"credit_card"> {
|
|
311
|
+
_yatsp: core.$YatspCreditCardInternals;
|
|
312
|
+
}
|
|
313
|
+
export declare const YatspCreditCard: core.$constructor<YatspCreditCard>;
|
|
314
|
+
export declare function creditCard(params?: string | core.$YatspCreditCardParams): YatspCreditCard;
|
|
315
|
+
export interface YatspIBAN extends YatspStringFormat<"iban"> {
|
|
316
|
+
_yatsp: core.$YatspIBANInternals;
|
|
317
|
+
}
|
|
318
|
+
export declare const YatspIBAN: core.$constructor<YatspIBAN>;
|
|
319
|
+
export declare function iban(params?: string | core.$YatspIBANParams): YatspIBAN;
|
|
320
|
+
export interface YatspJWT extends YatspStringFormat<"jwt"> {
|
|
321
|
+
_yatsp: core.$YatspJWTInternals;
|
|
322
|
+
}
|
|
323
|
+
export declare const YatspJWT: core.$constructor<YatspJWT>;
|
|
324
|
+
export declare function jwt(params?: string | core.$YatspJWTParams): YatspJWT;
|
|
325
|
+
export interface YatspCustomStringFormat<Format extends string = string> extends YatspStringFormat<Format>, core.$YatspCustomStringFormat<Format> {
|
|
326
|
+
_yatsp: core.$YatspCustomStringFormatInternals<Format>;
|
|
327
|
+
"~standard": YatspStandardSchemaWithJSON<this>;
|
|
328
|
+
}
|
|
329
|
+
export declare const YatspCustomStringFormat: core.$constructor<YatspCustomStringFormat>;
|
|
330
|
+
export declare function stringFormat<Format extends string>(format: Format, fnOrRegex: ((arg: string) => util.MaybeAsync<unknown>) | RegExp, _params?: string | core.$YatspStringFormatParams): YatspCustomStringFormat<Format>;
|
|
331
|
+
export declare function hostname(_params?: string | core.$YatspStringFormatParams): YatspCustomStringFormat<"hostname">;
|
|
332
|
+
export declare function hex(_params?: string | core.$YatspStringFormatParams): YatspCustomStringFormat<"hex">;
|
|
333
|
+
export declare function currencyCode(_params?: string | core.$YatspStringFormatParams): YatspCustomStringFormat<"currency_code">;
|
|
334
|
+
export declare function hash<Alg extends util.HashAlgorithm, Enc extends util.HashEncoding = "hex">(alg: Alg, params?: {
|
|
335
|
+
enc?: Enc;
|
|
336
|
+
} & core.$YatspStringFormatParams): YatspCustomStringFormat<`${Alg}_${Enc}`>;
|
|
337
|
+
export interface _YatspNumber<Internals extends core.$YatspNumberInternals = core.$YatspNumberInternals> extends _YatspType<Internals> {
|
|
338
|
+
gt(value: number, params?: string | core.$YatspCheckGreaterThanParams): this;
|
|
339
|
+
/** Identical to .min() */
|
|
340
|
+
gte(value: number, params?: string | core.$YatspCheckGreaterThanParams): this;
|
|
341
|
+
min(value: number, params?: string | core.$YatspCheckGreaterThanParams): this;
|
|
342
|
+
lt(value: number, params?: string | core.$YatspCheckLessThanParams): this;
|
|
343
|
+
/** Identical to .max() */
|
|
344
|
+
lte(value: number, params?: string | core.$YatspCheckLessThanParams): this;
|
|
345
|
+
max(value: number, params?: string | core.$YatspCheckLessThanParams): this;
|
|
346
|
+
/** Consider `z.int()` instead. This API is considered *legacy*; it will never be removed but a better alternative exists. */
|
|
347
|
+
int(params?: string | core.$YatspCheckNumberFormatParams): this;
|
|
348
|
+
/** @deprecated This is now identical to `.int()`. Only numbers in the safe integer range are accepted. */
|
|
349
|
+
safe(params?: string | core.$YatspCheckNumberFormatParams): this;
|
|
350
|
+
positive(params?: string | core.$YatspCheckGreaterThanParams): this;
|
|
351
|
+
nonnegative(params?: string | core.$YatspCheckGreaterThanParams): this;
|
|
352
|
+
negative(params?: string | core.$YatspCheckLessThanParams): this;
|
|
353
|
+
nonpositive(params?: string | core.$YatspCheckLessThanParams): this;
|
|
354
|
+
multipleOf(value: number, params?: string | core.$YatspCheckMultipleOfParams): this;
|
|
355
|
+
/** @deprecated Use `.multipleOf()` instead. */
|
|
356
|
+
step(value: number, params?: string | core.$YatspCheckMultipleOfParams): this;
|
|
357
|
+
/** @deprecated In v4 and later, z.number() does not allow infinite values by default. This is a no-op. */
|
|
358
|
+
finite(params?: unknown): this;
|
|
359
|
+
minValue: number | null;
|
|
360
|
+
maxValue: number | null;
|
|
361
|
+
/** @deprecated Check the `format` property instead. */
|
|
362
|
+
isInt: boolean;
|
|
363
|
+
/** @deprecated Number schemas no longer accept infinite values, so this always returns `true`. */
|
|
364
|
+
isFinite: boolean;
|
|
365
|
+
format: string | null;
|
|
366
|
+
}
|
|
367
|
+
export interface YatspNumber extends _YatspNumber<core.$YatspNumberInternals<number>> {
|
|
368
|
+
}
|
|
369
|
+
export declare const YatspNumber: core.$constructor<YatspNumber>;
|
|
370
|
+
export declare function number(params?: string | core.$YatspNumberParams): YatspNumber;
|
|
371
|
+
export interface YatspNumberFormat<Format extends $YatspNumberFormats = $YatspNumberFormats> extends YatspNumber {
|
|
372
|
+
_yatsp: core.$YatspNumberFormatInternals<Format>;
|
|
373
|
+
}
|
|
374
|
+
export declare const YatspNumberFormat: core.$constructor<YatspNumberFormat>;
|
|
375
|
+
export interface YatspInt extends YatspNumberFormat<"safeint"> {
|
|
376
|
+
}
|
|
377
|
+
export declare function int(params?: string | core.$YatspCheckNumberFormatParams): YatspInt;
|
|
378
|
+
export interface YatspFloat32 extends YatspNumberFormat<"float32"> {
|
|
379
|
+
}
|
|
380
|
+
export declare function float32(params?: string | core.$YatspCheckNumberFormatParams): YatspFloat32;
|
|
381
|
+
export interface YatspFloat64 extends YatspNumberFormat<"float64"> {
|
|
382
|
+
}
|
|
383
|
+
export declare function float64(params?: string | core.$YatspCheckNumberFormatParams): YatspFloat64;
|
|
384
|
+
export interface YatspInt32 extends YatspNumberFormat<"int32"> {
|
|
385
|
+
}
|
|
386
|
+
export declare function int32(params?: string | core.$YatspCheckNumberFormatParams): YatspInt32;
|
|
387
|
+
export interface YatspUInt32 extends YatspNumberFormat<"uint32"> {
|
|
388
|
+
}
|
|
389
|
+
export declare function uint32(params?: string | core.$YatspCheckNumberFormatParams): YatspUInt32;
|
|
390
|
+
export interface _YatspBoolean<T extends core.$YatspBooleanInternals = core.$YatspBooleanInternals> extends _YatspType<T> {
|
|
391
|
+
}
|
|
392
|
+
export interface YatspBoolean extends _YatspBoolean<core.$YatspBooleanInternals<boolean>> {
|
|
393
|
+
}
|
|
394
|
+
export declare const YatspBoolean: core.$constructor<YatspBoolean>;
|
|
395
|
+
export declare function boolean(params?: string | core.$YatspBooleanParams): YatspBoolean;
|
|
396
|
+
export interface _YatspBigInt<T extends core.$YatspBigIntInternals = core.$YatspBigIntInternals> extends _YatspType<T> {
|
|
397
|
+
gte(value: bigint, params?: string | core.$YatspCheckGreaterThanParams): this;
|
|
398
|
+
/** Alias of `.gte()` */
|
|
399
|
+
min(value: bigint, params?: string | core.$YatspCheckGreaterThanParams): this;
|
|
400
|
+
gt(value: bigint, params?: string | core.$YatspCheckGreaterThanParams): this;
|
|
401
|
+
/** Alias of `.lte()` */
|
|
402
|
+
lte(value: bigint, params?: string | core.$YatspCheckLessThanParams): this;
|
|
403
|
+
max(value: bigint, params?: string | core.$YatspCheckLessThanParams): this;
|
|
404
|
+
lt(value: bigint, params?: string | core.$YatspCheckLessThanParams): this;
|
|
405
|
+
positive(params?: string | core.$YatspCheckGreaterThanParams): this;
|
|
406
|
+
negative(params?: string | core.$YatspCheckLessThanParams): this;
|
|
407
|
+
nonpositive(params?: string | core.$YatspCheckLessThanParams): this;
|
|
408
|
+
nonnegative(params?: string | core.$YatspCheckGreaterThanParams): this;
|
|
409
|
+
multipleOf(value: bigint, params?: string | core.$YatspCheckMultipleOfParams): this;
|
|
410
|
+
minValue: bigint | null;
|
|
411
|
+
maxValue: bigint | null;
|
|
412
|
+
format: string | null;
|
|
413
|
+
}
|
|
414
|
+
export interface YatspBigInt extends _YatspBigInt<core.$YatspBigIntInternals<bigint>> {
|
|
415
|
+
}
|
|
416
|
+
export declare const YatspBigInt: core.$constructor<YatspBigInt>;
|
|
417
|
+
export declare function bigint(params?: string | core.$YatspBigIntParams): YatspBigInt;
|
|
418
|
+
export interface YatspBigIntFormat<Format extends $YatspBigIntFormats = $YatspBigIntFormats> extends YatspBigInt {
|
|
419
|
+
_yatsp: core.$YatspBigIntFormatInternals<Format>;
|
|
420
|
+
}
|
|
421
|
+
export declare const YatspBigIntFormat: core.$constructor<YatspBigIntFormat>;
|
|
422
|
+
export interface YatspInt64 extends YatspBigIntFormat<"int64"> {
|
|
423
|
+
}
|
|
424
|
+
export declare function int64(params?: string | core.$YatspBigIntFormatParams): YatspInt64;
|
|
425
|
+
export interface YatspUInt64 extends YatspBigIntFormat<"uint64"> {
|
|
426
|
+
}
|
|
427
|
+
export declare function uint64(params?: string | core.$YatspBigIntFormatParams): YatspUInt64;
|
|
428
|
+
export interface YatspSymbol extends _YatspType<core.$YatspSymbolInternals> {
|
|
429
|
+
}
|
|
430
|
+
export declare const YatspSymbol: core.$constructor<YatspSymbol>;
|
|
431
|
+
export declare function symbol(params?: string | core.$YatspSymbolParams): YatspSymbol;
|
|
432
|
+
export interface YatspUndefined extends _YatspType<core.$YatspUndefinedInternals> {
|
|
433
|
+
}
|
|
434
|
+
export declare const YatspUndefined: core.$constructor<YatspUndefined>;
|
|
435
|
+
declare function _undefined(params?: string | core.$YatspUndefinedParams): YatspUndefined;
|
|
436
|
+
export { _undefined as undefined };
|
|
437
|
+
export interface YatspNull extends _YatspType<core.$YatspNullInternals> {
|
|
438
|
+
}
|
|
439
|
+
export declare const YatspNull: core.$constructor<YatspNull>;
|
|
440
|
+
declare function _null(params?: string | core.$YatspNullParams): YatspNull;
|
|
441
|
+
export { _null as null };
|
|
442
|
+
export interface YatspAny extends _YatspType<core.$YatspAnyInternals> {
|
|
443
|
+
}
|
|
444
|
+
export declare const YatspAny: core.$constructor<YatspAny>;
|
|
445
|
+
export declare function any(): YatspAny;
|
|
446
|
+
export interface YatspUnknown extends _YatspType<core.$YatspUnknownInternals> {
|
|
447
|
+
}
|
|
448
|
+
export declare const YatspUnknown: core.$constructor<YatspUnknown>;
|
|
449
|
+
export declare function unknown(): YatspUnknown;
|
|
450
|
+
export interface YatspNever extends _YatspType<core.$YatspNeverInternals> {
|
|
451
|
+
}
|
|
452
|
+
export declare const YatspNever: core.$constructor<YatspNever>;
|
|
453
|
+
export declare function never(params?: string | core.$YatspNeverParams): YatspNever;
|
|
454
|
+
export interface YatspVoid extends _YatspType<core.$YatspVoidInternals> {
|
|
455
|
+
}
|
|
456
|
+
export declare const YatspVoid: core.$constructor<YatspVoid>;
|
|
457
|
+
declare function _void(params?: string | core.$YatspVoidParams): YatspVoid;
|
|
458
|
+
export { _void as void };
|
|
459
|
+
export interface _YatspDate<T extends core.$YatspDateInternals = core.$YatspDateInternals> extends _YatspType<T> {
|
|
460
|
+
min(value: number | Date, params?: string | core.$YatspCheckGreaterThanParams): this;
|
|
461
|
+
max(value: number | Date, params?: string | core.$YatspCheckLessThanParams): this;
|
|
462
|
+
/** @deprecated Not recommended. */
|
|
463
|
+
minDate: Date | null;
|
|
464
|
+
/** @deprecated Not recommended. */
|
|
465
|
+
maxDate: Date | null;
|
|
466
|
+
}
|
|
467
|
+
export interface YatspDate extends _YatspDate<core.$YatspDateInternals<Date>> {
|
|
468
|
+
}
|
|
469
|
+
export declare const YatspDate: core.$constructor<YatspDate>;
|
|
470
|
+
export declare function date(params?: string | core.$YatspDateParams): YatspDate;
|
|
471
|
+
export interface YatspArray<T extends core.SomeType = core.$YatspType> extends _YatspType<core.$YatspArrayInternals<T>>, core.$YatspArray<T> {
|
|
472
|
+
element: T;
|
|
473
|
+
min(minLength: number, params?: string | core.$YatspCheckMinLengthParams): this;
|
|
474
|
+
nonempty(params?: string | core.$YatspCheckMinLengthParams): this;
|
|
475
|
+
max(maxLength: number, params?: string | core.$YatspCheckMaxLengthParams): this;
|
|
476
|
+
length(len: number, params?: string | core.$YatspCheckLengthEqualsParams): this;
|
|
477
|
+
unwrap(): T;
|
|
478
|
+
"~standard": YatspStandardSchemaWithJSON<this>;
|
|
479
|
+
}
|
|
480
|
+
export declare const YatspArray: core.$constructor<YatspArray>;
|
|
481
|
+
export declare function array<T extends core.SomeType>(element: T, params?: string | core.$YatspArrayParams): YatspArray<T>;
|
|
482
|
+
export declare function keyof<T extends YatspObject>(schema: T): YatspEnum<util.KeysEnum<T["_yatsp"]["output"]>>;
|
|
483
|
+
export type SafeExtendShape<Base extends core.$YatspShape, Ext extends core.$YatspLooseShape> = {
|
|
484
|
+
[K in keyof Ext]: K extends keyof Base ? core.output<Ext[K]> extends core.output<Base[K]> ? core.input<Ext[K]> extends core.input<Base[K]> ? Ext[K] : never : never : Ext[K];
|
|
485
|
+
};
|
|
486
|
+
export interface YatspObject<
|
|
487
|
+
/** @ts-ignore Cast variance */
|
|
488
|
+
out Shape extends core.$YatspShape = core.$YatspLooseShape, out Config extends core.$YatspObjectConfig = core.$strip> extends _YatspType<core.$YatspObjectInternals<Shape, Config>>, core.$YatspObject<Shape, Config> {
|
|
489
|
+
"~standard": YatspStandardSchemaWithJSON<this>;
|
|
490
|
+
shape: Shape;
|
|
491
|
+
keyof(): YatspEnum<util.ToEnum<keyof Shape & string>>;
|
|
492
|
+
/** Define a schema to validate all unrecognized keys. This overrides the existing strict/loose behavior. */
|
|
493
|
+
catchall<T extends core.SomeType>(schema: T): YatspObject<Shape, core.$catchall<T>>;
|
|
494
|
+
/** @deprecated Use `z.looseObject()` or `.loose()` instead. */
|
|
495
|
+
passthrough(): YatspObject<Shape, core.$loose>;
|
|
496
|
+
/** Consider `z.looseObject(A.shape)` instead */
|
|
497
|
+
loose(): YatspObject<Shape, core.$loose>;
|
|
498
|
+
/** Consider `z.strictObject(A.shape)` instead */
|
|
499
|
+
strict(): YatspObject<Shape, core.$strict>;
|
|
500
|
+
/** This is the default behavior. This method call is likely unnecessary. */
|
|
501
|
+
strip(): YatspObject<Shape, core.$strip>;
|
|
502
|
+
extend<U extends core.$YatspLooseShape>(shape: U): YatspObject<util.Extend<Shape, util.Writeable<U>>, Config>;
|
|
503
|
+
safeExtend<U extends core.$YatspLooseShape>(shape: SafeExtendShape<Shape, U> & Partial<Record<keyof Shape, core.SomeType>>): YatspObject<util.Extend<Shape, util.Writeable<U>>, Config>;
|
|
504
|
+
/**
|
|
505
|
+
* @deprecated Use [`A.extend(B.shape)`](https://yatsp.dev/api?id=extend) instead.
|
|
506
|
+
*/
|
|
507
|
+
merge<U extends YatspObject>(other: U): YatspObject<util.Extend<Shape, U["shape"]>, U["_yatsp"]["config"]>;
|
|
508
|
+
pick<M extends util.Mask<keyof Shape>>(mask: M & Record<Exclude<keyof M, keyof Shape>, never>): YatspObject<util.Flatten<Pick<Shape, Extract<keyof Shape, keyof M>>>, Config>;
|
|
509
|
+
omit<M extends util.Mask<keyof Shape>>(mask: M & Record<Exclude<keyof M, keyof Shape>, never>): YatspObject<util.Flatten<Omit<Shape, Extract<keyof Shape, keyof M>>>, Config>;
|
|
510
|
+
partial(): YatspObject<{
|
|
511
|
+
-readonly [k in keyof Shape]: YatspOptional<Shape[k]>;
|
|
512
|
+
}, Config>;
|
|
513
|
+
partial<M extends util.Mask<keyof Shape>>(mask: M & Record<Exclude<keyof M, keyof Shape>, never>): YatspObject<{
|
|
514
|
+
-readonly [k in keyof Shape]: k extends keyof M ? YatspOptional<Shape[k]> : Shape[k];
|
|
515
|
+
}, Config>;
|
|
516
|
+
exactPartial(): YatspObject<{
|
|
517
|
+
-readonly [k in keyof Shape]: YatspExactOptional<Shape[k]>;
|
|
518
|
+
}, Config>;
|
|
519
|
+
exactPartial<M extends util.Mask<keyof Shape>>(mask: M & Record<Exclude<keyof M, keyof Shape>, never>): YatspObject<{
|
|
520
|
+
-readonly [k in keyof Shape]: k extends keyof M ? YatspExactOptional<Shape[k]> : Shape[k];
|
|
521
|
+
}, Config>;
|
|
522
|
+
required(): YatspObject<{
|
|
523
|
+
-readonly [k in keyof Shape]: YatspNonOptional<Shape[k]>;
|
|
524
|
+
}, Config>;
|
|
525
|
+
required<M extends util.Mask<keyof Shape>>(mask: M & Record<Exclude<keyof M, keyof Shape>, never>): YatspObject<{
|
|
526
|
+
-readonly [k in keyof Shape]: k extends keyof M ? YatspNonOptional<Shape[k]> : Shape[k];
|
|
527
|
+
}, Config>;
|
|
528
|
+
}
|
|
529
|
+
export declare const YatspObject: core.$constructor<YatspObject>;
|
|
530
|
+
export declare function object<T extends core.$YatspLooseShape = Partial<Record<never, core.SomeType>>>(shape?: T, params?: string | core.$YatspObjectParams): YatspObject<util.Writeable<T>, core.$strip>;
|
|
531
|
+
export declare function strictObject<T extends core.$YatspLooseShape>(shape: T, params?: string | core.$YatspObjectParams): YatspObject<util.Writeable<T>, core.$strict>;
|
|
532
|
+
export declare function looseObject<T extends core.$YatspLooseShape>(shape: T, params?: string | core.$YatspObjectParams): YatspObject<util.Writeable<T>, core.$loose>;
|
|
533
|
+
export interface YatspUnion<T extends readonly core.SomeType[] = readonly core.$YatspType[]> extends _YatspType<core.$YatspUnionInternals<T>>, core.$YatspUnion<T> {
|
|
534
|
+
"~standard": YatspStandardSchemaWithJSON<this>;
|
|
535
|
+
options: T;
|
|
536
|
+
}
|
|
537
|
+
export declare const YatspUnion: core.$constructor<YatspUnion>;
|
|
538
|
+
export declare function union<const T extends readonly core.SomeType[]>(options: T, params?: string | core.$YatspUnionParams): YatspUnion<T>;
|
|
539
|
+
export interface YatspXor<T extends readonly core.SomeType[] = readonly core.$YatspType[]> extends _YatspType<core.$YatspXorInternals<T>>, core.$YatspXor<T> {
|
|
540
|
+
"~standard": YatspStandardSchemaWithJSON<this>;
|
|
541
|
+
options: T;
|
|
542
|
+
}
|
|
543
|
+
export declare const YatspXor: core.$constructor<YatspXor>;
|
|
544
|
+
/** Creates an exclusive union (XOR) where exactly one option must match.
|
|
545
|
+
* Unlike regular unions that succeed when any option matches, xor fails if
|
|
546
|
+
* zero or more than one option matches the input. */
|
|
547
|
+
export declare function xor<const T extends readonly core.SomeType[]>(options: T, params?: string | core.$YatspXorParams): YatspXor<T>;
|
|
548
|
+
export interface YatspDiscriminatedUnion<Options extends readonly core.SomeType[] = readonly core.$YatspType[], Disc extends string = string> extends YatspUnion<Options>, core.$YatspDiscriminatedUnion<Options, Disc> {
|
|
549
|
+
"~standard": YatspStandardSchemaWithJSON<this>;
|
|
550
|
+
_yatsp: core.$YatspDiscriminatedUnionInternals<Options, Disc>;
|
|
551
|
+
def: core.$YatspDiscriminatedUnionDef<Options, Disc>;
|
|
552
|
+
}
|
|
553
|
+
export declare const YatspDiscriminatedUnion: core.$constructor<YatspDiscriminatedUnion>;
|
|
554
|
+
export declare function discriminatedUnion<Types extends readonly [core.$YatspTypeDiscriminable, ...core.$YatspTypeDiscriminable[]], Disc extends string>(discriminator: Disc, options: Types, params?: string | core.$YatspDiscriminatedUnionParams): YatspDiscriminatedUnion<Types, Disc>;
|
|
555
|
+
export interface YatspIntersection<A extends core.SomeType = core.$YatspType, B extends core.SomeType = core.$YatspType> extends _YatspType<core.$YatspIntersectionInternals<A, B>>, core.$YatspIntersection<A, B> {
|
|
556
|
+
"~standard": YatspStandardSchemaWithJSON<this>;
|
|
557
|
+
}
|
|
558
|
+
export declare const YatspIntersection: core.$constructor<YatspIntersection>;
|
|
559
|
+
export declare function intersection<T extends core.SomeType, U extends core.SomeType>(left: T, right: U): YatspIntersection<T, U>;
|
|
560
|
+
export interface YatspTuple<T extends util.TupleItems = readonly core.$YatspType[], Rest extends core.SomeType | null = core.$YatspType | null> extends _YatspType<core.$YatspTupleInternals<T, Rest>>, core.$YatspTuple<T, Rest> {
|
|
561
|
+
"~standard": YatspStandardSchemaWithJSON<this>;
|
|
562
|
+
rest<Rest extends core.SomeType = core.$YatspType>(rest: Rest): YatspTuple<T, Rest>;
|
|
563
|
+
partial(): YatspTuple<{
|
|
564
|
+
-readonly [k in keyof T]: YatspOptional<T[k]>;
|
|
565
|
+
}, Rest>;
|
|
566
|
+
}
|
|
567
|
+
export declare const YatspTuple: core.$constructor<YatspTuple>;
|
|
568
|
+
export declare function tuple<T extends readonly [core.SomeType, ...core.SomeType[]]>(items: T, params?: string | core.$YatspTupleParams): YatspTuple<T, null>;
|
|
569
|
+
export declare function tuple<T extends readonly [core.SomeType, ...core.SomeType[]], Rest extends core.SomeType>(items: T, rest: Rest, params?: string | core.$YatspTupleParams): YatspTuple<T, Rest>;
|
|
570
|
+
export declare function tuple(items: [], params?: string | core.$YatspTupleParams): YatspTuple<[], null>;
|
|
571
|
+
export interface YatspRecord<Key extends core.$YatspRecordKey = core.$YatspRecordKey, Value extends core.SomeType = core.$YatspType> extends _YatspType<core.$YatspRecordInternals<Key, Value>>, core.$YatspRecord<Key, Value> {
|
|
572
|
+
"~standard": YatspStandardSchemaWithJSON<this>;
|
|
573
|
+
keyType: Key;
|
|
574
|
+
valueType: Value;
|
|
575
|
+
}
|
|
576
|
+
export declare const YatspRecord: core.$constructor<YatspRecord>;
|
|
577
|
+
export declare function record<Key extends core.$YatspRecordKey, Value extends core.SomeType>(keyType: Key, valueType: Value, params?: string | core.$YatspRecordParams): YatspRecord<Key, Value>;
|
|
578
|
+
export declare function partialRecord<Key extends core.$YatspRecordKey, Value extends core.SomeType>(keyType: Key, valueType: Value, params?: string | core.$YatspRecordParams): YatspRecord<Key & core.$partial, Value>;
|
|
579
|
+
export declare function looseRecord<Key extends core.$YatspRecordKey, Value extends core.SomeType>(keyType: Key, valueType: Value, params?: string | core.$YatspRecordParams): YatspRecord<Key, Value>;
|
|
580
|
+
export interface YatspMap<Key extends core.SomeType = core.$YatspType, Value extends core.SomeType = core.$YatspType> extends _YatspType<core.$YatspMapInternals<Key, Value>>, core.$YatspMap<Key, Value> {
|
|
581
|
+
"~standard": YatspStandardSchemaWithJSON<this>;
|
|
582
|
+
keyType: Key;
|
|
583
|
+
valueType: Value;
|
|
584
|
+
min(minSize: number, params?: string | core.$YatspCheckMinSizeParams): this;
|
|
585
|
+
nonempty(params?: string | core.$YatspCheckMinSizeParams): this;
|
|
586
|
+
max(maxSize: number, params?: string | core.$YatspCheckMaxSizeParams): this;
|
|
587
|
+
size(size: number, params?: string | core.$YatspCheckSizeEqualsParams): this;
|
|
588
|
+
}
|
|
589
|
+
export declare const YatspMap: core.$constructor<YatspMap>;
|
|
590
|
+
export declare function map<Key extends core.SomeType, Value extends core.SomeType>(keyType: Key, valueType: Value, params?: string | core.$YatspMapParams): YatspMap<Key, Value>;
|
|
591
|
+
export interface YatspSet<T extends core.SomeType = core.$YatspType> extends _YatspType<core.$YatspSetInternals<T>>, core.$YatspSet<T> {
|
|
592
|
+
"~standard": YatspStandardSchemaWithJSON<this>;
|
|
593
|
+
min(minSize: number, params?: string | core.$YatspCheckMinSizeParams): this;
|
|
594
|
+
nonempty(params?: string | core.$YatspCheckMinSizeParams): this;
|
|
595
|
+
max(maxSize: number, params?: string | core.$YatspCheckMaxSizeParams): this;
|
|
596
|
+
size(size: number, params?: string | core.$YatspCheckSizeEqualsParams): this;
|
|
597
|
+
}
|
|
598
|
+
export declare const YatspSet: core.$constructor<YatspSet>;
|
|
599
|
+
export declare function set<Value extends core.SomeType>(valueType: Value, params?: string | core.$YatspSetParams): YatspSet<Value>;
|
|
600
|
+
export interface YatspEnum<
|
|
601
|
+
/** @ts-ignore Cast variance */
|
|
602
|
+
out T extends util.EnumLike = util.EnumLike> extends _YatspType<core.$YatspEnumInternals<T>>, core.$YatspEnum<T> {
|
|
603
|
+
"~standard": YatspStandardSchemaWithJSON<this>;
|
|
604
|
+
enum: T;
|
|
605
|
+
options: Array<T[keyof T]>;
|
|
606
|
+
extract<const U extends readonly (keyof T)[]>(values: U, params?: string | core.$YatspEnumParams): YatspEnum<util.Flatten<Pick<T, U[number]>>>;
|
|
607
|
+
exclude<const U extends readonly (keyof T)[]>(values: U, params?: string | core.$YatspEnumParams): YatspEnum<util.Flatten<Omit<T, U[number]>>>;
|
|
608
|
+
}
|
|
609
|
+
export declare const YatspEnum: core.$constructor<YatspEnum>;
|
|
610
|
+
declare function _enum<const T extends readonly string[]>(values: T, params?: string | core.$YatspEnumParams): YatspEnum<util.ToEnum<T[number]>>;
|
|
611
|
+
declare function _enum<const T extends util.EnumLike>(entries: T, params?: string | core.$YatspEnumParams): YatspEnum<T>;
|
|
612
|
+
export { _enum as enum };
|
|
613
|
+
/** @deprecated This API has been merged into `z.enum()`. Use `z.enum()` instead.
|
|
614
|
+
*
|
|
615
|
+
* ```ts
|
|
616
|
+
* enum Colors { red, green, blue }
|
|
617
|
+
* z.enum(Colors);
|
|
618
|
+
* ```
|
|
619
|
+
*/
|
|
620
|
+
export declare function nativeEnum<T extends util.EnumLike>(entries: T, params?: string | core.$YatspEnumParams): YatspEnum<T>;
|
|
621
|
+
export interface YatspLiteral<T extends util.Literal = util.Literal> extends _YatspType<core.$YatspLiteralInternals<T>>, core.$YatspLiteral<T> {
|
|
622
|
+
"~standard": YatspStandardSchemaWithJSON<this>;
|
|
623
|
+
values: Set<T>;
|
|
624
|
+
/** @legacy Use `.values` instead. Accessing this property will throw an error if the literal accepts multiple values. */
|
|
625
|
+
value: T;
|
|
626
|
+
}
|
|
627
|
+
export declare const YatspLiteral: core.$constructor<YatspLiteral>;
|
|
628
|
+
export declare function literal<const T extends ReadonlyArray<util.Literal>>(value: T, params?: string | core.$YatspLiteralParams): YatspLiteral<T[number]>;
|
|
629
|
+
export declare function literal<const T extends util.Literal>(value: T, params?: string | core.$YatspLiteralParams): YatspLiteral<T>;
|
|
630
|
+
export interface YatspFile extends _YatspType<core.$YatspFileInternals>, core.$YatspFile {
|
|
631
|
+
"~standard": YatspStandardSchemaWithJSON<this>;
|
|
632
|
+
min(size: number, params?: string | core.$YatspCheckMinSizeParams): this;
|
|
633
|
+
max(size: number, params?: string | core.$YatspCheckMaxSizeParams): this;
|
|
634
|
+
mime(types: util.MimeTypes | Array<util.MimeTypes>, params?: string | core.$YatspCheckMimeTypeParams): this;
|
|
635
|
+
}
|
|
636
|
+
export declare const YatspFile: core.$constructor<YatspFile>;
|
|
637
|
+
export declare function file(params?: string | core.$YatspFileParams): YatspFile;
|
|
638
|
+
export interface YatspTransform<O = unknown, I = unknown> extends _YatspType<core.$YatspTransformInternals<O, I>>, core.$YatspTransform<O, I> {
|
|
639
|
+
"~standard": YatspStandardSchemaWithJSON<this>;
|
|
640
|
+
}
|
|
641
|
+
export declare const YatspTransform: core.$constructor<YatspTransform>;
|
|
642
|
+
export declare function transform<I = unknown, O = I>(fn: (input: I, ctx: core.$RefinementCtx) => O): YatspTransform<Awaited<O>, I>;
|
|
643
|
+
export interface YatspOptional<T extends core.SomeType = core.$YatspType> extends _YatspType<core.$YatspOptionalInternals<T>>, core.$YatspOptional<T> {
|
|
644
|
+
"~standard": YatspStandardSchemaWithJSON<this>;
|
|
645
|
+
unwrap(): T;
|
|
646
|
+
}
|
|
647
|
+
export declare const YatspOptional: core.$constructor<YatspOptional>;
|
|
648
|
+
export declare function optional<T extends core.SomeType>(innerType: T): YatspOptional<T>;
|
|
649
|
+
export interface YatspExactOptional<T extends core.SomeType = core.$YatspType> extends _YatspType<core.$YatspExactOptionalInternals<T>>, core.$YatspExactOptional<T> {
|
|
650
|
+
"~standard": YatspStandardSchemaWithJSON<this>;
|
|
651
|
+
unwrap(): T;
|
|
652
|
+
}
|
|
653
|
+
export declare const YatspExactOptional: core.$constructor<YatspExactOptional>;
|
|
654
|
+
export declare function exactOptional<T extends core.SomeType>(innerType: T): YatspExactOptional<T>;
|
|
655
|
+
export interface YatspNullable<T extends core.SomeType = core.$YatspType> extends _YatspType<core.$YatspNullableInternals<T>>, core.$YatspNullable<T> {
|
|
656
|
+
"~standard": YatspStandardSchemaWithJSON<this>;
|
|
657
|
+
unwrap(): T;
|
|
658
|
+
}
|
|
659
|
+
export declare const YatspNullable: core.$constructor<YatspNullable>;
|
|
660
|
+
export declare function nullable<T extends core.SomeType>(innerType: T): YatspNullable<T>;
|
|
661
|
+
export declare function nullish<T extends core.SomeType>(innerType: T): YatspOptional<YatspNullable<T>>;
|
|
662
|
+
export interface YatspDefault<T extends core.SomeType = core.$YatspType> extends _YatspType<core.$YatspDefaultInternals<T>>, core.$YatspDefault<T> {
|
|
663
|
+
"~standard": YatspStandardSchemaWithJSON<this>;
|
|
664
|
+
unwrap(): T;
|
|
665
|
+
/** @deprecated Use `.unwrap()` instead. */
|
|
666
|
+
removeDefault(): T;
|
|
667
|
+
}
|
|
668
|
+
export declare const YatspDefault: core.$constructor<YatspDefault>;
|
|
669
|
+
export declare function _default<T extends core.SomeType>(innerType: T, defaultValue: util.NoUndefined<core.output<T>> | (() => util.NoUndefined<core.output<T>>)): YatspDefault<T>;
|
|
670
|
+
export interface YatspPrefault<T extends core.SomeType = core.$YatspType> extends _YatspType<core.$YatspPrefaultInternals<T>>, core.$YatspPrefault<T> {
|
|
671
|
+
"~standard": YatspStandardSchemaWithJSON<this>;
|
|
672
|
+
unwrap(): T;
|
|
673
|
+
}
|
|
674
|
+
export declare const YatspPrefault: core.$constructor<YatspPrefault>;
|
|
675
|
+
export declare function prefault<T extends core.SomeType>(innerType: T, defaultValue: core.input<T> | (() => core.input<T>)): YatspPrefault<T>;
|
|
676
|
+
export interface YatspNonOptional<T extends core.SomeType = core.$YatspType> extends _YatspType<core.$YatspNonOptionalInternals<T>>, core.$YatspNonOptional<T> {
|
|
677
|
+
"~standard": YatspStandardSchemaWithJSON<this>;
|
|
678
|
+
unwrap(): T;
|
|
679
|
+
}
|
|
680
|
+
export declare const YatspNonOptional: core.$constructor<YatspNonOptional>;
|
|
681
|
+
export declare function nonoptional<T extends core.SomeType>(innerType: T, params?: string | core.$YatspNonOptionalParams): YatspNonOptional<T>;
|
|
682
|
+
export interface YatspSuccess<T extends core.SomeType = core.$YatspType> extends _YatspType<core.$YatspSuccessInternals<T>>, core.$YatspSuccess<T> {
|
|
683
|
+
"~standard": YatspStandardSchemaWithJSON<this>;
|
|
684
|
+
unwrap(): T;
|
|
685
|
+
}
|
|
686
|
+
export declare const YatspSuccess: core.$constructor<YatspSuccess>;
|
|
687
|
+
export declare function success<T extends core.SomeType>(innerType: T): YatspSuccess<T>;
|
|
688
|
+
export interface YatspCatch<T extends core.SomeType = core.$YatspType> extends _YatspType<core.$YatspCatchInternals<T>>, core.$YatspCatch<T> {
|
|
689
|
+
"~standard": YatspStandardSchemaWithJSON<this>;
|
|
690
|
+
unwrap(): T;
|
|
691
|
+
/** @deprecated Use `.unwrap()` instead. */
|
|
692
|
+
removeCatch(): T;
|
|
693
|
+
}
|
|
694
|
+
export declare const YatspCatch: core.$constructor<YatspCatch>;
|
|
695
|
+
declare function _catch<T extends core.SomeType>(innerType: T, catchValue: core.output<T> | ((ctx: core.$YatspCatchCtx) => core.output<T>)): YatspCatch<T>;
|
|
696
|
+
export { _catch as catch };
|
|
697
|
+
export interface YatspNaN extends _YatspType<core.$YatspNaNInternals>, core.$YatspNaN {
|
|
698
|
+
"~standard": YatspStandardSchemaWithJSON<this>;
|
|
699
|
+
}
|
|
700
|
+
export declare const YatspNaN: core.$constructor<YatspNaN>;
|
|
701
|
+
export declare function nan(params?: string | core.$YatspNaNParams): YatspNaN;
|
|
702
|
+
export interface YatspPipe<A extends core.SomeType = core.$YatspType, B extends core.SomeType = core.$YatspType> extends _YatspType<core.$YatspPipeInternals<A, B>>, core.$YatspPipe<A, B> {
|
|
703
|
+
"~standard": YatspStandardSchemaWithJSON<this>;
|
|
704
|
+
in: A;
|
|
705
|
+
out: B;
|
|
706
|
+
}
|
|
707
|
+
export declare const YatspPipe: core.$constructor<YatspPipe>;
|
|
708
|
+
export declare function pipe<const A extends core.SomeType, B extends core.$YatspType<unknown, core.output<A>> = core.$YatspType<unknown, core.output<A>>>(in_: A, out: B | core.$YatspType<unknown, core.output<A>>): YatspPipe<A, B>;
|
|
709
|
+
export interface YatspCodec<A extends core.SomeType = core.$YatspType, B extends core.SomeType = core.$YatspType> extends YatspPipe<A, B>, core.$YatspCodec<A, B> {
|
|
710
|
+
"~standard": YatspStandardSchemaWithJSON<this>;
|
|
711
|
+
_yatsp: core.$YatspCodecInternals<A, B>;
|
|
712
|
+
def: core.$YatspCodecDef<A, B>;
|
|
713
|
+
}
|
|
714
|
+
export declare const YatspCodec: core.$constructor<YatspCodec>;
|
|
715
|
+
export declare function codec<const A extends core.SomeType, B extends core.SomeType = core.$YatspType>(in_: A, out: B, params: {
|
|
716
|
+
decode: (value: core.output<A>, payload: core.ParsePayload<core.output<A>>) => core.util.MaybeAsync<core.input<B>>;
|
|
717
|
+
encode: (value: core.input<B>, payload: core.ParsePayload<core.input<B>>) => core.util.MaybeAsync<core.output<A>>;
|
|
718
|
+
}): YatspCodec<A, B>;
|
|
719
|
+
export declare function invertCodec<A extends core.SomeType, B extends core.SomeType>(codec: YatspCodec<A, B>): YatspCodec<B, A>;
|
|
720
|
+
export interface YatspPreprocess<B extends core.SomeType = core.$YatspType, I = unknown> extends YatspPipe<core.$YatspTransform<unknown, I>, B>, core.$YatspPreprocess<B, I> {
|
|
721
|
+
"~standard": YatspStandardSchemaWithJSON<this>;
|
|
722
|
+
_yatsp: core.$YatspPreprocessInternals<B, I>;
|
|
723
|
+
def: core.$YatspPreprocessDef<B, I>;
|
|
724
|
+
}
|
|
725
|
+
export declare const YatspPreprocess: core.$constructor<YatspPreprocess>;
|
|
726
|
+
export interface YatspReadonly<T extends core.SomeType = core.$YatspType> extends _YatspType<core.$YatspReadonlyInternals<T>>, core.$YatspReadonly<T> {
|
|
727
|
+
"~standard": YatspStandardSchemaWithJSON<this>;
|
|
728
|
+
unwrap(): T;
|
|
729
|
+
}
|
|
730
|
+
export declare const YatspReadonly: core.$constructor<YatspReadonly>;
|
|
731
|
+
export declare function readonly<T extends core.SomeType>(innerType: T): YatspReadonly<T>;
|
|
732
|
+
export interface YatspTemplateLiteral<Template extends string = string> extends _YatspType<core.$YatspTemplateLiteralInternals<Template>>, core.$YatspTemplateLiteral<Template> {
|
|
733
|
+
"~standard": YatspStandardSchemaWithJSON<this>;
|
|
734
|
+
}
|
|
735
|
+
export declare const YatspTemplateLiteral: core.$constructor<YatspTemplateLiteral>;
|
|
736
|
+
export declare function templateLiteral<const Parts extends core.$YatspTemplateLiteralPart[]>(parts: Parts, params?: string | core.$YatspTemplateLiteralParams): YatspTemplateLiteral<core.$PartsToTemplateLiteral<Parts>>;
|
|
737
|
+
export interface YatspLazy<T extends core.SomeType = core.$YatspType> extends _YatspType<core.$YatspLazyInternals<T>>, core.$YatspLazy<T> {
|
|
738
|
+
"~standard": YatspStandardSchemaWithJSON<this>;
|
|
739
|
+
unwrap(): T;
|
|
740
|
+
}
|
|
741
|
+
export declare const YatspLazy: core.$constructor<YatspLazy>;
|
|
742
|
+
export declare function lazy<T extends core.SomeType>(getter: () => T): YatspLazy<T>;
|
|
743
|
+
export interface YatspPromise<T extends core.SomeType = core.$YatspType> extends _YatspType<core.$YatspPromiseInternals<T>>, core.$YatspPromise<T> {
|
|
744
|
+
"~standard": YatspStandardSchemaWithJSON<this>;
|
|
745
|
+
unwrap(): T;
|
|
746
|
+
}
|
|
747
|
+
export declare const YatspPromise: core.$constructor<YatspPromise>;
|
|
748
|
+
export declare function promise<T extends core.SomeType>(innerType: T): YatspPromise<T>;
|
|
749
|
+
export interface YatspFunction<Args extends core.$YatspFunctionIn = core.$YatspFunctionIn, Returns extends core.$YatspFunctionOut = core.$YatspFunctionOut> extends _YatspType<core.$YatspFunctionInternals<Args, Returns>>, core.$YatspFunction<Args, Returns> {
|
|
750
|
+
"~standard": YatspStandardSchemaWithJSON<this>;
|
|
751
|
+
_def: core.$YatspFunctionDef<Args, Returns>;
|
|
752
|
+
_input: core.$InferInnerFunctionType<Args, Returns>;
|
|
753
|
+
_output: core.$InferOuterFunctionType<Args, Returns>;
|
|
754
|
+
input<const Items extends util.TupleItems, const Rest extends core.$YatspFunctionOut = core.$YatspFunctionOut>(args: Items, rest?: Rest): YatspFunction<core.$YatspTuple<Items, Rest>, Returns>;
|
|
755
|
+
input<NewArgs extends core.$YatspFunctionIn>(args: NewArgs): YatspFunction<NewArgs, Returns>;
|
|
756
|
+
input(...args: any[]): YatspFunction<any, Returns>;
|
|
757
|
+
output<NewReturns extends core.$YatspType>(output: NewReturns): YatspFunction<Args, NewReturns>;
|
|
758
|
+
}
|
|
759
|
+
export declare const YatspFunction: core.$constructor<YatspFunction>;
|
|
760
|
+
export declare function _function(): YatspFunction;
|
|
761
|
+
export declare function _function<const In extends ReadonlyArray<core.$YatspType>>(params: {
|
|
762
|
+
input: In;
|
|
763
|
+
}): YatspFunction<YatspTuple<In, null>, core.$YatspFunctionOut>;
|
|
764
|
+
export declare function _function<const In extends ReadonlyArray<core.$YatspType>, const Out extends core.$YatspFunctionOut = core.$YatspFunctionOut>(params: {
|
|
765
|
+
input: In;
|
|
766
|
+
output: Out;
|
|
767
|
+
}): YatspFunction<YatspTuple<In, null>, Out>;
|
|
768
|
+
export declare function _function<const In extends core.$YatspFunctionIn = core.$YatspFunctionIn>(params: {
|
|
769
|
+
input: In;
|
|
770
|
+
}): YatspFunction<In, core.$YatspFunctionOut>;
|
|
771
|
+
export declare function _function<const Out extends core.$YatspFunctionOut = core.$YatspFunctionOut>(params: {
|
|
772
|
+
output: Out;
|
|
773
|
+
}): YatspFunction<core.$YatspFunctionIn, Out>;
|
|
774
|
+
export declare function _function<In extends core.$YatspFunctionIn = core.$YatspFunctionIn, Out extends core.$YatspType = core.$YatspType>(params?: {
|
|
775
|
+
input: In;
|
|
776
|
+
output: Out;
|
|
777
|
+
}): YatspFunction<In, Out>;
|
|
778
|
+
export { _function as function };
|
|
779
|
+
export interface YatspCustom<O = unknown, I = unknown> extends _YatspType<core.$YatspCustomInternals<O, I>>, core.$YatspCustom<O, I> {
|
|
780
|
+
"~standard": YatspStandardSchemaWithJSON<this>;
|
|
781
|
+
}
|
|
782
|
+
export declare const YatspCustom: core.$constructor<YatspCustom>;
|
|
783
|
+
export declare function check<O = unknown>(fn: core.CheckFn<O>): core.$YatspCheck<O>;
|
|
784
|
+
export declare function custom<O>(fn?: (data: unknown) => unknown, _params?: string | core.$YatspCustomParams | undefined): YatspCustom<O, O>;
|
|
785
|
+
export declare function refine<T>(fn: (arg: NoInfer<T>) => util.MaybeAsync<unknown>, _params?: string | core.$YatspCustomParams): core.$YatspCheck<T>;
|
|
786
|
+
export declare function superRefine<T>(fn: (arg: T, payload: core.$RefinementCtx<T>) => void | Promise<void>, params?: core.$YatspSuperRefineParams): core.$YatspCheck<T>;
|
|
787
|
+
export declare const describe: typeof core.describe;
|
|
788
|
+
export declare const meta: typeof core.meta;
|
|
789
|
+
type YatspInstanceOfParams = core.Params<YatspCustom, core.$YatspIssueCustom, "type" | "check" | "checks" | "fn" | "abort" | "error" | "params" | "path">;
|
|
790
|
+
export interface YatspInstanceOf<T = unknown> extends YatspCustom<T, T> {
|
|
791
|
+
properties<Shape extends {
|
|
792
|
+
[k in keyof T as T[k] extends Function ? never : k]?: core.$YatspType<unknown, T[k]>;
|
|
793
|
+
}>(shape: Shape, params?: string | core.$YatspCheckPropertiesParams): YatspInstanceOf<T & core.$InferObjectInput<Shape, {}>>;
|
|
794
|
+
}
|
|
795
|
+
export declare const YatspInstanceOf: core.$constructor<YatspInstanceOf>;
|
|
796
|
+
declare function _instanceof<T extends typeof util.Class>(cls: T, params?: YatspInstanceOfParams): YatspInstanceOf<InstanceType<T>>;
|
|
797
|
+
export { _instanceof as instanceof };
|
|
798
|
+
export declare const stringbool: (_params?: string | core.$YatspStringBoolParams) => YatspCodec<YatspString, YatspBoolean>;
|
|
799
|
+
type _YatspJSONSchema = YatspUnion<[
|
|
800
|
+
YatspString,
|
|
801
|
+
YatspNumber,
|
|
802
|
+
YatspBoolean,
|
|
803
|
+
YatspNull,
|
|
804
|
+
YatspArray<YatspJSONSchema>,
|
|
805
|
+
YatspRecord<YatspString, YatspJSONSchema>
|
|
806
|
+
]>;
|
|
807
|
+
type _YatspJSONSchemaInternals = _YatspJSONSchema["_yatsp"];
|
|
808
|
+
export interface YatspJSONSchemaInternals extends _YatspJSONSchemaInternals {
|
|
809
|
+
output: util.JSONType;
|
|
810
|
+
input: util.JSONType;
|
|
811
|
+
}
|
|
812
|
+
export interface YatspJSONSchema extends _YatspJSONSchema {
|
|
813
|
+
_yatsp: YatspJSONSchemaInternals;
|
|
814
|
+
}
|
|
815
|
+
export declare function json(params?: string | core.$YatspCustomParams): YatspJSONSchema;
|
|
816
|
+
export declare function preprocess<A, U extends core.SomeType, B = unknown>(fn: (arg: B, ctx: core.$RefinementCtx) => A, schema: U): YatspPreprocess<U, B>;
|