bguard 0.6.0 → 0.7.1
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 +589 -5
- package/lib/InferType.d.mts +37 -3
- package/lib/InferType.d.ts +37 -3
- package/lib/asserts/array/index.d.mts +2 -1
- package/lib/asserts/array/index.d.ts +2 -1
- package/lib/asserts/array/index.js +8 -6
- package/lib/asserts/array/index.js.map +1 -1
- package/lib/asserts/array/index.mjs +7 -5
- package/lib/asserts/array/maxArrayLength.d.mts +2 -1
- package/lib/asserts/array/maxArrayLength.d.ts +2 -1
- package/lib/asserts/array/maxArrayLength.js +5 -4
- package/lib/asserts/array/maxArrayLength.js.map +1 -1
- package/lib/asserts/array/maxArrayLength.mjs +4 -3
- package/lib/asserts/array/minArrayLength.d.mts +2 -1
- package/lib/asserts/array/minArrayLength.d.ts +2 -1
- package/lib/asserts/array/minArrayLength.js +5 -4
- package/lib/asserts/array/minArrayLength.js.map +1 -1
- package/lib/asserts/array/minArrayLength.mjs +4 -3
- package/lib/asserts/bigint/bigintMax.d.mts +2 -1
- package/lib/asserts/bigint/bigintMax.d.ts +2 -1
- package/lib/asserts/bigint/bigintMax.js +4 -4
- package/lib/asserts/bigint/bigintMax.mjs +3 -3
- package/lib/asserts/bigint/bigintMaxExcluded.d.mts +2 -1
- package/lib/asserts/bigint/bigintMaxExcluded.d.ts +2 -1
- package/lib/asserts/bigint/bigintMaxExcluded.js +4 -4
- package/lib/asserts/bigint/bigintMaxExcluded.mjs +3 -3
- package/lib/asserts/bigint/bigintMin.d.mts +2 -1
- package/lib/asserts/bigint/bigintMin.d.ts +2 -1
- package/lib/asserts/bigint/bigintMin.js +4 -4
- package/lib/asserts/bigint/bigintMin.mjs +3 -3
- package/lib/asserts/bigint/bigintMinExcluded.d.mts +2 -1
- package/lib/asserts/bigint/bigintMinExcluded.d.ts +2 -1
- package/lib/asserts/bigint/bigintMinExcluded.js +4 -4
- package/lib/asserts/bigint/bigintMinExcluded.mjs +3 -3
- package/lib/asserts/bigint/index.d.mts +9 -4
- package/lib/asserts/bigint/index.d.ts +9 -4
- package/lib/asserts/bigint/index.js +11 -9
- package/lib/asserts/bigint/index.js.map +1 -1
- package/lib/asserts/bigint/index.mjs +10 -8
- package/lib/asserts/boolean/index.d.mts +10 -3
- package/lib/asserts/boolean/index.d.ts +10 -3
- package/lib/asserts/boolean/index.js +9 -7
- package/lib/asserts/boolean/index.js.map +1 -1
- package/lib/asserts/boolean/index.mjs +8 -6
- package/lib/asserts/coerce/bigint.d.mts +32 -0
- package/lib/asserts/coerce/bigint.d.ts +32 -0
- package/lib/asserts/coerce/bigint.js +16 -0
- package/lib/asserts/coerce/bigint.js.map +1 -0
- package/lib/asserts/coerce/bigint.mjs +16 -0
- package/lib/asserts/coerce/bigint.mjs.map +1 -0
- package/lib/asserts/coerce/boolean.d.mts +35 -0
- package/lib/asserts/coerce/boolean.d.ts +35 -0
- package/lib/asserts/coerce/boolean.js +14 -0
- package/lib/asserts/coerce/boolean.js.map +1 -0
- package/lib/asserts/coerce/boolean.mjs +14 -0
- package/lib/asserts/coerce/boolean.mjs.map +1 -0
- package/lib/asserts/coerce/date.d.mts +32 -0
- package/lib/asserts/coerce/date.d.ts +32 -0
- package/lib/asserts/coerce/date.js +13 -0
- package/lib/asserts/coerce/date.js.map +1 -0
- package/lib/asserts/coerce/date.mjs +13 -0
- package/lib/asserts/coerce/date.mjs.map +1 -0
- package/lib/asserts/coerce/index.d.mts +41 -0
- package/lib/asserts/coerce/index.d.ts +41 -0
- package/lib/asserts/coerce/index.js +41 -0
- package/lib/asserts/coerce/index.js.map +1 -0
- package/lib/asserts/coerce/index.mjs +41 -0
- package/lib/asserts/coerce/index.mjs.map +1 -0
- package/lib/asserts/coerce/number.d.mts +33 -0
- package/lib/asserts/coerce/number.d.ts +33 -0
- package/lib/asserts/coerce/number.js +16 -0
- package/lib/asserts/coerce/number.js.map +1 -0
- package/lib/asserts/coerce/number.mjs +16 -0
- package/lib/asserts/coerce/number.mjs.map +1 -0
- package/lib/asserts/coerce/string.d.mts +30 -0
- package/lib/asserts/coerce/string.d.ts +30 -0
- package/lib/asserts/coerce/string.js +17 -0
- package/lib/asserts/coerce/string.js.map +1 -0
- package/lib/asserts/coerce/string.mjs +17 -0
- package/lib/asserts/coerce/string.mjs.map +1 -0
- package/lib/asserts/date/dateMax.d.mts +2 -1
- package/lib/asserts/date/dateMax.d.ts +2 -1
- package/lib/asserts/date/dateMax.js +4 -4
- package/lib/asserts/date/dateMax.mjs +3 -3
- package/lib/asserts/date/dateMin.d.mts +2 -1
- package/lib/asserts/date/dateMin.d.ts +2 -1
- package/lib/asserts/date/dateMin.js +4 -4
- package/lib/asserts/date/dateMin.mjs +3 -3
- package/lib/asserts/date/index.d.mts +2 -1
- package/lib/asserts/date/index.d.ts +2 -1
- package/lib/asserts/date/index.js +8 -6
- package/lib/asserts/date/index.js.map +1 -1
- package/lib/asserts/date/index.mjs +7 -5
- 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/intersection/index.mjs.map +1 -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/lazy/index.mjs.map +1 -0
- package/lib/asserts/mix/equalTo.d.mts +2 -1
- package/lib/asserts/mix/equalTo.d.ts +2 -1
- package/lib/asserts/mix/equalTo.js +4 -4
- package/lib/asserts/mix/equalTo.mjs +3 -3
- package/lib/asserts/mix/index.d.mts +10 -3
- package/lib/asserts/mix/index.d.ts +10 -3
- package/lib/asserts/mix/index.js +6 -6
- package/lib/asserts/mix/index.mjs +5 -5
- package/lib/asserts/mix/oneOfValues.d.mts +2 -1
- package/lib/asserts/mix/oneOfValues.d.ts +2 -1
- package/lib/asserts/mix/oneOfValues.js +4 -4
- package/lib/asserts/mix/oneOfValues.mjs +3 -3
- package/lib/asserts/number/index.d.mts +4 -3
- package/lib/asserts/number/index.d.ts +4 -3
- package/lib/asserts/number/index.js +11 -9
- package/lib/asserts/number/index.js.map +1 -1
- package/lib/asserts/number/index.mjs +10 -8
- package/lib/asserts/number/max.d.mts +2 -1
- package/lib/asserts/number/max.d.ts +2 -1
- package/lib/asserts/number/max.js +5 -4
- package/lib/asserts/number/max.js.map +1 -1
- package/lib/asserts/number/max.mjs +4 -3
- package/lib/asserts/number/maxExcluded.d.mts +2 -1
- package/lib/asserts/number/maxExcluded.d.ts +2 -1
- package/lib/asserts/number/maxExcluded.js +5 -4
- package/lib/asserts/number/maxExcluded.js.map +1 -1
- package/lib/asserts/number/maxExcluded.mjs +4 -3
- package/lib/asserts/number/min.d.mts +2 -1
- package/lib/asserts/number/min.d.ts +2 -1
- package/lib/asserts/number/min.js +5 -4
- package/lib/asserts/number/min.js.map +1 -1
- package/lib/asserts/number/min.mjs +4 -3
- package/lib/asserts/number/minExcluded.d.mts +2 -1
- package/lib/asserts/number/minExcluded.d.ts +2 -1
- package/lib/asserts/number/minExcluded.js +5 -4
- package/lib/asserts/number/minExcluded.js.map +1 -1
- package/lib/asserts/number/minExcluded.mjs +4 -3
- package/lib/asserts/number/negative.d.mts +2 -1
- package/lib/asserts/number/negative.d.ts +2 -1
- package/lib/asserts/number/negative.js +5 -4
- package/lib/asserts/number/negative.js.map +1 -1
- package/lib/asserts/number/negative.mjs +4 -3
- package/lib/asserts/number/positive.d.mts +2 -1
- package/lib/asserts/number/positive.d.ts +2 -1
- package/lib/asserts/number/positive.js +5 -4
- package/lib/asserts/number/positive.js.map +1 -1
- package/lib/asserts/number/positive.mjs +4 -3
- 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/extend.mjs.map +1 -0
- package/lib/asserts/object/index.d.mts +3 -2
- package/lib/asserts/object/index.d.ts +3 -2
- package/lib/asserts/object/index.js +8 -6
- package/lib/asserts/object/index.js.map +1 -1
- package/lib/asserts/object/index.mjs +7 -5
- package/lib/asserts/object/maxKeys.d.mts +2 -1
- package/lib/asserts/object/maxKeys.d.ts +2 -1
- package/lib/asserts/object/maxKeys.js +5 -4
- package/lib/asserts/object/maxKeys.js.map +1 -1
- package/lib/asserts/object/maxKeys.mjs +4 -3
- 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/omit.mjs.map +1 -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/partial.mjs.map +1 -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/pick.mjs.map +1 -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/object/required.mjs.map +1 -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/record/index.mjs.map +1 -0
- package/lib/asserts/string/atLeastOneDigit.d.mts +2 -1
- package/lib/asserts/string/atLeastOneDigit.d.ts +2 -1
- package/lib/asserts/string/atLeastOneDigit.js +4 -4
- package/lib/asserts/string/atLeastOneDigit.mjs +3 -3
- package/lib/asserts/string/atLeastOneLowerChar.d.mts +2 -1
- package/lib/asserts/string/atLeastOneLowerChar.d.ts +2 -1
- package/lib/asserts/string/atLeastOneLowerChar.js +4 -4
- package/lib/asserts/string/atLeastOneLowerChar.mjs +3 -3
- package/lib/asserts/string/atLeastOneSpecialChar.d.mts +2 -1
- package/lib/asserts/string/atLeastOneSpecialChar.d.ts +2 -1
- package/lib/asserts/string/atLeastOneSpecialChar.js +4 -4
- package/lib/asserts/string/atLeastOneSpecialChar.mjs +3 -3
- package/lib/asserts/string/atLeastOneUpperChar.d.mts +2 -1
- package/lib/asserts/string/atLeastOneUpperChar.d.ts +2 -1
- package/lib/asserts/string/atLeastOneUpperChar.js +4 -4
- package/lib/asserts/string/atLeastOneUpperChar.mjs +3 -3
- package/lib/asserts/string/contains.d.mts +2 -1
- package/lib/asserts/string/contains.d.ts +2 -1
- package/lib/asserts/string/contains.js +4 -4
- package/lib/asserts/string/contains.mjs +3 -3
- package/lib/asserts/string/email.d.mts +2 -1
- package/lib/asserts/string/email.d.ts +2 -1
- package/lib/asserts/string/email.js +5 -4
- package/lib/asserts/string/email.js.map +1 -1
- package/lib/asserts/string/email.mjs +4 -3
- package/lib/asserts/string/endsWith.d.mts +2 -1
- package/lib/asserts/string/endsWith.d.ts +2 -1
- package/lib/asserts/string/endsWith.js +4 -4
- package/lib/asserts/string/endsWith.mjs +3 -3
- package/lib/asserts/string/index.d.mts +9 -4
- package/lib/asserts/string/index.d.ts +9 -4
- package/lib/asserts/string/index.js +12 -9
- package/lib/asserts/string/index.js.map +1 -1
- package/lib/asserts/string/index.mjs +11 -8
- package/lib/asserts/string/isValidDate.d.mts +2 -1
- package/lib/asserts/string/isValidDate.d.ts +2 -1
- package/lib/asserts/string/isValidDate.js +5 -4
- package/lib/asserts/string/isValidDate.js.map +1 -1
- package/lib/asserts/string/isValidDate.mjs +4 -3
- package/lib/asserts/string/isValidDateTime.d.mts +2 -1
- package/lib/asserts/string/isValidDateTime.d.ts +2 -1
- package/lib/asserts/string/isValidDateTime.js +5 -4
- package/lib/asserts/string/isValidDateTime.js.map +1 -1
- package/lib/asserts/string/isValidDateTime.mjs +4 -3
- package/lib/asserts/string/isValidTime.d.mts +2 -1
- package/lib/asserts/string/isValidTime.d.ts +2 -1
- package/lib/asserts/string/isValidTime.js +5 -4
- package/lib/asserts/string/isValidTime.js.map +1 -1
- package/lib/asserts/string/isValidTime.mjs +4 -3
- package/lib/asserts/string/lowerCase.d.mts +2 -1
- package/lib/asserts/string/lowerCase.d.ts +2 -1
- package/lib/asserts/string/lowerCase.js +4 -4
- package/lib/asserts/string/lowerCase.mjs +3 -3
- package/lib/asserts/string/maxLength.d.mts +2 -1
- package/lib/asserts/string/maxLength.d.ts +2 -1
- package/lib/asserts/string/maxLength.js +5 -4
- package/lib/asserts/string/maxLength.js.map +1 -1
- package/lib/asserts/string/maxLength.mjs +4 -3
- package/lib/asserts/string/minLength.d.mts +2 -1
- package/lib/asserts/string/minLength.d.ts +2 -1
- package/lib/asserts/string/minLength.js +5 -4
- package/lib/asserts/string/minLength.js.map +1 -1
- package/lib/asserts/string/minLength.mjs +4 -3
- package/lib/asserts/string/regExp.d.mts +2 -1
- package/lib/asserts/string/regExp.d.ts +2 -1
- package/lib/asserts/string/regExp.js +5 -4
- package/lib/asserts/string/regExp.js.map +1 -1
- package/lib/asserts/string/regExp.mjs +4 -3
- package/lib/asserts/string/startsWith.d.mts +2 -1
- package/lib/asserts/string/startsWith.d.ts +2 -1
- package/lib/asserts/string/startsWith.js +4 -4
- package/lib/asserts/string/startsWith.mjs +3 -3
- package/lib/asserts/string/upperCase.d.mts +2 -1
- package/lib/asserts/string/upperCase.d.ts +2 -1
- package/lib/asserts/string/upperCase.js +4 -4
- package/lib/asserts/string/upperCase.mjs +3 -3
- package/lib/asserts/string/uuid.d.mts +2 -1
- package/lib/asserts/string/uuid.d.ts +2 -1
- package/lib/asserts/string/uuid.js +5 -4
- package/lib/asserts/string/uuid.js.map +1 -1
- package/lib/asserts/string/uuid.mjs +4 -3
- package/lib/asserts/string/uuidV1.d.mts +2 -1
- package/lib/asserts/string/uuidV1.d.ts +2 -1
- package/lib/asserts/string/uuidV1.js +4 -4
- package/lib/asserts/string/uuidV1.mjs +3 -3
- package/lib/asserts/string/uuidV2.d.mts +2 -1
- package/lib/asserts/string/uuidV2.d.ts +2 -1
- package/lib/asserts/string/uuidV2.js +4 -4
- package/lib/asserts/string/uuidV2.mjs +3 -3
- package/lib/asserts/string/uuidV3.d.mts +2 -1
- package/lib/asserts/string/uuidV3.d.ts +2 -1
- package/lib/asserts/string/uuidV3.js +4 -4
- package/lib/asserts/string/uuidV3.mjs +3 -3
- package/lib/asserts/string/uuidV4.d.mts +2 -1
- package/lib/asserts/string/uuidV4.d.ts +2 -1
- package/lib/asserts/string/uuidV4.js +4 -4
- package/lib/asserts/string/uuidV4.mjs +3 -3
- package/lib/asserts/string/uuidV5.d.mts +2 -1
- package/lib/asserts/string/uuidV5.d.ts +2 -1
- package/lib/asserts/string/uuidV5.js +4 -4
- package/lib/asserts/string/uuidV5.mjs +3 -3
- package/lib/asserts/string/validUrl.d.mts +2 -1
- package/lib/asserts/string/validUrl.d.ts +2 -1
- package/lib/asserts/string/validUrl.js +5 -4
- package/lib/asserts/string/validUrl.js.map +1 -1
- package/lib/asserts/string/validUrl.mjs +4 -3
- 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/tuple/index.mjs.map +1 -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/asserts/union/index.mjs.map +1 -0
- package/lib/chunk-23R5R7PL.js +69 -0
- package/lib/chunk-23R5R7PL.js.map +1 -0
- package/lib/{chunk-Y5MNJGFX.js → chunk-2AYQ7GRP.js} +9 -6
- package/lib/chunk-2AYQ7GRP.js.map +1 -0
- package/lib/{chunk-OMSHZITC.js → chunk-2KLV3CHA.js} +3 -3
- package/lib/{chunk-OMSHZITC.js.map → chunk-2KLV3CHA.js.map} +1 -1
- package/lib/{chunk-MHWPSQB3.js → chunk-2X6V3ODY.js} +3 -3
- package/lib/{chunk-MHWPSQB3.js.map → chunk-2X6V3ODY.js.map} +1 -1
- package/lib/{chunk-QIFA6S5U.mjs → chunk-346TIMNH.mjs} +2 -2
- package/lib/{chunk-QIFA6S5U.mjs.map → chunk-346TIMNH.mjs.map} +1 -1
- package/lib/{chunk-PAV4SQQL.js → chunk-3D6TPN7F.js} +3 -3
- package/lib/{chunk-PAV4SQQL.js.map → chunk-3D6TPN7F.js.map} +1 -1
- package/lib/{chunk-4UPXP4I3.js → chunk-3OAUE5VW.js} +8 -5
- 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-QEG24G7E.mjs → chunk-3T5QKF7X.mjs} +2 -2
- package/lib/{chunk-QEG24G7E.mjs.map → chunk-3T5QKF7X.mjs.map} +1 -1
- package/lib/{chunk-FI737YZJ.js → chunk-45K4AUO3.js} +9 -6
- package/lib/chunk-45K4AUO3.js.map +1 -0
- package/lib/{chunk-PNSDUVRE.mjs → chunk-4AZOGLHD.mjs} +2 -2
- package/lib/{chunk-PNSDUVRE.mjs.map → chunk-4AZOGLHD.mjs.map} +1 -1
- package/lib/chunk-4PPMVVQY.js +67 -0
- package/lib/chunk-4PPMVVQY.js.map +1 -0
- package/lib/{chunk-HWVM4SYU.mjs → chunk-54F462SS.mjs} +7 -4
- package/lib/chunk-54F462SS.mjs.map +1 -0
- package/lib/{chunk-S4FWDTEW.mjs → chunk-55P4YTMX.mjs} +2 -2
- package/lib/{chunk-S4FWDTEW.mjs.map → chunk-55P4YTMX.mjs.map} +1 -1
- package/lib/chunk-56TWNROC.js +20 -0
- package/lib/chunk-56TWNROC.js.map +1 -0
- package/lib/chunk-5PIGAEGL.mjs +22 -0
- package/lib/chunk-5PIGAEGL.mjs.map +1 -0
- package/lib/{chunk-NFD7D5GZ.mjs → chunk-5PXMSVTE.mjs} +30 -22
- package/lib/chunk-5PXMSVTE.mjs.map +1 -0
- package/lib/{chunk-ZGUF5ZDP.mjs → chunk-5U5CYDRB.mjs} +2 -2
- package/lib/{chunk-ZGUF5ZDP.mjs.map → chunk-5U5CYDRB.mjs.map} +1 -1
- package/lib/{chunk-V7C77FML.mjs → chunk-5WLWZKC6.mjs} +7 -4
- package/lib/chunk-5WLWZKC6.mjs.map +1 -0
- package/lib/{chunk-GFWZQ4XW.mjs → chunk-5WV7FMW7.mjs} +8 -5
- package/lib/chunk-5WV7FMW7.mjs.map +1 -0
- package/lib/{chunk-OE3L7EKN.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-BRFUFNU4.js → chunk-7A4RN5UD.js} +9 -6
- package/lib/chunk-7A4RN5UD.js.map +1 -0
- package/lib/{chunk-ENZ5WDUQ.js → chunk-7CNZKYPM.js} +8 -5
- package/lib/chunk-7CNZKYPM.js.map +1 -0
- package/lib/{chunk-NS4GXUCA.mjs → chunk-7F4P72SG.mjs} +2 -2
- package/lib/{chunk-NS4GXUCA.mjs.map → chunk-7F4P72SG.mjs.map} +1 -1
- package/lib/{chunk-6WKSLMJG.mjs → chunk-A2LPSUNQ.mjs} +8 -7
- package/lib/{chunk-6WKSLMJG.mjs.map → chunk-A2LPSUNQ.mjs.map} +1 -1
- package/lib/chunk-A36G62K5.mjs +49 -0
- package/lib/chunk-A36G62K5.mjs.map +1 -0
- package/lib/{chunk-24LO7MNY.js → chunk-A5OEVSSV.js} +8 -5
- package/lib/chunk-A5OEVSSV.js.map +1 -0
- package/lib/{chunk-KRCOKWAB.mjs → chunk-ABSZMCDX.mjs} +8 -5
- package/lib/chunk-ABSZMCDX.mjs.map +1 -0
- package/lib/chunk-AGB5RWYD.js +32 -0
- package/lib/chunk-AGB5RWYD.js.map +1 -0
- package/lib/{chunk-PVQALO2H.js → chunk-ALXDH7GS.js} +3 -3
- package/lib/{chunk-PVQALO2H.js.map → chunk-ALXDH7GS.js.map} +1 -1
- package/lib/chunk-AO6DKPJZ.js +49 -0
- package/lib/chunk-AO6DKPJZ.js.map +1 -0
- package/lib/{chunk-TQDMUHTA.mjs → chunk-AYJCGPXI.mjs} +2 -2
- package/lib/{chunk-TQDMUHTA.mjs.map → chunk-AYJCGPXI.mjs.map} +1 -1
- package/lib/{chunk-OSFIPFQ3.mjs → chunk-AYSJLD4S.mjs} +5 -5
- package/lib/{chunk-OSFIPFQ3.mjs.map → chunk-AYSJLD4S.mjs.map} +1 -1
- package/lib/chunk-B3IWQRZF.mjs +22 -0
- package/lib/chunk-B3IWQRZF.mjs.map +1 -0
- package/lib/{chunk-DCPRPCZ3.js → chunk-B4WB3UB7.js} +3 -3
- package/lib/{chunk-DCPRPCZ3.js.map → chunk-B4WB3UB7.js.map} +1 -1
- package/lib/chunk-BZ6R6RWE.mjs +19 -0
- package/lib/chunk-BZ6R6RWE.mjs.map +1 -0
- package/lib/{chunk-MCQHWS3E.mjs → chunk-C6ICGQEX.mjs} +7 -4
- package/lib/chunk-C6ICGQEX.mjs.map +1 -0
- package/lib/{chunk-2ANPCB4O.mjs → chunk-C76DLZFD.mjs} +2 -2
- package/lib/{chunk-2ANPCB4O.mjs.map → chunk-C76DLZFD.mjs.map} +1 -1
- package/lib/chunk-CLRHVTVY.js +50 -0
- package/lib/chunk-CLRHVTVY.js.map +1 -0
- package/lib/{chunk-QMIH3A4D.js → chunk-CWYS6MUA.js} +3 -3
- package/lib/{chunk-QMIH3A4D.js.map → chunk-CWYS6MUA.js.map} +1 -1
- package/lib/{chunk-W3U7RYLP.mjs → chunk-D42AL6CN.mjs} +2 -2
- package/lib/{chunk-W3U7RYLP.mjs.map → chunk-D42AL6CN.mjs.map} +1 -1
- package/lib/{chunk-YDTQASAY.mjs → chunk-D4YY45O2.mjs} +8 -5
- package/lib/chunk-D4YY45O2.mjs.map +1 -0
- package/lib/{chunk-WLPDAJB3.js → chunk-DKGRAVID.js} +29 -11
- package/lib/chunk-DKGRAVID.js.map +1 -0
- package/lib/{chunk-TZBAW5OO.mjs → chunk-DLEDKNPD.mjs} +2 -2
- package/lib/{chunk-TZBAW5OO.mjs.map → chunk-DLEDKNPD.mjs.map} +1 -1
- package/lib/{chunk-OZ3BTSSQ.mjs → chunk-DS2LUTTF.mjs} +23 -20
- package/lib/chunk-DS2LUTTF.mjs.map +1 -0
- package/lib/{chunk-6JPYR2TS.js → chunk-ECLNZ233.js} +9 -6
- 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-EI6TQG4L.js +80 -0
- package/lib/chunk-EI6TQG4L.js.map +1 -0
- package/lib/{chunk-6LPQRAFN.js → chunk-EN745GWN.js} +10 -7
- package/lib/chunk-EN745GWN.js.map +1 -0
- package/lib/chunk-ET2I4EXQ.mjs +18 -0
- package/lib/chunk-ET2I4EXQ.mjs.map +1 -0
- package/lib/{chunk-OFZMO7PB.mjs → chunk-ETBJ4NF4.mjs} +7 -4
- package/lib/chunk-ETBJ4NF4.mjs.map +1 -0
- package/lib/chunk-FA3S35LQ.mjs +20 -0
- package/lib/chunk-FA3S35LQ.mjs.map +1 -0
- package/lib/{chunk-23QTSXPQ.js → chunk-FJEBPEGR.js} +8 -5
- package/lib/chunk-FJEBPEGR.js.map +1 -0
- package/lib/chunk-FTHEF6SB.js +14 -0
- package/lib/{chunk-XDVSL5B6.js.map → chunk-FTHEF6SB.js.map} +1 -1
- package/lib/{chunk-WYM2TIVW.mjs → chunk-FU5WAVRB.mjs} +5 -4
- package/lib/{chunk-WYM2TIVW.mjs.map → chunk-FU5WAVRB.mjs.map} +1 -1
- package/lib/chunk-G2VC3SQB.js +22 -0
- package/lib/chunk-G2VC3SQB.js.map +1 -0
- package/lib/{chunk-NOJB5GBZ.mjs → chunk-G6YZVGWC.mjs} +8 -5
- package/lib/chunk-G6YZVGWC.mjs.map +1 -0
- package/lib/{chunk-Z2HZXSDA.js → chunk-GSLVYDXO.js} +3 -3
- package/lib/{chunk-Z2HZXSDA.js.map → chunk-GSLVYDXO.js.map} +1 -1
- package/lib/{chunk-H4OW6OUF.js → chunk-GTGXSQKC.js} +3 -3
- package/lib/{chunk-H4OW6OUF.js.map → chunk-GTGXSQKC.js.map} +1 -1
- package/lib/{chunk-Z3NPFUIA.mjs → chunk-H3FXZTYS.mjs} +2 -2
- package/lib/{chunk-Z3NPFUIA.mjs.map → chunk-H3FXZTYS.mjs.map} +1 -1
- package/lib/{chunk-T2A3XXQZ.mjs → chunk-HKDDJSN2.mjs} +8 -5
- package/lib/chunk-HKDDJSN2.mjs.map +1 -0
- package/lib/chunk-HU5SDECP.js +29 -0
- package/lib/chunk-HU5SDECP.js.map +1 -0
- package/lib/{chunk-THU5VBSO.mjs → chunk-IIL6D2UL.mjs} +2 -2
- package/lib/{chunk-AJHBPMZT.mjs → chunk-IWNVHB2K.mjs} +8 -5
- package/lib/chunk-IWNVHB2K.mjs.map +1 -0
- package/lib/{chunk-UYQFYQQG.mjs → chunk-J3EKIWPZ.mjs} +33 -22
- package/lib/chunk-J3EKIWPZ.mjs.map +1 -0
- package/lib/chunk-JCX2TB7E.js +13 -0
- package/lib/chunk-JCX2TB7E.js.map +1 -0
- package/lib/{chunk-2ESDKTV4.js → chunk-JF7KZZ7R.js} +9 -6
- 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-DED5KDLM.js → chunk-JLEQOYDW.js} +15 -13
- package/lib/chunk-JLEQOYDW.js.map +1 -0
- package/lib/{chunk-HD37VXPZ.mjs → chunk-JND3VAPR.mjs} +2 -2
- package/lib/{chunk-HD37VXPZ.mjs.map → chunk-JND3VAPR.mjs.map} +1 -1
- package/lib/chunk-K4YXIN2V.mjs +33 -0
- package/lib/chunk-K4YXIN2V.mjs.map +1 -0
- package/lib/{chunk-NY2TPU6O.mjs → chunk-K6QYFFMX.mjs} +8 -5
- package/lib/chunk-K6QYFFMX.mjs.map +1 -0
- package/lib/chunk-K7CDOU6F.js +13 -0
- package/lib/chunk-K7CDOU6F.js.map +1 -0
- package/lib/{chunk-M3HYPZLE.mjs → chunk-KAFZGQ2W.mjs} +10 -8
- package/lib/chunk-KAFZGQ2W.mjs.map +1 -0
- package/lib/chunk-KALHMMEN.mjs +29 -0
- package/lib/chunk-KALHMMEN.mjs.map +1 -0
- package/lib/{chunk-DFYP4GKE.js → chunk-KDPYWGMJ.js} +8 -5
- package/lib/chunk-KDPYWGMJ.js.map +1 -0
- package/lib/chunk-KGXWQ3XP.mjs +69 -0
- package/lib/chunk-KGXWQ3XP.mjs.map +1 -0
- package/lib/{chunk-R25HSJPH.js → chunk-KIVIWBIY.js} +3 -3
- package/lib/{chunk-R25HSJPH.js.map → chunk-KIVIWBIY.js.map} +1 -1
- package/lib/{chunk-ZNQHNLKW.js → chunk-KZBW5WCK.js} +8 -5
- package/lib/chunk-KZBW5WCK.js.map +1 -0
- package/lib/{chunk-VVXKATDH.js → chunk-L36PQXUB.js} +8 -5
- package/lib/chunk-L36PQXUB.js.map +1 -0
- package/lib/chunk-LDZFOOWN.mjs +595 -0
- package/lib/chunk-LDZFOOWN.mjs.map +1 -0
- package/lib/{chunk-AXKX5BGH.js → chunk-LHEU4XAC.js} +2 -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-AQCV7PB4.mjs → chunk-M7EMQU7U.mjs} +5 -5
- package/lib/{chunk-AQCV7PB4.mjs.map → chunk-M7EMQU7U.mjs.map} +1 -1
- package/lib/{chunk-GGWJJFXY.mjs → chunk-MOHROZTD.mjs} +2 -2
- package/lib/{chunk-GGWJJFXY.mjs.map → chunk-MOHROZTD.mjs.map} +1 -1
- package/lib/{chunk-SBO6OQIX.mjs → chunk-MQGE7GIK.mjs} +8 -5
- package/lib/chunk-MQGE7GIK.mjs.map +1 -0
- package/lib/chunk-MUXY6Q45.mjs +13 -0
- package/lib/chunk-MUXY6Q45.mjs.map +1 -0
- package/lib/{chunk-H2M4FCRZ.mjs → chunk-NC7E2FQR.mjs} +2 -2
- package/lib/{chunk-H2M4FCRZ.mjs.map → chunk-NC7E2FQR.mjs.map} +1 -1
- package/lib/chunk-NM3VRT77.mjs +120 -0
- package/lib/chunk-NM3VRT77.mjs.map +1 -0
- package/lib/{chunk-OHUOBIHX.mjs → chunk-NM4TCTZM.mjs} +28 -10
- 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-2D3HCTJV.js → chunk-NZOANK7A.js} +3 -3
- package/lib/{chunk-2D3HCTJV.js.map → chunk-NZOANK7A.js.map} +1 -1
- 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-ARIYSQMH.js → chunk-OHJ2EB4T.js} +3 -3
- package/lib/{chunk-ARIYSQMH.js.map → chunk-OHJ2EB4T.js.map} +1 -1
- package/lib/{chunk-TLPVFRWR.js → chunk-OPA6AXSH.js} +3 -3
- package/lib/{chunk-TLPVFRWR.js.map → chunk-OPA6AXSH.js.map} +1 -1
- package/lib/chunk-OQB5UGWG.mjs +24 -0
- package/lib/chunk-OQB5UGWG.mjs.map +1 -0
- package/lib/{chunk-3W2COCXV.js → chunk-ORQBVFHY.js} +3 -3
- package/lib/{chunk-3W2COCXV.js.map → chunk-ORQBVFHY.js.map} +1 -1
- package/lib/{chunk-C44KAKMR.js → chunk-OW7RK5YW.js} +3 -3
- package/lib/{chunk-C44KAKMR.js.map → chunk-OW7RK5YW.js.map} +1 -1
- package/lib/{chunk-22254THF.mjs → chunk-OY5DJBRV.mjs} +2 -2
- package/lib/{chunk-22254THF.mjs.map → chunk-OY5DJBRV.mjs.map} +1 -1
- 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-2IPGGARK.mjs → chunk-P6M6QZU5.mjs} +7 -4
- package/lib/chunk-P6M6QZU5.mjs.map +1 -0
- package/lib/{chunk-Y54K6TQO.js → chunk-PFADKWMO.js} +3 -3
- package/lib/{chunk-Y54K6TQO.js.map → chunk-PFADKWMO.js.map} +1 -1
- package/lib/chunk-POPLWPM4.mjs +19 -0
- package/lib/chunk-POPLWPM4.mjs.map +1 -0
- package/lib/{chunk-VOFKYSJD.js → chunk-POQZCV3D.js} +3 -3
- package/lib/{chunk-VOFKYSJD.js.map → chunk-POQZCV3D.js.map} +1 -1
- package/lib/{chunk-M2GOQ7TZ.mjs → chunk-QM4MJTTD.mjs} +7 -4
- package/lib/chunk-QM4MJTTD.mjs.map +1 -0
- package/lib/{chunk-WJGXVKZY.js → chunk-QNA4O6AU.js} +3 -3
- package/lib/{chunk-WJGXVKZY.js.map → chunk-QNA4O6AU.js.map} +1 -1
- package/lib/{chunk-ZDXO3TGZ.mjs → chunk-RCD6EO4Q.mjs} +7 -4
- package/lib/chunk-RCD6EO4Q.mjs.map +1 -0
- package/lib/{chunk-ZEGRYDE5.mjs → chunk-RDJK3X4J.mjs} +8 -5
- package/lib/chunk-RDJK3X4J.mjs.map +1 -0
- package/lib/{chunk-4N5J426R.mjs → chunk-RXU74KSN.mjs} +2 -2
- package/lib/{chunk-4N5J426R.mjs.map → chunk-RXU74KSN.mjs.map} +1 -1
- package/lib/{chunk-S5D5AFDF.js → chunk-S6N4N4FT.js} +9 -6
- package/lib/chunk-S6N4N4FT.js.map +1 -0
- package/lib/chunk-SBNUNRI3.mjs +13 -0
- package/lib/chunk-SBNUNRI3.mjs.map +1 -0
- package/lib/{chunk-SFIX77W5.js → chunk-SGWF66HS.js} +3 -3
- package/lib/{chunk-SFIX77W5.js.map → chunk-SGWF66HS.js.map} +1 -1
- package/lib/{chunk-OU5BTUDV.mjs → chunk-SKMDZ4S6.mjs} +2 -2
- package/lib/{chunk-OU5BTUDV.mjs.map → chunk-SKMDZ4S6.mjs.map} +1 -1
- package/lib/chunk-SVRCKC65.js +120 -0
- package/lib/chunk-SVRCKC65.js.map +1 -0
- package/lib/{chunk-OQYS7JVF.js → chunk-SY2V2V54.js} +6 -6
- package/lib/{chunk-OQYS7JVF.js.map → chunk-SY2V2V54.js.map} +1 -1
- package/lib/{chunk-YMPRYKNY.js → chunk-SZO4SUUG.js} +9 -6
- 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-TD3Y3IV3.js +13 -0
- package/lib/chunk-TD3Y3IV3.js.map +1 -0
- package/lib/{chunk-C2VSTWID.js → chunk-TJ7IQSHU.js} +9 -6
- package/lib/chunk-TJ7IQSHU.js.map +1 -0
- package/lib/{chunk-7JL66G7G.mjs → chunk-TPSWNY5K.mjs} +2 -2
- package/lib/{chunk-7JL66G7G.mjs.map → chunk-TPSWNY5K.mjs.map} +1 -1
- package/lib/chunk-UCY3HEYZ.mjs +13 -0
- package/lib/chunk-UCY3HEYZ.mjs.map +1 -0
- package/lib/{chunk-HPIF2CMT.js → chunk-UIJIIIOA.js} +9 -6
- 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-N3EHGKZV.mjs → chunk-UN5S46LE.mjs} +7 -4
- package/lib/chunk-UN5S46LE.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-62EKGBXF.js → chunk-VGOAXY26.js} +8 -5
- 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-LXZTBF7F.js → chunk-VWHKNZLG.js} +3 -3
- package/lib/{chunk-LXZTBF7F.js.map → chunk-VWHKNZLG.js.map} +1 -1
- package/lib/chunk-WH7WJMFF.js +79 -0
- package/lib/chunk-WH7WJMFF.js.map +1 -0
- package/lib/{chunk-TLRVQWCI.mjs → chunk-WL7BV4XV.mjs} +9 -6
- package/lib/chunk-WL7BV4XV.mjs.map +1 -0
- package/lib/chunk-WLZZTIOV.js +18 -0
- package/lib/chunk-WLZZTIOV.js.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-UHMICS34.mjs → chunk-YETYTLAD.mjs} +2 -2
- package/lib/{chunk-UHMICS34.mjs.map → chunk-YETYTLAD.mjs.map} +1 -1
- package/lib/chunk-YJUYGFG2.mjs +26 -0
- package/lib/chunk-YJUYGFG2.mjs.map +1 -0
- package/lib/chunk-YOF36UOS.js +19 -0
- package/lib/chunk-YOF36UOS.js.map +1 -0
- package/lib/{chunk-NBR3QGKW.js → chunk-YPOEO3UF.js} +7 -6
- package/lib/chunk-YPOEO3UF.js.map +1 -0
- package/lib/{chunk-4ZKU4RJL.mjs → chunk-YQP44G45.mjs} +2 -2
- package/lib/{chunk-4ZKU4RJL.mjs.map → chunk-YQP44G45.mjs.map} +1 -1
- package/lib/{chunk-22VHHJSS.js → chunk-Z7LBOQRQ.js} +6 -6
- package/lib/{chunk-22VHHJSS.js.map → chunk-Z7LBOQRQ.js.map} +1 -1
- package/lib/{chunk-IDDU6B6T.js → chunk-ZIBHO6FI.js} +3 -3
- package/lib/{chunk-IDDU6B6T.js.map → chunk-ZIBHO6FI.js.map} +1 -1
- package/lib/{chunk-TJQ5NVL4.js → chunk-ZJGY6EOE.js} +19 -10
- package/lib/chunk-ZJGY6EOE.js.map +1 -0
- package/lib/{chunk-V2J4TQR5.mjs → chunk-ZQKVVWD5.mjs} +2 -2
- package/lib/{chunk-V2J4TQR5.mjs.map → chunk-ZQKVVWD5.mjs.map} +1 -1
- package/lib/{chunk-FIDPCCCW.js → chunk-ZWFSAKQK.js} +8 -2
- package/lib/chunk-ZWFSAKQK.js.map +1 -0
- package/lib/codeGen.d.mts +1 -0
- package/lib/codeGen.d.ts +1 -0
- package/lib/codeGen.js +3 -3
- package/lib/codeGen.mjs +2 -2
- package/lib/commonTypes.d.mts +34 -1
- package/lib/commonTypes.d.ts +34 -1
- package/lib/core.d.mts +153 -23
- package/lib/core.d.ts +153 -23
- package/lib/core.js +9 -5
- package/lib/core.js.map +1 -1
- package/lib/core.mjs +10 -6
- 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.js +2 -2
- package/lib/helpers/constants.mjs +1 -1
- 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 +1 -0
- package/lib/helpers/setStrictType.d.ts +1 -0
- package/lib/helpers/setStrictType.js +3 -3
- package/lib/helpers/setStrictType.mjs +2 -2
- package/lib/index.d.mts +21 -2
- package/lib/index.d.ts +21 -2
- package/lib/index.js +135 -55
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +166 -86
- 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 +7 -0
- package/lib/translationMap.d.ts +7 -0
- package/lib/translationMap.js +3 -3
- package/lib/translationMap.mjs +2 -2
- package/package.json +194 -46
- package/lib/chunk-23QTSXPQ.js.map +0 -1
- package/lib/chunk-24LO7MNY.js.map +0 -1
- package/lib/chunk-2ESDKTV4.js.map +0 -1
- package/lib/chunk-2HGS4STD.js +0 -48
- package/lib/chunk-2HGS4STD.js.map +0 -1
- package/lib/chunk-2IPGGARK.mjs.map +0 -1
- package/lib/chunk-4UPXP4I3.js.map +0 -1
- package/lib/chunk-5NYVRFG3.mjs +0 -48
- package/lib/chunk-5NYVRFG3.mjs.map +0 -1
- package/lib/chunk-62EKGBXF.js.map +0 -1
- package/lib/chunk-6JPYR2TS.js.map +0 -1
- package/lib/chunk-6LPQRAFN.js.map +0 -1
- package/lib/chunk-AJHBPMZT.mjs.map +0 -1
- package/lib/chunk-AXKX5BGH.js.map +0 -1
- package/lib/chunk-BRFUFNU4.js.map +0 -1
- package/lib/chunk-C2VSTWID.js.map +0 -1
- package/lib/chunk-D6G32F2K.js +0 -69
- package/lib/chunk-D6G32F2K.js.map +0 -1
- package/lib/chunk-DED5KDLM.js.map +0 -1
- package/lib/chunk-DFYP4GKE.js.map +0 -1
- package/lib/chunk-ENZ5WDUQ.js.map +0 -1
- package/lib/chunk-FI737YZJ.js.map +0 -1
- package/lib/chunk-FIDPCCCW.js.map +0 -1
- package/lib/chunk-GFWZQ4XW.mjs.map +0 -1
- package/lib/chunk-HPIF2CMT.js.map +0 -1
- package/lib/chunk-HUWO5UKU.js +0 -64
- package/lib/chunk-HUWO5UKU.js.map +0 -1
- package/lib/chunk-HWVM4SYU.mjs.map +0 -1
- package/lib/chunk-KRCOKWAB.mjs.map +0 -1
- package/lib/chunk-M2GOQ7TZ.mjs.map +0 -1
- package/lib/chunk-M3HYPZLE.mjs.map +0 -1
- package/lib/chunk-MCQHWS3E.mjs.map +0 -1
- package/lib/chunk-N3EHGKZV.mjs.map +0 -1
- package/lib/chunk-NBR3QGKW.js.map +0 -1
- package/lib/chunk-NFD7D5GZ.mjs.map +0 -1
- package/lib/chunk-NOJB5GBZ.mjs.map +0 -1
- package/lib/chunk-NY2TPU6O.mjs.map +0 -1
- package/lib/chunk-OE3L7EKN.mjs.map +0 -1
- package/lib/chunk-OFZMO7PB.mjs.map +0 -1
- package/lib/chunk-OHUOBIHX.mjs.map +0 -1
- package/lib/chunk-OZ3BTSSQ.mjs.map +0 -1
- package/lib/chunk-QIPGUTIG.mjs +0 -302
- package/lib/chunk-QIPGUTIG.mjs.map +0 -1
- package/lib/chunk-S5D5AFDF.js.map +0 -1
- package/lib/chunk-SBO6OQIX.mjs.map +0 -1
- package/lib/chunk-T2A3XXQZ.mjs.map +0 -1
- package/lib/chunk-TCDQA2NU.js +0 -31
- package/lib/chunk-TCDQA2NU.js.map +0 -1
- package/lib/chunk-TJQ5NVL4.js.map +0 -1
- package/lib/chunk-TLRVQWCI.mjs.map +0 -1
- package/lib/chunk-UYQFYQQG.mjs.map +0 -1
- package/lib/chunk-V7C77FML.mjs.map +0 -1
- package/lib/chunk-VN4GLOEN.js +0 -302
- package/lib/chunk-VN4GLOEN.js.map +0 -1
- package/lib/chunk-VVXKATDH.js.map +0 -1
- package/lib/chunk-WLPDAJB3.js.map +0 -1
- package/lib/chunk-XBE75VFX.js +0 -13
- package/lib/chunk-XBE75VFX.js.map +0 -1
- package/lib/chunk-XDVSL5B6.js +0 -14
- package/lib/chunk-XIOV4SHZ.mjs +0 -13
- package/lib/chunk-XIOV4SHZ.mjs.map +0 -1
- package/lib/chunk-Y5MNJGFX.js.map +0 -1
- package/lib/chunk-YDTQASAY.mjs.map +0 -1
- package/lib/chunk-YMPRYKNY.js.map +0 -1
- package/lib/chunk-Z4XOKGU3.js +0 -71
- package/lib/chunk-Z4XOKGU3.js.map +0 -1
- package/lib/chunk-ZDXO3TGZ.mjs.map +0 -1
- package/lib/chunk-ZEGRYDE5.mjs.map +0 -1
- package/lib/chunk-ZNQHNLKW.js.map +0 -1
- package/lib/chunk-ZTCXXAKD.mjs.map +0 -1
- /package/lib/{chunk-THU5VBSO.mjs.map → chunk-IIL6D2UL.mjs.map} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/asserts/number/positive.ts"],"sourcesContent":["import { _constrain } from '../../helpers/jsonSchemaConstraint';\nimport { setToDefaultLocale } from '../../translationMap';\nimport type { ExceptionContext, RequiredValidation } from '../../core';\n\nconst positiveErrorMessage = 'The received value is not a positive number';\nconst positiveErrorKey = 'n:positive';\n\n/**\n * @description Asserts that a number value is positive (greater than zero).\n * @returns {RequiredValidation} A validation function that takes a received number and an exception context.\n * @throws {ValidationError} if the received value is not positive.\n * @example\n * const schema = number().custom(positive());\n * parseOrFail(schema, 10); // Valid\n * parseOrFail(schema, 0); // Throws an error: 'The received value is not a positive number'\n * parseOrFail(schema, -5); // Throws an error: 'The received value is not a positive number'\n *\n * @translation Error Translation Key = 'n:positive'\n */\nexport const positive = (): RequiredValidation<number> =>\n _constrain({ exclusiveMinimum: 0 }, (received: number, ctx: ExceptionContext) => {\n if (received <= 0) ctx.addIssue('positive', received, positiveErrorKey);\n });\n\npositive.key = positiveErrorKey;\npositive.message = positiveErrorMessage;\nsetToDefaultLocale(positive);\n"],"mappings":";;;;;;;;AAIA,IAAM,uBAAuB;AAC7B,IAAM,mBAAmB;AAclB,IAAM,WAAW,MACtB,WAAW,EAAE,kBAAkB,EAAE,GAAG,CAAC,UAAkB,QAA0B;AAC/E,MAAI,YAAY,EAAG,KAAI,SAAS,YAAY,UAAU,gBAAgB;AACxE,CAAC;AAEH,SAAS,MAAM;AACf,SAAS,UAAU;AACnB,mBAAmB,QAAQ;","names":[]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
setToDefaultLocale
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-65X7NTUS.mjs";
|
|
4
4
|
|
|
5
5
|
// src/asserts/string/atLeastOneUpperChar.ts
|
|
6
6
|
var atLeastOneUpperCharErrorMessage = "The received value does not contain at least one uppercase character";
|
|
@@ -17,4 +17,4 @@ setToDefaultLocale(atLeastOneUpperChar);
|
|
|
17
17
|
export {
|
|
18
18
|
atLeastOneUpperChar
|
|
19
19
|
};
|
|
20
|
-
//# sourceMappingURL=chunk-
|
|
20
|
+
//# sourceMappingURL=chunk-RXU74KSN.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/asserts/string/atLeastOneUpperChar.ts"],"sourcesContent":["import type { ExceptionContext, RequiredValidation } from '../../core';\nimport { setToDefaultLocale } from '../../translationMap';\n\nconst atLeastOneUpperCharErrorMessage = 'The received value does not contain at least one uppercase character';\nconst atLeastOneUpperCharErrorKey = 's:atLeastOneUpperChar';\n\n/**\n * @description Asserts that a string value contains at least one uppercase character.\n * @returns {RequiredValidation} A validation function that takes a received string and an exception context.\n * @throws {ValidationError} if the received value does not contain at least one uppercase character.\n * @example\n * const schema = string().custom(atLeastOneUpperChar());\n * parseOrFail(schema, 'abcDEF'); // Valid\n * parseOrFail(schema, 'abcdef'); // Throws an error: 'The received value does not contain at least one uppercase character'\n *\n * @translation Error Translation Key = 's:atLeastOneUpperChar'\n */\nexport const atLeastOneUpperChar = (): RequiredValidation => (received: string, ctx: ExceptionContext) => {\n const upperCharRegExp = /[A-Z]/;\n if (!upperCharRegExp.test(received))\n ctx.addIssue('at least one uppercase character', received, atLeastOneUpperCharErrorKey);\n};\n\natLeastOneUpperChar.key = atLeastOneUpperCharErrorKey;\natLeastOneUpperChar.message = atLeastOneUpperCharErrorMessage;\nsetToDefaultLocale(atLeastOneUpperChar);\n"],"mappings":";;;;;AAGA,IAAM,kCAAkC;AACxC,IAAM,8BAA8B;AAa7B,IAAM,sBAAsB,
|
|
1
|
+
{"version":3,"sources":["../src/asserts/string/atLeastOneUpperChar.ts"],"sourcesContent":["import type { ExceptionContext, RequiredValidation } from '../../core';\nimport { setToDefaultLocale } from '../../translationMap';\n\nconst atLeastOneUpperCharErrorMessage = 'The received value does not contain at least one uppercase character';\nconst atLeastOneUpperCharErrorKey = 's:atLeastOneUpperChar';\n\n/**\n * @description Asserts that a string value contains at least one uppercase character.\n * @returns {RequiredValidation} A validation function that takes a received string and an exception context.\n * @throws {ValidationError} if the received value does not contain at least one uppercase character.\n * @example\n * const schema = string().custom(atLeastOneUpperChar());\n * parseOrFail(schema, 'abcDEF'); // Valid\n * parseOrFail(schema, 'abcdef'); // Throws an error: 'The received value does not contain at least one uppercase character'\n *\n * @translation Error Translation Key = 's:atLeastOneUpperChar'\n */\nexport const atLeastOneUpperChar = (): RequiredValidation<string> => (received: string, ctx: ExceptionContext) => {\n const upperCharRegExp = /[A-Z]/;\n if (!upperCharRegExp.test(received))\n ctx.addIssue('at least one uppercase character', received, atLeastOneUpperCharErrorKey);\n};\n\natLeastOneUpperChar.key = atLeastOneUpperCharErrorKey;\natLeastOneUpperChar.message = atLeastOneUpperCharErrorMessage;\nsetToDefaultLocale(atLeastOneUpperChar);\n"],"mappings":";;;;;AAGA,IAAM,kCAAkC;AACxC,IAAM,8BAA8B;AAa7B,IAAM,sBAAsB,MAAkC,CAAC,UAAkB,QAA0B;AAChH,QAAM,kBAAkB;AACxB,MAAI,CAAC,gBAAgB,KAAK,QAAQ;AAChC,QAAI,SAAS,oCAAoC,UAAU,2BAA2B;AAC1F;AAEA,oBAAoB,MAAM;AAC1B,oBAAoB,UAAU;AAC9B,mBAAmB,mBAAmB;","names":[]}
|
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkWOPNDC4Rjs = require('./chunk-WOPNDC4R.js');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
var _chunkZJGY6EOEjs = require('./chunk-ZJGY6EOE.js');
|
|
4
7
|
|
|
5
8
|
// src/asserts/string/regExp.ts
|
|
6
9
|
var regExpErrorMessage = "The received value does not match the required text pattern";
|
|
7
10
|
var regExpErrorKey = "s:regExp";
|
|
8
|
-
var regExp = (expected) => (received, ctx) => {
|
|
9
|
-
if (!expected.test(received)) ctx.addIssue(expected, received,
|
|
10
|
-
};
|
|
11
|
+
var regExp = (expected) => _chunkWOPNDC4Rjs._constrain.call(void 0, { pattern: expected.source }, (received, ctx) => {
|
|
12
|
+
if (!expected.test(received)) ctx.addIssue(expected, received, regExpErrorKey);
|
|
13
|
+
});
|
|
11
14
|
regExp.key = regExpErrorKey;
|
|
12
15
|
regExp.message = regExpErrorMessage;
|
|
13
|
-
|
|
16
|
+
_chunkZJGY6EOEjs.setToDefaultLocale.call(void 0, regExp);
|
|
14
17
|
|
|
15
18
|
|
|
16
19
|
|
|
17
20
|
exports.regExp = regExp;
|
|
18
|
-
//# sourceMappingURL=chunk-
|
|
21
|
+
//# sourceMappingURL=chunk-S6N4N4FT.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/bguard/bguard/lib/chunk-S6N4N4FT.js","../src/asserts/string/regExp.ts"],"names":[],"mappings":"AAAA;AACE;AACF,sDAA4B;AAC5B;AACE;AACF,sDAA4B;AAC5B;AACA;ACHA,IAAM,mBAAA,EAAqB,6DAAA;AAC3B,IAAM,eAAA,EAAiB,UAAA;AAchB,IAAM,OAAA,EAAS,CAAC,QAAA,EAAA,GACrB,yCAAA,EAAa,OAAA,EAAS,QAAA,CAAS,OAAO,CAAA,EAAG,CAAC,QAAA,EAAkB,GAAA,EAAA,GAA0B;AACpF,EAAA,GAAA,CAAI,CAAC,QAAA,CAAS,IAAA,CAAK,QAAQ,CAAA,EAAG,GAAA,CAAI,QAAA,CAAS,QAAA,EAAU,QAAA,EAAU,cAAc,CAAA;AAC/E,CAAC,CAAA;AAEH,MAAA,CAAO,IAAA,EAAM,cAAA;AACb,MAAA,CAAO,QAAA,EAAU,kBAAA;AACjB,iDAAA,MAAyB,CAAA;ADVzB;AACA;AACE;AACF,wBAAC","file":"/home/runner/work/bguard/bguard/lib/chunk-S6N4N4FT.js","sourcesContent":[null,"import type { ExceptionContext, RequiredValidation } from '../../core';\nimport { _constrain } from '../../helpers/jsonSchemaConstraint';\nimport { setToDefaultLocale } from '../../translationMap';\n\nconst regExpErrorMessage = 'The received value does not match the required text pattern';\nconst regExpErrorKey = 's:regExp';\n\n/**\n * @description Asserts that a string value matches a specified regular expression pattern.\n * @param {RegExp} expected The regular expression pattern that the string value should match.\n * @returns {RequiredValidation} A validation function that takes a received string and an exception context.\n * @throws {ValidationError} if the received value does not match the expected pattern.\n * @example\n * const schema = string().custom(regExp(/^[A-Za-z0-9]+$/)); // Validates against alphanumeric pattern\n * parseOrFail(schema, 'valid123'); // Valid\n * parseOrFail(schema, 'invalid!@#'); // Throws an error: 'The received value does not match the required text pattern'\n *\n * @translation Error Translation Key = 's:regExp'\n */\nexport const regExp = (expected: RegExp): RequiredValidation<string> =>\n _constrain({ pattern: expected.source }, (received: string, ctx: ExceptionContext) => {\n if (!expected.test(received)) ctx.addIssue(expected, received, regExpErrorKey);\n });\n\nregExp.key = regExpErrorKey;\nregExp.message = regExpErrorMessage;\nsetToDefaultLocale(regExp);\n"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import {
|
|
2
|
+
string
|
|
3
|
+
} from "./chunk-J3EKIWPZ.mjs";
|
|
4
|
+
|
|
5
|
+
// src/asserts/coerce/string.ts
|
|
6
|
+
var coerceString = () => string().transformBeforeValidation(
|
|
7
|
+
(received) => received === null || typeof received === "string" ? received : String(received)
|
|
8
|
+
);
|
|
9
|
+
|
|
10
|
+
export {
|
|
11
|
+
coerceString
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=chunk-SBNUNRI3.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/asserts/coerce/string.ts"],"sourcesContent":["import { string } from '../string/index';\n\n/**\n * A coercing transform must never throw: it runs before validation, and throwing would replace a clear\n * validation error with an unexplained failure. Anything it cannot convert is passed through unchanged\n * so that validation reports the type problem itself.\n *\n * `null` is never coerced, so `nullable()` still decides whether it is allowed rather than it becoming\n * the string `'null'` or the number `0`.\n *\n * The return type is inferred rather than written out. Naming it flattened the schema to\n * `CommonSchema`, which silently dropped the methods only the concrete classes define — `equalTo`,\n * `oneOfValues`, `onlyTrue`, `onlyFalse`.\n */\n/**\n * @description Coerces the received value to a string before validating it. Anything that is not\n * already a string is passed through `String`.\n *\n * @returns A string schema that accepts `unknown` as its input type.\n * @example\n * parseOrFail(coerceString(), 42); // '42'\n */\nexport const coerceString = () =>\n string().transformBeforeValidation<unknown>((received) =>\n received === null || typeof received === 'string' ? (received as string) : String(received),\n );\n"],"mappings":";;;;;AAsBO,IAAM,eAAe,MAC1B,OAAO,EAAE;AAAA,EAAmC,CAAC,aAC3C,aAAa,QAAQ,OAAO,aAAa,WAAY,WAAsB,OAAO,QAAQ;AAC5F;","names":[]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkZJGY6EOEjs = require('./chunk-ZJGY6EOE.js');
|
|
4
4
|
|
|
5
5
|
// src/asserts/string/uuidV5.ts
|
|
6
6
|
var uuidV5ErrorMessage = "The received value is not a valid UUID v5";
|
|
@@ -13,9 +13,9 @@ var uuidV5 = () => (received, ctx) => {
|
|
|
13
13
|
};
|
|
14
14
|
uuidV5.key = uuidV5ErrorKey;
|
|
15
15
|
uuidV5.message = uuidV5ErrorMessage;
|
|
16
|
-
|
|
16
|
+
_chunkZJGY6EOEjs.setToDefaultLocale.call(void 0, uuidV5);
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
exports.uuidV5 = uuidV5;
|
|
21
|
-
//# sourceMappingURL=chunk-
|
|
21
|
+
//# sourceMappingURL=chunk-SGWF66HS.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/bguard/bguard/lib/chunk-
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/bguard/bguard/lib/chunk-SGWF66HS.js","../src/asserts/string/uuidV5.ts"],"names":[],"mappings":"AAAA;AACE;AACF,sDAA4B;AAC5B;AACA;ACDA,IAAM,mBAAA,EAAqB,2CAAA;AAC3B,IAAM,eAAA,EAAiB,UAAA;AAEvB,IAAM,cAAA,EAAgB,wEAAA;AAcf,IAAM,OAAA,EAAS,CAAA,EAAA,GAAkC,CAAC,QAAA,EAAkB,GAAA,EAAA,GAA0B;AACnG,EAAA,GAAA,CAAI,CAAC,aAAA,CAAc,IAAA,CAAK,QAAQ,CAAA,EAAG;AACjC,IAAA,GAAA,CAAI,QAAA,CAAS,SAAA,EAAW,QAAA,EAAU,cAAc,CAAA;AAAA,EAClD;AACF,CAAA;AAEA,MAAA,CAAO,IAAA,EAAM,cAAA;AACb,MAAA,CAAO,QAAA,EAAU,kBAAA;AACjB,iDAAA,MAAyB,CAAA;ADZzB;AACA;AACE;AACF,wBAAC","file":"/home/runner/work/bguard/bguard/lib/chunk-SGWF66HS.js","sourcesContent":[null,"import type { ExceptionContext, RequiredValidation } from '../../core';\nimport { setToDefaultLocale } from '../../translationMap';\n\nconst uuidV5ErrorMessage = 'The received value is not a valid UUID v5';\nconst uuidV5ErrorKey = 's:uuidV5';\n\nconst uuidV5Pattern = /^[0-9a-f]{8}-[0-9a-f]{4}-5[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;\n\n/**\n * @description Asserts that a string value matches the UUID v5 format.\n * @returns {RequiredValidation} A validation function that takes a received string and an exception context.\n * @throws {ValidationError} if the received value is not a valid UUID v5.\n * @example\n * const schema = string().custom(uuidV5());\n * parseOrFail(schema, '550e8400-e29b-51d4-a716-446655440000'); // Valid\n * parseOrFail(schema, '550e8400-e29b-41d4-a716-446655440000'); // Throws an error: 'The received value is not a valid UUID v5'\n * parseOrFail(schema, 'invalid-uuid'); // Throws an error: 'The received value is not a valid UUID v5'\n *\n * @translation Error Translation Key = 's:uuidV5'\n */\nexport const uuidV5 = (): RequiredValidation<string> => (received: string, ctx: ExceptionContext) => {\n if (!uuidV5Pattern.test(received)) {\n ctx.addIssue('uuid v5', received, uuidV5ErrorKey);\n }\n};\n\nuuidV5.key = uuidV5ErrorKey;\nuuidV5.message = uuidV5ErrorMessage;\nsetToDefaultLocale(uuidV5);\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
setToDefaultLocale
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-65X7NTUS.mjs";
|
|
4
4
|
|
|
5
5
|
// src/asserts/string/atLeastOneSpecialChar.ts
|
|
6
6
|
var atLeastOneSpecialCharErrorMessage = "The received value does not contain at least one special character";
|
|
@@ -20,4 +20,4 @@ setToDefaultLocale(atLeastOneSpecialChar);
|
|
|
20
20
|
export {
|
|
21
21
|
atLeastOneSpecialChar
|
|
22
22
|
};
|
|
23
|
-
//# sourceMappingURL=chunk-
|
|
23
|
+
//# sourceMappingURL=chunk-SKMDZ4S6.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/asserts/string/atLeastOneSpecialChar.ts"],"sourcesContent":["import type { ExceptionContext, RequiredValidation } from '../../core';\nimport { setToDefaultLocale } from '../../translationMap';\n\nconst atLeastOneSpecialCharErrorMessage = 'The received value does not contain at least one special character';\nconst atLeastOneSpecialCharErrorKey = 's:atLeastOneSpecialChar';\n\n/**\n * @description Asserts that a string value contains at least one special character.\n * @param {string} [allowedSpecialChars=*] The string containing allowed special characters. Defaults to '*@$!#%&()^~{}'.\n * @returns {RequiredValidation} A validation function that takes a received string and an exception context.\n * @throws {ValidationError} if the received value does not contain at least one of the allowed special characters.\n * @example\n * const schema = string().custom(atLeastOneSpecialChar()); // Default special characters\n * parseOrFail(schema, 'abc!def'); // Valid\n * parseOrFail(schema, 'abcdef'); // Throws an error: 'The received value does not contain at least one special character'\n *\n * const customSchema = string().custom(atLeastOneSpecialChar('@$')); // Custom special characters\n * parseOrFail(customSchema, 'abc@def'); // Valid\n * parseOrFail(customSchema, 'abcdef'); // Throws an error: 'The received value does not contain at least one special character'\n *\n * @translation Error Translation Key = 's:atLeastOneSpecialChar'\n */\nexport const atLeastOneSpecialChar = (allowedSpecialChars?: string): RequiredValidation => {\n const specialCharRegExp = new RegExp(\n `[${(allowedSpecialChars ?? '*@$!#%&()^~{}').replace(/[-/\\\\^$*+?.()|[\\]{}]/g, '\\\\$&')}]`,\n );\n return (received: string, ctx: ExceptionContext) => {\n if (!specialCharRegExp.test(received)) ctx.addIssue('special character', received, atLeastOneSpecialCharErrorKey);\n };\n};\n\natLeastOneSpecialChar.key = atLeastOneSpecialCharErrorKey;\natLeastOneSpecialChar.message = atLeastOneSpecialCharErrorMessage;\nsetToDefaultLocale(atLeastOneSpecialChar);\n"],"mappings":";;;;;AAGA,IAAM,oCAAoC;AAC1C,IAAM,gCAAgC;AAkB/B,IAAM,wBAAwB,CAAC,
|
|
1
|
+
{"version":3,"sources":["../src/asserts/string/atLeastOneSpecialChar.ts"],"sourcesContent":["import type { ExceptionContext, RequiredValidation } from '../../core';\nimport { setToDefaultLocale } from '../../translationMap';\n\nconst atLeastOneSpecialCharErrorMessage = 'The received value does not contain at least one special character';\nconst atLeastOneSpecialCharErrorKey = 's:atLeastOneSpecialChar';\n\n/**\n * @description Asserts that a string value contains at least one special character.\n * @param {string} [allowedSpecialChars=*] The string containing allowed special characters. Defaults to '*@$!#%&()^~{}'.\n * @returns {RequiredValidation} A validation function that takes a received string and an exception context.\n * @throws {ValidationError} if the received value does not contain at least one of the allowed special characters.\n * @example\n * const schema = string().custom(atLeastOneSpecialChar()); // Default special characters\n * parseOrFail(schema, 'abc!def'); // Valid\n * parseOrFail(schema, 'abcdef'); // Throws an error: 'The received value does not contain at least one special character'\n *\n * const customSchema = string().custom(atLeastOneSpecialChar('@$')); // Custom special characters\n * parseOrFail(customSchema, 'abc@def'); // Valid\n * parseOrFail(customSchema, 'abcdef'); // Throws an error: 'The received value does not contain at least one special character'\n *\n * @translation Error Translation Key = 's:atLeastOneSpecialChar'\n */\nexport const atLeastOneSpecialChar = (allowedSpecialChars?: string): RequiredValidation<string> => {\n const specialCharRegExp = new RegExp(\n `[${(allowedSpecialChars ?? '*@$!#%&()^~{}').replace(/[-/\\\\^$*+?.()|[\\]{}]/g, '\\\\$&')}]`,\n );\n return (received: string, ctx: ExceptionContext) => {\n if (!specialCharRegExp.test(received)) ctx.addIssue('special character', received, atLeastOneSpecialCharErrorKey);\n };\n};\n\natLeastOneSpecialChar.key = atLeastOneSpecialCharErrorKey;\natLeastOneSpecialChar.message = atLeastOneSpecialCharErrorMessage;\nsetToDefaultLocale(atLeastOneSpecialChar);\n"],"mappings":";;;;;AAGA,IAAM,oCAAoC;AAC1C,IAAM,gCAAgC;AAkB/B,IAAM,wBAAwB,CAAC,wBAA6D;AACjG,QAAM,oBAAoB,IAAI;AAAA,IAC5B,KAAK,uBAAuB,iBAAiB,QAAQ,yBAAyB,MAAM,CAAC;AAAA,EACvF;AACA,SAAO,CAAC,UAAkB,QAA0B;AAClD,QAAI,CAAC,kBAAkB,KAAK,QAAQ,EAAG,KAAI,SAAS,qBAAqB,UAAU,6BAA6B;AAAA,EAClH;AACF;AAEA,sBAAsB,MAAM;AAC5B,sBAAsB,UAAU;AAChC,mBAAmB,qBAAqB;","names":[]}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
|
+
|
|
3
|
+
var _chunk6LUSV3SSjs = require('./chunk-6LUSV3SS.js');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
var _chunkLHEU4XACjs = require('./chunk-LHEU4XAC.js');
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
var _chunkZWFSAKQKjs = require('./chunk-ZWFSAKQK.js');
|
|
10
|
+
|
|
11
|
+
// src/toJSONSchema.ts
|
|
12
|
+
var typeNames = {
|
|
13
|
+
string: "string",
|
|
14
|
+
number: "number",
|
|
15
|
+
boolean: "boolean",
|
|
16
|
+
object: "object"
|
|
17
|
+
};
|
|
18
|
+
function constraintsOf(schemaData) {
|
|
19
|
+
const constraints = {};
|
|
20
|
+
for (const validation of schemaData.requiredValidations) {
|
|
21
|
+
const carried = validation.jsonSchema;
|
|
22
|
+
if (carried) Object.assign(constraints, carried);
|
|
23
|
+
}
|
|
24
|
+
return constraints;
|
|
25
|
+
}
|
|
26
|
+
function literalOf(schemaData) {
|
|
27
|
+
if (!schemaData.strictType) return void 0;
|
|
28
|
+
const unquote = (value) => typeof value === "string" && value.startsWith("'") && value.endsWith("'") ? value.slice(1, -1).replace(/\\'/g, "'").replace(/\\\\/g, "\\") : value;
|
|
29
|
+
if (Array.isArray(schemaData.strictTypeValue)) return { enum: schemaData.strictTypeValue.map(unquote) };
|
|
30
|
+
return { const: unquote(schemaData.strictTypeValue) };
|
|
31
|
+
}
|
|
32
|
+
function baseOf(schemaData, context) {
|
|
33
|
+
if (schemaData.lazy) {
|
|
34
|
+
const { typeName, getSchema } = schemaData.lazy;
|
|
35
|
+
if (context.inProgress.has(typeName)) return { $ref: `#/$defs/${typeName}` };
|
|
36
|
+
schemaData.lazy.resolved ??= getSchema();
|
|
37
|
+
if (!(schemaData.lazy.resolved instanceof _chunk6LUSV3SSjs.CommonSchema))
|
|
38
|
+
throw new (0, _chunkZWFSAKQKjs.BuildSchemaError)("Invalid schema returned from lazy method");
|
|
39
|
+
context.inProgress.add(typeName);
|
|
40
|
+
context.definitions[typeName] = generate(schemaData.lazy.resolved, context);
|
|
41
|
+
context.inProgress.delete(typeName);
|
|
42
|
+
return { $ref: `#/$defs/${typeName}` };
|
|
43
|
+
}
|
|
44
|
+
if (schemaData.union) return { anyOf: schemaData.union.map((member) => generate(member, context)) };
|
|
45
|
+
if (schemaData.tuple)
|
|
46
|
+
return {
|
|
47
|
+
type: "array",
|
|
48
|
+
// Draft 2020-12 spells positional schemas `prefixItems`, and forbidding extras is what makes it a
|
|
49
|
+
// tuple rather than an array that happens to start a certain way.
|
|
50
|
+
prefixItems: schemaData.tuple.map((position) => generate(position, context)),
|
|
51
|
+
items: false,
|
|
52
|
+
minItems: schemaData.tuple.length,
|
|
53
|
+
maxItems: schemaData.tuple.length
|
|
54
|
+
};
|
|
55
|
+
if (schemaData.record) {
|
|
56
|
+
const keyLiteral = literalOf(schemaData.record.key[_chunkLHEU4XACjs.ctxSymbol]);
|
|
57
|
+
const valueSchema = generate(schemaData.record.value, context);
|
|
58
|
+
if (_optionalChain([keyLiteral, 'optionalAccess', _ => _.enum]))
|
|
59
|
+
return {
|
|
60
|
+
type: "object",
|
|
61
|
+
properties: Object.fromEntries(keyLiteral.enum.map((key) => [String(key), valueSchema])),
|
|
62
|
+
additionalProperties: false
|
|
63
|
+
};
|
|
64
|
+
return { type: "object", additionalProperties: valueSchema };
|
|
65
|
+
}
|
|
66
|
+
if (schemaData.array) return { type: "array", items: generate(schemaData.array, context) };
|
|
67
|
+
if (schemaData.object) {
|
|
68
|
+
const properties = {};
|
|
69
|
+
const required = [];
|
|
70
|
+
for (const [key, valueSchema] of Object.entries(schemaData.object)) {
|
|
71
|
+
const valueSchemaData = valueSchema[_chunkLHEU4XACjs.ctxSymbol];
|
|
72
|
+
properties[key] = generate(valueSchema, context);
|
|
73
|
+
if (!valueSchemaData.isOptional && valueSchemaData.defaultValue === void 0) required.push(key);
|
|
74
|
+
}
|
|
75
|
+
const objectSchema = { type: "object", properties };
|
|
76
|
+
if (required.length) objectSchema.required = required;
|
|
77
|
+
if (!schemaData.allowUnrecognizedObjectProps) objectSchema.additionalProperties = false;
|
|
78
|
+
return objectSchema;
|
|
79
|
+
}
|
|
80
|
+
if (schemaData.date) return { type: "string", format: "date-time" };
|
|
81
|
+
const named = schemaData.type.filter((type) => type !== "undefined");
|
|
82
|
+
if (!named.length) return {};
|
|
83
|
+
const jsonTypes = named.map((type) => {
|
|
84
|
+
const jsonType = typeNames[type];
|
|
85
|
+
if (!jsonType) throw new (0, _chunkZWFSAKQKjs.BuildSchemaError)(`Type '${type}' has no JSON Schema equivalent and cannot be generated`);
|
|
86
|
+
return jsonType;
|
|
87
|
+
});
|
|
88
|
+
return { type: jsonTypes.length === 1 ? jsonTypes[0] : jsonTypes };
|
|
89
|
+
}
|
|
90
|
+
function generate(schema, context) {
|
|
91
|
+
const schemaData = schema[_chunkLHEU4XACjs.ctxSymbol];
|
|
92
|
+
const base = baseOf(schemaData, context);
|
|
93
|
+
const literal = literalOf(schemaData);
|
|
94
|
+
let result = literal ? { ...base, ...literal } : { ...base, ...constraintsOf(schemaData) };
|
|
95
|
+
if (literal && result.type) delete result.type;
|
|
96
|
+
if (schemaData.isNullable) {
|
|
97
|
+
result = result.$ref || result.anyOf ? { anyOf: [result, { type: "null" }] } : mergeNull(result);
|
|
98
|
+
}
|
|
99
|
+
if (schemaData.defaultValue !== void 0) result.default = schemaData.defaultValue;
|
|
100
|
+
if (_optionalChain([schemaData, 'access', _2 => _2.meta, 'optionalAccess', _3 => _3.description])) result.description = schemaData.meta.description;
|
|
101
|
+
return result;
|
|
102
|
+
}
|
|
103
|
+
function mergeNull(schema) {
|
|
104
|
+
if (typeof schema.type === "string") return { ...schema, type: [schema.type, "null"] };
|
|
105
|
+
if (Array.isArray(schema.type)) return { ...schema, type: [...schema.type, "null"] };
|
|
106
|
+
return { anyOf: [schema, { type: "null" }] };
|
|
107
|
+
}
|
|
108
|
+
function toJSONSchema(schema, options) {
|
|
109
|
+
const context = { definitions: {}, inProgress: /* @__PURE__ */ new Set() };
|
|
110
|
+
const generated = generate(schema, context);
|
|
111
|
+
const dialect = _optionalChain([options, 'optionalAccess', _4 => _4.dialect]) === void 0 ? "https://json-schema.org/draft/2020-12/schema" : options.dialect;
|
|
112
|
+
const document = dialect ? { $schema: dialect, ...generated } : generated;
|
|
113
|
+
if (Object.keys(context.definitions).length) document.$defs = context.definitions;
|
|
114
|
+
return document;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
exports.toJSONSchema = toJSONSchema;
|
|
120
|
+
//# sourceMappingURL=chunk-SVRCKC65.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/bguard/bguard/lib/chunk-SVRCKC65.js","../src/toJSONSchema.ts"],"names":[],"mappings":"AAAA;AACE;AACF,sDAA4B;AAC5B;AACE;AACF,sDAA4B;AAC5B;AACE;AACF,sDAA4B;AAC5B;AACA;ACSA,IAAM,UAAA,EAA+C;AAAA,EACnD,MAAA,EAAQ,QAAA;AAAA,EACR,MAAA,EAAQ,QAAA;AAAA,EACR,OAAA,EAAS,SAAA;AAAA,EACT,MAAA,EAAQ;AACV,CAAA;AAcA,SAAS,aAAA,CAAc,UAAA,EAA0C;AAC/D,EAAA,MAAM,YAAA,EAA0B,CAAC,CAAA;AAEjC,EAAA,IAAA,CAAA,MAAW,WAAA,GAAc,UAAA,CAAW,mBAAA,EAAqB;AACvD,IAAA,MAAM,QAAA,EAAW,UAAA,CAAqC,UAAA;AACtD,IAAA,GAAA,CAAI,OAAA,EAAS,MAAA,CAAO,MAAA,CAAO,WAAA,EAAa,OAAO,CAAA;AAAA,EACjD;AAEA,EAAA,OAAO,WAAA;AACT;AAEA,SAAS,SAAA,CAAU,UAAA,EAAsD;AACvE,EAAA,GAAA,CAAI,CAAC,UAAA,CAAW,UAAA,EAAY,OAAO,KAAA,CAAA;AAInC,EAAA,MAAM,QAAA,EAAU,CAAC,KAAA,EAAA,GACf,OAAO,MAAA,IAAU,SAAA,GAAY,KAAA,CAAM,UAAA,CAAW,GAAG,EAAA,GAAK,KAAA,CAAM,QAAA,CAAS,GAAG,EAAA,EACpE,KAAA,CAAM,KAAA,CAAM,CAAA,EAAG,CAAA,CAAE,CAAA,CAAE,OAAA,CAAQ,MAAA,EAAQ,GAAG,CAAA,CAAE,OAAA,CAAQ,OAAA,EAAS,IAAI,EAAA,EAC7D,KAAA;AAEN,EAAA,GAAA,CAAI,KAAA,CAAM,OAAA,CAAQ,UAAA,CAAW,eAAe,CAAA,EAAG,OAAO,EAAE,IAAA,EAAM,UAAA,CAAW,eAAA,CAAgB,GAAA,CAAI,OAAO,EAAE,CAAA;AAEtG,EAAA,OAAO,EAAE,KAAA,EAAO,OAAA,CAAQ,UAAA,CAAW,eAAe,EAAE,CAAA;AACtD;AAEA,SAAS,MAAA,CAAO,UAAA,EAA8B,OAAA,EAA8B;AAC1E,EAAA,GAAA,CAAI,UAAA,CAAW,IAAA,EAAM;AACnB,IAAA,MAAM,EAAE,QAAA,EAAU,UAAU,EAAA,EAAI,UAAA,CAAW,IAAA;AAG3C,IAAA,GAAA,CAAI,OAAA,CAAQ,UAAA,CAAW,GAAA,CAAI,QAAQ,CAAA,EAAG,OAAO,EAAE,IAAA,EAAM,CAAA,QAAA,EAAW,QAAQ,CAAA,EAAA;AAEjC,IAAA;AACG,IAAA;AAC6B,MAAA;AAExC,IAAA;AACoC,IAAA;AACjC,IAAA;AAEG,IAAA;AACvC,EAAA;AAEuE,EAAA;AAExD,EAAA;AACN,IAAA;AACC,MAAA;AAAA;AAAA;AAG6D,MAAA;AAC5D,MAAA;AACoB,MAAA;AACA,MAAA;AAC7B,IAAA;AAEqB,EAAA;AACwC,IAAA;AACA,IAAA;AAK7C,IAAA;AACP,MAAA;AACC,QAAA;AAC6E,QAAA;AAC7D,QAAA;AACxB,MAAA;AAEyD,IAAA;AAC7D,EAAA;AAEyE,EAAA;AAElD,EAAA;AAC2B,IAAA;AACpB,IAAA;AAEwC,IAAA;AACrB,MAAA;AACE,MAAA;AAGqB,MAAA;AACtE,IAAA;AAE8D,IAAA;AACjB,IAAA;AACc,IAAA;AAEpD,IAAA;AACT,EAAA;AAEkE,EAAA;AAEC,EAAA;AACxC,EAAA;AAEW,EAAA;AACL,IAAA;AACwB,IAAA;AAEhD,IAAA;AACR,EAAA;AAEgE,EAAA;AACnE;AAEsE;AACjC,EAAA;AACI,EAAA;AACH,EAAA;AAGuC,EAAA;AACjC,EAAA;AAEf,EAAA;AAEgD,IAAA;AAC3E,EAAA;AAEuE,EAAA;AACA,EAAA;AAEhE,EAAA;AACT;AAGmD;AACsB,EAAA;AACkB,EAAA;AAE9C,EAAA;AAC7C;AA0B8F;AAC1B,EAAA;AACxB,EAAA;AAEO,EAAA;AAC2B,EAAA;AAEN,EAAA;AAE/D,EAAA;AACT;AD/F6E;AACA;AACA;AACA","file":"/home/runner/work/bguard/bguard/lib/chunk-SVRCKC65.js","sourcesContent":[null,"import type { BaseType } from './commonTypes';\nimport { CommonSchema, type ValidatorContext } from './core';\nimport { BuildSchemaError } from './exceptions';\nimport { ctxSymbol } from './helpers/constants';\n\nexport interface JSONSchema {\n [keyword: string]: unknown;\n}\n\nexport interface ToJSONSchemaOptions {\n /**\n * The dialect to declare in `$schema`. Pass `null` to leave it out, which is what you want when the\n * result is embedded in a larger document such as an OpenAPI `components.schemas` entry.\n * @default 'https://json-schema.org/draft/2020-12/schema'\n */\n dialect?: string | null;\n}\n\n/** What a bguard primitive is called in JSON Schema. */\nconst typeNames: Partial<Record<BaseType, string>> = {\n string: 'string',\n number: 'number',\n boolean: 'boolean',\n object: 'object',\n};\n\n/** A validation may carry the JSON Schema keywords it stands for. Those that cannot, do not. */\ninterface ConstrainedValidation {\n jsonSchema?: JSONSchema;\n}\n\ninterface Context {\n /** Named subschemas, filled as lazy schemas are met so a recursive schema can reference itself. */\n definitions: Record<string, JSONSchema>;\n /** Lazy type names currently being generated, so a self-reference emits a `$ref` instead of looping. */\n inProgress: Set<string>;\n}\n\nfunction constraintsOf(schemaData: ValidatorContext): JSONSchema {\n const constraints: JSONSchema = {};\n\n for (const validation of schemaData.requiredValidations) {\n const carried = (validation as ConstrainedValidation).jsonSchema;\n if (carried) Object.assign(constraints, carried);\n }\n\n return constraints;\n}\n\nfunction literalOf(schemaData: ValidatorContext): JSONSchema | undefined {\n if (!schemaData.strictType) return undefined;\n\n // equalTo stores one value, oneOfValues an array. String literals arrive already quoted for codeGen,\n // so the quotes have to come back off for JSON.\n const unquote = (value: unknown) =>\n typeof value === 'string' && value.startsWith(\"'\") && value.endsWith(\"'\")\n ? value.slice(1, -1).replace(/\\\\'/g, \"'\").replace(/\\\\\\\\/g, '\\\\')\n : value;\n\n if (Array.isArray(schemaData.strictTypeValue)) return { enum: schemaData.strictTypeValue.map(unquote) };\n\n return { const: unquote(schemaData.strictTypeValue) };\n}\n\nfunction baseOf(schemaData: ValidatorContext, context: Context): JSONSchema {\n if (schemaData.lazy) {\n const { typeName, getSchema } = schemaData.lazy;\n\n // A self-reference resolves to a pointer, which is what stops generation from recursing forever.\n if (context.inProgress.has(typeName)) return { $ref: `#/$defs/${typeName}` };\n\n schemaData.lazy.resolved ??= getSchema();\n if (!(schemaData.lazy.resolved instanceof CommonSchema))\n throw new BuildSchemaError('Invalid schema returned from lazy method');\n\n context.inProgress.add(typeName);\n context.definitions[typeName] = generate(schemaData.lazy.resolved, context);\n context.inProgress.delete(typeName);\n\n return { $ref: `#/$defs/${typeName}` };\n }\n\n if (schemaData.union) return { anyOf: schemaData.union.map((member) => generate(member, context)) };\n\n if (schemaData.tuple)\n return {\n type: 'array',\n // Draft 2020-12 spells positional schemas `prefixItems`, and forbidding extras is what makes it a\n // tuple rather than an array that happens to start a certain way.\n prefixItems: schemaData.tuple.map((position) => generate(position, context)),\n items: false,\n minItems: schemaData.tuple.length,\n maxItems: schemaData.tuple.length,\n };\n\n if (schemaData.record) {\n const keyLiteral = literalOf(schemaData.record.key[ctxSymbol]);\n const valueSchema = generate(schemaData.record.value, context);\n\n // A restricted key set becomes named properties. There is no `required`, because validation checks\n // the keys that are present rather than demanding the whole set — the same reason InferType says\n // Partial.\n if (keyLiteral?.enum)\n return {\n type: 'object',\n properties: Object.fromEntries((keyLiteral.enum as unknown[]).map((key) => [String(key), valueSchema])),\n additionalProperties: false,\n };\n\n return { type: 'object', additionalProperties: valueSchema };\n }\n\n if (schemaData.array) return { type: 'array', items: generate(schemaData.array, context) };\n\n if (schemaData.object) {\n const properties: Record<string, JSONSchema> = {};\n const required: string[] = [];\n\n for (const [key, valueSchema] of Object.entries(schemaData.object)) {\n const valueSchemaData = valueSchema[ctxSymbol];\n properties[key] = generate(valueSchema, context);\n\n // A default supplies the value, so the caller need not send it — the same rule InferInput follows.\n if (!valueSchemaData.isOptional && valueSchemaData.defaultValue === undefined) required.push(key);\n }\n\n const objectSchema: JSONSchema = { type: 'object', properties };\n if (required.length) objectSchema.required = required;\n if (!schemaData.allowUnrecognizedObjectProps) objectSchema.additionalProperties = false;\n\n return objectSchema;\n }\n\n if (schemaData.date) return { type: 'string', format: 'date-time' };\n\n const named = schemaData.type.filter((type) => type !== 'undefined');\n if (!named.length) return {};\n\n const jsonTypes = named.map((type) => {\n const jsonType = typeNames[type];\n if (!jsonType) throw new BuildSchemaError(`Type '${type}' has no JSON Schema equivalent and cannot be generated`);\n\n return jsonType;\n });\n\n return { type: jsonTypes.length === 1 ? jsonTypes[0] : jsonTypes };\n}\n\nfunction generate(schema: CommonSchema, context: Context): JSONSchema {\n const schemaData = schema[ctxSymbol];\n const base = baseOf(schemaData, context);\n const literal = literalOf(schemaData);\n\n // A literal already says everything about the value, so the type is redundant beside it.\n let result: JSONSchema = literal ? { ...base, ...literal } : { ...base, ...constraintsOf(schemaData) };\n if (literal && result.type) delete result.type;\n\n if (schemaData.isNullable) {\n // `$ref` and `anyOf` cannot take a sibling type, so nullability has to wrap rather than merge.\n result = result.$ref || result.anyOf ? { anyOf: [result, { type: 'null' }] } : mergeNull(result);\n }\n\n if (schemaData.defaultValue !== undefined) result.default = schemaData.defaultValue;\n if (schemaData.meta?.description) result.description = schemaData.meta.description;\n\n return result;\n}\n\n/** Adds null to a plain type, which reads better than wrapping a single type in `anyOf`. */\nfunction mergeNull(schema: JSONSchema): JSONSchema {\n if (typeof schema.type === 'string') return { ...schema, type: [schema.type, 'null'] };\n if (Array.isArray(schema.type)) return { ...schema, type: [...(schema.type as string[]), 'null'] };\n\n return { anyOf: [schema, { type: 'null' }] };\n}\n\n/**\n * Renders a schema as a JSON Schema document, for OpenAPI, form generators and tool definitions.\n *\n * What is represented: types, object properties and which of them are required, arrays, tuples,\n * records, unions, literals and enums, nullability, defaults, `description()`, and recursive schemas\n * via `$defs` and `$ref`. Assertions that map onto a JSON Schema keyword — string lengths and patterns,\n * numeric bounds, array lengths — are included; those with no equivalent are not, because JSON Schema\n * has no way to express them.\n *\n * `bigint` and `symbol` have no JSON Schema counterpart and raise a `BuildSchemaError` rather than\n * being quietly emitted as something they are not. A `date()` becomes `{ type: 'string', format:\n * 'date-time' }`, since JSON has no date type.\n *\n * @example\n * const schema = object({ name: string().custom(minLength(2)), age: number().optional() });\n * toJSONSchema(schema);\n * // {\n * // $schema: 'https://json-schema.org/draft/2020-12/schema',\n * // type: 'object',\n * // properties: { name: { type: 'string', minLength: 2 }, age: { type: 'number' } },\n * // required: ['name'],\n * // additionalProperties: false,\n * // }\n */\nexport function toJSONSchema(schema: CommonSchema, options?: ToJSONSchemaOptions): JSONSchema {\n const context: Context = { definitions: {}, inProgress: new Set() };\n const generated = generate(schema, context);\n\n const dialect = options?.dialect === undefined ? 'https://json-schema.org/draft/2020-12/schema' : options.dialect;\n const document: JSONSchema = dialect ? { $schema: dialect, ...generated } : generated;\n\n if (Object.keys(context.definitions).length) document.$defs = context.definitions;\n\n return document;\n}\n"]}
|
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkZJGY6EOEjs = require('./chunk-ZJGY6EOE.js');
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunkVBTWYDEMjs = require('./chunk-VBTWYDEM.js');
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
var
|
|
9
|
+
var _chunkZWFSAKQKjs = require('./chunk-ZWFSAKQK.js');
|
|
10
10
|
|
|
11
11
|
// src/asserts/date/dateMax.ts
|
|
12
12
|
var dateMaxErrorMessage = "The received value is greater than expected";
|
|
13
13
|
var dateMaxErrorKey = "dt:max";
|
|
14
14
|
var dateMax = (expected) => {
|
|
15
15
|
const transformedExpected = typeof expected === "string" ? new Date(expected) : expected;
|
|
16
|
-
if (!_chunkVBTWYDEMjs.isValidDateInner.call(void 0, transformedExpected)) throw new (0,
|
|
16
|
+
if (!_chunkVBTWYDEMjs.isValidDateInner.call(void 0, transformedExpected)) throw new (0, _chunkZWFSAKQKjs.BuildSchemaError)("Invalid date in Date assertion");
|
|
17
17
|
return (received, ctx) => {
|
|
18
18
|
if (transformedExpected < received) ctx.addIssue(transformedExpected, received, dateMaxErrorKey);
|
|
19
19
|
};
|
|
20
20
|
};
|
|
21
21
|
dateMax.key = dateMaxErrorKey;
|
|
22
22
|
dateMax.message = dateMaxErrorMessage;
|
|
23
|
-
|
|
23
|
+
_chunkZJGY6EOEjs.setToDefaultLocale.call(void 0, dateMax);
|
|
24
24
|
|
|
25
25
|
|
|
26
26
|
|
|
27
27
|
exports.dateMax = dateMax;
|
|
28
|
-
//# sourceMappingURL=chunk-
|
|
28
|
+
//# sourceMappingURL=chunk-SY2V2V54.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/bguard/bguard/lib/chunk-
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/bguard/bguard/lib/chunk-SY2V2V54.js","../src/asserts/date/dateMax.ts"],"names":[],"mappings":"AAAA;AACE;AACF,sDAA4B;AAC5B;AACE;AACF,sDAA4B;AAC5B;AACE;AACF,sDAA4B;AAC5B;AACA;ACLA,IAAM,oBAAA,EAAsB,6CAAA;AAC5B,IAAM,gBAAA,EAAkB,QAAA;AAcjB,IAAM,QAAA,EAAU,CAAC,QAAA,EAAA,GAAsD;AAC5E,EAAA,MAAM,oBAAA,EAAsB,OAAO,SAAA,IAAa,SAAA,EAAW,IAAI,IAAA,CAAK,QAAQ,EAAA,EAAI,QAAA;AAChF,EAAA,GAAA,CAAI,CAAC,+CAAA,mBAAoC,CAAA,EAAG,MAAM,IAAI,sCAAA,CAAiB,gCAAgC,CAAA;AACvG,EAAA,OAAO,CAAC,QAAA,EAAgB,GAAA,EAAA,GAA0B;AAChD,IAAA,GAAA,CAAI,oBAAA,EAAsB,QAAA,EAAU,GAAA,CAAI,QAAA,CAAS,mBAAA,EAAqB,QAAA,EAAU,eAAe,CAAA;AAAA,EACjG,CAAA;AACF,CAAA;AAEA,OAAA,CAAQ,IAAA,EAAM,eAAA;AACd,OAAA,CAAQ,QAAA,EAAU,mBAAA;AAClB,iDAAA,OAA0B,CAAA;ADP1B;AACA;AACE;AACF,0BAAC","file":"/home/runner/work/bguard/bguard/lib/chunk-SY2V2V54.js","sourcesContent":[null,"import { setToDefaultLocale } from '../../translationMap';\nimport { BuildSchemaError } from '../../exceptions';\nimport type { ExceptionContext, RequiredValidation } from '../../core';\nimport { isValidDateInner } from '../../helpers/isValidDateInner';\n\nconst dateMaxErrorMessage = 'The received value is greater than expected';\nconst dateMaxErrorKey = 'dt:max';\n/**\n * @description Asserts that a date value is not greater than a specified maximum value.\n * @param {Date | string} expected The maximum allowable value.\n * @returns {RequiredValidation} A validation function that takes a received Date or string and an exception context.\n * @throws {ValidationError} if the received value is greater than the expected maximum value.\n * @example\n * const schema = date().custom(dateMax('2024-12-31'));\n * parseOrFail(schema, new Date('2024-12-30')); // Valid\n * parseOrFail(schema, new Date('2024-12-31')); // Valid\n * parseOrFail(schema, new Date('2025-01-01')); // Throws an error: 'The received value is greater than expected'\n *\n * @translation Error Translation Key = 'dt:max'\n */\nexport const dateMax = (expected: Date | string): RequiredValidation<Date> => {\n const transformedExpected = typeof expected === 'string' ? new Date(expected) : expected;\n if (!isValidDateInner(transformedExpected)) throw new BuildSchemaError('Invalid date in Date assertion');\n return (received: Date, ctx: ExceptionContext) => {\n if (transformedExpected < received) ctx.addIssue(transformedExpected, received, dateMaxErrorKey);\n };\n};\n\ndateMax.key = dateMaxErrorKey;\ndateMax.message = dateMaxErrorMessage;\nsetToDefaultLocale(dateMax);\n"]}
|
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkWOPNDC4Rjs = require('./chunk-WOPNDC4R.js');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
var _chunkZJGY6EOEjs = require('./chunk-ZJGY6EOE.js');
|
|
4
7
|
|
|
5
8
|
// src/asserts/array/maxArrayLength.ts
|
|
6
9
|
var maxArrayLengthErrorMessage = "The received value length is greater than expected";
|
|
7
10
|
var maxArrayLengthErrorKey = "a:maxArrayLength";
|
|
8
|
-
var maxArrayLength = (expected) => (received, ctx) => {
|
|
9
|
-
if (received.length > expected) ctx.addIssue(expected, received,
|
|
10
|
-
};
|
|
11
|
+
var maxArrayLength = (expected) => _chunkWOPNDC4Rjs._constrain.call(void 0, { maxItems: expected }, (received, ctx) => {
|
|
12
|
+
if (received.length > expected) ctx.addIssue(expected, received, maxArrayLengthErrorKey);
|
|
13
|
+
});
|
|
11
14
|
maxArrayLength.key = maxArrayLengthErrorKey;
|
|
12
15
|
maxArrayLength.message = maxArrayLengthErrorMessage;
|
|
13
|
-
|
|
16
|
+
_chunkZJGY6EOEjs.setToDefaultLocale.call(void 0, maxArrayLength);
|
|
14
17
|
|
|
15
18
|
|
|
16
19
|
|
|
17
20
|
exports.maxArrayLength = maxArrayLength;
|
|
18
|
-
//# sourceMappingURL=chunk-
|
|
21
|
+
//# sourceMappingURL=chunk-SZO4SUUG.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/bguard/bguard/lib/chunk-SZO4SUUG.js","../src/asserts/array/maxArrayLength.ts"],"names":[],"mappings":"AAAA;AACE;AACF,sDAA4B;AAC5B;AACE;AACF,sDAA4B;AAC5B;AACA;ACHA,IAAM,2BAAA,EAA6B,oDAAA;AACnC,IAAM,uBAAA,EAAyB,kBAAA;AAexB,IAAM,eAAA,EAAiB,CAAC,QAAA,EAAA,GAC7B,yCAAA,EAAa,QAAA,EAAU,SAAS,CAAA,EAAG,CAAC,QAAA,EAAqB,GAAA,EAAA,GAA0B;AACjF,EAAA,GAAA,CAAI,QAAA,CAAS,OAAA,EAAS,QAAA,EAAU,GAAA,CAAI,QAAA,CAAS,QAAA,EAAU,QAAA,EAAU,sBAAsB,CAAA;AACzF,CAAC,CAAA;AAEH,cAAA,CAAe,IAAA,EAAM,sBAAA;AACrB,cAAA,CAAe,QAAA,EAAU,0BAAA;AACzB,iDAAA,cAAiC,CAAA;ADXjC;AACA;AACE;AACF,wCAAC","file":"/home/runner/work/bguard/bguard/lib/chunk-SZO4SUUG.js","sourcesContent":[null,"import type { ExceptionContext, RequiredValidation } from '../../core';\nimport { _constrain } from '../../helpers/jsonSchemaConstraint';\nimport { setToDefaultLocale } from '../../translationMap';\n\nconst maxArrayLengthErrorMessage = 'The received value length is greater than expected';\nconst maxArrayLengthErrorKey = 'a:maxArrayLength';\n\n/**\n * @description Asserts that the length of an array is not greater than a specified maximum length.\n * @param {number} expected The maximum allowed length for the array.\n * @returns {RequiredValidation} A validation function that takes a received array and an exception context.\n * @throws {ValidationError} if the length of the received value is greater than the expected length.\n * @example\n * const schema = array(string()).custom(maxArrayLength(3));\n * parseOrFail(schema, ['adequate', 'array']); // Valid\n * parseOrFail(schema, ['adequate', 'array', 'length']); // Valid\n * parseOrFail(schema, ['adequate', 'array', 'length', 'test']); // Throws an error: 'The received value length is greater than expected'\n *\n * @translation Error Translation Key = 'a:maxArrayLength'\n */\nexport const maxArrayLength = (expected: number): RequiredValidation<unknown[]> =>\n _constrain({ maxItems: expected }, (received: unknown[], ctx: ExceptionContext) => {\n if (received.length > expected) ctx.addIssue(expected, received, maxArrayLengthErrorKey);\n });\n\nmaxArrayLength.key = maxArrayLengthErrorKey;\nmaxArrayLength.message = maxArrayLengthErrorMessage;\nsetToDefaultLocale(maxArrayLength);\n"]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
var _chunkAO6DKPJZjs = require('./chunk-AO6DKPJZ.js');
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
var _chunkLHEU4XACjs = require('./chunk-LHEU4XAC.js');
|
|
8
|
+
|
|
9
|
+
// src/asserts/object/required.ts
|
|
10
|
+
function required(schema) {
|
|
11
|
+
const shape = _chunkAO6DKPJZjs._shapeOf.call(void 0, schema, "required");
|
|
12
|
+
const tightened = {};
|
|
13
|
+
for (const [key, valueSchema] of Object.entries(shape)) {
|
|
14
|
+
const tightenedSchema = valueSchema.clone();
|
|
15
|
+
delete tightenedSchema[_chunkLHEU4XACjs.ctxSymbol].isOptional;
|
|
16
|
+
tightened[key] = tightenedSchema;
|
|
17
|
+
}
|
|
18
|
+
return _chunkAO6DKPJZjs._objectFrom.call(void 0, schema, tightened);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
exports.required = required;
|
|
24
|
+
//# sourceMappingURL=chunk-TCHVA6VG.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/bguard/bguard/lib/chunk-TCHVA6VG.js","../src/asserts/object/required.ts"],"names":[],"mappings":"AAAA;AACE;AACA;AACF,sDAA4B;AAC5B;AACE;AACF,sDAA4B;AAC5B;AACA;AC0BO,SAAS,QAAA,CACd,MAAA,EAC4C;AAC5C,EAAA,MAAM,MAAA,EAAQ,uCAAA,MAAS,EAAQ,UAAU,CAAA;AACzC,EAAA,MAAM,UAAA,EAAmC,CAAC,CAAA;AAE1C,EAAA,IAAA,CAAA,MAAW,CAAC,GAAA,EAAK,WAAW,EAAA,GAAK,MAAA,CAAO,OAAA,CAAQ,KAAK,CAAA,EAAG;AAEtD,IAAA,MAAM,gBAAA,EAAkB,WAAA,CAAY,KAAA,CAAM,CAAA;AAC1C,IAAA,OAAO,eAAA,CAAgB,0BAAS,CAAA,CAAE,UAAA;AAClC,IAAA,SAAA,CAAU,GAAG,EAAA,EAAI,eAAA;AAAA,EACnB;AAEA,EAAA,OAAO,0CAAA,MAAY,EAAQ,SAAS,CAAA;AACtC;AD7BA;AACA;AACE;AACF,4BAAC","file":"/home/runner/work/bguard/bguard/lib/chunk-TCHVA6VG.js","sourcesContent":[null,"import { WithObject } from '../../commonTypes';\nimport { CommonSchema, ObjectShapeSchemaType } from '../../core';\nimport { ctxSymbol } from '../../helpers/constants';\nimport { ObjectSchema } from './index';\nimport { _objectFrom, _shapeOf } from './pick';\n\n/**\n * Named rather than written inline in both the signature and the cast: the two spellings of the same\n * mapped type are not provably identical to the compiler once `~standard` puts a deferred\n * `InferType<this>` inside them.\n *\n * Removing the brand rather than trying to recover the type it wraps, because an intersection cannot\n * be taken apart again. What matters to `InferType` is that the result no longer carries the marker.\n */\ntype RequiredShape<T extends ObjectShapeSchemaType> = { [K in keyof T]: Omit<T[K], 'validation_undefined'> };\n\n/**\n * @description Creates a new object schema in which every property is required, the counterpart to\n * `partial`.\n *\n * A property that carried a default keeps it, so it may still be omitted — a default is what makes a\n * property supply its own value rather than optional.\n *\n * @template T\n * @param {WithObject<CommonSchema, T>} schema - The object schema to tighten.\n * @returns A new object schema with every property required.\n * @example\n * const patchSchema = partial(object({ id: string(), name: string() }));\n * const fullSchema = required(patchSchema);\n * parseOrFail(fullSchema, { id: '1', name: 'a' }); // Validates successfully\n * parseOrFail(fullSchema, {}); // Throws a validation error\n *\n * @instance Of CommonSchema\n */\nexport function required<T extends ObjectShapeSchemaType>(\n schema: WithObject<CommonSchema, T>,\n): WithObject<ObjectSchema, RequiredShape<T>> {\n const shape = _shapeOf(schema, 'required');\n const tightened: ObjectShapeSchemaType = {};\n\n for (const [key, valueSchema] of Object.entries(shape)) {\n // A copy, so the property schema the source holds keeps whatever it had.\n const tightenedSchema = valueSchema.clone();\n delete tightenedSchema[ctxSymbol].isOptional;\n tightened[key] = tightenedSchema;\n }\n\n return _objectFrom(schema, tightened) as unknown as WithObject<ObjectSchema, RequiredShape<T>>;\n}\n"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
var _chunkEI6TQG4Ljs = require('./chunk-EI6TQG4L.js');
|
|
4
|
+
|
|
5
|
+
// src/asserts/coerce/string.ts
|
|
6
|
+
var coerceString = () => _chunkEI6TQG4Ljs.string.call(void 0, ).transformBeforeValidation(
|
|
7
|
+
(received) => received === null || typeof received === "string" ? received : String(received)
|
|
8
|
+
);
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
exports.coerceString = coerceString;
|
|
13
|
+
//# sourceMappingURL=chunk-TD3Y3IV3.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/bguard/bguard/lib/chunk-TD3Y3IV3.js","../src/asserts/coerce/string.ts"],"names":[],"mappings":"AAAA;AACE;AACF,sDAA4B;AAC5B;AACA;ACkBO,IAAM,aAAA,EAAe,CAAA,EAAA,GAC1B,qCAAA,CAAO,CAAE,yBAAA;AAAA,EAAmC,CAAC,QAAA,EAAA,GAC3C,SAAA,IAAa,KAAA,GAAQ,OAAO,SAAA,IAAa,SAAA,EAAY,SAAA,EAAsB,MAAA,CAAO,QAAQ;AAC5F,CAAA;ADjBF;AACA;AACE;AACF,oCAAC","file":"/home/runner/work/bguard/bguard/lib/chunk-TD3Y3IV3.js","sourcesContent":[null,"import { string } from '../string/index';\n\n/**\n * A coercing transform must never throw: it runs before validation, and throwing would replace a clear\n * validation error with an unexplained failure. Anything it cannot convert is passed through unchanged\n * so that validation reports the type problem itself.\n *\n * `null` is never coerced, so `nullable()` still decides whether it is allowed rather than it becoming\n * the string `'null'` or the number `0`.\n *\n * The return type is inferred rather than written out. Naming it flattened the schema to\n * `CommonSchema`, which silently dropped the methods only the concrete classes define — `equalTo`,\n * `oneOfValues`, `onlyTrue`, `onlyFalse`.\n */\n/**\n * @description Coerces the received value to a string before validating it. Anything that is not\n * already a string is passed through `String`.\n *\n * @returns A string schema that accepts `unknown` as its input type.\n * @example\n * parseOrFail(coerceString(), 42); // '42'\n */\nexport const coerceString = () =>\n string().transformBeforeValidation<unknown>((received) =>\n received === null || typeof received === 'string' ? (received as string) : String(received),\n );\n"]}
|
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkWOPNDC4Rjs = require('./chunk-WOPNDC4R.js');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
var _chunkZJGY6EOEjs = require('./chunk-ZJGY6EOE.js');
|
|
4
7
|
|
|
5
8
|
// src/asserts/array/minArrayLength.ts
|
|
6
9
|
var minArrayLengthErrorMessage = "The received value length is less than expected";
|
|
7
10
|
var minArrayLengthErrorKey = "a:minArrayLength";
|
|
8
|
-
var minArrayLength = (expected) => (received, ctx) => {
|
|
9
|
-
if (received.length < expected) ctx.addIssue(expected, received,
|
|
10
|
-
};
|
|
11
|
+
var minArrayLength = (expected) => _chunkWOPNDC4Rjs._constrain.call(void 0, { minItems: expected }, (received, ctx) => {
|
|
12
|
+
if (received.length < expected) ctx.addIssue(expected, received, minArrayLengthErrorKey);
|
|
13
|
+
});
|
|
11
14
|
minArrayLength.key = minArrayLengthErrorKey;
|
|
12
15
|
minArrayLength.message = minArrayLengthErrorMessage;
|
|
13
|
-
|
|
16
|
+
_chunkZJGY6EOEjs.setToDefaultLocale.call(void 0, minArrayLength);
|
|
14
17
|
|
|
15
18
|
|
|
16
19
|
|
|
17
20
|
exports.minArrayLength = minArrayLength;
|
|
18
|
-
//# sourceMappingURL=chunk-
|
|
21
|
+
//# sourceMappingURL=chunk-TJ7IQSHU.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/bguard/bguard/lib/chunk-TJ7IQSHU.js","../src/asserts/array/minArrayLength.ts"],"names":[],"mappings":"AAAA;AACE;AACF,sDAA4B;AAC5B;AACE;AACF,sDAA4B;AAC5B;AACA;ACHA,IAAM,2BAAA,EAA6B,iDAAA;AACnC,IAAM,uBAAA,EAAyB,kBAAA;AAexB,IAAM,eAAA,EAAiB,CAAC,QAAA,EAAA,GAC7B,yCAAA,EAAa,QAAA,EAAU,SAAS,CAAA,EAAG,CAAC,QAAA,EAAqB,GAAA,EAAA,GAA0B;AACjF,EAAA,GAAA,CAAI,QAAA,CAAS,OAAA,EAAS,QAAA,EAAU,GAAA,CAAI,QAAA,CAAS,QAAA,EAAU,QAAA,EAAU,sBAAsB,CAAA;AACzF,CAAC,CAAA;AAEH,cAAA,CAAe,IAAA,EAAM,sBAAA;AACrB,cAAA,CAAe,QAAA,EAAU,0BAAA;AACzB,iDAAA,cAAiC,CAAA;ADXjC;AACA;AACE;AACF,wCAAC","file":"/home/runner/work/bguard/bguard/lib/chunk-TJ7IQSHU.js","sourcesContent":[null,"import type { ExceptionContext, RequiredValidation } from '../../core';\nimport { _constrain } from '../../helpers/jsonSchemaConstraint';\nimport { setToDefaultLocale } from '../../translationMap';\n\nconst minArrayLengthErrorMessage = 'The received value length is less than expected';\nconst minArrayLengthErrorKey = 'a:minArrayLength';\n\n/**\n * @description Asserts that the length of na array is not less than a specified minimum length.\n * @param {number} expected The minimum required length for the array.\n * @returns {RequiredValidation} A validation function that takes a received array and an exception context.\n * @throws {ValidationError} if the length of the received value is less than the expected length.\n * @example\n * const schema = array(string()).custom(minArrayLength(3));\n * parseOrFail(schema, ['short', 'array']); // Throws an error: 'The received value length is less than expected'\n * parseOrFail(schema, ['adequate', 'array', 'length']); // Valid\n * parseOrFail(schema, ['adequate', 'array', 'length', 'test']); // Valid\n *\n * @translation Error Translation Key = 'a:minArrayLength'\n */\nexport const minArrayLength = (expected: number): RequiredValidation<unknown[]> =>\n _constrain({ minItems: expected }, (received: unknown[], ctx: ExceptionContext) => {\n if (received.length < expected) ctx.addIssue(expected, received, minArrayLengthErrorKey);\n });\n\nminArrayLength.key = minArrayLengthErrorKey;\nminArrayLength.message = minArrayLengthErrorMessage;\nsetToDefaultLocale(minArrayLength);\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
setToDefaultLocale
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-65X7NTUS.mjs";
|
|
4
4
|
|
|
5
5
|
// src/asserts/string/endsWith.ts
|
|
6
6
|
var endsWithErrorMessage = "The received value does not end with the required substring";
|
|
@@ -17,4 +17,4 @@ setToDefaultLocale(endsWith);
|
|
|
17
17
|
export {
|
|
18
18
|
endsWith
|
|
19
19
|
};
|
|
20
|
-
//# sourceMappingURL=chunk-
|
|
20
|
+
//# sourceMappingURL=chunk-TPSWNY5K.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/asserts/string/endsWith.ts"],"sourcesContent":["import type { ExceptionContext, RequiredValidation } from '../../core';\nimport { setToDefaultLocale } from '../../translationMap';\n\nconst endsWithErrorMessage = 'The received value does not end with the required substring';\nconst endsWithErrorKey = 's:endsWith';\n\n/**\n * @description Asserts that a string value ends with a specified substring.\n * @param {string} substring The substring that the string value must end with.\n * @returns {RequiredValidation} A validation function that takes a received string and an exception context.\n * @throws {ValidationError} if the received value does not end with the required substring.\n * @example\n * const schema = string().custom(endsWith('bar'));\n * parseOrFail(schema, 'foobar'); // Valid\n * parseOrFail(schema, 'foofoo'); // Throws an error: 'The received value does not end with the required substring'\n *\n * @translation Error Translation Key = 's:endsWith'\n */\nexport const endsWith =\n (substring: string): RequiredValidation =>\n (received: string, ctx: ExceptionContext) => {\n if (!received.endsWith(substring)) {\n ctx.addIssue(`ends with '${substring}'`, received, endsWithErrorKey);\n }\n };\n\nendsWith.key = endsWithErrorKey;\nendsWith.message = endsWithErrorMessage;\nsetToDefaultLocale(endsWith);\n"],"mappings":";;;;;AAGA,IAAM,uBAAuB;AAC7B,IAAM,mBAAmB;AAclB,IAAM,WACX,CAAC,cACD,CAAC,UAAkB,QAA0B;AAC3C,MAAI,CAAC,SAAS,SAAS,SAAS,GAAG;AACjC,QAAI,SAAS,cAAc,SAAS,KAAK,UAAU,gBAAgB;AAAA,EACrE;AACF;AAEF,SAAS,MAAM;AACf,SAAS,UAAU;AACnB,mBAAmB,QAAQ;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/asserts/string/endsWith.ts"],"sourcesContent":["import type { ExceptionContext, RequiredValidation } from '../../core';\nimport { setToDefaultLocale } from '../../translationMap';\n\nconst endsWithErrorMessage = 'The received value does not end with the required substring';\nconst endsWithErrorKey = 's:endsWith';\n\n/**\n * @description Asserts that a string value ends with a specified substring.\n * @param {string} substring The substring that the string value must end with.\n * @returns {RequiredValidation} A validation function that takes a received string and an exception context.\n * @throws {ValidationError} if the received value does not end with the required substring.\n * @example\n * const schema = string().custom(endsWith('bar'));\n * parseOrFail(schema, 'foobar'); // Valid\n * parseOrFail(schema, 'foofoo'); // Throws an error: 'The received value does not end with the required substring'\n *\n * @translation Error Translation Key = 's:endsWith'\n */\nexport const endsWith =\n (substring: string): RequiredValidation<string> =>\n (received: string, ctx: ExceptionContext) => {\n if (!received.endsWith(substring)) {\n ctx.addIssue(`ends with '${substring}'`, received, endsWithErrorKey);\n }\n };\n\nendsWith.key = endsWithErrorKey;\nendsWith.message = endsWithErrorMessage;\nsetToDefaultLocale(endsWith);\n"],"mappings":";;;;;AAGA,IAAM,uBAAuB;AAC7B,IAAM,mBAAmB;AAclB,IAAM,WACX,CAAC,cACD,CAAC,UAAkB,QAA0B;AAC3C,MAAI,CAAC,SAAS,SAAS,SAAS,GAAG;AACjC,QAAI,SAAS,cAAc,SAAS,KAAK,UAAU,gBAAgB;AAAA,EACrE;AACF;AAEF,SAAS,MAAM;AACf,SAAS,UAAU;AACnB,mBAAmB,QAAQ;","names":[]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import {
|
|
2
|
+
number
|
|
3
|
+
} from "./chunk-DS2LUTTF.mjs";
|
|
4
|
+
|
|
5
|
+
// src/asserts/coerce/number.ts
|
|
6
|
+
var coerceNumber = () => number().transformBeforeValidation(
|
|
7
|
+
(received) => received === null || typeof received === "number" ? received : Number(received)
|
|
8
|
+
);
|
|
9
|
+
|
|
10
|
+
export {
|
|
11
|
+
coerceNumber
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=chunk-UCY3HEYZ.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/asserts/coerce/number.ts"],"sourcesContent":["import { number } from '../number/index';\n\n/**\n * A coercing transform must never throw: it runs before validation, and throwing would replace a clear\n * validation error with an unexplained failure. Anything it cannot convert is passed through unchanged\n * so that validation reports the type problem itself.\n *\n * `null` is never coerced, so `nullable()` still decides whether it is allowed rather than it becoming\n * the string `'null'` or the number `0`.\n *\n * The return type is inferred rather than written out. Naming it flattened the schema to\n * `CommonSchema`, which silently dropped the methods only the concrete classes define — `equalTo`,\n * `oneOfValues`, `onlyTrue`, `onlyFalse`.\n */\n/**\n * @description Coerces the received value to a number before validating it. Anything that is not\n * already a number is passed through `Number`.\n *\n * A value `Number` cannot read becomes `NaN`, which `number()` rejects, so `'abc'` fails validation\n * rather than passing as a number.\n *\n * @returns A number schema that accepts `unknown` as its input type.\n * @example\n * parseOrFail(coerceNumber(), '42'); // 42\n */\nexport const coerceNumber = () =>\n number().transformBeforeValidation<unknown>((received) =>\n received === null || typeof received === 'number' ? (received as number) : Number(received),\n );\n"],"mappings":";;;;;AAyBO,IAAM,eAAe,MAC1B,OAAO,EAAE;AAAA,EAAmC,CAAC,aAC3C,aAAa,QAAQ,OAAO,aAAa,WAAY,WAAsB,OAAO,QAAQ;AAC5F;","names":[]}
|
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkWOPNDC4Rjs = require('./chunk-WOPNDC4R.js');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
var _chunkZJGY6EOEjs = require('./chunk-ZJGY6EOE.js');
|
|
4
7
|
|
|
5
8
|
// src/asserts/string/maxLength.ts
|
|
6
9
|
var maxLengthErrorMessage = "The received value length is greater than expected";
|
|
7
10
|
var maxLengthErrorKey = "s:maxLength";
|
|
8
|
-
var maxLength = (expected) => (received, ctx) => {
|
|
9
|
-
if (received.length > expected) ctx.addIssue(expected, received,
|
|
10
|
-
};
|
|
11
|
+
var maxLength = (expected) => _chunkWOPNDC4Rjs._constrain.call(void 0, { maxLength: expected }, (received, ctx) => {
|
|
12
|
+
if (received.length > expected) ctx.addIssue(expected, received, maxLengthErrorKey);
|
|
13
|
+
});
|
|
11
14
|
maxLength.key = maxLengthErrorKey;
|
|
12
15
|
maxLength.message = maxLengthErrorMessage;
|
|
13
|
-
|
|
16
|
+
_chunkZJGY6EOEjs.setToDefaultLocale.call(void 0, maxLength);
|
|
14
17
|
|
|
15
18
|
|
|
16
19
|
|
|
17
20
|
exports.maxLength = maxLength;
|
|
18
|
-
//# sourceMappingURL=chunk-
|
|
21
|
+
//# sourceMappingURL=chunk-UIJIIIOA.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/bguard/bguard/lib/chunk-UIJIIIOA.js","../src/asserts/string/maxLength.ts"],"names":[],"mappings":"AAAA;AACE;AACF,sDAA4B;AAC5B;AACE;AACF,sDAA4B;AAC5B;AACA;ACHA,IAAM,sBAAA,EAAwB,oDAAA;AAC9B,IAAM,kBAAA,EAAoB,aAAA;AAcnB,IAAM,UAAA,EAAY,CAAC,QAAA,EAAA,GACxB,yCAAA,EAAa,SAAA,EAAW,SAAS,CAAA,EAAG,CAAC,QAAA,EAAkB,GAAA,EAAA,GAA0B;AAC/E,EAAA,GAAA,CAAI,QAAA,CAAS,OAAA,EAAS,QAAA,EAAU,GAAA,CAAI,QAAA,CAAS,QAAA,EAAU,QAAA,EAAU,iBAAiB,CAAA;AACpF,CAAC,CAAA;AAEH,SAAA,CAAU,IAAA,EAAM,iBAAA;AAChB,SAAA,CAAU,QAAA,EAAU,qBAAA;AACpB,iDAAA,SAA4B,CAAA;ADV5B;AACA;AACE;AACF,8BAAC","file":"/home/runner/work/bguard/bguard/lib/chunk-UIJIIIOA.js","sourcesContent":[null,"import type { ExceptionContext, RequiredValidation } from '../../core';\nimport { _constrain } from '../../helpers/jsonSchemaConstraint';\nimport { setToDefaultLocale } from '../../translationMap';\n\nconst maxLengthErrorMessage = 'The received value length is greater than expected';\nconst maxLengthErrorKey = 's:maxLength';\n\n/**\n * @description Asserts that the length of a string value is not greater than a specified maximum length.\n * @param {number} expected The maximum allowed length for the string.\n * @returns {RequiredValidation} A validation function that takes a received string and an exception context.\n * @throws {ValidationError} if the length of the received value is greater than the expected length.\n * @example\n * const schema = string().custom(maxLength(10));\n * parseOrFail(schema, 'short'); // Valid\n * parseOrFail(schema, 'this is a very long string'); // Throws an error: 'The received value length is greater than expected'\n *\n * @translation Error Translation Key = 's:maxLength'\n */\nexport const maxLength = (expected: number): RequiredValidation<string> =>\n _constrain({ maxLength: expected }, (received: string, ctx: ExceptionContext) => {\n if (received.length > expected) ctx.addIssue(expected, received, maxLengthErrorKey);\n });\n\nmaxLength.key = maxLengthErrorKey;\nmaxLength.message = maxLengthErrorMessage;\nsetToDefaultLocale(maxLength);\n"]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import {
|
|
2
|
+
CommonSchema
|
|
3
|
+
} from "./chunk-LDZFOOWN.mjs";
|
|
4
|
+
import {
|
|
5
|
+
BuildSchemaError
|
|
6
|
+
} from "./chunk-O2WD4JBG.mjs";
|
|
7
|
+
|
|
8
|
+
// src/asserts/mix/index.ts
|
|
9
|
+
function oneOfTypes(valueTypes) {
|
|
10
|
+
if (!valueTypes.length) throw new BuildSchemaError("Missing value types in oneOfTypes method");
|
|
11
|
+
return new CommonSchema({
|
|
12
|
+
type: valueTypes,
|
|
13
|
+
requiredValidations: [],
|
|
14
|
+
// Without this the inferred type said `| undefined` while validation rejected it as missing.
|
|
15
|
+
isOptional: valueTypes.includes("undefined") || void 0
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export {
|
|
20
|
+
oneOfTypes
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=chunk-UMS4M7FU.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/asserts/mix/index.ts"],"sourcesContent":["import { BaseType, MapMixTypes, WithBGuardType, WithUndefined } from '../../commonTypes';\nimport { CommonSchema } from '../../core';\nimport { BuildSchemaError } from '../../exceptions';\n\n/**\n * Listing `'undefined'` infers `| undefined`, so the schema has to accept a missing value as well,\n * and an object property holding it has to be optional. Both follow from the `WithUndefined` brand\n * plus `isOptional` on the context.\n */\ntype OneOfTypesSchema<T extends BaseType[]> = 'undefined' extends T[number]\n ? WithUndefined<WithBGuardType<CommonSchema, MapMixTypes<T>>>\n : WithBGuardType<CommonSchema, MapMixTypes<T>>;\n\n/**\n * @description Creates a new schema for validating values that can match any one of the specified primitive types.\n * @template T\n * @param {T} valueTypes - An array of primitive types that the value can match.\n * @returns A new schema for validating values that can match any of the specified types.\n * @example\n * const schema = oneOfTypes(['string', 'number']);\n * parseOrFail(schema, 'hello'); // Validates successfully\n * parseOrFail(schema, 42); // Validates successfully\n * parseOrFail(schema, true); // Throws a validation error\n *\n * @instance Of CommonSchema\n */\nexport function oneOfTypes<T extends BaseType[]>(valueTypes: T): OneOfTypesSchema<T> {\n // An empty list left the type check with nothing to compare against, so the schema accepted any\n // value at all and code-generated to an empty type annotation.\n if (!valueTypes.length) throw new BuildSchemaError('Missing value types in oneOfTypes method');\n\n return new CommonSchema({\n type: valueTypes,\n requiredValidations: [],\n // Without this the inferred type said `| undefined` while validation rejected it as missing.\n isOptional: valueTypes.includes('undefined') || undefined,\n }) as OneOfTypesSchema<T>;\n}\n"],"mappings":";;;;;;;;AA0BO,SAAS,WAAiC,YAAoC;AAGnF,MAAI,CAAC,WAAW,OAAQ,OAAM,IAAI,iBAAiB,0CAA0C;AAE7F,SAAO,IAAI,aAAa;AAAA,IACtB,MAAM;AAAA,IACN,qBAAqB,CAAC;AAAA;AAAA,IAEtB,YAAY,WAAW,SAAS,WAAW,KAAK;AAAA,EAClD,CAAC;AACH;","names":[]}
|