bguard 0.5.0 → 0.7.0
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 +643 -7
- package/lib/InferType.d.mts +37 -3
- package/lib/InferType.d.ts +37 -3
- package/lib/asserts/array/index.d.mts +8 -3
- package/lib/asserts/array/index.d.ts +8 -3
- package/lib/asserts/array/index.js +6 -12
- package/lib/asserts/array/index.js.map +1 -1
- package/lib/asserts/array/index.mjs +6 -12
- package/lib/asserts/array/index.mjs.map +1 -1
- package/lib/asserts/array/maxArrayLength.d.mts +5 -2
- package/lib/asserts/array/maxArrayLength.d.ts +5 -2
- package/lib/asserts/array/maxArrayLength.js +5 -13
- package/lib/asserts/array/maxArrayLength.js.map +1 -1
- package/lib/asserts/array/maxArrayLength.mjs +5 -13
- package/lib/asserts/array/maxArrayLength.mjs.map +1 -1
- package/lib/asserts/array/minArrayLength.d.mts +5 -2
- package/lib/asserts/array/minArrayLength.d.ts +5 -2
- package/lib/asserts/array/minArrayLength.js +5 -13
- package/lib/asserts/array/minArrayLength.js.map +1 -1
- package/lib/asserts/array/minArrayLength.mjs +5 -13
- package/lib/asserts/array/minArrayLength.mjs.map +1 -1
- package/lib/asserts/bigint/bigintMax.d.mts +5 -2
- package/lib/asserts/bigint/bigintMax.d.ts +5 -2
- package/lib/asserts/bigint/bigintMax.js +4 -13
- package/lib/asserts/bigint/bigintMax.js.map +1 -1
- package/lib/asserts/bigint/bigintMax.mjs +4 -13
- package/lib/asserts/bigint/bigintMax.mjs.map +1 -1
- package/lib/asserts/bigint/bigintMaxExcluded.d.mts +5 -2
- package/lib/asserts/bigint/bigintMaxExcluded.d.ts +5 -2
- package/lib/asserts/bigint/bigintMaxExcluded.js +4 -13
- package/lib/asserts/bigint/bigintMaxExcluded.js.map +1 -1
- package/lib/asserts/bigint/bigintMaxExcluded.mjs +4 -13
- package/lib/asserts/bigint/bigintMaxExcluded.mjs.map +1 -1
- package/lib/asserts/bigint/bigintMin.d.mts +5 -2
- package/lib/asserts/bigint/bigintMin.d.ts +5 -2
- package/lib/asserts/bigint/bigintMin.js +4 -13
- package/lib/asserts/bigint/bigintMin.js.map +1 -1
- package/lib/asserts/bigint/bigintMin.mjs +4 -13
- package/lib/asserts/bigint/bigintMin.mjs.map +1 -1
- package/lib/asserts/bigint/bigintMinExcluded.d.mts +5 -2
- package/lib/asserts/bigint/bigintMinExcluded.d.ts +5 -2
- package/lib/asserts/bigint/bigintMinExcluded.js +4 -13
- package/lib/asserts/bigint/bigintMinExcluded.js.map +1 -1
- package/lib/asserts/bigint/bigintMinExcluded.mjs +4 -13
- package/lib/asserts/bigint/bigintMinExcluded.mjs.map +1 -1
- package/lib/asserts/bigint/index.d.mts +35 -4
- package/lib/asserts/bigint/index.d.ts +35 -4
- package/lib/asserts/bigint/index.js +9 -16
- package/lib/asserts/bigint/index.js.map +1 -1
- package/lib/asserts/bigint/index.mjs +9 -16
- package/lib/asserts/bigint/index.mjs.map +1 -1
- package/lib/asserts/boolean/index.d.mts +32 -3
- package/lib/asserts/boolean/index.d.ts +32 -3
- package/lib/asserts/boolean/index.js +7 -13
- package/lib/asserts/boolean/index.js.map +1 -1
- package/lib/asserts/boolean/index.mjs +7 -13
- package/lib/asserts/boolean/index.mjs.map +1 -1
- package/lib/asserts/coerce/index.d.mts +52 -0
- package/lib/asserts/coerce/index.d.ts +52 -0
- package/lib/asserts/coerce/index.js +21 -0
- package/lib/asserts/coerce/index.js.map +1 -0
- package/lib/asserts/coerce/index.mjs +21 -0
- package/lib/asserts/date/dateMax.d.mts +5 -2
- package/lib/asserts/date/dateMax.d.ts +5 -2
- package/lib/asserts/date/dateMax.js +5 -22
- package/lib/asserts/date/dateMax.js.map +1 -1
- package/lib/asserts/date/dateMax.mjs +5 -22
- package/lib/asserts/date/dateMax.mjs.map +1 -1
- package/lib/asserts/date/dateMin.d.mts +5 -2
- package/lib/asserts/date/dateMin.d.ts +5 -2
- package/lib/asserts/date/dateMin.js +5 -22
- package/lib/asserts/date/dateMin.js.map +1 -1
- package/lib/asserts/date/dateMin.mjs +5 -22
- package/lib/asserts/date/dateMin.mjs.map +1 -1
- package/lib/asserts/date/index.d.mts +7 -3
- package/lib/asserts/date/index.d.ts +7 -3
- package/lib/asserts/date/index.js +6 -12
- package/lib/asserts/date/index.js.map +1 -1
- package/lib/asserts/date/index.mjs +6 -12
- package/lib/asserts/date/index.mjs.map +1 -1
- package/lib/asserts/intersection/index.d.mts +36 -0
- package/lib/asserts/intersection/index.d.ts +36 -0
- package/lib/asserts/intersection/index.js +13 -0
- package/lib/asserts/intersection/index.js.map +1 -0
- package/lib/asserts/intersection/index.mjs +13 -0
- package/lib/asserts/lazy/index.d.mts +42 -0
- package/lib/asserts/lazy/index.d.ts +42 -0
- package/lib/asserts/lazy/index.js +12 -0
- package/lib/asserts/lazy/index.js.map +1 -0
- package/lib/asserts/lazy/index.mjs +12 -0
- package/lib/asserts/mix/equalTo.d.mts +5 -2
- package/lib/asserts/mix/equalTo.d.ts +5 -2
- package/lib/asserts/mix/equalTo.js +4 -4
- package/lib/asserts/mix/equalTo.mjs +3 -3
- package/lib/asserts/mix/index.d.mts +12 -6
- package/lib/asserts/mix/index.d.ts +12 -6
- package/lib/asserts/mix/index.js +6 -11
- package/lib/asserts/mix/index.js.map +1 -1
- package/lib/asserts/mix/index.mjs +6 -11
- package/lib/asserts/mix/index.mjs.map +1 -1
- package/lib/asserts/mix/oneOfValues.d.mts +5 -2
- package/lib/asserts/mix/oneOfValues.d.ts +5 -2
- package/lib/asserts/mix/oneOfValues.js +4 -4
- package/lib/asserts/mix/oneOfValues.mjs +3 -3
- package/lib/asserts/number/index.d.mts +29 -3
- package/lib/asserts/number/index.d.ts +29 -3
- package/lib/asserts/number/index.js +9 -16
- package/lib/asserts/number/index.js.map +1 -1
- package/lib/asserts/number/index.mjs +9 -16
- package/lib/asserts/number/index.mjs.map +1 -1
- package/lib/asserts/number/max.d.mts +5 -2
- package/lib/asserts/number/max.d.ts +5 -2
- package/lib/asserts/number/max.js +5 -13
- package/lib/asserts/number/max.js.map +1 -1
- package/lib/asserts/number/max.mjs +5 -13
- package/lib/asserts/number/max.mjs.map +1 -1
- package/lib/asserts/number/maxExcluded.d.mts +5 -2
- package/lib/asserts/number/maxExcluded.d.ts +5 -2
- package/lib/asserts/number/maxExcluded.js +5 -13
- package/lib/asserts/number/maxExcluded.js.map +1 -1
- package/lib/asserts/number/maxExcluded.mjs +5 -13
- package/lib/asserts/number/maxExcluded.mjs.map +1 -1
- package/lib/asserts/number/min.d.mts +5 -2
- package/lib/asserts/number/min.d.ts +5 -2
- package/lib/asserts/number/min.js +5 -13
- package/lib/asserts/number/min.js.map +1 -1
- package/lib/asserts/number/min.mjs +5 -13
- package/lib/asserts/number/min.mjs.map +1 -1
- package/lib/asserts/number/minExcluded.d.mts +5 -2
- package/lib/asserts/number/minExcluded.d.ts +5 -2
- package/lib/asserts/number/minExcluded.js +5 -13
- package/lib/asserts/number/minExcluded.js.map +1 -1
- package/lib/asserts/number/minExcluded.mjs +5 -13
- package/lib/asserts/number/minExcluded.mjs.map +1 -1
- package/lib/asserts/number/negative.d.mts +5 -2
- package/lib/asserts/number/negative.d.ts +5 -2
- package/lib/asserts/number/negative.js +5 -13
- package/lib/asserts/number/negative.js.map +1 -1
- package/lib/asserts/number/negative.mjs +5 -13
- package/lib/asserts/number/negative.mjs.map +1 -1
- package/lib/asserts/number/positive.d.mts +5 -2
- package/lib/asserts/number/positive.d.ts +5 -2
- package/lib/asserts/number/positive.js +5 -13
- package/lib/asserts/number/positive.js.map +1 -1
- package/lib/asserts/number/positive.mjs +5 -13
- package/lib/asserts/number/positive.mjs.map +1 -1
- package/lib/asserts/object/extend.d.mts +29 -0
- package/lib/asserts/object/extend.d.ts +29 -0
- package/lib/asserts/object/extend.js +14 -0
- package/lib/asserts/object/extend.js.map +1 -0
- package/lib/asserts/object/extend.mjs +14 -0
- package/lib/asserts/object/index.d.mts +28 -4
- package/lib/asserts/object/index.d.ts +28 -4
- package/lib/asserts/object/index.js +7 -11
- package/lib/asserts/object/index.js.map +1 -1
- package/lib/asserts/object/index.mjs +8 -12
- package/lib/asserts/object/index.mjs.map +1 -1
- package/lib/asserts/object/maxKeys.d.mts +5 -2
- package/lib/asserts/object/maxKeys.d.ts +5 -2
- package/lib/asserts/object/maxKeys.js +5 -16
- package/lib/asserts/object/maxKeys.js.map +1 -1
- package/lib/asserts/object/maxKeys.mjs +5 -16
- package/lib/asserts/object/maxKeys.mjs.map +1 -1
- package/lib/asserts/object/omit.d.mts +27 -0
- package/lib/asserts/object/omit.d.ts +27 -0
- package/lib/asserts/object/omit.js +14 -0
- package/lib/asserts/object/omit.js.map +1 -0
- package/lib/asserts/object/omit.mjs +14 -0
- package/lib/asserts/object/partial.d.mts +34 -0
- package/lib/asserts/object/partial.d.ts +34 -0
- package/lib/asserts/object/partial.js +14 -0
- package/lib/asserts/object/partial.js.map +1 -0
- package/lib/asserts/object/partial.mjs +14 -0
- package/lib/asserts/object/pick.d.mts +32 -0
- package/lib/asserts/object/pick.d.ts +32 -0
- package/lib/asserts/object/pick.js +17 -0
- package/lib/asserts/object/pick.js.map +1 -0
- package/lib/asserts/object/pick.mjs +17 -0
- package/lib/asserts/object/required.d.mts +39 -0
- package/lib/asserts/object/required.d.ts +39 -0
- package/lib/asserts/object/required.js +14 -0
- package/lib/asserts/object/required.js.map +1 -0
- package/lib/asserts/object/required.mjs +14 -0
- package/lib/asserts/record/index.d.mts +28 -0
- package/lib/asserts/record/index.d.ts +28 -0
- package/lib/asserts/record/index.js +12 -0
- package/lib/asserts/record/index.js.map +1 -0
- package/lib/asserts/record/index.mjs +12 -0
- package/lib/asserts/string/atLeastOneDigit.d.mts +5 -2
- package/lib/asserts/string/atLeastOneDigit.d.ts +5 -2
- package/lib/asserts/string/atLeastOneDigit.js +4 -14
- package/lib/asserts/string/atLeastOneDigit.js.map +1 -1
- package/lib/asserts/string/atLeastOneDigit.mjs +4 -14
- package/lib/asserts/string/atLeastOneDigit.mjs.map +1 -1
- package/lib/asserts/string/atLeastOneLowerChar.d.mts +5 -2
- package/lib/asserts/string/atLeastOneLowerChar.d.ts +5 -2
- package/lib/asserts/string/atLeastOneLowerChar.js +4 -15
- package/lib/asserts/string/atLeastOneLowerChar.js.map +1 -1
- package/lib/asserts/string/atLeastOneLowerChar.mjs +4 -15
- package/lib/asserts/string/atLeastOneLowerChar.mjs.map +1 -1
- package/lib/asserts/string/atLeastOneSpecialChar.d.mts +5 -2
- package/lib/asserts/string/atLeastOneSpecialChar.d.ts +5 -2
- package/lib/asserts/string/atLeastOneSpecialChar.js +5 -19
- package/lib/asserts/string/atLeastOneSpecialChar.js.map +1 -1
- package/lib/asserts/string/atLeastOneSpecialChar.mjs +4 -18
- package/lib/asserts/string/atLeastOneSpecialChar.mjs.map +1 -1
- package/lib/asserts/string/atLeastOneUpperChar.d.mts +5 -2
- package/lib/asserts/string/atLeastOneUpperChar.d.ts +5 -2
- package/lib/asserts/string/atLeastOneUpperChar.js +4 -15
- package/lib/asserts/string/atLeastOneUpperChar.js.map +1 -1
- package/lib/asserts/string/atLeastOneUpperChar.mjs +4 -15
- package/lib/asserts/string/atLeastOneUpperChar.mjs.map +1 -1
- package/lib/asserts/string/contains.d.mts +5 -2
- package/lib/asserts/string/contains.d.ts +5 -2
- package/lib/asserts/string/contains.js +4 -15
- package/lib/asserts/string/contains.js.map +1 -1
- package/lib/asserts/string/contains.mjs +4 -15
- package/lib/asserts/string/contains.mjs.map +1 -1
- package/lib/asserts/string/email.d.mts +5 -2
- package/lib/asserts/string/email.d.ts +5 -2
- package/lib/asserts/string/email.js +5 -14
- package/lib/asserts/string/email.js.map +1 -1
- package/lib/asserts/string/email.mjs +5 -14
- package/lib/asserts/string/email.mjs.map +1 -1
- package/lib/asserts/string/endsWith.d.mts +5 -2
- package/lib/asserts/string/endsWith.d.ts +5 -2
- package/lib/asserts/string/endsWith.js +4 -15
- package/lib/asserts/string/endsWith.js.map +1 -1
- package/lib/asserts/string/endsWith.mjs +4 -15
- package/lib/asserts/string/endsWith.mjs.map +1 -1
- package/lib/asserts/string/index.d.mts +34 -3
- package/lib/asserts/string/index.d.ts +34 -3
- package/lib/asserts/string/index.js +10 -16
- package/lib/asserts/string/index.js.map +1 -1
- package/lib/asserts/string/index.mjs +10 -16
- package/lib/asserts/string/index.mjs.map +1 -1
- package/lib/asserts/string/isValidDate.d.mts +5 -2
- package/lib/asserts/string/isValidDate.d.ts +5 -2
- package/lib/asserts/string/isValidDate.js +5 -18
- package/lib/asserts/string/isValidDate.js.map +1 -1
- package/lib/asserts/string/isValidDate.mjs +5 -18
- package/lib/asserts/string/isValidDate.mjs.map +1 -1
- package/lib/asserts/string/isValidDateTime.d.mts +5 -2
- package/lib/asserts/string/isValidDateTime.d.ts +5 -2
- package/lib/asserts/string/isValidDateTime.js +5 -25
- package/lib/asserts/string/isValidDateTime.js.map +1 -1
- package/lib/asserts/string/isValidDateTime.mjs +5 -25
- package/lib/asserts/string/isValidDateTime.mjs.map +1 -1
- package/lib/asserts/string/isValidTime.d.mts +5 -2
- package/lib/asserts/string/isValidTime.d.ts +5 -2
- package/lib/asserts/string/isValidTime.js +5 -25
- package/lib/asserts/string/isValidTime.js.map +1 -1
- package/lib/asserts/string/isValidTime.mjs +5 -25
- package/lib/asserts/string/isValidTime.mjs.map +1 -1
- package/lib/asserts/string/lowerCase.d.mts +5 -2
- package/lib/asserts/string/lowerCase.d.ts +5 -2
- package/lib/asserts/string/lowerCase.js +4 -13
- package/lib/asserts/string/lowerCase.js.map +1 -1
- package/lib/asserts/string/lowerCase.mjs +4 -13
- package/lib/asserts/string/lowerCase.mjs.map +1 -1
- package/lib/asserts/string/maxLength.d.mts +5 -2
- package/lib/asserts/string/maxLength.d.ts +5 -2
- package/lib/asserts/string/maxLength.js +5 -13
- package/lib/asserts/string/maxLength.js.map +1 -1
- package/lib/asserts/string/maxLength.mjs +5 -13
- package/lib/asserts/string/maxLength.mjs.map +1 -1
- package/lib/asserts/string/minLength.d.mts +5 -2
- package/lib/asserts/string/minLength.d.ts +5 -2
- package/lib/asserts/string/minLength.js +5 -13
- package/lib/asserts/string/minLength.js.map +1 -1
- package/lib/asserts/string/minLength.mjs +5 -13
- package/lib/asserts/string/minLength.mjs.map +1 -1
- package/lib/asserts/string/regExp.d.mts +5 -2
- package/lib/asserts/string/regExp.d.ts +5 -2
- package/lib/asserts/string/regExp.js +5 -13
- package/lib/asserts/string/regExp.js.map +1 -1
- package/lib/asserts/string/regExp.mjs +5 -13
- package/lib/asserts/string/regExp.mjs.map +1 -1
- package/lib/asserts/string/startsWith.d.mts +5 -2
- package/lib/asserts/string/startsWith.d.ts +5 -2
- package/lib/asserts/string/startsWith.js +4 -15
- package/lib/asserts/string/startsWith.js.map +1 -1
- package/lib/asserts/string/startsWith.mjs +4 -15
- package/lib/asserts/string/startsWith.mjs.map +1 -1
- package/lib/asserts/string/upperCase.d.mts +5 -2
- package/lib/asserts/string/upperCase.d.ts +5 -2
- package/lib/asserts/string/upperCase.js +4 -15
- package/lib/asserts/string/upperCase.js.map +1 -1
- package/lib/asserts/string/upperCase.mjs +4 -15
- package/lib/asserts/string/upperCase.mjs.map +1 -1
- package/lib/asserts/string/uuid.d.mts +5 -2
- package/lib/asserts/string/uuid.d.ts +5 -2
- package/lib/asserts/string/uuid.js +5 -16
- package/lib/asserts/string/uuid.js.map +1 -1
- package/lib/asserts/string/uuid.mjs +5 -16
- package/lib/asserts/string/uuid.mjs.map +1 -1
- package/lib/asserts/string/uuidV1.d.mts +5 -2
- package/lib/asserts/string/uuidV1.d.ts +5 -2
- package/lib/asserts/string/uuidV1.js +4 -16
- package/lib/asserts/string/uuidV1.js.map +1 -1
- package/lib/asserts/string/uuidV1.mjs +4 -16
- package/lib/asserts/string/uuidV1.mjs.map +1 -1
- package/lib/asserts/string/uuidV2.d.mts +5 -2
- package/lib/asserts/string/uuidV2.d.ts +5 -2
- package/lib/asserts/string/uuidV2.js +4 -16
- package/lib/asserts/string/uuidV2.js.map +1 -1
- package/lib/asserts/string/uuidV2.mjs +4 -16
- package/lib/asserts/string/uuidV2.mjs.map +1 -1
- package/lib/asserts/string/uuidV3.d.mts +5 -2
- package/lib/asserts/string/uuidV3.d.ts +5 -2
- package/lib/asserts/string/uuidV3.js +4 -16
- package/lib/asserts/string/uuidV3.js.map +1 -1
- package/lib/asserts/string/uuidV3.mjs +4 -16
- package/lib/asserts/string/uuidV3.mjs.map +1 -1
- package/lib/asserts/string/uuidV4.d.mts +5 -2
- package/lib/asserts/string/uuidV4.d.ts +5 -2
- package/lib/asserts/string/uuidV4.js +4 -16
- package/lib/asserts/string/uuidV4.js.map +1 -1
- package/lib/asserts/string/uuidV4.mjs +4 -16
- package/lib/asserts/string/uuidV4.mjs.map +1 -1
- package/lib/asserts/string/uuidV5.d.mts +5 -2
- package/lib/asserts/string/uuidV5.d.ts +5 -2
- package/lib/asserts/string/uuidV5.js +4 -16
- package/lib/asserts/string/uuidV5.js.map +1 -1
- package/lib/asserts/string/uuidV5.mjs +4 -16
- package/lib/asserts/string/uuidV5.mjs.map +1 -1
- package/lib/asserts/string/validUrl.d.mts +5 -2
- package/lib/asserts/string/validUrl.d.ts +5 -2
- package/lib/asserts/string/validUrl.js +5 -20
- package/lib/asserts/string/validUrl.js.map +1 -1
- package/lib/asserts/string/validUrl.mjs +5 -20
- package/lib/asserts/string/validUrl.mjs.map +1 -1
- package/lib/asserts/tuple/index.d.mts +28 -0
- package/lib/asserts/tuple/index.d.ts +28 -0
- package/lib/asserts/tuple/index.js +12 -0
- package/lib/asserts/tuple/index.js.map +1 -0
- package/lib/asserts/tuple/index.mjs +12 -0
- package/lib/asserts/union/index.d.mts +29 -0
- package/lib/asserts/union/index.d.ts +29 -0
- package/lib/asserts/union/index.js +12 -0
- package/lib/asserts/union/index.js.map +1 -0
- package/lib/asserts/union/index.mjs +12 -0
- package/lib/chunk-2AYQ7GRP.js +33 -0
- package/lib/chunk-2AYQ7GRP.js.map +1 -0
- package/lib/chunk-2KLV3CHA.js +20 -0
- package/lib/chunk-2KLV3CHA.js.map +1 -0
- package/lib/chunk-2X6V3ODY.js +20 -0
- package/lib/chunk-2X6V3ODY.js.map +1 -0
- package/lib/chunk-346TIMNH.mjs +18 -0
- package/lib/chunk-346TIMNH.mjs.map +1 -0
- package/lib/{chunk-32MKEBKR.js → chunk-3D6TPN7F.js} +3 -3
- package/lib/chunk-3D6TPN7F.js.map +1 -0
- package/lib/chunk-3OAUE5VW.js +28 -0
- package/lib/chunk-3OAUE5VW.js.map +1 -0
- package/lib/chunk-3PTVMZY7.js +22 -0
- package/lib/chunk-3PTVMZY7.js.map +1 -0
- package/lib/chunk-3T5QKF7X.mjs +18 -0
- package/lib/chunk-3T5QKF7X.mjs.map +1 -0
- package/lib/chunk-45K4AUO3.js +22 -0
- package/lib/chunk-45K4AUO3.js.map +1 -0
- package/lib/chunk-4AZOGLHD.mjs +21 -0
- package/lib/chunk-4AZOGLHD.mjs.map +1 -0
- package/lib/chunk-54F462SS.mjs +21 -0
- package/lib/chunk-54F462SS.mjs.map +1 -0
- package/lib/chunk-55P4YTMX.mjs +20 -0
- package/lib/chunk-55P4YTMX.mjs.map +1 -0
- package/lib/chunk-5PIGAEGL.mjs +22 -0
- package/lib/chunk-5PIGAEGL.mjs.map +1 -0
- package/lib/chunk-5U5CYDRB.mjs +21 -0
- package/lib/chunk-5U5CYDRB.mjs.map +1 -0
- package/lib/chunk-5VZDHJKM.mjs +68 -0
- package/lib/chunk-5VZDHJKM.mjs.map +1 -0
- package/lib/chunk-5WLWZKC6.mjs +21 -0
- package/lib/chunk-5WLWZKC6.mjs.map +1 -0
- package/lib/chunk-5WV7FMW7.mjs +33 -0
- package/lib/chunk-5WV7FMW7.mjs.map +1 -0
- package/lib/{chunk-QWPHP26D.mjs → chunk-65X7NTUS.mjs} +18 -9
- package/lib/chunk-65X7NTUS.mjs.map +1 -0
- package/lib/chunk-6LUSV3SS.js +595 -0
- package/lib/chunk-6LUSV3SS.js.map +1 -0
- package/lib/chunk-7A4RN5UD.js +21 -0
- package/lib/chunk-7A4RN5UD.js.map +1 -0
- package/lib/chunk-7CNZKYPM.js +21 -0
- package/lib/chunk-7CNZKYPM.js.map +1 -0
- package/lib/chunk-7F4P72SG.mjs +18 -0
- package/lib/chunk-7F4P72SG.mjs.map +1 -0
- package/lib/chunk-A36G62K5.mjs +49 -0
- package/lib/chunk-A36G62K5.mjs.map +1 -0
- package/lib/chunk-A5OEVSSV.js +21 -0
- package/lib/chunk-A5OEVSSV.js.map +1 -0
- package/lib/chunk-ABSZMCDX.mjs +21 -0
- package/lib/chunk-ABSZMCDX.mjs.map +1 -0
- package/lib/chunk-ALXDH7GS.js +23 -0
- package/lib/chunk-ALXDH7GS.js.map +1 -0
- package/lib/chunk-AO6DKPJZ.js +49 -0
- package/lib/chunk-AO6DKPJZ.js.map +1 -0
- package/lib/chunk-AYJCGPXI.mjs +20 -0
- package/lib/chunk-AYJCGPXI.mjs.map +1 -0
- package/lib/chunk-AYSJLD4S.mjs +28 -0
- package/lib/chunk-AYSJLD4S.mjs.map +1 -0
- package/lib/{chunk-XG6K6N3A.mjs → chunk-B2R5S6OH.mjs} +9 -6
- package/lib/chunk-B2R5S6OH.mjs.map +1 -0
- package/lib/chunk-B3IWQRZF.mjs +22 -0
- package/lib/chunk-B3IWQRZF.mjs.map +1 -0
- package/lib/chunk-B4WB3UB7.js +20 -0
- package/lib/chunk-B4WB3UB7.js.map +1 -0
- package/lib/chunk-BZ6R6RWE.mjs +19 -0
- package/lib/chunk-BZ6R6RWE.mjs.map +1 -0
- package/lib/chunk-C6ICGQEX.mjs +21 -0
- package/lib/chunk-C6ICGQEX.mjs.map +1 -0
- package/lib/{chunk-ASZW6XRM.mjs → chunk-C76DLZFD.mjs} +4 -2
- package/lib/{chunk-ASZW6XRM.mjs.map → chunk-C76DLZFD.mjs.map} +1 -1
- package/lib/chunk-CJCIOMS7.mjs +66 -0
- package/lib/chunk-CJCIOMS7.mjs.map +1 -0
- package/lib/chunk-CLRHVTVY.js +50 -0
- package/lib/chunk-CLRHVTVY.js.map +1 -0
- package/lib/chunk-CWYS6MUA.js +18 -0
- package/lib/chunk-CWYS6MUA.js.map +1 -0
- package/lib/{chunk-P54CF5QN.mjs → chunk-D42AL6CN.mjs} +2 -2
- package/lib/chunk-D42AL6CN.mjs.map +1 -0
- package/lib/chunk-D4YY45O2.mjs +21 -0
- package/lib/chunk-D4YY45O2.mjs.map +1 -0
- package/lib/chunk-DKGRAVID.js +70 -0
- package/lib/chunk-DKGRAVID.js.map +1 -0
- package/lib/chunk-DLEDKNPD.mjs +21 -0
- package/lib/chunk-DLEDKNPD.mjs.map +1 -0
- package/lib/chunk-DPXTSNEX.js +23 -0
- package/lib/chunk-DPXTSNEX.js.map +1 -0
- package/lib/chunk-ECLNZ233.js +26 -0
- package/lib/chunk-ECLNZ233.js.map +1 -0
- package/lib/chunk-EEKYR5IA.js +19 -0
- package/lib/chunk-EEKYR5IA.js.map +1 -0
- package/lib/chunk-EJCCIGXH.js +31 -0
- package/lib/chunk-EJCCIGXH.js.map +1 -0
- package/lib/chunk-EN745GWN.js +33 -0
- package/lib/chunk-EN745GWN.js.map +1 -0
- package/lib/chunk-ETBJ4NF4.mjs +21 -0
- package/lib/chunk-ETBJ4NF4.mjs.map +1 -0
- package/lib/chunk-EVM26M2C.js +66 -0
- package/lib/chunk-EVM26M2C.js.map +1 -0
- package/lib/chunk-FJEBPEGR.js +21 -0
- package/lib/chunk-FJEBPEGR.js.map +1 -0
- package/lib/chunk-FTHEF6SB.js +14 -0
- package/lib/chunk-FTHEF6SB.js.map +1 -0
- package/lib/chunk-G2VC3SQB.js +22 -0
- package/lib/chunk-G2VC3SQB.js.map +1 -0
- package/lib/chunk-G6YZVGWC.mjs +21 -0
- package/lib/chunk-G6YZVGWC.mjs.map +1 -0
- package/lib/chunk-GSLVYDXO.js +18 -0
- package/lib/chunk-GSLVYDXO.js.map +1 -0
- package/lib/chunk-GTGXSQKC.js +21 -0
- package/lib/chunk-GTGXSQKC.js.map +1 -0
- package/lib/chunk-GYLCPX6O.js +68 -0
- package/lib/chunk-GYLCPX6O.js.map +1 -0
- package/lib/chunk-H3FXZTYS.mjs +18 -0
- package/lib/chunk-H3FXZTYS.mjs.map +1 -0
- package/lib/chunk-HKDDJSN2.mjs +21 -0
- package/lib/chunk-HKDDJSN2.mjs.map +1 -0
- package/lib/{chunk-YSCVE4PJ.mjs → chunk-IIL6D2UL.mjs} +2 -2
- package/lib/chunk-IIL6D2UL.mjs.map +1 -0
- package/lib/chunk-IWNVHB2K.mjs +22 -0
- package/lib/chunk-IWNVHB2K.mjs.map +1 -0
- package/lib/chunk-JF7KZZ7R.js +21 -0
- package/lib/chunk-JF7KZZ7R.js.map +1 -0
- package/lib/chunk-JHONMWCE.js +27 -0
- package/lib/chunk-JHONMWCE.js.map +1 -0
- package/lib/chunk-JLEQOYDW.js +59 -0
- package/lib/chunk-JLEQOYDW.js.map +1 -0
- package/lib/chunk-JND3VAPR.mjs +19 -0
- package/lib/chunk-JND3VAPR.mjs.map +1 -0
- package/lib/chunk-K4YXIN2V.mjs +33 -0
- package/lib/chunk-K4YXIN2V.mjs.map +1 -0
- package/lib/chunk-K6QYFFMX.mjs +21 -0
- package/lib/chunk-K6QYFFMX.mjs.map +1 -0
- package/lib/{chunk-CCNK27CX.mjs → chunk-KAFZGQ2W.mjs} +17 -11
- package/lib/chunk-KAFZGQ2W.mjs.map +1 -0
- package/lib/chunk-KDPYWGMJ.js +24 -0
- package/lib/chunk-KDPYWGMJ.js.map +1 -0
- package/lib/chunk-KGNT5T35.mjs +70 -0
- package/lib/chunk-KGNT5T35.mjs.map +1 -0
- package/lib/chunk-KIVIWBIY.js +21 -0
- package/lib/chunk-KIVIWBIY.js.map +1 -0
- package/lib/chunk-KZBW5WCK.js +21 -0
- package/lib/chunk-KZBW5WCK.js.map +1 -0
- package/lib/chunk-L36PQXUB.js +21 -0
- package/lib/chunk-L36PQXUB.js.map +1 -0
- package/lib/chunk-L7YFDMZU.js +78 -0
- package/lib/chunk-L7YFDMZU.js.map +1 -0
- package/lib/chunk-LDZFOOWN.mjs +595 -0
- package/lib/chunk-LDZFOOWN.mjs.map +1 -0
- package/lib/{chunk-42J6CHIO.js → chunk-LHEU4XAC.js} +4 -2
- package/lib/chunk-LHEU4XAC.js.map +1 -0
- package/lib/chunk-LNBZ7SJR.js +26 -0
- package/lib/chunk-LNBZ7SJR.js.map +1 -0
- package/lib/chunk-M7EMQU7U.mjs +28 -0
- package/lib/chunk-M7EMQU7U.mjs.map +1 -0
- package/lib/chunk-MOHROZTD.mjs +20 -0
- package/lib/chunk-MOHROZTD.mjs.map +1 -0
- package/lib/chunk-MQGE7GIK.mjs +26 -0
- package/lib/chunk-MQGE7GIK.mjs.map +1 -0
- package/lib/chunk-NC7E2FQR.mjs +21 -0
- package/lib/chunk-NC7E2FQR.mjs.map +1 -0
- package/lib/chunk-NM3VRT77.mjs +120 -0
- package/lib/chunk-NM3VRT77.mjs.map +1 -0
- package/lib/chunk-NM4TCTZM.mjs +70 -0
- package/lib/chunk-NM4TCTZM.mjs.map +1 -0
- package/lib/chunk-NXS5ULAJ.mjs +22 -0
- package/lib/chunk-NXS5ULAJ.mjs.map +1 -0
- package/lib/chunk-NZOANK7A.js +18 -0
- package/lib/chunk-NZOANK7A.js.map +1 -0
- package/lib/{chunk-ZTCXXAKD.mjs → chunk-O2WD4JBG.mjs} +8 -2
- package/lib/chunk-O2WD4JBG.mjs.map +1 -0
- package/lib/chunk-O4FVL7CA.js +33 -0
- package/lib/chunk-O4FVL7CA.js.map +1 -0
- package/lib/chunk-O646PJXY.mjs +23 -0
- package/lib/chunk-O646PJXY.mjs.map +1 -0
- package/lib/chunk-OHJ2EB4T.js +20 -0
- package/lib/chunk-OHJ2EB4T.js.map +1 -0
- package/lib/{chunk-UTPG4GZB.js → chunk-OPA6AXSH.js} +3 -3
- package/lib/chunk-OPA6AXSH.js.map +1 -0
- package/lib/chunk-OQB5UGWG.mjs +24 -0
- package/lib/chunk-OQB5UGWG.mjs.map +1 -0
- package/lib/chunk-ORQBVFHY.js +18 -0
- package/lib/chunk-ORQBVFHY.js.map +1 -0
- package/lib/chunk-OW7RK5YW.js +21 -0
- package/lib/chunk-OW7RK5YW.js.map +1 -0
- package/lib/chunk-OY5DJBRV.mjs +21 -0
- package/lib/chunk-OY5DJBRV.mjs.map +1 -0
- package/lib/chunk-P2SQQBVB.js +22 -0
- package/lib/chunk-P2SQQBVB.js.map +1 -0
- package/lib/chunk-P6CI5ITJ.js +22 -0
- package/lib/chunk-P6CI5ITJ.js.map +1 -0
- package/lib/chunk-P6M6QZU5.mjs +24 -0
- package/lib/chunk-P6M6QZU5.mjs.map +1 -0
- package/lib/chunk-PFADKWMO.js +19 -0
- package/lib/chunk-PFADKWMO.js.map +1 -0
- package/lib/chunk-POPLWPM4.mjs +19 -0
- package/lib/chunk-POPLWPM4.mjs.map +1 -0
- package/lib/chunk-POQZCV3D.js +20 -0
- package/lib/chunk-POQZCV3D.js.map +1 -0
- package/lib/chunk-QM4MJTTD.mjs +24 -0
- package/lib/chunk-QM4MJTTD.mjs.map +1 -0
- package/lib/chunk-QNA4O6AU.js +21 -0
- package/lib/chunk-QNA4O6AU.js.map +1 -0
- package/lib/chunk-RCD6EO4Q.mjs +21 -0
- package/lib/chunk-RCD6EO4Q.mjs.map +1 -0
- package/lib/chunk-RDJK3X4J.mjs +21 -0
- package/lib/chunk-RDJK3X4J.mjs.map +1 -0
- package/lib/chunk-RXU74KSN.mjs +20 -0
- package/lib/chunk-RXU74KSN.mjs.map +1 -0
- package/lib/chunk-S6N4N4FT.js +21 -0
- package/lib/chunk-S6N4N4FT.js.map +1 -0
- package/lib/chunk-SGWF66HS.js +21 -0
- package/lib/chunk-SGWF66HS.js.map +1 -0
- package/lib/chunk-SKMDZ4S6.mjs +23 -0
- package/lib/chunk-SKMDZ4S6.mjs.map +1 -0
- package/lib/chunk-SVRCKC65.js +120 -0
- package/lib/chunk-SVRCKC65.js.map +1 -0
- package/lib/chunk-SY2V2V54.js +28 -0
- package/lib/chunk-SY2V2V54.js.map +1 -0
- package/lib/chunk-SZO4SUUG.js +21 -0
- package/lib/chunk-SZO4SUUG.js.map +1 -0
- package/lib/chunk-TCHVA6VG.js +24 -0
- package/lib/chunk-TCHVA6VG.js.map +1 -0
- package/lib/chunk-TJ7IQSHU.js +21 -0
- package/lib/chunk-TJ7IQSHU.js.map +1 -0
- package/lib/chunk-TLLR2DXI.js +70 -0
- package/lib/chunk-TLLR2DXI.js.map +1 -0
- package/lib/chunk-TPSWNY5K.mjs +20 -0
- package/lib/chunk-TPSWNY5K.mjs.map +1 -0
- package/lib/chunk-UCHEFFWR.js +79 -0
- package/lib/chunk-UCHEFFWR.js.map +1 -0
- package/lib/chunk-UIJIIIOA.js +21 -0
- package/lib/chunk-UIJIIIOA.js.map +1 -0
- package/lib/chunk-UMS4M7FU.mjs +22 -0
- package/lib/chunk-UMS4M7FU.mjs.map +1 -0
- package/lib/chunk-UN5S46LE.mjs +28 -0
- package/lib/chunk-UN5S46LE.mjs.map +1 -0
- package/lib/chunk-UWONIZJZ.mjs +78 -0
- package/lib/chunk-UWONIZJZ.mjs.map +1 -0
- package/lib/chunk-UYAF7QRD.mjs +22 -0
- package/lib/chunk-UYAF7QRD.mjs.map +1 -0
- package/lib/chunk-VERUOTB3.mjs +10 -0
- package/lib/chunk-VERUOTB3.mjs.map +1 -0
- package/lib/chunk-VGOAXY26.js +24 -0
- package/lib/chunk-VGOAXY26.js.map +1 -0
- package/lib/chunk-VKSBOWCE.mjs +50 -0
- package/lib/chunk-VKSBOWCE.mjs.map +1 -0
- package/lib/chunk-VT2JBMWQ.mjs +27 -0
- package/lib/chunk-VT2JBMWQ.mjs.map +1 -0
- package/lib/chunk-VWHKNZLG.js +18 -0
- package/lib/chunk-VWHKNZLG.js.map +1 -0
- package/lib/chunk-WL7BV4XV.mjs +33 -0
- package/lib/chunk-WL7BV4XV.mjs.map +1 -0
- package/lib/chunk-WOPNDC4R.js +10 -0
- package/lib/chunk-WOPNDC4R.js.map +1 -0
- package/lib/chunk-X6SI76NQ.js +22 -0
- package/lib/chunk-X6SI76NQ.js.map +1 -0
- package/lib/chunk-YETYTLAD.mjs +18 -0
- package/lib/chunk-YETYTLAD.mjs.map +1 -0
- package/lib/chunk-YJUYGFG2.mjs +26 -0
- package/lib/chunk-YJUYGFG2.mjs.map +1 -0
- package/lib/chunk-YJZXJKM4.mjs +79 -0
- package/lib/chunk-YJZXJKM4.mjs.map +1 -0
- package/lib/chunk-YOF36UOS.js +19 -0
- package/lib/chunk-YOF36UOS.js.map +1 -0
- package/lib/{chunk-EMOOEIPZ.mjs → chunk-YQP44G45.mjs} +2 -2
- package/lib/chunk-YQP44G45.mjs.map +1 -0
- package/lib/chunk-Z7LBOQRQ.js +28 -0
- package/lib/chunk-Z7LBOQRQ.js.map +1 -0
- package/lib/chunk-ZIBHO6FI.js +20 -0
- package/lib/chunk-ZIBHO6FI.js.map +1 -0
- package/lib/{chunk-EXVTHIT5.js → chunk-ZJGY6EOE.js} +19 -10
- package/lib/chunk-ZJGY6EOE.js.map +1 -0
- package/lib/chunk-ZQKVVWD5.mjs +20 -0
- package/lib/chunk-ZQKVVWD5.mjs.map +1 -0
- package/lib/{chunk-FIDPCCCW.js → chunk-ZWFSAKQK.js} +8 -2
- package/lib/chunk-ZWFSAKQK.js.map +1 -0
- package/lib/codeGen.d.mts +3 -2
- package/lib/codeGen.d.ts +3 -2
- package/lib/codeGen.js +3 -45
- package/lib/codeGen.js.map +1 -1
- package/lib/codeGen.mjs +4 -46
- package/lib/codeGen.mjs.map +1 -1
- package/lib/commonTypes.d.mts +45 -1
- package/lib/commonTypes.d.ts +45 -1
- package/lib/core.d.mts +330 -0
- package/lib/core.d.ts +330 -0
- package/lib/core.js +21 -0
- package/lib/core.js.map +1 -0
- package/lib/core.mjs +21 -0
- package/lib/exceptions.d.mts +5 -1
- package/lib/exceptions.d.ts +5 -1
- package/lib/exceptions.js +2 -2
- package/lib/exceptions.mjs +1 -1
- package/lib/formatErrors.d.mts +40 -0
- package/lib/formatErrors.d.ts +40 -0
- package/lib/formatErrors.js +9 -0
- package/lib/formatErrors.js.map +1 -0
- package/lib/formatErrors.mjs +9 -0
- package/lib/formatErrors.mjs.map +1 -0
- package/lib/helpers/constants.d.mts +2 -1
- package/lib/helpers/constants.d.ts +2 -1
- package/lib/helpers/constants.js +4 -2
- package/lib/helpers/constants.js.map +1 -1
- package/lib/helpers/constants.mjs +5 -3
- package/lib/helpers/jsonSchemaConstraint.d.mts +18 -0
- package/lib/helpers/jsonSchemaConstraint.d.ts +18 -0
- package/lib/helpers/jsonSchemaConstraint.js +7 -0
- package/lib/helpers/jsonSchemaConstraint.js.map +1 -0
- package/lib/helpers/jsonSchemaConstraint.mjs +7 -0
- package/lib/helpers/jsonSchemaConstraint.mjs.map +1 -0
- package/lib/helpers/quoteStringLiteral.d.mts +3 -0
- package/lib/helpers/quoteStringLiteral.d.ts +3 -0
- package/lib/helpers/quoteStringLiteral.js +7 -0
- package/lib/helpers/quoteStringLiteral.js.map +1 -0
- package/lib/helpers/quoteStringLiteral.mjs +7 -0
- package/lib/helpers/quoteStringLiteral.mjs.map +1 -0
- package/lib/helpers/setStrictType.d.mts +3 -2
- package/lib/helpers/setStrictType.d.ts +3 -2
- package/lib/helpers/setStrictType.js +3 -4
- package/lib/helpers/setStrictType.js.map +1 -1
- package/lib/helpers/setStrictType.mjs +2 -3
- package/lib/index.d.mts +66 -5
- package/lib/index.d.ts +66 -5
- package/lib/index.js +266 -5
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +267 -6
- package/lib/standardSchema.d.mts +44 -0
- package/lib/standardSchema.d.ts +44 -0
- package/lib/standardSchema.js +1 -0
- package/lib/standardSchema.js.map +1 -0
- package/lib/standardSchema.mjs +1 -0
- package/lib/standardSchema.mjs.map +1 -0
- package/lib/toJSONSchema.d.mts +44 -0
- package/lib/toJSONSchema.d.ts +44 -0
- package/lib/toJSONSchema.js +12 -0
- package/lib/toJSONSchema.js.map +1 -0
- package/lib/toJSONSchema.mjs +12 -0
- package/lib/toJSONSchema.mjs.map +1 -0
- package/lib/translationMap.d.mts +10 -1
- package/lib/translationMap.d.ts +10 -1
- package/lib/translationMap.js +3 -3
- package/lib/translationMap.mjs +2 -2
- package/package.json +194 -52
- package/lib/CommonSchema-BIfYCtcQ.d.mts +0 -110
- package/lib/CommonSchema-DIDMH9R7.d.ts +0 -110
- package/lib/ExceptionContext.d.mts +0 -16
- package/lib/ExceptionContext.d.ts +0 -16
- package/lib/ExceptionContext.js +0 -11
- package/lib/ExceptionContext.js.map +0 -1
- package/lib/ExceptionContext.mjs +0 -11
- package/lib/chunk-32MKEBKR.js.map +0 -1
- package/lib/chunk-3ZQ4ORQH.js +0 -14
- package/lib/chunk-3ZQ4ORQH.js.map +0 -1
- package/lib/chunk-42J6CHIO.js.map +0 -1
- package/lib/chunk-BURPSYZ3.js +0 -53
- package/lib/chunk-BURPSYZ3.js.map +0 -1
- package/lib/chunk-CCNK27CX.mjs.map +0 -1
- package/lib/chunk-EMOOEIPZ.mjs.map +0 -1
- package/lib/chunk-EXVTHIT5.js.map +0 -1
- package/lib/chunk-FIDPCCCW.js.map +0 -1
- package/lib/chunk-FNBYM254.js +0 -41
- package/lib/chunk-FNBYM254.js.map +0 -1
- package/lib/chunk-IFQLPXCZ.mjs +0 -111
- package/lib/chunk-IFQLPXCZ.mjs.map +0 -1
- package/lib/chunk-MMWS3SXR.js +0 -136
- package/lib/chunk-MMWS3SXR.js.map +0 -1
- package/lib/chunk-MQRXWXHP.mjs +0 -83
- package/lib/chunk-MQRXWXHP.mjs.map +0 -1
- package/lib/chunk-MRRMV2GM.mjs +0 -63
- package/lib/chunk-MRRMV2GM.mjs.map +0 -1
- package/lib/chunk-P4Q22AZA.js +0 -28
- package/lib/chunk-P4Q22AZA.js.map +0 -1
- package/lib/chunk-P54CF5QN.mjs.map +0 -1
- package/lib/chunk-PE55R4KH.js +0 -83
- package/lib/chunk-PE55R4KH.js.map +0 -1
- package/lib/chunk-PGEXAFA5.js +0 -20
- package/lib/chunk-PGEXAFA5.js.map +0 -1
- package/lib/chunk-PQ4GCO3Q.js +0 -111
- package/lib/chunk-PQ4GCO3Q.js.map +0 -1
- package/lib/chunk-QWPHP26D.mjs.map +0 -1
- package/lib/chunk-RAJF6LMF.js +0 -63
- package/lib/chunk-RAJF6LMF.js.map +0 -1
- package/lib/chunk-RG5NYH2I.js +0 -65
- package/lib/chunk-RG5NYH2I.js.map +0 -1
- package/lib/chunk-U3DJ354I.mjs +0 -65
- package/lib/chunk-U3DJ354I.mjs.map +0 -1
- package/lib/chunk-UEYMBPZN.mjs +0 -136
- package/lib/chunk-UEYMBPZN.mjs.map +0 -1
- package/lib/chunk-UTPG4GZB.js.map +0 -1
- package/lib/chunk-VIFJBTQO.mjs +0 -20
- package/lib/chunk-VIFJBTQO.mjs.map +0 -1
- package/lib/chunk-W2SQHSOS.mjs +0 -58
- package/lib/chunk-W2SQHSOS.mjs.map +0 -1
- package/lib/chunk-XG6K6N3A.mjs.map +0 -1
- package/lib/chunk-XT5E3MPI.mjs +0 -41
- package/lib/chunk-XT5E3MPI.mjs.map +0 -1
- package/lib/chunk-YSCVE4PJ.mjs.map +0 -1
- package/lib/chunk-ZG373PNB.js +0 -58
- package/lib/chunk-ZG373PNB.js.map +0 -1
- package/lib/chunk-ZTCXXAKD.mjs.map +0 -1
- package/lib/helpers/core.d.mts +0 -4
- package/lib/helpers/core.d.ts +0 -4
- package/lib/helpers/core.js +0 -10
- package/lib/helpers/core.js.map +0 -1
- package/lib/helpers/core.mjs +0 -10
- package/lib/parse.d.mts +0 -62
- package/lib/parse.d.ts +0 -62
- package/lib/parse.js +0 -11
- package/lib/parse.js.map +0 -1
- package/lib/parse.mjs +0 -11
- package/lib/parseOrFail.d.mts +0 -44
- package/lib/parseOrFail.d.ts +0 -44
- package/lib/parseOrFail.js +0 -11
- package/lib/parseOrFail.js.map +0 -1
- package/lib/parseOrFail.mjs +0 -11
- package/lib/schemas/ArraySchema.d.mts +0 -12
- package/lib/schemas/ArraySchema.d.ts +0 -12
- package/lib/schemas/ArraySchema.js +0 -13
- package/lib/schemas/ArraySchema.js.map +0 -1
- package/lib/schemas/ArraySchema.mjs +0 -13
- package/lib/schemas/BigIntSchema.d.mts +0 -31
- package/lib/schemas/BigIntSchema.d.ts +0 -31
- package/lib/schemas/BigIntSchema.js +0 -17
- package/lib/schemas/BigIntSchema.js.map +0 -1
- package/lib/schemas/BigIntSchema.mjs +0 -17
- package/lib/schemas/BooleanSchema.d.mts +0 -26
- package/lib/schemas/BooleanSchema.d.ts +0 -26
- package/lib/schemas/BooleanSchema.js +0 -14
- package/lib/schemas/BooleanSchema.js.map +0 -1
- package/lib/schemas/BooleanSchema.mjs +0 -14
- package/lib/schemas/CommonSchema.d.mts +0 -4
- package/lib/schemas/CommonSchema.d.ts +0 -4
- package/lib/schemas/CommonSchema.js +0 -12
- package/lib/schemas/CommonSchema.js.map +0 -1
- package/lib/schemas/CommonSchema.mjs +0 -12
- package/lib/schemas/DateSchema.d.mts +0 -11
- package/lib/schemas/DateSchema.d.ts +0 -11
- package/lib/schemas/DateSchema.js +0 -13
- package/lib/schemas/DateSchema.js.map +0 -1
- package/lib/schemas/DateSchema.mjs +0 -13
- package/lib/schemas/NumberSchema.d.mts +0 -30
- package/lib/schemas/NumberSchema.d.ts +0 -30
- package/lib/schemas/NumberSchema.js +0 -17
- package/lib/schemas/NumberSchema.js.map +0 -1
- package/lib/schemas/NumberSchema.mjs +0 -17
- package/lib/schemas/ObjectSchema.d.mts +0 -30
- package/lib/schemas/ObjectSchema.d.ts +0 -30
- package/lib/schemas/ObjectSchema.js +0 -13
- package/lib/schemas/ObjectSchema.js.map +0 -1
- package/lib/schemas/ObjectSchema.mjs +0 -13
- package/lib/schemas/StringSchema.d.mts +0 -31
- package/lib/schemas/StringSchema.d.ts +0 -31
- package/lib/schemas/StringSchema.js +0 -17
- package/lib/schemas/StringSchema.js.map +0 -1
- package/lib/schemas/StringSchema.mjs +0 -17
- /package/lib/{ExceptionContext.mjs.map → asserts/coerce/index.mjs.map} +0 -0
- /package/lib/{helpers/core.mjs.map → asserts/intersection/index.mjs.map} +0 -0
- /package/lib/{parse.mjs.map → asserts/lazy/index.mjs.map} +0 -0
- /package/lib/{parseOrFail.mjs.map → asserts/object/extend.mjs.map} +0 -0
- /package/lib/{schemas/ArraySchema.mjs.map → asserts/object/omit.mjs.map} +0 -0
- /package/lib/{schemas/BigIntSchema.mjs.map → asserts/object/partial.mjs.map} +0 -0
- /package/lib/{schemas/BooleanSchema.mjs.map → asserts/object/pick.mjs.map} +0 -0
- /package/lib/{schemas/CommonSchema.mjs.map → asserts/object/required.mjs.map} +0 -0
- /package/lib/{schemas/DateSchema.mjs.map → asserts/record/index.mjs.map} +0 -0
- /package/lib/{schemas/NumberSchema.mjs.map → asserts/tuple/index.mjs.map} +0 -0
- /package/lib/{schemas/ObjectSchema.mjs.map → asserts/union/index.mjs.map} +0 -0
- /package/lib/{schemas/StringSchema.mjs.map → core.mjs.map} +0 -0
package/lib/core.d.mts
ADDED
|
@@ -0,0 +1,330 @@
|
|
|
1
|
+
import { BaseType, TranslationErrorMap, ValidationErrorData, MetaContext, TransformCallback, WithBGuardType, WithArray, WithTuple, WithObject, WithRecord, WithNull, WithUndefined, WithDefault, WithInput } from './commonTypes.mjs';
|
|
2
|
+
import { InferInput, InferType } from './InferType.mjs';
|
|
3
|
+
import { ctxSymbol } from './helpers/constants.mjs';
|
|
4
|
+
import { StandardSchemaProps } from './standardSchema.mjs';
|
|
5
|
+
|
|
6
|
+
declare class ExceptionContext {
|
|
7
|
+
readonly initialReceived: unknown;
|
|
8
|
+
readonly t: TranslationErrorMap;
|
|
9
|
+
readonly pathToError: string;
|
|
10
|
+
readonly errors?: ValidationErrorData[] | undefined;
|
|
11
|
+
readonly meta?: MetaContext | undefined;
|
|
12
|
+
/** The same location as `pathToError`, as keys. A string path cannot be taken apart again
|
|
13
|
+
* reliably, because a key may itself contain a dot or a bracket. */
|
|
14
|
+
readonly path: readonly PropertyKey[];
|
|
15
|
+
/** Where async validations are collected. Absent during a synchronous parse, which is how one
|
|
16
|
+
* is detected and reported rather than silently skipped. */
|
|
17
|
+
readonly pending?: PendingValidation[] | undefined;
|
|
18
|
+
constructor(initialReceived: unknown, t: TranslationErrorMap, pathToError: string, errors?: ValidationErrorData[] | undefined, meta?: MetaContext | undefined,
|
|
19
|
+
/** The same location as `pathToError`, as keys. A string path cannot be taken apart again
|
|
20
|
+
* reliably, because a key may itself contain a dot or a bracket. */
|
|
21
|
+
path?: readonly PropertyKey[],
|
|
22
|
+
/** Where async validations are collected. Absent during a synchronous parse, which is how one
|
|
23
|
+
* is detected and reported rather than silently skipped. */
|
|
24
|
+
pending?: PendingValidation[] | undefined);
|
|
25
|
+
/**
|
|
26
|
+
* The same location, reporting into a different errors list.
|
|
27
|
+
*
|
|
28
|
+
* A union tries each member against a throwaway list so a member that does not match is not fatal.
|
|
29
|
+
* An async validation reached inside the winning member is awaited long after that decision, so it
|
|
30
|
+
* has to be re-pointed at the real list or its issues would be collected where nobody reads them.
|
|
31
|
+
*/
|
|
32
|
+
withErrors(errors?: ValidationErrorData[]): ExceptionContext;
|
|
33
|
+
/**
|
|
34
|
+
* Records async validations to be awaited once the walk is over.
|
|
35
|
+
*
|
|
36
|
+
* Throws during a synchronous parse rather than dropping them: a validation that never runs is worse
|
|
37
|
+
* than a clear instruction to use parseAsync.
|
|
38
|
+
*/
|
|
39
|
+
enqueueAsync(validations: AsyncRequiredValidation[], received: unknown): void;
|
|
40
|
+
/**
|
|
41
|
+
* Descends into a property or an index, deriving both forms of the location from the same key so
|
|
42
|
+
* they cannot disagree.
|
|
43
|
+
*/
|
|
44
|
+
createChild(pathSegment: PropertyKey, childMeta?: MetaContext): ExceptionContext;
|
|
45
|
+
ref(path: string): unknown;
|
|
46
|
+
addIssue(expected: unknown, received: unknown, messageKey: string): never | void;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* A validation function run against an already type-checked value.
|
|
50
|
+
*
|
|
51
|
+
* `T` is the value the assert knows how to inspect, and it is what stops a string assert from
|
|
52
|
+
* being attached to a number schema: `custom` asks for `RequiredValidation<AssertInput<this>>`,
|
|
53
|
+
* and function parameters are compared contravariantly under `strictFunctionTypes`.
|
|
54
|
+
*
|
|
55
|
+
* An assert that genuinely accepts anything should declare `RequiredValidation<unknown>`, which
|
|
56
|
+
* stays assignable to every schema. The default of `any` is deliberate, so that custom asserts
|
|
57
|
+
* written against the previous signature keep compiling.
|
|
58
|
+
*/
|
|
59
|
+
type RequiredValidation<T = any> = (received: T, ctx: ExceptionContext) => void;
|
|
60
|
+
/**
|
|
61
|
+
* A validation that has to wait for something — a database lookup, an HTTP call.
|
|
62
|
+
*
|
|
63
|
+
* Registered with `customAsync` and run by `parseAsync`. Asserts only add issues, they never change the
|
|
64
|
+
* value, so the value the synchronous walk produced is already final by the time these run.
|
|
65
|
+
*/
|
|
66
|
+
type AsyncRequiredValidation<T = any> = (received: T, ctx: ExceptionContext) => Promise<void>;
|
|
67
|
+
/** An async validation that has been reached, waiting to be awaited once the walk is over. */
|
|
68
|
+
interface PendingValidation {
|
|
69
|
+
validations: AsyncRequiredValidation[];
|
|
70
|
+
received: unknown;
|
|
71
|
+
ctx: ExceptionContext;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* The runtime value a schema hands to its asserts. Nullish is stripped, because `innerCheck`
|
|
75
|
+
* returns before running asserts when the value is `null` or `undefined`.
|
|
76
|
+
*/
|
|
77
|
+
type AssertInput<T> = T extends WithBGuardType<unknown, infer Y> ? NonNullable<Y> : T extends WithArray<unknown, unknown> ? unknown[] : T extends WithTuple<unknown, unknown> ? unknown[] : T extends WithObject<unknown, unknown> ? Record<string, unknown> : T extends WithRecord<unknown, unknown, unknown> ? Record<string, unknown> : unknown;
|
|
78
|
+
type ObjectShapeSchemaType = Record<string, CommonSchema>;
|
|
79
|
+
interface RecordSchemaType {
|
|
80
|
+
key: CommonSchema;
|
|
81
|
+
value: CommonSchema;
|
|
82
|
+
}
|
|
83
|
+
interface LazySchemaType {
|
|
84
|
+
/** The name codeGen emits at the recursion point, instead of descending forever. */
|
|
85
|
+
typeName: string;
|
|
86
|
+
getSchema: () => CommonSchema;
|
|
87
|
+
/** Filled on first use, so the thunk runs once however many values are validated. */
|
|
88
|
+
resolved?: CommonSchema;
|
|
89
|
+
}
|
|
90
|
+
interface ValidatorContext {
|
|
91
|
+
type: BaseType[];
|
|
92
|
+
isNullable?: boolean;
|
|
93
|
+
isOptional?: boolean;
|
|
94
|
+
requiredValidations: RequiredValidation[];
|
|
95
|
+
asyncValidations?: AsyncRequiredValidation[];
|
|
96
|
+
array?: CommonSchema;
|
|
97
|
+
object?: ObjectShapeSchemaType;
|
|
98
|
+
union?: CommonSchema[];
|
|
99
|
+
record?: RecordSchemaType;
|
|
100
|
+
tuple?: CommonSchema[];
|
|
101
|
+
lazy?: LazySchemaType;
|
|
102
|
+
allowUnrecognizedObjectProps?: boolean;
|
|
103
|
+
strictType?: boolean;
|
|
104
|
+
strictTypeValue?: unknown;
|
|
105
|
+
date?: boolean;
|
|
106
|
+
defaultValue?: unknown;
|
|
107
|
+
meta?: MetaContext;
|
|
108
|
+
transformListBefore?: TransformCallback<any, any>[];
|
|
109
|
+
}
|
|
110
|
+
declare class CommonSchema {
|
|
111
|
+
[ctxSymbol]: ValidatorContext;
|
|
112
|
+
constructor(ctx: ValidatorContext);
|
|
113
|
+
/**
|
|
114
|
+
* The Standard Schema v1 interface, which lets a bguard schema be used by any library that accepts
|
|
115
|
+
* a validator without either side knowing about the other.
|
|
116
|
+
*
|
|
117
|
+
* A getter rather than a stored property, so it costs nothing until something asks for it and is
|
|
118
|
+
* not copied by `clone`. `types` is declared but deliberately never assigned: the spec defines it
|
|
119
|
+
* as type-only. Input and output are reported separately, so a consumer generating a form asks for
|
|
120
|
+
* what the schema takes rather than what it returns.
|
|
121
|
+
*/
|
|
122
|
+
get '~standard'(): StandardSchemaProps<InferInput<this>, InferType<this>>;
|
|
123
|
+
/**
|
|
124
|
+
* Returns a copy of this schema that carries its own context.
|
|
125
|
+
*
|
|
126
|
+
* Every refining method goes through this, so a schema can be shared between properties and
|
|
127
|
+
* reused as a base without one use leaking into another. Construction is deliberately bypassed:
|
|
128
|
+
* the subclass constructors validate their arguments and take extra parameters, and neither
|
|
129
|
+
* applies when deriving from an already-valid schema.
|
|
130
|
+
*
|
|
131
|
+
* Public because deriving a schema is a reasonable thing to do from outside as well — the object
|
|
132
|
+
* utilities need it to rebuild a property schema without touching the one they were handed.
|
|
133
|
+
*/
|
|
134
|
+
clone(): this;
|
|
135
|
+
/**
|
|
136
|
+
* @param validators - One or more custom validation functions.
|
|
137
|
+
* @returns {this} A new schema instance with the added custom validation.
|
|
138
|
+
*/
|
|
139
|
+
custom(...validators: RequiredValidation<AssertInput<this>>[]): this;
|
|
140
|
+
/**
|
|
141
|
+
* Adds validations that have to wait for something, such as a database lookup.
|
|
142
|
+
*
|
|
143
|
+
* These run only under `parseAsync` or `parseOrFailAsync`; a synchronous parse reports a
|
|
144
|
+
* `BuildSchemaError` rather than skipping them. They are awaited after the structural walk is
|
|
145
|
+
* complete, all together, so several slow checks across a schema cost one round of waiting.
|
|
146
|
+
*
|
|
147
|
+
* @param validators - One or more async validation functions.
|
|
148
|
+
* @returns {this} A new schema instance with the added validations.
|
|
149
|
+
* @example
|
|
150
|
+
* const schema = string().customAsync(async (received, ctx) => {
|
|
151
|
+
* if (await isTaken(received)) ctx.addIssue('an unused name', received, 'name is taken');
|
|
152
|
+
* });
|
|
153
|
+
*/
|
|
154
|
+
customAsync(...validators: AsyncRequiredValidation<AssertInput<this>>[]): this;
|
|
155
|
+
/**
|
|
156
|
+
* Marks the schema as nullable, allowing the value to be `null`.
|
|
157
|
+
*
|
|
158
|
+
* @returns {WithNull<this>} A new schema instance marked as nullable.
|
|
159
|
+
*/
|
|
160
|
+
nullable(): WithNull<this>;
|
|
161
|
+
/**
|
|
162
|
+
* Marks the schema as optional, allowing the value to be `undefined`.
|
|
163
|
+
*
|
|
164
|
+
* @returns {WithUndefined<this>} A new schema instance marked as optional.
|
|
165
|
+
*/
|
|
166
|
+
optional(): WithUndefined<this>;
|
|
167
|
+
/**
|
|
168
|
+
* Marks the schema as optional, allowing the value to be `undefined`.
|
|
169
|
+
*
|
|
170
|
+
* @returns {this} The schema instance. This method should be used as a last one because it does the check of previous methods and
|
|
171
|
+
*/
|
|
172
|
+
default(defaultValue: InferType<this>): WithDefault<this>;
|
|
173
|
+
/**
|
|
174
|
+
* Applies a transformation to the input value before any validation occurs.
|
|
175
|
+
* The transformation should return a value of the same type as the inferred type of the schema,
|
|
176
|
+
* ensuring that the overall type is not altered.
|
|
177
|
+
*
|
|
178
|
+
* @template In - The type of the input value before transformation (defaults to `unknown`).
|
|
179
|
+
* @param {TransformCallback<In, InferType<this>>} cb - The callback function that performs the transformation.
|
|
180
|
+
* @returns {this} A new schema with the applied transformation.
|
|
181
|
+
*
|
|
182
|
+
* @example
|
|
183
|
+
* const schema = string()
|
|
184
|
+
* .nullable()
|
|
185
|
+
* .transformBeforeValidation((val) => val + '') // Ensure the value is a string
|
|
186
|
+
* .transformBeforeValidation((val: string) => (val === '' ? null : val)); // Convert empty strings to null
|
|
187
|
+
*
|
|
188
|
+
* // Parse 'test' will pass as 'test' is a valid string longer than 3 characters.
|
|
189
|
+
* parseOrFail(schema, 'test');
|
|
190
|
+
*
|
|
191
|
+
* // Parsing '' will be transformed to null and will pass due to .nullable().
|
|
192
|
+
* parseOrFail(schema, '');
|
|
193
|
+
*/
|
|
194
|
+
transformBeforeValidation<In>(cb: TransformCallback<In, InferType<this>>): WithInput<this, In>;
|
|
195
|
+
/**
|
|
196
|
+
* Assigns a unique identifier to the schema.
|
|
197
|
+
* This ID can be used to track or map validation errors back to specific fields
|
|
198
|
+
* in a form or other structures.
|
|
199
|
+
*
|
|
200
|
+
* @param {string} value - The unique identifier for the schema.
|
|
201
|
+
* @returns {this} A new schema with the assigned ID.
|
|
202
|
+
*
|
|
203
|
+
* @example
|
|
204
|
+
* const schema = string().id('username');
|
|
205
|
+
*/
|
|
206
|
+
id(value: string): this;
|
|
207
|
+
/**
|
|
208
|
+
* Provides a description for the schema, offering additional context or information.
|
|
209
|
+
* The description can be used when displaying validation errors or for documentation purposes.
|
|
210
|
+
*
|
|
211
|
+
* @param {string} value - The description for the schema.
|
|
212
|
+
* @returns {this} A new schema with the added description.
|
|
213
|
+
*
|
|
214
|
+
* @example
|
|
215
|
+
* const schema = string().description('The username of the account holder.');
|
|
216
|
+
*/
|
|
217
|
+
description(value: string): this;
|
|
218
|
+
private meta;
|
|
219
|
+
protected defaultValueCheck(): void;
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Parses and validates a value against the provided schema, returning a type-safe result.
|
|
223
|
+
*
|
|
224
|
+
* This function will throw a `ValidationError` if the value does not conform to the schema.
|
|
225
|
+
* The inferred TypeScript type of the returned value will match the structure defined by the schema.
|
|
226
|
+
*
|
|
227
|
+
* @template T
|
|
228
|
+
* @param {T} schema - The schema to validate the received value against. This schema dictates the expected structure and type of the value.
|
|
229
|
+
* @param {unknown} receivedValue - The value to be validated and parsed according to the schema.
|
|
230
|
+
* @param {ParseOptions} options - Options
|
|
231
|
+
* @param {ParseOptions.lng} options.lng - Set language keyword to map Error message
|
|
232
|
+
* @returns {InferType<T>} The validated value, with its TypeScript type inferred from the schema.
|
|
233
|
+
*
|
|
234
|
+
* @throws {ValidationError} If the received value does not match the schema, a `ValidationError` will be thrown.
|
|
235
|
+
* @throws {Error} If an unexpected error occurs during validation, an error will be thrown with a generic message.
|
|
236
|
+
*
|
|
237
|
+
* @example
|
|
238
|
+
* const schema = object({
|
|
239
|
+
* name: string(),
|
|
240
|
+
* age: number(),
|
|
241
|
+
* });
|
|
242
|
+
*
|
|
243
|
+
* const result = parseOrFail(schema, { name: 'Alice', age: 30 });
|
|
244
|
+
* // result will be inferred as { name: string; age: number }
|
|
245
|
+
*
|
|
246
|
+
* parseOrFail(schema, { name: 'Alice', age: '30' });
|
|
247
|
+
* // Throws ValidationError because 'age' should be a number, not a string.
|
|
248
|
+
*/
|
|
249
|
+
declare function parseOrFail<T extends CommonSchema>(schema: T, receivedValue: unknown, options?: ParseOptions): InferType<T>;
|
|
250
|
+
interface ParseOptions {
|
|
251
|
+
/**
|
|
252
|
+
* Set language keyword to map error messages.
|
|
253
|
+
* @default 'default'
|
|
254
|
+
* @example 'sr' or 'Serbia' or any string to identify language
|
|
255
|
+
*/
|
|
256
|
+
lng?: string;
|
|
257
|
+
}
|
|
258
|
+
interface ParseAllOptions extends ParseOptions {
|
|
259
|
+
/**
|
|
260
|
+
* If true, collects all validation errors and returns them.
|
|
261
|
+
* If false or undefined, returns the first validation error it can find and stops looking,
|
|
262
|
+
* which provides a small runtime optimization.
|
|
263
|
+
*
|
|
264
|
+
* Declared only where it is honoured. `parseOrFail` throws on the first error by definition, and it
|
|
265
|
+
* used to accept this flag and ignore it.
|
|
266
|
+
* @default undefined
|
|
267
|
+
*/
|
|
268
|
+
getAllErrors?: boolean;
|
|
269
|
+
}
|
|
270
|
+
/**
|
|
271
|
+
* Parses and validates a value against the provided schema, returning a type-safe parsedValue.
|
|
272
|
+
*
|
|
273
|
+
* This function will throw a `ValidationError` if the value does not conform to the schema.
|
|
274
|
+
* The inferred TypeScript type of the returned value will match the structure defined by the schema.
|
|
275
|
+
*
|
|
276
|
+
* @template T
|
|
277
|
+
* @param {T} schema - The schema to validate the received value against. This schema dictates the expected structure and type of the value.
|
|
278
|
+
* @param {unknown} receivedValue - The value to be validated and parsed according to the schema.
|
|
279
|
+
* @param {ParseOptions} options - Options
|
|
280
|
+
* @param {ParseOptions.lng} options.lng - Set language keyword to map Error messages
|
|
281
|
+
* @param {ParseOptions.lng} options.getAllErrors - If `false` or `undefined` - returns the first validation error it can find and stops looking, which provides a small runtime optimization.
|
|
282
|
+
* @returns {[undefined, InferType<T>]} A tuple of [undefined, InferType<T>] if parsing is successful.
|
|
283
|
+
* @returns {[ValidationErrorData[], undefined]} A tuple of [ValidationErrorData[], undefined]] if errors occur.
|
|
284
|
+
*
|
|
285
|
+
* @example
|
|
286
|
+
* const schema = object({
|
|
287
|
+
* name: string(),
|
|
288
|
+
* age: number(),
|
|
289
|
+
* });
|
|
290
|
+
*
|
|
291
|
+
* const [errors, parsedValue] = parse(schema, { name: 'Alice', age: 30 });
|
|
292
|
+
* // parsedValue will be inferred as { name: string; age: number }
|
|
293
|
+
*
|
|
294
|
+
*
|
|
295
|
+
* const [errors, parsedValue] = parse(schema, { name: 'Alice', age: '30' });
|
|
296
|
+
* // First element in array "errors" will have an error because 'age' should be a number, not a string.
|
|
297
|
+
* // Array 'errors' returns only one element.
|
|
298
|
+
*
|
|
299
|
+
*
|
|
300
|
+
* const [errors, parsedValue] = parse(schema, { name: true, age: '30' }, { getAllErrors: true});
|
|
301
|
+
* // Returns array "errors" with multiple errors because 'age' should be a number and 'name' a string.
|
|
302
|
+
* // With provided options { getAllErrors: true}, we can expecte more than one error in 'errors' array.
|
|
303
|
+
*
|
|
304
|
+
*
|
|
305
|
+
* const [errors, parsedValue] = parse(schema, { name: true, age: '30' }, { lng: 'SR'});
|
|
306
|
+
* // First element in array "errors" will have an error because 'age' should be a number, not a string.
|
|
307
|
+
* // With provided options { lng: 'SR'}, errors will be translated to a language mapped with keyword 'SR'
|
|
308
|
+
*/
|
|
309
|
+
declare function parse<T extends CommonSchema>(schema: T, receivedValue: unknown, options?: ParseAllOptions): [ValidationErrorData[], null] | [null, InferType<T>];
|
|
310
|
+
/**
|
|
311
|
+
* The asynchronous counterpart of {@link parse}, for schemas carrying `customAsync` validations.
|
|
312
|
+
*
|
|
313
|
+
* The structure is validated synchronously first and the async validations run afterwards, all
|
|
314
|
+
* together. That means their issues come after the synchronous ones in the returned array, and that an
|
|
315
|
+
* async validation is never reached for a value the synchronous pass already rejected structurally.
|
|
316
|
+
*
|
|
317
|
+
* @example
|
|
318
|
+
* const [errors, value] = await parseAsync(schema, received, { getAllErrors: true });
|
|
319
|
+
*/
|
|
320
|
+
declare function parseAsync<T extends CommonSchema>(schema: T, receivedValue: unknown, options?: ParseAllOptions): Promise<[ValidationErrorData[], null] | [null, InferType<T>]>;
|
|
321
|
+
/**
|
|
322
|
+
* The asynchronous counterpart of {@link parseOrFail}.
|
|
323
|
+
*
|
|
324
|
+
* Unlike the synchronous version it cannot stop at the first error, because the async validations have
|
|
325
|
+
* to be awaited before anything can be reported. It throws the first error found, in the same order
|
|
326
|
+
* `parseAsync` reports them.
|
|
327
|
+
*/
|
|
328
|
+
declare function parseOrFailAsync<T extends CommonSchema>(schema: T, receivedValue: unknown, options?: ParseOptions): Promise<InferType<T>>;
|
|
329
|
+
|
|
330
|
+
export { type AssertInput, type AsyncRequiredValidation, CommonSchema, ExceptionContext, type LazySchemaType, type ObjectShapeSchemaType, type RecordSchemaType, type RequiredValidation, type ValidatorContext, parse, parseAsync, parseOrFail, parseOrFailAsync };
|
package/lib/core.d.ts
ADDED
|
@@ -0,0 +1,330 @@
|
|
|
1
|
+
import { BaseType, TranslationErrorMap, ValidationErrorData, MetaContext, TransformCallback, WithBGuardType, WithArray, WithTuple, WithObject, WithRecord, WithNull, WithUndefined, WithDefault, WithInput } from './commonTypes.js';
|
|
2
|
+
import { InferInput, InferType } from './InferType.js';
|
|
3
|
+
import { ctxSymbol } from './helpers/constants.js';
|
|
4
|
+
import { StandardSchemaProps } from './standardSchema.js';
|
|
5
|
+
|
|
6
|
+
declare class ExceptionContext {
|
|
7
|
+
readonly initialReceived: unknown;
|
|
8
|
+
readonly t: TranslationErrorMap;
|
|
9
|
+
readonly pathToError: string;
|
|
10
|
+
readonly errors?: ValidationErrorData[] | undefined;
|
|
11
|
+
readonly meta?: MetaContext | undefined;
|
|
12
|
+
/** The same location as `pathToError`, as keys. A string path cannot be taken apart again
|
|
13
|
+
* reliably, because a key may itself contain a dot or a bracket. */
|
|
14
|
+
readonly path: readonly PropertyKey[];
|
|
15
|
+
/** Where async validations are collected. Absent during a synchronous parse, which is how one
|
|
16
|
+
* is detected and reported rather than silently skipped. */
|
|
17
|
+
readonly pending?: PendingValidation[] | undefined;
|
|
18
|
+
constructor(initialReceived: unknown, t: TranslationErrorMap, pathToError: string, errors?: ValidationErrorData[] | undefined, meta?: MetaContext | undefined,
|
|
19
|
+
/** The same location as `pathToError`, as keys. A string path cannot be taken apart again
|
|
20
|
+
* reliably, because a key may itself contain a dot or a bracket. */
|
|
21
|
+
path?: readonly PropertyKey[],
|
|
22
|
+
/** Where async validations are collected. Absent during a synchronous parse, which is how one
|
|
23
|
+
* is detected and reported rather than silently skipped. */
|
|
24
|
+
pending?: PendingValidation[] | undefined);
|
|
25
|
+
/**
|
|
26
|
+
* The same location, reporting into a different errors list.
|
|
27
|
+
*
|
|
28
|
+
* A union tries each member against a throwaway list so a member that does not match is not fatal.
|
|
29
|
+
* An async validation reached inside the winning member is awaited long after that decision, so it
|
|
30
|
+
* has to be re-pointed at the real list or its issues would be collected where nobody reads them.
|
|
31
|
+
*/
|
|
32
|
+
withErrors(errors?: ValidationErrorData[]): ExceptionContext;
|
|
33
|
+
/**
|
|
34
|
+
* Records async validations to be awaited once the walk is over.
|
|
35
|
+
*
|
|
36
|
+
* Throws during a synchronous parse rather than dropping them: a validation that never runs is worse
|
|
37
|
+
* than a clear instruction to use parseAsync.
|
|
38
|
+
*/
|
|
39
|
+
enqueueAsync(validations: AsyncRequiredValidation[], received: unknown): void;
|
|
40
|
+
/**
|
|
41
|
+
* Descends into a property or an index, deriving both forms of the location from the same key so
|
|
42
|
+
* they cannot disagree.
|
|
43
|
+
*/
|
|
44
|
+
createChild(pathSegment: PropertyKey, childMeta?: MetaContext): ExceptionContext;
|
|
45
|
+
ref(path: string): unknown;
|
|
46
|
+
addIssue(expected: unknown, received: unknown, messageKey: string): never | void;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* A validation function run against an already type-checked value.
|
|
50
|
+
*
|
|
51
|
+
* `T` is the value the assert knows how to inspect, and it is what stops a string assert from
|
|
52
|
+
* being attached to a number schema: `custom` asks for `RequiredValidation<AssertInput<this>>`,
|
|
53
|
+
* and function parameters are compared contravariantly under `strictFunctionTypes`.
|
|
54
|
+
*
|
|
55
|
+
* An assert that genuinely accepts anything should declare `RequiredValidation<unknown>`, which
|
|
56
|
+
* stays assignable to every schema. The default of `any` is deliberate, so that custom asserts
|
|
57
|
+
* written against the previous signature keep compiling.
|
|
58
|
+
*/
|
|
59
|
+
type RequiredValidation<T = any> = (received: T, ctx: ExceptionContext) => void;
|
|
60
|
+
/**
|
|
61
|
+
* A validation that has to wait for something — a database lookup, an HTTP call.
|
|
62
|
+
*
|
|
63
|
+
* Registered with `customAsync` and run by `parseAsync`. Asserts only add issues, they never change the
|
|
64
|
+
* value, so the value the synchronous walk produced is already final by the time these run.
|
|
65
|
+
*/
|
|
66
|
+
type AsyncRequiredValidation<T = any> = (received: T, ctx: ExceptionContext) => Promise<void>;
|
|
67
|
+
/** An async validation that has been reached, waiting to be awaited once the walk is over. */
|
|
68
|
+
interface PendingValidation {
|
|
69
|
+
validations: AsyncRequiredValidation[];
|
|
70
|
+
received: unknown;
|
|
71
|
+
ctx: ExceptionContext;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* The runtime value a schema hands to its asserts. Nullish is stripped, because `innerCheck`
|
|
75
|
+
* returns before running asserts when the value is `null` or `undefined`.
|
|
76
|
+
*/
|
|
77
|
+
type AssertInput<T> = T extends WithBGuardType<unknown, infer Y> ? NonNullable<Y> : T extends WithArray<unknown, unknown> ? unknown[] : T extends WithTuple<unknown, unknown> ? unknown[] : T extends WithObject<unknown, unknown> ? Record<string, unknown> : T extends WithRecord<unknown, unknown, unknown> ? Record<string, unknown> : unknown;
|
|
78
|
+
type ObjectShapeSchemaType = Record<string, CommonSchema>;
|
|
79
|
+
interface RecordSchemaType {
|
|
80
|
+
key: CommonSchema;
|
|
81
|
+
value: CommonSchema;
|
|
82
|
+
}
|
|
83
|
+
interface LazySchemaType {
|
|
84
|
+
/** The name codeGen emits at the recursion point, instead of descending forever. */
|
|
85
|
+
typeName: string;
|
|
86
|
+
getSchema: () => CommonSchema;
|
|
87
|
+
/** Filled on first use, so the thunk runs once however many values are validated. */
|
|
88
|
+
resolved?: CommonSchema;
|
|
89
|
+
}
|
|
90
|
+
interface ValidatorContext {
|
|
91
|
+
type: BaseType[];
|
|
92
|
+
isNullable?: boolean;
|
|
93
|
+
isOptional?: boolean;
|
|
94
|
+
requiredValidations: RequiredValidation[];
|
|
95
|
+
asyncValidations?: AsyncRequiredValidation[];
|
|
96
|
+
array?: CommonSchema;
|
|
97
|
+
object?: ObjectShapeSchemaType;
|
|
98
|
+
union?: CommonSchema[];
|
|
99
|
+
record?: RecordSchemaType;
|
|
100
|
+
tuple?: CommonSchema[];
|
|
101
|
+
lazy?: LazySchemaType;
|
|
102
|
+
allowUnrecognizedObjectProps?: boolean;
|
|
103
|
+
strictType?: boolean;
|
|
104
|
+
strictTypeValue?: unknown;
|
|
105
|
+
date?: boolean;
|
|
106
|
+
defaultValue?: unknown;
|
|
107
|
+
meta?: MetaContext;
|
|
108
|
+
transformListBefore?: TransformCallback<any, any>[];
|
|
109
|
+
}
|
|
110
|
+
declare class CommonSchema {
|
|
111
|
+
[ctxSymbol]: ValidatorContext;
|
|
112
|
+
constructor(ctx: ValidatorContext);
|
|
113
|
+
/**
|
|
114
|
+
* The Standard Schema v1 interface, which lets a bguard schema be used by any library that accepts
|
|
115
|
+
* a validator without either side knowing about the other.
|
|
116
|
+
*
|
|
117
|
+
* A getter rather than a stored property, so it costs nothing until something asks for it and is
|
|
118
|
+
* not copied by `clone`. `types` is declared but deliberately never assigned: the spec defines it
|
|
119
|
+
* as type-only. Input and output are reported separately, so a consumer generating a form asks for
|
|
120
|
+
* what the schema takes rather than what it returns.
|
|
121
|
+
*/
|
|
122
|
+
get '~standard'(): StandardSchemaProps<InferInput<this>, InferType<this>>;
|
|
123
|
+
/**
|
|
124
|
+
* Returns a copy of this schema that carries its own context.
|
|
125
|
+
*
|
|
126
|
+
* Every refining method goes through this, so a schema can be shared between properties and
|
|
127
|
+
* reused as a base without one use leaking into another. Construction is deliberately bypassed:
|
|
128
|
+
* the subclass constructors validate their arguments and take extra parameters, and neither
|
|
129
|
+
* applies when deriving from an already-valid schema.
|
|
130
|
+
*
|
|
131
|
+
* Public because deriving a schema is a reasonable thing to do from outside as well — the object
|
|
132
|
+
* utilities need it to rebuild a property schema without touching the one they were handed.
|
|
133
|
+
*/
|
|
134
|
+
clone(): this;
|
|
135
|
+
/**
|
|
136
|
+
* @param validators - One or more custom validation functions.
|
|
137
|
+
* @returns {this} A new schema instance with the added custom validation.
|
|
138
|
+
*/
|
|
139
|
+
custom(...validators: RequiredValidation<AssertInput<this>>[]): this;
|
|
140
|
+
/**
|
|
141
|
+
* Adds validations that have to wait for something, such as a database lookup.
|
|
142
|
+
*
|
|
143
|
+
* These run only under `parseAsync` or `parseOrFailAsync`; a synchronous parse reports a
|
|
144
|
+
* `BuildSchemaError` rather than skipping them. They are awaited after the structural walk is
|
|
145
|
+
* complete, all together, so several slow checks across a schema cost one round of waiting.
|
|
146
|
+
*
|
|
147
|
+
* @param validators - One or more async validation functions.
|
|
148
|
+
* @returns {this} A new schema instance with the added validations.
|
|
149
|
+
* @example
|
|
150
|
+
* const schema = string().customAsync(async (received, ctx) => {
|
|
151
|
+
* if (await isTaken(received)) ctx.addIssue('an unused name', received, 'name is taken');
|
|
152
|
+
* });
|
|
153
|
+
*/
|
|
154
|
+
customAsync(...validators: AsyncRequiredValidation<AssertInput<this>>[]): this;
|
|
155
|
+
/**
|
|
156
|
+
* Marks the schema as nullable, allowing the value to be `null`.
|
|
157
|
+
*
|
|
158
|
+
* @returns {WithNull<this>} A new schema instance marked as nullable.
|
|
159
|
+
*/
|
|
160
|
+
nullable(): WithNull<this>;
|
|
161
|
+
/**
|
|
162
|
+
* Marks the schema as optional, allowing the value to be `undefined`.
|
|
163
|
+
*
|
|
164
|
+
* @returns {WithUndefined<this>} A new schema instance marked as optional.
|
|
165
|
+
*/
|
|
166
|
+
optional(): WithUndefined<this>;
|
|
167
|
+
/**
|
|
168
|
+
* Marks the schema as optional, allowing the value to be `undefined`.
|
|
169
|
+
*
|
|
170
|
+
* @returns {this} The schema instance. This method should be used as a last one because it does the check of previous methods and
|
|
171
|
+
*/
|
|
172
|
+
default(defaultValue: InferType<this>): WithDefault<this>;
|
|
173
|
+
/**
|
|
174
|
+
* Applies a transformation to the input value before any validation occurs.
|
|
175
|
+
* The transformation should return a value of the same type as the inferred type of the schema,
|
|
176
|
+
* ensuring that the overall type is not altered.
|
|
177
|
+
*
|
|
178
|
+
* @template In - The type of the input value before transformation (defaults to `unknown`).
|
|
179
|
+
* @param {TransformCallback<In, InferType<this>>} cb - The callback function that performs the transformation.
|
|
180
|
+
* @returns {this} A new schema with the applied transformation.
|
|
181
|
+
*
|
|
182
|
+
* @example
|
|
183
|
+
* const schema = string()
|
|
184
|
+
* .nullable()
|
|
185
|
+
* .transformBeforeValidation((val) => val + '') // Ensure the value is a string
|
|
186
|
+
* .transformBeforeValidation((val: string) => (val === '' ? null : val)); // Convert empty strings to null
|
|
187
|
+
*
|
|
188
|
+
* // Parse 'test' will pass as 'test' is a valid string longer than 3 characters.
|
|
189
|
+
* parseOrFail(schema, 'test');
|
|
190
|
+
*
|
|
191
|
+
* // Parsing '' will be transformed to null and will pass due to .nullable().
|
|
192
|
+
* parseOrFail(schema, '');
|
|
193
|
+
*/
|
|
194
|
+
transformBeforeValidation<In>(cb: TransformCallback<In, InferType<this>>): WithInput<this, In>;
|
|
195
|
+
/**
|
|
196
|
+
* Assigns a unique identifier to the schema.
|
|
197
|
+
* This ID can be used to track or map validation errors back to specific fields
|
|
198
|
+
* in a form or other structures.
|
|
199
|
+
*
|
|
200
|
+
* @param {string} value - The unique identifier for the schema.
|
|
201
|
+
* @returns {this} A new schema with the assigned ID.
|
|
202
|
+
*
|
|
203
|
+
* @example
|
|
204
|
+
* const schema = string().id('username');
|
|
205
|
+
*/
|
|
206
|
+
id(value: string): this;
|
|
207
|
+
/**
|
|
208
|
+
* Provides a description for the schema, offering additional context or information.
|
|
209
|
+
* The description can be used when displaying validation errors or for documentation purposes.
|
|
210
|
+
*
|
|
211
|
+
* @param {string} value - The description for the schema.
|
|
212
|
+
* @returns {this} A new schema with the added description.
|
|
213
|
+
*
|
|
214
|
+
* @example
|
|
215
|
+
* const schema = string().description('The username of the account holder.');
|
|
216
|
+
*/
|
|
217
|
+
description(value: string): this;
|
|
218
|
+
private meta;
|
|
219
|
+
protected defaultValueCheck(): void;
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Parses and validates a value against the provided schema, returning a type-safe result.
|
|
223
|
+
*
|
|
224
|
+
* This function will throw a `ValidationError` if the value does not conform to the schema.
|
|
225
|
+
* The inferred TypeScript type of the returned value will match the structure defined by the schema.
|
|
226
|
+
*
|
|
227
|
+
* @template T
|
|
228
|
+
* @param {T} schema - The schema to validate the received value against. This schema dictates the expected structure and type of the value.
|
|
229
|
+
* @param {unknown} receivedValue - The value to be validated and parsed according to the schema.
|
|
230
|
+
* @param {ParseOptions} options - Options
|
|
231
|
+
* @param {ParseOptions.lng} options.lng - Set language keyword to map Error message
|
|
232
|
+
* @returns {InferType<T>} The validated value, with its TypeScript type inferred from the schema.
|
|
233
|
+
*
|
|
234
|
+
* @throws {ValidationError} If the received value does not match the schema, a `ValidationError` will be thrown.
|
|
235
|
+
* @throws {Error} If an unexpected error occurs during validation, an error will be thrown with a generic message.
|
|
236
|
+
*
|
|
237
|
+
* @example
|
|
238
|
+
* const schema = object({
|
|
239
|
+
* name: string(),
|
|
240
|
+
* age: number(),
|
|
241
|
+
* });
|
|
242
|
+
*
|
|
243
|
+
* const result = parseOrFail(schema, { name: 'Alice', age: 30 });
|
|
244
|
+
* // result will be inferred as { name: string; age: number }
|
|
245
|
+
*
|
|
246
|
+
* parseOrFail(schema, { name: 'Alice', age: '30' });
|
|
247
|
+
* // Throws ValidationError because 'age' should be a number, not a string.
|
|
248
|
+
*/
|
|
249
|
+
declare function parseOrFail<T extends CommonSchema>(schema: T, receivedValue: unknown, options?: ParseOptions): InferType<T>;
|
|
250
|
+
interface ParseOptions {
|
|
251
|
+
/**
|
|
252
|
+
* Set language keyword to map error messages.
|
|
253
|
+
* @default 'default'
|
|
254
|
+
* @example 'sr' or 'Serbia' or any string to identify language
|
|
255
|
+
*/
|
|
256
|
+
lng?: string;
|
|
257
|
+
}
|
|
258
|
+
interface ParseAllOptions extends ParseOptions {
|
|
259
|
+
/**
|
|
260
|
+
* If true, collects all validation errors and returns them.
|
|
261
|
+
* If false or undefined, returns the first validation error it can find and stops looking,
|
|
262
|
+
* which provides a small runtime optimization.
|
|
263
|
+
*
|
|
264
|
+
* Declared only where it is honoured. `parseOrFail` throws on the first error by definition, and it
|
|
265
|
+
* used to accept this flag and ignore it.
|
|
266
|
+
* @default undefined
|
|
267
|
+
*/
|
|
268
|
+
getAllErrors?: boolean;
|
|
269
|
+
}
|
|
270
|
+
/**
|
|
271
|
+
* Parses and validates a value against the provided schema, returning a type-safe parsedValue.
|
|
272
|
+
*
|
|
273
|
+
* This function will throw a `ValidationError` if the value does not conform to the schema.
|
|
274
|
+
* The inferred TypeScript type of the returned value will match the structure defined by the schema.
|
|
275
|
+
*
|
|
276
|
+
* @template T
|
|
277
|
+
* @param {T} schema - The schema to validate the received value against. This schema dictates the expected structure and type of the value.
|
|
278
|
+
* @param {unknown} receivedValue - The value to be validated and parsed according to the schema.
|
|
279
|
+
* @param {ParseOptions} options - Options
|
|
280
|
+
* @param {ParseOptions.lng} options.lng - Set language keyword to map Error messages
|
|
281
|
+
* @param {ParseOptions.lng} options.getAllErrors - If `false` or `undefined` - returns the first validation error it can find and stops looking, which provides a small runtime optimization.
|
|
282
|
+
* @returns {[undefined, InferType<T>]} A tuple of [undefined, InferType<T>] if parsing is successful.
|
|
283
|
+
* @returns {[ValidationErrorData[], undefined]} A tuple of [ValidationErrorData[], undefined]] if errors occur.
|
|
284
|
+
*
|
|
285
|
+
* @example
|
|
286
|
+
* const schema = object({
|
|
287
|
+
* name: string(),
|
|
288
|
+
* age: number(),
|
|
289
|
+
* });
|
|
290
|
+
*
|
|
291
|
+
* const [errors, parsedValue] = parse(schema, { name: 'Alice', age: 30 });
|
|
292
|
+
* // parsedValue will be inferred as { name: string; age: number }
|
|
293
|
+
*
|
|
294
|
+
*
|
|
295
|
+
* const [errors, parsedValue] = parse(schema, { name: 'Alice', age: '30' });
|
|
296
|
+
* // First element in array "errors" will have an error because 'age' should be a number, not a string.
|
|
297
|
+
* // Array 'errors' returns only one element.
|
|
298
|
+
*
|
|
299
|
+
*
|
|
300
|
+
* const [errors, parsedValue] = parse(schema, { name: true, age: '30' }, { getAllErrors: true});
|
|
301
|
+
* // Returns array "errors" with multiple errors because 'age' should be a number and 'name' a string.
|
|
302
|
+
* // With provided options { getAllErrors: true}, we can expecte more than one error in 'errors' array.
|
|
303
|
+
*
|
|
304
|
+
*
|
|
305
|
+
* const [errors, parsedValue] = parse(schema, { name: true, age: '30' }, { lng: 'SR'});
|
|
306
|
+
* // First element in array "errors" will have an error because 'age' should be a number, not a string.
|
|
307
|
+
* // With provided options { lng: 'SR'}, errors will be translated to a language mapped with keyword 'SR'
|
|
308
|
+
*/
|
|
309
|
+
declare function parse<T extends CommonSchema>(schema: T, receivedValue: unknown, options?: ParseAllOptions): [ValidationErrorData[], null] | [null, InferType<T>];
|
|
310
|
+
/**
|
|
311
|
+
* The asynchronous counterpart of {@link parse}, for schemas carrying `customAsync` validations.
|
|
312
|
+
*
|
|
313
|
+
* The structure is validated synchronously first and the async validations run afterwards, all
|
|
314
|
+
* together. That means their issues come after the synchronous ones in the returned array, and that an
|
|
315
|
+
* async validation is never reached for a value the synchronous pass already rejected structurally.
|
|
316
|
+
*
|
|
317
|
+
* @example
|
|
318
|
+
* const [errors, value] = await parseAsync(schema, received, { getAllErrors: true });
|
|
319
|
+
*/
|
|
320
|
+
declare function parseAsync<T extends CommonSchema>(schema: T, receivedValue: unknown, options?: ParseAllOptions): Promise<[ValidationErrorData[], null] | [null, InferType<T>]>;
|
|
321
|
+
/**
|
|
322
|
+
* The asynchronous counterpart of {@link parseOrFail}.
|
|
323
|
+
*
|
|
324
|
+
* Unlike the synchronous version it cannot stop at the first error, because the async validations have
|
|
325
|
+
* to be awaited before anything can be reported. It throws the first error found, in the same order
|
|
326
|
+
* `parseAsync` reports them.
|
|
327
|
+
*/
|
|
328
|
+
declare function parseOrFailAsync<T extends CommonSchema>(schema: T, receivedValue: unknown, options?: ParseOptions): Promise<InferType<T>>;
|
|
329
|
+
|
|
330
|
+
export { type AssertInput, type AsyncRequiredValidation, CommonSchema, ExceptionContext, type LazySchemaType, type ObjectShapeSchemaType, type RecordSchemaType, type RequiredValidation, type ValidatorContext, parse, parseAsync, parseOrFail, parseOrFailAsync };
|