@willaimg/yatsp 4.3.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +22 -0
- package/compile.cjs +96 -0
- package/compile.d.cts +1 -0
- package/compile.d.ts +1 -0
- package/compile.js +52 -0
- package/index.cjs +52 -0
- package/index.d.cts +3 -0
- package/index.d.ts +3 -0
- package/index.js +7 -0
- package/locales/index.cjs +36 -0
- package/locales/index.d.cts +1 -0
- package/locales/index.d.ts +1 -0
- package/locales/index.js +1 -0
- package/mini/index.cjs +51 -0
- package/mini/index.d.cts +3 -0
- package/mini/index.d.ts +3 -0
- package/mini/index.js +3 -0
- package/package.json +142 -0
- package/src/compile.ts +56 -0
- package/src/index.ts +7 -0
- package/src/locales/index.ts +1 -0
- package/src/mini/index.ts +3 -0
- package/src/v3/YatspError.ts +340 -0
- package/src/v3/benchmarks/datetime.ts +58 -0
- package/src/v3/benchmarks/discriminatedUnion.ts +80 -0
- package/src/v3/benchmarks/index.ts +59 -0
- package/src/v3/benchmarks/ipv4.ts +57 -0
- package/src/v3/benchmarks/object.ts +69 -0
- package/src/v3/benchmarks/primitives.ts +162 -0
- package/src/v3/benchmarks/realworld.ts +63 -0
- package/src/v3/benchmarks/string.ts +55 -0
- package/src/v3/benchmarks/union.ts +80 -0
- package/src/v3/errors.ts +13 -0
- package/src/v3/external.ts +6 -0
- package/src/v3/helpers/enumUtil.ts +17 -0
- package/src/v3/helpers/errorUtil.ts +8 -0
- package/src/v3/helpers/parseUtil.ts +176 -0
- package/src/v3/helpers/partialUtil.ts +34 -0
- package/src/v3/helpers/typeAliases.ts +2 -0
- package/src/v3/helpers/util.ts +224 -0
- package/src/v3/index.ts +4 -0
- package/src/v3/locales/en.ts +124 -0
- package/src/v3/standard-schema.ts +113 -0
- package/src/v3/tests/Mocker.ts +54 -0
- package/src/v3/tests/all-errors.test.ts +157 -0
- package/src/v3/tests/anyunknown.test.ts +28 -0
- package/src/v3/tests/array.test.ts +71 -0
- package/src/v3/tests/async-parsing.test.ts +388 -0
- package/src/v3/tests/async-refinements.test.ts +46 -0
- package/src/v3/tests/base.test.ts +29 -0
- package/src/v3/tests/bigint.test.ts +55 -0
- package/src/v3/tests/branded.test.ts +53 -0
- package/src/v3/tests/catch.test.ts +220 -0
- package/src/v3/tests/coerce.test.ts +133 -0
- package/src/v3/tests/complex.test.ts +70 -0
- package/src/v3/tests/custom.test.ts +31 -0
- package/src/v3/tests/date.test.ts +32 -0
- package/src/v3/tests/deepmasking.test.ts +186 -0
- package/src/v3/tests/default.test.ts +112 -0
- package/src/v3/tests/description.test.ts +33 -0
- package/src/v3/tests/discriminated-unions.test.ts +315 -0
- package/src/v3/tests/enum.test.ts +80 -0
- package/src/v3/tests/error.test.ts +586 -0
- package/src/v3/tests/firstparty.test.ts +87 -0
- package/src/v3/tests/firstpartyschematypes.test.ts +21 -0
- package/src/v3/tests/function.test.ts +261 -0
- package/src/v3/tests/generics.test.ts +48 -0
- package/src/v3/tests/instanceof.test.ts +37 -0
- package/src/v3/tests/intersection.test.ts +128 -0
- package/src/v3/tests/language-server.source.ts +76 -0
- package/src/v3/tests/language-server.test.ts +206 -0
- package/src/v3/tests/literal.test.ts +36 -0
- package/src/v3/tests/map.test.ts +110 -0
- package/src/v3/tests/masking.test.ts +4 -0
- package/src/v3/tests/mocker.test.ts +19 -0
- package/src/v3/tests/nan.test.ts +24 -0
- package/src/v3/tests/nativeEnum.test.ts +87 -0
- package/src/v3/tests/nullable.test.ts +42 -0
- package/src/v3/tests/number.test.ts +176 -0
- package/src/v3/tests/object-augmentation.test.ts +29 -0
- package/src/v3/tests/object-in-es5-env.test.ts +29 -0
- package/src/v3/tests/object.test.ts +431 -0
- package/src/v3/tests/optional.test.ts +42 -0
- package/src/v3/tests/parseUtil.test.ts +23 -0
- package/src/v3/tests/parser.test.ts +41 -0
- package/src/v3/tests/partials.test.ts +243 -0
- package/src/v3/tests/pickomit.test.ts +111 -0
- package/src/v3/tests/pipeline.test.ts +29 -0
- package/src/v3/tests/preprocess.test.ts +186 -0
- package/src/v3/tests/primitive.test.ts +440 -0
- package/src/v3/tests/promise.test.ts +90 -0
- package/src/v3/tests/readonly.test.ts +114 -0
- package/src/v3/tests/record.test.ts +171 -0
- package/src/v3/tests/recursive.test.ts +197 -0
- package/src/v3/tests/refine.test.ts +313 -0
- package/src/v3/tests/safeparse.test.ts +27 -0
- package/src/v3/tests/set.test.ts +142 -0
- package/src/v3/tests/standard-schema.test.ts +83 -0
- package/src/v3/tests/string.test.ts +922 -0
- package/src/v3/tests/transformer.test.ts +233 -0
- package/src/v3/tests/tuple.test.ts +90 -0
- package/src/v3/tests/unions.test.ts +57 -0
- package/src/v3/tests/validations.test.ts +133 -0
- package/src/v3/tests/void.test.ts +15 -0
- package/src/v3/types.ts +5162 -0
- package/src/v4/classic/checks.ts +33 -0
- package/src/v4/classic/coerce.ts +27 -0
- package/src/v4/classic/compat.ts +78 -0
- package/src/v4/classic/deep-partial.ts +76 -0
- package/src/v4/classic/errors.ts +97 -0
- package/src/v4/classic/external.ts +57 -0
- package/src/v4/classic/from-json-schema.ts +944 -0
- package/src/v4/classic/in-out.ts +45 -0
- package/src/v4/classic/index.ts +5 -0
- package/src/v4/classic/iso.ts +20 -0
- package/src/v4/classic/parse.ts +88 -0
- package/src/v4/classic/schemas.ts +2994 -0
- package/src/v4/classic/tests/anyunknown.test.ts +26 -0
- package/src/v4/classic/tests/apply.test.ts +86 -0
- package/src/v4/classic/tests/array.test.ts +264 -0
- package/src/v4/classic/tests/assignability.test.ts +402 -0
- package/src/v4/classic/tests/async-parsing.test.ts +381 -0
- package/src/v4/classic/tests/async-refinements.test.ts +68 -0
- package/src/v4/classic/tests/base.test.ts +7 -0
- package/src/v4/classic/tests/bigint.test.ts +89 -0
- package/src/v4/classic/tests/brand.test.ts +106 -0
- package/src/v4/classic/tests/catch.test.ts +604 -0
- package/src/v4/classic/tests/coalesce.test.ts +20 -0
- package/src/v4/classic/tests/codec-examples.test.ts +572 -0
- package/src/v4/classic/tests/codec.test.ts +704 -0
- package/src/v4/classic/tests/coerce.test.ts +160 -0
- package/src/v4/classic/tests/continuability.test.ts +374 -0
- package/src/v4/classic/tests/credit-card.test.ts +76 -0
- package/src/v4/classic/tests/custom.test.ts +40 -0
- package/src/v4/classic/tests/cyclic-data.test.ts +985 -0
- package/src/v4/classic/tests/date.test.ts +92 -0
- package/src/v4/classic/tests/datetime.test.ts +316 -0
- package/src/v4/classic/tests/deep-partial.test.ts +380 -0
- package/src/v4/classic/tests/default-locale.test.ts +32 -0
- package/src/v4/classic/tests/default.test.ts +455 -0
- package/src/v4/classic/tests/describe-meta-checks.test.ts +27 -0
- package/src/v4/classic/tests/description.test.ts +32 -0
- package/src/v4/classic/tests/detached-methods.test.ts +226 -0
- package/src/v4/classic/tests/discriminated-unions.test.ts +942 -0
- package/src/v4/classic/tests/enum.test.ts +305 -0
- package/src/v4/classic/tests/error-utils.test.ts +917 -0
- package/src/v4/classic/tests/error.test.ts +1108 -0
- package/src/v4/classic/tests/file.test.ts +96 -0
- package/src/v4/classic/tests/firstparty.test.ts +179 -0
- package/src/v4/classic/tests/fix-json-issue.test.ts +26 -0
- package/src/v4/classic/tests/from-json-schema.test.ts +1467 -0
- package/src/v4/classic/tests/function.test.ts +391 -0
- package/src/v4/classic/tests/generics.test.ts +72 -0
- package/src/v4/classic/tests/global-config.test.ts +32 -0
- package/src/v4/classic/tests/hash.test.ts +67 -0
- package/src/v4/classic/tests/iban.test.ts +81 -0
- package/src/v4/classic/tests/in-out.test.ts +159 -0
- package/src/v4/classic/tests/index.test.ts +958 -0
- package/src/v4/classic/tests/instance-footprint.test.ts +319 -0
- package/src/v4/classic/tests/instanceof.test.ts +127 -0
- package/src/v4/classic/tests/intersection.test.ts +334 -0
- package/src/v4/classic/tests/issue-schema.test.ts +215 -0
- package/src/v4/classic/tests/jitless-allows-eval.test.ts +39 -0
- package/src/v4/classic/tests/json.test.ts +109 -0
- package/src/v4/classic/tests/lazy.test.ts +262 -0
- package/src/v4/classic/tests/literal.test.ts +128 -0
- package/src/v4/classic/tests/locales_ka.test.ts +29 -0
- package/src/v4/classic/tests/locales_ro.test.ts +24 -0
- package/src/v4/classic/tests/map.test.ts +342 -0
- package/src/v4/classic/tests/nan.test.ts +21 -0
- package/src/v4/classic/tests/nested-refine.test.ts +168 -0
- package/src/v4/classic/tests/nonoptional.test.ts +101 -0
- package/src/v4/classic/tests/nullable.test.ts +22 -0
- package/src/v4/classic/tests/number.test.ts +401 -0
- package/src/v4/classic/tests/object.test.ts +1006 -0
- package/src/v4/classic/tests/optin-ladder.test.ts +235 -0
- package/src/v4/classic/tests/optional.test.ts +366 -0
- package/src/v4/classic/tests/partial.test.ts +497 -0
- package/src/v4/classic/tests/pickomit.test.ts +211 -0
- package/src/v4/classic/tests/pipe.test.ts +101 -0
- package/src/v4/classic/tests/prefault.test.ts +144 -0
- package/src/v4/classic/tests/preprocess-types.test.ts +44 -0
- package/src/v4/classic/tests/preprocess.test.ts +351 -0
- package/src/v4/classic/tests/primitive.test.ts +175 -0
- package/src/v4/classic/tests/promise.test.ts +81 -0
- package/src/v4/classic/tests/properties.test.ts +141 -0
- package/src/v4/classic/tests/prototypes.test.ts +23 -0
- package/src/v4/classic/tests/readonly.test.ts +184 -0
- package/src/v4/classic/tests/record.test.ts +885 -0
- package/src/v4/classic/tests/recursive-types.test.ts +707 -0
- package/src/v4/classic/tests/redos.test.ts +68 -0
- package/src/v4/classic/tests/refine.test.ts +693 -0
- package/src/v4/classic/tests/registries.test.ts +243 -0
- package/src/v4/classic/tests/set.test.ts +190 -0
- package/src/v4/classic/tests/standard-schema.test.ts +153 -0
- package/src/v4/classic/tests/string-formats.test.ts +125 -0
- package/src/v4/classic/tests/string.test.ts +1440 -0
- package/src/v4/classic/tests/stringbool.test.ts +124 -0
- package/src/v4/classic/tests/template-literal.test.ts +814 -0
- package/src/v4/classic/tests/to-json-schema-methods.test.ts +438 -0
- package/src/v4/classic/tests/to-json-schema.test.ts +4733 -0
- package/src/v4/classic/tests/transform.test.ts +378 -0
- package/src/v4/classic/tests/tuple.test.ts +511 -0
- package/src/v4/classic/tests/union.test.ts +310 -0
- package/src/v4/classic/tests/url.test.ts +13 -0
- package/src/v4/classic/tests/validate.test.ts +645 -0
- package/src/v4/classic/tests/validations.test.ts +283 -0
- package/src/v4/classic/tests/void.test.ts +12 -0
- package/src/v4/core/api.ts +1913 -0
- package/src/v4/core/checks.ts +1274 -0
- package/src/v4/core/compile.ts +2315 -0
- package/src/v4/core/core.ts +230 -0
- package/src/v4/core/doc.ts +52 -0
- package/src/v4/core/errors.ts +546 -0
- package/src/v4/core/index.ts +19 -0
- package/src/v4/core/json-schema-generator.ts +131 -0
- package/src/v4/core/json-schema-processors.ts +934 -0
- package/src/v4/core/json-schema.ts +148 -0
- package/src/v4/core/memoizer.ts +331 -0
- package/src/v4/core/parse.ts +309 -0
- package/src/v4/core/regexes.ts +217 -0
- package/src/v4/core/registries.ts +109 -0
- package/src/v4/core/schemas.ts +5295 -0
- package/src/v4/core/standard-schema.ts +159 -0
- package/src/v4/core/tests/cached.test.ts +54 -0
- package/src/v4/core/tests/compile-differential.test.ts +1004 -0
- package/src/v4/core/tests/compile-generative.test.ts +445 -0
- package/src/v4/core/tests/compile-global.test.ts +89 -0
- package/src/v4/core/tests/compile-off-by-default.test.ts +26 -0
- package/src/v4/core/tests/compile-stats.test.ts +34 -0
- package/src/v4/core/tests/compile.test.ts +2040 -0
- package/src/v4/core/tests/email-regex.test.ts +140 -0
- package/src/v4/core/tests/extend.test.ts +59 -0
- package/src/v4/core/tests/index.test.ts +46 -0
- package/src/v4/core/tests/locales/be.test.ts +124 -0
- package/src/v4/core/tests/locales/el.test.ts +214 -0
- package/src/v4/core/tests/locales/en.test.ts +22 -0
- package/src/v4/core/tests/locales/es.test.ts +180 -0
- package/src/v4/core/tests/locales/fr.test.ts +72 -0
- package/src/v4/core/tests/locales/he.test.ts +379 -0
- package/src/v4/core/tests/locales/hr.test.ts +163 -0
- package/src/v4/core/tests/locales/nl.test.ts +46 -0
- package/src/v4/core/tests/locales/parity.test.ts +42 -0
- package/src/v4/core/tests/locales/ru.test.ts +128 -0
- package/src/v4/core/tests/locales/tg.test.ts +85 -0
- package/src/v4/core/tests/locales/tk.test.ts +69 -0
- package/src/v4/core/tests/locales/tr.test.ts +69 -0
- package/src/v4/core/tests/locales/uz.test.ts +105 -0
- package/src/v4/core/tests/polyfill-collision.test.ts +46 -0
- package/src/v4/core/tests/record-constructor.test.ts +125 -0
- package/src/v4/core/tests/recursive-tuples.test.ts +45 -0
- package/src/v4/core/tests/treeshake.test.ts +51 -0
- package/src/v4/core/tests/url-no-canparse.test.ts +133 -0
- package/src/v4/core/to-json-schema.ts +857 -0
- package/src/v4/core/util.ts +1284 -0
- package/src/v4/core/versions.ts +5 -0
- package/src/v4/core/visit.ts +193 -0
- package/src/v4/core/zsf.ts +323 -0
- package/src/v4/index.ts +4 -0
- package/src/v4/locales/ar.ts +120 -0
- package/src/v4/locales/az.ts +116 -0
- package/src/v4/locales/be.ts +188 -0
- package/src/v4/locales/bg.ts +133 -0
- package/src/v4/locales/bn.ts +123 -0
- package/src/v4/locales/ca.ts +121 -0
- package/src/v4/locales/ckb.ts +140 -0
- package/src/v4/locales/cs.ts +123 -0
- package/src/v4/locales/da.ts +128 -0
- package/src/v4/locales/de.ts +121 -0
- package/src/v4/locales/el.ts +124 -0
- package/src/v4/locales/en.ts +136 -0
- package/src/v4/locales/eo.ts +123 -0
- package/src/v4/locales/es.ts +145 -0
- package/src/v4/locales/fa.ts +131 -0
- package/src/v4/locales/fi.ts +126 -0
- package/src/v4/locales/fr-CA.ts +121 -0
- package/src/v4/locales/fr.ts +139 -0
- package/src/v4/locales/gu.ts +123 -0
- package/src/v4/locales/he.ts +253 -0
- package/src/v4/locales/hi.ts +126 -0
- package/src/v4/locales/hr.ts +135 -0
- package/src/v4/locales/hu.ts +122 -0
- package/src/v4/locales/hy.ts +175 -0
- package/src/v4/locales/id.ts +120 -0
- package/src/v4/locales/index.ts +63 -0
- package/src/v4/locales/is.ts +124 -0
- package/src/v4/locales/it.ts +121 -0
- package/src/v4/locales/ja.ts +119 -0
- package/src/v4/locales/ka.ts +128 -0
- package/src/v4/locales/kh.ts +7 -0
- package/src/v4/locales/km.ts +124 -0
- package/src/v4/locales/kn.ts +126 -0
- package/src/v4/locales/ko.ts +126 -0
- package/src/v4/locales/lt.ts +243 -0
- package/src/v4/locales/mk.ts +123 -0
- package/src/v4/locales/ms.ts +120 -0
- package/src/v4/locales/ne.ts +128 -0
- package/src/v4/locales/nl.ts +126 -0
- package/src/v4/locales/nn.ts +121 -0
- package/src/v4/locales/no.ts +121 -0
- package/src/v4/locales/ota.ts +122 -0
- package/src/v4/locales/pl.ts +123 -0
- package/src/v4/locales/ps.ts +131 -0
- package/src/v4/locales/pt-BR.ts +161 -0
- package/src/v4/locales/pt.ts +159 -0
- package/src/v4/locales/ro.ts +132 -0
- package/src/v4/locales/ru.ts +188 -0
- package/src/v4/locales/sk.ts +123 -0
- package/src/v4/locales/sl.ts +123 -0
- package/src/v4/locales/sv.ts +124 -0
- package/src/v4/locales/ta.ts +123 -0
- package/src/v4/locales/tg.ts +135 -0
- package/src/v4/locales/th.ts +124 -0
- package/src/v4/locales/tk.ts +113 -0
- package/src/v4/locales/tr.ts +116 -0
- package/src/v4/locales/ua.ts +7 -0
- package/src/v4/locales/uk.ts +122 -0
- package/src/v4/locales/ur.ts +124 -0
- package/src/v4/locales/uz.ts +120 -0
- package/src/v4/locales/vi.ts +122 -0
- package/src/v4/locales/yo.ts +129 -0
- package/src/v4/locales/zh-CN.ts +121 -0
- package/src/v4/locales/zh-TW.ts +120 -0
- package/src/v4/mini/checks.ts +33 -0
- package/src/v4/mini/coerce.ts +27 -0
- package/src/v4/mini/deep-partial.ts +73 -0
- package/src/v4/mini/external.ts +52 -0
- package/src/v4/mini/in-out.ts +45 -0
- package/src/v4/mini/index.ts +3 -0
- package/src/v4/mini/iso.ts +66 -0
- package/src/v4/mini/parse.ts +16 -0
- package/src/v4/mini/schemas.ts +2093 -0
- package/src/v4/mini/tests/apply.test.ts +57 -0
- package/src/v4/mini/tests/assignability.test.ts +190 -0
- package/src/v4/mini/tests/brand.test.ts +94 -0
- package/src/v4/mini/tests/checks.test.ts +158 -0
- package/src/v4/mini/tests/codec.test.ts +582 -0
- package/src/v4/mini/tests/computed.test.ts +30 -0
- package/src/v4/mini/tests/cyclic-data.test.ts +84 -0
- package/src/v4/mini/tests/deep-partial.test.ts +54 -0
- package/src/v4/mini/tests/error.test.ts +41 -0
- package/src/v4/mini/tests/functions.test.ts +14 -0
- package/src/v4/mini/tests/index.test.ts +1148 -0
- package/src/v4/mini/tests/number.test.ts +109 -0
- package/src/v4/mini/tests/object.test.ts +292 -0
- package/src/v4/mini/tests/prototypes.test.ts +43 -0
- package/src/v4/mini/tests/recursive-types.test.ts +341 -0
- package/src/v4/mini/tests/standard-schema.test.ts +50 -0
- package/src/v4/mini/tests/string.test.ts +396 -0
- package/src/v4-mini/index.ts +3 -0
- package/v3/YatspError.cjs +167 -0
- package/v3/YatspError.d.cts +164 -0
- package/v3/YatspError.d.ts +164 -0
- package/v3/YatspError.js +143 -0
- package/v3/errors.cjs +36 -0
- package/v3/errors.d.cts +5 -0
- package/v3/errors.d.ts +5 -0
- package/v3/errors.js +9 -0
- package/v3/external.cjs +41 -0
- package/v3/external.d.cts +6 -0
- package/v3/external.d.ts +6 -0
- package/v3/external.js +6 -0
- package/v3/helpers/enumUtil.cjs +21 -0
- package/v3/helpers/enumUtil.d.cts +8 -0
- package/v3/helpers/enumUtil.d.ts +8 -0
- package/v3/helpers/enumUtil.js +1 -0
- package/v3/helpers/errorUtil.cjs +28 -0
- package/v3/helpers/errorUtil.d.cts +9 -0
- package/v3/helpers/errorUtil.d.ts +9 -0
- package/v3/helpers/errorUtil.js +6 -0
- package/v3/helpers/parseUtil.cjs +143 -0
- package/v3/helpers/parseUtil.d.cts +78 -0
- package/v3/helpers/parseUtil.d.ts +78 -0
- package/v3/helpers/parseUtil.js +109 -0
- package/v3/helpers/partialUtil.cjs +21 -0
- package/v3/helpers/partialUtil.d.cts +8 -0
- package/v3/helpers/partialUtil.d.ts +8 -0
- package/v3/helpers/partialUtil.js +1 -0
- package/v3/helpers/typeAliases.cjs +21 -0
- package/v3/helpers/typeAliases.d.cts +2 -0
- package/v3/helpers/typeAliases.d.ts +2 -0
- package/v3/helpers/typeAliases.js +1 -0
- package/v3/helpers/util.cjs +156 -0
- package/v3/helpers/util.d.cts +85 -0
- package/v3/helpers/util.d.ts +85 -0
- package/v3/helpers/util.js +133 -0
- package/v3/index.cjs +52 -0
- package/v3/index.d.cts +4 -0
- package/v3/index.d.ts +4 -0
- package/v3/index.js +4 -0
- package/v3/locales/en.cjs +112 -0
- package/v3/locales/en.d.cts +3 -0
- package/v3/locales/en.d.ts +3 -0
- package/v3/locales/en.js +109 -0
- package/v3/standard-schema.cjs +21 -0
- package/v3/standard-schema.d.cts +102 -0
- package/v3/standard-schema.d.ts +102 -0
- package/v3/standard-schema.js +1 -0
- package/v3/types.cjs +3798 -0
- package/v3/types.d.cts +1034 -0
- package/v3/types.d.ts +1034 -0
- package/v3/types.js +3697 -0
- package/v4/classic/checks.cjs +53 -0
- package/v4/classic/checks.d.cts +1 -0
- package/v4/classic/checks.d.ts +1 -0
- package/v4/classic/checks.js +1 -0
- package/v4/classic/coerce.cjs +66 -0
- package/v4/classic/coerce.d.cts +17 -0
- package/v4/classic/coerce.d.ts +17 -0
- package/v4/classic/coerce.js +17 -0
- package/v4/classic/compat.cjs +80 -0
- package/v4/classic/compat.d.cts +48 -0
- package/v4/classic/compat.d.ts +48 -0
- package/v4/classic/compat.js +31 -0
- package/v4/classic/deep-partial.cjs +58 -0
- package/v4/classic/deep-partial.d.cts +14 -0
- package/v4/classic/deep-partial.d.ts +14 -0
- package/v4/classic/deep-partial.js +13 -0
- package/v4/classic/errors.cjs +102 -0
- package/v4/classic/errors.d.cts +29 -0
- package/v4/classic/errors.d.ts +29 -0
- package/v4/classic/errors.js +57 -0
- package/v4/classic/external.cjs +97 -0
- package/v4/classic/external.d.cts +19 -0
- package/v4/classic/external.d.ts +19 -0
- package/v4/classic/external.js +17 -0
- package/v4/classic/from-json-schema.cjs +926 -0
- package/v4/classic/from-json-schema.d.cts +12 -0
- package/v4/classic/from-json-schema.d.ts +12 -0
- package/v4/classic/from-json-schema.js +881 -0
- package/v4/classic/in-out.cjs +82 -0
- package/v4/classic/in-out.d.cts +8 -0
- package/v4/classic/in-out.d.ts +8 -0
- package/v4/classic/in-out.js +36 -0
- package/v4/classic/index.cjs +52 -0
- package/v4/classic/index.d.cts +3 -0
- package/v4/classic/index.d.ts +3 -0
- package/v4/classic/index.js +4 -0
- package/v4/classic/iso.cjs +68 -0
- package/v4/classic/iso.d.cts +7 -0
- package/v4/classic/iso.d.ts +7 -0
- package/v4/classic/iso.js +15 -0
- package/v4/classic/parse.cjs +63 -0
- package/v4/classic/parse.d.cts +44 -0
- package/v4/classic/parse.d.ts +44 -0
- package/v4/classic/parse.js +16 -0
- package/v4/classic/schemas.cjs +1676 -0
- package/v4/classic/schemas.d.cts +816 -0
- package/v4/classic/schemas.d.ts +816 -0
- package/v4/classic/schemas.js +1535 -0
- package/v4/core/api.cjs +1269 -0
- package/v4/core/api.d.cts +335 -0
- package/v4/core/api.d.ts +335 -0
- package/v4/core/api.js +1107 -0
- package/v4/core/checks.cjs +561 -0
- package/v4/core/checks.d.cts +294 -0
- package/v4/core/checks.d.ts +294 -0
- package/v4/core/checks.js +516 -0
- package/v4/core/compile.cjs +1908 -0
- package/v4/core/compile.d.cts +65 -0
- package/v4/core/compile.d.ts +65 -0
- package/v4/core/compile.js +1858 -0
- package/v4/core/core.cjs +167 -0
- package/v4/core/core.d.cts +82 -0
- package/v4/core/core.d.ts +82 -0
- package/v4/core/core.js +141 -0
- package/v4/core/doc.cjs +61 -0
- package/v4/core/doc.d.cts +16 -0
- package/v4/core/doc.d.ts +16 -0
- package/v4/core/doc.js +38 -0
- package/v4/core/errors.cjs +317 -0
- package/v4/core/errors.d.cts +225 -0
- package/v4/core/errors.d.ts +225 -0
- package/v4/core/errors.js +267 -0
- package/v4/core/index.cjs +70 -0
- package/v4/core/index.d.cts +19 -0
- package/v4/core/index.d.ts +19 -0
- package/v4/core/index.js +19 -0
- package/v4/core/json-schema-generator.cjs +122 -0
- package/v4/core/json-schema-generator.d.cts +65 -0
- package/v4/core/json-schema-generator.d.ts +65 -0
- package/v4/core/json-schema-generator.js +99 -0
- package/v4/core/json-schema-processors.cjs +929 -0
- package/v4/core/json-schema-processors.d.cts +65 -0
- package/v4/core/json-schema-processors.d.ts +65 -0
- package/v4/core/json-schema-processors.js +843 -0
- package/v4/core/json-schema.cjs +21 -0
- package/v4/core/json-schema.d.cts +89 -0
- package/v4/core/json-schema.d.ts +89 -0
- package/v4/core/json-schema.js +1 -0
- package/v4/core/memoizer.cjs +360 -0
- package/v4/core/memoizer.d.cts +15 -0
- package/v4/core/memoizer.d.ts +15 -0
- package/v4/core/memoizer.js +311 -0
- package/v4/core/parse.cjs +233 -0
- package/v4/core/parse.d.cts +52 -0
- package/v4/core/parse.d.ts +52 -0
- package/v4/core/parse.js +175 -0
- package/v4/core/regexes.cjs +209 -0
- package/v4/core/regexes.d.cts +90 -0
- package/v4/core/regexes.d.ts +90 -0
- package/v4/core/regexes.js +156 -0
- package/v4/core/registries.cjs +76 -0
- package/v4/core/registries.d.cts +35 -0
- package/v4/core/registries.d.ts +35 -0
- package/v4/core/registries.js +52 -0
- package/v4/core/schemas.cjs +2669 -0
- package/v4/core/schemas.d.cts +1273 -0
- package/v4/core/schemas.d.ts +1273 -0
- package/v4/core/schemas.js +2606 -0
- package/v4/core/standard-schema.cjs +21 -0
- package/v4/core/standard-schema.d.cts +126 -0
- package/v4/core/standard-schema.d.ts +126 -0
- package/v4/core/standard-schema.js +1 -0
- package/v4/core/to-json-schema.cjs +681 -0
- package/v4/core/to-json-schema.d.cts +154 -0
- package/v4/core/to-json-schema.d.ts +154 -0
- package/v4/core/to-json-schema.js +651 -0
- package/v4/core/util.cjs +949 -0
- package/v4/core/util.d.cts +278 -0
- package/v4/core/util.d.ts +278 -0
- package/v4/core/util.js +859 -0
- package/v4/core/versions.cjs +27 -0
- package/v4/core/versions.d.cts +5 -0
- package/v4/core/versions.d.ts +5 -0
- package/v4/core/versions.js +5 -0
- package/v4/core/visit.cjs +214 -0
- package/v4/core/visit.d.cts +30 -0
- package/v4/core/visit.d.ts +30 -0
- package/v4/core/visit.js +169 -0
- package/v4/index.cjs +51 -0
- package/v4/index.d.cts +3 -0
- package/v4/index.d.ts +3 -0
- package/v4/index.js +4 -0
- package/v4/locales/ar.cjs +138 -0
- package/v4/locales/ar.d.cts +5 -0
- package/v4/locales/ar.d.ts +4 -0
- package/v4/locales/ar.js +111 -0
- package/v4/locales/az.cjs +137 -0
- package/v4/locales/az.d.cts +5 -0
- package/v4/locales/az.d.ts +4 -0
- package/v4/locales/az.js +110 -0
- package/v4/locales/be.cjs +195 -0
- package/v4/locales/be.d.cts +5 -0
- package/v4/locales/be.d.ts +4 -0
- package/v4/locales/be.js +168 -0
- package/v4/locales/bg.cjs +152 -0
- package/v4/locales/bg.d.cts +5 -0
- package/v4/locales/bg.d.ts +4 -0
- package/v4/locales/bg.js +125 -0
- package/v4/locales/bn.cjs +140 -0
- package/v4/locales/bn.d.cts +5 -0
- package/v4/locales/bn.d.ts +4 -0
- package/v4/locales/bn.js +113 -0
- package/v4/locales/ca.cjs +139 -0
- package/v4/locales/ca.d.cts +5 -0
- package/v4/locales/ca.d.ts +4 -0
- package/v4/locales/ca.js +112 -0
- package/v4/locales/ckb.cjs +160 -0
- package/v4/locales/ckb.d.cts +5 -0
- package/v4/locales/ckb.d.ts +4 -0
- package/v4/locales/ckb.js +133 -0
- package/v4/locales/cs.cjs +143 -0
- package/v4/locales/cs.d.cts +5 -0
- package/v4/locales/cs.d.ts +4 -0
- package/v4/locales/cs.js +116 -0
- package/v4/locales/da.cjs +147 -0
- package/v4/locales/da.d.cts +5 -0
- package/v4/locales/da.d.ts +4 -0
- package/v4/locales/da.js +120 -0
- package/v4/locales/de.cjs +140 -0
- package/v4/locales/de.d.cts +5 -0
- package/v4/locales/de.d.ts +4 -0
- package/v4/locales/de.js +113 -0
- package/v4/locales/el.cjs +139 -0
- package/v4/locales/el.d.cts +5 -0
- package/v4/locales/el.d.ts +4 -0
- package/v4/locales/el.js +112 -0
- package/v4/locales/en.cjs +152 -0
- package/v4/locales/en.d.cts +5 -0
- package/v4/locales/en.d.ts +4 -0
- package/v4/locales/en.js +125 -0
- package/v4/locales/eo.cjs +141 -0
- package/v4/locales/eo.d.cts +5 -0
- package/v4/locales/eo.d.ts +4 -0
- package/v4/locales/eo.js +114 -0
- package/v4/locales/es.cjs +163 -0
- package/v4/locales/es.d.cts +5 -0
- package/v4/locales/es.d.ts +4 -0
- package/v4/locales/es.js +136 -0
- package/v4/locales/fa.cjs +146 -0
- package/v4/locales/fa.d.cts +5 -0
- package/v4/locales/fa.d.ts +4 -0
- package/v4/locales/fa.js +119 -0
- package/v4/locales/fi.cjs +144 -0
- package/v4/locales/fi.d.cts +5 -0
- package/v4/locales/fi.d.ts +4 -0
- package/v4/locales/fi.js +117 -0
- package/v4/locales/fr-CA.cjs +139 -0
- package/v4/locales/fr-CA.d.cts +5 -0
- package/v4/locales/fr-CA.d.ts +4 -0
- package/v4/locales/fr-CA.js +112 -0
- package/v4/locales/fr.cjs +156 -0
- package/v4/locales/fr.d.cts +5 -0
- package/v4/locales/fr.d.ts +4 -0
- package/v4/locales/fr.js +129 -0
- package/v4/locales/gu.cjs +140 -0
- package/v4/locales/gu.d.cts +5 -0
- package/v4/locales/gu.d.ts +4 -0
- package/v4/locales/gu.js +113 -0
- package/v4/locales/he.cjs +248 -0
- package/v4/locales/he.d.cts +5 -0
- package/v4/locales/he.d.ts +4 -0
- package/v4/locales/he.js +221 -0
- package/v4/locales/hi.cjs +138 -0
- package/v4/locales/hi.d.cts +5 -0
- package/v4/locales/hi.d.ts +4 -0
- package/v4/locales/hi.js +111 -0
- package/v4/locales/hr.cjs +153 -0
- package/v4/locales/hr.d.cts +5 -0
- package/v4/locales/hr.d.ts +4 -0
- package/v4/locales/hr.js +126 -0
- package/v4/locales/hu.cjs +140 -0
- package/v4/locales/hu.d.cts +5 -0
- package/v4/locales/hu.d.ts +4 -0
- package/v4/locales/hu.js +113 -0
- package/v4/locales/hy.cjs +185 -0
- package/v4/locales/hy.d.cts +5 -0
- package/v4/locales/hy.d.ts +4 -0
- package/v4/locales/hy.js +158 -0
- package/v4/locales/id.cjs +138 -0
- package/v4/locales/id.d.cts +5 -0
- package/v4/locales/id.d.ts +4 -0
- package/v4/locales/id.js +111 -0
- package/v4/locales/index.cjs +152 -0
- package/v4/locales/index.d.cts +63 -0
- package/v4/locales/index.d.ts +63 -0
- package/v4/locales/index.js +63 -0
- package/v4/locales/is.cjs +141 -0
- package/v4/locales/is.d.cts +5 -0
- package/v4/locales/is.d.ts +4 -0
- package/v4/locales/is.js +114 -0
- package/v4/locales/it.cjs +140 -0
- package/v4/locales/it.d.cts +5 -0
- package/v4/locales/it.d.ts +4 -0
- package/v4/locales/it.js +113 -0
- package/v4/locales/ja.cjs +139 -0
- package/v4/locales/ja.d.cts +5 -0
- package/v4/locales/ja.d.ts +4 -0
- package/v4/locales/ja.js +112 -0
- package/v4/locales/ka.cjs +144 -0
- package/v4/locales/ka.d.cts +5 -0
- package/v4/locales/ka.d.ts +4 -0
- package/v4/locales/ka.js +117 -0
- package/v4/locales/kh.cjs +12 -0
- package/v4/locales/kh.d.cts +5 -0
- package/v4/locales/kh.d.ts +5 -0
- package/v4/locales/kh.js +5 -0
- package/v4/locales/km.cjs +142 -0
- package/v4/locales/km.d.cts +5 -0
- package/v4/locales/km.d.ts +4 -0
- package/v4/locales/km.js +115 -0
- package/v4/locales/kn.cjs +143 -0
- package/v4/locales/kn.d.cts +5 -0
- package/v4/locales/kn.d.ts +4 -0
- package/v4/locales/kn.js +116 -0
- package/v4/locales/ko.cjs +143 -0
- package/v4/locales/ko.d.cts +5 -0
- package/v4/locales/ko.d.ts +4 -0
- package/v4/locales/ko.js +116 -0
- package/v4/locales/lt.cjs +234 -0
- package/v4/locales/lt.d.cts +5 -0
- package/v4/locales/lt.d.ts +4 -0
- package/v4/locales/lt.js +207 -0
- package/v4/locales/mk.cjs +141 -0
- package/v4/locales/mk.d.cts +5 -0
- package/v4/locales/mk.d.ts +4 -0
- package/v4/locales/mk.js +114 -0
- package/v4/locales/ms.cjs +139 -0
- package/v4/locales/ms.d.cts +5 -0
- package/v4/locales/ms.d.ts +4 -0
- package/v4/locales/ms.js +112 -0
- package/v4/locales/ne.cjs +138 -0
- package/v4/locales/ne.d.cts +5 -0
- package/v4/locales/ne.d.ts +4 -0
- package/v4/locales/ne.js +111 -0
- package/v4/locales/nl.cjs +142 -0
- package/v4/locales/nl.d.cts +5 -0
- package/v4/locales/nl.d.ts +4 -0
- package/v4/locales/nl.js +115 -0
- package/v4/locales/nn.cjs +140 -0
- package/v4/locales/nn.d.cts +5 -0
- package/v4/locales/nn.d.ts +4 -0
- package/v4/locales/nn.js +113 -0
- package/v4/locales/no.cjs +140 -0
- package/v4/locales/no.d.cts +5 -0
- package/v4/locales/no.d.ts +4 -0
- package/v4/locales/no.js +113 -0
- package/v4/locales/ota.cjs +141 -0
- package/v4/locales/ota.d.cts +5 -0
- package/v4/locales/ota.d.ts +4 -0
- package/v4/locales/ota.js +114 -0
- package/v4/locales/pl.cjs +141 -0
- package/v4/locales/pl.d.cts +5 -0
- package/v4/locales/pl.d.ts +4 -0
- package/v4/locales/pl.js +114 -0
- package/v4/locales/ps.cjs +146 -0
- package/v4/locales/ps.d.cts +5 -0
- package/v4/locales/ps.d.ts +4 -0
- package/v4/locales/ps.js +119 -0
- package/v4/locales/pt-BR.cjs +170 -0
- package/v4/locales/pt-BR.d.cts +5 -0
- package/v4/locales/pt-BR.d.ts +4 -0
- package/v4/locales/pt-BR.js +143 -0
- package/v4/locales/pt.cjs +169 -0
- package/v4/locales/pt.d.cts +5 -0
- package/v4/locales/pt.d.ts +4 -0
- package/v4/locales/pt.js +142 -0
- package/v4/locales/ro.cjs +149 -0
- package/v4/locales/ro.d.cts +5 -0
- package/v4/locales/ro.d.ts +4 -0
- package/v4/locales/ro.js +122 -0
- package/v4/locales/ru.cjs +195 -0
- package/v4/locales/ru.d.cts +5 -0
- package/v4/locales/ru.d.ts +4 -0
- package/v4/locales/ru.js +168 -0
- package/v4/locales/sk.cjs +143 -0
- package/v4/locales/sk.d.cts +5 -0
- package/v4/locales/sk.d.ts +4 -0
- package/v4/locales/sk.js +116 -0
- package/v4/locales/sl.cjs +141 -0
- package/v4/locales/sl.d.cts +5 -0
- package/v4/locales/sl.d.ts +4 -0
- package/v4/locales/sl.js +114 -0
- package/v4/locales/sv.cjs +142 -0
- package/v4/locales/sv.d.cts +5 -0
- package/v4/locales/sv.d.ts +4 -0
- package/v4/locales/sv.js +115 -0
- package/v4/locales/ta.cjs +142 -0
- package/v4/locales/ta.d.cts +5 -0
- package/v4/locales/ta.d.ts +4 -0
- package/v4/locales/ta.js +115 -0
- package/v4/locales/tg.cjs +144 -0
- package/v4/locales/tg.d.cts +5 -0
- package/v4/locales/tg.d.ts +4 -0
- package/v4/locales/tg.js +117 -0
- package/v4/locales/th.cjs +142 -0
- package/v4/locales/th.d.cts +5 -0
- package/v4/locales/th.d.ts +4 -0
- package/v4/locales/th.js +115 -0
- package/v4/locales/tk.cjs +134 -0
- package/v4/locales/tk.d.cts +5 -0
- package/v4/locales/tk.d.ts +4 -0
- package/v4/locales/tk.js +107 -0
- package/v4/locales/tr.cjs +137 -0
- package/v4/locales/tr.d.cts +5 -0
- package/v4/locales/tr.d.ts +4 -0
- package/v4/locales/tr.js +110 -0
- package/v4/locales/ua.cjs +12 -0
- package/v4/locales/ua.d.cts +5 -0
- package/v4/locales/ua.d.ts +5 -0
- package/v4/locales/ua.js +5 -0
- package/v4/locales/uk.cjs +140 -0
- package/v4/locales/uk.d.cts +5 -0
- package/v4/locales/uk.d.ts +4 -0
- package/v4/locales/uk.js +113 -0
- package/v4/locales/ur.cjs +142 -0
- package/v4/locales/ur.d.cts +5 -0
- package/v4/locales/ur.d.ts +4 -0
- package/v4/locales/ur.js +115 -0
- package/v4/locales/uz.cjs +140 -0
- package/v4/locales/uz.d.cts +5 -0
- package/v4/locales/uz.d.ts +4 -0
- package/v4/locales/uz.js +113 -0
- package/v4/locales/vi.cjs +140 -0
- package/v4/locales/vi.d.cts +5 -0
- package/v4/locales/vi.d.ts +4 -0
- package/v4/locales/vi.js +113 -0
- package/v4/locales/yo.cjs +139 -0
- package/v4/locales/yo.d.cts +5 -0
- package/v4/locales/yo.d.ts +4 -0
- package/v4/locales/yo.js +112 -0
- package/v4/locales/zh-CN.cjs +141 -0
- package/v4/locales/zh-CN.d.cts +5 -0
- package/v4/locales/zh-CN.d.ts +4 -0
- package/v4/locales/zh-CN.js +114 -0
- package/v4/locales/zh-TW.cjs +139 -0
- package/v4/locales/zh-TW.d.cts +5 -0
- package/v4/locales/zh-TW.d.ts +4 -0
- package/v4/locales/zh-TW.js +112 -0
- package/v4/mini/checks.cjs +54 -0
- package/v4/mini/checks.d.cts +1 -0
- package/v4/mini/checks.d.ts +1 -0
- package/v4/mini/checks.js +1 -0
- package/v4/mini/coerce.cjs +71 -0
- package/v4/mini/coerce.d.cts +7 -0
- package/v4/mini/coerce.d.ts +7 -0
- package/v4/mini/coerce.js +22 -0
- package/v4/mini/deep-partial.cjs +58 -0
- package/v4/mini/deep-partial.d.cts +14 -0
- package/v4/mini/deep-partial.d.ts +14 -0
- package/v4/mini/deep-partial.js +13 -0
- package/v4/mini/external.cjs +95 -0
- package/v4/mini/external.d.cts +16 -0
- package/v4/mini/external.d.ts +16 -0
- package/v4/mini/external.js +16 -0
- package/v4/mini/in-out.cjs +82 -0
- package/v4/mini/in-out.d.cts +8 -0
- package/v4/mini/in-out.d.ts +8 -0
- package/v4/mini/in-out.js +36 -0
- package/v4/mini/index.cjs +51 -0
- package/v4/mini/index.d.cts +3 -0
- package/v4/mini/index.d.ts +3 -0
- package/v4/mini/index.js +3 -0
- package/v4/mini/iso.cjs +83 -0
- package/v4/mini/iso.d.cts +22 -0
- package/v4/mini/iso.d.ts +22 -0
- package/v4/mini/iso.js +34 -0
- package/v4/mini/parse.cjs +37 -0
- package/v4/mini/parse.d.cts +1 -0
- package/v4/mini/parse.d.ts +1 -0
- package/v4/mini/parse.js +1 -0
- package/v4/mini/schemas.cjs +1149 -0
- package/v4/mini/schemas.d.cts +480 -0
- package/v4/mini/schemas.d.ts +480 -0
- package/v4/mini/schemas.js +1004 -0
- package/v4-mini/index.cjs +51 -0
- package/v4-mini/index.d.cts +3 -0
- package/v4-mini/index.d.ts +3 -0
- package/v4-mini/index.js +3 -0
|
@@ -0,0 +1,1149 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.YatspMiniEnum = exports.YatspMiniSet = exports.YatspMiniMap = exports.YatspMiniRecord = exports.YatspMiniTuple = exports.YatspMiniIntersection = exports.YatspMiniDiscriminatedUnion = exports.YatspMiniXor = exports.YatspMiniUnion = exports.YatspMiniObject = exports.YatspMiniArray = exports.YatspMiniDate = exports.YatspMiniVoid = exports.YatspMiniNever = exports.YatspMiniUnknown = exports.YatspMiniAny = exports.YatspMiniNull = exports.YatspMiniUndefined = exports.YatspMiniSymbol = exports.YatspMiniBigIntFormat = exports.YatspMiniBigInt = exports.YatspMiniBoolean = exports.YatspMiniNumberFormat = exports.YatspMiniNumber = exports.YatspMiniCustomStringFormat = exports.YatspMiniJWT = exports.YatspMiniIBAN = exports.YatspMiniCreditCard = exports.YatspMiniE164 = exports.YatspMiniBase64URL = exports.YatspMiniBase64 = exports.YatspMiniMAC = exports.YatspMiniCIDRv6 = exports.YatspMiniCIDRv4 = exports.YatspMiniIPv6 = exports.YatspMiniIPv4 = exports.YatspMiniKSUID = exports.YatspMiniXID = exports.YatspMiniULID = exports.YatspMiniCUID2 = exports.YatspMiniCUID = exports.YatspMiniNanoID = exports.YatspMiniEmoji = exports.YatspMiniURL = exports.YatspMiniUUID = exports.YatspMiniGUID = exports.YatspMiniEmail = exports.YatspMiniStringFormat = exports.YatspMiniString = exports.YatspMiniType = void 0;
|
|
27
|
+
exports.YatspMiniFunction = exports.stringbool = exports.meta = exports.describe = exports.YatspMiniCustom = exports.YatspMiniPromise = exports.YatspMiniLazy = exports.YatspMiniTemplateLiteral = exports.YatspMiniReadonly = exports.YatspMiniCodec = exports.YatspMiniPipe = exports.YatspMiniNaN = exports.YatspMiniCatch = exports.YatspMiniSuccess = exports.YatspMiniNonOptional = exports.YatspMiniPrefault = exports.YatspMiniDefault = exports.YatspMiniNullable = exports.YatspMiniExactOptional = exports.YatspMiniOptional = exports.YatspMiniTransform = exports.YatspMiniFile = exports.YatspMiniLiteral = void 0;
|
|
28
|
+
exports.string = string;
|
|
29
|
+
exports.email = email;
|
|
30
|
+
exports.guid = guid;
|
|
31
|
+
exports.uuid = uuid;
|
|
32
|
+
exports.uuidv4 = uuidv4;
|
|
33
|
+
exports.uuidv6 = uuidv6;
|
|
34
|
+
exports.uuidv7 = uuidv7;
|
|
35
|
+
exports.url = url;
|
|
36
|
+
exports.httpUrl = httpUrl;
|
|
37
|
+
exports.emoji = emoji;
|
|
38
|
+
exports.nanoid = nanoid;
|
|
39
|
+
exports.cuid = cuid;
|
|
40
|
+
exports.cuid2 = cuid2;
|
|
41
|
+
exports.ulid = ulid;
|
|
42
|
+
exports.xid = xid;
|
|
43
|
+
exports.ksuid = ksuid;
|
|
44
|
+
exports.ipv4 = ipv4;
|
|
45
|
+
exports.ipv6 = ipv6;
|
|
46
|
+
exports.cidrv4 = cidrv4;
|
|
47
|
+
exports.cidrv6 = cidrv6;
|
|
48
|
+
exports.mac = mac;
|
|
49
|
+
exports.base64 = base64;
|
|
50
|
+
exports.base64url = base64url;
|
|
51
|
+
exports.e164 = e164;
|
|
52
|
+
exports.creditCard = creditCard;
|
|
53
|
+
exports.iban = iban;
|
|
54
|
+
exports.jwt = jwt;
|
|
55
|
+
exports.stringFormat = stringFormat;
|
|
56
|
+
exports.hostname = hostname;
|
|
57
|
+
exports.hex = hex;
|
|
58
|
+
exports.currencyCode = currencyCode;
|
|
59
|
+
exports.hash = hash;
|
|
60
|
+
exports.number = number;
|
|
61
|
+
exports.int = int;
|
|
62
|
+
exports.float32 = float32;
|
|
63
|
+
exports.float64 = float64;
|
|
64
|
+
exports.int32 = int32;
|
|
65
|
+
exports.uint32 = uint32;
|
|
66
|
+
exports.boolean = boolean;
|
|
67
|
+
exports.bigint = bigint;
|
|
68
|
+
exports.int64 = int64;
|
|
69
|
+
exports.uint64 = uint64;
|
|
70
|
+
exports.symbol = symbol;
|
|
71
|
+
exports.undefined = _undefined;
|
|
72
|
+
exports.null = _null;
|
|
73
|
+
exports.any = any;
|
|
74
|
+
exports.unknown = unknown;
|
|
75
|
+
exports.never = never;
|
|
76
|
+
exports.void = _void;
|
|
77
|
+
exports.date = date;
|
|
78
|
+
exports.array = array;
|
|
79
|
+
exports.keyof = keyof;
|
|
80
|
+
exports.object = object;
|
|
81
|
+
exports.strictObject = strictObject;
|
|
82
|
+
exports.looseObject = looseObject;
|
|
83
|
+
exports.extend = extend;
|
|
84
|
+
exports.safeExtend = safeExtend;
|
|
85
|
+
exports.merge = merge;
|
|
86
|
+
exports.pick = pick;
|
|
87
|
+
exports.omit = omit;
|
|
88
|
+
exports.partial = partial;
|
|
89
|
+
exports.exactPartial = exactPartial;
|
|
90
|
+
exports.required = required;
|
|
91
|
+
exports.catchall = catchall;
|
|
92
|
+
exports.union = union;
|
|
93
|
+
exports.xor = xor;
|
|
94
|
+
exports.discriminatedUnion = discriminatedUnion;
|
|
95
|
+
exports.intersection = intersection;
|
|
96
|
+
exports.tuple = tuple;
|
|
97
|
+
exports.record = record;
|
|
98
|
+
exports.partialRecord = partialRecord;
|
|
99
|
+
exports.looseRecord = looseRecord;
|
|
100
|
+
exports.map = map;
|
|
101
|
+
exports.set = set;
|
|
102
|
+
exports.enum = _enum;
|
|
103
|
+
exports.nativeEnum = nativeEnum;
|
|
104
|
+
exports.literal = literal;
|
|
105
|
+
exports.file = file;
|
|
106
|
+
exports.transform = transform;
|
|
107
|
+
exports.optional = optional;
|
|
108
|
+
exports.exactOptional = exactOptional;
|
|
109
|
+
exports.nullable = nullable;
|
|
110
|
+
exports.nullish = nullish;
|
|
111
|
+
exports._default = _default;
|
|
112
|
+
exports.prefault = prefault;
|
|
113
|
+
exports.nonoptional = nonoptional;
|
|
114
|
+
exports.success = success;
|
|
115
|
+
exports.catch = _catch;
|
|
116
|
+
exports.nan = nan;
|
|
117
|
+
exports.pipe = pipe;
|
|
118
|
+
exports.codec = codec;
|
|
119
|
+
exports.invertCodec = invertCodec;
|
|
120
|
+
exports.readonly = readonly;
|
|
121
|
+
exports.templateLiteral = templateLiteral;
|
|
122
|
+
exports.lazy = _lazy;
|
|
123
|
+
exports.promise = promise;
|
|
124
|
+
exports.check = check;
|
|
125
|
+
exports.custom = custom;
|
|
126
|
+
exports.refine = refine;
|
|
127
|
+
exports.superRefine = superRefine;
|
|
128
|
+
exports.instanceof = _instanceof;
|
|
129
|
+
exports.json = json;
|
|
130
|
+
exports._function = _function;
|
|
131
|
+
exports.function = _function;
|
|
132
|
+
exports._function = _function;
|
|
133
|
+
exports.function = _function;
|
|
134
|
+
const core = __importStar(require("../core/index.cjs"));
|
|
135
|
+
const regexes = __importStar(require("../core/regexes.cjs"));
|
|
136
|
+
const util = __importStar(require("../core/util.cjs"));
|
|
137
|
+
const parse = __importStar(require("./parse.cjs"));
|
|
138
|
+
exports.YatspMiniType = core.$constructor("YatspMiniType", (inst, def) => {
|
|
139
|
+
if (!inst._yatsp)
|
|
140
|
+
throw new Error("Uninitialized schema in YatspMiniType.");
|
|
141
|
+
core.$YatspType.init(inst, def);
|
|
142
|
+
inst.def = def;
|
|
143
|
+
inst.type = def.type;
|
|
144
|
+
}, {
|
|
145
|
+
// `with` is an alias for `check`: the same function object, not a wrapper.
|
|
146
|
+
get with() {
|
|
147
|
+
return this.check;
|
|
148
|
+
},
|
|
149
|
+
set with(value) {
|
|
150
|
+
util.own(this, "with", value);
|
|
151
|
+
},
|
|
152
|
+
parse(data, params) {
|
|
153
|
+
return parse.parse(this, data, params, { callee: this.parse });
|
|
154
|
+
},
|
|
155
|
+
parseAsync(data, params) {
|
|
156
|
+
return parse.parseAsync(this, data, params, { callee: this.parseAsync });
|
|
157
|
+
},
|
|
158
|
+
safeParse(data, params) {
|
|
159
|
+
return parse.safeParse(this, data, params);
|
|
160
|
+
},
|
|
161
|
+
safeParseAsync(data, params) {
|
|
162
|
+
return parse.safeParseAsync(this, data, params);
|
|
163
|
+
},
|
|
164
|
+
check(...checks) {
|
|
165
|
+
const def = this.def;
|
|
166
|
+
return this.clone({
|
|
167
|
+
...def,
|
|
168
|
+
checks: [
|
|
169
|
+
...(def.checks ?? []),
|
|
170
|
+
...checks.map((ch) => typeof ch === "function" ? { _yatsp: { check: ch, def: { check: "custom" }, onattach: [] } } : ch),
|
|
171
|
+
],
|
|
172
|
+
}, { parent: true });
|
|
173
|
+
},
|
|
174
|
+
clone(_def, params) {
|
|
175
|
+
return core.clone(this, _def, params);
|
|
176
|
+
},
|
|
177
|
+
brand() {
|
|
178
|
+
return this;
|
|
179
|
+
},
|
|
180
|
+
register(reg, meta) {
|
|
181
|
+
reg.add(this, meta);
|
|
182
|
+
return this;
|
|
183
|
+
},
|
|
184
|
+
apply(fn, ...args) {
|
|
185
|
+
return args.length === 0 ? fn(this) : fn(this, ...args);
|
|
186
|
+
},
|
|
187
|
+
});
|
|
188
|
+
exports.YatspMiniString = core.$constructor("YatspMiniString", (inst, def) => {
|
|
189
|
+
core.$YatspString.init(inst, def);
|
|
190
|
+
exports.YatspMiniType.init(inst, def);
|
|
191
|
+
});
|
|
192
|
+
// @__NO_SIDE_EFFECTS__
|
|
193
|
+
function string(params) {
|
|
194
|
+
return core._string(exports.YatspMiniString, params);
|
|
195
|
+
}
|
|
196
|
+
exports.YatspMiniStringFormat = core.$constructor("YatspMiniStringFormat", (inst, def) => {
|
|
197
|
+
core.$YatspStringFormat.init(inst, def);
|
|
198
|
+
exports.YatspMiniString.init(inst, def);
|
|
199
|
+
});
|
|
200
|
+
exports.YatspMiniEmail = core.$constructor("YatspMiniEmail", (inst, def) => {
|
|
201
|
+
core.$YatspEmail.init(inst, def);
|
|
202
|
+
exports.YatspMiniStringFormat.init(inst, def);
|
|
203
|
+
});
|
|
204
|
+
// @__NO_SIDE_EFFECTS__
|
|
205
|
+
function email(params) {
|
|
206
|
+
return core._email(exports.YatspMiniEmail, params);
|
|
207
|
+
}
|
|
208
|
+
exports.YatspMiniGUID = core.$constructor("YatspMiniGUID", (inst, def) => {
|
|
209
|
+
core.$YatspGUID.init(inst, def);
|
|
210
|
+
exports.YatspMiniStringFormat.init(inst, def);
|
|
211
|
+
});
|
|
212
|
+
// @__NO_SIDE_EFFECTS__
|
|
213
|
+
function guid(params) {
|
|
214
|
+
return core._guid(exports.YatspMiniGUID, params);
|
|
215
|
+
}
|
|
216
|
+
exports.YatspMiniUUID = core.$constructor("YatspMiniUUID", (inst, def) => {
|
|
217
|
+
core.$YatspUUID.init(inst, def);
|
|
218
|
+
exports.YatspMiniStringFormat.init(inst, def);
|
|
219
|
+
});
|
|
220
|
+
// @__NO_SIDE_EFFECTS__
|
|
221
|
+
function uuid(params) {
|
|
222
|
+
return core._uuid(exports.YatspMiniUUID, params);
|
|
223
|
+
}
|
|
224
|
+
// @__NO_SIDE_EFFECTS__
|
|
225
|
+
function uuidv4(params) {
|
|
226
|
+
return core._uuidv4(exports.YatspMiniUUID, params);
|
|
227
|
+
}
|
|
228
|
+
// YatspMiniUUIDv6
|
|
229
|
+
// @__NO_SIDE_EFFECTS__
|
|
230
|
+
function uuidv6(params) {
|
|
231
|
+
return core._uuidv6(exports.YatspMiniUUID, params);
|
|
232
|
+
}
|
|
233
|
+
// YatspMiniUUIDv7
|
|
234
|
+
// @__NO_SIDE_EFFECTS__
|
|
235
|
+
function uuidv7(params) {
|
|
236
|
+
return core._uuidv7(exports.YatspMiniUUID, params);
|
|
237
|
+
}
|
|
238
|
+
exports.YatspMiniURL = core.$constructor("YatspMiniURL", (inst, def) => {
|
|
239
|
+
core.$YatspURL.init(inst, def);
|
|
240
|
+
exports.YatspMiniStringFormat.init(inst, def);
|
|
241
|
+
});
|
|
242
|
+
// @__NO_SIDE_EFFECTS__
|
|
243
|
+
function url(params) {
|
|
244
|
+
return core._url(exports.YatspMiniURL, params);
|
|
245
|
+
}
|
|
246
|
+
// @__NO_SIDE_EFFECTS__
|
|
247
|
+
function httpUrl(params) {
|
|
248
|
+
return core._url(exports.YatspMiniURL, {
|
|
249
|
+
protocol: regexes.httpProtocol,
|
|
250
|
+
hostname: regexes.domain,
|
|
251
|
+
...util.normalizeParams(params),
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
exports.YatspMiniEmoji = core.$constructor("YatspMiniEmoji", (inst, def) => {
|
|
255
|
+
core.$YatspEmoji.init(inst, def);
|
|
256
|
+
exports.YatspMiniStringFormat.init(inst, def);
|
|
257
|
+
});
|
|
258
|
+
// @__NO_SIDE_EFFECTS__
|
|
259
|
+
function emoji(params) {
|
|
260
|
+
return core._emoji(exports.YatspMiniEmoji, params);
|
|
261
|
+
}
|
|
262
|
+
exports.YatspMiniNanoID = core.$constructor("YatspMiniNanoID", (inst, def) => {
|
|
263
|
+
core.$YatspNanoID.init(inst, def);
|
|
264
|
+
exports.YatspMiniStringFormat.init(inst, def);
|
|
265
|
+
});
|
|
266
|
+
// @__NO_SIDE_EFFECTS__
|
|
267
|
+
function nanoid(params) {
|
|
268
|
+
return core._nanoid(exports.YatspMiniNanoID, params);
|
|
269
|
+
}
|
|
270
|
+
/**
|
|
271
|
+
* @deprecated CUID v1 is deprecated by its authors due to information leakage
|
|
272
|
+
* (timestamps embedded in the id). Use {@link YatspMiniCUID2} instead.
|
|
273
|
+
* See https://github.com/paralleldrive/cuid.
|
|
274
|
+
*/
|
|
275
|
+
exports.YatspMiniCUID = core.$constructor("YatspMiniCUID", (inst, def) => {
|
|
276
|
+
core.$YatspCUID.init(inst, def);
|
|
277
|
+
exports.YatspMiniStringFormat.init(inst, def);
|
|
278
|
+
});
|
|
279
|
+
/**
|
|
280
|
+
* Validates a CUID v1 string.
|
|
281
|
+
*
|
|
282
|
+
* @deprecated CUID v1 is deprecated by its authors due to information leakage
|
|
283
|
+
* (timestamps embedded in the id). Use {@link cuid2 | `z.cuid2()`} instead.
|
|
284
|
+
* See https://github.com/paralleldrive/cuid.
|
|
285
|
+
*/
|
|
286
|
+
// @__NO_SIDE_EFFECTS__
|
|
287
|
+
function cuid(params) {
|
|
288
|
+
return core._cuid(exports.YatspMiniCUID, params);
|
|
289
|
+
}
|
|
290
|
+
exports.YatspMiniCUID2 = core.$constructor("YatspMiniCUID2", (inst, def) => {
|
|
291
|
+
core.$YatspCUID2.init(inst, def);
|
|
292
|
+
exports.YatspMiniStringFormat.init(inst, def);
|
|
293
|
+
});
|
|
294
|
+
// @__NO_SIDE_EFFECTS__
|
|
295
|
+
function cuid2(params) {
|
|
296
|
+
return core._cuid2(exports.YatspMiniCUID2, params);
|
|
297
|
+
}
|
|
298
|
+
exports.YatspMiniULID = core.$constructor("YatspMiniULID", (inst, def) => {
|
|
299
|
+
core.$YatspULID.init(inst, def);
|
|
300
|
+
exports.YatspMiniStringFormat.init(inst, def);
|
|
301
|
+
});
|
|
302
|
+
// @__NO_SIDE_EFFECTS__
|
|
303
|
+
function ulid(params) {
|
|
304
|
+
return core._ulid(exports.YatspMiniULID, params);
|
|
305
|
+
}
|
|
306
|
+
exports.YatspMiniXID = core.$constructor("YatspMiniXID", (inst, def) => {
|
|
307
|
+
core.$YatspXID.init(inst, def);
|
|
308
|
+
exports.YatspMiniStringFormat.init(inst, def);
|
|
309
|
+
});
|
|
310
|
+
// @__NO_SIDE_EFFECTS__
|
|
311
|
+
function xid(params) {
|
|
312
|
+
return core._xid(exports.YatspMiniXID, params);
|
|
313
|
+
}
|
|
314
|
+
exports.YatspMiniKSUID = core.$constructor("YatspMiniKSUID", (inst, def) => {
|
|
315
|
+
core.$YatspKSUID.init(inst, def);
|
|
316
|
+
exports.YatspMiniStringFormat.init(inst, def);
|
|
317
|
+
});
|
|
318
|
+
// @__NO_SIDE_EFFECTS__
|
|
319
|
+
function ksuid(params) {
|
|
320
|
+
return core._ksuid(exports.YatspMiniKSUID, params);
|
|
321
|
+
}
|
|
322
|
+
exports.YatspMiniIPv4 = core.$constructor("YatspMiniIPv4", (inst, def) => {
|
|
323
|
+
core.$YatspIPv4.init(inst, def);
|
|
324
|
+
exports.YatspMiniStringFormat.init(inst, def);
|
|
325
|
+
});
|
|
326
|
+
// @__NO_SIDE_EFFECTS__
|
|
327
|
+
function ipv4(params) {
|
|
328
|
+
return core._ipv4(exports.YatspMiniIPv4, params);
|
|
329
|
+
}
|
|
330
|
+
exports.YatspMiniIPv6 = core.$constructor("YatspMiniIPv6", (inst, def) => {
|
|
331
|
+
core.$YatspIPv6.init(inst, def);
|
|
332
|
+
exports.YatspMiniStringFormat.init(inst, def);
|
|
333
|
+
});
|
|
334
|
+
// @__NO_SIDE_EFFECTS__
|
|
335
|
+
function ipv6(params) {
|
|
336
|
+
return core._ipv6(exports.YatspMiniIPv6, params);
|
|
337
|
+
}
|
|
338
|
+
exports.YatspMiniCIDRv4 = core.$constructor("YatspMiniCIDRv4", (inst, def) => {
|
|
339
|
+
core.$YatspCIDRv4.init(inst, def);
|
|
340
|
+
exports.YatspMiniStringFormat.init(inst, def);
|
|
341
|
+
});
|
|
342
|
+
// @__NO_SIDE_EFFECTS__
|
|
343
|
+
function cidrv4(params) {
|
|
344
|
+
return core._cidrv4(exports.YatspMiniCIDRv4, params);
|
|
345
|
+
}
|
|
346
|
+
exports.YatspMiniCIDRv6 = core.$constructor("YatspMiniCIDRv6", (inst, def) => {
|
|
347
|
+
core.$YatspCIDRv6.init(inst, def);
|
|
348
|
+
exports.YatspMiniStringFormat.init(inst, def);
|
|
349
|
+
});
|
|
350
|
+
// @__NO_SIDE_EFFECTS__
|
|
351
|
+
function cidrv6(params) {
|
|
352
|
+
return core._cidrv6(exports.YatspMiniCIDRv6, params);
|
|
353
|
+
}
|
|
354
|
+
exports.YatspMiniMAC = core.$constructor("YatspMiniMAC", (inst, def) => {
|
|
355
|
+
core.$YatspMAC.init(inst, def);
|
|
356
|
+
exports.YatspMiniStringFormat.init(inst, def);
|
|
357
|
+
});
|
|
358
|
+
// @__NO_SIDE_EFFECTS__
|
|
359
|
+
function mac(params) {
|
|
360
|
+
return core._mac(exports.YatspMiniMAC, params);
|
|
361
|
+
}
|
|
362
|
+
exports.YatspMiniBase64 = core.$constructor("YatspMiniBase64", (inst, def) => {
|
|
363
|
+
core.$YatspBase64.init(inst, def);
|
|
364
|
+
exports.YatspMiniStringFormat.init(inst, def);
|
|
365
|
+
});
|
|
366
|
+
// @__NO_SIDE_EFFECTS__
|
|
367
|
+
function base64(params) {
|
|
368
|
+
return core._base64(exports.YatspMiniBase64, params);
|
|
369
|
+
}
|
|
370
|
+
exports.YatspMiniBase64URL = core.$constructor("YatspMiniBase64URL", (inst, def) => {
|
|
371
|
+
core.$YatspBase64URL.init(inst, def);
|
|
372
|
+
exports.YatspMiniStringFormat.init(inst, def);
|
|
373
|
+
});
|
|
374
|
+
// @__NO_SIDE_EFFECTS__
|
|
375
|
+
function base64url(params) {
|
|
376
|
+
return core._base64url(exports.YatspMiniBase64URL, params);
|
|
377
|
+
}
|
|
378
|
+
exports.YatspMiniE164 = core.$constructor("YatspMiniE164", (inst, def) => {
|
|
379
|
+
core.$YatspE164.init(inst, def);
|
|
380
|
+
exports.YatspMiniStringFormat.init(inst, def);
|
|
381
|
+
});
|
|
382
|
+
// @__NO_SIDE_EFFECTS__
|
|
383
|
+
function e164(params) {
|
|
384
|
+
return core._e164(exports.YatspMiniE164, params);
|
|
385
|
+
}
|
|
386
|
+
exports.YatspMiniCreditCard = core.$constructor("YatspMiniCreditCard", (inst, def) => {
|
|
387
|
+
core.$YatspCreditCard.init(inst, def);
|
|
388
|
+
exports.YatspMiniStringFormat.init(inst, def);
|
|
389
|
+
});
|
|
390
|
+
// @__NO_SIDE_EFFECTS__
|
|
391
|
+
function creditCard(params) {
|
|
392
|
+
return core._creditCard(exports.YatspMiniCreditCard, params);
|
|
393
|
+
}
|
|
394
|
+
exports.YatspMiniIBAN = core.$constructor("YatspMiniIBAN", (inst, def) => {
|
|
395
|
+
core.$YatspIBAN.init(inst, def);
|
|
396
|
+
exports.YatspMiniStringFormat.init(inst, def);
|
|
397
|
+
});
|
|
398
|
+
// @__NO_SIDE_EFFECTS__
|
|
399
|
+
function iban(params) {
|
|
400
|
+
return core._iban(exports.YatspMiniIBAN, params);
|
|
401
|
+
}
|
|
402
|
+
exports.YatspMiniJWT = core.$constructor("YatspMiniJWT", (inst, def) => {
|
|
403
|
+
core.$YatspJWT.init(inst, def);
|
|
404
|
+
exports.YatspMiniStringFormat.init(inst, def);
|
|
405
|
+
});
|
|
406
|
+
// @__NO_SIDE_EFFECTS__
|
|
407
|
+
function jwt(params) {
|
|
408
|
+
return core._jwt(exports.YatspMiniJWT, params);
|
|
409
|
+
}
|
|
410
|
+
exports.YatspMiniCustomStringFormat =
|
|
411
|
+
/*@__PURE__*/ core.$constructor("YatspMiniCustomStringFormat", (inst, def) => {
|
|
412
|
+
core.$YatspCustomStringFormat.init(inst, def);
|
|
413
|
+
exports.YatspMiniStringFormat.init(inst, def);
|
|
414
|
+
});
|
|
415
|
+
// @__NO_SIDE_EFFECTS__
|
|
416
|
+
function stringFormat(format, fnOrRegex, _params = {}) {
|
|
417
|
+
return core._stringFormat(exports.YatspMiniCustomStringFormat, format, fnOrRegex, _params);
|
|
418
|
+
}
|
|
419
|
+
// @__NO_SIDE_EFFECTS__
|
|
420
|
+
function hostname(_params) {
|
|
421
|
+
return core._stringFormat(exports.YatspMiniCustomStringFormat, "hostname", regexes.hostname, _params);
|
|
422
|
+
}
|
|
423
|
+
// @__NO_SIDE_EFFECTS__
|
|
424
|
+
function hex(_params) {
|
|
425
|
+
return core._stringFormat(exports.YatspMiniCustomStringFormat, "hex", regexes.hex, _params);
|
|
426
|
+
}
|
|
427
|
+
// @__NO_SIDE_EFFECTS__
|
|
428
|
+
function currencyCode(_params) {
|
|
429
|
+
return core._stringFormat(exports.YatspMiniCustomStringFormat, "currency_code", regexes.currencyCode, _params);
|
|
430
|
+
}
|
|
431
|
+
// @__NO_SIDE_EFFECTS__
|
|
432
|
+
function hash(alg, params) {
|
|
433
|
+
const enc = params?.enc ?? "hex";
|
|
434
|
+
const format = `${alg}_${enc}`;
|
|
435
|
+
const regex = core.regexes[format];
|
|
436
|
+
// check for unrecognized format
|
|
437
|
+
if (!regex)
|
|
438
|
+
throw new Error(`Unrecognized hash format: ${format}`);
|
|
439
|
+
return core._stringFormat(exports.YatspMiniCustomStringFormat, format, regex, params);
|
|
440
|
+
}
|
|
441
|
+
exports.YatspMiniNumber = core.$constructor("YatspMiniNumber", (inst, def) => {
|
|
442
|
+
core.$YatspNumber.init(inst, def);
|
|
443
|
+
exports.YatspMiniType.init(inst, def);
|
|
444
|
+
});
|
|
445
|
+
// @__NO_SIDE_EFFECTS__
|
|
446
|
+
function number(params) {
|
|
447
|
+
return core._number(exports.YatspMiniNumber, params);
|
|
448
|
+
}
|
|
449
|
+
exports.YatspMiniNumberFormat = core.$constructor("YatspMiniNumberFormat", (inst, def) => {
|
|
450
|
+
core.$YatspNumberFormat.init(inst, def);
|
|
451
|
+
exports.YatspMiniNumber.init(inst, def);
|
|
452
|
+
});
|
|
453
|
+
function int(params) {
|
|
454
|
+
return core._int(exports.YatspMiniNumberFormat, params);
|
|
455
|
+
}
|
|
456
|
+
function float32(params) {
|
|
457
|
+
return core._float32(exports.YatspMiniNumberFormat, params);
|
|
458
|
+
}
|
|
459
|
+
function float64(params) {
|
|
460
|
+
return core._float64(exports.YatspMiniNumberFormat, params);
|
|
461
|
+
}
|
|
462
|
+
function int32(params) {
|
|
463
|
+
return core._int32(exports.YatspMiniNumberFormat, params);
|
|
464
|
+
}
|
|
465
|
+
function uint32(params) {
|
|
466
|
+
return core._uint32(exports.YatspMiniNumberFormat, params);
|
|
467
|
+
}
|
|
468
|
+
exports.YatspMiniBoolean = core.$constructor("YatspMiniBoolean", (inst, def) => {
|
|
469
|
+
core.$YatspBoolean.init(inst, def);
|
|
470
|
+
exports.YatspMiniType.init(inst, def);
|
|
471
|
+
});
|
|
472
|
+
// @__NO_SIDE_EFFECTS__
|
|
473
|
+
function boolean(params) {
|
|
474
|
+
return core._boolean(exports.YatspMiniBoolean, params);
|
|
475
|
+
}
|
|
476
|
+
exports.YatspMiniBigInt = core.$constructor("YatspMiniBigInt", (inst, def) => {
|
|
477
|
+
core.$YatspBigInt.init(inst, def);
|
|
478
|
+
exports.YatspMiniType.init(inst, def);
|
|
479
|
+
});
|
|
480
|
+
// @__NO_SIDE_EFFECTS__
|
|
481
|
+
function bigint(params) {
|
|
482
|
+
return core._bigint(exports.YatspMiniBigInt, params);
|
|
483
|
+
}
|
|
484
|
+
exports.YatspMiniBigIntFormat = core.$constructor("YatspMiniBigIntFormat", (inst, def) => {
|
|
485
|
+
core.$YatspBigIntFormat.init(inst, def);
|
|
486
|
+
exports.YatspMiniBigInt.init(inst, def);
|
|
487
|
+
});
|
|
488
|
+
function int64(params) {
|
|
489
|
+
return core._int64(exports.YatspMiniBigIntFormat, params);
|
|
490
|
+
}
|
|
491
|
+
function uint64(params) {
|
|
492
|
+
return core._uint64(exports.YatspMiniBigIntFormat, params);
|
|
493
|
+
}
|
|
494
|
+
exports.YatspMiniSymbol = core.$constructor("YatspMiniSymbol", (inst, def) => {
|
|
495
|
+
core.$YatspSymbol.init(inst, def);
|
|
496
|
+
exports.YatspMiniType.init(inst, def);
|
|
497
|
+
});
|
|
498
|
+
// @__NO_SIDE_EFFECTS__
|
|
499
|
+
function symbol(params) {
|
|
500
|
+
return core._symbol(exports.YatspMiniSymbol, params);
|
|
501
|
+
}
|
|
502
|
+
exports.YatspMiniUndefined = core.$constructor("YatspMiniUndefined", (inst, def) => {
|
|
503
|
+
core.$YatspUndefined.init(inst, def);
|
|
504
|
+
exports.YatspMiniType.init(inst, def);
|
|
505
|
+
});
|
|
506
|
+
// @__NO_SIDE_EFFECTS__
|
|
507
|
+
function _undefined(params) {
|
|
508
|
+
return core._undefined(exports.YatspMiniUndefined, params);
|
|
509
|
+
}
|
|
510
|
+
exports.YatspMiniNull = core.$constructor("YatspMiniNull", (inst, def) => {
|
|
511
|
+
core.$YatspNull.init(inst, def);
|
|
512
|
+
exports.YatspMiniType.init(inst, def);
|
|
513
|
+
});
|
|
514
|
+
// @__NO_SIDE_EFFECTS__
|
|
515
|
+
function _null(params) {
|
|
516
|
+
return core._null(exports.YatspMiniNull, params);
|
|
517
|
+
}
|
|
518
|
+
exports.YatspMiniAny = core.$constructor("YatspMiniAny", (inst, def) => {
|
|
519
|
+
core.$YatspAny.init(inst, def);
|
|
520
|
+
exports.YatspMiniType.init(inst, def);
|
|
521
|
+
});
|
|
522
|
+
// @__NO_SIDE_EFFECTS__
|
|
523
|
+
function any() {
|
|
524
|
+
return core._any(exports.YatspMiniAny);
|
|
525
|
+
}
|
|
526
|
+
exports.YatspMiniUnknown = core.$constructor("YatspMiniUnknown", (inst, def) => {
|
|
527
|
+
core.$YatspUnknown.init(inst, def);
|
|
528
|
+
exports.YatspMiniType.init(inst, def);
|
|
529
|
+
});
|
|
530
|
+
// @__NO_SIDE_EFFECTS__
|
|
531
|
+
function unknown() {
|
|
532
|
+
return core._unknown(exports.YatspMiniUnknown);
|
|
533
|
+
}
|
|
534
|
+
exports.YatspMiniNever = core.$constructor("YatspMiniNever", (inst, def) => {
|
|
535
|
+
core.$YatspNever.init(inst, def);
|
|
536
|
+
exports.YatspMiniType.init(inst, def);
|
|
537
|
+
});
|
|
538
|
+
// @__NO_SIDE_EFFECTS__
|
|
539
|
+
function never(params) {
|
|
540
|
+
return core._never(exports.YatspMiniNever, params);
|
|
541
|
+
}
|
|
542
|
+
exports.YatspMiniVoid = core.$constructor("YatspMiniVoid", (inst, def) => {
|
|
543
|
+
core.$YatspVoid.init(inst, def);
|
|
544
|
+
exports.YatspMiniType.init(inst, def);
|
|
545
|
+
});
|
|
546
|
+
// @__NO_SIDE_EFFECTS__
|
|
547
|
+
function _void(params) {
|
|
548
|
+
return core._void(exports.YatspMiniVoid, params);
|
|
549
|
+
}
|
|
550
|
+
exports.YatspMiniDate = core.$constructor("YatspMiniDate", (inst, def) => {
|
|
551
|
+
core.$YatspDate.init(inst, def);
|
|
552
|
+
exports.YatspMiniType.init(inst, def);
|
|
553
|
+
});
|
|
554
|
+
// @__NO_SIDE_EFFECTS__
|
|
555
|
+
function date(params) {
|
|
556
|
+
return core._date(exports.YatspMiniDate, params);
|
|
557
|
+
}
|
|
558
|
+
exports.YatspMiniArray = core.$constructor("YatspMiniArray", (inst, def) => {
|
|
559
|
+
core.$YatspArray.init(inst, def);
|
|
560
|
+
exports.YatspMiniType.init(inst, def);
|
|
561
|
+
});
|
|
562
|
+
// @__NO_SIDE_EFFECTS__
|
|
563
|
+
function array(element, params) {
|
|
564
|
+
return new exports.YatspMiniArray({
|
|
565
|
+
type: "array",
|
|
566
|
+
element: element,
|
|
567
|
+
...util.normalizeParams(params),
|
|
568
|
+
});
|
|
569
|
+
}
|
|
570
|
+
// .keyof
|
|
571
|
+
// @__NO_SIDE_EFFECTS__
|
|
572
|
+
function keyof(schema) {
|
|
573
|
+
const shape = schema._yatsp.def.shape;
|
|
574
|
+
return _enum(Object.keys(shape));
|
|
575
|
+
}
|
|
576
|
+
exports.YatspMiniObject = core.$constructor("YatspMiniObject", (inst, def) => {
|
|
577
|
+
core.$YatspObject.init(inst, def);
|
|
578
|
+
exports.YatspMiniType.init(inst, def);
|
|
579
|
+
util.installLazyProp(inst, "shape", (self) => self._yatsp.def.shape, false);
|
|
580
|
+
});
|
|
581
|
+
// @__NO_SIDE_EFFECTS__
|
|
582
|
+
function object(shape, params) {
|
|
583
|
+
const def = {
|
|
584
|
+
type: "object",
|
|
585
|
+
shape: shape ?? {},
|
|
586
|
+
...util.normalizeParams(params),
|
|
587
|
+
};
|
|
588
|
+
return new exports.YatspMiniObject(def);
|
|
589
|
+
}
|
|
590
|
+
// strictObject
|
|
591
|
+
// @__NO_SIDE_EFFECTS__
|
|
592
|
+
function strictObject(shape, params) {
|
|
593
|
+
return new exports.YatspMiniObject({
|
|
594
|
+
type: "object",
|
|
595
|
+
shape,
|
|
596
|
+
catchall: never(),
|
|
597
|
+
...util.normalizeParams(params),
|
|
598
|
+
});
|
|
599
|
+
}
|
|
600
|
+
// looseObject
|
|
601
|
+
// @__NO_SIDE_EFFECTS__
|
|
602
|
+
function looseObject(shape, params) {
|
|
603
|
+
return new exports.YatspMiniObject({
|
|
604
|
+
type: "object",
|
|
605
|
+
shape,
|
|
606
|
+
catchall: unknown(),
|
|
607
|
+
...util.normalizeParams(params),
|
|
608
|
+
});
|
|
609
|
+
}
|
|
610
|
+
// object methods
|
|
611
|
+
// @__NO_SIDE_EFFECTS__
|
|
612
|
+
function extend(schema, shape) {
|
|
613
|
+
return util.extend(schema, shape);
|
|
614
|
+
}
|
|
615
|
+
// @__NO_SIDE_EFFECTS__
|
|
616
|
+
function safeExtend(schema, shape) {
|
|
617
|
+
return util.safeExtend(schema, shape);
|
|
618
|
+
}
|
|
619
|
+
/**
|
|
620
|
+
* @deprecated Use [`z.extend(A, B.shape)`](https://yatsp.dev/api?id=extend) instead.
|
|
621
|
+
*/
|
|
622
|
+
// @__NO_SIDE_EFFECTS__
|
|
623
|
+
function merge(a, b) {
|
|
624
|
+
return util.merge(a, b);
|
|
625
|
+
}
|
|
626
|
+
// @__NO_SIDE_EFFECTS__
|
|
627
|
+
function pick(schema, mask) {
|
|
628
|
+
return util.pick(schema, mask);
|
|
629
|
+
}
|
|
630
|
+
// .omit
|
|
631
|
+
// @__NO_SIDE_EFFECTS__
|
|
632
|
+
function omit(schema, mask) {
|
|
633
|
+
return util.omit(schema, mask);
|
|
634
|
+
}
|
|
635
|
+
// @__NO_SIDE_EFFECTS__
|
|
636
|
+
function partial(schema, mask) {
|
|
637
|
+
const def = schema._yatsp.def;
|
|
638
|
+
if (def.type !== "tuple")
|
|
639
|
+
return util.partial(exports.YatspMiniOptional, schema, mask);
|
|
640
|
+
// a refinement was authored against the full arity; partialing would run it on a shorter array
|
|
641
|
+
if (def.checks?.length)
|
|
642
|
+
throw new Error(".partial() cannot be used on tuple schemas containing refinements");
|
|
643
|
+
return util.clone(schema, {
|
|
644
|
+
...def,
|
|
645
|
+
items: def.items.map((item) => new exports.YatspMiniOptional({ type: "optional", innerType: item })),
|
|
646
|
+
});
|
|
647
|
+
}
|
|
648
|
+
// @__NO_SIDE_EFFECTS__
|
|
649
|
+
function exactPartial(schema, mask) {
|
|
650
|
+
return util.partial(exports.YatspMiniExactOptional, schema, mask, "exactPartial");
|
|
651
|
+
}
|
|
652
|
+
// @__NO_SIDE_EFFECTS__
|
|
653
|
+
function required(schema, mask) {
|
|
654
|
+
return util.required(exports.YatspMiniNonOptional, schema, mask);
|
|
655
|
+
}
|
|
656
|
+
// @__NO_SIDE_EFFECTS__
|
|
657
|
+
function catchall(inst, catchall) {
|
|
658
|
+
// `mergeDefs` rather than a spread: spreading reads `shape`, and resolving it can mint a whole fresh subtree
|
|
659
|
+
return inst.clone(util.mergeDefs(inst._yatsp.def, { catchall: catchall }));
|
|
660
|
+
}
|
|
661
|
+
exports.YatspMiniUnion = core.$constructor("YatspMiniUnion", (inst, def) => {
|
|
662
|
+
core.$YatspUnion.init(inst, def);
|
|
663
|
+
exports.YatspMiniType.init(inst, def);
|
|
664
|
+
});
|
|
665
|
+
// @__NO_SIDE_EFFECTS__
|
|
666
|
+
function union(options, params) {
|
|
667
|
+
return new exports.YatspMiniUnion({
|
|
668
|
+
type: "union",
|
|
669
|
+
options: options,
|
|
670
|
+
...util.normalizeParams(params),
|
|
671
|
+
});
|
|
672
|
+
}
|
|
673
|
+
exports.YatspMiniXor = core.$constructor("YatspMiniXor", (inst, def) => {
|
|
674
|
+
exports.YatspMiniUnion.init(inst, def);
|
|
675
|
+
core.$YatspXor.init(inst, def);
|
|
676
|
+
});
|
|
677
|
+
/** Creates an exclusive union (XOR) where exactly one option must match.
|
|
678
|
+
* Unlike regular unions that succeed when any option matches, xor fails if
|
|
679
|
+
* zero or more than one option matches the input. */
|
|
680
|
+
function xor(options, params) {
|
|
681
|
+
return new exports.YatspMiniXor({
|
|
682
|
+
type: "union",
|
|
683
|
+
options: options,
|
|
684
|
+
inclusive: false,
|
|
685
|
+
...util.normalizeParams(params),
|
|
686
|
+
});
|
|
687
|
+
}
|
|
688
|
+
exports.YatspMiniDiscriminatedUnion =
|
|
689
|
+
/*@__PURE__*/ core.$constructor("YatspMiniDiscriminatedUnion", (inst, def) => {
|
|
690
|
+
core.$YatspDiscriminatedUnion.init(inst, def);
|
|
691
|
+
exports.YatspMiniType.init(inst, def);
|
|
692
|
+
});
|
|
693
|
+
// @__NO_SIDE_EFFECTS__
|
|
694
|
+
function discriminatedUnion(discriminator, options, params) {
|
|
695
|
+
return new exports.YatspMiniDiscriminatedUnion({
|
|
696
|
+
type: "union",
|
|
697
|
+
options: options,
|
|
698
|
+
discriminator,
|
|
699
|
+
...util.normalizeParams(params),
|
|
700
|
+
});
|
|
701
|
+
}
|
|
702
|
+
exports.YatspMiniIntersection = core.$constructor("YatspMiniIntersection", (inst, def) => {
|
|
703
|
+
core.$YatspIntersection.init(inst, def);
|
|
704
|
+
exports.YatspMiniType.init(inst, def);
|
|
705
|
+
});
|
|
706
|
+
// @__NO_SIDE_EFFECTS__
|
|
707
|
+
function intersection(left, right) {
|
|
708
|
+
return new exports.YatspMiniIntersection({
|
|
709
|
+
type: "intersection",
|
|
710
|
+
left: left,
|
|
711
|
+
right: right,
|
|
712
|
+
});
|
|
713
|
+
}
|
|
714
|
+
exports.YatspMiniTuple = core.$constructor("YatspMiniTuple", (inst, def) => {
|
|
715
|
+
core.$YatspTuple.init(inst, def);
|
|
716
|
+
exports.YatspMiniType.init(inst, def);
|
|
717
|
+
});
|
|
718
|
+
// @__NO_SIDE_EFFECTS__
|
|
719
|
+
function tuple(items, _paramsOrRest, _params) {
|
|
720
|
+
const hasRest = _paramsOrRest instanceof core.$YatspType;
|
|
721
|
+
const params = hasRest ? _params : _paramsOrRest;
|
|
722
|
+
const rest = hasRest ? _paramsOrRest : null;
|
|
723
|
+
return new exports.YatspMiniTuple({
|
|
724
|
+
type: "tuple",
|
|
725
|
+
items: items,
|
|
726
|
+
rest,
|
|
727
|
+
...util.normalizeParams(params),
|
|
728
|
+
});
|
|
729
|
+
}
|
|
730
|
+
exports.YatspMiniRecord = core.$constructor("YatspMiniRecord", (inst, def) => {
|
|
731
|
+
core.$YatspRecord.init(inst, def);
|
|
732
|
+
exports.YatspMiniType.init(inst, def);
|
|
733
|
+
});
|
|
734
|
+
// @__NO_SIDE_EFFECTS__
|
|
735
|
+
function record(keyType, valueType, params) {
|
|
736
|
+
// v3-compat: z.record(valueType, params?) — defaults keyType to z.string()
|
|
737
|
+
if (!valueType || !valueType._yatsp) {
|
|
738
|
+
return new exports.YatspMiniRecord({
|
|
739
|
+
type: "record",
|
|
740
|
+
keyType: string(),
|
|
741
|
+
valueType: keyType,
|
|
742
|
+
...util.normalizeParams(valueType),
|
|
743
|
+
});
|
|
744
|
+
}
|
|
745
|
+
return new exports.YatspMiniRecord({
|
|
746
|
+
type: "record",
|
|
747
|
+
keyType,
|
|
748
|
+
valueType: valueType,
|
|
749
|
+
...util.normalizeParams(params),
|
|
750
|
+
});
|
|
751
|
+
}
|
|
752
|
+
// @__NO_SIDE_EFFECTS__
|
|
753
|
+
function partialRecord(keyType, valueType, params) {
|
|
754
|
+
return new exports.YatspMiniRecord({
|
|
755
|
+
type: "record",
|
|
756
|
+
keyType,
|
|
757
|
+
valueType: valueType,
|
|
758
|
+
...util.normalizeParams(params),
|
|
759
|
+
partial: true,
|
|
760
|
+
});
|
|
761
|
+
}
|
|
762
|
+
function looseRecord(keyType, valueType, params) {
|
|
763
|
+
return new exports.YatspMiniRecord({
|
|
764
|
+
type: "record",
|
|
765
|
+
keyType,
|
|
766
|
+
valueType: valueType,
|
|
767
|
+
mode: "loose",
|
|
768
|
+
...util.normalizeParams(params),
|
|
769
|
+
});
|
|
770
|
+
}
|
|
771
|
+
exports.YatspMiniMap = core.$constructor("YatspMiniMap", (inst, def) => {
|
|
772
|
+
core.$YatspMap.init(inst, def);
|
|
773
|
+
exports.YatspMiniType.init(inst, def);
|
|
774
|
+
});
|
|
775
|
+
// @__NO_SIDE_EFFECTS__
|
|
776
|
+
function map(keyType, valueType, params) {
|
|
777
|
+
return new exports.YatspMiniMap({
|
|
778
|
+
type: "map",
|
|
779
|
+
keyType: keyType,
|
|
780
|
+
valueType: valueType,
|
|
781
|
+
...util.normalizeParams(params),
|
|
782
|
+
});
|
|
783
|
+
}
|
|
784
|
+
exports.YatspMiniSet = core.$constructor("YatspMiniSet", (inst, def) => {
|
|
785
|
+
core.$YatspSet.init(inst, def);
|
|
786
|
+
exports.YatspMiniType.init(inst, def);
|
|
787
|
+
});
|
|
788
|
+
// @__NO_SIDE_EFFECTS__
|
|
789
|
+
function set(valueType, params) {
|
|
790
|
+
return new exports.YatspMiniSet({
|
|
791
|
+
type: "set",
|
|
792
|
+
valueType: valueType,
|
|
793
|
+
...util.normalizeParams(params),
|
|
794
|
+
});
|
|
795
|
+
}
|
|
796
|
+
exports.YatspMiniEnum = core.$constructor("YatspMiniEnum", (inst, def) => {
|
|
797
|
+
core.$YatspEnum.init(inst, def);
|
|
798
|
+
exports.YatspMiniType.init(inst, def);
|
|
799
|
+
// reuse the parsed value set so a numeric TS enum's reverse-mapping keys stay out
|
|
800
|
+
inst.options = [...inst._yatsp.values];
|
|
801
|
+
});
|
|
802
|
+
// @__NO_SIDE_EFFECTS__
|
|
803
|
+
function _enum(values, params) {
|
|
804
|
+
const entries = Array.isArray(values) ? Object.fromEntries(values.map((v) => [v, v])) : values;
|
|
805
|
+
return new exports.YatspMiniEnum({
|
|
806
|
+
type: "enum",
|
|
807
|
+
entries,
|
|
808
|
+
...util.normalizeParams(params),
|
|
809
|
+
});
|
|
810
|
+
}
|
|
811
|
+
// @__NO_SIDE_EFFECTS__
|
|
812
|
+
/** @deprecated This API has been merged into `z.enum()`. Use `z.enum()` instead.
|
|
813
|
+
*
|
|
814
|
+
* ```ts
|
|
815
|
+
* enum Colors { red, green, blue }
|
|
816
|
+
* z.enum(Colors);
|
|
817
|
+
* ```
|
|
818
|
+
*/
|
|
819
|
+
function nativeEnum(entries, params) {
|
|
820
|
+
return new exports.YatspMiniEnum({
|
|
821
|
+
type: "enum",
|
|
822
|
+
entries,
|
|
823
|
+
...util.normalizeParams(params),
|
|
824
|
+
});
|
|
825
|
+
}
|
|
826
|
+
exports.YatspMiniLiteral = core.$constructor("YatspMiniLiteral", (inst, def) => {
|
|
827
|
+
core.$YatspLiteral.init(inst, def);
|
|
828
|
+
exports.YatspMiniType.init(inst, def);
|
|
829
|
+
});
|
|
830
|
+
// @__NO_SIDE_EFFECTS__
|
|
831
|
+
function literal(value, params) {
|
|
832
|
+
return new exports.YatspMiniLiteral({
|
|
833
|
+
type: "literal",
|
|
834
|
+
values: Array.isArray(value) ? value : [value],
|
|
835
|
+
...util.normalizeParams(params),
|
|
836
|
+
});
|
|
837
|
+
}
|
|
838
|
+
exports.YatspMiniFile = core.$constructor("YatspMiniFile", (inst, def) => {
|
|
839
|
+
core.$YatspFile.init(inst, def);
|
|
840
|
+
exports.YatspMiniType.init(inst, def);
|
|
841
|
+
});
|
|
842
|
+
// @__NO_SIDE_EFFECTS__
|
|
843
|
+
function file(params) {
|
|
844
|
+
return core._file(exports.YatspMiniFile, params);
|
|
845
|
+
}
|
|
846
|
+
exports.YatspMiniTransform = core.$constructor("YatspMiniTransform", (inst, def) => {
|
|
847
|
+
core.$YatspTransform.init(inst, def);
|
|
848
|
+
exports.YatspMiniType.init(inst, def);
|
|
849
|
+
});
|
|
850
|
+
// @__NO_SIDE_EFFECTS__
|
|
851
|
+
function transform(fn) {
|
|
852
|
+
return new exports.YatspMiniTransform({
|
|
853
|
+
type: "transform",
|
|
854
|
+
transform: fn,
|
|
855
|
+
});
|
|
856
|
+
}
|
|
857
|
+
exports.YatspMiniOptional = core.$constructor("YatspMiniOptional", (inst, def) => {
|
|
858
|
+
core.$YatspOptional.init(inst, def);
|
|
859
|
+
exports.YatspMiniType.init(inst, def);
|
|
860
|
+
});
|
|
861
|
+
// @__NO_SIDE_EFFECTS__
|
|
862
|
+
function optional(innerType) {
|
|
863
|
+
return new exports.YatspMiniOptional({
|
|
864
|
+
type: "optional",
|
|
865
|
+
innerType: innerType,
|
|
866
|
+
});
|
|
867
|
+
}
|
|
868
|
+
exports.YatspMiniExactOptional = core.$constructor("YatspMiniExactOptional", (inst, def) => {
|
|
869
|
+
core.$YatspExactOptional.init(inst, def);
|
|
870
|
+
exports.YatspMiniType.init(inst, def);
|
|
871
|
+
});
|
|
872
|
+
// @__NO_SIDE_EFFECTS__
|
|
873
|
+
function exactOptional(innerType) {
|
|
874
|
+
return new exports.YatspMiniExactOptional({
|
|
875
|
+
type: "optional",
|
|
876
|
+
innerType: innerType,
|
|
877
|
+
});
|
|
878
|
+
}
|
|
879
|
+
exports.YatspMiniNullable = core.$constructor("YatspMiniNullable", (inst, def) => {
|
|
880
|
+
core.$YatspNullable.init(inst, def);
|
|
881
|
+
exports.YatspMiniType.init(inst, def);
|
|
882
|
+
});
|
|
883
|
+
// @__NO_SIDE_EFFECTS__
|
|
884
|
+
function nullable(innerType) {
|
|
885
|
+
return new exports.YatspMiniNullable({
|
|
886
|
+
type: "nullable",
|
|
887
|
+
innerType: innerType,
|
|
888
|
+
});
|
|
889
|
+
}
|
|
890
|
+
// nullish
|
|
891
|
+
// @__NO_SIDE_EFFECTS__
|
|
892
|
+
function nullish(innerType) {
|
|
893
|
+
return optional(nullable(innerType));
|
|
894
|
+
}
|
|
895
|
+
exports.YatspMiniDefault = core.$constructor("YatspMiniDefault", (inst, def) => {
|
|
896
|
+
core.$YatspDefault.init(inst, def);
|
|
897
|
+
exports.YatspMiniType.init(inst, def);
|
|
898
|
+
});
|
|
899
|
+
// @__NO_SIDE_EFFECTS__
|
|
900
|
+
function _default(innerType, defaultValue) {
|
|
901
|
+
return new exports.YatspMiniDefault({
|
|
902
|
+
type: "default",
|
|
903
|
+
innerType: innerType,
|
|
904
|
+
get defaultValue() {
|
|
905
|
+
return typeof defaultValue === "function" ? defaultValue() : util.shallowClone(defaultValue);
|
|
906
|
+
},
|
|
907
|
+
});
|
|
908
|
+
}
|
|
909
|
+
exports.YatspMiniPrefault = core.$constructor("YatspMiniPrefault", (inst, def) => {
|
|
910
|
+
core.$YatspPrefault.init(inst, def);
|
|
911
|
+
exports.YatspMiniType.init(inst, def);
|
|
912
|
+
});
|
|
913
|
+
// @__NO_SIDE_EFFECTS__
|
|
914
|
+
function prefault(innerType, defaultValue) {
|
|
915
|
+
return new exports.YatspMiniPrefault({
|
|
916
|
+
type: "prefault",
|
|
917
|
+
innerType: innerType,
|
|
918
|
+
get defaultValue() {
|
|
919
|
+
return typeof defaultValue === "function" ? defaultValue() : util.shallowClone(defaultValue);
|
|
920
|
+
},
|
|
921
|
+
});
|
|
922
|
+
}
|
|
923
|
+
exports.YatspMiniNonOptional = core.$constructor("YatspMiniNonOptional", (inst, def) => {
|
|
924
|
+
core.$YatspNonOptional.init(inst, def);
|
|
925
|
+
exports.YatspMiniType.init(inst, def);
|
|
926
|
+
});
|
|
927
|
+
// @__NO_SIDE_EFFECTS__
|
|
928
|
+
function nonoptional(innerType, params) {
|
|
929
|
+
return new exports.YatspMiniNonOptional({
|
|
930
|
+
type: "nonoptional",
|
|
931
|
+
innerType: innerType,
|
|
932
|
+
...util.normalizeParams(params),
|
|
933
|
+
});
|
|
934
|
+
}
|
|
935
|
+
exports.YatspMiniSuccess = core.$constructor("YatspMiniSuccess", (inst, def) => {
|
|
936
|
+
core.$YatspSuccess.init(inst, def);
|
|
937
|
+
exports.YatspMiniType.init(inst, def);
|
|
938
|
+
});
|
|
939
|
+
// @__NO_SIDE_EFFECTS__
|
|
940
|
+
function success(innerType) {
|
|
941
|
+
return new exports.YatspMiniSuccess({
|
|
942
|
+
type: "success",
|
|
943
|
+
innerType: innerType,
|
|
944
|
+
});
|
|
945
|
+
}
|
|
946
|
+
exports.YatspMiniCatch = core.$constructor("YatspMiniCatch", (inst, def) => {
|
|
947
|
+
core.$YatspCatch.init(inst, def);
|
|
948
|
+
exports.YatspMiniType.init(inst, def);
|
|
949
|
+
});
|
|
950
|
+
// @__NO_SIDE_EFFECTS__
|
|
951
|
+
function _catch(innerType, catchValue) {
|
|
952
|
+
return new exports.YatspMiniCatch({
|
|
953
|
+
type: "catch",
|
|
954
|
+
innerType: innerType,
|
|
955
|
+
catchValue: (typeof catchValue === "function" ? catchValue : core.util.constantCatch(catchValue)),
|
|
956
|
+
});
|
|
957
|
+
}
|
|
958
|
+
exports.YatspMiniNaN = core.$constructor("YatspMiniNaN", (inst, def) => {
|
|
959
|
+
core.$YatspNaN.init(inst, def);
|
|
960
|
+
exports.YatspMiniType.init(inst, def);
|
|
961
|
+
});
|
|
962
|
+
// @__NO_SIDE_EFFECTS__
|
|
963
|
+
function nan(params) {
|
|
964
|
+
return core._nan(exports.YatspMiniNaN, params);
|
|
965
|
+
}
|
|
966
|
+
exports.YatspMiniPipe = core.$constructor("YatspMiniPipe", (inst, def) => {
|
|
967
|
+
core.$YatspPipe.init(inst, def);
|
|
968
|
+
exports.YatspMiniType.init(inst, def);
|
|
969
|
+
});
|
|
970
|
+
// @__NO_SIDE_EFFECTS__
|
|
971
|
+
function pipe(in_, out) {
|
|
972
|
+
return new exports.YatspMiniPipe({
|
|
973
|
+
type: "pipe",
|
|
974
|
+
in: in_,
|
|
975
|
+
out: out,
|
|
976
|
+
});
|
|
977
|
+
}
|
|
978
|
+
exports.YatspMiniCodec = core.$constructor("YatspMiniCodec", (inst, def) => {
|
|
979
|
+
exports.YatspMiniPipe.init(inst, def);
|
|
980
|
+
core.$YatspCodec.init(inst, def);
|
|
981
|
+
});
|
|
982
|
+
// @__NO_SIDE_EFFECTS__
|
|
983
|
+
function codec(in_, out, params) {
|
|
984
|
+
return new exports.YatspMiniCodec({
|
|
985
|
+
type: "pipe",
|
|
986
|
+
in: in_,
|
|
987
|
+
out: out,
|
|
988
|
+
transform: params.decode,
|
|
989
|
+
reverseTransform: params.encode,
|
|
990
|
+
});
|
|
991
|
+
}
|
|
992
|
+
// @__NO_SIDE_EFFECTS__
|
|
993
|
+
function invertCodec(codec) {
|
|
994
|
+
const def = codec._yatsp.def;
|
|
995
|
+
return new exports.YatspMiniCodec({
|
|
996
|
+
type: "pipe",
|
|
997
|
+
in: def.out,
|
|
998
|
+
out: def.in,
|
|
999
|
+
transform: def.reverseTransform,
|
|
1000
|
+
reverseTransform: def.transform,
|
|
1001
|
+
});
|
|
1002
|
+
}
|
|
1003
|
+
exports.YatspMiniReadonly = core.$constructor("YatspMiniReadonly", (inst, def) => {
|
|
1004
|
+
core.$YatspReadonly.init(inst, def);
|
|
1005
|
+
exports.YatspMiniType.init(inst, def);
|
|
1006
|
+
});
|
|
1007
|
+
// @__NO_SIDE_EFFECTS__
|
|
1008
|
+
function readonly(innerType) {
|
|
1009
|
+
return new exports.YatspMiniReadonly({
|
|
1010
|
+
type: "readonly",
|
|
1011
|
+
innerType: innerType,
|
|
1012
|
+
});
|
|
1013
|
+
}
|
|
1014
|
+
exports.YatspMiniTemplateLiteral = core.$constructor("YatspMiniTemplateLiteral", (inst, def) => {
|
|
1015
|
+
core.$YatspTemplateLiteral.init(inst, def);
|
|
1016
|
+
exports.YatspMiniType.init(inst, def);
|
|
1017
|
+
});
|
|
1018
|
+
// @__NO_SIDE_EFFECTS__
|
|
1019
|
+
function templateLiteral(parts, params) {
|
|
1020
|
+
return new exports.YatspMiniTemplateLiteral({
|
|
1021
|
+
type: "template_literal",
|
|
1022
|
+
parts,
|
|
1023
|
+
...util.normalizeParams(params),
|
|
1024
|
+
});
|
|
1025
|
+
}
|
|
1026
|
+
exports.YatspMiniLazy = core.$constructor("YatspMiniLazy", (inst, def) => {
|
|
1027
|
+
core.$YatspLazy.init(inst, def);
|
|
1028
|
+
exports.YatspMiniType.init(inst, def);
|
|
1029
|
+
});
|
|
1030
|
+
// export function lazy<T extends object>(getter: () => T): T {
|
|
1031
|
+
// return util.createTransparentProxy<T>(getter);
|
|
1032
|
+
// }
|
|
1033
|
+
// @__NO_SIDE_EFFECTS__
|
|
1034
|
+
function _lazy(getter) {
|
|
1035
|
+
return new exports.YatspMiniLazy({
|
|
1036
|
+
type: "lazy",
|
|
1037
|
+
getter: getter,
|
|
1038
|
+
});
|
|
1039
|
+
}
|
|
1040
|
+
exports.YatspMiniPromise = core.$constructor("YatspMiniPromise", (inst, def) => {
|
|
1041
|
+
core.$YatspPromise.init(inst, def);
|
|
1042
|
+
exports.YatspMiniType.init(inst, def);
|
|
1043
|
+
});
|
|
1044
|
+
// @__NO_SIDE_EFFECTS__
|
|
1045
|
+
function promise(innerType) {
|
|
1046
|
+
return new exports.YatspMiniPromise({
|
|
1047
|
+
type: "promise",
|
|
1048
|
+
innerType: innerType,
|
|
1049
|
+
});
|
|
1050
|
+
}
|
|
1051
|
+
exports.YatspMiniCustom = core.$constructor("YatspMiniCustom", (inst, def) => {
|
|
1052
|
+
core.$YatspCustom.init(inst, def);
|
|
1053
|
+
exports.YatspMiniType.init(inst, def);
|
|
1054
|
+
});
|
|
1055
|
+
// custom checks
|
|
1056
|
+
// @__NO_SIDE_EFFECTS__
|
|
1057
|
+
function check(fn, params) {
|
|
1058
|
+
const ch = new core.$YatspCheck({
|
|
1059
|
+
check: "custom",
|
|
1060
|
+
...util.normalizeParams(params),
|
|
1061
|
+
});
|
|
1062
|
+
ch._yatsp.check = fn;
|
|
1063
|
+
return ch;
|
|
1064
|
+
}
|
|
1065
|
+
// YatspCustom custom schema
|
|
1066
|
+
// @__NO_SIDE_EFFECTS__
|
|
1067
|
+
function custom(fn, _params) {
|
|
1068
|
+
return core._custom(exports.YatspMiniCustom, fn ?? (() => true), _params);
|
|
1069
|
+
}
|
|
1070
|
+
// refine
|
|
1071
|
+
// @__NO_SIDE_EFFECTS__
|
|
1072
|
+
function refine(fn, _params = {}) {
|
|
1073
|
+
return core._refine(exports.YatspMiniCustom, fn, _params);
|
|
1074
|
+
}
|
|
1075
|
+
// superRefine
|
|
1076
|
+
// @__NO_SIDE_EFFECTS__
|
|
1077
|
+
function superRefine(fn, params) {
|
|
1078
|
+
return core._superRefine(fn, params);
|
|
1079
|
+
}
|
|
1080
|
+
// Re-export describe and meta from core
|
|
1081
|
+
exports.describe = core.describe;
|
|
1082
|
+
exports.meta = core.meta;
|
|
1083
|
+
// instanceof
|
|
1084
|
+
class Class {
|
|
1085
|
+
constructor(..._args) { }
|
|
1086
|
+
}
|
|
1087
|
+
// @__NO_SIDE_EFFECTS__
|
|
1088
|
+
function _instanceof(cls, params = {}) {
|
|
1089
|
+
const inst = custom((data) => data instanceof cls, params);
|
|
1090
|
+
inst._yatsp.bag.Class = cls;
|
|
1091
|
+
// Override check to emit invalid_type instead of custom
|
|
1092
|
+
inst._yatsp.check = (payload) => {
|
|
1093
|
+
if (!(payload.value instanceof cls)) {
|
|
1094
|
+
payload.issues.push({
|
|
1095
|
+
code: "invalid_type",
|
|
1096
|
+
expected: cls.name,
|
|
1097
|
+
input: payload.value,
|
|
1098
|
+
inst,
|
|
1099
|
+
path: [...(inst._yatsp.def.path ?? [])],
|
|
1100
|
+
});
|
|
1101
|
+
}
|
|
1102
|
+
};
|
|
1103
|
+
return inst;
|
|
1104
|
+
}
|
|
1105
|
+
// stringbool
|
|
1106
|
+
const stringbool = (...args) => core._stringbool({
|
|
1107
|
+
Codec: exports.YatspMiniCodec,
|
|
1108
|
+
Boolean: exports.YatspMiniBoolean,
|
|
1109
|
+
String: exports.YatspMiniString,
|
|
1110
|
+
}, ...args);
|
|
1111
|
+
exports.stringbool = stringbool;
|
|
1112
|
+
// @__NO_SIDE_EFFECTS__
|
|
1113
|
+
function json() {
|
|
1114
|
+
const jsonSchema = _lazy(() => {
|
|
1115
|
+
return union([string(), number(), boolean(), _null(), array(jsonSchema), record(string(), jsonSchema)]);
|
|
1116
|
+
});
|
|
1117
|
+
return jsonSchema;
|
|
1118
|
+
}
|
|
1119
|
+
exports.YatspMiniFunction = core.$constructor("YatspMiniFunction", (inst, def) => {
|
|
1120
|
+
core.$YatspFunction.init(inst, def);
|
|
1121
|
+
exports.YatspMiniType.init(inst, def);
|
|
1122
|
+
});
|
|
1123
|
+
// @__NO_SIDE_EFFECTS__
|
|
1124
|
+
function _function(params) {
|
|
1125
|
+
return new exports.YatspMiniFunction({
|
|
1126
|
+
type: "function",
|
|
1127
|
+
input: Array.isArray(params?.input) ? tuple(params?.input) : (params?.input ?? array(unknown())),
|
|
1128
|
+
output: params?.output ?? unknown(),
|
|
1129
|
+
});
|
|
1130
|
+
}
|
|
1131
|
+
|
|
1132
|
+
// seal-cjs-exports
|
|
1133
|
+
(function () {
|
|
1134
|
+
var keys = Object.getOwnPropertyNames(exports);
|
|
1135
|
+
for (var i = 0; i < keys.length; i++) {
|
|
1136
|
+
var desc = Object.getOwnPropertyDescriptor(exports, keys[i]);
|
|
1137
|
+
if (!desc || !desc.get || !desc.configurable) continue;
|
|
1138
|
+
var value;
|
|
1139
|
+
try {
|
|
1140
|
+
value = desc.get();
|
|
1141
|
+
} catch (e) {
|
|
1142
|
+
continue;
|
|
1143
|
+
}
|
|
1144
|
+
// a circular require may not have settled this one yet, so leave it live
|
|
1145
|
+
if (value === undefined) continue;
|
|
1146
|
+
Object.defineProperty(exports, keys[i], { value: value, writable: false, enumerable: desc.enumerable, configurable: false });
|
|
1147
|
+
}
|
|
1148
|
+
Object.freeze(exports);
|
|
1149
|
+
})();
|