bguard 0.6.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +571 -5
- package/lib/InferType.d.mts +37 -3
- package/lib/InferType.d.ts +37 -3
- package/lib/asserts/array/index.d.mts +1 -0
- package/lib/asserts/array/index.d.ts +1 -0
- package/lib/asserts/array/index.js +6 -6
- package/lib/asserts/array/index.mjs +5 -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 +8 -3
- package/lib/asserts/bigint/index.d.ts +8 -3
- package/lib/asserts/bigint/index.js +9 -9
- package/lib/asserts/bigint/index.mjs +8 -8
- package/lib/asserts/boolean/index.d.mts +9 -2
- package/lib/asserts/boolean/index.d.ts +9 -2
- package/lib/asserts/boolean/index.js +7 -7
- package/lib/asserts/boolean/index.mjs +6 -6
- package/lib/asserts/coerce/index.d.mts +52 -0
- package/lib/asserts/coerce/index.d.ts +52 -0
- package/lib/asserts/coerce/index.js +21 -0
- package/lib/asserts/coerce/index.js.map +1 -0
- package/lib/asserts/coerce/index.mjs +21 -0
- package/lib/asserts/coerce/index.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 +1 -0
- package/lib/asserts/date/index.d.ts +1 -0
- package/lib/asserts/date/index.js +6 -6
- package/lib/asserts/date/index.mjs +5 -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 +3 -2
- package/lib/asserts/number/index.d.ts +3 -2
- package/lib/asserts/number/index.js +9 -9
- package/lib/asserts/number/index.mjs +8 -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 +8 -3
- package/lib/asserts/string/index.d.ts +8 -3
- package/lib/asserts/string/index.js +10 -9
- package/lib/asserts/string/index.js.map +1 -1
- package/lib/asserts/string/index.mjs +9 -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-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-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-5PIGAEGL.mjs +22 -0
- package/lib/chunk-5PIGAEGL.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-5VZDHJKM.mjs +68 -0
- package/lib/chunk-5VZDHJKM.mjs.map +1 -0
- 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-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-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-6WKSLMJG.mjs → chunk-B2R5S6OH.mjs} +6 -6
- 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-OZ3BTSSQ.mjs → chunk-CJCIOMS7.mjs} +19 -17
- package/lib/chunk-CJCIOMS7.mjs.map +1 -0
- package/lib/chunk-CLRHVTVY.js +50 -0
- package/lib/chunk-CLRHVTVY.js.map +1 -0
- package/lib/{chunk-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-NBR3QGKW.js → chunk-DPXTSNEX.js} +5 -5
- package/lib/{chunk-NBR3QGKW.js.map → chunk-DPXTSNEX.js.map} +1 -1
- 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-TCDQA2NU.js → chunk-EJCCIGXH.js} +8 -8
- package/lib/{chunk-TCDQA2NU.js.map → chunk-EJCCIGXH.js.map} +1 -1
- package/lib/{chunk-6LPQRAFN.js → chunk-EN745GWN.js} +10 -7
- package/lib/chunk-EN745GWN.js.map +1 -0
- package/lib/{chunk-OFZMO7PB.mjs → chunk-ETBJ4NF4.mjs} +7 -4
- package/lib/chunk-ETBJ4NF4.mjs.map +1 -0
- package/lib/chunk-EVM26M2C.js +66 -0
- package/lib/chunk-EVM26M2C.js.map +1 -0
- package/lib/{chunk-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-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-GYLCPX6O.js +68 -0
- package/lib/chunk-GYLCPX6O.js.map +1 -0
- 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-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-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-M3HYPZLE.mjs → chunk-KAFZGQ2W.mjs} +10 -8
- package/lib/chunk-KAFZGQ2W.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-KGNT5T35.mjs +70 -0
- package/lib/chunk-KGNT5T35.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-L7YFDMZU.js +78 -0
- package/lib/chunk-L7YFDMZU.js.map +1 -0
- package/lib/chunk-LDZFOOWN.mjs +595 -0
- package/lib/chunk-LDZFOOWN.mjs.map +1 -0
- package/lib/{chunk-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-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-WYM2TIVW.mjs → chunk-O646PJXY.mjs} +3 -3
- 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-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-C2VSTWID.js → chunk-TJ7IQSHU.js} +9 -6
- package/lib/chunk-TJ7IQSHU.js.map +1 -0
- package/lib/chunk-TLLR2DXI.js +70 -0
- package/lib/chunk-TLLR2DXI.js.map +1 -0
- package/lib/{chunk-7JL66G7G.mjs → chunk-TPSWNY5K.mjs} +2 -2
- package/lib/{chunk-7JL66G7G.mjs.map → chunk-TPSWNY5K.mjs.map} +1 -1
- package/lib/chunk-UCHEFFWR.js +79 -0
- package/lib/chunk-UCHEFFWR.js.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-NFD7D5GZ.mjs → chunk-UWONIZJZ.mjs} +26 -19
- package/lib/chunk-UWONIZJZ.mjs.map +1 -0
- package/lib/chunk-UYAF7QRD.mjs +22 -0
- package/lib/chunk-UYAF7QRD.mjs.map +1 -0
- package/lib/chunk-VERUOTB3.mjs +10 -0
- package/lib/chunk-VERUOTB3.mjs.map +1 -0
- package/lib/{chunk-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-TLRVQWCI.mjs → chunk-WL7BV4XV.mjs} +9 -6
- package/lib/chunk-WL7BV4XV.mjs.map +1 -0
- package/lib/chunk-WOPNDC4R.js +10 -0
- package/lib/chunk-WOPNDC4R.js.map +1 -0
- package/lib/chunk-X6SI76NQ.js +22 -0
- package/lib/chunk-X6SI76NQ.js.map +1 -0
- package/lib/{chunk-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-UYQFYQQG.mjs → chunk-YJZXJKM4.mjs} +30 -20
- package/lib/chunk-YJZXJKM4.mjs.map +1 -0
- package/lib/chunk-YOF36UOS.js +19 -0
- package/lib/chunk-YOF36UOS.js.map +1 -0
- package/lib/{chunk-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 +16 -2
- package/lib/index.d.ts +16 -2
- package/lib/index.js +115 -55
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +135 -75
- 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 +183 -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-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-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-6WKSLMJG.mjs.map → chunk-B2R5S6OH.mjs.map} +0 -0
- /package/lib/{chunk-THU5VBSO.mjs.map → chunk-IIL6D2UL.mjs.map} +0 -0
- /package/lib/{chunk-WYM2TIVW.mjs.map → chunk-O646PJXY.mjs.map} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/bguard/bguard/lib/chunk-6LUSV3SS.js","../src/core.ts"],"names":["schema"],"mappings":"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","file":"/home/runner/work/bguard/bguard/lib/chunk-6LUSV3SS.js","sourcesContent":[null,"import { isValidDateInner } from './helpers/isValidDateInner';\nimport {\n BaseType,\n MetaContext,\n TransformCallback,\n TranslationErrorMap,\n ValidationErrorData,\n WithArray,\n WithBGuardType,\n WithDefault,\n WithInput,\n WithNull,\n WithObject,\n WithRecord,\n WithTuple,\n WithUndefined,\n} from './commonTypes';\nimport { type InferInput, type InferType } from './InferType';\nimport { BuildSchemaError, ValidationError } from './exceptions';\nimport { getTranslationByLocale } from './translationMap';\nimport { ctxSymbol } from './helpers/constants';\nimport type { StandardSchemaProps, StandardSchemaResult } from './standardSchema';\n\nconst replacePlaceholdersRegex = /{{(.*?)}}/g;\n\nfunction replacePlaceholders(template: string, replacements: Record<string, unknown>): string {\n return template.replace(replacePlaceholdersRegex, (_, key) => {\n return key in replacements ? `${replacements[key] as string}` : `{{${key}}}`;\n });\n}\n\nexport class ExceptionContext {\n constructor(\n public readonly initialReceived: unknown,\n public readonly t: TranslationErrorMap,\n public readonly pathToError: string,\n public readonly errors?: ValidationErrorData[],\n public readonly meta?: MetaContext,\n /** The same location as `pathToError`, as keys. A string path cannot be taken apart again\n * reliably, because a key may itself contain a dot or a bracket. */\n public readonly path: readonly PropertyKey[] = [],\n /** Where async validations are collected. Absent during a synchronous parse, which is how one\n * is detected and reported rather than silently skipped. */\n public readonly pending?: PendingValidation[],\n ) {}\n\n /**\n * The same location, reporting into a different errors list.\n *\n * A union tries each member against a throwaway list so a member that does not match is not fatal.\n * An async validation reached inside the winning member is awaited long after that decision, so it\n * has to be re-pointed at the real list or its issues would be collected where nobody reads them.\n */\n withErrors(errors?: ValidationErrorData[]) {\n return new ExceptionContext(\n this.initialReceived,\n this.t,\n this.pathToError,\n errors,\n this.meta,\n this.path,\n this.pending,\n );\n }\n\n /**\n * Records async validations to be awaited once the walk is over.\n *\n * Throws during a synchronous parse rather than dropping them: a validation that never runs is worse\n * than a clear instruction to use parseAsync.\n */\n enqueueAsync(validations: AsyncRequiredValidation[], received: unknown) {\n if (!this.pending) throw new BuildSchemaError('Schema has an async validation. Use parseAsync or parseOrFailAsync');\n\n this.pending.push({ validations, received, ctx: this });\n }\n\n /**\n * Descends into a property or an index, deriving both forms of the location from the same key so\n * they cannot disagree.\n */\n createChild(pathSegment: PropertyKey, childMeta?: MetaContext) {\n const childPathToError =\n typeof pathSegment === 'number'\n ? `${this.pathToError}[${pathSegment}]`\n : `${this.pathToError}.${String(pathSegment)}`;\n\n return new ExceptionContext(\n this.initialReceived,\n this.t,\n childPathToError,\n this.errors,\n childMeta,\n [...this.path, pathSegment],\n this.pending,\n );\n }\n\n public ref(path: string): unknown {\n let ref: unknown = this.initialReceived;\n\n for (const el of path.split('.')) {\n // A path that runs past the end of the data yields undefined. Indexing straight into it threw\n // a TypeError, which parseOrFail turned into a bare 'Something unexpected happened' with no\n // indication of which assert or which path was at fault.\n if (ref === null || ref === undefined) return undefined;\n ref = (ref as Record<string, unknown>)[el];\n }\n\n return ref;\n }\n\n public addIssue(expected: unknown, received: unknown, messageKey: string): never | void {\n const rawMessage = this.t[messageKey] ?? messageKey;\n const message = replacePlaceholders(rawMessage, { e: expected, r: received, p: this.pathToError });\n\n if (this.errors) {\n this.errors.push({\n expected,\n received,\n pathToError: this.pathToError,\n path: this.path,\n code: messageKey,\n message,\n meta: this.meta,\n });\n\n return;\n }\n\n throw new ValidationError(expected, received, this.pathToError, message, this.meta, this.path, messageKey);\n }\n}\n\n/**\n * A validation function run against an already type-checked value.\n *\n * `T` is the value the assert knows how to inspect, and it is what stops a string assert from\n * being attached to a number schema: `custom` asks for `RequiredValidation<AssertInput<this>>`,\n * and function parameters are compared contravariantly under `strictFunctionTypes`.\n *\n * An assert that genuinely accepts anything should declare `RequiredValidation<unknown>`, which\n * stays assignable to every schema. The default of `any` is deliberate, so that custom asserts\n * written against the previous signature keep compiling.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type RequiredValidation<T = any> = (received: T, ctx: ExceptionContext) => void;\n\n/**\n * A validation that has to wait for something — a database lookup, an HTTP call.\n *\n * Registered with `customAsync` and run by `parseAsync`. Asserts only add issues, they never change the\n * value, so the value the synchronous walk produced is already final by the time these run.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type AsyncRequiredValidation<T = any> = (received: T, ctx: ExceptionContext) => Promise<void>;\n\n/** An async validation that has been reached, waiting to be awaited once the walk is over. */\ninterface PendingValidation {\n validations: AsyncRequiredValidation[];\n received: unknown;\n ctx: ExceptionContext;\n}\n\n/**\n * The runtime value a schema hands to its asserts. Nullish is stripped, because `innerCheck`\n * returns before running asserts when the value is `null` or `undefined`.\n */\nexport type AssertInput<T> =\n T extends WithBGuardType<unknown, infer Y>\n ? NonNullable<Y>\n : T extends WithArray<unknown, unknown>\n ? unknown[]\n : T extends WithTuple<unknown, unknown>\n ? unknown[]\n : T extends WithObject<unknown, unknown>\n ? Record<string, unknown>\n : T extends WithRecord<unknown, unknown, unknown>\n ? Record<string, unknown>\n : unknown;\n\n/**\n * Runs a schema's own assertions. The async ones are only enqueued: they are awaited after the walk,\n * so a slow check never holds up the structural validation around it.\n */\nfunction runValidations(schemaData: ValidatorContext, receivedValue: unknown, exCtx: ExceptionContext) {\n schemaData.requiredValidations.forEach((requiredValidation) => {\n requiredValidation(receivedValue, exCtx);\n });\n\n if (schemaData.asyncValidations?.length) exCtx.enqueueAsync(schemaData.asyncValidations, receivedValue);\n}\n\nfunction innerCheck(schema: CommonSchema, receivedValue: unknown, exCtx: ExceptionContext): unknown {\n const schemaData = schema[ctxSymbol];\n\n // Nothing to transform when the value is absent. Running the list anyway turned `undefined` into\n // whatever the callback made of it, so an optional string with a `val + ''` transform parsed to\n // the string 'undefined'.\n if (receivedValue !== undefined) {\n schemaData.transformListBefore?.forEach((transformCallback) => {\n receivedValue = transformCallback(receivedValue);\n });\n }\n\n if (receivedValue === undefined) {\n if (schemaData.defaultValue === undefined) {\n if (!schemaData.isOptional) exCtx.addIssue('Required', receivedValue, 'c:optional');\n return receivedValue;\n }\n\n // Carry on with the default as the received value rather than returning it. Returning it handed\n // every parse the same array or object, so mutating one result changed what later parses gave\n // back; going through validation rebuilds containers and yields a fresh value each time.\n receivedValue = schemaData.defaultValue;\n }\n\n if (receivedValue === null) {\n if (!schemaData.isNullable) exCtx.addIssue('Not null', receivedValue, 'c:nullable');\n return receivedValue;\n }\n\n if (schemaData.date) {\n if (!isValidDateInner(receivedValue)) exCtx.addIssue('Date', receivedValue, 'c:date');\n }\n\n const typeOfVal = typeof receivedValue;\n\n if (schemaData.type.length) {\n if (!schemaData.type.includes(typeOfVal)) exCtx.addIssue(schemaData.type, typeOfVal, 'c:invalidType');\n // NaN is a number by typeof, and every comparison against it is false, so it slipped past\n // min, max, positive and negative alike.\n else if (typeOfVal === 'number' && Number.isNaN(receivedValue)) exCtx.addIssue('number', receivedValue, 'c:nan');\n }\n\n if (schemaData.lazy) {\n // Resolved on first use rather than at construction, which is what lets a schema refer to\n // itself. The result is cached on the context so the thunk runs once.\n schemaData.lazy.resolved ??= schemaData.lazy.getSchema();\n\n if (!(schemaData.lazy.resolved instanceof CommonSchema))\n throw new BuildSchemaError('Invalid schema returned from lazy method');\n\n return innerCheck(schemaData.lazy.resolved, receivedValue, exCtx);\n }\n\n if (schemaData.tuple) {\n if (!Array.isArray(receivedValue)) return exCtx.addIssue('Array', receivedValue, 'c:array');\n\n runValidations(schemaData, receivedValue, exCtx);\n\n if (receivedValue.length !== schemaData.tuple.length) {\n // Reported and then abandoned: walking the declared positions as well would add a \"required\"\n // error for every position the value does not reach, which says nothing further.\n exCtx.addIssue(schemaData.tuple.length, receivedValue.length, 'c:tupleLength');\n return receivedValue;\n }\n\n const parsedTuple: unknown[] = [];\n\n for (let i = 0; i < schemaData.tuple.length; i++) {\n const positionSchema = schemaData.tuple[i] as CommonSchema;\n parsedTuple.push(\n innerCheck(\n positionSchema,\n receivedValue[i],\n exCtx.createChild(i, positionSchema[ctxSymbol].meta ?? schemaData.meta),\n ),\n );\n }\n\n return parsedTuple;\n }\n\n if (schemaData.union) {\n // The union's own asserts see the value whichever member ends up matching, so they are declared\n // over `unknown` and run before any member is tried.\n runValidations(schemaData, receivedValue, exCtx);\n\n const attemptErrors: ValidationErrorData[] = [];\n for (const memberSchema of schemaData.union) {\n const errorsBefore = attemptErrors.length;\n // Async validations reached inside a member are collected separately and only kept if that member\n // wins. Sharing the outer list would let a rejected member's validations run and report issues.\n const attemptPending: PendingValidation[] = [];\n // Each member is tried against a context that collects instead of throwing, so a member that\n // does not match is not fatal. Only a member that produces nothing wins.\n const attemptCtx = new ExceptionContext(\n exCtx.initialReceived,\n exCtx.t,\n exCtx.pathToError,\n attemptErrors,\n schemaData.meta,\n // Carried over, so an async validation inside the winning member keeps the right location.\n exCtx.path,\n exCtx.pending && attemptPending,\n );\n\n const parsedMember = innerCheck(memberSchema, receivedValue, attemptCtx);\n if (attemptErrors.length === errorsBefore) {\n for (const entry of attemptPending) {\n exCtx.pending?.push({ ...entry, ctx: entry.ctx.withErrors(exCtx.errors) });\n }\n\n return parsedMember;\n }\n }\n\n exCtx.addIssue('One of the union members', receivedValue, 'c:union');\n return receivedValue;\n }\n\n if (schemaData.record) {\n if (typeOfVal !== 'object' || Array.isArray(receivedValue)) {\n if (Array.isArray(receivedValue)) {\n exCtx.addIssue('Object', receivedValue, 'c:objectTypeAsArray');\n } else {\n exCtx.addIssue('Object', receivedValue, 'c:objectType');\n }\n\n return receivedValue;\n }\n\n runValidations(schemaData, receivedValue, exCtx);\n\n const { key: keySchema, value: valueSchema } = schemaData.record;\n const parsedRecord: Record<string, unknown> = {};\n\n for (const [receivedKey, receivedRecordValue] of Object.entries(receivedValue as Record<string, unknown>)) {\n const childCtx = exCtx.createChild(receivedKey, schemaData.meta);\n\n // Keys are validated too, which is what makes a restricted key type meaningful.\n innerCheck(keySchema, receivedKey, childCtx);\n parsedRecord[receivedKey] = innerCheck(valueSchema, receivedRecordValue, childCtx);\n }\n\n return parsedRecord;\n }\n\n if (schemaData.array) {\n if (!Array.isArray(receivedValue)) return exCtx.addIssue('Array', receivedValue, 'c:array');\n\n runValidations(schemaData, receivedValue, exCtx);\n\n const schema = schemaData.array;\n const parsedReceivedValue: unknown[] = [];\n // Indexed rather than forEach, which skips holes: a sparse array used to come back shorter than\n // it went in, with no error to say so. A hole now reaches innerCheck as undefined and is\n // reported unless the element schema is optional.\n for (let i = 0; i < receivedValue.length; i++) {\n const parsedElement = innerCheck(\n schema,\n receivedValue[i],\n // The element's own metadata wins; the array's is inherited when it has none.\n exCtx.createChild(i, schema[ctxSymbol].meta ?? schemaData.meta),\n );\n parsedReceivedValue.push(parsedElement);\n }\n\n return parsedReceivedValue;\n }\n\n if (schemaData.object) {\n if (typeOfVal !== 'object' || Array.isArray(receivedValue)) {\n // Reported and then abandoned. When errors are collected rather than thrown, walking the\n // shape of a non-object went on to invent one \"unrecognized property\" per string index and\n // one \"missing property\" per declared key, so a single wrong type produced seven errors.\n if (Array.isArray(receivedValue)) {\n exCtx.addIssue('Object', receivedValue, 'c:objectTypeAsArray');\n } else {\n exCtx.addIssue('Object', receivedValue, 'c:objectType');\n }\n\n return receivedValue;\n }\n\n runValidations(schemaData, receivedValue, exCtx);\n\n const shapeSchema = schemaData.object;\n const parsedReceivedValue: Record<string, unknown> = {};\n // Null was handled above and the type guard just ruled out arrays and non-objects.\n const receivedObject = receivedValue as Record<string, unknown>;\n\n if (!schemaData.allowUnrecognizedObjectProps) {\n for (const keyPerReceivedValue of Object.keys(receivedObject)) {\n // An own-property check, not an undefined check: `constructor`, `toString` and `__proto__`\n // all resolve on Object.prototype, so a plain lookup accepted them as declared properties\n // and then dropped them from the output. Spelled out rather than via Object.hasOwn, which\n // would add a runtime floor the package does not otherwise require.\n if (!Object.prototype.hasOwnProperty.call(shapeSchema, keyPerReceivedValue))\n exCtx.addIssue('Unrecognized property', keyPerReceivedValue, 'c:unrecognizedProperty');\n }\n }\n\n for (const [keyOfSchema, valueOfSchema] of Object.entries(shapeSchema)) {\n const valueSchemaData = valueOfSchema[ctxSymbol];\n const receivedObjectValuePropery = receivedObject[keyOfSchema];\n if (\n receivedObjectValuePropery === undefined &&\n !valueSchemaData.isOptional &&\n // A property with a default is not missing: innerCheck substitutes the value below. The\n // check used to run first and reject it, so default() could never apply to a property.\n valueSchemaData.defaultValue === undefined\n ) {\n // Reported at the property's own path, not the container's. Reporting it on the container\n // gave every missing property the same empty path, so neither an error list nor a Standard\n // Schema consumer could tell which field was missing — or tell two of them apart.\n exCtx\n .createChild(keyOfSchema, valueSchemaData.meta ?? schemaData.meta)\n .addIssue('Required', receivedObjectValuePropery, 'c:requiredProperty');\n\n // Stop here, or innerCheck reports the same missing value again as 'c:optional'.\n continue;\n }\n\n const parsedReceivedObjectValuePropery = innerCheck(\n valueOfSchema,\n receivedObjectValuePropery,\n exCtx.createChild(keyOfSchema, valueSchemaData.meta ?? schemaData.meta),\n );\n\n // Only carried over when there is something to carry. Assigning unconditionally gave an absent\n // optional property a present key holding undefined, so `Object.keys` and `in` reported a field\n // nobody sent — invisible through JSON.stringify, which drops such keys. A property the input\n // did hold is kept even when its value is undefined, and one with a default has a value by now.\n if (\n parsedReceivedObjectValuePropery !== undefined ||\n Object.prototype.hasOwnProperty.call(receivedObject, keyOfSchema)\n ) {\n parsedReceivedValue[keyOfSchema] = parsedReceivedObjectValuePropery;\n }\n }\n\n return parsedReceivedValue;\n }\n\n runValidations(schemaData, receivedValue, exCtx);\n\n return receivedValue;\n}\n\nexport type ObjectShapeSchemaType = Record<string, CommonSchema>;\n\nexport interface RecordSchemaType {\n key: CommonSchema;\n value: CommonSchema;\n}\n\nexport interface LazySchemaType {\n /** The name codeGen emits at the recursion point, instead of descending forever. */\n typeName: string;\n getSchema: () => CommonSchema;\n /** Filled on first use, so the thunk runs once however many values are validated. */\n resolved?: CommonSchema;\n}\n\nexport interface ValidatorContext {\n type: BaseType[];\n isNullable?: boolean;\n isOptional?: boolean;\n requiredValidations: RequiredValidation[];\n asyncValidations?: AsyncRequiredValidation[];\n array?: CommonSchema;\n object?: ObjectShapeSchemaType;\n union?: CommonSchema[];\n record?: RecordSchemaType;\n tuple?: CommonSchema[];\n lazy?: LazySchemaType;\n allowUnrecognizedObjectProps?: boolean;\n strictType?: boolean;\n strictTypeValue?: unknown;\n date?: boolean;\n defaultValue?: unknown;\n meta?: MetaContext;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n transformListBefore?: TransformCallback<any, any>[];\n}\n\n/**\n * Copies a context so a derived schema can be changed without touching the one it came from.\n *\n * Child schemas in `array` and `object` are shared by reference rather than copied. That is safe\n * because schemas are immutable: refining a child produces a new instance instead of altering the\n * shared one. Only the containers themselves are re-allocated, so adding a key to a derived\n * object schema cannot be seen by the original.\n */\nfunction cloneValidatorContext(ctx: ValidatorContext): ValidatorContext {\n const next: ValidatorContext = {\n ...ctx,\n type: [...ctx.type],\n requiredValidations: [...ctx.requiredValidations],\n };\n\n if (ctx.asyncValidations) next.asyncValidations = [...ctx.asyncValidations];\n if (ctx.object) next.object = { ...ctx.object };\n if (ctx.union) next.union = [...ctx.union];\n if (ctx.record) next.record = { ...ctx.record };\n if (ctx.tuple) next.tuple = [...ctx.tuple];\n if (ctx.lazy) next.lazy = { ...ctx.lazy };\n if (ctx.transformListBefore) next.transformListBefore = [...ctx.transformListBefore];\n if (ctx.meta) next.meta = { ...ctx.meta };\n\n return next;\n}\n\nexport class CommonSchema {\n [ctxSymbol]: ValidatorContext;\n constructor(ctx: ValidatorContext) {\n this[ctxSymbol] = ctx;\n }\n\n /**\n * The Standard Schema v1 interface, which lets a bguard schema be used by any library that accepts\n * a validator without either side knowing about the other.\n *\n * A getter rather than a stored property, so it costs nothing until something asks for it and is\n * not copied by `clone`. `types` is declared but deliberately never assigned: the spec defines it\n * as type-only. Input and output are reported separately, so a consumer generating a form asks for\n * what the schema takes rather than what it returns.\n */\n public get '~standard'(): StandardSchemaProps<InferInput<this>, InferType<this>> {\n return {\n version: 1,\n vendor: 'bguard',\n // An arrow function, so `this` is the schema however the property is destructured or passed on.\n validate: (value: unknown) => {\n // The spec allows either a result or a promise of one, decided per call. A schema with async\n // validations returns a promise; everything else stays synchronous, so a consumer that never\n // awaits keeps working.\n if (hasAsyncValidation(this)) return parseAsync(this, value, { getAllErrors: true }).then(toStandardResult);\n\n return toStandardResult(parse(this, value, { getAllErrors: true }));\n },\n };\n }\n\n /**\n * Returns a copy of this schema that carries its own context.\n *\n * Every refining method goes through this, so a schema can be shared between properties and\n * reused as a base without one use leaking into another. Construction is deliberately bypassed:\n * the subclass constructors validate their arguments and take extra parameters, and neither\n * applies when deriving from an already-valid schema.\n *\n * Public because deriving a schema is a reasonable thing to do from outside as well — the object\n * utilities need it to rebuild a property schema without touching the one they were handed.\n */\n public clone(): this {\n const next = Object.assign(Object.create(Object.getPrototypeOf(this) as object), this) as this;\n next[ctxSymbol] = cloneValidatorContext(this[ctxSymbol]);\n return next;\n }\n\n /**\n * @param validators - One or more custom validation functions.\n * @returns {this} A new schema instance with the added custom validation.\n */\n public custom(...validators: RequiredValidation<AssertInput<this>>[]): this {\n this.defaultValueCheck();\n const next = this.clone();\n next[ctxSymbol].requiredValidations.push(...validators);\n return next;\n }\n\n /**\n * Adds validations that have to wait for something, such as a database lookup.\n *\n * These run only under `parseAsync` or `parseOrFailAsync`; a synchronous parse reports a\n * `BuildSchemaError` rather than skipping them. They are awaited after the structural walk is\n * complete, all together, so several slow checks across a schema cost one round of waiting.\n *\n * @param validators - One or more async validation functions.\n * @returns {this} A new schema instance with the added validations.\n * @example\n * const schema = string().customAsync(async (received, ctx) => {\n * if (await isTaken(received)) ctx.addIssue('an unused name', received, 'name is taken');\n * });\n */\n public customAsync(...validators: AsyncRequiredValidation<AssertInput<this>>[]): this {\n this.defaultValueCheck();\n const next = this.clone();\n next[ctxSymbol].asyncValidations = [...(next[ctxSymbol].asyncValidations ?? []), ...validators];\n return next;\n }\n\n /**\n * Marks the schema as nullable, allowing the value to be `null`.\n *\n * @returns {WithNull<this>} A new schema instance marked as nullable.\n */\n public nullable(): WithNull<this> {\n this.defaultValueCheck();\n const next = this.clone();\n next[ctxSymbol].isNullable = true;\n return next as WithNull<this>;\n }\n\n /**\n * Marks the schema as optional, allowing the value to be `undefined`.\n *\n * @returns {WithUndefined<this>} A new schema instance marked as optional.\n */\n public optional(): WithUndefined<this> {\n this.defaultValueCheck();\n const next = this.clone();\n next[ctxSymbol].isOptional = true;\n return next as WithUndefined<this>;\n }\n\n /**\n * Marks the schema as optional, allowing the value to be `undefined`.\n *\n * @returns {this} The schema instance. This method should be used as a last one because it does the check of previous methods and\n */\n public default(defaultValue: InferType<this>): WithDefault<this> {\n const ctx = this[ctxSymbol];\n if (ctx.isOptional) {\n throw new BuildSchemaError(`Cannot call method 'default' after method 'optional'`);\n }\n\n try {\n parseOrFail(this, defaultValue);\n } catch (e) {\n throw new BuildSchemaError((e as Error).message);\n }\n\n const next = this.clone();\n next[ctxSymbol].defaultValue = defaultValue;\n return next as WithDefault<this>;\n }\n\n /**\n * Applies a transformation to the input value before any validation occurs.\n * The transformation should return a value of the same type as the inferred type of the schema,\n * ensuring that the overall type is not altered.\n *\n * @template In - The type of the input value before transformation (defaults to `unknown`).\n * @param {TransformCallback<In, InferType<this>>} cb - The callback function that performs the transformation.\n * @returns {this} A new schema with the applied transformation.\n *\n * @example\n * const schema = string()\n * .nullable()\n * .transformBeforeValidation((val) => val + '') // Ensure the value is a string\n * .transformBeforeValidation((val: string) => (val === '' ? null : val)); // Convert empty strings to null\n *\n * // Parse 'test' will pass as 'test' is a valid string longer than 3 characters.\n * parseOrFail(schema, 'test');\n *\n * // Parsing '' will be transformed to null and will pass due to .nullable().\n * parseOrFail(schema, '');\n */\n public transformBeforeValidation<In>(cb: TransformCallback<In, InferType<this>>): WithInput<this, In> {\n const next = this.clone();\n const ctx = next[ctxSymbol];\n if (ctx.transformListBefore) {\n ctx.transformListBefore.push(cb);\n } else {\n ctx.transformListBefore = [cb];\n }\n\n // The callback's parameter type becomes the schema's input type, which is what lets a coercing\n // schema say that it accepts more than it produces.\n return next as WithInput<this, In>;\n }\n\n /**\n * Assigns a unique identifier to the schema.\n * This ID can be used to track or map validation errors back to specific fields\n * in a form or other structures.\n *\n * @param {string} value - The unique identifier for the schema.\n * @returns {this} A new schema with the assigned ID.\n *\n * @example\n * const schema = string().id('username');\n */\n public id(value: string): this {\n return this.meta('id', value);\n }\n\n /**\n * Provides a description for the schema, offering additional context or information.\n * The description can be used when displaying validation errors or for documentation purposes.\n *\n * @param {string} value - The description for the schema.\n * @returns {this} A new schema with the added description.\n *\n * @example\n * const schema = string().description('The username of the account holder.');\n */\n public description(value: string): this {\n return this.meta('description', value);\n }\n\n private meta(key: string, value: string): this {\n const next = this.clone();\n const ctx = next[ctxSymbol];\n ctx.meta = { ...ctx.meta, [key]: value };\n return next;\n }\n\n protected defaultValueCheck() {\n if (this[ctxSymbol].defaultValue !== undefined) {\n throw new BuildSchemaError('Default value must be the last method called in schema');\n }\n }\n}\n\n/**\n * Parses and validates a value against the provided schema, returning a type-safe result.\n *\n * This function will throw a `ValidationError` if the value does not conform to the schema.\n * The inferred TypeScript type of the returned value will match the structure defined by the schema.\n *\n * @template T\n * @param {T} schema - The schema to validate the received value against. This schema dictates the expected structure and type of the value.\n * @param {unknown} receivedValue - The value to be validated and parsed according to the schema.\n * @param {ParseOptions} options - Options\n * @param {ParseOptions.lng} options.lng - Set language keyword to map Error message\n * @returns {InferType<T>} The validated value, with its TypeScript type inferred from the schema.\n *\n * @throws {ValidationError} If the received value does not match the schema, a `ValidationError` will be thrown.\n * @throws {Error} If an unexpected error occurs during validation, an error will be thrown with a generic message.\n *\n * @example\n * const schema = object({\n * name: string(),\n * age: number(),\n * });\n *\n * const result = parseOrFail(schema, { name: 'Alice', age: 30 });\n * // result will be inferred as { name: string; age: number }\n *\n * parseOrFail(schema, { name: 'Alice', age: '30' });\n * // Throws ValidationError because 'age' should be a number, not a string.\n */\nexport function parseOrFail<T extends CommonSchema>(\n schema: T,\n receivedValue: unknown,\n options?: ParseOptions,\n): InferType<T> {\n try {\n const ctx = new ExceptionContext(\n receivedValue,\n getTranslationByLocale(options?.lng),\n '',\n undefined,\n schema[ctxSymbol].meta,\n );\n return innerCheck(schema, receivedValue, ctx) as InferType<T>;\n } catch (e) {\n if (e instanceof ValidationError) throw e;\n // A BuildSchemaError means the schema itself is wrong, which is a programming error rather than\n // a validation failure. Some are only discoverable during validation, such as a lazy getter\n // returning something that is not a schema, and disguising them loses the reason entirely.\n if (e instanceof BuildSchemaError) throw e;\n\n // Anything else came from a custom assert, which can throw whatever it likes.\n throw new Error('Something unexpected happened');\n }\n}\n\ninterface ParseOptions {\n /**\n * Set language keyword to map error messages.\n * @default 'default'\n * @example 'sr' or 'Serbia' or any string to identify language\n */\n lng?: string;\n}\n\ninterface ParseAllOptions extends ParseOptions {\n /**\n * If true, collects all validation errors and returns them.\n * If false or undefined, returns the first validation error it can find and stops looking,\n * which provides a small runtime optimization.\n *\n * Declared only where it is honoured. `parseOrFail` throws on the first error by definition, and it\n * used to accept this flag and ignore it.\n * @default undefined\n */\n getAllErrors?: boolean;\n}\n\n/**\n * Parses and validates a value against the provided schema, returning a type-safe parsedValue.\n *\n * This function will throw a `ValidationError` if the value does not conform to the schema.\n * The inferred TypeScript type of the returned value will match the structure defined by the schema.\n *\n * @template T\n * @param {T} schema - The schema to validate the received value against. This schema dictates the expected structure and type of the value.\n * @param {unknown} receivedValue - The value to be validated and parsed according to the schema.\n * @param {ParseOptions} options - Options\n * @param {ParseOptions.lng} options.lng - Set language keyword to map Error messages\n * @param {ParseOptions.lng} options.getAllErrors - If `false` or `undefined` - returns the first validation error it can find and stops looking, which provides a small runtime optimization.\n * @returns {[undefined, InferType<T>]} A tuple of [undefined, InferType<T>] if parsing is successful.\n * @returns {[ValidationErrorData[], undefined]} A tuple of [ValidationErrorData[], undefined]] if errors occur.\n *\n * @example\n * const schema = object({\n * name: string(),\n * age: number(),\n * });\n *\n * const [errors, parsedValue] = parse(schema, { name: 'Alice', age: 30 });\n * // parsedValue will be inferred as { name: string; age: number }\n *\n *\n * const [errors, parsedValue] = parse(schema, { name: 'Alice', age: '30' });\n * // First element in array \"errors\" will have an error because 'age' should be a number, not a string.\n * // Array 'errors' returns only one element.\n *\n *\n * const [errors, parsedValue] = parse(schema, { name: true, age: '30' }, { getAllErrors: true});\n * // Returns array \"errors\" with multiple errors because 'age' should be a number and 'name' a string.\n * // With provided options { getAllErrors: true}, we can expecte more than one error in 'errors' array.\n *\n *\n * const [errors, parsedValue] = parse(schema, { name: true, age: '30' }, { lng: 'SR'});\n * // First element in array \"errors\" will have an error because 'age' should be a number, not a string.\n * // With provided options { lng: 'SR'}, errors will be translated to a language mapped with keyword 'SR'\n */\nexport function parse<T extends CommonSchema>(\n schema: T,\n receivedValue: unknown,\n options?: ParseAllOptions,\n): [ValidationErrorData[], null] | [null, InferType<T>] {\n try {\n const ctx = new ExceptionContext(\n receivedValue,\n getTranslationByLocale(options?.lng),\n '',\n options?.getAllErrors ? [] : undefined,\n schema[ctxSymbol].meta,\n );\n\n const parsedValue = innerCheck(schema, receivedValue, ctx) as InferType<T>;\n\n if (ctx.errors?.length) {\n return [ctx.errors, null];\n }\n\n return [null, parsedValue];\n } catch (e) {\n if (e instanceof ValidationError) {\n delete e.stack;\n return [[e], null];\n }\n\n if (e instanceof BuildSchemaError) throw e;\n\n // Anything else came from a custom assert, which can throw whatever it likes.\n return [[unexpectedError()], null];\n }\n}\n\n/**\n * Awaits the collected async validations and merges whatever they report.\n *\n * They are awaited together rather than in sequence, so several slow checks across one schema cost one\n * round of waiting. Each keeps the context it was reached with, so an issue lands on the right path.\n */\n/** Shapes a parse result the way Standard Schema expects it. */\nfunction toStandardResult<T>(result: [ValidationErrorData[], null] | [null, T]): StandardSchemaResult<T> {\n const [errors, parsedValue] = result;\n\n if (errors) return { issues: errors.map((error) => ({ message: error.message, path: error.path })) };\n\n return { value: parsedValue as T };\n}\n\n/**\n * Whether anything in the schema needs awaiting, which decides whether `~standard.validate` hands back\n * a promise. Walks the whole tree, since an async validation may sit at any depth.\n *\n * A lazy schema is only followed once it has been resolved. Following it here would force the thunk\n * merely because someone asked for the interface, and could recurse forever on a self-referential\n * schema — so a schema whose async validation hides behind an unresolved lazy is validated\n * synchronously and reports the BuildSchemaError that explains it.\n */\nfunction hasAsyncValidation(schema: CommonSchema, seen = new Set<CommonSchema>()): boolean {\n if (seen.has(schema)) return false;\n seen.add(schema);\n\n const schemaData = schema[ctxSymbol];\n if (schemaData.asyncValidations?.length) return true;\n\n const children: CommonSchema[] = [\n ...(schemaData.object ? Object.values(schemaData.object) : []),\n ...(schemaData.union ?? []),\n ...(schemaData.tuple ?? []),\n ...(schemaData.array ? [schemaData.array] : []),\n ...(schemaData.record ? [schemaData.record.key, schemaData.record.value] : []),\n ...(schemaData.lazy?.resolved ? [schemaData.lazy.resolved] : []),\n ];\n\n return children.some((child) => hasAsyncValidation(child, seen));\n}\n\n/** What a custom assert throwing something unrecognised is reported as, shared by both parse forms. */\nfunction unexpectedError(): ValidationErrorData {\n return {\n message: 'Something unexpected happened',\n expected: '',\n received: '',\n pathToError: '',\n path: [],\n code: '',\n meta: undefined,\n };\n}\n\nasync function settlePending(pending: PendingValidation[]) {\n await Promise.all(\n pending.flatMap(({ validations, received, ctx }) => validations.map((validation) => validation(received, ctx))),\n );\n}\n\n/**\n * The asynchronous counterpart of {@link parse}, for schemas carrying `customAsync` validations.\n *\n * The structure is validated synchronously first and the async validations run afterwards, all\n * together. That means their issues come after the synchronous ones in the returned array, and that an\n * async validation is never reached for a value the synchronous pass already rejected structurally.\n *\n * @example\n * const [errors, value] = await parseAsync(schema, received, { getAllErrors: true });\n */\nexport async function parseAsync<T extends CommonSchema>(\n schema: T,\n receivedValue: unknown,\n options?: ParseAllOptions,\n): Promise<[ValidationErrorData[], null] | [null, InferType<T>]> {\n const errors: ValidationErrorData[] = [];\n const pending: PendingValidation[] = [];\n\n try {\n const ctx = new ExceptionContext(\n receivedValue,\n getTranslationByLocale(options?.lng),\n '',\n // Always collecting: a throw partway through would leave the pending validations unawaited.\n errors,\n schema[ctxSymbol].meta,\n [],\n pending,\n );\n\n const parsedValue = innerCheck(schema, receivedValue, ctx) as InferType<T>;\n await settlePending(pending);\n\n if (errors.length) {\n if (!options?.getAllErrors) return [[errors[0] as ValidationErrorData], null];\n return [errors, null];\n }\n\n return [null, parsedValue];\n } catch (e) {\n if (e instanceof BuildSchemaError) throw e;\n\n // Anything else came from a custom assert, which can throw whatever it likes.\n return [[unexpectedError()], null];\n }\n}\n\n/**\n * The asynchronous counterpart of {@link parseOrFail}.\n *\n * Unlike the synchronous version it cannot stop at the first error, because the async validations have\n * to be awaited before anything can be reported. It throws the first error found, in the same order\n * `parseAsync` reports them.\n */\nexport async function parseOrFailAsync<T extends CommonSchema>(\n schema: T,\n receivedValue: unknown,\n options?: ParseOptions,\n): Promise<InferType<T>> {\n const [errors, parsedValue] = await parseAsync(schema, receivedValue, options);\n\n if (errors) {\n const [first] = errors;\n throw new ValidationError(\n first!.expected,\n first!.received,\n first!.pathToError,\n first!.message,\n first!.meta,\n first!.path,\n first!.code,\n );\n }\n\n return parsedValue as InferType<T>;\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/string/minLength.ts
|
|
6
9
|
var minLengthErrorMessage = "The received value length is less than expected";
|
|
7
10
|
var minLengthErrorKey = "s:minLength";
|
|
8
|
-
var minLength = (expected) => (received, ctx) => {
|
|
9
|
-
if (received.length < expected) ctx.addIssue(expected, received,
|
|
10
|
-
};
|
|
11
|
+
var minLength = (expected) => _chunkWOPNDC4Rjs._constrain.call(void 0, { minLength: expected }, (received, ctx) => {
|
|
12
|
+
if (received.length < expected) ctx.addIssue(expected, received, minLengthErrorKey);
|
|
13
|
+
});
|
|
11
14
|
minLength.key = minLengthErrorKey;
|
|
12
15
|
minLength.message = minLengthErrorMessage;
|
|
13
|
-
|
|
16
|
+
_chunkZJGY6EOEjs.setToDefaultLocale.call(void 0, minLength);
|
|
14
17
|
|
|
15
18
|
|
|
16
19
|
|
|
17
20
|
exports.minLength = minLength;
|
|
18
|
-
//# sourceMappingURL=chunk-
|
|
21
|
+
//# sourceMappingURL=chunk-7A4RN5UD.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/bguard/bguard/lib/chunk-7A4RN5UD.js","../src/asserts/string/minLength.ts"],"names":[],"mappings":"AAAA;AACE;AACF,sDAA4B;AAC5B;AACE;AACF,sDAA4B;AAC5B;AACA;ACHA,IAAM,sBAAA,EAAwB,iDAAA;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-7A4RN5UD.js","sourcesContent":[null,"import type { ExceptionContext, RequiredValidation } from '../../core';\nimport { _constrain } from '../../helpers/jsonSchemaConstraint';\nimport { setToDefaultLocale } from '../../translationMap';\n\nconst minLengthErrorMessage = 'The received value length is less than expected';\nconst minLengthErrorKey = 's:minLength';\n\n/**\n * @description Asserts that the length of a string value is not less than a specified minimum length.\n * @param {number} expected The minimum required 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 less than the expected length.\n * @example\n * const schema = string().custom(minLength(5));\n * parseOrFail(schema, 'short'); // Throws an error: 'The received value length is less than expected'\n * parseOrFail(schema, 'adequate'); // Valid\n *\n * @translation Error Translation Key = 's:minLength'\n */\nexport const minLength = (expected: number): RequiredValidation<string> =>\n _constrain({ minLength: expected }, (received: string, ctx: ExceptionContext) => {\n if (received.length < expected) ctx.addIssue(expected, received, minLengthErrorKey);\n });\n\nminLength.key = minLengthErrorKey;\nminLength.message = minLengthErrorMessage;\nsetToDefaultLocale(minLength);\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/number/maxExcluded.ts
|
|
6
9
|
var maxExcludedErrorMessage = "The received value is greater than or equal to expected";
|
|
7
10
|
var maxExcludedErrorKey = "n:maxExcluded";
|
|
8
|
-
var maxExcluded = (expected) => (received, ctx) => {
|
|
11
|
+
var maxExcluded = (expected) => _chunkWOPNDC4Rjs._constrain.call(void 0, { exclusiveMaximum: expected }, (received, ctx) => {
|
|
9
12
|
if (expected <= received) ctx.addIssue(expected, received, maxExcludedErrorKey);
|
|
10
|
-
};
|
|
13
|
+
});
|
|
11
14
|
maxExcluded.key = maxExcludedErrorKey;
|
|
12
15
|
maxExcluded.message = maxExcludedErrorMessage;
|
|
13
|
-
|
|
16
|
+
_chunkZJGY6EOEjs.setToDefaultLocale.call(void 0, maxExcluded);
|
|
14
17
|
|
|
15
18
|
|
|
16
19
|
|
|
17
20
|
exports.maxExcluded = maxExcluded;
|
|
18
|
-
//# sourceMappingURL=chunk-
|
|
21
|
+
//# sourceMappingURL=chunk-7CNZKYPM.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/bguard/bguard/lib/chunk-7CNZKYPM.js","../src/asserts/number/maxExcluded.ts"],"names":[],"mappings":"AAAA;AACE;AACF,sDAA4B;AAC5B;AACE;AACF,sDAA4B;AAC5B;AACA;ACHA,IAAM,wBAAA,EAA0B,yDAAA;AAChC,IAAM,oBAAA,EAAsB,eAAA;AAerB,IAAM,YAAA,EAAc,CAAC,QAAA,EAAA,GAC1B,yCAAA,EAAa,gBAAA,EAAkB,SAAS,CAAA,EAAG,CAAC,QAAA,EAAkB,GAAA,EAAA,GAA0B;AACtF,EAAA,GAAA,CAAI,SAAA,GAAY,QAAA,EAAU,GAAA,CAAI,QAAA,CAAS,QAAA,EAAU,QAAA,EAAU,mBAAmB,CAAA;AAChF,CAAC,CAAA;AAEH,WAAA,CAAY,IAAA,EAAM,mBAAA;AAClB,WAAA,CAAY,QAAA,EAAU,uBAAA;AACtB,iDAAA,WAA8B,CAAA;ADX9B;AACA;AACE;AACF,kCAAC","file":"/home/runner/work/bguard/bguard/lib/chunk-7CNZKYPM.js","sourcesContent":[null,"import { _constrain } from '../../helpers/jsonSchemaConstraint';\nimport { setToDefaultLocale } from '../../translationMap';\nimport type { ExceptionContext, RequiredValidation } from '../../core';\n\nconst maxExcludedErrorMessage = 'The received value is greater than or equal to expected';\nconst maxExcludedErrorKey = 'n:maxExcluded';\n\n/**\n * @description - Asserts that a number value is strictly less than a specified maximum value (i.e., the maximum value is excluded).\n * @param {number} expected - The maximum allowable value, which is excluded.\n * @returns {RequiredValidation} - A validation function that takes a received number and an exception context.\n * @throws {ValidationError} if the received value is greater than or equal to the expected maximum value.\n * @example\n * const schema = number().custom(maxExcluded(100));\n * parseOrFail(schema, 99); // Valid\n * parseOrFail(schema, 100); // Throws an error: 'The received value is greater than or equal to expected'\n * parseOrFail(schema, 101); // Throws an error: 'The received value is greater than or equal to expected'\n *\n * @translation Error Translation Key = 'n:maxExcluded'\n */\nexport const maxExcluded = (expected: number): RequiredValidation<number> =>\n _constrain({ exclusiveMaximum: expected }, (received: number, ctx: ExceptionContext) => {\n if (expected <= received) ctx.addIssue(expected, received, maxExcludedErrorKey);\n });\n\nmaxExcluded.key = maxExcludedErrorKey;\nmaxExcluded.message = maxExcludedErrorMessage;\nsetToDefaultLocale(maxExcluded);\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/bigint/bigintMinExcluded.ts
|
|
6
6
|
var bigintMinExcludedErrorMessage = "The received value is less than or equal to expected";
|
|
@@ -15,4 +15,4 @@ setToDefaultLocale(bigintMinExcluded);
|
|
|
15
15
|
export {
|
|
16
16
|
bigintMinExcluded
|
|
17
17
|
};
|
|
18
|
-
//# sourceMappingURL=chunk-
|
|
18
|
+
//# sourceMappingURL=chunk-7F4P72SG.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/asserts/bigint/bigintMinExcluded.ts"],"sourcesContent":["import { setToDefaultLocale } from '../../translationMap';\nimport type { ExceptionContext, RequiredValidation } from '../../core';\n\nconst bigintMinExcludedErrorMessage = 'The received value is less than or equal to expected';\nconst bigintMinExcludedErrorKey = 'bi:minExcluded';\n\n/**\n * @description Asserts that a bigint value is strictly greater than a specified minimum value (i.e., the minimum value is excluded).\n * @param {bigint} expected The minimum allowable value, which is excluded.\n * @returns {RequiredValidation} A validation function that takes a received bigint and an exception context.\n * @throws {ValidationError} if the received value is less than or equal to the expected minimum value.\n * @example\n * const schema = bigint().custom(bigintMinExcluded(10n));\n * parseOrFail(schema, 11n); // Valid\n * parseOrFail(schema, 10n); // Throws an error: 'The received value is less than or equal to expected'\n * parseOrFail(schema, 9n); // Throws an error: 'The received value is less than or equal to expected'\n *\n * @translation Error Translation Key = 'bi:minExcluded'\n */\nexport const bigintMinExcluded =\n (expected: bigint): RequiredValidation =>\n (received: bigint, ctx: ExceptionContext) => {\n if (expected >= received) ctx.addIssue(expected, received, bigintMinExcludedErrorKey);\n };\n\nbigintMinExcluded.key = bigintMinExcludedErrorKey;\nbigintMinExcluded.message = bigintMinExcludedErrorMessage;\nsetToDefaultLocale(bigintMinExcluded);\n"],"mappings":";;;;;AAGA,IAAM,gCAAgC;AACtC,IAAM,4BAA4B;AAe3B,IAAM,oBACX,CAAC,aACD,CAAC,UAAkB,QAA0B;AAC3C,MAAI,YAAY,SAAU,KAAI,SAAS,UAAU,UAAU,yBAAyB;AACtF;AAEF,kBAAkB,MAAM;AACxB,kBAAkB,UAAU;AAC5B,mBAAmB,iBAAiB;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/asserts/bigint/bigintMinExcluded.ts"],"sourcesContent":["import { setToDefaultLocale } from '../../translationMap';\nimport type { ExceptionContext, RequiredValidation } from '../../core';\n\nconst bigintMinExcludedErrorMessage = 'The received value is less than or equal to expected';\nconst bigintMinExcludedErrorKey = 'bi:minExcluded';\n\n/**\n * @description Asserts that a bigint value is strictly greater than a specified minimum value (i.e., the minimum value is excluded).\n * @param {bigint} expected The minimum allowable value, which is excluded.\n * @returns {RequiredValidation} A validation function that takes a received bigint and an exception context.\n * @throws {ValidationError} if the received value is less than or equal to the expected minimum value.\n * @example\n * const schema = bigint().custom(bigintMinExcluded(10n));\n * parseOrFail(schema, 11n); // Valid\n * parseOrFail(schema, 10n); // Throws an error: 'The received value is less than or equal to expected'\n * parseOrFail(schema, 9n); // Throws an error: 'The received value is less than or equal to expected'\n *\n * @translation Error Translation Key = 'bi:minExcluded'\n */\nexport const bigintMinExcluded =\n (expected: bigint): RequiredValidation<bigint> =>\n (received: bigint, ctx: ExceptionContext) => {\n if (expected >= received) ctx.addIssue(expected, received, bigintMinExcludedErrorKey);\n };\n\nbigintMinExcluded.key = bigintMinExcludedErrorKey;\nbigintMinExcluded.message = bigintMinExcludedErrorMessage;\nsetToDefaultLocale(bigintMinExcluded);\n"],"mappings":";;;;;AAGA,IAAM,gCAAgC;AACtC,IAAM,4BAA4B;AAe3B,IAAM,oBACX,CAAC,aACD,CAAC,UAAkB,QAA0B;AAC3C,MAAI,YAAY,SAAU,KAAI,SAAS,UAAU,UAAU,yBAAyB;AACtF;AAEF,kBAAkB,MAAM;AACxB,kBAAkB,UAAU;AAC5B,mBAAmB,iBAAiB;","names":[]}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ObjectSchema
|
|
3
|
+
} from "./chunk-KAFZGQ2W.mjs";
|
|
4
|
+
import {
|
|
5
|
+
CommonSchema
|
|
6
|
+
} from "./chunk-LDZFOOWN.mjs";
|
|
7
|
+
import {
|
|
8
|
+
ctxSymbol
|
|
9
|
+
} from "./chunk-C76DLZFD.mjs";
|
|
10
|
+
import {
|
|
11
|
+
BuildSchemaError
|
|
12
|
+
} from "./chunk-O2WD4JBG.mjs";
|
|
13
|
+
|
|
14
|
+
// src/asserts/object/pick.ts
|
|
15
|
+
function pick(schema, keys) {
|
|
16
|
+
const shape = _shapeOf(schema, "pick");
|
|
17
|
+
const picked = {};
|
|
18
|
+
for (const key of keys) {
|
|
19
|
+
if (!Object.prototype.hasOwnProperty.call(shape, key))
|
|
20
|
+
throw new BuildSchemaError(`Unknown property '${key}' in pick method`);
|
|
21
|
+
picked[key] = shape[key];
|
|
22
|
+
}
|
|
23
|
+
return _objectFrom(schema, picked);
|
|
24
|
+
}
|
|
25
|
+
function _shapeOf(schema, methodName) {
|
|
26
|
+
if (!(schema instanceof CommonSchema)) throw new BuildSchemaError(`Invalid schema in ${methodName} method`);
|
|
27
|
+
const shape = schema[ctxSymbol].object;
|
|
28
|
+
if (!shape) throw new BuildSchemaError(`Schema in ${methodName} method is not an object schema`);
|
|
29
|
+
return shape;
|
|
30
|
+
}
|
|
31
|
+
function _objectFrom(source, shape) {
|
|
32
|
+
const sourceData = source[ctxSymbol];
|
|
33
|
+
return new ObjectSchema(
|
|
34
|
+
{
|
|
35
|
+
type: [],
|
|
36
|
+
requiredValidations: [...sourceData.requiredValidations],
|
|
37
|
+
allowUnrecognizedObjectProps: sourceData.allowUnrecognizedObjectProps,
|
|
38
|
+
meta: sourceData.meta ? { ...sourceData.meta } : void 0
|
|
39
|
+
},
|
|
40
|
+
shape
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export {
|
|
45
|
+
pick,
|
|
46
|
+
_shapeOf,
|
|
47
|
+
_objectFrom
|
|
48
|
+
};
|
|
49
|
+
//# sourceMappingURL=chunk-A36G62K5.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/asserts/object/pick.ts"],"sourcesContent":["import { WithObject } from '../../commonTypes';\nimport { CommonSchema, ObjectShapeSchemaType } from '../../core';\nimport { BuildSchemaError } from '../../exceptions';\nimport { ctxSymbol } from '../../helpers/constants';\nimport { ObjectSchema } from './index';\n\n/**\n * @description Creates a new object schema keeping only the named properties.\n *\n * The original is untouched, and the properties keep the schemas they had, including their assertions\n * and metadata.\n *\n * @template T\n * @template K\n * @param {WithObject<CommonSchema, T>} schema - The object schema to narrow.\n * @param {readonly K[]} keys - The properties to keep.\n * @returns A new object schema with only those properties.\n * @example\n * const userSchema = object({ id: string(), name: string(), secret: string() });\n * const publicSchema = pick(userSchema, ['id', 'name']);\n * parseOrFail(publicSchema, { id: '1', name: 'a' }); // Validates successfully\n *\n * @instance Of CommonSchema\n */\nexport function pick<T extends ObjectShapeSchemaType, K extends keyof T & string>(\n schema: WithObject<CommonSchema, T>,\n keys: readonly K[],\n): WithObject<ObjectSchema, Pick<T, K>> {\n const shape = _shapeOf(schema, 'pick');\n const picked: ObjectShapeSchemaType = {};\n\n for (const key of keys) {\n if (!Object.prototype.hasOwnProperty.call(shape, key))\n throw new BuildSchemaError(`Unknown property '${key}' in pick method`);\n\n picked[key] = shape[key] as CommonSchema;\n }\n\n return _objectFrom(schema, picked) as unknown as WithObject<ObjectSchema, Pick<T, K>>;\n}\n\n/** Reads the shape of a schema that must be an object schema. Shared by the object utilities. */\nexport function _shapeOf(schema: CommonSchema, methodName: string): ObjectShapeSchemaType {\n if (!(schema instanceof CommonSchema)) throw new BuildSchemaError(`Invalid schema in ${methodName} method`);\n\n const shape = schema[ctxSymbol].object;\n if (!shape) throw new BuildSchemaError(`Schema in ${methodName} method is not an object schema`);\n\n return shape;\n}\n\n/** Builds a new object schema from a shape, carrying over the source's own settings. */\nexport function _objectFrom(source: CommonSchema, shape: ObjectShapeSchemaType): ObjectSchema {\n const sourceData = source[ctxSymbol];\n\n return new ObjectSchema(\n {\n type: [],\n requiredValidations: [...sourceData.requiredValidations],\n allowUnrecognizedObjectProps: sourceData.allowUnrecognizedObjectProps,\n meta: sourceData.meta ? { ...sourceData.meta } : undefined,\n },\n shape,\n );\n}\n"],"mappings":";;;;;;;;;;;;;;AAwBO,SAAS,KACd,QACA,MACsC;AACtC,QAAM,QAAQ,SAAS,QAAQ,MAAM;AACrC,QAAM,SAAgC,CAAC;AAEvC,aAAW,OAAO,MAAM;AACtB,QAAI,CAAC,OAAO,UAAU,eAAe,KAAK,OAAO,GAAG;AAClD,YAAM,IAAI,iBAAiB,qBAAqB,GAAG,kBAAkB;AAEvE,WAAO,GAAG,IAAI,MAAM,GAAG;AAAA,EACzB;AAEA,SAAO,YAAY,QAAQ,MAAM;AACnC;AAGO,SAAS,SAAS,QAAsB,YAA2C;AACxF,MAAI,EAAE,kBAAkB,cAAe,OAAM,IAAI,iBAAiB,qBAAqB,UAAU,SAAS;AAE1G,QAAM,QAAQ,OAAO,SAAS,EAAE;AAChC,MAAI,CAAC,MAAO,OAAM,IAAI,iBAAiB,aAAa,UAAU,iCAAiC;AAE/F,SAAO;AACT;AAGO,SAAS,YAAY,QAAsB,OAA4C;AAC5F,QAAM,aAAa,OAAO,SAAS;AAEnC,SAAO,IAAI;AAAA,IACT;AAAA,MACE,MAAM,CAAC;AAAA,MACP,qBAAqB,CAAC,GAAG,WAAW,mBAAmB;AAAA,MACvD,8BAA8B,WAAW;AAAA,MACzC,MAAM,WAAW,OAAO,EAAE,GAAG,WAAW,KAAK,IAAI;AAAA,IACnD;AAAA,IACA;AAAA,EACF;AACF;","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/number/negative.ts
|
|
6
9
|
var negativeErrorMessage = "The received value is not a negative number";
|
|
7
10
|
var negativeErrorKey = "n:negative";
|
|
8
|
-
var negative = () => (received, ctx) => {
|
|
11
|
+
var negative = () => _chunkWOPNDC4Rjs._constrain.call(void 0, { exclusiveMaximum: 0 }, (received, ctx) => {
|
|
9
12
|
if (received >= 0) ctx.addIssue("negative", received, negativeErrorKey);
|
|
10
|
-
};
|
|
13
|
+
});
|
|
11
14
|
negative.key = negativeErrorKey;
|
|
12
15
|
negative.message = negativeErrorMessage;
|
|
13
|
-
|
|
16
|
+
_chunkZJGY6EOEjs.setToDefaultLocale.call(void 0, negative);
|
|
14
17
|
|
|
15
18
|
|
|
16
19
|
|
|
17
20
|
exports.negative = negative;
|
|
18
|
-
//# sourceMappingURL=chunk-
|
|
21
|
+
//# sourceMappingURL=chunk-A5OEVSSV.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/bguard/bguard/lib/chunk-A5OEVSSV.js","../src/asserts/number/negative.ts"],"names":[],"mappings":"AAAA;AACE;AACF,sDAA4B;AAC5B;AACE;AACF,sDAA4B;AAC5B;AACA;ACHA,IAAM,qBAAA,EAAuB,6CAAA;AAC7B,IAAM,iBAAA,EAAmB,YAAA;AAclB,IAAM,SAAA,EAAW,CAAA,EAAA,GACtB,yCAAA,EAAa,gBAAA,EAAkB,EAAE,CAAA,EAAG,CAAC,QAAA,EAAkB,GAAA,EAAA,GAA0B;AAC/E,EAAA,GAAA,CAAI,SAAA,GAAY,CAAA,EAAG,GAAA,CAAI,QAAA,CAAS,UAAA,EAAY,QAAA,EAAU,gBAAgB,CAAA;AACxE,CAAC,CAAA;AAEH,QAAA,CAAS,IAAA,EAAM,gBAAA;AACf,QAAA,CAAS,QAAA,EAAU,oBAAA;AACnB,iDAAA,QAA2B,CAAA;ADV3B;AACA;AACE;AACF,4BAAC","file":"/home/runner/work/bguard/bguard/lib/chunk-A5OEVSSV.js","sourcesContent":[null,"import { _constrain } from '../../helpers/jsonSchemaConstraint';\nimport { setToDefaultLocale } from '../../translationMap';\nimport type { ExceptionContext, RequiredValidation } from '../../core';\n\nconst negativeErrorMessage = 'The received value is not a negative number';\nconst negativeErrorKey = 'n:negative';\n\n/**\n * @description Asserts that a number value is negative (less 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 negative.\n * @example\n * const schema = number().custom(negative());\n * parseOrFail(schema, -10); // Valid\n * parseOrFail(schema, 0); // Throws an error: 'The received value is not a negative number'\n * parseOrFail(schema, 5); // Throws an error: 'The received value is not a negative number'\n *\n * @translation - Error Translation Key = 'n:negative'\n */\nexport const negative = (): RequiredValidation<number> =>\n _constrain({ exclusiveMaximum: 0 }, (received: number, ctx: ExceptionContext) => {\n if (received >= 0) ctx.addIssue('negative', received, negativeErrorKey);\n });\n\nnegative.key = negativeErrorKey;\nnegative.message = negativeErrorMessage;\nsetToDefaultLocale(negative);\n"]}
|
|
@@ -1,13 +1,16 @@
|
|
|
1
|
+
import {
|
|
2
|
+
_constrain
|
|
3
|
+
} from "./chunk-VERUOTB3.mjs";
|
|
1
4
|
import {
|
|
2
5
|
setToDefaultLocale
|
|
3
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-65X7NTUS.mjs";
|
|
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) => _constrain({ 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
|
setToDefaultLocale(maxLength);
|
|
@@ -15,4 +18,4 @@ setToDefaultLocale(maxLength);
|
|
|
15
18
|
export {
|
|
16
19
|
maxLength
|
|
17
20
|
};
|
|
18
|
-
//# sourceMappingURL=chunk-
|
|
21
|
+
//# sourceMappingURL=chunk-ABSZMCDX.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/asserts/string/maxLength.ts"],"sourcesContent":["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"],"mappings":";;;;;;;;AAIA,IAAM,wBAAwB;AAC9B,IAAM,oBAAoB;AAcnB,IAAM,YAAY,CAAC,aACxB,WAAW,EAAE,WAAW,SAAS,GAAG,CAAC,UAAkB,QAA0B;AAC/E,MAAI,SAAS,SAAS,SAAU,KAAI,SAAS,UAAU,UAAU,iBAAiB;AACpF,CAAC;AAEH,UAAU,MAAM;AAChB,UAAU,UAAU;AACpB,mBAAmB,SAAS;","names":[]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkZJGY6EOEjs = require('./chunk-ZJGY6EOE.js');
|
|
4
4
|
|
|
5
5
|
// src/asserts/string/atLeastOneSpecialChar.ts
|
|
6
6
|
var atLeastOneSpecialCharErrorMessage = "The received value does not contain at least one special character";
|
|
@@ -15,9 +15,9 @@ var atLeastOneSpecialChar = (allowedSpecialChars) => {
|
|
|
15
15
|
};
|
|
16
16
|
atLeastOneSpecialChar.key = atLeastOneSpecialCharErrorKey;
|
|
17
17
|
atLeastOneSpecialChar.message = atLeastOneSpecialCharErrorMessage;
|
|
18
|
-
|
|
18
|
+
_chunkZJGY6EOEjs.setToDefaultLocale.call(void 0, atLeastOneSpecialChar);
|
|
19
19
|
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
exports.atLeastOneSpecialChar = atLeastOneSpecialChar;
|
|
23
|
-
//# sourceMappingURL=chunk-
|
|
23
|
+
//# sourceMappingURL=chunk-ALXDH7GS.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-ALXDH7GS.js","../src/asserts/string/atLeastOneSpecialChar.ts"],"names":[],"mappings":"AAAA;AACE;AACF,sDAA4B;AAC5B;AACA;ACDA,IAAM,kCAAA,EAAoC,oEAAA;AAC1C,IAAM,8BAAA,EAAgC,yBAAA;AAkB/B,IAAM,sBAAA,EAAwB,CAAC,mBAAA,EAAA,GAA6D;AACjG,EAAA,MAAM,kBAAA,EAAoB,IAAI,MAAA;AAAA,IAC5B,CAAA,CAAA,EAAA,kBAAK,mBAAA,UAAuB,iBAAA,CAAA,CAAiB,OAAA,CAAQ,uBAAA,EAAyB,MAAM,CAAC,CAAA,CAAA;AAAA,EACvF,CAAA;AACA,EAAA,OAAO,CAAC,QAAA,EAAkB,GAAA,EAAA,GAA0B;AAClD,IAAA,GAAA,CAAI,CAAC,iBAAA,CAAkB,IAAA,CAAK,QAAQ,CAAA,EAAG,GAAA,CAAI,QAAA,CAAS,mBAAA,EAAqB,QAAA,EAAU,6BAA6B,CAAA;AAAA,EAClH,CAAA;AACF,CAAA;AAEA,qBAAA,CAAsB,IAAA,EAAM,6BAAA;AAC5B,qBAAA,CAAsB,QAAA,EAAU,iCAAA;AAChC,iDAAA,qBAAwC,CAAA;ADfxC;AACA;AACE;AACF,sDAAC","file":"/home/runner/work/bguard/bguard/lib/chunk-ALXDH7GS.js","sourcesContent":[null,"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"]}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
var _chunkJLEQOYDWjs = require('./chunk-JLEQOYDW.js');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
var _chunk6LUSV3SSjs = require('./chunk-6LUSV3SS.js');
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
var _chunkLHEU4XACjs = require('./chunk-LHEU4XAC.js');
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
var _chunkZWFSAKQKjs = require('./chunk-ZWFSAKQK.js');
|
|
13
|
+
|
|
14
|
+
// src/asserts/object/pick.ts
|
|
15
|
+
function pick(schema, keys) {
|
|
16
|
+
const shape = _shapeOf(schema, "pick");
|
|
17
|
+
const picked = {};
|
|
18
|
+
for (const key of keys) {
|
|
19
|
+
if (!Object.prototype.hasOwnProperty.call(shape, key))
|
|
20
|
+
throw new (0, _chunkZWFSAKQKjs.BuildSchemaError)(`Unknown property '${key}' in pick method`);
|
|
21
|
+
picked[key] = shape[key];
|
|
22
|
+
}
|
|
23
|
+
return _objectFrom(schema, picked);
|
|
24
|
+
}
|
|
25
|
+
function _shapeOf(schema, methodName) {
|
|
26
|
+
if (!(schema instanceof _chunk6LUSV3SSjs.CommonSchema)) throw new (0, _chunkZWFSAKQKjs.BuildSchemaError)(`Invalid schema in ${methodName} method`);
|
|
27
|
+
const shape = schema[_chunkLHEU4XACjs.ctxSymbol].object;
|
|
28
|
+
if (!shape) throw new (0, _chunkZWFSAKQKjs.BuildSchemaError)(`Schema in ${methodName} method is not an object schema`);
|
|
29
|
+
return shape;
|
|
30
|
+
}
|
|
31
|
+
function _objectFrom(source, shape) {
|
|
32
|
+
const sourceData = source[_chunkLHEU4XACjs.ctxSymbol];
|
|
33
|
+
return new (0, _chunkJLEQOYDWjs.ObjectSchema)(
|
|
34
|
+
{
|
|
35
|
+
type: [],
|
|
36
|
+
requiredValidations: [...sourceData.requiredValidations],
|
|
37
|
+
allowUnrecognizedObjectProps: sourceData.allowUnrecognizedObjectProps,
|
|
38
|
+
meta: sourceData.meta ? { ...sourceData.meta } : void 0
|
|
39
|
+
},
|
|
40
|
+
shape
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
exports.pick = pick; exports._shapeOf = _shapeOf; exports._objectFrom = _objectFrom;
|
|
49
|
+
//# sourceMappingURL=chunk-AO6DKPJZ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/bguard/bguard/lib/chunk-AO6DKPJZ.js","../src/asserts/object/pick.ts"],"names":[],"mappings":"AAAA;AACE;AACF,sDAA4B;AAC5B;AACE;AACF,sDAA4B;AAC5B;AACE;AACF,sDAA4B;AAC5B;AACE;AACF,sDAA4B;AAC5B;AACA;ACWO,SAAS,IAAA,CACd,MAAA,EACA,IAAA,EACsC;AACtC,EAAA,MAAM,MAAA,EAAQ,QAAA,CAAS,MAAA,EAAQ,MAAM,CAAA;AACrC,EAAA,MAAM,OAAA,EAAgC,CAAC,CAAA;AAEvC,EAAA,IAAA,CAAA,MAAW,IAAA,GAAO,IAAA,EAAM;AACtB,IAAA,GAAA,CAAI,CAAC,MAAA,CAAO,SAAA,CAAU,cAAA,CAAe,IAAA,CAAK,KAAA,EAAO,GAAG,CAAA;AAClD,MAAA,MAAM,IAAI,sCAAA,CAAiB,CAAA,kBAAA,EAAqB,GAAG,CAAA,gBAAA,CAAkB,CAAA;AAEvE,IAAA,MAAA,CAAO,GAAG,EAAA,EAAI,KAAA,CAAM,GAAG,CAAA;AAAA,EACzB;AAEA,EAAA,OAAO,WAAA,CAAY,MAAA,EAAQ,MAAM,CAAA;AACnC;AAGO,SAAS,QAAA,CAAS,MAAA,EAAsB,UAAA,EAA2C;AACxF,EAAA,GAAA,CAAI,CAAA,CAAE,OAAA,WAAkB,6BAAA,CAAA,EAAe,MAAM,IAAI,sCAAA,CAAiB,CAAA,kBAAA,EAAqB,UAAU,CAAA,OAAA,CAAS,CAAA;AAE1G,EAAA,MAAM,MAAA,EAAQ,MAAA,CAAO,0BAAS,CAAA,CAAE,MAAA;AAChC,EAAA,GAAA,CAAI,CAAC,KAAA,EAAO,MAAM,IAAI,sCAAA,CAAiB,CAAA,UAAA,EAAa,UAAU,CAAA,+BAAA,CAAiC,CAAA;AAE/F,EAAA,OAAO,KAAA;AACT;AAGO,SAAS,WAAA,CAAY,MAAA,EAAsB,KAAA,EAA4C;AAC5F,EAAA,MAAM,WAAA,EAAa,MAAA,CAAO,0BAAS,CAAA;AAEnC,EAAA,OAAO,IAAI,kCAAA;AAAA,IACT;AAAA,MACE,IAAA,EAAM,CAAC,CAAA;AAAA,MACP,mBAAA,EAAqB,CAAC,GAAG,UAAA,CAAW,mBAAmB,CAAA;AAAA,MACvD,4BAAA,EAA8B,UAAA,CAAW,4BAAA;AAAA,MACzC,IAAA,EAAM,UAAA,CAAW,KAAA,EAAO,EAAE,GAAG,UAAA,CAAW,KAAK,EAAA,EAAI,KAAA;AAAA,IACnD,CAAA;AAAA,IACA;AAAA,EACF,CAAA;AACF;ADtBA;AACA;AACE;AACA;AACA;AACF,oFAAC","file":"/home/runner/work/bguard/bguard/lib/chunk-AO6DKPJZ.js","sourcesContent":[null,"import { WithObject } from '../../commonTypes';\nimport { CommonSchema, ObjectShapeSchemaType } from '../../core';\nimport { BuildSchemaError } from '../../exceptions';\nimport { ctxSymbol } from '../../helpers/constants';\nimport { ObjectSchema } from './index';\n\n/**\n * @description Creates a new object schema keeping only the named properties.\n *\n * The original is untouched, and the properties keep the schemas they had, including their assertions\n * and metadata.\n *\n * @template T\n * @template K\n * @param {WithObject<CommonSchema, T>} schema - The object schema to narrow.\n * @param {readonly K[]} keys - The properties to keep.\n * @returns A new object schema with only those properties.\n * @example\n * const userSchema = object({ id: string(), name: string(), secret: string() });\n * const publicSchema = pick(userSchema, ['id', 'name']);\n * parseOrFail(publicSchema, { id: '1', name: 'a' }); // Validates successfully\n *\n * @instance Of CommonSchema\n */\nexport function pick<T extends ObjectShapeSchemaType, K extends keyof T & string>(\n schema: WithObject<CommonSchema, T>,\n keys: readonly K[],\n): WithObject<ObjectSchema, Pick<T, K>> {\n const shape = _shapeOf(schema, 'pick');\n const picked: ObjectShapeSchemaType = {};\n\n for (const key of keys) {\n if (!Object.prototype.hasOwnProperty.call(shape, key))\n throw new BuildSchemaError(`Unknown property '${key}' in pick method`);\n\n picked[key] = shape[key] as CommonSchema;\n }\n\n return _objectFrom(schema, picked) as unknown as WithObject<ObjectSchema, Pick<T, K>>;\n}\n\n/** Reads the shape of a schema that must be an object schema. Shared by the object utilities. */\nexport function _shapeOf(schema: CommonSchema, methodName: string): ObjectShapeSchemaType {\n if (!(schema instanceof CommonSchema)) throw new BuildSchemaError(`Invalid schema in ${methodName} method`);\n\n const shape = schema[ctxSymbol].object;\n if (!shape) throw new BuildSchemaError(`Schema in ${methodName} method is not an object schema`);\n\n return shape;\n}\n\n/** Builds a new object schema from a shape, carrying over the source's own settings. */\nexport function _objectFrom(source: CommonSchema, shape: ObjectShapeSchemaType): ObjectSchema {\n const sourceData = source[ctxSymbol];\n\n return new ObjectSchema(\n {\n type: [],\n requiredValidations: [...sourceData.requiredValidations],\n allowUnrecognizedObjectProps: sourceData.allowUnrecognizedObjectProps,\n meta: sourceData.meta ? { ...sourceData.meta } : undefined,\n },\n shape,\n );\n}\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/upperCase.ts
|
|
6
6
|
var upperCaseErrorMessage = "The received value is not in uppercase";
|
|
@@ -17,4 +17,4 @@ setToDefaultLocale(upperCase);
|
|
|
17
17
|
export {
|
|
18
18
|
upperCase
|
|
19
19
|
};
|
|
20
|
-
//# sourceMappingURL=chunk-
|
|
20
|
+
//# sourceMappingURL=chunk-AYJCGPXI.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/asserts/string/upperCase.ts"],"sourcesContent":["import type { ExceptionContext, RequiredValidation } from '../../core';\nimport { setToDefaultLocale } from '../../translationMap';\n\nconst upperCaseErrorMessage = 'The received value is not in uppercase';\nconst upperCaseErrorKey = 's:upperCase';\n\n/**\n * @description Asserts that a string value is entirely in uppercase.\n * @returns {RequiredValidation} A validation function that takes a received string and an exception context.\n * @throws {ValidationError} if the received value is not in uppercase.\n * @example\n * const schema = string().custom(upperCase());\n * parseOrFail(schema, 'VALID'); // Valid\n * parseOrFail(schema, 'INVALID'); // Throws an error: 'The received value is not in uppercase'\n * parseOrFail(schema, 'Valid'); // Throws an error: 'The received value is not in uppercase'\n *\n * @translation Error Translation Key = 's:upperCase'\n */\nexport const upperCase = (): RequiredValidation => (received: string, ctx: ExceptionContext) => {\n if (received !== received.toUpperCase()) {\n ctx.addIssue('upper case', received, upperCaseErrorKey);\n }\n};\n\nupperCase.key = upperCaseErrorKey;\nupperCase.message = upperCaseErrorMessage;\nsetToDefaultLocale(upperCase);\n"],"mappings":";;;;;AAGA,IAAM,wBAAwB;AAC9B,IAAM,oBAAoB;AAcnB,IAAM,YAAY,
|
|
1
|
+
{"version":3,"sources":["../src/asserts/string/upperCase.ts"],"sourcesContent":["import type { ExceptionContext, RequiredValidation } from '../../core';\nimport { setToDefaultLocale } from '../../translationMap';\n\nconst upperCaseErrorMessage = 'The received value is not in uppercase';\nconst upperCaseErrorKey = 's:upperCase';\n\n/**\n * @description Asserts that a string value is entirely in uppercase.\n * @returns {RequiredValidation} A validation function that takes a received string and an exception context.\n * @throws {ValidationError} if the received value is not in uppercase.\n * @example\n * const schema = string().custom(upperCase());\n * parseOrFail(schema, 'VALID'); // Valid\n * parseOrFail(schema, 'INVALID'); // Throws an error: 'The received value is not in uppercase'\n * parseOrFail(schema, 'Valid'); // Throws an error: 'The received value is not in uppercase'\n *\n * @translation Error Translation Key = 's:upperCase'\n */\nexport const upperCase = (): RequiredValidation<string> => (received: string, ctx: ExceptionContext) => {\n if (received !== received.toUpperCase()) {\n ctx.addIssue('upper case', received, upperCaseErrorKey);\n }\n};\n\nupperCase.key = upperCaseErrorKey;\nupperCase.message = upperCaseErrorMessage;\nsetToDefaultLocale(upperCase);\n"],"mappings":";;;;;AAGA,IAAM,wBAAwB;AAC9B,IAAM,oBAAoB;AAcnB,IAAM,YAAY,MAAkC,CAAC,UAAkB,QAA0B;AACtG,MAAI,aAAa,SAAS,YAAY,GAAG;AACvC,QAAI,SAAS,cAAc,UAAU,iBAAiB;AAAA,EACxD;AACF;AAEA,UAAU,MAAM;AAChB,UAAU,UAAU;AACpB,mBAAmB,SAAS;","names":[]}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
+
import {
|
|
2
|
+
setToDefaultLocale
|
|
3
|
+
} from "./chunk-65X7NTUS.mjs";
|
|
1
4
|
import {
|
|
2
5
|
isValidDateInner
|
|
3
6
|
} from "./chunk-YBVMP4EI.mjs";
|
|
4
|
-
import {
|
|
5
|
-
setToDefaultLocale
|
|
6
|
-
} from "./chunk-OE3L7EKN.mjs";
|
|
7
7
|
import {
|
|
8
8
|
BuildSchemaError
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-O2WD4JBG.mjs";
|
|
10
10
|
|
|
11
11
|
// src/asserts/date/dateMax.ts
|
|
12
12
|
var dateMaxErrorMessage = "The received value is greater than expected";
|
|
@@ -25,4 +25,4 @@ setToDefaultLocale(dateMax);
|
|
|
25
25
|
export {
|
|
26
26
|
dateMax
|
|
27
27
|
};
|
|
28
|
-
//# sourceMappingURL=chunk-
|
|
28
|
+
//# sourceMappingURL=chunk-AYSJLD4S.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/asserts/date/dateMax.ts"],"sourcesContent":["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 => {\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"],"mappings":";;;;;;;;;;;AAKA,IAAM,sBAAsB;AAC5B,IAAM,kBAAkB;AAcjB,IAAM,UAAU,CAAC,
|
|
1
|
+
{"version":3,"sources":["../src/asserts/date/dateMax.ts"],"sourcesContent":["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"],"mappings":";;;;;;;;;;;AAKA,IAAM,sBAAsB;AAC5B,IAAM,kBAAkB;AAcjB,IAAM,UAAU,CAAC,aAAsD;AAC5E,QAAM,sBAAsB,OAAO,aAAa,WAAW,IAAI,KAAK,QAAQ,IAAI;AAChF,MAAI,CAAC,iBAAiB,mBAAmB,EAAG,OAAM,IAAI,iBAAiB,gCAAgC;AACvG,SAAO,CAAC,UAAgB,QAA0B;AAChD,QAAI,sBAAsB,SAAU,KAAI,SAAS,qBAAqB,UAAU,eAAe;AAAA,EACjG;AACF;AAEA,QAAQ,MAAM;AACd,QAAQ,UAAU;AAClB,mBAAmB,OAAO;","names":[]}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CommonSchema
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import {
|
|
5
|
-
BuildSchemaError
|
|
6
|
-
} from "./chunk-ZTCXXAKD.mjs";
|
|
3
|
+
} from "./chunk-LDZFOOWN.mjs";
|
|
7
4
|
import {
|
|
8
5
|
ctxSymbol
|
|
9
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-C76DLZFD.mjs";
|
|
7
|
+
import {
|
|
8
|
+
BuildSchemaError
|
|
9
|
+
} from "./chunk-O2WD4JBG.mjs";
|
|
10
10
|
|
|
11
11
|
// src/asserts/array/index.ts
|
|
12
12
|
function array(arraySchema) {
|
|
@@ -28,4 +28,4 @@ var ArraySchema = class extends CommonSchema {
|
|
|
28
28
|
export {
|
|
29
29
|
array
|
|
30
30
|
};
|
|
31
|
-
//# sourceMappingURL=chunk-
|
|
31
|
+
//# sourceMappingURL=chunk-B2R5S6OH.mjs.map
|
|
@@ -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/lazy/index.ts
|
|
9
|
+
function lazy(typeName, getSchema) {
|
|
10
|
+
if (!typeName) throw new BuildSchemaError("Missing type name in lazy method");
|
|
11
|
+
if (typeof getSchema !== "function") throw new BuildSchemaError("Missing schema getter in lazy method");
|
|
12
|
+
return new CommonSchema({
|
|
13
|
+
type: [],
|
|
14
|
+
requiredValidations: [],
|
|
15
|
+
lazy: { typeName, getSchema }
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export {
|
|
20
|
+
lazy
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=chunk-B3IWQRZF.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/asserts/lazy/index.ts"],"sourcesContent":["import { WithBGuardType } from '../../commonTypes';\nimport { CommonSchema } from '../../core';\nimport { BuildSchemaError } from '../../exceptions';\n\n/**\n * @description Defers building a schema until it is first used, which is what allows a schema to\n * refer to itself.\n *\n * The inferred type is the one you supply, because TypeScript cannot infer a type through a\n * self-reference. Declare the type, then annotate the schema with it:\n *\n * ```typescript\n * interface Category {\n * name: string;\n * children: Category[];\n * }\n *\n * const categorySchema: WithObject<CommonSchema, { name: CommonSchema; children: CommonSchema }> =\n * object({\n * name: string(),\n * children: array(lazy<Category>('Category', () => categorySchema)),\n * });\n * ```\n *\n * `typeName` is what `codeGen` emits at the recursion point. Without it code generation would\n * descend into the schema again and never finish, so it is required rather than optional.\n *\n * Note that validation follows the data, so a value containing a cycle recurses until the call stack\n * is exhausted. Recursive *schemas* are supported; cyclic *values* are not.\n *\n * @template Out - The type this schema validates. Supply it explicitly.\n * @param {string} typeName - The type name codeGen emits where the recursion occurs.\n * @param {() => CommonSchema} getSchema - Returns the schema, called once on first use.\n * @returns A new schema inferring `Out`.\n *\n * @instance Of CommonSchema\n */\nexport function lazy<Out>(typeName: string, getSchema: () => CommonSchema): WithBGuardType<CommonSchema, Out> {\n if (!typeName) throw new BuildSchemaError('Missing type name in lazy method');\n if (typeof getSchema !== 'function') throw new BuildSchemaError('Missing schema getter in lazy method');\n\n return new CommonSchema({\n type: [],\n requiredValidations: [],\n lazy: { typeName, getSchema },\n }) as WithBGuardType<CommonSchema, Out>;\n}\n"],"mappings":";;;;;;;;AAqCO,SAAS,KAAU,UAAkB,WAAkE;AAC5G,MAAI,CAAC,SAAU,OAAM,IAAI,iBAAiB,kCAAkC;AAC5E,MAAI,OAAO,cAAc,WAAY,OAAM,IAAI,iBAAiB,sCAAsC;AAEtG,SAAO,IAAI,aAAa;AAAA,IACtB,MAAM,CAAC;AAAA,IACP,qBAAqB,CAAC;AAAA,IACtB,MAAM,EAAE,UAAU,UAAU;AAAA,EAC9B,CAAC;AACH;","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/endsWith.ts
|
|
6
6
|
var endsWithErrorMessage = "The received value does not end with the required substring";
|
|
@@ -12,9 +12,9 @@ var endsWith = (substring) => (received, ctx) => {
|
|
|
12
12
|
};
|
|
13
13
|
endsWith.key = endsWithErrorKey;
|
|
14
14
|
endsWith.message = endsWithErrorMessage;
|
|
15
|
-
|
|
15
|
+
_chunkZJGY6EOEjs.setToDefaultLocale.call(void 0, endsWith);
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
exports.endsWith = endsWith;
|
|
20
|
-
//# sourceMappingURL=chunk-
|
|
20
|
+
//# sourceMappingURL=chunk-B4WB3UB7.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-B4WB3UB7.js","../src/asserts/string/endsWith.ts"],"names":[],"mappings":"AAAA;AACE;AACF,sDAA4B;AAC5B;AACA;ACDA,IAAM,qBAAA,EAAuB,6DAAA;AAC7B,IAAM,iBAAA,EAAmB,YAAA;AAclB,IAAM,SAAA,EACX,CAAC,SAAA,EAAA,GACD,CAAC,QAAA,EAAkB,GAAA,EAAA,GAA0B;AAC3C,EAAA,GAAA,CAAI,CAAC,QAAA,CAAS,QAAA,CAAS,SAAS,CAAA,EAAG;AACjC,IAAA,GAAA,CAAI,QAAA,CAAS,CAAA,WAAA,EAAc,SAAS,CAAA,CAAA,CAAA,EAAK,QAAA,EAAU,gBAAgB,CAAA;AAAA,EACrE;AACF,CAAA;AAEF,QAAA,CAAS,IAAA,EAAM,gBAAA;AACf,QAAA,CAAS,QAAA,EAAU,oBAAA;AACnB,iDAAA,QAA2B,CAAA;ADb3B;AACA;AACE;AACF,4BAAC","file":"/home/runner/work/bguard/bguard/lib/chunk-B4WB3UB7.js","sourcesContent":[null,"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"]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import {
|
|
2
|
+
_objectFrom,
|
|
3
|
+
_shapeOf
|
|
4
|
+
} from "./chunk-A36G62K5.mjs";
|
|
5
|
+
|
|
6
|
+
// src/asserts/object/partial.ts
|
|
7
|
+
function partial(schema) {
|
|
8
|
+
const shape = _shapeOf(schema, "partial");
|
|
9
|
+
const relaxed = {};
|
|
10
|
+
for (const [key, valueSchema] of Object.entries(shape)) {
|
|
11
|
+
relaxed[key] = valueSchema.optional();
|
|
12
|
+
}
|
|
13
|
+
return _objectFrom(schema, relaxed);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export {
|
|
17
|
+
partial
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=chunk-BZ6R6RWE.mjs.map
|