bguard 0.1.1 → 0.3.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 +561 -175
- package/lib/{CommonSchema-CjsYE4dC.d.mts → CommonSchema-CiY7spmg.d.mts} +12 -3
- package/lib/{CommonSchema-BbGNki0L.d.ts → CommonSchema-D9QVJBJe.d.ts} +12 -3
- package/lib/InferType.d.mts +5 -2
- package/lib/InferType.d.ts +5 -2
- package/lib/asserts/array/index.d.mts +4 -4
- package/lib/asserts/array/index.d.ts +4 -4
- package/lib/asserts/array/index.js +13 -6
- package/lib/asserts/array/index.js.map +1 -1
- package/lib/asserts/array/index.mjs +13 -6
- package/lib/asserts/array/index.mjs.map +1 -1
- package/lib/asserts/array/maxArrayLength.d.mts +22 -0
- package/lib/asserts/array/maxArrayLength.d.ts +22 -0
- package/lib/asserts/array/maxArrayLength.js +20 -0
- package/lib/asserts/array/maxArrayLength.js.map +1 -0
- package/lib/asserts/array/maxArrayLength.mjs +20 -0
- package/lib/asserts/array/maxArrayLength.mjs.map +1 -0
- package/lib/asserts/array/minArrayLength.d.mts +22 -0
- package/lib/asserts/array/minArrayLength.d.ts +22 -0
- package/lib/asserts/array/minArrayLength.js +20 -0
- package/lib/asserts/array/minArrayLength.js.map +1 -0
- package/lib/asserts/array/minArrayLength.mjs +20 -0
- package/lib/asserts/array/minArrayLength.mjs.map +1 -0
- package/lib/asserts/bigint/bigintMax.d.mts +22 -0
- package/lib/asserts/bigint/bigintMax.d.ts +22 -0
- package/lib/asserts/bigint/bigintMax.js +20 -0
- package/lib/asserts/bigint/bigintMax.js.map +1 -0
- package/lib/asserts/bigint/bigintMax.mjs +20 -0
- package/lib/asserts/bigint/bigintMax.mjs.map +1 -0
- package/lib/asserts/bigint/bigintMaxExcluded.d.mts +22 -0
- package/lib/asserts/bigint/bigintMaxExcluded.d.ts +22 -0
- package/lib/asserts/bigint/bigintMaxExcluded.js +20 -0
- package/lib/asserts/bigint/bigintMaxExcluded.js.map +1 -0
- package/lib/asserts/bigint/bigintMaxExcluded.mjs +20 -0
- package/lib/asserts/bigint/bigintMaxExcluded.mjs.map +1 -0
- package/lib/asserts/bigint/bigintMin.d.mts +22 -0
- package/lib/asserts/bigint/bigintMin.d.ts +22 -0
- package/lib/asserts/bigint/bigintMin.js +20 -0
- package/lib/asserts/bigint/bigintMin.js.map +1 -0
- package/lib/asserts/bigint/bigintMin.mjs +20 -0
- package/lib/asserts/bigint/bigintMin.mjs.map +1 -0
- package/lib/asserts/bigint/bigintMinExcluded.d.mts +22 -0
- package/lib/asserts/bigint/bigintMinExcluded.d.ts +22 -0
- package/lib/asserts/bigint/bigintMinExcluded.js +20 -0
- package/lib/asserts/bigint/bigintMinExcluded.js.map +1 -0
- package/lib/asserts/bigint/bigintMinExcluded.mjs +20 -0
- package/lib/asserts/bigint/bigintMinExcluded.mjs.map +1 -0
- package/lib/asserts/bigint/index.d.mts +18 -0
- package/lib/asserts/bigint/index.d.ts +18 -0
- package/lib/asserts/bigint/index.js +22 -0
- package/lib/asserts/bigint/index.js.map +1 -0
- package/lib/asserts/bigint/index.mjs +22 -0
- package/lib/asserts/bigint/index.mjs.map +1 -0
- package/lib/asserts/boolean/index.d.mts +4 -4
- package/lib/asserts/boolean/index.d.ts +4 -4
- package/lib/asserts/boolean/index.js +14 -7
- package/lib/asserts/boolean/index.js.map +1 -1
- package/lib/asserts/boolean/index.mjs +14 -7
- package/lib/asserts/boolean/index.mjs.map +1 -1
- package/lib/asserts/date/dateMax.d.mts +22 -0
- package/lib/asserts/date/dateMax.d.ts +22 -0
- package/lib/asserts/date/dateMax.js +28 -0
- package/lib/asserts/date/dateMax.js.map +1 -0
- package/lib/asserts/date/dateMax.mjs +28 -0
- package/lib/asserts/date/dateMax.mjs.map +1 -0
- package/lib/asserts/date/dateMin.d.mts +22 -0
- package/lib/asserts/date/dateMin.d.ts +22 -0
- package/lib/asserts/date/dateMin.js +28 -0
- package/lib/asserts/date/dateMin.js.map +1 -0
- package/lib/asserts/date/dateMin.mjs +28 -0
- package/lib/asserts/date/dateMin.mjs.map +1 -0
- package/lib/asserts/date/index.d.mts +17 -0
- package/lib/asserts/date/index.d.ts +17 -0
- package/lib/asserts/date/index.js +18 -0
- package/lib/asserts/date/index.js.map +1 -0
- package/lib/asserts/date/index.mjs +18 -0
- package/lib/asserts/date/index.mjs.map +1 -0
- package/lib/asserts/mix/equalTo.d.mts +1 -1
- package/lib/asserts/mix/equalTo.d.ts +1 -1
- package/lib/asserts/mix/equalTo.js +4 -4
- package/lib/asserts/mix/equalTo.mjs +3 -3
- package/lib/asserts/mix/index.d.mts +4 -3
- package/lib/asserts/mix/index.d.ts +4 -3
- package/lib/asserts/mix/index.js +12 -5
- package/lib/asserts/mix/index.js.map +1 -1
- package/lib/asserts/mix/index.mjs +12 -5
- package/lib/asserts/mix/index.mjs.map +1 -1
- package/lib/asserts/mix/oneOfValues.d.mts +1 -1
- package/lib/asserts/mix/oneOfValues.d.ts +1 -1
- package/lib/asserts/mix/oneOfValues.js +4 -4
- package/lib/asserts/mix/oneOfValues.mjs +3 -3
- package/lib/asserts/number/index.d.mts +4 -4
- package/lib/asserts/number/index.d.ts +4 -4
- package/lib/asserts/number/index.js +16 -10
- package/lib/asserts/number/index.js.map +1 -1
- package/lib/asserts/number/index.mjs +16 -10
- package/lib/asserts/number/index.mjs.map +1 -1
- package/lib/asserts/number/max.js +4 -4
- package/lib/asserts/number/max.mjs +2 -2
- package/lib/asserts/number/maxExcluded.js +4 -4
- package/lib/asserts/number/maxExcluded.mjs +2 -2
- package/lib/asserts/number/min.js +4 -4
- package/lib/asserts/number/min.mjs +2 -2
- package/lib/asserts/number/minExcluded.js +4 -4
- package/lib/asserts/number/minExcluded.mjs +2 -2
- package/lib/asserts/number/negative.js +4 -4
- package/lib/asserts/number/negative.mjs +2 -2
- package/lib/asserts/number/positive.js +4 -4
- package/lib/asserts/number/positive.mjs +2 -2
- package/lib/asserts/object/index.d.mts +4 -4
- package/lib/asserts/object/index.d.ts +4 -4
- package/lib/asserts/object/index.js +13 -6
- package/lib/asserts/object/index.js.map +1 -1
- package/lib/asserts/object/index.mjs +13 -6
- package/lib/asserts/object/index.mjs.map +1 -1
- package/lib/asserts/string/atLeastOneDigit.js +4 -4
- package/lib/asserts/string/atLeastOneDigit.mjs +2 -2
- package/lib/asserts/string/atLeastOneLowerChar.js +4 -4
- package/lib/asserts/string/atLeastOneLowerChar.mjs +2 -2
- package/lib/asserts/string/atLeastOneSpecialChar.js +4 -4
- package/lib/asserts/string/atLeastOneSpecialChar.mjs +2 -2
- package/lib/asserts/string/atLeastOneUpperChar.js +4 -4
- package/lib/asserts/string/atLeastOneUpperChar.mjs +2 -2
- package/lib/asserts/string/contains.js +4 -4
- package/lib/asserts/string/contains.mjs +2 -2
- package/lib/asserts/string/email.js +4 -4
- package/lib/asserts/string/email.mjs +2 -2
- package/lib/asserts/string/endsWith.js +4 -4
- package/lib/asserts/string/endsWith.mjs +2 -2
- package/lib/asserts/string/index.d.mts +4 -4
- package/lib/asserts/string/index.d.ts +4 -4
- package/lib/asserts/string/index.js +16 -10
- package/lib/asserts/string/index.js.map +1 -1
- package/lib/asserts/string/index.mjs +16 -10
- package/lib/asserts/string/index.mjs.map +1 -1
- package/lib/asserts/string/isValidDate.d.mts +21 -0
- package/lib/asserts/string/isValidDate.d.ts +21 -0
- package/lib/asserts/string/isValidDate.js +25 -0
- package/lib/asserts/string/isValidDate.js.map +1 -0
- package/lib/asserts/string/isValidDate.mjs +25 -0
- package/lib/asserts/string/isValidDate.mjs.map +1 -0
- package/lib/asserts/string/isValidDateTime.d.mts +35 -0
- package/lib/asserts/string/isValidDateTime.d.ts +35 -0
- package/lib/asserts/string/isValidDateTime.js +32 -0
- package/lib/asserts/string/isValidDateTime.js.map +1 -0
- package/lib/asserts/string/isValidDateTime.mjs +32 -0
- package/lib/asserts/string/isValidDateTime.mjs.map +1 -0
- package/lib/asserts/string/isValidTime.d.mts +29 -0
- package/lib/asserts/string/isValidTime.d.ts +29 -0
- package/lib/asserts/string/isValidTime.js +32 -0
- package/lib/asserts/string/isValidTime.js.map +1 -0
- package/lib/asserts/string/isValidTime.mjs +32 -0
- package/lib/asserts/string/isValidTime.mjs.map +1 -0
- package/lib/asserts/string/lowerCase.js +4 -4
- package/lib/asserts/string/lowerCase.mjs +2 -2
- package/lib/asserts/string/maxLength.js +4 -4
- package/lib/asserts/string/maxLength.mjs +2 -2
- package/lib/asserts/string/minLength.js +4 -4
- package/lib/asserts/string/minLength.mjs +2 -2
- package/lib/asserts/string/regExp.js +4 -4
- package/lib/asserts/string/regExp.mjs +2 -2
- package/lib/asserts/string/startsWith.js +4 -4
- package/lib/asserts/string/startsWith.mjs +2 -2
- package/lib/asserts/string/upperCase.js +4 -4
- package/lib/asserts/string/upperCase.mjs +2 -2
- package/lib/asserts/string/uuid.js +4 -4
- package/lib/asserts/string/uuid.mjs +2 -2
- package/lib/asserts/string/uuidV1.js +4 -4
- package/lib/asserts/string/uuidV1.mjs +2 -2
- package/lib/asserts/string/uuidV2.js +4 -4
- package/lib/asserts/string/uuidV2.mjs +2 -2
- package/lib/asserts/string/uuidV3.js +4 -4
- package/lib/asserts/string/uuidV3.mjs +2 -2
- package/lib/asserts/string/uuidV4.js +4 -4
- package/lib/asserts/string/uuidV4.mjs +2 -2
- package/lib/asserts/string/uuidV5.js +4 -4
- package/lib/asserts/string/uuidV5.mjs +2 -2
- package/lib/asserts/string/validUrl.js +4 -4
- package/lib/asserts/string/validUrl.mjs +2 -2
- package/lib/{chunk-LEQCDD66.js → chunk-2D5QE7F4.js} +17 -15
- package/lib/chunk-2D5QE7F4.js.map +1 -0
- package/lib/chunk-2MFBOVP2.mjs +20 -0
- package/lib/chunk-2MFBOVP2.mjs.map +1 -0
- package/lib/chunk-3IOQH3K4.js +74 -0
- package/lib/chunk-3IOQH3K4.js.map +1 -0
- package/lib/chunk-3ZPLJ5KC.js +14 -0
- package/lib/{chunk-JSGZ7DKT.js.map → chunk-3ZPLJ5KC.js.map} +1 -1
- package/lib/{chunk-3HTYHE2X.mjs → chunk-4GDBM5LP.mjs} +4 -3
- package/lib/chunk-4GDBM5LP.mjs.map +1 -0
- package/lib/{chunk-TCQY2R3U.mjs → chunk-5HT3PYSG.mjs} +4 -4
- package/lib/chunk-5HT3PYSG.mjs.map +1 -0
- package/lib/{chunk-PH2PMUZP.mjs → chunk-5LLJ22IG.mjs} +28 -14
- package/lib/chunk-5LLJ22IG.mjs.map +1 -0
- package/lib/{chunk-PG2R7P7G.mjs → chunk-ADSMWGDJ.mjs} +4 -4
- package/lib/{chunk-H7CPKW53.js → chunk-AN3VHQEQ.js} +7 -7
- package/lib/{chunk-H7CPKW53.js.map → chunk-AN3VHQEQ.js.map} +1 -1
- package/lib/chunk-AOUFWACR.mjs +74 -0
- package/lib/chunk-AOUFWACR.mjs.map +1 -0
- package/lib/{chunk-WK4O3HH4.js → chunk-AY7HKAG2.js} +2 -3
- package/lib/chunk-AY7HKAG2.js.map +1 -0
- package/lib/{chunk-NNFYXHLU.mjs → chunk-BUXOCPHI.mjs} +3 -3
- package/lib/chunk-BUXOCPHI.mjs.map +1 -0
- package/lib/{chunk-RYVUYVEE.mjs → chunk-D42ISCFK.mjs} +2 -2
- package/lib/{chunk-KQKJASVB.js → chunk-EU3ZZF7Y.js} +13 -13
- package/lib/chunk-EU3ZZF7Y.js.map +1 -0
- package/lib/{chunk-NDQM5OL4.mjs → chunk-KBZUNXJB.mjs} +4 -4
- package/lib/chunk-KBZUNXJB.mjs.map +1 -0
- package/lib/chunk-LYNVPN3R.js +28 -0
- package/lib/chunk-LYNVPN3R.js.map +1 -0
- package/lib/{chunk-7XFLH6R2.mjs → chunk-NP64RC7B.mjs} +2 -3
- package/lib/chunk-NP64RC7B.mjs.map +1 -0
- package/lib/{chunk-3O4WCRC2.mjs → chunk-OHEMRF7Y.mjs} +3 -3
- package/lib/chunk-OHEMRF7Y.mjs.map +1 -0
- package/lib/chunk-OJSTQQ3N.js +20 -0
- package/lib/chunk-OJSTQQ3N.js.map +1 -0
- package/lib/{chunk-YUESB2WV.mjs → chunk-OKF3BVUD.mjs} +4 -4
- package/lib/{chunk-6TH3DBDK.js → chunk-OO6BTBVP.js} +11 -11
- package/lib/chunk-OO6BTBVP.js.map +1 -0
- package/lib/chunk-P6V6S6TZ.js +65 -0
- package/lib/chunk-P6V6S6TZ.js.map +1 -0
- package/lib/{chunk-DJSLA2ZV.js → chunk-PESVL5YJ.js} +7 -7
- package/lib/{chunk-DJSLA2ZV.js.map → chunk-PESVL5YJ.js.map} +1 -1
- package/lib/{chunk-IRG4OQAB.js → chunk-PIBDJJUU.js} +35 -21
- package/lib/chunk-PIBDJJUU.js.map +1 -0
- package/lib/{chunk-J4VKFJQK.js → chunk-SPWF5IFU.js} +5 -5
- package/lib/chunk-SPWF5IFU.js.map +1 -0
- package/lib/{chunk-P7IXNCJG.mjs → chunk-TQWUSDQD.mjs} +6 -6
- package/lib/chunk-TQWUSDQD.mjs.map +1 -0
- package/lib/{chunk-5BVJ6YMH.js → chunk-UZ2PWO4O.js} +6 -5
- package/lib/chunk-UZ2PWO4O.js.map +1 -0
- package/lib/chunk-VBTWYDEM.js +12 -0
- package/lib/chunk-VBTWYDEM.js.map +1 -0
- package/lib/{chunk-4CYIMDP2.js → chunk-W2GOLG3K.js} +5 -5
- package/lib/chunk-W2GOLG3K.js.map +1 -0
- package/lib/chunk-YBVMP4EI.mjs +12 -0
- package/lib/chunk-YBVMP4EI.mjs.map +1 -0
- package/lib/{chunk-CCBCDJXS.mjs → chunk-YPAFWVDL.mjs} +4 -4
- package/lib/chunk-YPAFWVDL.mjs.map +1 -0
- package/lib/chunk-ZMEQCIRN.mjs +65 -0
- package/lib/chunk-ZMEQCIRN.mjs.map +1 -0
- package/lib/{chunk-WBERBAL4.js → chunk-ZVW3IHBW.js} +8 -8
- package/lib/chunk-ZVW3IHBW.js.map +1 -0
- package/lib/{chunk-JPRCULRQ.mjs → chunk-ZWE5Q37U.mjs} +12 -10
- package/lib/chunk-ZWE5Q37U.mjs.map +1 -0
- package/lib/codeGen.d.mts +1 -1
- package/lib/codeGen.d.ts +1 -1
- package/lib/codeGen.js +5 -3
- package/lib/codeGen.js.map +1 -1
- package/lib/codeGen.mjs +4 -2
- package/lib/codeGen.mjs.map +1 -1
- package/lib/commonTypes.d.mts +1 -0
- package/lib/commonTypes.d.ts +1 -0
- package/lib/exceptions.js +2 -2
- package/lib/exceptions.mjs +1 -1
- package/lib/helpers/core.d.mts +1 -1
- package/lib/helpers/core.d.ts +1 -1
- package/lib/helpers/core.js +4 -3
- package/lib/helpers/core.js.map +1 -1
- package/lib/helpers/core.mjs +3 -2
- package/lib/helpers/isValidDateInner.d.mts +3 -0
- package/lib/helpers/isValidDateInner.d.ts +3 -0
- package/lib/helpers/isValidDateInner.js +7 -0
- package/lib/helpers/isValidDateInner.js.map +1 -0
- package/lib/helpers/isValidDateInner.mjs +7 -0
- package/lib/helpers/isValidDateInner.mjs.map +1 -0
- package/lib/helpers/setStrictType.d.mts +1 -1
- package/lib/helpers/setStrictType.d.ts +1 -1
- package/lib/helpers/setStrictType.js +5 -4
- package/lib/helpers/setStrictType.js.map +1 -1
- package/lib/helpers/setStrictType.mjs +4 -3
- package/lib/index.d.mts +3 -7
- package/lib/index.d.ts +3 -7
- package/lib/index.js +7 -40
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +7 -40
- package/lib/parse.d.mts +3 -1
- package/lib/parse.d.ts +3 -1
- package/lib/parse.js +6 -5
- package/lib/parse.js.map +1 -1
- package/lib/parse.mjs +5 -4
- package/lib/parseOrFail.d.mts +3 -1
- package/lib/parseOrFail.d.ts +3 -1
- package/lib/parseOrFail.js +6 -5
- package/lib/parseOrFail.js.map +1 -1
- package/lib/parseOrFail.mjs +5 -4
- package/lib/schemas/ArraySchema.d.mts +2 -2
- package/lib/schemas/ArraySchema.d.ts +2 -2
- package/lib/schemas/ArraySchema.js +8 -5
- package/lib/schemas/ArraySchema.js.map +1 -1
- package/lib/schemas/ArraySchema.mjs +7 -4
- package/lib/schemas/BigIntSchema.d.mts +33 -0
- package/lib/schemas/BigIntSchema.d.ts +33 -0
- package/lib/schemas/BigIntSchema.js +17 -0
- package/lib/schemas/BigIntSchema.js.map +1 -0
- package/lib/schemas/BigIntSchema.mjs +17 -0
- package/lib/schemas/BigIntSchema.mjs.map +1 -0
- package/lib/schemas/BooleanSchema.d.mts +2 -2
- package/lib/schemas/BooleanSchema.d.ts +2 -2
- package/lib/schemas/BooleanSchema.js +9 -6
- package/lib/schemas/BooleanSchema.js.map +1 -1
- package/lib/schemas/BooleanSchema.mjs +8 -5
- package/lib/schemas/CommonSchema.d.mts +1 -1
- package/lib/schemas/CommonSchema.d.ts +1 -1
- package/lib/schemas/CommonSchema.js +7 -4
- package/lib/schemas/CommonSchema.js.map +1 -1
- package/lib/schemas/CommonSchema.mjs +6 -3
- package/lib/schemas/DateSchema.d.mts +9 -0
- package/lib/schemas/DateSchema.d.ts +9 -0
- package/lib/schemas/DateSchema.js +13 -0
- package/lib/schemas/DateSchema.js.map +1 -0
- package/lib/schemas/DateSchema.mjs +13 -0
- package/lib/schemas/DateSchema.mjs.map +1 -0
- package/lib/schemas/NumberSchema.d.mts +2 -2
- package/lib/schemas/NumberSchema.d.ts +2 -2
- package/lib/schemas/NumberSchema.js +11 -9
- package/lib/schemas/NumberSchema.js.map +1 -1
- package/lib/schemas/NumberSchema.mjs +10 -8
- package/lib/schemas/ObjectSchema.d.mts +2 -2
- package/lib/schemas/ObjectSchema.d.ts +2 -2
- package/lib/schemas/ObjectSchema.js +8 -5
- package/lib/schemas/ObjectSchema.js.map +1 -1
- package/lib/schemas/ObjectSchema.mjs +7 -4
- package/lib/schemas/StringSchema.d.mts +3 -2
- package/lib/schemas/StringSchema.d.ts +3 -2
- package/lib/schemas/StringSchema.js +11 -9
- package/lib/schemas/StringSchema.js.map +1 -1
- package/lib/schemas/StringSchema.mjs +10 -8
- package/lib/translationMap.js +3 -3
- package/lib/translationMap.mjs +2 -2
- package/package.json +6 -1
- package/lib/chunk-2PM3K3OE.mjs +0 -13
- package/lib/chunk-2PM3K3OE.mjs.map +0 -1
- package/lib/chunk-32RSTOZ4.mjs +0 -13
- package/lib/chunk-32RSTOZ4.mjs.map +0 -1
- package/lib/chunk-3HTYHE2X.mjs.map +0 -1
- package/lib/chunk-3O4WCRC2.mjs.map +0 -1
- package/lib/chunk-4CYIMDP2.js.map +0 -1
- package/lib/chunk-5BVJ6YMH.js.map +0 -1
- package/lib/chunk-6TH3DBDK.js.map +0 -1
- package/lib/chunk-7XFLH6R2.mjs.map +0 -1
- package/lib/chunk-CCBCDJXS.mjs.map +0 -1
- package/lib/chunk-DPBE7TAQ.mjs +0 -42
- package/lib/chunk-DPBE7TAQ.mjs.map +0 -1
- package/lib/chunk-EGEHSELT.js +0 -42
- package/lib/chunk-EGEHSELT.js.map +0 -1
- package/lib/chunk-HDSGCAHH.js +0 -13
- package/lib/chunk-HDSGCAHH.js.map +0 -1
- package/lib/chunk-IEUXIOL6.js +0 -13
- package/lib/chunk-IEUXIOL6.js.map +0 -1
- package/lib/chunk-IRG4OQAB.js.map +0 -1
- package/lib/chunk-J4VKFJQK.js.map +0 -1
- package/lib/chunk-JDGZCBXF.mjs +0 -13
- package/lib/chunk-JDGZCBXF.mjs.map +0 -1
- package/lib/chunk-JPRCULRQ.mjs.map +0 -1
- package/lib/chunk-JSGZ7DKT.js +0 -14
- package/lib/chunk-KQKJASVB.js.map +0 -1
- package/lib/chunk-LEQCDD66.js.map +0 -1
- package/lib/chunk-MRISXZQ4.mjs +0 -13
- package/lib/chunk-MRISXZQ4.mjs.map +0 -1
- package/lib/chunk-NDQM5OL4.mjs.map +0 -1
- package/lib/chunk-NNFYXHLU.mjs.map +0 -1
- package/lib/chunk-P7IXNCJG.mjs.map +0 -1
- package/lib/chunk-PH2PMUZP.mjs.map +0 -1
- package/lib/chunk-PXBAS3GA.mjs +0 -13
- package/lib/chunk-PXBAS3GA.mjs.map +0 -1
- package/lib/chunk-QQNQ4IDN.js +0 -13
- package/lib/chunk-QQNQ4IDN.js.map +0 -1
- package/lib/chunk-RD6TBCPQ.js +0 -13
- package/lib/chunk-RD6TBCPQ.js.map +0 -1
- package/lib/chunk-RRQOET3X.js +0 -28
- package/lib/chunk-RRQOET3X.js.map +0 -1
- package/lib/chunk-TCQY2R3U.mjs.map +0 -1
- package/lib/chunk-TKZ6FLLR.js +0 -13
- package/lib/chunk-TKZ6FLLR.js.map +0 -1
- package/lib/chunk-VHEA4JZ5.js +0 -13
- package/lib/chunk-VHEA4JZ5.js.map +0 -1
- package/lib/chunk-WBERBAL4.js.map +0 -1
- package/lib/chunk-WK4O3HH4.js.map +0 -1
- package/lib/chunk-YML32TPA.mjs +0 -13
- package/lib/chunk-YML32TPA.mjs.map +0 -1
- /package/lib/{chunk-PG2R7P7G.mjs.map → chunk-ADSMWGDJ.mjs.map} +0 -0
- /package/lib/{chunk-RYVUYVEE.mjs.map → chunk-D42ISCFK.mjs.map} +0 -0
- /package/lib/{chunk-YUESB2WV.mjs.map → chunk-OKF3BVUD.mjs.map} +0 -0
|
@@ -2,7 +2,7 @@ import { ExceptionContext, PrimitiveType, RequiredValidation } from './commonTyp
|
|
|
2
2
|
|
|
3
3
|
declare const ctxSymbol: unique symbol;
|
|
4
4
|
|
|
5
|
-
declare function innerCheck(schema: CommonSchema, receivedValue: unknown, exCtx: ExceptionContext):
|
|
5
|
+
declare function innerCheck(schema: CommonSchema, receivedValue: unknown, exCtx: ExceptionContext): unknown;
|
|
6
6
|
|
|
7
7
|
type ObjectShapeSchemaType = Record<string, CommonSchema>;
|
|
8
8
|
interface ValidatorContext {
|
|
@@ -15,6 +15,8 @@ interface ValidatorContext {
|
|
|
15
15
|
allowUnrecognizedObjectProps?: boolean;
|
|
16
16
|
strictType?: boolean;
|
|
17
17
|
strictTypeValue?: unknown;
|
|
18
|
+
date?: boolean;
|
|
19
|
+
defaultValue?: unknown;
|
|
18
20
|
}
|
|
19
21
|
declare class CommonSchema {
|
|
20
22
|
[ctxSymbol]: ValidatorContext;
|
|
@@ -33,9 +35,16 @@ declare class CommonSchema {
|
|
|
33
35
|
/**
|
|
34
36
|
* Marks the schema as optional, allowing the value to be `undefined`.
|
|
35
37
|
*
|
|
36
|
-
* @returns {WithUndefined<this>}
|
|
38
|
+
* @returns {WithUndefined<this>} The schema instance marked as optional.
|
|
37
39
|
*/
|
|
38
40
|
optional(): WithUndefined<this>;
|
|
41
|
+
/**
|
|
42
|
+
* Marks the schema as optional, allowing the value to be `undefined`.
|
|
43
|
+
*
|
|
44
|
+
* @returns {this} The schema instance. This method should be used as a last one because it does the check of previous methods and
|
|
45
|
+
*/
|
|
46
|
+
default(defaultValue: unknown): this;
|
|
47
|
+
protected defaultValueCheck(): void;
|
|
39
48
|
}
|
|
40
49
|
type WithNull<T extends CommonSchema> = T & {
|
|
41
50
|
validation_null: true;
|
|
@@ -59,4 +68,4 @@ type WithMix<Y = unknown> = CommonSchema & {
|
|
|
59
68
|
type ExtractFromMix<T> = T extends WithMix<infer X> ? X : never;
|
|
60
69
|
type MapMixTypes<T extends PrimitiveType[]> = T extends (infer U)[] ? U extends keyof TypeMapping ? TypeMapping[U] : never : never;
|
|
61
70
|
|
|
62
|
-
export { CommonSchema as C, type ExtractFromMix as E, type MapMixTypes as M, type ObjectShapeSchemaType as O, type ValidatorContext as V, type
|
|
71
|
+
export { CommonSchema as C, type ExtractFromMix as E, type MapMixTypes as M, type ObjectShapeSchemaType as O, type ValidatorContext as V, type WithMix as W, type WithUndefined as a, type WithNull as b, ctxSymbol as c, innerCheck as i };
|
|
@@ -2,7 +2,7 @@ import { ExceptionContext, PrimitiveType, RequiredValidation } from './commonTyp
|
|
|
2
2
|
|
|
3
3
|
declare const ctxSymbol: unique symbol;
|
|
4
4
|
|
|
5
|
-
declare function innerCheck(schema: CommonSchema, receivedValue: unknown, exCtx: ExceptionContext):
|
|
5
|
+
declare function innerCheck(schema: CommonSchema, receivedValue: unknown, exCtx: ExceptionContext): unknown;
|
|
6
6
|
|
|
7
7
|
type ObjectShapeSchemaType = Record<string, CommonSchema>;
|
|
8
8
|
interface ValidatorContext {
|
|
@@ -15,6 +15,8 @@ interface ValidatorContext {
|
|
|
15
15
|
allowUnrecognizedObjectProps?: boolean;
|
|
16
16
|
strictType?: boolean;
|
|
17
17
|
strictTypeValue?: unknown;
|
|
18
|
+
date?: boolean;
|
|
19
|
+
defaultValue?: unknown;
|
|
18
20
|
}
|
|
19
21
|
declare class CommonSchema {
|
|
20
22
|
[ctxSymbol]: ValidatorContext;
|
|
@@ -33,9 +35,16 @@ declare class CommonSchema {
|
|
|
33
35
|
/**
|
|
34
36
|
* Marks the schema as optional, allowing the value to be `undefined`.
|
|
35
37
|
*
|
|
36
|
-
* @returns {WithUndefined<this>}
|
|
38
|
+
* @returns {WithUndefined<this>} The schema instance marked as optional.
|
|
37
39
|
*/
|
|
38
40
|
optional(): WithUndefined<this>;
|
|
41
|
+
/**
|
|
42
|
+
* Marks the schema as optional, allowing the value to be `undefined`.
|
|
43
|
+
*
|
|
44
|
+
* @returns {this} The schema instance. This method should be used as a last one because it does the check of previous methods and
|
|
45
|
+
*/
|
|
46
|
+
default(defaultValue: unknown): this;
|
|
47
|
+
protected defaultValueCheck(): void;
|
|
39
48
|
}
|
|
40
49
|
type WithNull<T extends CommonSchema> = T & {
|
|
41
50
|
validation_null: true;
|
|
@@ -59,4 +68,4 @@ type WithMix<Y = unknown> = CommonSchema & {
|
|
|
59
68
|
type ExtractFromMix<T> = T extends WithMix<infer X> ? X : never;
|
|
60
69
|
type MapMixTypes<T extends PrimitiveType[]> = T extends (infer U)[] ? U extends keyof TypeMapping ? TypeMapping[U] : never : never;
|
|
61
70
|
|
|
62
|
-
export { CommonSchema as C, type ExtractFromMix as E, type MapMixTypes as M, type ObjectShapeSchemaType as O, type ValidatorContext as V, type
|
|
71
|
+
export { CommonSchema as C, type ExtractFromMix as E, type MapMixTypes as M, type ObjectShapeSchemaType as O, type ValidatorContext as V, type WithMix as W, type WithUndefined as a, type WithNull as b, ctxSymbol as c, innerCheck as i };
|
package/lib/InferType.d.mts
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import { ArraySchema, ExtractFromArray } from './schemas/ArraySchema.mjs';
|
|
2
|
+
import { WithBigInt, BigIntSchema, ExtractFromBigInt } from './schemas/BigIntSchema.mjs';
|
|
2
3
|
import { WithBoolean, BooleanSchema, ExtractFromBoolean } from './schemas/BooleanSchema.mjs';
|
|
3
|
-
import { W as
|
|
4
|
+
import { W as WithMix, E as ExtractFromMix, a as WithUndefined, C as CommonSchema, b as WithNull } from './CommonSchema-CiY7spmg.mjs';
|
|
5
|
+
import { DateSchema } from './schemas/DateSchema.mjs';
|
|
4
6
|
import { WithNumber, NumberSchema, ExtractFromNumber } from './schemas/NumberSchema.mjs';
|
|
5
7
|
import { ObjectSchema, WithObject } from './schemas/ObjectSchema.mjs';
|
|
6
8
|
import { WithString, StringSchema, ExtractFromString } from './schemas/StringSchema.mjs';
|
|
7
9
|
import './commonTypes.mjs';
|
|
8
10
|
|
|
9
|
-
type
|
|
11
|
+
type ResolveNullish<T, Y> = T extends WithUndefined<WithNull<CommonSchema>> ? Y | null | undefined : T extends WithUndefined<CommonSchema> ? Y | undefined : T extends WithNull<CommonSchema> ? Y | null : Y;
|
|
12
|
+
type InferType<T> = T extends WithString<StringSchema> ? ResolveNullish<T, ExtractFromString<T>> : T extends StringSchema ? ResolveNullish<T, string> : T extends WithNumber<NumberSchema> ? ResolveNullish<T, ExtractFromNumber<T>> : T extends NumberSchema ? ResolveNullish<T, number> : T extends WithBoolean<BooleanSchema> ? ResolveNullish<T, ExtractFromBoolean<T>> : T extends BooleanSchema ? ResolveNullish<T, boolean> : T extends ArraySchema ? ResolveNullish<T, InferType<ExtractFromArray<T>>[]> : T extends ObjectSchema ? ResolveNullish<T, ExtractFromObject<T>> : T extends WithMix ? ResolveNullish<T, ExtractFromMix<T>> : T extends WithBigInt<BigIntSchema> ? ResolveNullish<T, ExtractFromBigInt<T>> : T extends BigIntSchema ? ResolveNullish<T, bigint> : T extends DateSchema ? ResolveNullish<T, Date> : unknown;
|
|
10
13
|
type Merge<T> = T extends infer U ? {
|
|
11
14
|
[K in keyof U]: U[K];
|
|
12
15
|
} : never;
|
package/lib/InferType.d.ts
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import { ArraySchema, ExtractFromArray } from './schemas/ArraySchema.js';
|
|
2
|
+
import { WithBigInt, BigIntSchema, ExtractFromBigInt } from './schemas/BigIntSchema.js';
|
|
2
3
|
import { WithBoolean, BooleanSchema, ExtractFromBoolean } from './schemas/BooleanSchema.js';
|
|
3
|
-
import { W as
|
|
4
|
+
import { W as WithMix, E as ExtractFromMix, a as WithUndefined, C as CommonSchema, b as WithNull } from './CommonSchema-D9QVJBJe.js';
|
|
5
|
+
import { DateSchema } from './schemas/DateSchema.js';
|
|
4
6
|
import { WithNumber, NumberSchema, ExtractFromNumber } from './schemas/NumberSchema.js';
|
|
5
7
|
import { ObjectSchema, WithObject } from './schemas/ObjectSchema.js';
|
|
6
8
|
import { WithString, StringSchema, ExtractFromString } from './schemas/StringSchema.js';
|
|
7
9
|
import './commonTypes.js';
|
|
8
10
|
|
|
9
|
-
type
|
|
11
|
+
type ResolveNullish<T, Y> = T extends WithUndefined<WithNull<CommonSchema>> ? Y | null | undefined : T extends WithUndefined<CommonSchema> ? Y | undefined : T extends WithNull<CommonSchema> ? Y | null : Y;
|
|
12
|
+
type InferType<T> = T extends WithString<StringSchema> ? ResolveNullish<T, ExtractFromString<T>> : T extends StringSchema ? ResolveNullish<T, string> : T extends WithNumber<NumberSchema> ? ResolveNullish<T, ExtractFromNumber<T>> : T extends NumberSchema ? ResolveNullish<T, number> : T extends WithBoolean<BooleanSchema> ? ResolveNullish<T, ExtractFromBoolean<T>> : T extends BooleanSchema ? ResolveNullish<T, boolean> : T extends ArraySchema ? ResolveNullish<T, InferType<ExtractFromArray<T>>[]> : T extends ObjectSchema ? ResolveNullish<T, ExtractFromObject<T>> : T extends WithMix ? ResolveNullish<T, ExtractFromMix<T>> : T extends WithBigInt<BigIntSchema> ? ResolveNullish<T, ExtractFromBigInt<T>> : T extends BigIntSchema ? ResolveNullish<T, bigint> : T extends DateSchema ? ResolveNullish<T, Date> : unknown;
|
|
10
13
|
type Merge<T> = T extends infer U ? {
|
|
11
14
|
[K in keyof U]: U[K];
|
|
12
15
|
} : never;
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { WithArray } from '../../schemas/ArraySchema.mjs';
|
|
2
|
-
import { C as CommonSchema } from '../../CommonSchema-
|
|
2
|
+
import { C as CommonSchema } from '../../CommonSchema-CiY7spmg.mjs';
|
|
3
3
|
import '../../commonTypes.mjs';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
* Creates a new schema for validating arrays where each element must match the specified schema.
|
|
7
|
-
*
|
|
6
|
+
* @description Creates a new schema for validating arrays where each element must match the specified schema.
|
|
8
7
|
* @template T
|
|
9
8
|
* @param {T} arraySchema - The schema that each element of the array must match.
|
|
10
9
|
* @returns {WithArray<T>} A new instance of `ArraySchema` for validating arrays of elements that match the specified schema.
|
|
11
|
-
*
|
|
12
10
|
* @example
|
|
13
11
|
* const schema = array(string());
|
|
14
12
|
* parseOrFail(schema, ['hello', 'world']); // Validates successfully
|
|
15
13
|
* parseOrFail(schema, ['hello', 123]); // Throws a validation error
|
|
14
|
+
*
|
|
15
|
+
* @instance Of ArraySchema
|
|
16
16
|
*/
|
|
17
17
|
declare function array<T extends CommonSchema>(arraySchema: T): WithArray<T>;
|
|
18
18
|
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { WithArray } from '../../schemas/ArraySchema.js';
|
|
2
|
-
import { C as CommonSchema } from '../../CommonSchema-
|
|
2
|
+
import { C as CommonSchema } from '../../CommonSchema-D9QVJBJe.js';
|
|
3
3
|
import '../../commonTypes.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
* Creates a new schema for validating arrays where each element must match the specified schema.
|
|
7
|
-
*
|
|
6
|
+
* @description Creates a new schema for validating arrays where each element must match the specified schema.
|
|
8
7
|
* @template T
|
|
9
8
|
* @param {T} arraySchema - The schema that each element of the array must match.
|
|
10
9
|
* @returns {WithArray<T>} A new instance of `ArraySchema` for validating arrays of elements that match the specified schema.
|
|
11
|
-
*
|
|
12
10
|
* @example
|
|
13
11
|
* const schema = array(string());
|
|
14
12
|
* parseOrFail(schema, ['hello', 'world']); // Validates successfully
|
|
15
13
|
* parseOrFail(schema, ['hello', 123]); // Throws a validation error
|
|
14
|
+
*
|
|
15
|
+
* @instance Of ArraySchema
|
|
16
16
|
*/
|
|
17
17
|
declare function array<T extends CommonSchema>(arraySchema: T): WithArray<T>;
|
|
18
18
|
|
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('../../chunk-
|
|
5
|
-
require('../../chunk-
|
|
6
|
-
require('../../chunk-
|
|
7
|
-
require('../../chunk-
|
|
3
|
+
var _chunkLYNVPN3Rjs = require('../../chunk-LYNVPN3R.js');
|
|
4
|
+
require('../../chunk-3IOQH3K4.js');
|
|
5
|
+
require('../../chunk-PESVL5YJ.js');
|
|
6
|
+
require('../../chunk-PIBDJJUU.js');
|
|
7
|
+
require('../../chunk-VBTWYDEM.js');
|
|
8
|
+
require('../../chunk-UZ2PWO4O.js');
|
|
9
|
+
require('../../chunk-AY7HKAG2.js');
|
|
8
10
|
|
|
11
|
+
// src/asserts/array/index.ts
|
|
12
|
+
function array(arraySchema) {
|
|
13
|
+
return new (0, _chunkLYNVPN3Rjs.ArraySchema)({ type: [], requiredValidations: [] }, arraySchema);
|
|
14
|
+
}
|
|
9
15
|
|
|
10
|
-
|
|
16
|
+
|
|
17
|
+
exports.array = array;
|
|
11
18
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/bguard/bguard/lib/asserts/array/index.js"],"names":[],"mappings":"AAAA;AACE;AACF,0DAAgC;AAChC,mCAAgC;AAChC,mCAAgC;AAChC,mCAAgC;AAChC,mCAAgC;AAChC;AACE;AACF,
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/bguard/bguard/lib/asserts/array/index.js","../../../src/asserts/array/index.ts"],"names":[],"mappings":"AAAA;AACE;AACF,0DAAgC;AAChC,mCAAgC;AAChC,mCAAgC;AAChC,mCAAgC;AAChC,mCAAgC;AAChC,mCAAgC;AAChC,mCAAgC;AAChC;AACA;ACKO,SAAS,KAAA,CAA8B,WAAA,EAA8B;AAC1E,EAAA,OAAO,IAAI,iCAAA,CAAY,EAAE,IAAA,EAAM,CAAC,CAAA,EAAG,mBAAA,EAAqB,CAAC,EAAE,CAAA,EAAG,WAAW,CAAA;AAC3E;ADHA;AACE;AACF,sBAAC","file":"/home/runner/work/bguard/bguard/lib/asserts/array/index.js","sourcesContent":[null,"import { ArraySchema, WithArray } from '../../schemas/ArraySchema';\nimport { CommonSchema } from '../../schemas/CommonSchema';\n\n/**\n * @description Creates a new schema for validating arrays where each element must match the specified schema.\n * @template T\n * @param {T} arraySchema - The schema that each element of the array must match.\n * @returns {WithArray<T>} A new instance of `ArraySchema` for validating arrays of elements that match the specified schema.\n * @example\n * const schema = array(string());\n * parseOrFail(schema, ['hello', 'world']); // Validates successfully\n * parseOrFail(schema, ['hello', 123]); // Throws a validation error\n *\n * @instance Of ArraySchema\n */\nexport function array<T extends CommonSchema>(arraySchema: T): WithArray<T> {\n return new ArraySchema({ type: [], requiredValidations: [] }, arraySchema) as WithArray<T>;\n}\n"]}
|
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
} from "../../chunk-
|
|
4
|
-
import "../../chunk-
|
|
5
|
-
import "../../chunk-
|
|
6
|
-
import "../../chunk-
|
|
7
|
-
import "../../chunk-
|
|
2
|
+
ArraySchema
|
|
3
|
+
} from "../../chunk-KBZUNXJB.mjs";
|
|
4
|
+
import "../../chunk-AOUFWACR.mjs";
|
|
5
|
+
import "../../chunk-ADSMWGDJ.mjs";
|
|
6
|
+
import "../../chunk-5LLJ22IG.mjs";
|
|
7
|
+
import "../../chunk-YBVMP4EI.mjs";
|
|
8
|
+
import "../../chunk-4GDBM5LP.mjs";
|
|
9
|
+
import "../../chunk-NP64RC7B.mjs";
|
|
10
|
+
|
|
11
|
+
// src/asserts/array/index.ts
|
|
12
|
+
function array(arraySchema) {
|
|
13
|
+
return new ArraySchema({ type: [], requiredValidations: [] }, arraySchema);
|
|
14
|
+
}
|
|
8
15
|
export {
|
|
9
16
|
array
|
|
10
17
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../../src/asserts/array/index.ts"],"sourcesContent":["import { ArraySchema, WithArray } from '../../schemas/ArraySchema';\nimport { CommonSchema } from '../../schemas/CommonSchema';\n\n/**\n * @description Creates a new schema for validating arrays where each element must match the specified schema.\n * @template T\n * @param {T} arraySchema - The schema that each element of the array must match.\n * @returns {WithArray<T>} A new instance of `ArraySchema` for validating arrays of elements that match the specified schema.\n * @example\n * const schema = array(string());\n * parseOrFail(schema, ['hello', 'world']); // Validates successfully\n * parseOrFail(schema, ['hello', 123]); // Throws a validation error\n *\n * @instance Of ArraySchema\n */\nexport function array<T extends CommonSchema>(arraySchema: T): WithArray<T> {\n return new ArraySchema({ type: [], requiredValidations: [] }, arraySchema) as WithArray<T>;\n}\n"],"mappings":";;;;;;;;;;;AAeO,SAAS,MAA8B,aAA8B;AAC1E,SAAO,IAAI,YAAY,EAAE,MAAM,CAAC,GAAG,qBAAqB,CAAC,EAAE,GAAG,WAAW;AAC3E;","names":[]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { RequiredValidation } from '../../commonTypes.mjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @description Asserts that the length of an array is not greater than a specified maximum length.
|
|
5
|
+
* @param {number} expected The maximum allowed length for the array.
|
|
6
|
+
* @returns {RequiredValidation} A validation function that takes a received array and an exception context.
|
|
7
|
+
* @throws {ValidationError} if the length of the received value is greater than the expected length.
|
|
8
|
+
* @example
|
|
9
|
+
* const schema = array(string()).custom(maxArrayLength(3));
|
|
10
|
+
* parseOrFail(schema, ['adequate', 'array']); // Valid
|
|
11
|
+
* parseOrFail(schema, ['adequate', 'array', 'length']); // Valid
|
|
12
|
+
* parseOrFail(schema, ['adequate', 'array', 'length', 'test']); // Throws an error: 'The received value length is greater than expected'
|
|
13
|
+
*
|
|
14
|
+
* @translation Error Translation Key = 'a:maxArrayLength'
|
|
15
|
+
*/
|
|
16
|
+
declare const maxArrayLength: {
|
|
17
|
+
(expected: number): RequiredValidation;
|
|
18
|
+
key: string;
|
|
19
|
+
message: string;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export { maxArrayLength };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { RequiredValidation } from '../../commonTypes.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @description Asserts that the length of an array is not greater than a specified maximum length.
|
|
5
|
+
* @param {number} expected The maximum allowed length for the array.
|
|
6
|
+
* @returns {RequiredValidation} A validation function that takes a received array and an exception context.
|
|
7
|
+
* @throws {ValidationError} if the length of the received value is greater than the expected length.
|
|
8
|
+
* @example
|
|
9
|
+
* const schema = array(string()).custom(maxArrayLength(3));
|
|
10
|
+
* parseOrFail(schema, ['adequate', 'array']); // Valid
|
|
11
|
+
* parseOrFail(schema, ['adequate', 'array', 'length']); // Valid
|
|
12
|
+
* parseOrFail(schema, ['adequate', 'array', 'length', 'test']); // Throws an error: 'The received value length is greater than expected'
|
|
13
|
+
*
|
|
14
|
+
* @translation Error Translation Key = 'a:maxArrayLength'
|
|
15
|
+
*/
|
|
16
|
+
declare const maxArrayLength: {
|
|
17
|
+
(expected: number): RequiredValidation;
|
|
18
|
+
key: string;
|
|
19
|
+
message: string;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export { maxArrayLength };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
var _chunkUZ2PWO4Ojs = require('../../chunk-UZ2PWO4O.js');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
var _chunkAY7HKAG2js = require('../../chunk-AY7HKAG2.js');
|
|
7
|
+
|
|
8
|
+
// src/asserts/array/maxArrayLength.ts
|
|
9
|
+
var maxArrayLengthErrorMessage = "The received value length is greater than expected";
|
|
10
|
+
var maxArrayLengthErrorKey = "a:maxArrayLength";
|
|
11
|
+
var maxArrayLength = (expected) => (received, ctx) => {
|
|
12
|
+
if (received.length > expected) _chunkAY7HKAG2js.guardException.call(void 0, expected, received, ctx, maxArrayLengthErrorMessage);
|
|
13
|
+
};
|
|
14
|
+
maxArrayLength.key = maxArrayLengthErrorKey;
|
|
15
|
+
maxArrayLength.message = maxArrayLengthErrorMessage;
|
|
16
|
+
_chunkUZ2PWO4Ojs.setToDefaultLocale.call(void 0, maxArrayLength);
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
exports.maxArrayLength = maxArrayLength;
|
|
20
|
+
//# sourceMappingURL=maxArrayLength.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/bguard/bguard/lib/asserts/array/maxArrayLength.js","../../../src/asserts/array/maxArrayLength.ts"],"names":[],"mappings":"AAAA;AACE;AACF,0DAAgC;AAChC;AACE;AACF,0DAAgC;AAChC;AACA;ACHA,IAAM,2BAAA,EAA6B,oDAAA;AACnC,IAAM,uBAAA,EAAyB,kBAAA;AAexB,IAAM,eAAA,EACX,CAAC,QAAA,EAAA,GACD,CAAC,QAAA,EAAqB,GAAA,EAAA,GAA0B;AAC9C,EAAA,GAAA,CAAI,QAAA,CAAS,OAAA,EAAS,QAAA,EAAU,6CAAA,QAAe,EAAU,QAAA,EAAU,GAAA,EAAK,0BAA0B,CAAA;AACpG,CAAA;AAEF,cAAA,CAAe,IAAA,EAAM,sBAAA;AACrB,cAAA,CAAe,QAAA,EAAU,0BAAA;AACzB,iDAAA,cAAiC,CAAA;ADZjC;AACE;AACF,wCAAC","file":"/home/runner/work/bguard/bguard/lib/asserts/array/maxArrayLength.js","sourcesContent":[null,"import { guardException } from '../../exceptions';\nimport { ExceptionContext, RequiredValidation } from '../../commonTypes';\nimport { setToDefaultLocale } from '../../translationMap';\n\nconst maxArrayLengthErrorMessage = 'The received value length is greater than expected';\nconst maxArrayLengthErrorKey = 'a:maxArrayLength';\n\n/**\n * @description Asserts that the length of an array is not greater than a specified maximum length.\n * @param {number} expected The maximum allowed length for the array.\n * @returns {RequiredValidation} A validation function that takes a received array and an exception context.\n * @throws {ValidationError} if the length of the received value is greater than the expected length.\n * @example\n * const schema = array(string()).custom(maxArrayLength(3));\n * parseOrFail(schema, ['adequate', 'array']); // Valid\n * parseOrFail(schema, ['adequate', 'array', 'length']); // Valid\n * parseOrFail(schema, ['adequate', 'array', 'length', 'test']); // Throws an error: 'The received value length is greater than expected'\n *\n * @translation Error Translation Key = 'a:maxArrayLength'\n */\nexport const maxArrayLength =\n (expected: number): RequiredValidation =>\n (received: unknown[], ctx: ExceptionContext) => {\n if (received.length > expected) guardException(expected, received, ctx, maxArrayLengthErrorMessage);\n };\n\nmaxArrayLength.key = maxArrayLengthErrorKey;\nmaxArrayLength.message = maxArrayLengthErrorMessage;\nsetToDefaultLocale(maxArrayLength);\n"]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import {
|
|
2
|
+
setToDefaultLocale
|
|
3
|
+
} from "../../chunk-4GDBM5LP.mjs";
|
|
4
|
+
import {
|
|
5
|
+
guardException
|
|
6
|
+
} from "../../chunk-NP64RC7B.mjs";
|
|
7
|
+
|
|
8
|
+
// src/asserts/array/maxArrayLength.ts
|
|
9
|
+
var maxArrayLengthErrorMessage = "The received value length is greater than expected";
|
|
10
|
+
var maxArrayLengthErrorKey = "a:maxArrayLength";
|
|
11
|
+
var maxArrayLength = (expected) => (received, ctx) => {
|
|
12
|
+
if (received.length > expected) guardException(expected, received, ctx, maxArrayLengthErrorMessage);
|
|
13
|
+
};
|
|
14
|
+
maxArrayLength.key = maxArrayLengthErrorKey;
|
|
15
|
+
maxArrayLength.message = maxArrayLengthErrorMessage;
|
|
16
|
+
setToDefaultLocale(maxArrayLength);
|
|
17
|
+
export {
|
|
18
|
+
maxArrayLength
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=maxArrayLength.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/asserts/array/maxArrayLength.ts"],"sourcesContent":["import { guardException } from '../../exceptions';\nimport { ExceptionContext, RequiredValidation } from '../../commonTypes';\nimport { setToDefaultLocale } from '../../translationMap';\n\nconst maxArrayLengthErrorMessage = 'The received value length is greater than expected';\nconst maxArrayLengthErrorKey = 'a:maxArrayLength';\n\n/**\n * @description Asserts that the length of an array is not greater than a specified maximum length.\n * @param {number} expected The maximum allowed length for the array.\n * @returns {RequiredValidation} A validation function that takes a received array and an exception context.\n * @throws {ValidationError} if the length of the received value is greater than the expected length.\n * @example\n * const schema = array(string()).custom(maxArrayLength(3));\n * parseOrFail(schema, ['adequate', 'array']); // Valid\n * parseOrFail(schema, ['adequate', 'array', 'length']); // Valid\n * parseOrFail(schema, ['adequate', 'array', 'length', 'test']); // Throws an error: 'The received value length is greater than expected'\n *\n * @translation Error Translation Key = 'a:maxArrayLength'\n */\nexport const maxArrayLength =\n (expected: number): RequiredValidation =>\n (received: unknown[], ctx: ExceptionContext) => {\n if (received.length > expected) guardException(expected, received, ctx, maxArrayLengthErrorMessage);\n };\n\nmaxArrayLength.key = maxArrayLengthErrorKey;\nmaxArrayLength.message = maxArrayLengthErrorMessage;\nsetToDefaultLocale(maxArrayLength);\n"],"mappings":";;;;;;;;AAIA,IAAM,6BAA6B;AACnC,IAAM,yBAAyB;AAexB,IAAM,iBACX,CAAC,aACD,CAAC,UAAqB,QAA0B;AAC9C,MAAI,SAAS,SAAS,SAAU,gBAAe,UAAU,UAAU,KAAK,0BAA0B;AACpG;AAEF,eAAe,MAAM;AACrB,eAAe,UAAU;AACzB,mBAAmB,cAAc;","names":[]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { RequiredValidation } from '../../commonTypes.mjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @description Asserts that the length of na array is not less than a specified minimum length.
|
|
5
|
+
* @param {number} expected The minimum required length for the array.
|
|
6
|
+
* @returns {RequiredValidation} A validation function that takes a received array and an exception context.
|
|
7
|
+
* @throws {ValidationError} if the length of the received value is less than the expected length.
|
|
8
|
+
* @example
|
|
9
|
+
* const schema = array(string()).custom(minArrayLength(3));
|
|
10
|
+
* parseOrFail(schema, ['short', 'array']); // Throws an error: 'The received value length is less than expected'
|
|
11
|
+
* parseOrFail(schema, ['adequate', 'array', 'length']); // Valid
|
|
12
|
+
* parseOrFail(schema, ['adequate', 'array', 'length', 'test']); // Valid
|
|
13
|
+
*
|
|
14
|
+
* @translation Error Translation Key = 'a:minArrayLength'
|
|
15
|
+
*/
|
|
16
|
+
declare const minArrayLength: {
|
|
17
|
+
(expected: number): RequiredValidation;
|
|
18
|
+
key: string;
|
|
19
|
+
message: string;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export { minArrayLength };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { RequiredValidation } from '../../commonTypes.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @description Asserts that the length of na array is not less than a specified minimum length.
|
|
5
|
+
* @param {number} expected The minimum required length for the array.
|
|
6
|
+
* @returns {RequiredValidation} A validation function that takes a received array and an exception context.
|
|
7
|
+
* @throws {ValidationError} if the length of the received value is less than the expected length.
|
|
8
|
+
* @example
|
|
9
|
+
* const schema = array(string()).custom(minArrayLength(3));
|
|
10
|
+
* parseOrFail(schema, ['short', 'array']); // Throws an error: 'The received value length is less than expected'
|
|
11
|
+
* parseOrFail(schema, ['adequate', 'array', 'length']); // Valid
|
|
12
|
+
* parseOrFail(schema, ['adequate', 'array', 'length', 'test']); // Valid
|
|
13
|
+
*
|
|
14
|
+
* @translation Error Translation Key = 'a:minArrayLength'
|
|
15
|
+
*/
|
|
16
|
+
declare const minArrayLength: {
|
|
17
|
+
(expected: number): RequiredValidation;
|
|
18
|
+
key: string;
|
|
19
|
+
message: string;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export { minArrayLength };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
var _chunkUZ2PWO4Ojs = require('../../chunk-UZ2PWO4O.js');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
var _chunkAY7HKAG2js = require('../../chunk-AY7HKAG2.js');
|
|
7
|
+
|
|
8
|
+
// src/asserts/array/minArrayLength.ts
|
|
9
|
+
var minArrayLengthErrorMessage = "The received value length is less than expected";
|
|
10
|
+
var minArrayLengthErrorKey = "a:minArrayLength";
|
|
11
|
+
var minArrayLength = (expected) => (received, ctx) => {
|
|
12
|
+
if (received.length < expected) _chunkAY7HKAG2js.guardException.call(void 0, expected, received, ctx, minArrayLengthErrorMessage);
|
|
13
|
+
};
|
|
14
|
+
minArrayLength.key = minArrayLengthErrorKey;
|
|
15
|
+
minArrayLength.message = minArrayLengthErrorMessage;
|
|
16
|
+
_chunkUZ2PWO4Ojs.setToDefaultLocale.call(void 0, minArrayLength);
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
exports.minArrayLength = minArrayLength;
|
|
20
|
+
//# sourceMappingURL=minArrayLength.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/bguard/bguard/lib/asserts/array/minArrayLength.js","../../../src/asserts/array/minArrayLength.ts"],"names":[],"mappings":"AAAA;AACE;AACF,0DAAgC;AAChC;AACE;AACF,0DAAgC;AAChC;AACA;ACHA,IAAM,2BAAA,EAA6B,iDAAA;AACnC,IAAM,uBAAA,EAAyB,kBAAA;AAexB,IAAM,eAAA,EACX,CAAC,QAAA,EAAA,GACD,CAAC,QAAA,EAAqB,GAAA,EAAA,GAA0B;AAC9C,EAAA,GAAA,CAAI,QAAA,CAAS,OAAA,EAAS,QAAA,EAAU,6CAAA,QAAe,EAAU,QAAA,EAAU,GAAA,EAAK,0BAA0B,CAAA;AACpG,CAAA;AAEF,cAAA,CAAe,IAAA,EAAM,sBAAA;AACrB,cAAA,CAAe,QAAA,EAAU,0BAAA;AACzB,iDAAA,cAAiC,CAAA;ADZjC;AACE;AACF,wCAAC","file":"/home/runner/work/bguard/bguard/lib/asserts/array/minArrayLength.js","sourcesContent":[null,"import { guardException } from '../../exceptions';\nimport { ExceptionContext, RequiredValidation } from '../../commonTypes';\nimport { setToDefaultLocale } from '../../translationMap';\n\nconst minArrayLengthErrorMessage = 'The received value length is less than expected';\nconst minArrayLengthErrorKey = 'a:minArrayLength';\n\n/**\n * @description Asserts that the length of na array is not less than a specified minimum length.\n * @param {number} expected The minimum required length for the array.\n * @returns {RequiredValidation} A validation function that takes a received array and an exception context.\n * @throws {ValidationError} if the length of the received value is less than the expected length.\n * @example\n * const schema = array(string()).custom(minArrayLength(3));\n * parseOrFail(schema, ['short', 'array']); // Throws an error: 'The received value length is less than expected'\n * parseOrFail(schema, ['adequate', 'array', 'length']); // Valid\n * parseOrFail(schema, ['adequate', 'array', 'length', 'test']); // Valid\n *\n * @translation Error Translation Key = 'a:minArrayLength'\n */\nexport const minArrayLength =\n (expected: number): RequiredValidation =>\n (received: unknown[], ctx: ExceptionContext) => {\n if (received.length < expected) guardException(expected, received, ctx, minArrayLengthErrorMessage);\n };\n\nminArrayLength.key = minArrayLengthErrorKey;\nminArrayLength.message = minArrayLengthErrorMessage;\nsetToDefaultLocale(minArrayLength);\n"]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import {
|
|
2
|
+
setToDefaultLocale
|
|
3
|
+
} from "../../chunk-4GDBM5LP.mjs";
|
|
4
|
+
import {
|
|
5
|
+
guardException
|
|
6
|
+
} from "../../chunk-NP64RC7B.mjs";
|
|
7
|
+
|
|
8
|
+
// src/asserts/array/minArrayLength.ts
|
|
9
|
+
var minArrayLengthErrorMessage = "The received value length is less than expected";
|
|
10
|
+
var minArrayLengthErrorKey = "a:minArrayLength";
|
|
11
|
+
var minArrayLength = (expected) => (received, ctx) => {
|
|
12
|
+
if (received.length < expected) guardException(expected, received, ctx, minArrayLengthErrorMessage);
|
|
13
|
+
};
|
|
14
|
+
minArrayLength.key = minArrayLengthErrorKey;
|
|
15
|
+
minArrayLength.message = minArrayLengthErrorMessage;
|
|
16
|
+
setToDefaultLocale(minArrayLength);
|
|
17
|
+
export {
|
|
18
|
+
minArrayLength
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=minArrayLength.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/asserts/array/minArrayLength.ts"],"sourcesContent":["import { guardException } from '../../exceptions';\nimport { ExceptionContext, RequiredValidation } from '../../commonTypes';\nimport { setToDefaultLocale } from '../../translationMap';\n\nconst minArrayLengthErrorMessage = 'The received value length is less than expected';\nconst minArrayLengthErrorKey = 'a:minArrayLength';\n\n/**\n * @description Asserts that the length of na array is not less than a specified minimum length.\n * @param {number} expected The minimum required length for the array.\n * @returns {RequiredValidation} A validation function that takes a received array and an exception context.\n * @throws {ValidationError} if the length of the received value is less than the expected length.\n * @example\n * const schema = array(string()).custom(minArrayLength(3));\n * parseOrFail(schema, ['short', 'array']); // Throws an error: 'The received value length is less than expected'\n * parseOrFail(schema, ['adequate', 'array', 'length']); // Valid\n * parseOrFail(schema, ['adequate', 'array', 'length', 'test']); // Valid\n *\n * @translation Error Translation Key = 'a:minArrayLength'\n */\nexport const minArrayLength =\n (expected: number): RequiredValidation =>\n (received: unknown[], ctx: ExceptionContext) => {\n if (received.length < expected) guardException(expected, received, ctx, minArrayLengthErrorMessage);\n };\n\nminArrayLength.key = minArrayLengthErrorKey;\nminArrayLength.message = minArrayLengthErrorMessage;\nsetToDefaultLocale(minArrayLength);\n"],"mappings":";;;;;;;;AAIA,IAAM,6BAA6B;AACnC,IAAM,yBAAyB;AAexB,IAAM,iBACX,CAAC,aACD,CAAC,UAAqB,QAA0B;AAC9C,MAAI,SAAS,SAAS,SAAU,gBAAe,UAAU,UAAU,KAAK,0BAA0B;AACpG;AAEF,eAAe,MAAM;AACrB,eAAe,UAAU;AACzB,mBAAmB,cAAc;","names":[]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { RequiredValidation } from '../../commonTypes.mjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @description Asserts that a bigint value does not exceed a specified maximum value.
|
|
5
|
+
* @param {bigint} expected The maximum allowable value.
|
|
6
|
+
* @returns {RequiredValidation} A validation function that takes a received bigint and an exception context.
|
|
7
|
+
* @throws {ValidationError} if the received value exceeds the expected maximum value.
|
|
8
|
+
* @example
|
|
9
|
+
* const schema = bigint().custom(bigintMax(100n));
|
|
10
|
+
* parseOrFail(schema, 99n); // Valid
|
|
11
|
+
* parseOrFail(schema, 100n); // Valid
|
|
12
|
+
* parseOrFail(schema, 101n); // Throws an error: 'The received value is greater than expected'
|
|
13
|
+
*
|
|
14
|
+
* @translation Error Translation Key = 'bi:max'
|
|
15
|
+
*/
|
|
16
|
+
declare const bigintMax: {
|
|
17
|
+
(expected: bigint): RequiredValidation;
|
|
18
|
+
key: string;
|
|
19
|
+
message: string;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export { bigintMax };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { RequiredValidation } from '../../commonTypes.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @description Asserts that a bigint value does not exceed a specified maximum value.
|
|
5
|
+
* @param {bigint} expected The maximum allowable value.
|
|
6
|
+
* @returns {RequiredValidation} A validation function that takes a received bigint and an exception context.
|
|
7
|
+
* @throws {ValidationError} if the received value exceeds the expected maximum value.
|
|
8
|
+
* @example
|
|
9
|
+
* const schema = bigint().custom(bigintMax(100n));
|
|
10
|
+
* parseOrFail(schema, 99n); // Valid
|
|
11
|
+
* parseOrFail(schema, 100n); // Valid
|
|
12
|
+
* parseOrFail(schema, 101n); // Throws an error: 'The received value is greater than expected'
|
|
13
|
+
*
|
|
14
|
+
* @translation Error Translation Key = 'bi:max'
|
|
15
|
+
*/
|
|
16
|
+
declare const bigintMax: {
|
|
17
|
+
(expected: bigint): RequiredValidation;
|
|
18
|
+
key: string;
|
|
19
|
+
message: string;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export { bigintMax };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
var _chunkUZ2PWO4Ojs = require('../../chunk-UZ2PWO4O.js');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
var _chunkAY7HKAG2js = require('../../chunk-AY7HKAG2.js');
|
|
7
|
+
|
|
8
|
+
// src/asserts/bigint/bigintMax.ts
|
|
9
|
+
var bigintMaxErrorMessage = "The received value is greater than expected";
|
|
10
|
+
var bigintMaxErrorKey = "bi:max";
|
|
11
|
+
var bigintMax = (expected) => (received, ctx) => {
|
|
12
|
+
if (expected < received) _chunkAY7HKAG2js.guardException.call(void 0, expected, received, ctx, bigintMaxErrorKey);
|
|
13
|
+
};
|
|
14
|
+
bigintMax.key = bigintMaxErrorKey;
|
|
15
|
+
bigintMax.message = bigintMaxErrorMessage;
|
|
16
|
+
_chunkUZ2PWO4Ojs.setToDefaultLocale.call(void 0, bigintMax);
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
exports.bigintMax = bigintMax;
|
|
20
|
+
//# sourceMappingURL=bigintMax.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/bguard/bguard/lib/asserts/bigint/bigintMax.js","../../../src/asserts/bigint/bigintMax.ts"],"names":[],"mappings":"AAAA;AACE;AACF,0DAAgC;AAChC;AACE;AACF,0DAAgC;AAChC;AACA;ACHA,IAAM,sBAAA,EAAwB,6CAAA;AAC9B,IAAM,kBAAA,EAAoB,QAAA;AAenB,IAAM,UAAA,EACX,CAAC,QAAA,EAAA,GACD,CAAC,QAAA,EAAkB,GAAA,EAAA,GAA0B;AAC3C,EAAA,GAAA,CAAI,SAAA,EAAW,QAAA,EAAU,6CAAA,QAAe,EAAU,QAAA,EAAU,GAAA,EAAK,iBAAiB,CAAA;AACpF,CAAA;AAEF,SAAA,CAAU,IAAA,EAAM,iBAAA;AAChB,SAAA,CAAU,QAAA,EAAU,qBAAA;AACpB,iDAAA,SAA4B,CAAA;ADZ5B;AACE;AACF,8BAAC","file":"/home/runner/work/bguard/bguard/lib/asserts/bigint/bigintMax.js","sourcesContent":[null,"import { setToDefaultLocale } from '../../translationMap';\nimport { guardException } from '../../exceptions';\nimport { ExceptionContext, RequiredValidation } from '../../commonTypes';\n\nconst bigintMaxErrorMessage = 'The received value is greater than expected';\nconst bigintMaxErrorKey = 'bi:max';\n\n/**\n * @description Asserts that a bigint value does not exceed a specified maximum value.\n * @param {bigint} expected The maximum allowable value.\n * @returns {RequiredValidation} A validation function that takes a received bigint and an exception context.\n * @throws {ValidationError} if the received value exceeds the expected maximum value.\n * @example\n * const schema = bigint().custom(bigintMax(100n));\n * parseOrFail(schema, 99n); // Valid\n * parseOrFail(schema, 100n); // Valid\n * parseOrFail(schema, 101n); // Throws an error: 'The received value is greater than expected'\n *\n * @translation Error Translation Key = 'bi:max'\n */\nexport const bigintMax =\n (expected: bigint): RequiredValidation =>\n (received: bigint, ctx: ExceptionContext) => {\n if (expected < received) guardException(expected, received, ctx, bigintMaxErrorKey);\n };\n\nbigintMax.key = bigintMaxErrorKey;\nbigintMax.message = bigintMaxErrorMessage;\nsetToDefaultLocale(bigintMax);\n"]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import {
|
|
2
|
+
setToDefaultLocale
|
|
3
|
+
} from "../../chunk-4GDBM5LP.mjs";
|
|
4
|
+
import {
|
|
5
|
+
guardException
|
|
6
|
+
} from "../../chunk-NP64RC7B.mjs";
|
|
7
|
+
|
|
8
|
+
// src/asserts/bigint/bigintMax.ts
|
|
9
|
+
var bigintMaxErrorMessage = "The received value is greater than expected";
|
|
10
|
+
var bigintMaxErrorKey = "bi:max";
|
|
11
|
+
var bigintMax = (expected) => (received, ctx) => {
|
|
12
|
+
if (expected < received) guardException(expected, received, ctx, bigintMaxErrorKey);
|
|
13
|
+
};
|
|
14
|
+
bigintMax.key = bigintMaxErrorKey;
|
|
15
|
+
bigintMax.message = bigintMaxErrorMessage;
|
|
16
|
+
setToDefaultLocale(bigintMax);
|
|
17
|
+
export {
|
|
18
|
+
bigintMax
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=bigintMax.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/asserts/bigint/bigintMax.ts"],"sourcesContent":["import { setToDefaultLocale } from '../../translationMap';\nimport { guardException } from '../../exceptions';\nimport { ExceptionContext, RequiredValidation } from '../../commonTypes';\n\nconst bigintMaxErrorMessage = 'The received value is greater than expected';\nconst bigintMaxErrorKey = 'bi:max';\n\n/**\n * @description Asserts that a bigint value does not exceed a specified maximum value.\n * @param {bigint} expected The maximum allowable value.\n * @returns {RequiredValidation} A validation function that takes a received bigint and an exception context.\n * @throws {ValidationError} if the received value exceeds the expected maximum value.\n * @example\n * const schema = bigint().custom(bigintMax(100n));\n * parseOrFail(schema, 99n); // Valid\n * parseOrFail(schema, 100n); // Valid\n * parseOrFail(schema, 101n); // Throws an error: 'The received value is greater than expected'\n *\n * @translation Error Translation Key = 'bi:max'\n */\nexport const bigintMax =\n (expected: bigint): RequiredValidation =>\n (received: bigint, ctx: ExceptionContext) => {\n if (expected < received) guardException(expected, received, ctx, bigintMaxErrorKey);\n };\n\nbigintMax.key = bigintMaxErrorKey;\nbigintMax.message = bigintMaxErrorMessage;\nsetToDefaultLocale(bigintMax);\n"],"mappings":";;;;;;;;AAIA,IAAM,wBAAwB;AAC9B,IAAM,oBAAoB;AAenB,IAAM,YACX,CAAC,aACD,CAAC,UAAkB,QAA0B;AAC3C,MAAI,WAAW,SAAU,gBAAe,UAAU,UAAU,KAAK,iBAAiB;AACpF;AAEF,UAAU,MAAM;AAChB,UAAU,UAAU;AACpB,mBAAmB,SAAS;","names":[]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { RequiredValidation } from '../../commonTypes.mjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @description - Asserts that a bigint value is strictly less than a specified maximum value (i.e., the maximum value is excluded).
|
|
5
|
+
* @param {bigint} expected - The maximum allowable value, which is excluded.
|
|
6
|
+
* @returns {RequiredValidation} - A validation function that takes a received bigint and an exception context.
|
|
7
|
+
* @throws {ValidationError} if the received value is greater than or equal to the expected maximum value.
|
|
8
|
+
* @example
|
|
9
|
+
* const schema = bigint().custom(bigintMaxExcluded(100n));
|
|
10
|
+
* parseOrFail(schema, 99n); // Valid
|
|
11
|
+
* parseOrFail(schema, 100n); // Throws an error: 'The received value is greater than or equal to expected'
|
|
12
|
+
* parseOrFail(schema, 101n); // Throws an error: 'The received value is greater than or equal to expected'
|
|
13
|
+
*
|
|
14
|
+
* @translation Error Translation Key = 'bi:maxExcluded'
|
|
15
|
+
*/
|
|
16
|
+
declare const bigintMaxExcluded: {
|
|
17
|
+
(expected: bigint): RequiredValidation;
|
|
18
|
+
key: string;
|
|
19
|
+
message: string;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export { bigintMaxExcluded };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { RequiredValidation } from '../../commonTypes.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @description - Asserts that a bigint value is strictly less than a specified maximum value (i.e., the maximum value is excluded).
|
|
5
|
+
* @param {bigint} expected - The maximum allowable value, which is excluded.
|
|
6
|
+
* @returns {RequiredValidation} - A validation function that takes a received bigint and an exception context.
|
|
7
|
+
* @throws {ValidationError} if the received value is greater than or equal to the expected maximum value.
|
|
8
|
+
* @example
|
|
9
|
+
* const schema = bigint().custom(bigintMaxExcluded(100n));
|
|
10
|
+
* parseOrFail(schema, 99n); // Valid
|
|
11
|
+
* parseOrFail(schema, 100n); // Throws an error: 'The received value is greater than or equal to expected'
|
|
12
|
+
* parseOrFail(schema, 101n); // Throws an error: 'The received value is greater than or equal to expected'
|
|
13
|
+
*
|
|
14
|
+
* @translation Error Translation Key = 'bi:maxExcluded'
|
|
15
|
+
*/
|
|
16
|
+
declare const bigintMaxExcluded: {
|
|
17
|
+
(expected: bigint): RequiredValidation;
|
|
18
|
+
key: string;
|
|
19
|
+
message: string;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export { bigintMaxExcluded };
|