bguard 0.2.0 → 0.4.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 +777 -447
- package/lib/CommonSchema-DOh3bsL-.d.ts +110 -0
- package/lib/CommonSchema-wi9MOXGF.d.mts +110 -0
- package/lib/InferType.d.mts +6 -14
- package/lib/InferType.d.ts +6 -14
- package/lib/asserts/array/index.d.mts +6 -5
- package/lib/asserts/array/index.d.ts +6 -5
- package/lib/asserts/array/index.js +8 -6
- package/lib/asserts/array/index.js.map +1 -1
- package/lib/asserts/array/index.mjs +7 -5
- package/lib/asserts/array/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.js +4 -4
- package/lib/asserts/bigint/bigintMax.mjs +2 -2
- package/lib/asserts/bigint/bigintMaxExcluded.js +4 -4
- package/lib/asserts/bigint/bigintMaxExcluded.mjs +2 -2
- package/lib/asserts/bigint/bigintMin.js +4 -4
- package/lib/asserts/bigint/bigintMin.mjs +2 -2
- package/lib/asserts/bigint/bigintMinExcluded.js +4 -4
- package/lib/asserts/bigint/bigintMinExcluded.mjs +2 -2
- package/lib/asserts/bigint/index.d.mts +5 -4
- package/lib/asserts/bigint/index.d.ts +5 -4
- package/lib/asserts/bigint/index.js +11 -10
- package/lib/asserts/bigint/index.js.map +1 -1
- package/lib/asserts/bigint/index.mjs +10 -9
- package/lib/asserts/bigint/index.mjs.map +1 -1
- package/lib/asserts/boolean/index.d.mts +5 -4
- package/lib/asserts/boolean/index.d.ts +5 -4
- package/lib/asserts/boolean/index.js +9 -7
- package/lib/asserts/boolean/index.js.map +1 -1
- package/lib/asserts/boolean/index.mjs +8 -6
- package/lib/asserts/boolean/index.mjs.map +1 -1
- package/lib/asserts/date/dateMax.js +6 -6
- package/lib/asserts/date/dateMax.js.map +1 -1
- package/lib/asserts/date/dateMax.mjs +5 -5
- package/lib/asserts/date/dateMax.mjs.map +1 -1
- package/lib/asserts/date/dateMin.js +6 -6
- package/lib/asserts/date/dateMin.js.map +1 -1
- package/lib/asserts/date/dateMin.mjs +5 -5
- package/lib/asserts/date/dateMin.mjs.map +1 -1
- package/lib/asserts/date/index.d.mts +5 -4
- package/lib/asserts/date/index.d.ts +5 -4
- package/lib/asserts/date/index.js +8 -6
- package/lib/asserts/date/index.js.map +1 -1
- package/lib/asserts/date/index.mjs +7 -5
- package/lib/asserts/date/index.mjs.map +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 +5 -4
- package/lib/asserts/mix/index.d.ts +5 -4
- package/lib/asserts/mix/index.js +7 -5
- package/lib/asserts/mix/index.js.map +1 -1
- package/lib/asserts/mix/index.mjs +6 -4
- package/lib/asserts/mix/index.mjs.map +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 -3
- package/lib/asserts/number/index.d.ts +4 -3
- package/lib/asserts/number/index.js +11 -10
- package/lib/asserts/number/index.js.map +1 -1
- package/lib/asserts/number/index.mjs +10 -9
- 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 +6 -5
- package/lib/asserts/object/index.d.ts +6 -5
- 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/index.mjs.map +1 -1
- package/lib/asserts/object/maxKeys.d.mts +30 -0
- package/lib/asserts/object/maxKeys.d.ts +30 -0
- package/lib/asserts/object/maxKeys.js +23 -0
- package/lib/asserts/object/maxKeys.js.map +1 -0
- package/lib/asserts/object/maxKeys.mjs +23 -0
- package/lib/asserts/object/maxKeys.mjs.map +1 -0
- 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 +5 -4
- package/lib/asserts/string/index.d.ts +5 -4
- package/lib/asserts/string/index.js +11 -10
- package/lib/asserts/string/index.js.map +1 -1
- package/lib/asserts/string/index.mjs +10 -9
- 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-QLVLZRHT.js → chunk-2KQASECD.js} +5 -5
- package/lib/chunk-2KQASECD.js.map +1 -0
- package/lib/{chunk-WK4O3HH4.js → chunk-5P6AZJCN.js} +6 -5
- package/lib/chunk-5P6AZJCN.js.map +1 -0
- package/lib/{chunk-VGF3Y2EK.js → chunk-5WHCMWXK.js} +12 -9
- package/lib/chunk-5WHCMWXK.js.map +1 -0
- package/lib/{chunk-CQWI6YRI.js → chunk-5YYRBKDP.js} +4 -4
- package/lib/{chunk-CQWI6YRI.js.map → chunk-5YYRBKDP.js.map} +1 -1
- package/lib/{chunk-PJI3DRGP.mjs → chunk-6D5W7SSQ.mjs} +4 -4
- package/lib/chunk-6D5W7SSQ.mjs.map +1 -0
- package/lib/chunk-7NBOVYSP.mjs +136 -0
- package/lib/chunk-7NBOVYSP.mjs.map +1 -0
- package/lib/{chunk-XZTZC73V.mjs → chunk-BNCT7NOR.mjs} +36 -14
- package/lib/chunk-BNCT7NOR.mjs.map +1 -0
- package/lib/{chunk-M6OCVAUD.mjs → chunk-C3EDEQ3W.mjs} +3 -3
- package/lib/{chunk-Z7OEFOAD.mjs → chunk-CHUPE6SJ.mjs} +8 -8
- package/lib/chunk-CHUPE6SJ.mjs.map +1 -0
- package/lib/{chunk-4SR7J2I4.js → chunk-ECBOZ3BM.js} +8 -8
- package/lib/chunk-ECBOZ3BM.js.map +1 -0
- package/lib/{chunk-7XFLH6R2.mjs → chunk-FGZKNBDP.mjs} +6 -5
- package/lib/chunk-FGZKNBDP.mjs.map +1 -0
- package/lib/{chunk-TP5I237J.mjs → chunk-FP5QAEVQ.mjs} +14 -12
- package/lib/chunk-FP5QAEVQ.mjs.map +1 -0
- package/lib/{chunk-MTJJKWTP.js → chunk-G55SHHAR.js} +10 -8
- package/lib/chunk-G55SHHAR.js.map +1 -0
- package/lib/{chunk-QV4JDW3T.mjs → chunk-H32B3NHW.mjs} +2 -2
- package/lib/{chunk-54RHVQFA.mjs → chunk-H6LHV3EA.mjs} +2 -2
- package/lib/{chunk-WPHJ4QTB.js → chunk-HP3DRZWK.js} +5 -5
- package/lib/{chunk-WPHJ4QTB.js.map → chunk-HP3DRZWK.js.map} +1 -1
- package/lib/{chunk-4SPM2CSQ.js → chunk-IZ3CBVEE.js} +5 -5
- package/lib/{chunk-4SPM2CSQ.js.map → chunk-IZ3CBVEE.js.map} +1 -1
- package/lib/{chunk-YPAUFM3S.mjs → chunk-K7X6DVM2.mjs} +3 -3
- package/lib/{chunk-PEWNA24X.mjs → chunk-LPR3G5T3.mjs} +4 -4
- package/lib/chunk-LPR3G5T3.mjs.map +1 -0
- package/lib/{chunk-XFR7Y4XX.mjs → chunk-MHBY5OIQ.mjs} +3 -3
- package/lib/chunk-MHBY5OIQ.mjs.map +1 -0
- package/lib/{chunk-5EIBKBYS.js → chunk-MLNQZ445.js} +13 -13
- package/lib/chunk-MLNQZ445.js.map +1 -0
- package/lib/chunk-QIDWASOC.js +14 -0
- package/lib/{chunk-LWAEUS2F.js.map → chunk-QIDWASOC.js.map} +1 -1
- package/lib/chunk-SHJVKSEZ.js +136 -0
- package/lib/chunk-SHJVKSEZ.js.map +1 -0
- package/lib/{chunk-MRWZVTNH.mjs → chunk-TRGMD7LA.mjs} +7 -5
- package/lib/chunk-TRGMD7LA.mjs.map +1 -0
- package/lib/{chunk-5AO66YV5.mjs → chunk-TV5IZY4L.mjs} +9 -6
- package/lib/chunk-TV5IZY4L.mjs.map +1 -0
- package/lib/{chunk-N6YMNLXG.js → chunk-U4USIJV3.js} +11 -11
- package/lib/chunk-U4USIJV3.js.map +1 -0
- package/lib/{chunk-SEIKS6G7.js → chunk-UUY7DPHK.js} +19 -15
- package/lib/chunk-UUY7DPHK.js.map +1 -0
- package/lib/{chunk-356HMXOP.js → chunk-VBTWYDEM.js} +4 -4
- package/lib/chunk-VBTWYDEM.js.map +1 -0
- package/lib/chunk-VW4RMQD4.js +28 -0
- package/lib/chunk-VW4RMQD4.js.map +1 -0
- package/lib/{chunk-UV4I7JZR.mjs → chunk-WK4FJ5GD.mjs} +16 -12
- package/lib/chunk-WK4FJ5GD.mjs.map +1 -0
- package/lib/chunk-X762EUSZ.js +91 -0
- package/lib/chunk-X762EUSZ.js.map +1 -0
- package/lib/{chunk-GDSB7CDN.mjs → chunk-YBVMP4EI.mjs} +4 -4
- package/lib/chunk-YBVMP4EI.mjs.map +1 -0
- package/lib/{chunk-PVOHKGBW.mjs → chunk-YUMUCQKL.mjs} +4 -4
- package/lib/chunk-YUMUCQKL.mjs.map +1 -0
- package/lib/{chunk-32J4WVLE.js → chunk-Z6QU36MM.js} +17 -15
- package/lib/chunk-Z6QU36MM.js.map +1 -0
- package/lib/codeGen.d.mts +2 -1
- package/lib/codeGen.d.ts +2 -1
- package/lib/codeGen.js +4 -4
- package/lib/codeGen.mjs +3 -3
- package/lib/commonTypes.d.mts +26 -2
- package/lib/commonTypes.d.ts +26 -2
- package/lib/exceptions.d.mts +3 -2
- package/lib/exceptions.d.ts +3 -2
- package/lib/exceptions.js +2 -2
- package/lib/exceptions.mjs +1 -1
- package/lib/helpers/core.d.mts +2 -1
- package/lib/helpers/core.d.ts +2 -1
- package/lib/helpers/core.js +4 -4
- package/lib/helpers/core.mjs +3 -3
- 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/setStrictType.d.mts +2 -1
- package/lib/helpers/setStrictType.d.ts +2 -1
- package/lib/helpers/setStrictType.js +5 -5
- package/lib/helpers/setStrictType.mjs +4 -4
- package/lib/index.d.mts +1 -8
- package/lib/index.d.ts +1 -8
- package/lib/index.js +7 -7
- package/lib/index.mjs +6 -6
- package/lib/parse.d.mts +1 -8
- package/lib/parse.d.ts +1 -8
- package/lib/parse.js +6 -6
- package/lib/parse.mjs +5 -5
- package/lib/parseOrFail.d.mts +1 -8
- package/lib/parseOrFail.d.ts +1 -8
- package/lib/parseOrFail.js +6 -6
- package/lib/parseOrFail.mjs +5 -5
- package/lib/schemas/ArraySchema.d.mts +4 -7
- package/lib/schemas/ArraySchema.d.ts +4 -7
- package/lib/schemas/ArraySchema.js +8 -6
- package/lib/schemas/ArraySchema.js.map +1 -1
- package/lib/schemas/ArraySchema.mjs +7 -5
- package/lib/schemas/BigIntSchema.d.mts +8 -10
- package/lib/schemas/BigIntSchema.d.ts +8 -10
- package/lib/schemas/BigIntSchema.js +11 -10
- package/lib/schemas/BigIntSchema.js.map +1 -1
- package/lib/schemas/BigIntSchema.mjs +10 -9
- package/lib/schemas/BooleanSchema.d.mts +7 -10
- package/lib/schemas/BooleanSchema.d.ts +7 -10
- package/lib/schemas/BooleanSchema.js +9 -7
- package/lib/schemas/BooleanSchema.js.map +1 -1
- package/lib/schemas/BooleanSchema.mjs +8 -6
- package/lib/schemas/CommonSchema.d.mts +2 -1
- package/lib/schemas/CommonSchema.d.ts +2 -1
- package/lib/schemas/CommonSchema.js +7 -5
- package/lib/schemas/CommonSchema.js.map +1 -1
- package/lib/schemas/CommonSchema.mjs +6 -4
- package/lib/schemas/DateSchema.d.mts +3 -2
- package/lib/schemas/DateSchema.d.ts +3 -2
- package/lib/schemas/DateSchema.js +8 -6
- package/lib/schemas/DateSchema.js.map +1 -1
- package/lib/schemas/DateSchema.mjs +7 -5
- package/lib/schemas/NumberSchema.d.mts +7 -10
- package/lib/schemas/NumberSchema.d.ts +7 -10
- package/lib/schemas/NumberSchema.js +11 -10
- package/lib/schemas/NumberSchema.js.map +1 -1
- package/lib/schemas/NumberSchema.mjs +10 -9
- package/lib/schemas/ObjectSchema.d.mts +4 -6
- package/lib/schemas/ObjectSchema.d.ts +4 -6
- package/lib/schemas/ObjectSchema.js +8 -6
- package/lib/schemas/ObjectSchema.js.map +1 -1
- package/lib/schemas/ObjectSchema.mjs +7 -5
- package/lib/schemas/StringSchema.d.mts +8 -10
- package/lib/schemas/StringSchema.d.ts +8 -10
- package/lib/schemas/StringSchema.js +11 -10
- package/lib/schemas/StringSchema.js.map +1 -1
- package/lib/schemas/StringSchema.mjs +10 -9
- package/lib/translationMap.js +3 -3
- package/lib/translationMap.mjs +2 -2
- package/package.json +1 -1
- package/lib/CommonSchema-9RtxTxdX.d.ts +0 -63
- package/lib/CommonSchema-DJmQ3F_9.d.mts +0 -63
- package/lib/chunk-2OINKFOA.js +0 -28
- package/lib/chunk-2OINKFOA.js.map +0 -1
- package/lib/chunk-32J4WVLE.js.map +0 -1
- package/lib/chunk-356HMXOP.js.map +0 -1
- package/lib/chunk-4SR7J2I4.js.map +0 -1
- package/lib/chunk-4UF67IQ2.mjs +0 -42
- package/lib/chunk-4UF67IQ2.mjs.map +0 -1
- package/lib/chunk-5AO66YV5.mjs.map +0 -1
- package/lib/chunk-5EIBKBYS.js.map +0 -1
- package/lib/chunk-7GIRQ5EA.js +0 -69
- package/lib/chunk-7GIRQ5EA.js.map +0 -1
- package/lib/chunk-7XFLH6R2.mjs.map +0 -1
- package/lib/chunk-EQNVYAKS.js +0 -42
- package/lib/chunk-EQNVYAKS.js.map +0 -1
- package/lib/chunk-GDSB7CDN.mjs.map +0 -1
- package/lib/chunk-LWAEUS2F.js +0 -14
- package/lib/chunk-MRWZVTNH.mjs.map +0 -1
- package/lib/chunk-MTJJKWTP.js.map +0 -1
- package/lib/chunk-N6YMNLXG.js.map +0 -1
- package/lib/chunk-PEWNA24X.mjs.map +0 -1
- package/lib/chunk-PJI3DRGP.mjs.map +0 -1
- package/lib/chunk-PVOHKGBW.mjs.map +0 -1
- package/lib/chunk-QLVLZRHT.js.map +0 -1
- package/lib/chunk-SEIKS6G7.js.map +0 -1
- package/lib/chunk-TP5I237J.mjs.map +0 -1
- package/lib/chunk-UV4I7JZR.mjs.map +0 -1
- package/lib/chunk-VGF3Y2EK.js.map +0 -1
- package/lib/chunk-WK4O3HH4.js.map +0 -1
- package/lib/chunk-XFR7Y4XX.mjs.map +0 -1
- package/lib/chunk-XZTZC73V.mjs.map +0 -1
- package/lib/chunk-Z7OEFOAD.mjs.map +0 -1
- package/lib/helpers/isValidDate.d.mts +0 -3
- package/lib/helpers/isValidDate.d.ts +0 -3
- package/lib/helpers/isValidDate.js +0 -7
- package/lib/helpers/isValidDate.js.map +0 -1
- package/lib/helpers/isValidDate.mjs +0 -7
- /package/lib/{chunk-M6OCVAUD.mjs.map → chunk-C3EDEQ3W.mjs.map} +0 -0
- /package/lib/{chunk-QV4JDW3T.mjs.map → chunk-H32B3NHW.mjs.map} +0 -0
- /package/lib/{chunk-54RHVQFA.mjs.map → chunk-H6LHV3EA.mjs.map} +0 -0
- /package/lib/{chunk-YPAUFM3S.mjs.map → chunk-K7X6DVM2.mjs.map} +0 -0
- /package/lib/helpers/{isValidDate.mjs.map → isValidDateInner.mjs.map} +0 -0
|
@@ -1,14 +1,16 @@
|
|
|
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 _chunkU4USIJV3js = require('../../chunk-U4USIJV3.js');
|
|
4
|
+
require('../../chunk-SHJVKSEZ.js');
|
|
5
|
+
require('../../chunk-G55SHHAR.js');
|
|
6
|
+
require('../../chunk-X762EUSZ.js');
|
|
7
|
+
require('../../chunk-VBTWYDEM.js');
|
|
8
|
+
require('../../chunk-5YYRBKDP.js');
|
|
9
|
+
require('../../chunk-5P6AZJCN.js');
|
|
8
10
|
|
|
9
11
|
// src/asserts/object/index.ts
|
|
10
12
|
function object(shapeSchema) {
|
|
11
|
-
return new (0,
|
|
13
|
+
return new (0, _chunkU4USIJV3js.ObjectSchema)({ type: [], requiredValidations: [] }, shapeSchema);
|
|
12
14
|
}
|
|
13
15
|
|
|
14
16
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/bguard/bguard/lib/asserts/object/index.js","../../../src/asserts/object/index.ts"],"names":[],"mappings":"AAAA;AACE;AACF,0DAAgC;AAChC,mCAAgC;AAChC,mCAAgC;AAChC,mCAAgC;AAChC,mCAAgC;AAChC;AACA;
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/bguard/bguard/lib/asserts/object/index.js","../../../src/asserts/object/index.ts"],"names":[],"mappings":"AAAA;AACE;AACF,0DAAgC;AAChC,mCAAgC;AAChC,mCAAgC;AAChC,mCAAgC;AAChC,mCAAgC;AAChC,mCAAgC;AAChC,mCAAgC;AAChC;AACA;ACSO,SAAS,MAAA,CAAwC,WAAA,EAA6C;AACnG,EAAA,OAAO,IAAI,kCAAA,CAAa,EAAE,IAAA,EAAM,CAAC,CAAA,EAAG,mBAAA,EAAqB,CAAC,EAAE,CAAA,EAAG,WAAW,CAAA;AAC5E;ADPA;AACE;AACF,wBAAC","file":"/home/runner/work/bguard/bguard/lib/asserts/object/index.js","sourcesContent":[null,"import { WithObject } from '../../commonTypes';\nimport { ObjectShapeSchemaType } from '../../schemas/CommonSchema';\nimport { ObjectSchema } from '../../schemas/ObjectSchema';\n\n/**\n * @description Creates a new schema for validating objects where each property must match the specified schema.\n * @template T\n * @param {T} shapeSchema - The schema that each property of the object must match.\n * @returns {WithObject<ObjectSchema, T>} A new instance of `ObjectSchema` for validating objects with properties matching the specified schema.\n * @example\n * const schema = object({\n * name: string(),\n * age: number()\n * });\n * parseOrFail(schema, { name: 'John', age: 30 }); // Validates successfully\n * parseOrFail(schema, { name: 'John', age: '30' }); // Throws a validation error\n *\n * @instance Of ObjectSchema\n */\nexport function object<T extends ObjectShapeSchemaType>(shapeSchema: T): WithObject<ObjectSchema, T> {\n return new ObjectSchema({ type: [], requiredValidations: [] }, shapeSchema) as WithObject<ObjectSchema, T>;\n}\n"]}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ObjectSchema
|
|
3
|
-
} from "../../chunk-
|
|
4
|
-
import "../../chunk-
|
|
5
|
-
import "../../chunk-
|
|
6
|
-
import "../../chunk-
|
|
7
|
-
import "../../chunk-
|
|
3
|
+
} from "../../chunk-YUMUCQKL.mjs";
|
|
4
|
+
import "../../chunk-7NBOVYSP.mjs";
|
|
5
|
+
import "../../chunk-TRGMD7LA.mjs";
|
|
6
|
+
import "../../chunk-BNCT7NOR.mjs";
|
|
7
|
+
import "../../chunk-YBVMP4EI.mjs";
|
|
8
|
+
import "../../chunk-H32B3NHW.mjs";
|
|
9
|
+
import "../../chunk-FGZKNBDP.mjs";
|
|
8
10
|
|
|
9
11
|
// src/asserts/object/index.ts
|
|
10
12
|
function object(shapeSchema) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/asserts/object/index.ts"],"sourcesContent":["import { ObjectShapeSchemaType } from '../../schemas/CommonSchema';\nimport { ObjectSchema
|
|
1
|
+
{"version":3,"sources":["../../../src/asserts/object/index.ts"],"sourcesContent":["import { WithObject } from '../../commonTypes';\nimport { ObjectShapeSchemaType } from '../../schemas/CommonSchema';\nimport { ObjectSchema } from '../../schemas/ObjectSchema';\n\n/**\n * @description Creates a new schema for validating objects where each property must match the specified schema.\n * @template T\n * @param {T} shapeSchema - The schema that each property of the object must match.\n * @returns {WithObject<ObjectSchema, T>} A new instance of `ObjectSchema` for validating objects with properties matching the specified schema.\n * @example\n * const schema = object({\n * name: string(),\n * age: number()\n * });\n * parseOrFail(schema, { name: 'John', age: 30 }); // Validates successfully\n * parseOrFail(schema, { name: 'John', age: '30' }); // Throws a validation error\n *\n * @instance Of ObjectSchema\n */\nexport function object<T extends ObjectShapeSchemaType>(shapeSchema: T): WithObject<ObjectSchema, T> {\n return new ObjectSchema({ type: [], requiredValidations: [] }, shapeSchema) as WithObject<ObjectSchema, T>;\n}\n"],"mappings":";;;;;;;;;;;AAmBO,SAAS,OAAwC,aAA6C;AACnG,SAAO,IAAI,aAAa,EAAE,MAAM,CAAC,GAAG,qBAAqB,CAAC,EAAE,GAAG,WAAW;AAC5E;","names":[]}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { RequiredValidation } from '../../commonTypes.mjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @description Ensures that the object has no more than the specified number of keys.
|
|
5
|
+
* @param {number} expected - The maximum number of keys allowed in the object.
|
|
6
|
+
* @returns {RequiredValidation} A validation function that takes a received object and an exception context.
|
|
7
|
+
* @throws {ValidationError} if the number of the received keys is greater than the expected value.
|
|
8
|
+
* @example
|
|
9
|
+
* const schema = object({
|
|
10
|
+
* name: string(),
|
|
11
|
+
* email: string(),
|
|
12
|
+
* })
|
|
13
|
+
* .allowUnrecognized()
|
|
14
|
+
* .custom(maxKeys(2));
|
|
15
|
+
*
|
|
16
|
+
* // This will pass
|
|
17
|
+
* parseOrFail(schema, { name: 'John', email: 'john@example.com' });
|
|
18
|
+
*
|
|
19
|
+
* // This will throw an error because there are 3 keys
|
|
20
|
+
* parseOrFail(schema, { name: 'John', email: 'john@example.com', address: '123 Main St' });
|
|
21
|
+
*
|
|
22
|
+
* @translation Error Translation Key = 'o:maxKeys'
|
|
23
|
+
*/
|
|
24
|
+
declare const maxKeys: {
|
|
25
|
+
(expected: number): RequiredValidation;
|
|
26
|
+
key: string;
|
|
27
|
+
message: string;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export { maxKeys };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { RequiredValidation } from '../../commonTypes.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @description Ensures that the object has no more than the specified number of keys.
|
|
5
|
+
* @param {number} expected - The maximum number of keys allowed in the object.
|
|
6
|
+
* @returns {RequiredValidation} A validation function that takes a received object and an exception context.
|
|
7
|
+
* @throws {ValidationError} if the number of the received keys is greater than the expected value.
|
|
8
|
+
* @example
|
|
9
|
+
* const schema = object({
|
|
10
|
+
* name: string(),
|
|
11
|
+
* email: string(),
|
|
12
|
+
* })
|
|
13
|
+
* .allowUnrecognized()
|
|
14
|
+
* .custom(maxKeys(2));
|
|
15
|
+
*
|
|
16
|
+
* // This will pass
|
|
17
|
+
* parseOrFail(schema, { name: 'John', email: 'john@example.com' });
|
|
18
|
+
*
|
|
19
|
+
* // This will throw an error because there are 3 keys
|
|
20
|
+
* parseOrFail(schema, { name: 'John', email: 'john@example.com', address: '123 Main St' });
|
|
21
|
+
*
|
|
22
|
+
* @translation Error Translation Key = 'o:maxKeys'
|
|
23
|
+
*/
|
|
24
|
+
declare const maxKeys: {
|
|
25
|
+
(expected: number): RequiredValidation;
|
|
26
|
+
key: string;
|
|
27
|
+
message: string;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export { maxKeys };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
var _chunk5YYRBKDPjs = require('../../chunk-5YYRBKDP.js');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
var _chunk5P6AZJCNjs = require('../../chunk-5P6AZJCN.js');
|
|
7
|
+
|
|
8
|
+
// src/asserts/object/maxKeys.ts
|
|
9
|
+
var maxKeysErrorMessage = "The received number of keys is greater than expected";
|
|
10
|
+
var maxKeysErrorKey = "o:maxKeys";
|
|
11
|
+
var maxKeys = (expected) => (receivedObject, ctx) => {
|
|
12
|
+
const keysCount = Object.keys(receivedObject).length;
|
|
13
|
+
if (keysCount > expected) {
|
|
14
|
+
_chunk5P6AZJCNjs.guardException.call(void 0, expected, keysCount, ctx, maxKeysErrorKey);
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
maxKeys.key = maxKeysErrorKey;
|
|
18
|
+
maxKeys.message = maxKeysErrorMessage;
|
|
19
|
+
_chunk5YYRBKDPjs.setToDefaultLocale.call(void 0, maxKeys);
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
exports.maxKeys = maxKeys;
|
|
23
|
+
//# sourceMappingURL=maxKeys.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/bguard/bguard/lib/asserts/object/maxKeys.js","../../../src/asserts/object/maxKeys.ts"],"names":[],"mappings":"AAAA;AACE;AACF,0DAAgC;AAChC;AACE;AACF,0DAAgC;AAChC;AACA;ACHA,IAAM,oBAAA,EAAsB,sDAAA;AAC5B,IAAM,gBAAA,EAAkB,WAAA;AAuBjB,IAAM,QAAA,EACX,CAAC,QAAA,EAAA,GACD,CAAC,cAAA,EAAyC,GAAA,EAAA,GAA0B;AAClE,EAAA,MAAM,UAAA,EAAY,MAAA,CAAO,IAAA,CAAK,cAAc,CAAA,CAAE,MAAA;AAC9C,EAAA,GAAA,CAAI,UAAA,EAAY,QAAA,EAAU;AACxB,IAAA,6CAAA,QAAe,EAAU,SAAA,EAAW,GAAA,EAAK,eAAe,CAAA;AAAA,EAC1D;AACF,CAAA;AAEF,OAAA,CAAQ,IAAA,EAAM,eAAA;AACd,OAAA,CAAQ,QAAA,EAAU,mBAAA;AAClB,iDAAA,OAA0B,CAAA;ADpB1B;AACE;AACF,0BAAC","file":"/home/runner/work/bguard/bguard/lib/asserts/object/maxKeys.js","sourcesContent":[null,"import { guardException } from '../../exceptions';\nimport { ExceptionContext, RequiredValidation } from '../../commonTypes';\nimport { setToDefaultLocale } from '../../translationMap';\n\nconst maxKeysErrorMessage = 'The received number of keys is greater than expected';\nconst maxKeysErrorKey = 'o:maxKeys';\n\n/**\n * @description Ensures that the object has no more than the specified number of keys.\n * @param {number} expected - The maximum number of keys allowed in the object.\n * @returns {RequiredValidation} A validation function that takes a received object and an exception context.\n * @throws {ValidationError} if the number of the received keys is greater than the expected value.\n * @example\n * const schema = object({\n * name: string(),\n * email: string(),\n * })\n * .allowUnrecognized()\n * .custom(maxKeys(2));\n *\n * // This will pass\n * parseOrFail(schema, { name: 'John', email: 'john@example.com' });\n *\n * // This will throw an error because there are 3 keys\n * parseOrFail(schema, { name: 'John', email: 'john@example.com', address: '123 Main St' });\n *\n * @translation Error Translation Key = 'o:maxKeys'\n */\nexport const maxKeys =\n (expected: number): RequiredValidation =>\n (receivedObject: Record<string, unknown>, ctx: ExceptionContext) => {\n const keysCount = Object.keys(receivedObject).length;\n if (keysCount > expected) {\n guardException(expected, keysCount, ctx, maxKeysErrorKey);\n }\n };\n\nmaxKeys.key = maxKeysErrorKey;\nmaxKeys.message = maxKeysErrorMessage;\nsetToDefaultLocale(maxKeys);\n"]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import {
|
|
2
|
+
setToDefaultLocale
|
|
3
|
+
} from "../../chunk-H32B3NHW.mjs";
|
|
4
|
+
import {
|
|
5
|
+
guardException
|
|
6
|
+
} from "../../chunk-FGZKNBDP.mjs";
|
|
7
|
+
|
|
8
|
+
// src/asserts/object/maxKeys.ts
|
|
9
|
+
var maxKeysErrorMessage = "The received number of keys is greater than expected";
|
|
10
|
+
var maxKeysErrorKey = "o:maxKeys";
|
|
11
|
+
var maxKeys = (expected) => (receivedObject, ctx) => {
|
|
12
|
+
const keysCount = Object.keys(receivedObject).length;
|
|
13
|
+
if (keysCount > expected) {
|
|
14
|
+
guardException(expected, keysCount, ctx, maxKeysErrorKey);
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
maxKeys.key = maxKeysErrorKey;
|
|
18
|
+
maxKeys.message = maxKeysErrorMessage;
|
|
19
|
+
setToDefaultLocale(maxKeys);
|
|
20
|
+
export {
|
|
21
|
+
maxKeys
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=maxKeys.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/asserts/object/maxKeys.ts"],"sourcesContent":["import { guardException } from '../../exceptions';\nimport { ExceptionContext, RequiredValidation } from '../../commonTypes';\nimport { setToDefaultLocale } from '../../translationMap';\n\nconst maxKeysErrorMessage = 'The received number of keys is greater than expected';\nconst maxKeysErrorKey = 'o:maxKeys';\n\n/**\n * @description Ensures that the object has no more than the specified number of keys.\n * @param {number} expected - The maximum number of keys allowed in the object.\n * @returns {RequiredValidation} A validation function that takes a received object and an exception context.\n * @throws {ValidationError} if the number of the received keys is greater than the expected value.\n * @example\n * const schema = object({\n * name: string(),\n * email: string(),\n * })\n * .allowUnrecognized()\n * .custom(maxKeys(2));\n *\n * // This will pass\n * parseOrFail(schema, { name: 'John', email: 'john@example.com' });\n *\n * // This will throw an error because there are 3 keys\n * parseOrFail(schema, { name: 'John', email: 'john@example.com', address: '123 Main St' });\n *\n * @translation Error Translation Key = 'o:maxKeys'\n */\nexport const maxKeys =\n (expected: number): RequiredValidation =>\n (receivedObject: Record<string, unknown>, ctx: ExceptionContext) => {\n const keysCount = Object.keys(receivedObject).length;\n if (keysCount > expected) {\n guardException(expected, keysCount, ctx, maxKeysErrorKey);\n }\n };\n\nmaxKeys.key = maxKeysErrorKey;\nmaxKeys.message = maxKeysErrorMessage;\nsetToDefaultLocale(maxKeys);\n"],"mappings":";;;;;;;;AAIA,IAAM,sBAAsB;AAC5B,IAAM,kBAAkB;AAuBjB,IAAM,UACX,CAAC,aACD,CAAC,gBAAyC,QAA0B;AAClE,QAAM,YAAY,OAAO,KAAK,cAAc,EAAE;AAC9C,MAAI,YAAY,UAAU;AACxB,mBAAe,UAAU,WAAW,KAAK,eAAe;AAAA,EAC1D;AACF;AAEF,QAAQ,MAAM;AACd,QAAQ,UAAU;AAClB,mBAAmB,OAAO;","names":[]}
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunk5YYRBKDPjs = require('../../chunk-5YYRBKDP.js');
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunk5P6AZJCNjs = require('../../chunk-5P6AZJCN.js');
|
|
7
7
|
|
|
8
8
|
// src/asserts/string/atLeastOneDigit.ts
|
|
9
9
|
var digitRegExp = /\d/;
|
|
10
10
|
var atLeastOneDigitErrorMessage = "The received value does not contain at least one digit";
|
|
11
11
|
var atLeastOneDigitErrorKey = "s:atLeastOneDigit";
|
|
12
12
|
var atLeastOneDigit = () => (received, ctx) => {
|
|
13
|
-
if (!digitRegExp.test(received))
|
|
13
|
+
if (!digitRegExp.test(received)) _chunk5P6AZJCNjs.guardException.call(void 0, "at least one digit", received, ctx, atLeastOneDigitErrorKey);
|
|
14
14
|
};
|
|
15
15
|
atLeastOneDigit.key = atLeastOneDigitErrorKey;
|
|
16
16
|
atLeastOneDigit.message = atLeastOneDigitErrorMessage;
|
|
17
|
-
|
|
17
|
+
_chunk5YYRBKDPjs.setToDefaultLocale.call(void 0, atLeastOneDigit);
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
exports.atLeastOneDigit = atLeastOneDigit;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
setToDefaultLocale
|
|
3
|
-
} from "../../chunk-
|
|
3
|
+
} from "../../chunk-H32B3NHW.mjs";
|
|
4
4
|
import {
|
|
5
5
|
guardException
|
|
6
|
-
} from "../../chunk-
|
|
6
|
+
} from "../../chunk-FGZKNBDP.mjs";
|
|
7
7
|
|
|
8
8
|
// src/asserts/string/atLeastOneDigit.ts
|
|
9
9
|
var digitRegExp = /\d/;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunk5YYRBKDPjs = require('../../chunk-5YYRBKDP.js');
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunk5P6AZJCNjs = require('../../chunk-5P6AZJCN.js');
|
|
7
7
|
|
|
8
8
|
// src/asserts/string/atLeastOneLowerChar.ts
|
|
9
9
|
var atLeastOneLowerCharErrorMessage = "The received value does not contain at least one lowercase character";
|
|
@@ -11,11 +11,11 @@ var atLeastOneLowerCharErrorKey = "s:atLeastOneLowerChar";
|
|
|
11
11
|
var atLeastOneLowerChar = () => (received, ctx) => {
|
|
12
12
|
const lowerCharRegExp = /[a-z]/;
|
|
13
13
|
if (!lowerCharRegExp.test(received))
|
|
14
|
-
|
|
14
|
+
_chunk5P6AZJCNjs.guardException.call(void 0, "at least one lowercase character", received, ctx, atLeastOneLowerCharErrorKey);
|
|
15
15
|
};
|
|
16
16
|
atLeastOneLowerChar.key = atLeastOneLowerCharErrorKey;
|
|
17
17
|
atLeastOneLowerChar.message = atLeastOneLowerCharErrorMessage;
|
|
18
|
-
|
|
18
|
+
_chunk5YYRBKDPjs.setToDefaultLocale.call(void 0, atLeastOneLowerChar);
|
|
19
19
|
|
|
20
20
|
|
|
21
21
|
exports.atLeastOneLowerChar = atLeastOneLowerChar;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
setToDefaultLocale
|
|
3
|
-
} from "../../chunk-
|
|
3
|
+
} from "../../chunk-H32B3NHW.mjs";
|
|
4
4
|
import {
|
|
5
5
|
guardException
|
|
6
|
-
} from "../../chunk-
|
|
6
|
+
} from "../../chunk-FGZKNBDP.mjs";
|
|
7
7
|
|
|
8
8
|
// src/asserts/string/atLeastOneLowerChar.ts
|
|
9
9
|
var atLeastOneLowerCharErrorMessage = "The received value does not contain at least one lowercase character";
|
|
@@ -1,9 +1,9 @@
|
|
|
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 _chunk5YYRBKDPjs = require('../../chunk-5YYRBKDP.js');
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunk5P6AZJCNjs = require('../../chunk-5P6AZJCN.js');
|
|
7
7
|
|
|
8
8
|
// src/asserts/string/atLeastOneSpecialChar.ts
|
|
9
9
|
var atLeastOneSpecialCharErrorMessage = "The received value does not contain at least one special character";
|
|
@@ -14,12 +14,12 @@ var atLeastOneSpecialChar = (allowedSpecialChars) => {
|
|
|
14
14
|
);
|
|
15
15
|
return (received, ctx) => {
|
|
16
16
|
if (!specialCharRegExp.test(received))
|
|
17
|
-
|
|
17
|
+
_chunk5P6AZJCNjs.guardException.call(void 0, "special character", received, ctx, atLeastOneSpecialCharErrorKey);
|
|
18
18
|
};
|
|
19
19
|
};
|
|
20
20
|
atLeastOneSpecialChar.key = atLeastOneSpecialCharErrorKey;
|
|
21
21
|
atLeastOneSpecialChar.message = atLeastOneSpecialCharErrorMessage;
|
|
22
|
-
|
|
22
|
+
_chunk5YYRBKDPjs.setToDefaultLocale.call(void 0, atLeastOneSpecialChar);
|
|
23
23
|
|
|
24
24
|
|
|
25
25
|
exports.atLeastOneSpecialChar = atLeastOneSpecialChar;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
setToDefaultLocale
|
|
3
|
-
} from "../../chunk-
|
|
3
|
+
} from "../../chunk-H32B3NHW.mjs";
|
|
4
4
|
import {
|
|
5
5
|
guardException
|
|
6
|
-
} from "../../chunk-
|
|
6
|
+
} from "../../chunk-FGZKNBDP.mjs";
|
|
7
7
|
|
|
8
8
|
// src/asserts/string/atLeastOneSpecialChar.ts
|
|
9
9
|
var atLeastOneSpecialCharErrorMessage = "The received value does not contain at least one special character";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunk5YYRBKDPjs = require('../../chunk-5YYRBKDP.js');
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunk5P6AZJCNjs = require('../../chunk-5P6AZJCN.js');
|
|
7
7
|
|
|
8
8
|
// src/asserts/string/atLeastOneUpperChar.ts
|
|
9
9
|
var atLeastOneUpperCharErrorMessage = "The received value does not contain at least one uppercase character";
|
|
@@ -11,11 +11,11 @@ var atLeastOneUpperCharErrorKey = "s:atLeastOneUpperChar";
|
|
|
11
11
|
var atLeastOneUpperChar = () => (received, ctx) => {
|
|
12
12
|
const upperCharRegExp = /[A-Z]/;
|
|
13
13
|
if (!upperCharRegExp.test(received))
|
|
14
|
-
|
|
14
|
+
_chunk5P6AZJCNjs.guardException.call(void 0, "at least one uppercase character", received, ctx, atLeastOneUpperCharErrorKey);
|
|
15
15
|
};
|
|
16
16
|
atLeastOneUpperChar.key = atLeastOneUpperCharErrorKey;
|
|
17
17
|
atLeastOneUpperChar.message = atLeastOneUpperCharErrorMessage;
|
|
18
|
-
|
|
18
|
+
_chunk5YYRBKDPjs.setToDefaultLocale.call(void 0, atLeastOneUpperChar);
|
|
19
19
|
|
|
20
20
|
|
|
21
21
|
exports.atLeastOneUpperChar = atLeastOneUpperChar;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
setToDefaultLocale
|
|
3
|
-
} from "../../chunk-
|
|
3
|
+
} from "../../chunk-H32B3NHW.mjs";
|
|
4
4
|
import {
|
|
5
5
|
guardException
|
|
6
|
-
} from "../../chunk-
|
|
6
|
+
} from "../../chunk-FGZKNBDP.mjs";
|
|
7
7
|
|
|
8
8
|
// src/asserts/string/atLeastOneUpperChar.ts
|
|
9
9
|
var atLeastOneUpperCharErrorMessage = "The received value does not contain at least one uppercase character";
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunk5YYRBKDPjs = require('../../chunk-5YYRBKDP.js');
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunk5P6AZJCNjs = require('../../chunk-5P6AZJCN.js');
|
|
7
7
|
|
|
8
8
|
// src/asserts/string/contains.ts
|
|
9
9
|
var containsErrorMessage = "The received value does not contain the required substring";
|
|
10
10
|
var containsErrorKey = "s:contains";
|
|
11
11
|
var contains = (substring) => (received, ctx) => {
|
|
12
12
|
if (!received.includes(substring)) {
|
|
13
|
-
|
|
13
|
+
_chunk5P6AZJCNjs.guardException.call(void 0, `contains '${substring}'`, received, ctx, containsErrorKey);
|
|
14
14
|
}
|
|
15
15
|
};
|
|
16
16
|
contains.key = containsErrorKey;
|
|
17
17
|
contains.message = containsErrorMessage;
|
|
18
|
-
|
|
18
|
+
_chunk5YYRBKDPjs.setToDefaultLocale.call(void 0, contains);
|
|
19
19
|
|
|
20
20
|
|
|
21
21
|
exports.contains = contains;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
setToDefaultLocale
|
|
3
|
-
} from "../../chunk-
|
|
3
|
+
} from "../../chunk-H32B3NHW.mjs";
|
|
4
4
|
import {
|
|
5
5
|
guardException
|
|
6
|
-
} from "../../chunk-
|
|
6
|
+
} from "../../chunk-FGZKNBDP.mjs";
|
|
7
7
|
|
|
8
8
|
// src/asserts/string/contains.ts
|
|
9
9
|
var containsErrorMessage = "The received value does not contain the required substring";
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunk5YYRBKDPjs = require('../../chunk-5YYRBKDP.js');
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunk5P6AZJCNjs = require('../../chunk-5P6AZJCN.js');
|
|
7
7
|
|
|
8
8
|
// src/asserts/string/email.ts
|
|
9
9
|
var emailRegExp = /^[^@]+@[^@]+\.[^@]+$/;
|
|
10
10
|
var emailErrorMessage = "The received value does not match the required email pattern";
|
|
11
11
|
var emailErrorKey = "s:email";
|
|
12
12
|
var email = () => (received, ctx) => {
|
|
13
|
-
if (!emailRegExp.test(received))
|
|
13
|
+
if (!emailRegExp.test(received)) _chunk5P6AZJCNjs.guardException.call(void 0, emailRegExp, received, ctx, emailErrorMessage);
|
|
14
14
|
};
|
|
15
15
|
email.key = emailErrorKey;
|
|
16
16
|
email.message = emailErrorMessage;
|
|
17
|
-
|
|
17
|
+
_chunk5YYRBKDPjs.setToDefaultLocale.call(void 0, email);
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
exports.email = email;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
setToDefaultLocale
|
|
3
|
-
} from "../../chunk-
|
|
3
|
+
} from "../../chunk-H32B3NHW.mjs";
|
|
4
4
|
import {
|
|
5
5
|
guardException
|
|
6
|
-
} from "../../chunk-
|
|
6
|
+
} from "../../chunk-FGZKNBDP.mjs";
|
|
7
7
|
|
|
8
8
|
// src/asserts/string/email.ts
|
|
9
9
|
var emailRegExp = /^[^@]+@[^@]+\.[^@]+$/;
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunk5YYRBKDPjs = require('../../chunk-5YYRBKDP.js');
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunk5P6AZJCNjs = require('../../chunk-5P6AZJCN.js');
|
|
7
7
|
|
|
8
8
|
// src/asserts/string/endsWith.ts
|
|
9
9
|
var endsWithErrorMessage = "The received value does not end with the required substring";
|
|
10
10
|
var endsWithErrorKey = "s:endsWith";
|
|
11
11
|
var endsWith = (substring) => (received, ctx) => {
|
|
12
12
|
if (!received.endsWith(substring)) {
|
|
13
|
-
|
|
13
|
+
_chunk5P6AZJCNjs.guardException.call(void 0, `ends with '${substring}'`, received, ctx, endsWithErrorKey);
|
|
14
14
|
}
|
|
15
15
|
};
|
|
16
16
|
endsWith.key = endsWithErrorKey;
|
|
17
17
|
endsWith.message = endsWithErrorMessage;
|
|
18
|
-
|
|
18
|
+
_chunk5YYRBKDPjs.setToDefaultLocale.call(void 0, endsWith);
|
|
19
19
|
|
|
20
20
|
|
|
21
21
|
exports.endsWith = endsWith;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
setToDefaultLocale
|
|
3
|
-
} from "../../chunk-
|
|
3
|
+
} from "../../chunk-H32B3NHW.mjs";
|
|
4
4
|
import {
|
|
5
5
|
guardException
|
|
6
|
-
} from "../../chunk-
|
|
6
|
+
} from "../../chunk-FGZKNBDP.mjs";
|
|
7
7
|
|
|
8
8
|
// src/asserts/string/endsWith.ts
|
|
9
9
|
var endsWithErrorMessage = "The received value does not end with the required substring";
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import { WithBGuardType } from '../../commonTypes.mjs';
|
|
1
2
|
import { StringSchema } from '../../schemas/StringSchema.mjs';
|
|
2
|
-
import '../../CommonSchema-
|
|
3
|
-
import '../../
|
|
3
|
+
import '../../CommonSchema-wi9MOXGF.mjs';
|
|
4
|
+
import '../../InferType.mjs';
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* @description Creates a new schema for validating string values.
|
|
7
|
-
* @returns {StringSchema} A new instance of `StringSchema` for validating strings.
|
|
8
|
+
* @returns {WithBGuardType<StringSchema, string>} A new instance of `StringSchema` for validating strings.
|
|
8
9
|
* @example
|
|
9
10
|
* const schema = string();
|
|
10
11
|
* parseOrFail(schema, 'hello'); // Validates successfully
|
|
@@ -12,6 +13,6 @@ import '../../commonTypes.mjs';
|
|
|
12
13
|
*
|
|
13
14
|
* @instance Of StringSchema
|
|
14
15
|
*/
|
|
15
|
-
declare function string(): StringSchema
|
|
16
|
+
declare function string(): WithBGuardType<StringSchema, string>;
|
|
16
17
|
|
|
17
18
|
export { string };
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import { WithBGuardType } from '../../commonTypes.js';
|
|
1
2
|
import { StringSchema } from '../../schemas/StringSchema.js';
|
|
2
|
-
import '../../CommonSchema-
|
|
3
|
-
import '../../
|
|
3
|
+
import '../../CommonSchema-DOh3bsL-.js';
|
|
4
|
+
import '../../InferType.js';
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* @description Creates a new schema for validating string values.
|
|
7
|
-
* @returns {StringSchema} A new instance of `StringSchema` for validating strings.
|
|
8
|
+
* @returns {WithBGuardType<StringSchema, string>} A new instance of `StringSchema` for validating strings.
|
|
8
9
|
* @example
|
|
9
10
|
* const schema = string();
|
|
10
11
|
* parseOrFail(schema, 'hello'); // Validates successfully
|
|
@@ -12,6 +13,6 @@ import '../../commonTypes.js';
|
|
|
12
13
|
*
|
|
13
14
|
* @instance Of StringSchema
|
|
14
15
|
*/
|
|
15
|
-
declare function string(): StringSchema
|
|
16
|
+
declare function string(): WithBGuardType<StringSchema, string>;
|
|
16
17
|
|
|
17
18
|
export { string };
|
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('../../chunk-
|
|
5
|
-
require('../../chunk-
|
|
3
|
+
var _chunkZ6QU36MMjs = require('../../chunk-Z6QU36MM.js');
|
|
4
|
+
require('../../chunk-HP3DRZWK.js');
|
|
5
|
+
require('../../chunk-IZ3CBVEE.js');
|
|
6
6
|
require('../../chunk-42J6CHIO.js');
|
|
7
|
-
require('../../chunk-
|
|
8
|
-
require('../../chunk-
|
|
9
|
-
require('../../chunk-
|
|
10
|
-
require('../../chunk-
|
|
11
|
-
require('../../chunk-
|
|
12
|
-
require('../../chunk-
|
|
7
|
+
require('../../chunk-QIDWASOC.js');
|
|
8
|
+
require('../../chunk-SHJVKSEZ.js');
|
|
9
|
+
require('../../chunk-G55SHHAR.js');
|
|
10
|
+
require('../../chunk-X762EUSZ.js');
|
|
11
|
+
require('../../chunk-VBTWYDEM.js');
|
|
12
|
+
require('../../chunk-5YYRBKDP.js');
|
|
13
|
+
require('../../chunk-5P6AZJCN.js');
|
|
13
14
|
|
|
14
15
|
// src/asserts/string/index.ts
|
|
15
16
|
function string() {
|
|
16
|
-
return new (0,
|
|
17
|
+
return new (0, _chunkZ6QU36MMjs.StringSchema)({ type: ["string"], requiredValidations: [] });
|
|
17
18
|
}
|
|
18
19
|
|
|
19
20
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/bguard/bguard/lib/asserts/string/index.js","../../../src/asserts/string/index.ts"],"names":[],"mappings":"AAAA;AACE;AACF,0DAAgC;AAChC,mCAAgC;AAChC,mCAAgC;AAChC,mCAAgC;AAChC,mCAAgC;AAChC,mCAAgC;AAChC,mCAAgC;AAChC,mCAAgC;AAChC,mCAAgC;AAChC,mCAAgC;AAChC;AACA;ACDO,SAAS,MAAA,CAAA,
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/bguard/bguard/lib/asserts/string/index.js","../../../src/asserts/string/index.ts"],"names":[],"mappings":"AAAA;AACE;AACF,0DAAgC;AAChC,mCAAgC;AAChC,mCAAgC;AAChC,mCAAgC;AAChC,mCAAgC;AAChC,mCAAgC;AAChC,mCAAgC;AAChC,mCAAgC;AAChC,mCAAgC;AAChC,mCAAgC;AAChC,mCAAgC;AAChC;AACA;ACDO,SAAS,MAAA,CAAA,EAA+C;AAC7D,EAAA,OAAO,IAAI,kCAAA,CAAa,EAAE,IAAA,EAAM,CAAC,QAAQ,CAAA,EAAG,mBAAA,EAAqB,CAAC,EAAE,CAAC,CAAA;AACvE;ADGA;AACE;AACF,wBAAC","file":"/home/runner/work/bguard/bguard/lib/asserts/string/index.js","sourcesContent":[null,"import { WithBGuardType } from '../../commonTypes';\nimport { StringSchema } from '../../schemas/StringSchema';\n\n/**\n * @description Creates a new schema for validating string values.\n * @returns {WithBGuardType<StringSchema, string>} A new instance of `StringSchema` for validating strings.\n * @example\n * const schema = string();\n * parseOrFail(schema, 'hello'); // Validates successfully\n * parseOrFail(schema, 123); // Throws a validation error\n *\n * @instance Of StringSchema\n */\nexport function string(): WithBGuardType<StringSchema, string> {\n return new StringSchema({ type: ['string'], requiredValidations: [] }) as WithBGuardType<StringSchema, string>;\n}\n"]}
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
2
|
StringSchema
|
|
3
|
-
} from "../../chunk-
|
|
4
|
-
import "../../chunk-
|
|
5
|
-
import "../../chunk-
|
|
3
|
+
} from "../../chunk-FP5QAEVQ.mjs";
|
|
4
|
+
import "../../chunk-C3EDEQ3W.mjs";
|
|
5
|
+
import "../../chunk-K7X6DVM2.mjs";
|
|
6
6
|
import "../../chunk-ASZW6XRM.mjs";
|
|
7
|
-
import "../../chunk-
|
|
8
|
-
import "../../chunk-
|
|
9
|
-
import "../../chunk-
|
|
10
|
-
import "../../chunk-
|
|
11
|
-
import "../../chunk-
|
|
12
|
-
import "../../chunk-
|
|
7
|
+
import "../../chunk-H6LHV3EA.mjs";
|
|
8
|
+
import "../../chunk-7NBOVYSP.mjs";
|
|
9
|
+
import "../../chunk-TRGMD7LA.mjs";
|
|
10
|
+
import "../../chunk-BNCT7NOR.mjs";
|
|
11
|
+
import "../../chunk-YBVMP4EI.mjs";
|
|
12
|
+
import "../../chunk-H32B3NHW.mjs";
|
|
13
|
+
import "../../chunk-FGZKNBDP.mjs";
|
|
13
14
|
|
|
14
15
|
// src/asserts/string/index.ts
|
|
15
16
|
function string() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/asserts/string/index.ts"],"sourcesContent":["import { StringSchema } from '../../schemas/StringSchema';\n\n/**\n * @description Creates a new schema for validating string values.\n * @returns {StringSchema} A new instance of `StringSchema` for validating strings.\n * @example\n * const schema = string();\n * parseOrFail(schema, 'hello'); // Validates successfully\n * parseOrFail(schema, 123); // Throws a validation error\n *\n * @instance Of StringSchema\n */\nexport function string(): StringSchema {\n return new StringSchema({ type: ['string'], requiredValidations: [] })
|
|
1
|
+
{"version":3,"sources":["../../../src/asserts/string/index.ts"],"sourcesContent":["import { WithBGuardType } from '../../commonTypes';\nimport { StringSchema } from '../../schemas/StringSchema';\n\n/**\n * @description Creates a new schema for validating string values.\n * @returns {WithBGuardType<StringSchema, string>} A new instance of `StringSchema` for validating strings.\n * @example\n * const schema = string();\n * parseOrFail(schema, 'hello'); // Validates successfully\n * parseOrFail(schema, 123); // Throws a validation error\n *\n * @instance Of StringSchema\n */\nexport function string(): WithBGuardType<StringSchema, string> {\n return new StringSchema({ type: ['string'], requiredValidations: [] }) as WithBGuardType<StringSchema, string>;\n}\n"],"mappings":";;;;;;;;;;;;;;;AAaO,SAAS,SAA+C;AAC7D,SAAO,IAAI,aAAa,EAAE,MAAM,CAAC,QAAQ,GAAG,qBAAqB,CAAC,EAAE,CAAC;AACvE;","names":[]}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { RequiredValidation } from '../../commonTypes.mjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @description Asserts that a string is a valid date in the format YYYY-MM-DD.
|
|
5
|
+
* @returns {RequiredValidation} A validation function that takes a received string and an exception context.
|
|
6
|
+
* @throws {ValidationError} if the received string is not a valid date.
|
|
7
|
+
* @example
|
|
8
|
+
* const schema = string().custom(isValidDate());
|
|
9
|
+
* parseOrFail(schema, "2020-01-01"); // Valid
|
|
10
|
+
* parseOrFail(schema, "2020-1-1"); // Throws an error: 'The received value is not a valid date'
|
|
11
|
+
* parseOrFail(schema, "2020-01-32"); // Throws an error: 'The received value is not a valid date'
|
|
12
|
+
*
|
|
13
|
+
* @translation Error Translation Key = 's:isValidDate'
|
|
14
|
+
*/
|
|
15
|
+
declare const isValidDate: {
|
|
16
|
+
(): RequiredValidation;
|
|
17
|
+
key: string;
|
|
18
|
+
message: string;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export { isValidDate };
|