@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
package/v3/types.d.ts
ADDED
|
@@ -0,0 +1,1034 @@
|
|
|
1
|
+
import { type IssueData, type StringValidation, type YatspCustomIssue, YatspError, type YatspErrorMap } from "./YatspError.js";
|
|
2
|
+
import type { enumUtil } from "./helpers/enumUtil.js";
|
|
3
|
+
import { errorUtil } from "./helpers/errorUtil.js";
|
|
4
|
+
import { type AsyncParseReturnType, INVALID, type ParseContext, type ParseInput, type ParseParams, type ParseReturnType, ParseStatus, type SyncParseReturnType } from "./helpers/parseUtil.js";
|
|
5
|
+
import type { partialUtil } from "./helpers/partialUtil.js";
|
|
6
|
+
import type { Primitive } from "./helpers/typeAliases.js";
|
|
7
|
+
import { util, type objectUtil } from "./helpers/util.js";
|
|
8
|
+
import type { StandardSchemaV1 } from "./standard-schema.js";
|
|
9
|
+
export interface RefinementCtx {
|
|
10
|
+
addIssue: (arg: IssueData) => void;
|
|
11
|
+
path: (string | number)[];
|
|
12
|
+
}
|
|
13
|
+
export type YatspRawShape = {
|
|
14
|
+
[k: string]: YatspTypeAny;
|
|
15
|
+
};
|
|
16
|
+
export type YatspTypeAny = YatspType<any, any, any>;
|
|
17
|
+
export type TypeOf<T extends YatspType<any, any, any>> = T["_output"];
|
|
18
|
+
export type input<T extends YatspType<any, any, any>> = T["_input"];
|
|
19
|
+
export type output<T extends YatspType<any, any, any>> = T["_output"];
|
|
20
|
+
export type { TypeOf as infer };
|
|
21
|
+
export type CustomErrorParams = Partial<util.Omit<YatspCustomIssue, "code">>;
|
|
22
|
+
export interface YatspTypeDef {
|
|
23
|
+
errorMap?: YatspErrorMap | undefined;
|
|
24
|
+
description?: string | undefined;
|
|
25
|
+
}
|
|
26
|
+
export type RawCreateParams = {
|
|
27
|
+
errorMap?: YatspErrorMap | undefined;
|
|
28
|
+
invalid_type_error?: string | undefined;
|
|
29
|
+
required_error?: string | undefined;
|
|
30
|
+
message?: string | undefined;
|
|
31
|
+
description?: string | undefined;
|
|
32
|
+
} | undefined;
|
|
33
|
+
export type ProcessedCreateParams = {
|
|
34
|
+
errorMap?: YatspErrorMap | undefined;
|
|
35
|
+
description?: string | undefined;
|
|
36
|
+
};
|
|
37
|
+
export type SafeParseSuccess<Output> = {
|
|
38
|
+
success: true;
|
|
39
|
+
data: Output;
|
|
40
|
+
error?: never;
|
|
41
|
+
};
|
|
42
|
+
export type SafeParseError<Input> = {
|
|
43
|
+
success: false;
|
|
44
|
+
error: YatspError<Input>;
|
|
45
|
+
data?: never;
|
|
46
|
+
};
|
|
47
|
+
export type SafeParseReturnType<Input, Output> = SafeParseSuccess<Output> | SafeParseError<Input>;
|
|
48
|
+
export declare abstract class YatspType<Output = any, Def extends YatspTypeDef = YatspTypeDef, Input = Output> {
|
|
49
|
+
readonly _type: Output;
|
|
50
|
+
readonly _output: Output;
|
|
51
|
+
readonly _input: Input;
|
|
52
|
+
readonly _def: Def;
|
|
53
|
+
get description(): string | undefined;
|
|
54
|
+
"~standard": StandardSchemaV1.Props<Input, Output>;
|
|
55
|
+
abstract _parse(input: ParseInput): ParseReturnType<Output>;
|
|
56
|
+
_getType(input: ParseInput): string;
|
|
57
|
+
_getOrReturnCtx(input: ParseInput, ctx?: ParseContext | undefined): ParseContext;
|
|
58
|
+
_processInputParams(input: ParseInput): {
|
|
59
|
+
status: ParseStatus;
|
|
60
|
+
ctx: ParseContext;
|
|
61
|
+
};
|
|
62
|
+
_parseSync(input: ParseInput): SyncParseReturnType<Output>;
|
|
63
|
+
_parseAsync(input: ParseInput): AsyncParseReturnType<Output>;
|
|
64
|
+
parse(data: unknown, params?: util.InexactPartial<ParseParams>): Output;
|
|
65
|
+
safeParse(data: unknown, params?: util.InexactPartial<ParseParams>): SafeParseReturnType<Input, Output>;
|
|
66
|
+
"~validate"(data: unknown): StandardSchemaV1.Result<Output> | Promise<StandardSchemaV1.Result<Output>>;
|
|
67
|
+
parseAsync(data: unknown, params?: util.InexactPartial<ParseParams>): Promise<Output>;
|
|
68
|
+
safeParseAsync(data: unknown, params?: util.InexactPartial<ParseParams>): Promise<SafeParseReturnType<Input, Output>>;
|
|
69
|
+
/** Alias of safeParseAsync */
|
|
70
|
+
spa: (data: unknown, params?: util.InexactPartial<ParseParams>) => Promise<SafeParseReturnType<Input, Output>>;
|
|
71
|
+
refine<RefinedOutput extends Output>(check: (arg: Output) => arg is RefinedOutput, message?: string | CustomErrorParams | ((arg: Output) => CustomErrorParams)): YatspEffects<this, RefinedOutput, Input>;
|
|
72
|
+
refine(check: (arg: Output) => unknown | Promise<unknown>, message?: string | CustomErrorParams | ((arg: Output) => CustomErrorParams)): YatspEffects<this, Output, Input>;
|
|
73
|
+
refinement<RefinedOutput extends Output>(check: (arg: Output) => arg is RefinedOutput, refinementData: IssueData | ((arg: Output, ctx: RefinementCtx) => IssueData)): YatspEffects<this, RefinedOutput, Input>;
|
|
74
|
+
refinement(check: (arg: Output) => boolean, refinementData: IssueData | ((arg: Output, ctx: RefinementCtx) => IssueData)): YatspEffects<this, Output, Input>;
|
|
75
|
+
_refinement(refinement: RefinementEffect<Output>["refinement"]): YatspEffects<this, Output, Input>;
|
|
76
|
+
superRefine<RefinedOutput extends Output>(refinement: (arg: Output, ctx: RefinementCtx) => arg is RefinedOutput): YatspEffects<this, RefinedOutput, Input>;
|
|
77
|
+
superRefine(refinement: (arg: Output, ctx: RefinementCtx) => void): YatspEffects<this, Output, Input>;
|
|
78
|
+
superRefine(refinement: (arg: Output, ctx: RefinementCtx) => Promise<void>): YatspEffects<this, Output, Input>;
|
|
79
|
+
constructor(def: Def);
|
|
80
|
+
optional(): YatspOptional<this>;
|
|
81
|
+
nullable(): YatspNullable<this>;
|
|
82
|
+
nullish(): YatspOptional<YatspNullable<this>>;
|
|
83
|
+
array(): YatspArray<this>;
|
|
84
|
+
promise(): YatspPromise<this>;
|
|
85
|
+
or<T extends YatspTypeAny>(option: T): YatspUnion<[this, T]>;
|
|
86
|
+
and<T extends YatspTypeAny>(incoming: T): YatspIntersection<this, T>;
|
|
87
|
+
transform<NewOut>(transform: (arg: Output, ctx: RefinementCtx) => NewOut | Promise<NewOut>): YatspEffects<this, NewOut>;
|
|
88
|
+
default(def: util.noUndefined<Input>): YatspDefault<this>;
|
|
89
|
+
default(def: () => util.noUndefined<Input>): YatspDefault<this>;
|
|
90
|
+
brand<B extends string | number | symbol>(brand?: B): YatspBranded<this, B>;
|
|
91
|
+
catch(def: Output): YatspCatch<this>;
|
|
92
|
+
catch(def: (ctx: {
|
|
93
|
+
error: YatspError;
|
|
94
|
+
input: Input;
|
|
95
|
+
}) => Output): YatspCatch<this>;
|
|
96
|
+
describe(description: string): this;
|
|
97
|
+
pipe<T extends YatspTypeAny>(target: T): YatspPipeline<this, T>;
|
|
98
|
+
readonly(): YatspReadonly<this>;
|
|
99
|
+
isOptional(): boolean;
|
|
100
|
+
isNullable(): boolean;
|
|
101
|
+
}
|
|
102
|
+
export type IpVersion = "v4" | "v6";
|
|
103
|
+
export type YatspStringCheck = {
|
|
104
|
+
kind: "min";
|
|
105
|
+
value: number;
|
|
106
|
+
message?: string | undefined;
|
|
107
|
+
} | {
|
|
108
|
+
kind: "max";
|
|
109
|
+
value: number;
|
|
110
|
+
message?: string | undefined;
|
|
111
|
+
} | {
|
|
112
|
+
kind: "length";
|
|
113
|
+
value: number;
|
|
114
|
+
message?: string | undefined;
|
|
115
|
+
} | {
|
|
116
|
+
kind: "email";
|
|
117
|
+
message?: string | undefined;
|
|
118
|
+
} | {
|
|
119
|
+
kind: "url";
|
|
120
|
+
message?: string | undefined;
|
|
121
|
+
} | {
|
|
122
|
+
kind: "emoji";
|
|
123
|
+
message?: string | undefined;
|
|
124
|
+
} | {
|
|
125
|
+
kind: "uuid";
|
|
126
|
+
message?: string | undefined;
|
|
127
|
+
} | {
|
|
128
|
+
kind: "nanoid";
|
|
129
|
+
message?: string | undefined;
|
|
130
|
+
} | {
|
|
131
|
+
kind: "cuid";
|
|
132
|
+
message?: string | undefined;
|
|
133
|
+
} | {
|
|
134
|
+
kind: "includes";
|
|
135
|
+
value: string;
|
|
136
|
+
position?: number | undefined;
|
|
137
|
+
message?: string | undefined;
|
|
138
|
+
} | {
|
|
139
|
+
kind: "cuid2";
|
|
140
|
+
message?: string | undefined;
|
|
141
|
+
} | {
|
|
142
|
+
kind: "ulid";
|
|
143
|
+
message?: string | undefined;
|
|
144
|
+
} | {
|
|
145
|
+
kind: "startsWith";
|
|
146
|
+
value: string;
|
|
147
|
+
message?: string | undefined;
|
|
148
|
+
} | {
|
|
149
|
+
kind: "endsWith";
|
|
150
|
+
value: string;
|
|
151
|
+
message?: string | undefined;
|
|
152
|
+
} | {
|
|
153
|
+
kind: "regex";
|
|
154
|
+
regex: RegExp;
|
|
155
|
+
message?: string | undefined;
|
|
156
|
+
} | {
|
|
157
|
+
kind: "trim";
|
|
158
|
+
message?: string | undefined;
|
|
159
|
+
} | {
|
|
160
|
+
kind: "toLowerCase";
|
|
161
|
+
message?: string | undefined;
|
|
162
|
+
} | {
|
|
163
|
+
kind: "toUpperCase";
|
|
164
|
+
message?: string | undefined;
|
|
165
|
+
} | {
|
|
166
|
+
kind: "jwt";
|
|
167
|
+
alg?: string;
|
|
168
|
+
message?: string | undefined;
|
|
169
|
+
} | {
|
|
170
|
+
kind: "datetime";
|
|
171
|
+
offset: boolean;
|
|
172
|
+
local: boolean;
|
|
173
|
+
precision: number | null;
|
|
174
|
+
message?: string | undefined;
|
|
175
|
+
} | {
|
|
176
|
+
kind: "date";
|
|
177
|
+
message?: string | undefined;
|
|
178
|
+
} | {
|
|
179
|
+
kind: "time";
|
|
180
|
+
precision: number | null;
|
|
181
|
+
message?: string | undefined;
|
|
182
|
+
} | {
|
|
183
|
+
kind: "duration";
|
|
184
|
+
message?: string | undefined;
|
|
185
|
+
} | {
|
|
186
|
+
kind: "ip";
|
|
187
|
+
version?: IpVersion | undefined;
|
|
188
|
+
message?: string | undefined;
|
|
189
|
+
} | {
|
|
190
|
+
kind: "cidr";
|
|
191
|
+
version?: IpVersion | undefined;
|
|
192
|
+
message?: string | undefined;
|
|
193
|
+
} | {
|
|
194
|
+
kind: "base64";
|
|
195
|
+
message?: string | undefined;
|
|
196
|
+
} | {
|
|
197
|
+
kind: "base64url";
|
|
198
|
+
message?: string | undefined;
|
|
199
|
+
};
|
|
200
|
+
export interface YatspStringDef extends YatspTypeDef {
|
|
201
|
+
checks: YatspStringCheck[];
|
|
202
|
+
typeName: YatspFirstPartyTypeKind.YatspString;
|
|
203
|
+
coerce: boolean;
|
|
204
|
+
}
|
|
205
|
+
export declare function datetimeRegex(args: {
|
|
206
|
+
precision?: number | null;
|
|
207
|
+
offset?: boolean;
|
|
208
|
+
local?: boolean;
|
|
209
|
+
}): RegExp;
|
|
210
|
+
export declare class YatspString extends YatspType<string, YatspStringDef, string> {
|
|
211
|
+
_parse(input: ParseInput): ParseReturnType<string>;
|
|
212
|
+
protected _regex(regex: RegExp, validation: StringValidation, message?: errorUtil.ErrMessage): YatspEffects<this, string, string>;
|
|
213
|
+
_addCheck(check: YatspStringCheck): YatspString;
|
|
214
|
+
email(message?: errorUtil.ErrMessage): YatspString;
|
|
215
|
+
url(message?: errorUtil.ErrMessage): YatspString;
|
|
216
|
+
emoji(message?: errorUtil.ErrMessage): YatspString;
|
|
217
|
+
uuid(message?: errorUtil.ErrMessage): YatspString;
|
|
218
|
+
nanoid(message?: errorUtil.ErrMessage): YatspString;
|
|
219
|
+
cuid(message?: errorUtil.ErrMessage): YatspString;
|
|
220
|
+
cuid2(message?: errorUtil.ErrMessage): YatspString;
|
|
221
|
+
ulid(message?: errorUtil.ErrMessage): YatspString;
|
|
222
|
+
base64(message?: errorUtil.ErrMessage): YatspString;
|
|
223
|
+
base64url(message?: errorUtil.ErrMessage): YatspString;
|
|
224
|
+
jwt(options?: {
|
|
225
|
+
alg?: string;
|
|
226
|
+
message?: string | undefined;
|
|
227
|
+
}): YatspString;
|
|
228
|
+
ip(options?: string | {
|
|
229
|
+
version?: IpVersion;
|
|
230
|
+
message?: string | undefined;
|
|
231
|
+
}): YatspString;
|
|
232
|
+
cidr(options?: string | {
|
|
233
|
+
version?: IpVersion;
|
|
234
|
+
message?: string | undefined;
|
|
235
|
+
}): YatspString;
|
|
236
|
+
datetime(options?: string | {
|
|
237
|
+
message?: string | undefined;
|
|
238
|
+
precision?: number | null;
|
|
239
|
+
offset?: boolean;
|
|
240
|
+
local?: boolean;
|
|
241
|
+
}): YatspString;
|
|
242
|
+
date(message?: string): YatspString;
|
|
243
|
+
time(options?: string | {
|
|
244
|
+
message?: string | undefined;
|
|
245
|
+
precision?: number | null;
|
|
246
|
+
}): YatspString;
|
|
247
|
+
duration(message?: errorUtil.ErrMessage): YatspString;
|
|
248
|
+
regex(regex: RegExp, message?: errorUtil.ErrMessage): YatspString;
|
|
249
|
+
includes(value: string, options?: {
|
|
250
|
+
message?: string;
|
|
251
|
+
position?: number;
|
|
252
|
+
}): YatspString;
|
|
253
|
+
startsWith(value: string, message?: errorUtil.ErrMessage): YatspString;
|
|
254
|
+
endsWith(value: string, message?: errorUtil.ErrMessage): YatspString;
|
|
255
|
+
min(minLength: number, message?: errorUtil.ErrMessage): YatspString;
|
|
256
|
+
max(maxLength: number, message?: errorUtil.ErrMessage): YatspString;
|
|
257
|
+
length(len: number, message?: errorUtil.ErrMessage): YatspString;
|
|
258
|
+
/**
|
|
259
|
+
* Equivalent to `.min(1)`
|
|
260
|
+
*/
|
|
261
|
+
nonempty(message?: errorUtil.ErrMessage): YatspString;
|
|
262
|
+
trim(): YatspString;
|
|
263
|
+
toLowerCase(): YatspString;
|
|
264
|
+
toUpperCase(): YatspString;
|
|
265
|
+
get isDatetime(): boolean;
|
|
266
|
+
get isDate(): boolean;
|
|
267
|
+
get isTime(): boolean;
|
|
268
|
+
get isDuration(): boolean;
|
|
269
|
+
get isEmail(): boolean;
|
|
270
|
+
get isURL(): boolean;
|
|
271
|
+
get isEmoji(): boolean;
|
|
272
|
+
get isUUID(): boolean;
|
|
273
|
+
get isNANOID(): boolean;
|
|
274
|
+
get isCUID(): boolean;
|
|
275
|
+
get isCUID2(): boolean;
|
|
276
|
+
get isULID(): boolean;
|
|
277
|
+
get isIP(): boolean;
|
|
278
|
+
get isCIDR(): boolean;
|
|
279
|
+
get isBase64(): boolean;
|
|
280
|
+
get isBase64url(): boolean;
|
|
281
|
+
get minLength(): number | null;
|
|
282
|
+
get maxLength(): number | null;
|
|
283
|
+
static create: (params?: RawCreateParams & {
|
|
284
|
+
coerce?: true;
|
|
285
|
+
}) => YatspString;
|
|
286
|
+
}
|
|
287
|
+
export type YatspNumberCheck = {
|
|
288
|
+
kind: "min";
|
|
289
|
+
value: number;
|
|
290
|
+
inclusive: boolean;
|
|
291
|
+
message?: string | undefined;
|
|
292
|
+
} | {
|
|
293
|
+
kind: "max";
|
|
294
|
+
value: number;
|
|
295
|
+
inclusive: boolean;
|
|
296
|
+
message?: string | undefined;
|
|
297
|
+
} | {
|
|
298
|
+
kind: "int";
|
|
299
|
+
message?: string | undefined;
|
|
300
|
+
} | {
|
|
301
|
+
kind: "multipleOf";
|
|
302
|
+
value: number;
|
|
303
|
+
message?: string | undefined;
|
|
304
|
+
} | {
|
|
305
|
+
kind: "finite";
|
|
306
|
+
message?: string | undefined;
|
|
307
|
+
};
|
|
308
|
+
export interface YatspNumberDef extends YatspTypeDef {
|
|
309
|
+
checks: YatspNumberCheck[];
|
|
310
|
+
typeName: YatspFirstPartyTypeKind.YatspNumber;
|
|
311
|
+
coerce: boolean;
|
|
312
|
+
}
|
|
313
|
+
export declare class YatspNumber extends YatspType<number, YatspNumberDef, number> {
|
|
314
|
+
_parse(input: ParseInput): ParseReturnType<number>;
|
|
315
|
+
static create: (params?: RawCreateParams & {
|
|
316
|
+
coerce?: boolean;
|
|
317
|
+
}) => YatspNumber;
|
|
318
|
+
gte(value: number, message?: errorUtil.ErrMessage): YatspNumber;
|
|
319
|
+
min: (value: number, message?: errorUtil.ErrMessage) => YatspNumber;
|
|
320
|
+
gt(value: number, message?: errorUtil.ErrMessage): YatspNumber;
|
|
321
|
+
lte(value: number, message?: errorUtil.ErrMessage): YatspNumber;
|
|
322
|
+
max: (value: number, message?: errorUtil.ErrMessage) => YatspNumber;
|
|
323
|
+
lt(value: number, message?: errorUtil.ErrMessage): YatspNumber;
|
|
324
|
+
protected setLimit(kind: "min" | "max", value: number, inclusive: boolean, message?: string): YatspNumber;
|
|
325
|
+
_addCheck(check: YatspNumberCheck): YatspNumber;
|
|
326
|
+
int(message?: errorUtil.ErrMessage): YatspNumber;
|
|
327
|
+
positive(message?: errorUtil.ErrMessage): YatspNumber;
|
|
328
|
+
negative(message?: errorUtil.ErrMessage): YatspNumber;
|
|
329
|
+
nonpositive(message?: errorUtil.ErrMessage): YatspNumber;
|
|
330
|
+
nonnegative(message?: errorUtil.ErrMessage): YatspNumber;
|
|
331
|
+
multipleOf(value: number, message?: errorUtil.ErrMessage): YatspNumber;
|
|
332
|
+
step: (value: number, message?: errorUtil.ErrMessage) => YatspNumber;
|
|
333
|
+
finite(message?: errorUtil.ErrMessage): YatspNumber;
|
|
334
|
+
safe(message?: errorUtil.ErrMessage): YatspNumber;
|
|
335
|
+
get minValue(): number | null;
|
|
336
|
+
get maxValue(): number | null;
|
|
337
|
+
get isInt(): boolean;
|
|
338
|
+
get isFinite(): boolean;
|
|
339
|
+
}
|
|
340
|
+
export type YatspBigIntCheck = {
|
|
341
|
+
kind: "min";
|
|
342
|
+
value: bigint;
|
|
343
|
+
inclusive: boolean;
|
|
344
|
+
message?: string | undefined;
|
|
345
|
+
} | {
|
|
346
|
+
kind: "max";
|
|
347
|
+
value: bigint;
|
|
348
|
+
inclusive: boolean;
|
|
349
|
+
message?: string | undefined;
|
|
350
|
+
} | {
|
|
351
|
+
kind: "multipleOf";
|
|
352
|
+
value: bigint;
|
|
353
|
+
message?: string | undefined;
|
|
354
|
+
};
|
|
355
|
+
export interface YatspBigIntDef extends YatspTypeDef {
|
|
356
|
+
checks: YatspBigIntCheck[];
|
|
357
|
+
typeName: YatspFirstPartyTypeKind.YatspBigInt;
|
|
358
|
+
coerce: boolean;
|
|
359
|
+
}
|
|
360
|
+
export declare class YatspBigInt extends YatspType<bigint, YatspBigIntDef, bigint> {
|
|
361
|
+
_parse(input: ParseInput): ParseReturnType<bigint>;
|
|
362
|
+
_getInvalidInput(input: ParseInput): INVALID;
|
|
363
|
+
static create: (params?: RawCreateParams & {
|
|
364
|
+
coerce?: boolean;
|
|
365
|
+
}) => YatspBigInt;
|
|
366
|
+
gte(value: bigint, message?: errorUtil.ErrMessage): YatspBigInt;
|
|
367
|
+
min: (value: bigint, message?: errorUtil.ErrMessage) => YatspBigInt;
|
|
368
|
+
gt(value: bigint, message?: errorUtil.ErrMessage): YatspBigInt;
|
|
369
|
+
lte(value: bigint, message?: errorUtil.ErrMessage): YatspBigInt;
|
|
370
|
+
max: (value: bigint, message?: errorUtil.ErrMessage) => YatspBigInt;
|
|
371
|
+
lt(value: bigint, message?: errorUtil.ErrMessage): YatspBigInt;
|
|
372
|
+
protected setLimit(kind: "min" | "max", value: bigint, inclusive: boolean, message?: string): YatspBigInt;
|
|
373
|
+
_addCheck(check: YatspBigIntCheck): YatspBigInt;
|
|
374
|
+
positive(message?: errorUtil.ErrMessage): YatspBigInt;
|
|
375
|
+
negative(message?: errorUtil.ErrMessage): YatspBigInt;
|
|
376
|
+
nonpositive(message?: errorUtil.ErrMessage): YatspBigInt;
|
|
377
|
+
nonnegative(message?: errorUtil.ErrMessage): YatspBigInt;
|
|
378
|
+
multipleOf(value: bigint, message?: errorUtil.ErrMessage): YatspBigInt;
|
|
379
|
+
get minValue(): bigint | null;
|
|
380
|
+
get maxValue(): bigint | null;
|
|
381
|
+
}
|
|
382
|
+
export interface YatspBooleanDef extends YatspTypeDef {
|
|
383
|
+
typeName: YatspFirstPartyTypeKind.YatspBoolean;
|
|
384
|
+
coerce: boolean;
|
|
385
|
+
}
|
|
386
|
+
export declare class YatspBoolean extends YatspType<boolean, YatspBooleanDef, boolean> {
|
|
387
|
+
_parse(input: ParseInput): ParseReturnType<boolean>;
|
|
388
|
+
static create: (params?: RawCreateParams & {
|
|
389
|
+
coerce?: boolean;
|
|
390
|
+
}) => YatspBoolean;
|
|
391
|
+
}
|
|
392
|
+
export type YatspDateCheck = {
|
|
393
|
+
kind: "min";
|
|
394
|
+
value: number;
|
|
395
|
+
message?: string | undefined;
|
|
396
|
+
} | {
|
|
397
|
+
kind: "max";
|
|
398
|
+
value: number;
|
|
399
|
+
message?: string | undefined;
|
|
400
|
+
};
|
|
401
|
+
export interface YatspDateDef extends YatspTypeDef {
|
|
402
|
+
checks: YatspDateCheck[];
|
|
403
|
+
coerce: boolean;
|
|
404
|
+
typeName: YatspFirstPartyTypeKind.YatspDate;
|
|
405
|
+
}
|
|
406
|
+
export declare class YatspDate extends YatspType<Date, YatspDateDef, Date> {
|
|
407
|
+
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
408
|
+
_addCheck(check: YatspDateCheck): YatspDate;
|
|
409
|
+
min(minDate: Date, message?: errorUtil.ErrMessage): YatspDate;
|
|
410
|
+
max(maxDate: Date, message?: errorUtil.ErrMessage): YatspDate;
|
|
411
|
+
get minDate(): Date | null;
|
|
412
|
+
get maxDate(): Date | null;
|
|
413
|
+
static create: (params?: RawCreateParams & {
|
|
414
|
+
coerce?: boolean;
|
|
415
|
+
}) => YatspDate;
|
|
416
|
+
}
|
|
417
|
+
export interface YatspSymbolDef extends YatspTypeDef {
|
|
418
|
+
typeName: YatspFirstPartyTypeKind.YatspSymbol;
|
|
419
|
+
}
|
|
420
|
+
export declare class YatspSymbol extends YatspType<symbol, YatspSymbolDef, symbol> {
|
|
421
|
+
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
422
|
+
static create: (params?: RawCreateParams) => YatspSymbol;
|
|
423
|
+
}
|
|
424
|
+
export interface YatspUndefinedDef extends YatspTypeDef {
|
|
425
|
+
typeName: YatspFirstPartyTypeKind.YatspUndefined;
|
|
426
|
+
}
|
|
427
|
+
export declare class YatspUndefined extends YatspType<undefined, YatspUndefinedDef, undefined> {
|
|
428
|
+
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
429
|
+
params?: RawCreateParams;
|
|
430
|
+
static create: (params?: RawCreateParams) => YatspUndefined;
|
|
431
|
+
}
|
|
432
|
+
export interface YatspNullDef extends YatspTypeDef {
|
|
433
|
+
typeName: YatspFirstPartyTypeKind.YatspNull;
|
|
434
|
+
}
|
|
435
|
+
export declare class YatspNull extends YatspType<null, YatspNullDef, null> {
|
|
436
|
+
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
437
|
+
static create: (params?: RawCreateParams) => YatspNull;
|
|
438
|
+
}
|
|
439
|
+
export interface YatspAnyDef extends YatspTypeDef {
|
|
440
|
+
typeName: YatspFirstPartyTypeKind.YatspAny;
|
|
441
|
+
}
|
|
442
|
+
export declare class YatspAny extends YatspType<any, YatspAnyDef, any> {
|
|
443
|
+
_any: true;
|
|
444
|
+
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
445
|
+
static create: (params?: RawCreateParams) => YatspAny;
|
|
446
|
+
}
|
|
447
|
+
export interface YatspUnknownDef extends YatspTypeDef {
|
|
448
|
+
typeName: YatspFirstPartyTypeKind.YatspUnknown;
|
|
449
|
+
}
|
|
450
|
+
export declare class YatspUnknown extends YatspType<unknown, YatspUnknownDef, unknown> {
|
|
451
|
+
_unknown: true;
|
|
452
|
+
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
453
|
+
static create: (params?: RawCreateParams) => YatspUnknown;
|
|
454
|
+
}
|
|
455
|
+
export interface YatspNeverDef extends YatspTypeDef {
|
|
456
|
+
typeName: YatspFirstPartyTypeKind.YatspNever;
|
|
457
|
+
}
|
|
458
|
+
export declare class YatspNever extends YatspType<never, YatspNeverDef, never> {
|
|
459
|
+
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
460
|
+
static create: (params?: RawCreateParams) => YatspNever;
|
|
461
|
+
}
|
|
462
|
+
export interface YatspVoidDef extends YatspTypeDef {
|
|
463
|
+
typeName: YatspFirstPartyTypeKind.YatspVoid;
|
|
464
|
+
}
|
|
465
|
+
export declare class YatspVoid extends YatspType<void, YatspVoidDef, void> {
|
|
466
|
+
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
467
|
+
static create: (params?: RawCreateParams) => YatspVoid;
|
|
468
|
+
}
|
|
469
|
+
export interface YatspArrayDef<T extends YatspTypeAny = YatspTypeAny> extends YatspTypeDef {
|
|
470
|
+
type: T;
|
|
471
|
+
typeName: YatspFirstPartyTypeKind.YatspArray;
|
|
472
|
+
exactLength: {
|
|
473
|
+
value: number;
|
|
474
|
+
message?: string | undefined;
|
|
475
|
+
} | null;
|
|
476
|
+
minLength: {
|
|
477
|
+
value: number;
|
|
478
|
+
message?: string | undefined;
|
|
479
|
+
} | null;
|
|
480
|
+
maxLength: {
|
|
481
|
+
value: number;
|
|
482
|
+
message?: string | undefined;
|
|
483
|
+
} | null;
|
|
484
|
+
}
|
|
485
|
+
export type ArrayCardinality = "many" | "atleastone";
|
|
486
|
+
export type arrayOutputType<T extends YatspTypeAny, Cardinality extends ArrayCardinality = "many"> = Cardinality extends "atleastone" ? [T["_output"], ...T["_output"][]] : T["_output"][];
|
|
487
|
+
export declare class YatspArray<T extends YatspTypeAny, Cardinality extends ArrayCardinality = "many"> extends YatspType<arrayOutputType<T, Cardinality>, YatspArrayDef<T>, Cardinality extends "atleastone" ? [T["_input"], ...T["_input"][]] : T["_input"][]> {
|
|
488
|
+
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
489
|
+
get element(): T;
|
|
490
|
+
min(minLength: number, message?: errorUtil.ErrMessage): this;
|
|
491
|
+
max(maxLength: number, message?: errorUtil.ErrMessage): this;
|
|
492
|
+
length(len: number, message?: errorUtil.ErrMessage): this;
|
|
493
|
+
nonempty(message?: errorUtil.ErrMessage): YatspArray<T, "atleastone">;
|
|
494
|
+
static create: <El extends YatspTypeAny>(schema: El, params?: RawCreateParams) => YatspArray<El>;
|
|
495
|
+
}
|
|
496
|
+
export type YatspNonEmptyArray<T extends YatspTypeAny> = YatspArray<T, "atleastone">;
|
|
497
|
+
export type UnknownKeysParam = "passthrough" | "strict" | "strip";
|
|
498
|
+
export interface YatspObjectDef<T extends YatspRawShape = YatspRawShape, UnknownKeys extends UnknownKeysParam = UnknownKeysParam, Catchall extends YatspTypeAny = YatspTypeAny> extends YatspTypeDef {
|
|
499
|
+
typeName: YatspFirstPartyTypeKind.YatspObject;
|
|
500
|
+
shape: () => T;
|
|
501
|
+
catchall: Catchall;
|
|
502
|
+
unknownKeys: UnknownKeys;
|
|
503
|
+
}
|
|
504
|
+
export type mergeTypes<A, B> = {
|
|
505
|
+
[k in keyof A | keyof B]: k extends keyof B ? B[k] : k extends keyof A ? A[k] : never;
|
|
506
|
+
};
|
|
507
|
+
export type objectOutputType<Shape extends YatspRawShape, Catchall extends YatspTypeAny, UnknownKeys extends UnknownKeysParam = UnknownKeysParam> = objectUtil.flatten<objectUtil.addQuestionMarks<baseObjectOutputType<Shape>>> & CatchallOutput<Catchall> & PassthroughType<UnknownKeys>;
|
|
508
|
+
export type baseObjectOutputType<Shape extends YatspRawShape> = {
|
|
509
|
+
[k in keyof Shape]: Shape[k]["_output"];
|
|
510
|
+
};
|
|
511
|
+
export type objectInputType<Shape extends YatspRawShape, Catchall extends YatspTypeAny, UnknownKeys extends UnknownKeysParam = UnknownKeysParam> = objectUtil.flatten<baseObjectInputType<Shape>> & CatchallInput<Catchall> & PassthroughType<UnknownKeys>;
|
|
512
|
+
export type baseObjectInputType<Shape extends YatspRawShape> = objectUtil.addQuestionMarks<{
|
|
513
|
+
[k in keyof Shape]: Shape[k]["_input"];
|
|
514
|
+
}>;
|
|
515
|
+
export type CatchallOutput<T extends YatspType> = YatspType extends T ? unknown : {
|
|
516
|
+
[k: string]: T["_output"];
|
|
517
|
+
};
|
|
518
|
+
export type CatchallInput<T extends YatspType> = YatspType extends T ? unknown : {
|
|
519
|
+
[k: string]: T["_input"];
|
|
520
|
+
};
|
|
521
|
+
export type PassthroughType<T extends UnknownKeysParam> = T extends "passthrough" ? {
|
|
522
|
+
[k: string]: unknown;
|
|
523
|
+
} : unknown;
|
|
524
|
+
export type deoptional<T extends YatspTypeAny> = T extends YatspOptional<infer U> ? deoptional<U> : T extends YatspNullable<infer U> ? YatspNullable<deoptional<U>> : T;
|
|
525
|
+
export type SomeYatspObject = YatspObject<YatspRawShape, UnknownKeysParam, YatspTypeAny>;
|
|
526
|
+
export type noUnrecognized<Obj extends object, Shape extends object> = {
|
|
527
|
+
[k in keyof Obj]: k extends keyof Shape ? Obj[k] : never;
|
|
528
|
+
};
|
|
529
|
+
export declare class YatspObject<T extends YatspRawShape, UnknownKeys extends UnknownKeysParam = UnknownKeysParam, Catchall extends YatspTypeAny = YatspTypeAny, Output = objectOutputType<T, Catchall, UnknownKeys>, Input = objectInputType<T, Catchall, UnknownKeys>> extends YatspType<Output, YatspObjectDef<T, UnknownKeys, Catchall>, Input> {
|
|
530
|
+
_cached: {
|
|
531
|
+
shape: T;
|
|
532
|
+
keys: string[];
|
|
533
|
+
} | null;
|
|
534
|
+
_getCached(): {
|
|
535
|
+
shape: T;
|
|
536
|
+
keys: string[];
|
|
537
|
+
};
|
|
538
|
+
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
539
|
+
get shape(): T;
|
|
540
|
+
strict(message?: errorUtil.ErrMessage): YatspObject<T, "strict", Catchall>;
|
|
541
|
+
strip(): YatspObject<T, "strip", Catchall>;
|
|
542
|
+
passthrough(): YatspObject<T, "passthrough", Catchall>;
|
|
543
|
+
/**
|
|
544
|
+
* @deprecated In most cases, this is no longer needed - unknown properties are now silently stripped.
|
|
545
|
+
* If you want to pass through unknown properties, use `.passthrough()` instead.
|
|
546
|
+
*/
|
|
547
|
+
nonstrict: () => YatspObject<T, "passthrough", Catchall>;
|
|
548
|
+
extend<Augmentation extends YatspRawShape>(augmentation: Augmentation): YatspObject<objectUtil.extendShape<T, Augmentation>, UnknownKeys, Catchall>;
|
|
549
|
+
/**
|
|
550
|
+
* @deprecated Use `.extend` instead
|
|
551
|
+
* */
|
|
552
|
+
augment: <Augmentation extends YatspRawShape>(augmentation: Augmentation) => YatspObject<objectUtil.extendShape<T, Augmentation>, UnknownKeys, Catchall>;
|
|
553
|
+
/**
|
|
554
|
+
* Prior to yatsp@1.0.12 there was a bug in the
|
|
555
|
+
* inferred type of merged objects. Please
|
|
556
|
+
* upgrade if you are experiencing issues.
|
|
557
|
+
*/
|
|
558
|
+
merge<Incoming extends AnyYatspObject, Augmentation extends Incoming["shape"]>(merging: Incoming): YatspObject<objectUtil.extendShape<T, Augmentation>, Incoming["_def"]["unknownKeys"], Incoming["_def"]["catchall"]>;
|
|
559
|
+
setKey<Key extends string, Schema extends YatspTypeAny>(key: Key, schema: Schema): YatspObject<T & {
|
|
560
|
+
[k in Key]: Schema;
|
|
561
|
+
}, UnknownKeys, Catchall>;
|
|
562
|
+
catchall<Index extends YatspTypeAny>(index: Index): YatspObject<T, UnknownKeys, Index>;
|
|
563
|
+
pick<Mask extends util.Exactly<{
|
|
564
|
+
[k in keyof T]?: true;
|
|
565
|
+
}, Mask>>(mask: Mask): YatspObject<Pick<T, Extract<keyof T, keyof Mask>>, UnknownKeys, Catchall>;
|
|
566
|
+
omit<Mask extends util.Exactly<{
|
|
567
|
+
[k in keyof T]?: true;
|
|
568
|
+
}, Mask>>(mask: Mask): YatspObject<Omit<T, keyof Mask>, UnknownKeys, Catchall>;
|
|
569
|
+
/**
|
|
570
|
+
* @deprecated
|
|
571
|
+
*/
|
|
572
|
+
deepPartial(): partialUtil.DeepPartial<this>;
|
|
573
|
+
partial(): YatspObject<{
|
|
574
|
+
[k in keyof T]: YatspOptional<T[k]>;
|
|
575
|
+
}, UnknownKeys, Catchall>;
|
|
576
|
+
partial<Mask extends util.Exactly<{
|
|
577
|
+
[k in keyof T]?: true;
|
|
578
|
+
}, Mask>>(mask: Mask): YatspObject<objectUtil.noNever<{
|
|
579
|
+
[k in keyof T]: k extends keyof Mask ? YatspOptional<T[k]> : T[k];
|
|
580
|
+
}>, UnknownKeys, Catchall>;
|
|
581
|
+
required(): YatspObject<{
|
|
582
|
+
[k in keyof T]: deoptional<T[k]>;
|
|
583
|
+
}, UnknownKeys, Catchall>;
|
|
584
|
+
required<Mask extends util.Exactly<{
|
|
585
|
+
[k in keyof T]?: true;
|
|
586
|
+
}, Mask>>(mask: Mask): YatspObject<objectUtil.noNever<{
|
|
587
|
+
[k in keyof T]: k extends keyof Mask ? deoptional<T[k]> : T[k];
|
|
588
|
+
}>, UnknownKeys, Catchall>;
|
|
589
|
+
keyof(): YatspEnum<enumUtil.UnionToTupleString<keyof T>>;
|
|
590
|
+
static create: <Shape extends YatspRawShape>(shape: Shape, params?: RawCreateParams) => YatspObject<Shape, "strip", YatspTypeAny, objectOutputType<Shape, YatspTypeAny, "strip">, objectInputType<Shape, YatspTypeAny, "strip">>;
|
|
591
|
+
static strictCreate: <Shape extends YatspRawShape>(shape: Shape, params?: RawCreateParams) => YatspObject<Shape, "strict">;
|
|
592
|
+
static lazycreate: <Shape extends YatspRawShape>(shape: () => Shape, params?: RawCreateParams) => YatspObject<Shape, "strip">;
|
|
593
|
+
}
|
|
594
|
+
export type AnyYatspObject = YatspObject<any, any, any>;
|
|
595
|
+
export type YatspUnionOptions = Readonly<[YatspTypeAny, ...YatspTypeAny[]]>;
|
|
596
|
+
export interface YatspUnionDef<T extends YatspUnionOptions = Readonly<[YatspTypeAny, YatspTypeAny, ...YatspTypeAny[]]>> extends YatspTypeDef {
|
|
597
|
+
options: T;
|
|
598
|
+
typeName: YatspFirstPartyTypeKind.YatspUnion;
|
|
599
|
+
}
|
|
600
|
+
export declare class YatspUnion<T extends YatspUnionOptions> extends YatspType<T[number]["_output"], YatspUnionDef<T>, T[number]["_input"]> {
|
|
601
|
+
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
602
|
+
get options(): T;
|
|
603
|
+
static create: <Options extends Readonly<[YatspTypeAny, YatspTypeAny, ...YatspTypeAny[]]>>(types: Options, params?: RawCreateParams) => YatspUnion<Options>;
|
|
604
|
+
}
|
|
605
|
+
export type YatspDiscriminatedUnionOption<Discriminator extends string> = YatspObject<{
|
|
606
|
+
[key in Discriminator]: YatspTypeAny;
|
|
607
|
+
} & YatspRawShape, UnknownKeysParam, YatspTypeAny>;
|
|
608
|
+
export interface YatspDiscriminatedUnionDef<Discriminator extends string, Options extends readonly YatspDiscriminatedUnionOption<string>[] = YatspDiscriminatedUnionOption<string>[]> extends YatspTypeDef {
|
|
609
|
+
discriminator: Discriminator;
|
|
610
|
+
options: Options;
|
|
611
|
+
optionsMap: Map<Primitive, YatspDiscriminatedUnionOption<any>>;
|
|
612
|
+
typeName: YatspFirstPartyTypeKind.YatspDiscriminatedUnion;
|
|
613
|
+
}
|
|
614
|
+
export declare class YatspDiscriminatedUnion<Discriminator extends string, Options extends readonly YatspDiscriminatedUnionOption<Discriminator>[]> extends YatspType<output<Options[number]>, YatspDiscriminatedUnionDef<Discriminator, Options>, input<Options[number]>> {
|
|
615
|
+
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
616
|
+
get discriminator(): Discriminator;
|
|
617
|
+
get options(): Options;
|
|
618
|
+
get optionsMap(): Map<Primitive, YatspDiscriminatedUnionOption<any>>;
|
|
619
|
+
/**
|
|
620
|
+
* The constructor of the discriminated union schema. Its behaviour is very similar to that of the normal z.union() constructor.
|
|
621
|
+
* However, it only allows a union of objects, all of which need to share a discriminator property. This property must
|
|
622
|
+
* have a different value for each object in the union.
|
|
623
|
+
* @param discriminator the name of the discriminator property
|
|
624
|
+
* @param types an array of object schemas
|
|
625
|
+
* @param params
|
|
626
|
+
*/
|
|
627
|
+
static create<Discriminator extends string, Types extends readonly [
|
|
628
|
+
YatspDiscriminatedUnionOption<Discriminator>,
|
|
629
|
+
...YatspDiscriminatedUnionOption<Discriminator>[]
|
|
630
|
+
]>(discriminator: Discriminator, options: Types, params?: RawCreateParams): YatspDiscriminatedUnion<Discriminator, Types>;
|
|
631
|
+
}
|
|
632
|
+
export interface YatspIntersectionDef<T extends YatspTypeAny = YatspTypeAny, U extends YatspTypeAny = YatspTypeAny> extends YatspTypeDef {
|
|
633
|
+
left: T;
|
|
634
|
+
right: U;
|
|
635
|
+
typeName: YatspFirstPartyTypeKind.YatspIntersection;
|
|
636
|
+
}
|
|
637
|
+
export declare class YatspIntersection<T extends YatspTypeAny, U extends YatspTypeAny> extends YatspType<T["_output"] & U["_output"], YatspIntersectionDef<T, U>, T["_input"] & U["_input"]> {
|
|
638
|
+
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
639
|
+
static create: <TSchema extends YatspTypeAny, USchema extends YatspTypeAny>(left: TSchema, right: USchema, params?: RawCreateParams) => YatspIntersection<TSchema, USchema>;
|
|
640
|
+
}
|
|
641
|
+
export type YatspTupleItems = [YatspTypeAny, ...YatspTypeAny[]];
|
|
642
|
+
export type AssertArray<T> = T extends any[] ? T : never;
|
|
643
|
+
export type OutputTypeOfTuple<T extends YatspTupleItems | []> = AssertArray<{
|
|
644
|
+
[k in keyof T]: T[k] extends YatspType<any, any, any> ? T[k]["_output"] : never;
|
|
645
|
+
}>;
|
|
646
|
+
export type OutputTypeOfTupleWithRest<T extends YatspTupleItems | [], Rest extends YatspTypeAny | null = null> = Rest extends YatspTypeAny ? [...OutputTypeOfTuple<T>, ...Rest["_output"][]] : OutputTypeOfTuple<T>;
|
|
647
|
+
export type InputTypeOfTuple<T extends YatspTupleItems | []> = AssertArray<{
|
|
648
|
+
[k in keyof T]: T[k] extends YatspType<any, any, any> ? T[k]["_input"] : never;
|
|
649
|
+
}>;
|
|
650
|
+
export type InputTypeOfTupleWithRest<T extends YatspTupleItems | [], Rest extends YatspTypeAny | null = null> = Rest extends YatspTypeAny ? [...InputTypeOfTuple<T>, ...Rest["_input"][]] : InputTypeOfTuple<T>;
|
|
651
|
+
export interface YatspTupleDef<T extends YatspTupleItems | [] = YatspTupleItems, Rest extends YatspTypeAny | null = null> extends YatspTypeDef {
|
|
652
|
+
items: T;
|
|
653
|
+
rest: Rest;
|
|
654
|
+
typeName: YatspFirstPartyTypeKind.YatspTuple;
|
|
655
|
+
}
|
|
656
|
+
export type AnyYatspTuple = YatspTuple<[YatspTypeAny, ...YatspTypeAny[]] | [], YatspTypeAny | null>;
|
|
657
|
+
export declare class YatspTuple<T extends YatspTupleItems | [] = YatspTupleItems, Rest extends YatspTypeAny | null = null> extends YatspType<OutputTypeOfTupleWithRest<T, Rest>, YatspTupleDef<T, Rest>, InputTypeOfTupleWithRest<T, Rest>> {
|
|
658
|
+
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
659
|
+
get items(): T;
|
|
660
|
+
rest<RestSchema extends YatspTypeAny>(rest: RestSchema): YatspTuple<T, RestSchema>;
|
|
661
|
+
static create: <Items extends [YatspTypeAny, ...YatspTypeAny[]] | []>(schemas: Items, params?: RawCreateParams) => YatspTuple<Items, null>;
|
|
662
|
+
}
|
|
663
|
+
export interface YatspRecordDef<Key extends KeySchema = YatspString, Value extends YatspTypeAny = YatspTypeAny> extends YatspTypeDef {
|
|
664
|
+
valueType: Value;
|
|
665
|
+
keyType: Key;
|
|
666
|
+
typeName: YatspFirstPartyTypeKind.YatspRecord;
|
|
667
|
+
}
|
|
668
|
+
export type KeySchema = YatspType<string | number | symbol, any, any>;
|
|
669
|
+
export type RecordType<K extends string | number | symbol, V> = [string] extends [K] ? Record<K, V> : [number] extends [K] ? Record<K, V> : [symbol] extends [K] ? Record<K, V> : [BRAND<string | number | symbol>] extends [K] ? Record<K, V> : Partial<Record<K, V>>;
|
|
670
|
+
export declare class YatspRecord<Key extends KeySchema = YatspString, Value extends YatspTypeAny = YatspTypeAny> extends YatspType<RecordType<Key["_output"], Value["_output"]>, YatspRecordDef<Key, Value>, RecordType<Key["_input"], Value["_input"]>> {
|
|
671
|
+
get keySchema(): Key;
|
|
672
|
+
get valueSchema(): Value;
|
|
673
|
+
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
674
|
+
get element(): Value;
|
|
675
|
+
static create<Value extends YatspTypeAny>(valueType: Value, params?: RawCreateParams): YatspRecord<YatspString, Value>;
|
|
676
|
+
static create<Keys extends KeySchema, Value extends YatspTypeAny>(keySchema: Keys, valueType: Value, params?: RawCreateParams): YatspRecord<Keys, Value>;
|
|
677
|
+
}
|
|
678
|
+
export interface YatspMapDef<Key extends YatspTypeAny = YatspTypeAny, Value extends YatspTypeAny = YatspTypeAny> extends YatspTypeDef {
|
|
679
|
+
valueType: Value;
|
|
680
|
+
keyType: Key;
|
|
681
|
+
typeName: YatspFirstPartyTypeKind.YatspMap;
|
|
682
|
+
}
|
|
683
|
+
export declare class YatspMap<Key extends YatspTypeAny = YatspTypeAny, Value extends YatspTypeAny = YatspTypeAny> extends YatspType<Map<Key["_output"], Value["_output"]>, YatspMapDef<Key, Value>, Map<Key["_input"], Value["_input"]>> {
|
|
684
|
+
get keySchema(): Key;
|
|
685
|
+
get valueSchema(): Value;
|
|
686
|
+
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
687
|
+
static create: <KeySchema extends YatspTypeAny = YatspTypeAny, ValueSchema extends YatspTypeAny = YatspTypeAny>(keyType: KeySchema, valueType: ValueSchema, params?: RawCreateParams) => YatspMap<KeySchema, ValueSchema>;
|
|
688
|
+
}
|
|
689
|
+
export interface YatspSetDef<Value extends YatspTypeAny = YatspTypeAny> extends YatspTypeDef {
|
|
690
|
+
valueType: Value;
|
|
691
|
+
typeName: YatspFirstPartyTypeKind.YatspSet;
|
|
692
|
+
minSize: {
|
|
693
|
+
value: number;
|
|
694
|
+
message?: string | undefined;
|
|
695
|
+
} | null;
|
|
696
|
+
maxSize: {
|
|
697
|
+
value: number;
|
|
698
|
+
message?: string | undefined;
|
|
699
|
+
} | null;
|
|
700
|
+
}
|
|
701
|
+
export declare class YatspSet<Value extends YatspTypeAny = YatspTypeAny> extends YatspType<Set<Value["_output"]>, YatspSetDef<Value>, Set<Value["_input"]>> {
|
|
702
|
+
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
703
|
+
min(minSize: number, message?: errorUtil.ErrMessage): this;
|
|
704
|
+
max(maxSize: number, message?: errorUtil.ErrMessage): this;
|
|
705
|
+
size(size: number, message?: errorUtil.ErrMessage): this;
|
|
706
|
+
nonempty(message?: errorUtil.ErrMessage): YatspSet<Value>;
|
|
707
|
+
static create: <ValueSchema extends YatspTypeAny = YatspTypeAny>(valueType: ValueSchema, params?: RawCreateParams) => YatspSet<ValueSchema>;
|
|
708
|
+
}
|
|
709
|
+
export interface YatspFunctionDef<Args extends YatspTuple<any, any> = YatspTuple<any, any>, Returns extends YatspTypeAny = YatspTypeAny> extends YatspTypeDef {
|
|
710
|
+
args: Args;
|
|
711
|
+
returns: Returns;
|
|
712
|
+
typeName: YatspFirstPartyTypeKind.YatspFunction;
|
|
713
|
+
}
|
|
714
|
+
export type OuterTypeOfFunction<Args extends YatspTuple<any, any>, Returns extends YatspTypeAny> = Args["_input"] extends Array<any> ? (...args: Args["_input"]) => Returns["_output"] : never;
|
|
715
|
+
export type InnerTypeOfFunction<Args extends YatspTuple<any, any>, Returns extends YatspTypeAny> = Args["_output"] extends Array<any> ? (...args: Args["_output"]) => Returns["_input"] : never;
|
|
716
|
+
export declare class YatspFunction<Args extends YatspTuple<any, any>, Returns extends YatspTypeAny> extends YatspType<OuterTypeOfFunction<Args, Returns>, YatspFunctionDef<Args, Returns>, InnerTypeOfFunction<Args, Returns>> {
|
|
717
|
+
_parse(input: ParseInput): ParseReturnType<any>;
|
|
718
|
+
parameters(): Args;
|
|
719
|
+
returnType(): Returns;
|
|
720
|
+
args<Items extends Parameters<(typeof YatspTuple)["create"]>[0]>(...items: Items): YatspFunction<YatspTuple<Items, YatspUnknown>, Returns>;
|
|
721
|
+
returns<NewReturnType extends YatspType<any, any, any>>(returnType: NewReturnType): YatspFunction<Args, NewReturnType>;
|
|
722
|
+
implement<F extends InnerTypeOfFunction<Args, Returns>>(func: F): ReturnType<F> extends Returns["_output"] ? (...args: Args["_input"]) => ReturnType<F> : OuterTypeOfFunction<Args, Returns>;
|
|
723
|
+
strictImplement(func: InnerTypeOfFunction<Args, Returns>): InnerTypeOfFunction<Args, Returns>;
|
|
724
|
+
validate: <F extends InnerTypeOfFunction<Args, Returns>>(func: F) => ReturnType<F> extends Returns["_output"] ? (...args: Args["_input"]) => ReturnType<F> : OuterTypeOfFunction<Args, Returns>;
|
|
725
|
+
static create(): YatspFunction<YatspTuple<[], YatspUnknown>, YatspUnknown>;
|
|
726
|
+
static create<T extends AnyYatspTuple = YatspTuple<[], YatspUnknown>>(args: T): YatspFunction<T, YatspUnknown>;
|
|
727
|
+
static create<T extends AnyYatspTuple, U extends YatspTypeAny>(args: T, returns: U): YatspFunction<T, U>;
|
|
728
|
+
static create<T extends AnyYatspTuple = YatspTuple<[], YatspUnknown>, U extends YatspTypeAny = YatspUnknown>(args: T, returns: U, params?: RawCreateParams): YatspFunction<T, U>;
|
|
729
|
+
}
|
|
730
|
+
export interface YatspLazyDef<T extends YatspTypeAny = YatspTypeAny> extends YatspTypeDef {
|
|
731
|
+
getter: () => T;
|
|
732
|
+
typeName: YatspFirstPartyTypeKind.YatspLazy;
|
|
733
|
+
}
|
|
734
|
+
export declare class YatspLazy<T extends YatspTypeAny> extends YatspType<output<T>, YatspLazyDef<T>, input<T>> {
|
|
735
|
+
get schema(): T;
|
|
736
|
+
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
737
|
+
static create: <Inner extends YatspTypeAny>(getter: () => Inner, params?: RawCreateParams) => YatspLazy<Inner>;
|
|
738
|
+
}
|
|
739
|
+
export interface YatspLiteralDef<T = any> extends YatspTypeDef {
|
|
740
|
+
value: T;
|
|
741
|
+
typeName: YatspFirstPartyTypeKind.YatspLiteral;
|
|
742
|
+
}
|
|
743
|
+
export declare class YatspLiteral<T> extends YatspType<T, YatspLiteralDef<T>, T> {
|
|
744
|
+
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
745
|
+
get value(): T;
|
|
746
|
+
static create: <Value extends Primitive>(value: Value, params?: RawCreateParams) => YatspLiteral<Value>;
|
|
747
|
+
}
|
|
748
|
+
export type ArrayKeys = keyof any[];
|
|
749
|
+
export type Indices<T> = Exclude<keyof T, ArrayKeys>;
|
|
750
|
+
export type EnumValues<T extends string = string> = readonly [T, ...T[]];
|
|
751
|
+
export type Values<T extends EnumValues> = {
|
|
752
|
+
[k in T[number]]: k;
|
|
753
|
+
};
|
|
754
|
+
export interface YatspEnumDef<T extends EnumValues = EnumValues> extends YatspTypeDef {
|
|
755
|
+
values: T;
|
|
756
|
+
typeName: YatspFirstPartyTypeKind.YatspEnum;
|
|
757
|
+
}
|
|
758
|
+
export type Writeable<T> = {
|
|
759
|
+
-readonly [P in keyof T]: T[P];
|
|
760
|
+
};
|
|
761
|
+
export type FilterEnum<Values, ToExclude> = Values extends [] ? [] : Values extends [infer Head, ...infer Rest] ? Head extends ToExclude ? FilterEnum<Rest, ToExclude> : [Head, ...FilterEnum<Rest, ToExclude>] : never;
|
|
762
|
+
export type typecast<A, T> = A extends T ? A : never;
|
|
763
|
+
declare function createYatspEnum<U extends string, T extends Readonly<[U, ...U[]]>>(values: T, params?: RawCreateParams): YatspEnum<Writeable<T>>;
|
|
764
|
+
declare function createYatspEnum<U extends string, T extends [U, ...U[]]>(values: T, params?: RawCreateParams): YatspEnum<T>;
|
|
765
|
+
export declare class YatspEnum<T extends [string, ...string[]]> extends YatspType<T[number], YatspEnumDef<T>, T[number]> {
|
|
766
|
+
_cache: Set<T[number]> | undefined;
|
|
767
|
+
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
768
|
+
get options(): T;
|
|
769
|
+
get enum(): Values<T>;
|
|
770
|
+
get Values(): Values<T>;
|
|
771
|
+
get Enum(): Values<T>;
|
|
772
|
+
extract<ToExtract extends readonly [T[number], ...T[number][]]>(values: ToExtract, newDef?: RawCreateParams): YatspEnum<Writeable<ToExtract>>;
|
|
773
|
+
exclude<ToExclude extends readonly [T[number], ...T[number][]]>(values: ToExclude, newDef?: RawCreateParams): YatspEnum<typecast<Writeable<FilterEnum<T, ToExclude[number]>>, [string, ...string[]]>>;
|
|
774
|
+
static create: typeof createYatspEnum;
|
|
775
|
+
}
|
|
776
|
+
export interface YatspNativeEnumDef<T extends EnumLike = EnumLike> extends YatspTypeDef {
|
|
777
|
+
values: T;
|
|
778
|
+
typeName: YatspFirstPartyTypeKind.YatspNativeEnum;
|
|
779
|
+
}
|
|
780
|
+
export type EnumLike = {
|
|
781
|
+
[k: string]: string | number;
|
|
782
|
+
[nu: number]: string;
|
|
783
|
+
};
|
|
784
|
+
export declare class YatspNativeEnum<T extends EnumLike> extends YatspType<T[keyof T], YatspNativeEnumDef<T>, T[keyof T]> {
|
|
785
|
+
_cache: Set<T[keyof T]> | undefined;
|
|
786
|
+
_parse(input: ParseInput): ParseReturnType<T[keyof T]>;
|
|
787
|
+
get enum(): T;
|
|
788
|
+
static create: <Elements extends EnumLike>(values: Elements, params?: RawCreateParams) => YatspNativeEnum<Elements>;
|
|
789
|
+
}
|
|
790
|
+
export interface YatspPromiseDef<T extends YatspTypeAny = YatspTypeAny> extends YatspTypeDef {
|
|
791
|
+
type: T;
|
|
792
|
+
typeName: YatspFirstPartyTypeKind.YatspPromise;
|
|
793
|
+
}
|
|
794
|
+
export declare class YatspPromise<T extends YatspTypeAny> extends YatspType<Promise<T["_output"]>, YatspPromiseDef<T>, Promise<T["_input"]>> {
|
|
795
|
+
unwrap(): T;
|
|
796
|
+
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
797
|
+
static create: <Inner extends YatspTypeAny>(schema: Inner, params?: RawCreateParams) => YatspPromise<Inner>;
|
|
798
|
+
}
|
|
799
|
+
export type Refinement<T> = (arg: T, ctx: RefinementCtx) => any;
|
|
800
|
+
export type SuperRefinement<T> = (arg: T, ctx: RefinementCtx) => void | Promise<void>;
|
|
801
|
+
export type RefinementEffect<T> = {
|
|
802
|
+
type: "refinement";
|
|
803
|
+
refinement: (arg: T, ctx: RefinementCtx) => any;
|
|
804
|
+
};
|
|
805
|
+
export type TransformEffect<T> = {
|
|
806
|
+
type: "transform";
|
|
807
|
+
transform: (arg: T, ctx: RefinementCtx) => any;
|
|
808
|
+
};
|
|
809
|
+
export type PreprocessEffect<T> = {
|
|
810
|
+
type: "preprocess";
|
|
811
|
+
transform: (arg: T, ctx: RefinementCtx) => any;
|
|
812
|
+
};
|
|
813
|
+
export type Effect<T> = RefinementEffect<T> | TransformEffect<T> | PreprocessEffect<T>;
|
|
814
|
+
export interface YatspEffectsDef<T extends YatspTypeAny = YatspTypeAny> extends YatspTypeDef {
|
|
815
|
+
schema: T;
|
|
816
|
+
typeName: YatspFirstPartyTypeKind.YatspEffects;
|
|
817
|
+
effect: Effect<any>;
|
|
818
|
+
}
|
|
819
|
+
export declare class YatspEffects<T extends YatspTypeAny, Output = output<T>, Input = input<T>> extends YatspType<Output, YatspEffectsDef<T>, Input> {
|
|
820
|
+
innerType(): T;
|
|
821
|
+
sourceType(): T;
|
|
822
|
+
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
823
|
+
static create: <I extends YatspTypeAny>(schema: I, effect: Effect<I["_output"]>, params?: RawCreateParams) => YatspEffects<I, I["_output"]>;
|
|
824
|
+
static createWithPreprocess: <I extends YatspTypeAny>(preprocess: (arg: unknown, ctx: RefinementCtx) => unknown, schema: I, params?: RawCreateParams) => YatspEffects<I, I["_output"], unknown>;
|
|
825
|
+
}
|
|
826
|
+
export { YatspEffects as YatspTransformer };
|
|
827
|
+
export interface YatspOptionalDef<T extends YatspTypeAny = YatspTypeAny> extends YatspTypeDef {
|
|
828
|
+
innerType: T;
|
|
829
|
+
typeName: YatspFirstPartyTypeKind.YatspOptional;
|
|
830
|
+
}
|
|
831
|
+
export type YatspOptionalType<T extends YatspTypeAny> = YatspOptional<T>;
|
|
832
|
+
export declare class YatspOptional<T extends YatspTypeAny> extends YatspType<T["_output"] | undefined, YatspOptionalDef<T>, T["_input"] | undefined> {
|
|
833
|
+
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
834
|
+
unwrap(): T;
|
|
835
|
+
static create: <Inner extends YatspTypeAny>(type: Inner, params?: RawCreateParams) => YatspOptional<Inner>;
|
|
836
|
+
}
|
|
837
|
+
export interface YatspNullableDef<T extends YatspTypeAny = YatspTypeAny> extends YatspTypeDef {
|
|
838
|
+
innerType: T;
|
|
839
|
+
typeName: YatspFirstPartyTypeKind.YatspNullable;
|
|
840
|
+
}
|
|
841
|
+
export type YatspNullableType<T extends YatspTypeAny> = YatspNullable<T>;
|
|
842
|
+
export declare class YatspNullable<T extends YatspTypeAny> extends YatspType<T["_output"] | null, YatspNullableDef<T>, T["_input"] | null> {
|
|
843
|
+
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
844
|
+
unwrap(): T;
|
|
845
|
+
static create: <Inner extends YatspTypeAny>(type: Inner, params?: RawCreateParams) => YatspNullable<Inner>;
|
|
846
|
+
}
|
|
847
|
+
export interface YatspDefaultDef<T extends YatspTypeAny = YatspTypeAny> extends YatspTypeDef {
|
|
848
|
+
innerType: T;
|
|
849
|
+
defaultValue: () => util.noUndefined<T["_input"]>;
|
|
850
|
+
typeName: YatspFirstPartyTypeKind.YatspDefault;
|
|
851
|
+
}
|
|
852
|
+
export declare class YatspDefault<T extends YatspTypeAny> extends YatspType<util.noUndefined<T["_output"]>, YatspDefaultDef<T>, T["_input"] | undefined> {
|
|
853
|
+
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
854
|
+
removeDefault(): T;
|
|
855
|
+
static create: <Inner extends YatspTypeAny>(type: Inner, params: RawCreateParams & {
|
|
856
|
+
default: Inner["_input"] | (() => util.noUndefined<Inner["_input"]>);
|
|
857
|
+
}) => YatspDefault<Inner>;
|
|
858
|
+
}
|
|
859
|
+
export interface YatspCatchDef<T extends YatspTypeAny = YatspTypeAny> extends YatspTypeDef {
|
|
860
|
+
innerType: T;
|
|
861
|
+
catchValue: (ctx: {
|
|
862
|
+
error: YatspError;
|
|
863
|
+
input: unknown;
|
|
864
|
+
}) => T["_input"];
|
|
865
|
+
typeName: YatspFirstPartyTypeKind.YatspCatch;
|
|
866
|
+
}
|
|
867
|
+
export declare class YatspCatch<T extends YatspTypeAny> extends YatspType<T["_output"], YatspCatchDef<T>, unknown> {
|
|
868
|
+
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
869
|
+
removeCatch(): T;
|
|
870
|
+
static create: <Inner extends YatspTypeAny>(type: Inner, params: RawCreateParams & {
|
|
871
|
+
catch: Inner["_output"] | (() => Inner["_output"]);
|
|
872
|
+
}) => YatspCatch<Inner>;
|
|
873
|
+
}
|
|
874
|
+
export interface YatspNaNDef extends YatspTypeDef {
|
|
875
|
+
typeName: YatspFirstPartyTypeKind.YatspNaN;
|
|
876
|
+
}
|
|
877
|
+
export declare class YatspNaN extends YatspType<number, YatspNaNDef, number> {
|
|
878
|
+
_parse(input: ParseInput): ParseReturnType<any>;
|
|
879
|
+
static create: (params?: RawCreateParams) => YatspNaN;
|
|
880
|
+
}
|
|
881
|
+
export interface YatspBrandedDef<T extends YatspTypeAny> extends YatspTypeDef {
|
|
882
|
+
type: T;
|
|
883
|
+
typeName: YatspFirstPartyTypeKind.YatspBranded;
|
|
884
|
+
}
|
|
885
|
+
export declare const BRAND: unique symbol;
|
|
886
|
+
export type BRAND<T extends string | number | symbol> = {
|
|
887
|
+
[BRAND]: {
|
|
888
|
+
[k in T]: true;
|
|
889
|
+
};
|
|
890
|
+
};
|
|
891
|
+
export declare class YatspBranded<T extends YatspTypeAny, B extends string | number | symbol> extends YatspType<T["_output"] & BRAND<B>, YatspBrandedDef<T>, T["_input"]> {
|
|
892
|
+
_parse(input: ParseInput): ParseReturnType<any>;
|
|
893
|
+
unwrap(): T;
|
|
894
|
+
}
|
|
895
|
+
export interface YatspPipelineDef<A extends YatspTypeAny, B extends YatspTypeAny> extends YatspTypeDef {
|
|
896
|
+
in: A;
|
|
897
|
+
out: B;
|
|
898
|
+
typeName: YatspFirstPartyTypeKind.YatspPipeline;
|
|
899
|
+
}
|
|
900
|
+
export declare class YatspPipeline<A extends YatspTypeAny, B extends YatspTypeAny> extends YatspType<B["_output"], YatspPipelineDef<A, B>, A["_input"]> {
|
|
901
|
+
_parse(input: ParseInput): ParseReturnType<any>;
|
|
902
|
+
static create<ASchema extends YatspTypeAny, BSchema extends YatspTypeAny>(a: ASchema, b: BSchema): YatspPipeline<ASchema, BSchema>;
|
|
903
|
+
}
|
|
904
|
+
type BuiltIn = (((...args: any[]) => any) | (new (...args: any[]) => any)) | {
|
|
905
|
+
readonly [Symbol.toStringTag]: string;
|
|
906
|
+
} | Date | Error | Generator | Promise<unknown> | RegExp;
|
|
907
|
+
type MakeReadonly<T> = T extends Map<infer K, infer V> ? ReadonlyMap<K, V> : T extends Set<infer V> ? ReadonlySet<V> : T extends [infer Head, ...infer Tail] ? readonly [Head, ...Tail] : T extends Array<infer V> ? ReadonlyArray<V> : T extends BuiltIn ? T : Readonly<T>;
|
|
908
|
+
export interface YatspReadonlyDef<T extends YatspTypeAny = YatspTypeAny> extends YatspTypeDef {
|
|
909
|
+
innerType: T;
|
|
910
|
+
typeName: YatspFirstPartyTypeKind.YatspReadonly;
|
|
911
|
+
}
|
|
912
|
+
export declare class YatspReadonly<T extends YatspTypeAny> extends YatspType<MakeReadonly<T["_output"]>, YatspReadonlyDef<T>, MakeReadonly<T["_input"]>> {
|
|
913
|
+
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
914
|
+
static create: <Inner extends YatspTypeAny>(type: Inner, params?: RawCreateParams) => YatspReadonly<Inner>;
|
|
915
|
+
unwrap(): T;
|
|
916
|
+
}
|
|
917
|
+
type CustomParams = CustomErrorParams & {
|
|
918
|
+
fatal?: boolean;
|
|
919
|
+
};
|
|
920
|
+
export declare function custom<T>(check?: (data: any) => any, _params?: string | CustomParams | ((input: any) => CustomParams),
|
|
921
|
+
/**
|
|
922
|
+
* @deprecated
|
|
923
|
+
*
|
|
924
|
+
* Pass `fatal` into the params object instead:
|
|
925
|
+
*
|
|
926
|
+
* ```ts
|
|
927
|
+
* z.string().custom((val) => val.length > 5, { fatal: false })
|
|
928
|
+
* ```
|
|
929
|
+
*
|
|
930
|
+
*/
|
|
931
|
+
fatal?: boolean): YatspType<T, YatspTypeDef, T>;
|
|
932
|
+
export { YatspType as Schema, YatspType as YatspSchema };
|
|
933
|
+
export declare const late: {
|
|
934
|
+
object: <Shape extends YatspRawShape>(shape: () => Shape, params?: RawCreateParams) => YatspObject<Shape, "strip">;
|
|
935
|
+
};
|
|
936
|
+
export declare enum YatspFirstPartyTypeKind {
|
|
937
|
+
YatspString = "YatspString",
|
|
938
|
+
YatspNumber = "YatspNumber",
|
|
939
|
+
YatspNaN = "YatspNaN",
|
|
940
|
+
YatspBigInt = "YatspBigInt",
|
|
941
|
+
YatspBoolean = "YatspBoolean",
|
|
942
|
+
YatspDate = "YatspDate",
|
|
943
|
+
YatspSymbol = "YatspSymbol",
|
|
944
|
+
YatspUndefined = "YatspUndefined",
|
|
945
|
+
YatspNull = "YatspNull",
|
|
946
|
+
YatspAny = "YatspAny",
|
|
947
|
+
YatspUnknown = "YatspUnknown",
|
|
948
|
+
YatspNever = "YatspNever",
|
|
949
|
+
YatspVoid = "YatspVoid",
|
|
950
|
+
YatspArray = "YatspArray",
|
|
951
|
+
YatspObject = "YatspObject",
|
|
952
|
+
YatspUnion = "YatspUnion",
|
|
953
|
+
YatspDiscriminatedUnion = "YatspDiscriminatedUnion",
|
|
954
|
+
YatspIntersection = "YatspIntersection",
|
|
955
|
+
YatspTuple = "YatspTuple",
|
|
956
|
+
YatspRecord = "YatspRecord",
|
|
957
|
+
YatspMap = "YatspMap",
|
|
958
|
+
YatspSet = "YatspSet",
|
|
959
|
+
YatspFunction = "YatspFunction",
|
|
960
|
+
YatspLazy = "YatspLazy",
|
|
961
|
+
YatspLiteral = "YatspLiteral",
|
|
962
|
+
YatspEnum = "YatspEnum",
|
|
963
|
+
YatspEffects = "YatspEffects",
|
|
964
|
+
YatspNativeEnum = "YatspNativeEnum",
|
|
965
|
+
YatspOptional = "YatspOptional",
|
|
966
|
+
YatspNullable = "YatspNullable",
|
|
967
|
+
YatspDefault = "YatspDefault",
|
|
968
|
+
YatspCatch = "YatspCatch",
|
|
969
|
+
YatspPromise = "YatspPromise",
|
|
970
|
+
YatspBranded = "YatspBranded",
|
|
971
|
+
YatspPipeline = "YatspPipeline",
|
|
972
|
+
YatspReadonly = "YatspReadonly"
|
|
973
|
+
}
|
|
974
|
+
export type YatspFirstPartySchemaTypes = YatspString | YatspNumber | YatspNaN | YatspBigInt | YatspBoolean | YatspDate | YatspUndefined | YatspNull | YatspAny | YatspUnknown | YatspNever | YatspVoid | YatspArray<any, any> | YatspObject<any, any, any> | YatspUnion<any> | YatspDiscriminatedUnion<any, any> | YatspIntersection<any, any> | YatspTuple<any, any> | YatspRecord<any, any> | YatspMap<any> | YatspSet<any> | YatspFunction<any, any> | YatspLazy<any> | YatspLiteral<any> | YatspEnum<any> | YatspEffects<any, any, any> | YatspNativeEnum<any> | YatspOptional<any> | YatspNullable<any> | YatspDefault<any> | YatspCatch<any> | YatspPromise<any> | YatspBranded<any, any> | YatspPipeline<any, any> | YatspReadonly<any> | YatspSymbol;
|
|
975
|
+
declare abstract class Class {
|
|
976
|
+
constructor(..._: any[]);
|
|
977
|
+
}
|
|
978
|
+
declare const instanceOfType: <T extends typeof Class>(cls: T, params?: CustomParams) => YatspType<InstanceType<T>, YatspTypeDef, InstanceType<T>>;
|
|
979
|
+
declare const stringType: (params?: RawCreateParams & {
|
|
980
|
+
coerce?: true;
|
|
981
|
+
}) => YatspString;
|
|
982
|
+
declare const numberType: (params?: RawCreateParams & {
|
|
983
|
+
coerce?: boolean;
|
|
984
|
+
}) => YatspNumber;
|
|
985
|
+
declare const nanType: (params?: RawCreateParams) => YatspNaN;
|
|
986
|
+
declare const bigIntType: (params?: RawCreateParams & {
|
|
987
|
+
coerce?: boolean;
|
|
988
|
+
}) => YatspBigInt;
|
|
989
|
+
declare const booleanType: (params?: RawCreateParams & {
|
|
990
|
+
coerce?: boolean;
|
|
991
|
+
}) => YatspBoolean;
|
|
992
|
+
declare const dateType: (params?: RawCreateParams & {
|
|
993
|
+
coerce?: boolean;
|
|
994
|
+
}) => YatspDate;
|
|
995
|
+
declare const symbolType: (params?: RawCreateParams) => YatspSymbol;
|
|
996
|
+
declare const undefinedType: (params?: RawCreateParams) => YatspUndefined;
|
|
997
|
+
declare const nullType: (params?: RawCreateParams) => YatspNull;
|
|
998
|
+
declare const anyType: (params?: RawCreateParams) => YatspAny;
|
|
999
|
+
declare const unknownType: (params?: RawCreateParams) => YatspUnknown;
|
|
1000
|
+
declare const neverType: (params?: RawCreateParams) => YatspNever;
|
|
1001
|
+
declare const voidType: (params?: RawCreateParams) => YatspVoid;
|
|
1002
|
+
declare const arrayType: <El extends YatspTypeAny>(schema: El, params?: RawCreateParams) => YatspArray<El>;
|
|
1003
|
+
declare const objectType: <Shape extends YatspRawShape>(shape: Shape, params?: RawCreateParams) => YatspObject<Shape, "strip", YatspTypeAny, objectOutputType<Shape, YatspTypeAny, "strip">, objectInputType<Shape, YatspTypeAny, "strip">>;
|
|
1004
|
+
declare const strictObjectType: <Shape extends YatspRawShape>(shape: Shape, params?: RawCreateParams) => YatspObject<Shape, "strict">;
|
|
1005
|
+
declare const unionType: <Options extends Readonly<[YatspTypeAny, YatspTypeAny, ...YatspTypeAny[]]>>(types: Options, params?: RawCreateParams) => YatspUnion<Options>;
|
|
1006
|
+
declare const discriminatedUnionType: typeof YatspDiscriminatedUnion.create;
|
|
1007
|
+
declare const intersectionType: <TSchema extends YatspTypeAny, USchema extends YatspTypeAny>(left: TSchema, right: USchema, params?: RawCreateParams) => YatspIntersection<TSchema, USchema>;
|
|
1008
|
+
declare const tupleType: <Items extends [YatspTypeAny, ...YatspTypeAny[]] | []>(schemas: Items, params?: RawCreateParams) => YatspTuple<Items, null>;
|
|
1009
|
+
declare const recordType: typeof YatspRecord.create;
|
|
1010
|
+
declare const mapType: <KeySchema extends YatspTypeAny = YatspTypeAny, ValueSchema extends YatspTypeAny = YatspTypeAny>(keyType: KeySchema, valueType: ValueSchema, params?: RawCreateParams) => YatspMap<KeySchema, ValueSchema>;
|
|
1011
|
+
declare const setType: <ValueSchema extends YatspTypeAny = YatspTypeAny>(valueType: ValueSchema, params?: RawCreateParams) => YatspSet<ValueSchema>;
|
|
1012
|
+
declare const functionType: typeof YatspFunction.create;
|
|
1013
|
+
declare const lazyType: <Inner extends YatspTypeAny>(getter: () => Inner, params?: RawCreateParams) => YatspLazy<Inner>;
|
|
1014
|
+
declare const literalType: <Value extends Primitive>(value: Value, params?: RawCreateParams) => YatspLiteral<Value>;
|
|
1015
|
+
declare const enumType: typeof createYatspEnum;
|
|
1016
|
+
declare const nativeEnumType: <Elements extends EnumLike>(values: Elements, params?: RawCreateParams) => YatspNativeEnum<Elements>;
|
|
1017
|
+
declare const promiseType: <Inner extends YatspTypeAny>(schema: Inner, params?: RawCreateParams) => YatspPromise<Inner>;
|
|
1018
|
+
declare const effectsType: <I extends YatspTypeAny>(schema: I, effect: Effect<I["_output"]>, params?: RawCreateParams) => YatspEffects<I, I["_output"]>;
|
|
1019
|
+
declare const optionalType: <Inner extends YatspTypeAny>(type: Inner, params?: RawCreateParams) => YatspOptional<Inner>;
|
|
1020
|
+
declare const nullableType: <Inner extends YatspTypeAny>(type: Inner, params?: RawCreateParams) => YatspNullable<Inner>;
|
|
1021
|
+
declare const preprocessType: <I extends YatspTypeAny>(preprocess: (arg: unknown, ctx: RefinementCtx) => unknown, schema: I, params?: RawCreateParams) => YatspEffects<I, I["_output"], unknown>;
|
|
1022
|
+
declare const pipelineType: typeof YatspPipeline.create;
|
|
1023
|
+
declare const ostring: () => YatspOptional<YatspString>;
|
|
1024
|
+
declare const onumber: () => YatspOptional<YatspNumber>;
|
|
1025
|
+
declare const oboolean: () => YatspOptional<YatspBoolean>;
|
|
1026
|
+
export declare const coerce: {
|
|
1027
|
+
string: (typeof YatspString)["create"];
|
|
1028
|
+
number: (typeof YatspNumber)["create"];
|
|
1029
|
+
boolean: (typeof YatspBoolean)["create"];
|
|
1030
|
+
bigint: (typeof YatspBigInt)["create"];
|
|
1031
|
+
date: (typeof YatspDate)["create"];
|
|
1032
|
+
};
|
|
1033
|
+
export { anyType as any, arrayType as array, bigIntType as bigint, booleanType as boolean, dateType as date, discriminatedUnionType as discriminatedUnion, effectsType as effect, enumType as enum, functionType as function, instanceOfType as instanceof, intersectionType as intersection, lazyType as lazy, literalType as literal, mapType as map, nanType as nan, nativeEnumType as nativeEnum, neverType as never, nullType as null, nullableType as nullable, numberType as number, objectType as object, oboolean, onumber, optionalType as optional, ostring, pipelineType as pipeline, preprocessType as preprocess, promiseType as promise, recordType as record, setType as set, strictObjectType as strictObject, stringType as string, symbolType as symbol, effectsType as transformer, tupleType as tuple, undefinedType as undefined, unionType as union, unknownType as unknown, voidType as void, };
|
|
1034
|
+
export declare const NEVER: never;
|