bguard 0.5.0 → 0.6.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 +72 -2
- package/lib/InferType.d.mts +1 -1
- package/lib/InferType.d.ts +1 -1
- package/lib/asserts/array/index.d.mts +7 -3
- package/lib/asserts/array/index.d.ts +7 -3
- package/lib/asserts/array/index.js +5 -11
- package/lib/asserts/array/index.js.map +1 -1
- package/lib/asserts/array/index.mjs +5 -11
- package/lib/asserts/array/index.mjs.map +1 -1
- package/lib/asserts/array/maxArrayLength.d.mts +3 -1
- package/lib/asserts/array/maxArrayLength.d.ts +3 -1
- package/lib/asserts/array/maxArrayLength.js +3 -12
- package/lib/asserts/array/maxArrayLength.js.map +1 -1
- package/lib/asserts/array/maxArrayLength.mjs +3 -12
- package/lib/asserts/array/maxArrayLength.mjs.map +1 -1
- package/lib/asserts/array/minArrayLength.d.mts +3 -1
- package/lib/asserts/array/minArrayLength.d.ts +3 -1
- package/lib/asserts/array/minArrayLength.js +3 -12
- package/lib/asserts/array/minArrayLength.js.map +1 -1
- package/lib/asserts/array/minArrayLength.mjs +3 -12
- package/lib/asserts/array/minArrayLength.mjs.map +1 -1
- package/lib/asserts/bigint/bigintMax.d.mts +3 -1
- package/lib/asserts/bigint/bigintMax.d.ts +3 -1
- package/lib/asserts/bigint/bigintMax.js +3 -12
- package/lib/asserts/bigint/bigintMax.js.map +1 -1
- package/lib/asserts/bigint/bigintMax.mjs +3 -12
- package/lib/asserts/bigint/bigintMax.mjs.map +1 -1
- package/lib/asserts/bigint/bigintMaxExcluded.d.mts +3 -1
- package/lib/asserts/bigint/bigintMaxExcluded.d.ts +3 -1
- package/lib/asserts/bigint/bigintMaxExcluded.js +3 -12
- package/lib/asserts/bigint/bigintMaxExcluded.js.map +1 -1
- package/lib/asserts/bigint/bigintMaxExcluded.mjs +3 -12
- package/lib/asserts/bigint/bigintMaxExcluded.mjs.map +1 -1
- package/lib/asserts/bigint/bigintMin.d.mts +3 -1
- package/lib/asserts/bigint/bigintMin.d.ts +3 -1
- package/lib/asserts/bigint/bigintMin.js +3 -12
- package/lib/asserts/bigint/bigintMin.js.map +1 -1
- package/lib/asserts/bigint/bigintMin.mjs +3 -12
- package/lib/asserts/bigint/bigintMin.mjs.map +1 -1
- package/lib/asserts/bigint/bigintMinExcluded.d.mts +3 -1
- package/lib/asserts/bigint/bigintMinExcluded.d.ts +3 -1
- package/lib/asserts/bigint/bigintMinExcluded.js +3 -12
- package/lib/asserts/bigint/bigintMinExcluded.js.map +1 -1
- package/lib/asserts/bigint/bigintMinExcluded.mjs +3 -12
- package/lib/asserts/bigint/bigintMinExcluded.mjs.map +1 -1
- package/lib/asserts/bigint/index.d.mts +30 -4
- package/lib/asserts/bigint/index.d.ts +30 -4
- package/lib/asserts/bigint/index.js +8 -15
- package/lib/asserts/bigint/index.js.map +1 -1
- package/lib/asserts/bigint/index.mjs +8 -15
- package/lib/asserts/bigint/index.mjs.map +1 -1
- package/lib/asserts/boolean/index.d.mts +25 -3
- package/lib/asserts/boolean/index.d.ts +25 -3
- package/lib/asserts/boolean/index.js +6 -12
- package/lib/asserts/boolean/index.js.map +1 -1
- package/lib/asserts/boolean/index.mjs +6 -12
- package/lib/asserts/boolean/index.mjs.map +1 -1
- package/lib/asserts/date/dateMax.d.mts +3 -1
- package/lib/asserts/date/dateMax.d.ts +3 -1
- package/lib/asserts/date/dateMax.js +5 -22
- package/lib/asserts/date/dateMax.js.map +1 -1
- package/lib/asserts/date/dateMax.mjs +5 -22
- package/lib/asserts/date/dateMax.mjs.map +1 -1
- package/lib/asserts/date/dateMin.d.mts +3 -1
- package/lib/asserts/date/dateMin.d.ts +3 -1
- package/lib/asserts/date/dateMin.js +5 -22
- package/lib/asserts/date/dateMin.js.map +1 -1
- package/lib/asserts/date/dateMin.mjs +5 -22
- package/lib/asserts/date/dateMin.mjs.map +1 -1
- package/lib/asserts/date/index.d.mts +6 -3
- package/lib/asserts/date/index.d.ts +6 -3
- package/lib/asserts/date/index.js +5 -11
- package/lib/asserts/date/index.js.map +1 -1
- package/lib/asserts/date/index.mjs +5 -11
- package/lib/asserts/date/index.mjs.map +1 -1
- package/lib/asserts/mix/equalTo.d.mts +3 -1
- package/lib/asserts/mix/equalTo.d.ts +3 -1
- package/lib/asserts/mix/equalTo.js +3 -3
- package/lib/asserts/mix/equalTo.mjs +2 -2
- package/lib/asserts/mix/index.d.mts +3 -4
- package/lib/asserts/mix/index.d.ts +3 -4
- package/lib/asserts/mix/index.js +5 -10
- package/lib/asserts/mix/index.js.map +1 -1
- package/lib/asserts/mix/index.mjs +5 -10
- package/lib/asserts/mix/index.mjs.map +1 -1
- package/lib/asserts/mix/oneOfValues.d.mts +3 -1
- package/lib/asserts/mix/oneOfValues.d.ts +3 -1
- package/lib/asserts/mix/oneOfValues.js +3 -3
- package/lib/asserts/mix/oneOfValues.mjs +2 -2
- package/lib/asserts/number/index.d.mts +28 -3
- package/lib/asserts/number/index.d.ts +28 -3
- package/lib/asserts/number/index.js +8 -15
- package/lib/asserts/number/index.js.map +1 -1
- package/lib/asserts/number/index.mjs +8 -15
- package/lib/asserts/number/index.mjs.map +1 -1
- package/lib/asserts/number/max.d.mts +3 -1
- package/lib/asserts/number/max.d.ts +3 -1
- package/lib/asserts/number/max.js +3 -12
- package/lib/asserts/number/max.js.map +1 -1
- package/lib/asserts/number/max.mjs +3 -12
- package/lib/asserts/number/max.mjs.map +1 -1
- package/lib/asserts/number/maxExcluded.d.mts +3 -1
- package/lib/asserts/number/maxExcluded.d.ts +3 -1
- package/lib/asserts/number/maxExcluded.js +3 -12
- package/lib/asserts/number/maxExcluded.js.map +1 -1
- package/lib/asserts/number/maxExcluded.mjs +3 -12
- package/lib/asserts/number/maxExcluded.mjs.map +1 -1
- package/lib/asserts/number/min.d.mts +3 -1
- package/lib/asserts/number/min.d.ts +3 -1
- package/lib/asserts/number/min.js +3 -12
- package/lib/asserts/number/min.js.map +1 -1
- package/lib/asserts/number/min.mjs +3 -12
- package/lib/asserts/number/min.mjs.map +1 -1
- package/lib/asserts/number/minExcluded.d.mts +3 -1
- package/lib/asserts/number/minExcluded.d.ts +3 -1
- package/lib/asserts/number/minExcluded.js +3 -12
- package/lib/asserts/number/minExcluded.js.map +1 -1
- package/lib/asserts/number/minExcluded.mjs +3 -12
- package/lib/asserts/number/minExcluded.mjs.map +1 -1
- package/lib/asserts/number/negative.d.mts +3 -1
- package/lib/asserts/number/negative.d.ts +3 -1
- package/lib/asserts/number/negative.js +3 -12
- package/lib/asserts/number/negative.js.map +1 -1
- package/lib/asserts/number/negative.mjs +3 -12
- package/lib/asserts/number/negative.mjs.map +1 -1
- package/lib/asserts/number/positive.d.mts +3 -1
- package/lib/asserts/number/positive.d.ts +3 -1
- package/lib/asserts/number/positive.js +3 -12
- package/lib/asserts/number/positive.js.map +1 -1
- package/lib/asserts/number/positive.mjs +3 -12
- package/lib/asserts/number/positive.mjs.map +1 -1
- package/lib/asserts/object/index.d.mts +26 -3
- package/lib/asserts/object/index.d.ts +26 -3
- package/lib/asserts/object/index.js +5 -11
- package/lib/asserts/object/index.js.map +1 -1
- package/lib/asserts/object/index.mjs +5 -11
- package/lib/asserts/object/index.mjs.map +1 -1
- package/lib/asserts/object/maxKeys.d.mts +3 -1
- package/lib/asserts/object/maxKeys.d.ts +3 -1
- package/lib/asserts/object/maxKeys.js +3 -15
- package/lib/asserts/object/maxKeys.js.map +1 -1
- package/lib/asserts/object/maxKeys.mjs +3 -15
- package/lib/asserts/object/maxKeys.mjs.map +1 -1
- package/lib/asserts/string/atLeastOneDigit.d.mts +3 -1
- package/lib/asserts/string/atLeastOneDigit.d.ts +3 -1
- package/lib/asserts/string/atLeastOneDigit.js +3 -13
- package/lib/asserts/string/atLeastOneDigit.js.map +1 -1
- package/lib/asserts/string/atLeastOneDigit.mjs +3 -13
- package/lib/asserts/string/atLeastOneDigit.mjs.map +1 -1
- package/lib/asserts/string/atLeastOneLowerChar.d.mts +3 -1
- package/lib/asserts/string/atLeastOneLowerChar.d.ts +3 -1
- package/lib/asserts/string/atLeastOneLowerChar.js +3 -14
- package/lib/asserts/string/atLeastOneLowerChar.js.map +1 -1
- package/lib/asserts/string/atLeastOneLowerChar.mjs +3 -14
- package/lib/asserts/string/atLeastOneLowerChar.mjs.map +1 -1
- package/lib/asserts/string/atLeastOneSpecialChar.d.mts +3 -1
- package/lib/asserts/string/atLeastOneSpecialChar.d.ts +3 -1
- package/lib/asserts/string/atLeastOneSpecialChar.js +4 -18
- package/lib/asserts/string/atLeastOneSpecialChar.js.map +1 -1
- package/lib/asserts/string/atLeastOneSpecialChar.mjs +3 -17
- package/lib/asserts/string/atLeastOneSpecialChar.mjs.map +1 -1
- package/lib/asserts/string/atLeastOneUpperChar.d.mts +3 -1
- package/lib/asserts/string/atLeastOneUpperChar.d.ts +3 -1
- package/lib/asserts/string/atLeastOneUpperChar.js +3 -14
- package/lib/asserts/string/atLeastOneUpperChar.js.map +1 -1
- package/lib/asserts/string/atLeastOneUpperChar.mjs +3 -14
- package/lib/asserts/string/atLeastOneUpperChar.mjs.map +1 -1
- package/lib/asserts/string/contains.d.mts +3 -1
- package/lib/asserts/string/contains.d.ts +3 -1
- package/lib/asserts/string/contains.js +3 -14
- package/lib/asserts/string/contains.js.map +1 -1
- package/lib/asserts/string/contains.mjs +3 -14
- package/lib/asserts/string/contains.mjs.map +1 -1
- package/lib/asserts/string/email.d.mts +3 -1
- package/lib/asserts/string/email.d.ts +3 -1
- package/lib/asserts/string/email.js +3 -13
- package/lib/asserts/string/email.js.map +1 -1
- package/lib/asserts/string/email.mjs +3 -13
- package/lib/asserts/string/email.mjs.map +1 -1
- package/lib/asserts/string/endsWith.d.mts +3 -1
- package/lib/asserts/string/endsWith.d.ts +3 -1
- package/lib/asserts/string/endsWith.js +3 -14
- package/lib/asserts/string/endsWith.js.map +1 -1
- package/lib/asserts/string/endsWith.mjs +3 -14
- package/lib/asserts/string/endsWith.mjs.map +1 -1
- package/lib/asserts/string/index.d.mts +29 -3
- package/lib/asserts/string/index.d.ts +29 -3
- package/lib/asserts/string/index.js +8 -15
- package/lib/asserts/string/index.js.map +1 -1
- package/lib/asserts/string/index.mjs +8 -15
- package/lib/asserts/string/index.mjs.map +1 -1
- package/lib/asserts/string/isValidDate.d.mts +3 -1
- package/lib/asserts/string/isValidDate.d.ts +3 -1
- package/lib/asserts/string/isValidDate.js +3 -17
- package/lib/asserts/string/isValidDate.js.map +1 -1
- package/lib/asserts/string/isValidDate.mjs +3 -17
- package/lib/asserts/string/isValidDate.mjs.map +1 -1
- package/lib/asserts/string/isValidDateTime.d.mts +3 -1
- package/lib/asserts/string/isValidDateTime.d.ts +3 -1
- package/lib/asserts/string/isValidDateTime.js +3 -24
- package/lib/asserts/string/isValidDateTime.js.map +1 -1
- package/lib/asserts/string/isValidDateTime.mjs +3 -24
- package/lib/asserts/string/isValidDateTime.mjs.map +1 -1
- package/lib/asserts/string/isValidTime.d.mts +3 -1
- package/lib/asserts/string/isValidTime.d.ts +3 -1
- package/lib/asserts/string/isValidTime.js +3 -24
- package/lib/asserts/string/isValidTime.js.map +1 -1
- package/lib/asserts/string/isValidTime.mjs +3 -24
- package/lib/asserts/string/isValidTime.mjs.map +1 -1
- package/lib/asserts/string/lowerCase.d.mts +3 -1
- package/lib/asserts/string/lowerCase.d.ts +3 -1
- package/lib/asserts/string/lowerCase.js +3 -12
- package/lib/asserts/string/lowerCase.js.map +1 -1
- package/lib/asserts/string/lowerCase.mjs +3 -12
- package/lib/asserts/string/lowerCase.mjs.map +1 -1
- package/lib/asserts/string/maxLength.d.mts +3 -1
- package/lib/asserts/string/maxLength.d.ts +3 -1
- package/lib/asserts/string/maxLength.js +3 -12
- package/lib/asserts/string/maxLength.js.map +1 -1
- package/lib/asserts/string/maxLength.mjs +3 -12
- package/lib/asserts/string/maxLength.mjs.map +1 -1
- package/lib/asserts/string/minLength.d.mts +3 -1
- package/lib/asserts/string/minLength.d.ts +3 -1
- package/lib/asserts/string/minLength.js +3 -12
- package/lib/asserts/string/minLength.js.map +1 -1
- package/lib/asserts/string/minLength.mjs +3 -12
- package/lib/asserts/string/minLength.mjs.map +1 -1
- package/lib/asserts/string/regExp.d.mts +3 -1
- package/lib/asserts/string/regExp.d.ts +3 -1
- package/lib/asserts/string/regExp.js +3 -12
- package/lib/asserts/string/regExp.js.map +1 -1
- package/lib/asserts/string/regExp.mjs +3 -12
- package/lib/asserts/string/regExp.mjs.map +1 -1
- package/lib/asserts/string/startsWith.d.mts +3 -1
- package/lib/asserts/string/startsWith.d.ts +3 -1
- package/lib/asserts/string/startsWith.js +3 -14
- package/lib/asserts/string/startsWith.js.map +1 -1
- package/lib/asserts/string/startsWith.mjs +3 -14
- package/lib/asserts/string/startsWith.mjs.map +1 -1
- package/lib/asserts/string/upperCase.d.mts +3 -1
- package/lib/asserts/string/upperCase.d.ts +3 -1
- package/lib/asserts/string/upperCase.js +3 -14
- package/lib/asserts/string/upperCase.js.map +1 -1
- package/lib/asserts/string/upperCase.mjs +3 -14
- package/lib/asserts/string/upperCase.mjs.map +1 -1
- package/lib/asserts/string/uuid.d.mts +3 -1
- package/lib/asserts/string/uuid.d.ts +3 -1
- package/lib/asserts/string/uuid.js +3 -15
- package/lib/asserts/string/uuid.js.map +1 -1
- package/lib/asserts/string/uuid.mjs +3 -15
- package/lib/asserts/string/uuid.mjs.map +1 -1
- package/lib/asserts/string/uuidV1.d.mts +3 -1
- package/lib/asserts/string/uuidV1.d.ts +3 -1
- package/lib/asserts/string/uuidV1.js +3 -15
- package/lib/asserts/string/uuidV1.js.map +1 -1
- package/lib/asserts/string/uuidV1.mjs +3 -15
- package/lib/asserts/string/uuidV1.mjs.map +1 -1
- package/lib/asserts/string/uuidV2.d.mts +3 -1
- package/lib/asserts/string/uuidV2.d.ts +3 -1
- package/lib/asserts/string/uuidV2.js +3 -15
- package/lib/asserts/string/uuidV2.js.map +1 -1
- package/lib/asserts/string/uuidV2.mjs +3 -15
- package/lib/asserts/string/uuidV2.mjs.map +1 -1
- package/lib/asserts/string/uuidV3.d.mts +3 -1
- package/lib/asserts/string/uuidV3.d.ts +3 -1
- package/lib/asserts/string/uuidV3.js +3 -15
- package/lib/asserts/string/uuidV3.js.map +1 -1
- package/lib/asserts/string/uuidV3.mjs +3 -15
- package/lib/asserts/string/uuidV3.mjs.map +1 -1
- package/lib/asserts/string/uuidV4.d.mts +3 -1
- package/lib/asserts/string/uuidV4.d.ts +3 -1
- package/lib/asserts/string/uuidV4.js +3 -15
- package/lib/asserts/string/uuidV4.js.map +1 -1
- package/lib/asserts/string/uuidV4.mjs +3 -15
- package/lib/asserts/string/uuidV4.mjs.map +1 -1
- package/lib/asserts/string/uuidV5.d.mts +3 -1
- package/lib/asserts/string/uuidV5.d.ts +3 -1
- package/lib/asserts/string/uuidV5.js +3 -15
- package/lib/asserts/string/uuidV5.js.map +1 -1
- package/lib/asserts/string/uuidV5.mjs +3 -15
- package/lib/asserts/string/uuidV5.mjs.map +1 -1
- package/lib/asserts/string/validUrl.d.mts +3 -1
- package/lib/asserts/string/validUrl.d.ts +3 -1
- package/lib/asserts/string/validUrl.js +3 -19
- package/lib/asserts/string/validUrl.js.map +1 -1
- package/lib/asserts/string/validUrl.mjs +3 -19
- package/lib/asserts/string/validUrl.mjs.map +1 -1
- package/lib/chunk-22254THF.mjs +21 -0
- package/lib/chunk-22254THF.mjs.map +1 -0
- package/lib/chunk-22VHHJSS.js +28 -0
- package/lib/chunk-22VHHJSS.js.map +1 -0
- package/lib/chunk-23QTSXPQ.js +18 -0
- package/lib/chunk-23QTSXPQ.js.map +1 -0
- package/lib/chunk-24LO7MNY.js +18 -0
- package/lib/chunk-24LO7MNY.js.map +1 -0
- package/lib/{chunk-ASZW6XRM.mjs → chunk-2ANPCB4O.mjs} +4 -2
- package/lib/{chunk-ASZW6XRM.mjs.map → chunk-2ANPCB4O.mjs.map} +1 -1
- package/lib/chunk-2D3HCTJV.js +18 -0
- package/lib/chunk-2D3HCTJV.js.map +1 -0
- package/lib/chunk-2ESDKTV4.js +18 -0
- package/lib/chunk-2ESDKTV4.js.map +1 -0
- package/lib/chunk-2HGS4STD.js +48 -0
- package/lib/chunk-2HGS4STD.js.map +1 -0
- package/lib/chunk-2IPGGARK.mjs +21 -0
- package/lib/chunk-2IPGGARK.mjs.map +1 -0
- package/lib/chunk-3W2COCXV.js +18 -0
- package/lib/chunk-3W2COCXV.js.map +1 -0
- package/lib/chunk-4N5J426R.mjs +20 -0
- package/lib/chunk-4N5J426R.mjs.map +1 -0
- package/lib/chunk-4UPXP4I3.js +25 -0
- package/lib/chunk-4UPXP4I3.js.map +1 -0
- package/lib/{chunk-EMOOEIPZ.mjs → chunk-4ZKU4RJL.mjs} +2 -2
- package/lib/chunk-4ZKU4RJL.mjs.map +1 -0
- package/lib/chunk-5NYVRFG3.mjs +48 -0
- package/lib/chunk-5NYVRFG3.mjs.map +1 -0
- package/lib/chunk-62EKGBXF.js +21 -0
- package/lib/chunk-62EKGBXF.js.map +1 -0
- package/lib/chunk-6JPYR2TS.js +23 -0
- package/lib/chunk-6JPYR2TS.js.map +1 -0
- package/lib/chunk-6LPQRAFN.js +30 -0
- package/lib/chunk-6LPQRAFN.js.map +1 -0
- package/lib/{chunk-XG6K6N3A.mjs → chunk-6WKSLMJG.mjs} +10 -7
- package/lib/chunk-6WKSLMJG.mjs.map +1 -0
- package/lib/chunk-7JL66G7G.mjs +20 -0
- package/lib/chunk-7JL66G7G.mjs.map +1 -0
- package/lib/chunk-AJHBPMZT.mjs +19 -0
- package/lib/chunk-AJHBPMZT.mjs.map +1 -0
- package/lib/chunk-AQCV7PB4.mjs +28 -0
- package/lib/chunk-AQCV7PB4.mjs.map +1 -0
- package/lib/chunk-ARIYSQMH.js +20 -0
- package/lib/chunk-ARIYSQMH.js.map +1 -0
- package/lib/{chunk-42J6CHIO.js → chunk-AXKX5BGH.js} +4 -2
- package/lib/chunk-AXKX5BGH.js.map +1 -0
- package/lib/chunk-BRFUFNU4.js +18 -0
- package/lib/chunk-BRFUFNU4.js.map +1 -0
- package/lib/chunk-C2VSTWID.js +18 -0
- package/lib/chunk-C2VSTWID.js.map +1 -0
- package/lib/chunk-C44KAKMR.js +21 -0
- package/lib/chunk-C44KAKMR.js.map +1 -0
- package/lib/chunk-D6G32F2K.js +69 -0
- package/lib/chunk-D6G32F2K.js.map +1 -0
- package/lib/chunk-DCPRPCZ3.js +20 -0
- package/lib/chunk-DCPRPCZ3.js.map +1 -0
- package/lib/{chunk-BURPSYZ3.js → chunk-DED5KDLM.js} +18 -14
- package/lib/chunk-DED5KDLM.js.map +1 -0
- package/lib/chunk-DFYP4GKE.js +21 -0
- package/lib/chunk-DFYP4GKE.js.map +1 -0
- package/lib/chunk-ENZ5WDUQ.js +18 -0
- package/lib/chunk-ENZ5WDUQ.js.map +1 -0
- package/lib/chunk-FI737YZJ.js +19 -0
- package/lib/chunk-FI737YZJ.js.map +1 -0
- package/lib/chunk-GFWZQ4XW.mjs +30 -0
- package/lib/chunk-GFWZQ4XW.mjs.map +1 -0
- package/lib/chunk-GGWJJFXY.mjs +20 -0
- package/lib/chunk-GGWJJFXY.mjs.map +1 -0
- package/lib/chunk-H2M4FCRZ.mjs +21 -0
- package/lib/chunk-H2M4FCRZ.mjs.map +1 -0
- package/lib/chunk-H4OW6OUF.js +21 -0
- package/lib/chunk-H4OW6OUF.js.map +1 -0
- package/lib/chunk-HD37VXPZ.mjs +19 -0
- package/lib/chunk-HD37VXPZ.mjs.map +1 -0
- package/lib/chunk-HPIF2CMT.js +18 -0
- package/lib/chunk-HPIF2CMT.js.map +1 -0
- package/lib/chunk-HUWO5UKU.js +64 -0
- package/lib/chunk-HUWO5UKU.js.map +1 -0
- package/lib/chunk-HWVM4SYU.mjs +18 -0
- package/lib/chunk-HWVM4SYU.mjs.map +1 -0
- package/lib/chunk-IDDU6B6T.js +20 -0
- package/lib/chunk-IDDU6B6T.js.map +1 -0
- package/lib/chunk-KRCOKWAB.mjs +18 -0
- package/lib/chunk-KRCOKWAB.mjs.map +1 -0
- package/lib/chunk-LXZTBF7F.js +18 -0
- package/lib/chunk-LXZTBF7F.js.map +1 -0
- package/lib/chunk-M2GOQ7TZ.mjs +21 -0
- package/lib/chunk-M2GOQ7TZ.mjs.map +1 -0
- package/lib/{chunk-CCNK27CX.mjs → chunk-M3HYPZLE.mjs} +14 -10
- package/lib/chunk-M3HYPZLE.mjs.map +1 -0
- package/lib/chunk-MCQHWS3E.mjs +18 -0
- package/lib/chunk-MCQHWS3E.mjs.map +1 -0
- package/lib/chunk-MHWPSQB3.js +20 -0
- package/lib/chunk-MHWPSQB3.js.map +1 -0
- package/lib/chunk-N3EHGKZV.mjs +25 -0
- package/lib/chunk-N3EHGKZV.mjs.map +1 -0
- package/lib/chunk-NBR3QGKW.js +23 -0
- package/lib/chunk-NBR3QGKW.js.map +1 -0
- package/lib/{chunk-U3DJ354I.mjs → chunk-NFD7D5GZ.mjs} +25 -19
- package/lib/chunk-NFD7D5GZ.mjs.map +1 -0
- package/lib/chunk-NOJB5GBZ.mjs +18 -0
- package/lib/chunk-NOJB5GBZ.mjs.map +1 -0
- package/lib/chunk-NS4GXUCA.mjs +18 -0
- package/lib/chunk-NS4GXUCA.mjs.map +1 -0
- package/lib/chunk-NY2TPU6O.mjs +18 -0
- package/lib/chunk-NY2TPU6O.mjs.map +1 -0
- package/lib/{chunk-QWPHP26D.mjs → chunk-OE3L7EKN.mjs} +2 -2
- package/lib/chunk-OE3L7EKN.mjs.map +1 -0
- package/lib/chunk-OFZMO7PB.mjs +18 -0
- package/lib/chunk-OFZMO7PB.mjs.map +1 -0
- package/lib/chunk-OHUOBIHX.mjs +52 -0
- package/lib/chunk-OHUOBIHX.mjs.map +1 -0
- package/lib/chunk-OMSHZITC.js +20 -0
- package/lib/chunk-OMSHZITC.js.map +1 -0
- package/lib/chunk-OQYS7JVF.js +28 -0
- package/lib/chunk-OQYS7JVF.js.map +1 -0
- package/lib/chunk-OSFIPFQ3.mjs +28 -0
- package/lib/chunk-OSFIPFQ3.mjs.map +1 -0
- package/lib/chunk-OU5BTUDV.mjs +23 -0
- package/lib/chunk-OU5BTUDV.mjs.map +1 -0
- package/lib/chunk-OZ3BTSSQ.mjs +64 -0
- package/lib/chunk-OZ3BTSSQ.mjs.map +1 -0
- package/lib/{chunk-32MKEBKR.js → chunk-PAV4SQQL.js} +3 -3
- package/lib/chunk-PAV4SQQL.js.map +1 -0
- package/lib/chunk-PNSDUVRE.mjs +21 -0
- package/lib/chunk-PNSDUVRE.mjs.map +1 -0
- package/lib/chunk-PVQALO2H.js +23 -0
- package/lib/chunk-PVQALO2H.js.map +1 -0
- package/lib/chunk-QEG24G7E.mjs +18 -0
- package/lib/chunk-QEG24G7E.mjs.map +1 -0
- package/lib/chunk-QIFA6S5U.mjs +18 -0
- package/lib/chunk-QIFA6S5U.mjs.map +1 -0
- package/lib/chunk-QIPGUTIG.mjs +302 -0
- package/lib/chunk-QIPGUTIG.mjs.map +1 -0
- package/lib/chunk-QMIH3A4D.js +18 -0
- package/lib/chunk-QMIH3A4D.js.map +1 -0
- package/lib/chunk-R25HSJPH.js +21 -0
- package/lib/chunk-R25HSJPH.js.map +1 -0
- package/lib/chunk-S4FWDTEW.mjs +20 -0
- package/lib/chunk-S4FWDTEW.mjs.map +1 -0
- package/lib/chunk-S5D5AFDF.js +18 -0
- package/lib/chunk-S5D5AFDF.js.map +1 -0
- package/lib/chunk-SBO6OQIX.mjs +23 -0
- package/lib/chunk-SBO6OQIX.mjs.map +1 -0
- package/lib/chunk-SFIX77W5.js +21 -0
- package/lib/chunk-SFIX77W5.js.map +1 -0
- package/lib/chunk-T2A3XXQZ.mjs +18 -0
- package/lib/chunk-T2A3XXQZ.mjs.map +1 -0
- package/lib/{chunk-P4Q22AZA.js → chunk-TCDQA2NU.js} +12 -9
- package/lib/chunk-TCDQA2NU.js.map +1 -0
- package/lib/{chunk-YSCVE4PJ.mjs → chunk-THU5VBSO.mjs} +2 -2
- package/lib/chunk-THU5VBSO.mjs.map +1 -0
- package/lib/{chunk-EXVTHIT5.js → chunk-TJQ5NVL4.js} +2 -2
- package/lib/chunk-TJQ5NVL4.js.map +1 -0
- package/lib/{chunk-UTPG4GZB.js → chunk-TLPVFRWR.js} +3 -3
- package/lib/chunk-TLPVFRWR.js.map +1 -0
- package/lib/chunk-TLRVQWCI.mjs +30 -0
- package/lib/chunk-TLRVQWCI.mjs.map +1 -0
- package/lib/chunk-TQDMUHTA.mjs +20 -0
- package/lib/chunk-TQDMUHTA.mjs.map +1 -0
- package/lib/chunk-TZBAW5OO.mjs +21 -0
- package/lib/chunk-TZBAW5OO.mjs.map +1 -0
- package/lib/chunk-UHMICS34.mjs +18 -0
- package/lib/chunk-UHMICS34.mjs.map +1 -0
- package/lib/chunk-UYQFYQQG.mjs +69 -0
- package/lib/chunk-UYQFYQQG.mjs.map +1 -0
- package/lib/chunk-V2J4TQR5.mjs +20 -0
- package/lib/chunk-V2J4TQR5.mjs.map +1 -0
- package/lib/chunk-V7C77FML.mjs +18 -0
- package/lib/chunk-V7C77FML.mjs.map +1 -0
- package/lib/chunk-VN4GLOEN.js +302 -0
- package/lib/chunk-VN4GLOEN.js.map +1 -0
- package/lib/chunk-VOFKYSJD.js +20 -0
- package/lib/chunk-VOFKYSJD.js.map +1 -0
- package/lib/chunk-VVXKATDH.js +18 -0
- package/lib/chunk-VVXKATDH.js.map +1 -0
- package/lib/{chunk-P54CF5QN.mjs → chunk-W3U7RYLP.mjs} +2 -2
- package/lib/chunk-W3U7RYLP.mjs.map +1 -0
- package/lib/chunk-WJGXVKZY.js +21 -0
- package/lib/chunk-WJGXVKZY.js.map +1 -0
- package/lib/chunk-WLPDAJB3.js +52 -0
- package/lib/chunk-WLPDAJB3.js.map +1 -0
- package/lib/chunk-WYM2TIVW.mjs +23 -0
- package/lib/chunk-WYM2TIVW.mjs.map +1 -0
- package/lib/chunk-XBE75VFX.js +13 -0
- package/lib/chunk-XBE75VFX.js.map +1 -0
- package/lib/chunk-XDVSL5B6.js +14 -0
- package/lib/chunk-XDVSL5B6.js.map +1 -0
- package/lib/chunk-XIOV4SHZ.mjs +13 -0
- package/lib/chunk-XIOV4SHZ.mjs.map +1 -0
- package/lib/chunk-Y54K6TQO.js +19 -0
- package/lib/chunk-Y54K6TQO.js.map +1 -0
- package/lib/chunk-Y5MNJGFX.js +30 -0
- package/lib/chunk-Y5MNJGFX.js.map +1 -0
- package/lib/chunk-YDTQASAY.mjs +18 -0
- package/lib/chunk-YDTQASAY.mjs.map +1 -0
- package/lib/chunk-YMPRYKNY.js +18 -0
- package/lib/chunk-YMPRYKNY.js.map +1 -0
- package/lib/chunk-Z2HZXSDA.js +18 -0
- package/lib/chunk-Z2HZXSDA.js.map +1 -0
- package/lib/chunk-Z3NPFUIA.mjs +18 -0
- package/lib/chunk-Z3NPFUIA.mjs.map +1 -0
- package/lib/chunk-Z4XOKGU3.js +71 -0
- package/lib/chunk-Z4XOKGU3.js.map +1 -0
- package/lib/chunk-ZDXO3TGZ.mjs +18 -0
- package/lib/chunk-ZDXO3TGZ.mjs.map +1 -0
- package/lib/chunk-ZEGRYDE5.mjs +18 -0
- package/lib/chunk-ZEGRYDE5.mjs.map +1 -0
- package/lib/chunk-ZGUF5ZDP.mjs +21 -0
- package/lib/chunk-ZGUF5ZDP.mjs.map +1 -0
- package/lib/chunk-ZNQHNLKW.js +18 -0
- package/lib/chunk-ZNQHNLKW.js.map +1 -0
- package/lib/codeGen.d.mts +2 -2
- package/lib/codeGen.d.ts +2 -2
- package/lib/codeGen.js +3 -45
- package/lib/codeGen.js.map +1 -1
- package/lib/codeGen.mjs +4 -46
- package/lib/codeGen.mjs.map +1 -1
- package/lib/commonTypes.d.mts +12 -1
- package/lib/commonTypes.d.ts +12 -1
- package/lib/core.d.mts +200 -0
- package/lib/core.d.ts +200 -0
- package/lib/core.js +17 -0
- package/lib/core.js.map +1 -0
- package/lib/core.mjs +17 -0
- package/lib/helpers/constants.d.mts +2 -1
- package/lib/helpers/constants.d.ts +2 -1
- package/lib/helpers/constants.js +4 -2
- package/lib/helpers/constants.js.map +1 -1
- package/lib/helpers/constants.mjs +5 -3
- package/lib/helpers/setStrictType.d.mts +2 -2
- package/lib/helpers/setStrictType.d.ts +2 -2
- package/lib/helpers/setStrictType.js +3 -4
- package/lib/helpers/setStrictType.js.map +1 -1
- package/lib/helpers/setStrictType.mjs +2 -3
- package/lib/index.d.mts +51 -4
- package/lib/index.d.ts +51 -4
- package/lib/index.js +205 -4
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +206 -5
- package/lib/translationMap.d.mts +3 -1
- package/lib/translationMap.d.ts +3 -1
- package/lib/translationMap.js +2 -2
- package/lib/translationMap.mjs +1 -1
- package/package.json +46 -41
- package/lib/CommonSchema-BIfYCtcQ.d.mts +0 -110
- package/lib/CommonSchema-DIDMH9R7.d.ts +0 -110
- package/lib/ExceptionContext.d.mts +0 -16
- package/lib/ExceptionContext.d.ts +0 -16
- package/lib/ExceptionContext.js +0 -11
- package/lib/ExceptionContext.js.map +0 -1
- package/lib/ExceptionContext.mjs +0 -11
- package/lib/ExceptionContext.mjs.map +0 -1
- package/lib/chunk-32MKEBKR.js.map +0 -1
- package/lib/chunk-3ZQ4ORQH.js +0 -14
- package/lib/chunk-3ZQ4ORQH.js.map +0 -1
- package/lib/chunk-42J6CHIO.js.map +0 -1
- package/lib/chunk-BURPSYZ3.js.map +0 -1
- package/lib/chunk-CCNK27CX.mjs.map +0 -1
- package/lib/chunk-EMOOEIPZ.mjs.map +0 -1
- package/lib/chunk-EXVTHIT5.js.map +0 -1
- package/lib/chunk-FNBYM254.js +0 -41
- package/lib/chunk-FNBYM254.js.map +0 -1
- package/lib/chunk-IFQLPXCZ.mjs +0 -111
- package/lib/chunk-IFQLPXCZ.mjs.map +0 -1
- package/lib/chunk-MMWS3SXR.js +0 -136
- package/lib/chunk-MMWS3SXR.js.map +0 -1
- package/lib/chunk-MQRXWXHP.mjs +0 -83
- package/lib/chunk-MQRXWXHP.mjs.map +0 -1
- package/lib/chunk-MRRMV2GM.mjs +0 -63
- package/lib/chunk-MRRMV2GM.mjs.map +0 -1
- package/lib/chunk-P4Q22AZA.js.map +0 -1
- package/lib/chunk-P54CF5QN.mjs.map +0 -1
- package/lib/chunk-PE55R4KH.js +0 -83
- package/lib/chunk-PE55R4KH.js.map +0 -1
- package/lib/chunk-PGEXAFA5.js +0 -20
- package/lib/chunk-PGEXAFA5.js.map +0 -1
- package/lib/chunk-PQ4GCO3Q.js +0 -111
- package/lib/chunk-PQ4GCO3Q.js.map +0 -1
- package/lib/chunk-QWPHP26D.mjs.map +0 -1
- package/lib/chunk-RAJF6LMF.js +0 -63
- package/lib/chunk-RAJF6LMF.js.map +0 -1
- package/lib/chunk-RG5NYH2I.js +0 -65
- package/lib/chunk-RG5NYH2I.js.map +0 -1
- package/lib/chunk-U3DJ354I.mjs.map +0 -1
- package/lib/chunk-UEYMBPZN.mjs +0 -136
- package/lib/chunk-UEYMBPZN.mjs.map +0 -1
- package/lib/chunk-UTPG4GZB.js.map +0 -1
- package/lib/chunk-VIFJBTQO.mjs +0 -20
- package/lib/chunk-VIFJBTQO.mjs.map +0 -1
- package/lib/chunk-W2SQHSOS.mjs +0 -58
- package/lib/chunk-W2SQHSOS.mjs.map +0 -1
- package/lib/chunk-XG6K6N3A.mjs.map +0 -1
- package/lib/chunk-XT5E3MPI.mjs +0 -41
- package/lib/chunk-XT5E3MPI.mjs.map +0 -1
- package/lib/chunk-YSCVE4PJ.mjs.map +0 -1
- package/lib/chunk-ZG373PNB.js +0 -58
- package/lib/chunk-ZG373PNB.js.map +0 -1
- package/lib/helpers/core.d.mts +0 -4
- package/lib/helpers/core.d.ts +0 -4
- package/lib/helpers/core.js +0 -10
- package/lib/helpers/core.js.map +0 -1
- package/lib/helpers/core.mjs +0 -10
- package/lib/parse.d.mts +0 -62
- package/lib/parse.d.ts +0 -62
- package/lib/parse.js +0 -11
- package/lib/parse.js.map +0 -1
- package/lib/parse.mjs +0 -11
- package/lib/parse.mjs.map +0 -1
- package/lib/parseOrFail.d.mts +0 -44
- package/lib/parseOrFail.d.ts +0 -44
- package/lib/parseOrFail.js +0 -11
- package/lib/parseOrFail.js.map +0 -1
- package/lib/parseOrFail.mjs +0 -11
- package/lib/parseOrFail.mjs.map +0 -1
- package/lib/schemas/ArraySchema.d.mts +0 -12
- package/lib/schemas/ArraySchema.d.ts +0 -12
- package/lib/schemas/ArraySchema.js +0 -13
- package/lib/schemas/ArraySchema.js.map +0 -1
- package/lib/schemas/ArraySchema.mjs +0 -13
- package/lib/schemas/ArraySchema.mjs.map +0 -1
- package/lib/schemas/BigIntSchema.d.mts +0 -31
- package/lib/schemas/BigIntSchema.d.ts +0 -31
- package/lib/schemas/BigIntSchema.js +0 -17
- package/lib/schemas/BigIntSchema.js.map +0 -1
- package/lib/schemas/BigIntSchema.mjs +0 -17
- package/lib/schemas/BigIntSchema.mjs.map +0 -1
- package/lib/schemas/BooleanSchema.d.mts +0 -26
- package/lib/schemas/BooleanSchema.d.ts +0 -26
- package/lib/schemas/BooleanSchema.js +0 -14
- package/lib/schemas/BooleanSchema.js.map +0 -1
- package/lib/schemas/BooleanSchema.mjs +0 -14
- package/lib/schemas/BooleanSchema.mjs.map +0 -1
- package/lib/schemas/CommonSchema.d.mts +0 -4
- package/lib/schemas/CommonSchema.d.ts +0 -4
- package/lib/schemas/CommonSchema.js +0 -12
- package/lib/schemas/CommonSchema.js.map +0 -1
- package/lib/schemas/CommonSchema.mjs +0 -12
- package/lib/schemas/CommonSchema.mjs.map +0 -1
- package/lib/schemas/DateSchema.d.mts +0 -11
- package/lib/schemas/DateSchema.d.ts +0 -11
- package/lib/schemas/DateSchema.js +0 -13
- package/lib/schemas/DateSchema.js.map +0 -1
- package/lib/schemas/DateSchema.mjs +0 -13
- package/lib/schemas/DateSchema.mjs.map +0 -1
- package/lib/schemas/NumberSchema.d.mts +0 -30
- package/lib/schemas/NumberSchema.d.ts +0 -30
- package/lib/schemas/NumberSchema.js +0 -17
- package/lib/schemas/NumberSchema.js.map +0 -1
- package/lib/schemas/NumberSchema.mjs +0 -17
- package/lib/schemas/NumberSchema.mjs.map +0 -1
- package/lib/schemas/ObjectSchema.d.mts +0 -30
- package/lib/schemas/ObjectSchema.d.ts +0 -30
- package/lib/schemas/ObjectSchema.js +0 -13
- package/lib/schemas/ObjectSchema.js.map +0 -1
- package/lib/schemas/ObjectSchema.mjs +0 -13
- package/lib/schemas/ObjectSchema.mjs.map +0 -1
- package/lib/schemas/StringSchema.d.mts +0 -31
- package/lib/schemas/StringSchema.d.ts +0 -31
- package/lib/schemas/StringSchema.js +0 -17
- package/lib/schemas/StringSchema.js.map +0 -1
- package/lib/schemas/StringSchema.mjs +0 -17
- package/lib/schemas/StringSchema.mjs.map +0 -1
- /package/lib/{helpers/core.mjs.map → core.mjs.map} +0 -0
package/lib/chunk-PQ4GCO3Q.js
DELETED
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
|
-
|
|
3
|
-
var _chunkEXVTHIT5js = require('./chunk-EXVTHIT5.js');
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
var _chunkPE55R4KHjs = require('./chunk-PE55R4KH.js');
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
var _chunkFIDPCCCWjs = require('./chunk-FIDPCCCW.js');
|
|
11
|
-
|
|
12
|
-
// src/parseOrFail.ts
|
|
13
|
-
function parseOrFail(schema, receivedValue, options) {
|
|
14
|
-
try {
|
|
15
|
-
const ctx = new ExceptionContext(
|
|
16
|
-
receivedValue,
|
|
17
|
-
_chunkEXVTHIT5js.getTranslationByLocale.call(void 0, _optionalChain([options, 'optionalAccess', _2 => _2.lng])),
|
|
18
|
-
"",
|
|
19
|
-
void 0,
|
|
20
|
-
schema[_chunkPE55R4KHjs.ctxSymbol].meta
|
|
21
|
-
);
|
|
22
|
-
return _chunkPE55R4KHjs.innerCheck.call(void 0, schema, receivedValue, ctx);
|
|
23
|
-
} catch (e) {
|
|
24
|
-
if (e instanceof _chunkFIDPCCCWjs.ValidationError) throw e;
|
|
25
|
-
throw new Error("Something unexpected happened");
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
// src/ExceptionContext.ts
|
|
30
|
-
var replacePlaceholdersRegex = /{{(.*?)}}/g;
|
|
31
|
-
function replacePlaceholders(template, replacements) {
|
|
32
|
-
return template.replace(replacePlaceholdersRegex, (_, key) => {
|
|
33
|
-
return key in replacements ? `${replacements[key]}` : `{{${key}}}`;
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
var ExceptionContext = class _ExceptionContext {
|
|
37
|
-
constructor(initialReceived, t, pathToError, errors, meta) {
|
|
38
|
-
this.initialReceived = initialReceived;
|
|
39
|
-
this.t = t;
|
|
40
|
-
this.pathToError = pathToError;
|
|
41
|
-
this.errors = errors;
|
|
42
|
-
this.meta = meta;
|
|
43
|
-
}
|
|
44
|
-
createChild(childPathToError, childMeta) {
|
|
45
|
-
return new _ExceptionContext(this.initialReceived, this.t, childPathToError, this.errors, childMeta);
|
|
46
|
-
}
|
|
47
|
-
ref(path) {
|
|
48
|
-
let ref = this.initialReceived;
|
|
49
|
-
const parsedRefPath = path.split(".");
|
|
50
|
-
parsedRefPath.forEach((el) => {
|
|
51
|
-
ref = ref[el];
|
|
52
|
-
});
|
|
53
|
-
return ref;
|
|
54
|
-
}
|
|
55
|
-
addIssue(expected, received, messageKey) {
|
|
56
|
-
const rawMessage = _nullishCoalesce(this.t[messageKey], () => ( messageKey));
|
|
57
|
-
const message = replacePlaceholders(rawMessage, { e: expected, r: received, p: this.pathToError });
|
|
58
|
-
if (this.errors) {
|
|
59
|
-
this.errors.push({
|
|
60
|
-
expected,
|
|
61
|
-
received,
|
|
62
|
-
pathToError: this.pathToError,
|
|
63
|
-
message
|
|
64
|
-
});
|
|
65
|
-
return;
|
|
66
|
-
}
|
|
67
|
-
throw new (0, _chunkFIDPCCCWjs.ValidationError)(expected, received, this.pathToError, message, this.meta);
|
|
68
|
-
}
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
// src/parse.ts
|
|
72
|
-
function parse(schema, receivedValue, options) {
|
|
73
|
-
try {
|
|
74
|
-
const ctx = new ExceptionContext(
|
|
75
|
-
receivedValue,
|
|
76
|
-
_chunkEXVTHIT5js.getTranslationByLocale.call(void 0, _optionalChain([options, 'optionalAccess', _3 => _3.lng])),
|
|
77
|
-
"",
|
|
78
|
-
_optionalChain([options, 'optionalAccess', _4 => _4.getAllErrors]) ? [] : void 0,
|
|
79
|
-
schema[_chunkPE55R4KHjs.ctxSymbol].meta
|
|
80
|
-
);
|
|
81
|
-
const parsedValue = _chunkPE55R4KHjs.innerCheck.call(void 0, schema, receivedValue, ctx);
|
|
82
|
-
if (_optionalChain([ctx, 'access', _5 => _5.errors, 'optionalAccess', _6 => _6.length])) {
|
|
83
|
-
return [ctx.errors, void 0];
|
|
84
|
-
}
|
|
85
|
-
return [void 0, parsedValue];
|
|
86
|
-
} catch (e) {
|
|
87
|
-
if (e instanceof _chunkFIDPCCCWjs.ValidationError) {
|
|
88
|
-
delete e.stack;
|
|
89
|
-
return [[e], void 0];
|
|
90
|
-
}
|
|
91
|
-
return [
|
|
92
|
-
[
|
|
93
|
-
{
|
|
94
|
-
message: "Something unexpected happened",
|
|
95
|
-
expected: "",
|
|
96
|
-
received: "",
|
|
97
|
-
pathToError: "",
|
|
98
|
-
meta: void 0
|
|
99
|
-
}
|
|
100
|
-
],
|
|
101
|
-
void 0
|
|
102
|
-
];
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
exports.parse = parse; exports.parseOrFail = parseOrFail; exports.ExceptionContext = ExceptionContext;
|
|
111
|
-
//# sourceMappingURL=chunk-PQ4GCO3Q.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/bguard/bguard/lib/chunk-PQ4GCO3Q.js","../src/parseOrFail.ts","../src/ExceptionContext.ts","../src/parse.ts"],"names":[],"mappings":"AAAA;AACE;AACF,sDAA4B;AAC5B;AACE;AACA;AACF,sDAA4B;AAC5B;AACE;AACF,sDAA4B;AAC5B;AACA;ACgCO,SAAS,WAAA,CACd,MAAA,EACA,aAAA,EACA,OAAA,EACc;AACd,EAAA,IAAI;AACF,IAAA,MAAM,IAAA,EAAM,IAAI,gBAAA;AAAA,MACd,aAAA;AAAA,MACA,qDAAA,gBAAuB,OAAA,6BAAS,KAAG,CAAA;AAAA,MACnC,EAAA;AAAA,MACA,KAAA,CAAA;AAAA,MACA,MAAA,CAAO,0BAAS,CAAA,CAAE;AAAA,IACpB,CAAA;AACA,IAAA,OAAO,yCAAA,MAAW,EAAQ,aAAA,EAAe,GAAG,CAAA;AAAA,EAC9C,EAAA,MAAA,CAAS,CAAA,EAAG;AACV,IAAA,GAAA,CAAI,EAAA,WAAa,gCAAA,EAAiB,MAAM,CAAA;AAExC,IAAA,MAAM,IAAI,KAAA,CAAM,+BAA+B,CAAA;AAAA,EACjD;AACF;ADnCA;AACA;AEzBA,IAAM,yBAAA,EAA2B,YAAA;AAEjC,SAAS,mBAAA,CAAoB,QAAA,EAAkB,YAAA,EAA+C;AAC5F,EAAA,OAAO,QAAA,CAAS,OAAA,CAAQ,wBAAA,EAA0B,CAAC,CAAA,EAAG,GAAA,EAAA,GAAQ;AAC5D,IAAA,OAAO,IAAA,GAAO,aAAA,EAAe,CAAA,EAAA;AAC9B,EAAA;AACH;AAEa;AAIO,EAAA;AAFA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACf,EAAA;AAEmC,EAAA;AACR,IAAA;AAC9B,EAAA;AAEkC,EAAA;AAEZ,IAAA;AACO,IAAA;AACG,IAAA;AAChB,MAAA;AACb,IAAA;AAEM,IAAA;AACT,EAAA;AAEsD,EAAA;AAC1B,IAAA;AACV,IAAA;AAEC,IAAA;AACE,MAAA;AACf,QAAA;AACA,QAAA;AACkB,QAAA;AAClB,QAAA;AACD,MAAA;AAED,MAAA;AACF,IAAA;AAE0B,IAAA;AAC5B,EAAA;AACF;AFiBkC;AACA;AGJhC;AAGI,EAAA;AACc,IAAA;AACd,MAAA;AACuB,MAAA;AACvB,MAAA;AACyB,sBAAA;AACP,MAAA;AACpB,IAAA;AAEoB,IAAA;AAEI,IAAA;AACO,MAAA;AAC/B,IAAA;AAE8B,IAAA;AACpB,EAAA;AACO,IAAA;AACN,MAAA;AACa,MAAA;AACxB,IAAA;AAEO,IAAA;AACL,MAAA;AACE,QAAA;AACW,UAAA;AACC,UAAA;AACA,UAAA;AACG,UAAA;AACP,UAAA;AACR,QAAA;AACF,MAAA;AACA,MAAA;AACF,IAAA;AACF,EAAA;AACF;AHAkC;AACA;AACA;AACA;AACA;AACA","file":"/home/runner/work/bguard/bguard/lib/chunk-PQ4GCO3Q.js","sourcesContent":[null,"import type { InferType } from './InferType';\nimport type { CommonSchema } from './schemas/CommonSchema';\nimport { ctxSymbol, innerCheck } from './helpers/core';\nimport { getTranslationByLocale } from './translationMap';\nimport { ValidationError } from './exceptions';\nimport { ExceptionContext } from './ExceptionContext';\ninterface ParseOptions {\n /**\n * Set language keyword to map error messages.\n * @default 'default'\n * @example 'sr' or 'Serbia' or any string to identify language\n */\n lng?: string;\n}\n\n/**\n * Parses and validates a value against the provided schema, returning a type-safe result.\n *\n * This function will throw a `ValidationError` if the value does not conform to the schema.\n * The inferred TypeScript type of the returned value will match the structure defined by the schema.\n *\n * @template T\n * @param {T} schema - The schema to validate the received value against. This schema dictates the expected structure and type of the value.\n * @param {unknown} receivedValue - The value to be validated and parsed according to the schema.\n * @param {ParseOptions} options - Options\n * @param {ParseOptions.lng} options.lng - Set language keyword to map Error message\n * @returns {InferType<T>} The validated value, with its TypeScript type inferred from the schema.\n *\n * @throws {ValidationError} If the received value does not match the schema, a `ValidationError` will be thrown.\n * @throws {Error} If an unexpected error occurs during validation, an error will be thrown with a generic message.\n *\n * @example\n * const schema = object({\n * name: string(),\n * age: number(),\n * });\n *\n * const result = parseOrFail(schema, { name: 'Alice', age: 30 });\n * // result will be inferred as { name: string; age: number }\n *\n * parseOrFail(schema, { name: 'Alice', age: '30' });\n * // Throws ValidationError because 'age' should be a number, not a string.\n */\nexport function parseOrFail<T extends CommonSchema>(\n schema: T,\n receivedValue: unknown,\n options?: ParseOptions,\n): InferType<T> {\n try {\n const ctx = new ExceptionContext(\n receivedValue,\n getTranslationByLocale(options?.lng),\n '',\n undefined,\n schema[ctxSymbol].meta,\n );\n return innerCheck(schema, receivedValue, ctx) as InferType<T>;\n } catch (e) {\n if (e instanceof ValidationError) throw e;\n /* istanbul ignore next */\n throw new Error('Something unexpected happened');\n }\n}\n","import { ValidationError } from '.';\nimport { MetaContext, TranslationErrorMap, ValidationErrorData } from './commonTypes';\n\nconst replacePlaceholdersRegex = /{{(.*?)}}/g;\n\nfunction replacePlaceholders(template: string, replacements: Record<string, unknown>): string {\n return template.replace(replacePlaceholdersRegex, (_, key) => {\n return key in replacements ? `${replacements[key] as string}` : `{{${key}}}`;\n });\n}\n\nexport class ExceptionContext {\n constructor(\n public readonly initialReceived: unknown,\n public readonly t: TranslationErrorMap,\n public readonly pathToError: string,\n public readonly errors?: ValidationErrorData[],\n public readonly meta?: MetaContext,\n ) {}\n\n createChild(childPathToError: string, childMeta?: MetaContext) {\n return new ExceptionContext(this.initialReceived, this.t, childPathToError, this.errors, childMeta);\n }\n\n public ref(path: string): unknown {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n let ref: any = this.initialReceived;\n const parsedRefPath = path.split('.');\n parsedRefPath.forEach((el) => {\n ref = ref[el];\n });\n\n return ref;\n }\n\n public addIssue(expected: unknown, received: unknown, messageKey: string): never | void {\n const rawMessage = this.t[messageKey] ?? messageKey;\n const message = replacePlaceholders(rawMessage, { e: expected, r: received, p: this.pathToError });\n\n if (this.errors) {\n this.errors.push({\n expected,\n received,\n pathToError: this.pathToError,\n message,\n });\n\n return;\n }\n\n throw new ValidationError(expected, received, this.pathToError, message, this.meta);\n }\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type RequiredValidation = (received: any, ctx: ExceptionContext) => void;\n","import { InferType } from './InferType';\nimport { ctxSymbol, innerCheck } from './helpers/core';\nimport { getTranslationByLocale } from './translationMap';\nimport { ValidationError } from './exceptions';\nimport { CommonSchema } from './schemas/CommonSchema';\nimport { ValidationErrorData } from './commonTypes';\nimport { ExceptionContext } from './ExceptionContext';\n\ninterface ParseOptions {\n /**\n * Set language keyword to map error messages.\n * @default 'default'\n * @example 'sr' or 'Serbia' or any string to identify language\n */\n lng?: string;\n\n /**\n * If true, collects all validation errors and returns them.\n * If false or undefined, returns the first validation error it can find and stops looking,\n * which provides a small runtime optimization.\n * @default undefined\n */\n getAllErrors?: boolean;\n}\n\n/**\n * Parses and validates a value against the provided schema, returning a type-safe parsedValue.\n *\n * This function will throw a `ValidationError` if the value does not conform to the schema.\n * The inferred TypeScript type of the returned value will match the structure defined by the schema.\n *\n * @template T\n * @param {T} schema - The schema to validate the received value against. This schema dictates the expected structure and type of the value.\n * @param {unknown} receivedValue - The value to be validated and parsed according to the schema.\n * @param {ParseOptions} options - Options\n * @param {ParseOptions.lng} options.lng - Set language keyword to map Error messages\n * @param {ParseOptions.lng} options.getAllErrors - If `false` or `undefined` - returns the first validation error it can find and stops looking, which provides a small runtime optimization.\n * @returns {[undefined, InferType<T>]} A tuple of [undefined, InferType<T>] if parsing is successful.\n * @returns {[ValidationErrorData[], undefined]} A tuple of [ValidationErrorData[], undefined]] if errors occur.\n *\n * @example\n * const schema = object({\n * name: string(),\n * age: number(),\n * });\n *\n * const [errors, parsedValue] = parse(schema, { name: 'Alice', age: 30 });\n * // parsedValue will be inferred as { name: string; age: number }\n *\n *\n * const [errors, parsedValue] = parse(schema, { name: 'Alice', age: '30' });\n * // First element in array \"errors\" will have an error because 'age' should be a number, not a string.\n * // Array 'errors' returns only one element.\n *\n *\n * const [errors, parsedValue] = parse(schema, { name: true, age: '30' }, { getAllErrors: true});\n * // Returns array \"errors\" with multiple errors because 'age' should be a number and 'name' a string.\n * // With provided options { getAllErrors: true}, we can expecte more than one error in 'errors' array.\n *\n *\n * const [errors, parsedValue] = parse(schema, { name: true, age: '30' }, { lng: 'SR'});\n * // First element in array \"errors\" will have an error because 'age' should be a number, not a string.\n * // With provided options { lng: 'SR'}, errors will be translated to a language mapped with keyword 'SR'\n */\nexport function parse<T extends CommonSchema>(\n schema: T,\n receivedValue: unknown,\n options?: ParseOptions,\n): [ValidationErrorData[], undefined] | [undefined, InferType<T>] {\n try {\n const ctx = new ExceptionContext(\n receivedValue,\n getTranslationByLocale(options?.lng),\n '',\n options?.getAllErrors ? [] : undefined,\n schema[ctxSymbol].meta,\n );\n\n const parsedValue = innerCheck(schema, receivedValue, ctx) as InferType<T>;\n\n if (ctx.errors?.length) {\n return [ctx.errors, undefined];\n }\n\n return [undefined, parsedValue];\n } catch (e) {\n if (e instanceof ValidationError) {\n delete e.stack;\n return [[e], undefined];\n }\n /* istanbul ignore next */\n return [\n [\n {\n message: 'Something unexpected happened',\n expected: '',\n received: '',\n pathToError: '',\n meta: undefined,\n },\n ],\n undefined,\n ];\n }\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/translationMap.ts"],"sourcesContent":["import { BuildSchemaError } from './exceptions';\nimport { TranslationErrorMap } from './commonTypes';\nimport type { RequiredValidation } from './ExceptionContext';\n\n// c: stands for common\nconst defaultErrorMap: TranslationErrorMap = {\n //@@start\n 'c:optional': 'The required value is missing',\n 'c:nullable': 'Value should not be null',\n 'c:array': 'Expected an array but received a different type',\n 'c:objectType': 'Expected an object but received a different type',\n 'c:objectTypeAsArray': 'Expected an object but received an array. Invalid type of data',\n 'c:unrecognizedProperty': 'This property is not allowed in the object',\n 'c:requiredProperty': 'Missing required property in the object',\n 'c:invalidType': 'Invalid type of data',\n 'c:isBoolean': 'The received value is not {{e}}',\n 'c:date': 'The received value is not a valid instance of Date',\n //@@end\n};\n\nlet data: Record<string, Record<string, string>> = {\n default: { ...defaultErrorMap },\n};\n\nexport function setToDefaultLocale({\n key,\n message,\n}: {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (expected: any): RequiredValidation;\n key: string;\n message: string;\n}) {\n const defaultLocale = data.default!;\n if (defaultLocale[key]) throw new BuildSchemaError('Duplicate default message key');\n defaultLocale[key] = message;\n}\n\nexport function setLocale(lng: string, custom: Partial<TranslationErrorMap>) {\n if (lng === 'default') throw new BuildSchemaError('Invalid language');\n if (!data[lng]) data[lng] = { ...defaultErrorMap };\n const locale = data[lng]!;\n Object.entries(custom).forEach(([messageKey, messageValue]) => {\n locale[messageKey] = messageValue!;\n });\n}\n\nexport function clearLocales() {\n data = {\n default: { ...defaultErrorMap },\n };\n}\n\nexport function getTranslationByLocale(lng?: string): TranslationErrorMap {\n if (!lng) return data['default'] as TranslationErrorMap;\n return (data[lng] ?? data['default']) as TranslationErrorMap;\n}\n"],"mappings":";;;;;AAKA,IAAM,kBAAuC;AAAA;AAAA,EAE3C,cAAc;AAAA,EACd,cAAc;AAAA,EACd,WAAW;AAAA,EACX,gBAAgB;AAAA,EAChB,uBAAuB;AAAA,EACvB,0BAA0B;AAAA,EAC1B,sBAAsB;AAAA,EACtB,iBAAiB;AAAA,EACjB,eAAe;AAAA,EACf,UAAU;AAAA;AAEZ;AAEA,IAAI,OAA+C;AAAA,EACjD,SAAS,EAAE,GAAG,gBAAgB;AAChC;AAEO,SAAS,mBAAmB;AAAA,EACjC;AAAA,EACA;AACF,GAKG;AACD,QAAM,gBAAgB,KAAK;AAC3B,MAAI,cAAc,GAAG,EAAG,OAAM,IAAI,iBAAiB,+BAA+B;AAClF,gBAAc,GAAG,IAAI;AACvB;AAEO,SAAS,UAAU,KAAa,QAAsC;AAC3E,MAAI,QAAQ,UAAW,OAAM,IAAI,iBAAiB,kBAAkB;AACpE,MAAI,CAAC,KAAK,GAAG,EAAG,MAAK,GAAG,IAAI,EAAE,GAAG,gBAAgB;AACjD,QAAM,SAAS,KAAK,GAAG;AACvB,SAAO,QAAQ,MAAM,EAAE,QAAQ,CAAC,CAAC,YAAY,YAAY,MAAM;AAC7D,WAAO,UAAU,IAAI;AAAA,EACvB,CAAC;AACH;AAEO,SAAS,eAAe;AAC7B,SAAO;AAAA,IACL,SAAS,EAAE,GAAG,gBAAgB;AAAA,EAChC;AACF;AAEO,SAAS,uBAAuB,KAAmC;AACxE,MAAI,CAAC,IAAK,QAAO,KAAK,SAAS;AAC/B,SAAQ,KAAK,GAAG,KAAK,KAAK,SAAS;AACrC;","names":[]}
|
package/lib/chunk-RAJF6LMF.js
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); var _class;
|
|
2
|
-
|
|
3
|
-
var _chunkUTPG4GZBjs = require('./chunk-UTPG4GZB.js');
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
var _chunk32MKEBKRjs = require('./chunk-32MKEBKR.js');
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
var _chunk42J6CHIOjs = require('./chunk-42J6CHIO.js');
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
var _chunk3ZQ4ORQHjs = require('./chunk-3ZQ4ORQH.js');
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
var _chunkMMWS3SXRjs = require('./chunk-MMWS3SXR.js');
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
var _chunkFIDPCCCWjs = require('./chunk-FIDPCCCW.js');
|
|
19
|
-
|
|
20
|
-
// src/schemas/StringSchema.ts
|
|
21
|
-
var StringSchema = (_class = class extends _chunkMMWS3SXRjs.CommonSchema {constructor(...args) { super(...args); _class.prototype.__init.call(this); }
|
|
22
|
-
__init() {this._string = 1}
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Restricts the schema to exactly match the specified value and infers the literal value as the TypeScript type.
|
|
26
|
-
*
|
|
27
|
-
* @param expectedValue - The value that the schema must exactly match.
|
|
28
|
-
* @returns - The schema instance restricted to the specified value, with the literal value inferred as the TypeScript type
|
|
29
|
-
*
|
|
30
|
-
* @example - string().equalTo('hello'); // Infers the type 'hello'
|
|
31
|
-
*/
|
|
32
|
-
equalTo(expectedValue) {
|
|
33
|
-
this.limitCheck();
|
|
34
|
-
_chunk3ZQ4ORQHjs._setStrictType.call(void 0, this, `'${expectedValue}'`);
|
|
35
|
-
return this.custom(_chunkUTPG4GZBjs.equalTo.call(void 0, expectedValue));
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Restricts the schema to match one of the specified values and infers the union of those values as the TypeScript type.
|
|
39
|
-
*
|
|
40
|
-
* @param expectedValues - An array of values that the schema can match.
|
|
41
|
-
* @returns - The schema instance restricted to one of the specified values, with the union of those values inferred as the TypeScript type.
|
|
42
|
-
*
|
|
43
|
-
* @example
|
|
44
|
-
* string().oneOfValues(['foo', 'bar']); // Infers the type 'foo' | 'bar'
|
|
45
|
-
*/
|
|
46
|
-
oneOfValues(expectedValue) {
|
|
47
|
-
this.limitCheck();
|
|
48
|
-
_chunk3ZQ4ORQHjs._setStrictType.call(void 0,
|
|
49
|
-
this,
|
|
50
|
-
expectedValue.map((el) => `'${el}'`)
|
|
51
|
-
);
|
|
52
|
-
return this.custom(_chunk32MKEBKRjs.oneOfValues.call(void 0, expectedValue));
|
|
53
|
-
}
|
|
54
|
-
limitCheck() {
|
|
55
|
-
if (this.limit) throw new (0, _chunkFIDPCCCWjs.BuildSchemaError)(_chunk42J6CHIOjs.ONLY_ONCE);
|
|
56
|
-
this.limit = true;
|
|
57
|
-
}
|
|
58
|
-
}, _class);
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
exports.StringSchema = StringSchema;
|
|
63
|
-
//# sourceMappingURL=chunk-RAJF6LMF.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/bguard/bguard/lib/chunk-RAJF6LMF.js","../src/schemas/StringSchema.ts"],"names":[],"mappings":"AAAA;AACE;AACF,sDAA4B;AAC5B;AACE;AACF,sDAA4B;AAC5B;AACE;AACF,sDAA4B;AAC5B;AACE;AACF,sDAA4B;AAC5B;AACE;AACF,sDAA4B;AAC5B;AACE;AACF,sDAA4B;AAC5B;AACA;ACXO,IAAM,aAAA,YAAN,MAAA,QAA2B,8BAAa;AAAA,iBACnC,QAAA,EAAU,EAAA;AAAA,EACZ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUD,OAAA,CAA0B,aAAA,EAA2C;AAC1E,IAAA,IAAA,CAAK,UAAA,CAAW,CAAA;AAChB,IAAA,6CAAA,IAAe,EAAM,CAAA,CAAA,EAAI,aAAa,CAAA,CAAA,CAAG,CAAA;AAEzC,IAAA,OAAO,IAAA,CAAK,MAAA,CAAO,sCAAA,aAAqB,CAAC,CAAA;AAAA,EAC3C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWO,WAAA,CAA8B,aAAA,EAA6C;AAChF,IAAA,IAAA,CAAK,UAAA,CAAW,CAAA;AAChB,IAAA,6CAAA;AAAA,MACE,IAAA;AAAA,MACA,aAAA,CAAc,GAAA,CAAI,CAAC,EAAA,EAAA,GAAO,CAAA,CAAA,EAAI,EAAE,CAAA,CAAA,CAAG;AAAA,IACrC,CAAA;AACA,IAAA,OAAO,IAAA,CAAK,MAAA,CAAO,0CAAA,aAAyB,CAAC,CAAA;AAAA,EAC/C;AAAA,EAEQ,UAAA,CAAA,EAAa;AACnB,IAAA,GAAA,CAAI,IAAA,CAAK,KAAA,EAAO,MAAM,IAAI,sCAAA,CAAiB,0BAAS,CAAA;AACpD,IAAA,IAAA,CAAK,MAAA,EAAQ,IAAA;AAAA,EACf;AACF,UAAA;ADSA;AACA;AACE;AACF,oCAAC","file":"/home/runner/work/bguard/bguard/lib/chunk-RAJF6LMF.js","sourcesContent":[null,"import { equalTo } from '../asserts/mix/equalTo';\nimport { oneOfValues } from '../asserts/mix/oneOfValues';\nimport { WithBGuardType } from '../commonTypes';\nimport { BuildSchemaError } from '../exceptions';\nimport { ONLY_ONCE } from '../helpers/constants';\nimport { _setStrictType } from '../helpers/setStrictType';\nimport { CommonSchema } from './CommonSchema';\n\nexport class StringSchema extends CommonSchema {\n protected _string = 1;\n private limit: boolean | undefined;\n\n /**\n * Restricts the schema to exactly match the specified value and infers the literal value as the TypeScript type.\n *\n * @param expectedValue - The value that the schema must exactly match.\n * @returns - The schema instance restricted to the specified value, with the literal value inferred as the TypeScript type\n *\n * @example - string().equalTo('hello'); // Infers the type 'hello'\n */\n public equalTo<Y extends string>(expectedValue: Y): WithBGuardType<this, Y> {\n this.limitCheck();\n _setStrictType(this, `'${expectedValue}'`);\n\n return this.custom(equalTo(expectedValue)) as WithBGuardType<this, Y>;\n }\n\n /**\n * Restricts the schema to match one of the specified values and infers the union of those values as the TypeScript type.\n *\n * @param expectedValues - An array of values that the schema can match.\n * @returns - The schema instance restricted to one of the specified values, with the union of those values inferred as the TypeScript type.\n *\n * @example\n * string().oneOfValues(['foo', 'bar']); // Infers the type 'foo' | 'bar'\n */\n public oneOfValues<Y extends string>(expectedValue: Y[]): WithBGuardType<this, Y> {\n this.limitCheck();\n _setStrictType(\n this,\n expectedValue.map((el) => `'${el}'`),\n );\n return this.custom(oneOfValues(expectedValue)) as WithBGuardType<this, Y>;\n }\n\n private limitCheck() {\n if (this.limit) throw new BuildSchemaError(ONLY_ONCE);\n this.limit = true;\n }\n}\n"]}
|
package/lib/chunk-RG5NYH2I.js
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); var _class;
|
|
2
|
-
|
|
3
|
-
var _chunkUTPG4GZBjs = require('./chunk-UTPG4GZB.js');
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
var _chunk32MKEBKRjs = require('./chunk-32MKEBKR.js');
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
var _chunk42J6CHIOjs = require('./chunk-42J6CHIO.js');
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
var _chunk3ZQ4ORQHjs = require('./chunk-3ZQ4ORQH.js');
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
var _chunkMMWS3SXRjs = require('./chunk-MMWS3SXR.js');
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
var _chunkFIDPCCCWjs = require('./chunk-FIDPCCCW.js');
|
|
19
|
-
|
|
20
|
-
// src/schemas/BigIntSchema.ts
|
|
21
|
-
var BigIntSchema = (_class = class extends _chunkMMWS3SXRjs.CommonSchema {constructor(...args) { super(...args); _class.prototype.__init.call(this); }
|
|
22
|
-
__init() {this._bigint = 1}
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Restricts the schema to exactly match the specified value and infers the literal value as the TypeScript type.
|
|
26
|
-
*
|
|
27
|
-
* @param expectedValue - The value that the schema must exactly match.
|
|
28
|
-
* @returns - The schema instance restricted to the specified value, with the literal value inferred as the TypeScript type
|
|
29
|
-
*
|
|
30
|
-
* @example - bigint().equalTo(42n); // Infers the type 42n
|
|
31
|
-
*/
|
|
32
|
-
equalTo(expectedValue) {
|
|
33
|
-
this.defaultValueCheck();
|
|
34
|
-
this.limitCheck();
|
|
35
|
-
_chunk3ZQ4ORQHjs._setStrictType.call(void 0, this, `${expectedValue}n`);
|
|
36
|
-
return this.custom(_chunkUTPG4GZBjs.equalTo.call(void 0, expectedValue));
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Restricts the schema to match one of the specified values and infers the union of those values as the TypeScript type.
|
|
40
|
-
*
|
|
41
|
-
* @param expectedValues - An array of values that the schema can match.
|
|
42
|
-
* @returns - The schema instance restricted to one of the specified values, with the union of those values inferred as the TypeScript type.
|
|
43
|
-
*
|
|
44
|
-
* @example
|
|
45
|
-
* bigint().oneOfValues([5n, 7n]); // Infers the type 5n | 7n
|
|
46
|
-
*/
|
|
47
|
-
oneOfValues(expectedValue) {
|
|
48
|
-
this.defaultValueCheck();
|
|
49
|
-
this.limitCheck();
|
|
50
|
-
_chunk3ZQ4ORQHjs._setStrictType.call(void 0,
|
|
51
|
-
this,
|
|
52
|
-
expectedValue.map((el) => `${el}n`)
|
|
53
|
-
);
|
|
54
|
-
return this.custom(_chunk32MKEBKRjs.oneOfValues.call(void 0, expectedValue));
|
|
55
|
-
}
|
|
56
|
-
limitCheck() {
|
|
57
|
-
if (this.limit) throw new (0, _chunkFIDPCCCWjs.BuildSchemaError)(_chunk42J6CHIOjs.ONLY_ONCE);
|
|
58
|
-
this.limit = true;
|
|
59
|
-
}
|
|
60
|
-
}, _class);
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
exports.BigIntSchema = BigIntSchema;
|
|
65
|
-
//# sourceMappingURL=chunk-RG5NYH2I.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/bguard/bguard/lib/chunk-RG5NYH2I.js","../src/schemas/BigIntSchema.ts"],"names":[],"mappings":"AAAA;AACE;AACF,sDAA4B;AAC5B;AACE;AACF,sDAA4B;AAC5B;AACE;AACF,sDAA4B;AAC5B;AACE;AACF,sDAA4B;AAC5B;AACE;AACF,sDAA4B;AAC5B;AACE;AACF,sDAA4B;AAC5B;AACA;ACXO,IAAM,aAAA,YAAN,MAAA,QAA2B,8BAAa;AAAA,iBACnC,QAAA,EAAU,EAAA;AAAA,EACZ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUD,OAAA,CAA0B,aAAA,EAA2C;AAC1E,IAAA,IAAA,CAAK,iBAAA,CAAkB,CAAA;AACvB,IAAA,IAAA,CAAK,UAAA,CAAW,CAAA;AAChB,IAAA,6CAAA,IAAe,EAAM,CAAA,EAAA;AACF,IAAA;AACrB,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAWqC,EAAA;AAC9B,IAAA;AACW,IAAA;AAChB,IAAA;AACE,MAAA;AACmB,MAAA;AACrB,IAAA;AACmB,IAAA;AACrB,EAAA;AAEqB,EAAA;AACG,IAAA;AACT,IAAA;AACf,EAAA;AACF;ADU0B;AACA;AACA;AACA","file":"/home/runner/work/bguard/bguard/lib/chunk-RG5NYH2I.js","sourcesContent":[null,"import { equalTo } from '../asserts/mix/equalTo';\nimport { oneOfValues } from '../asserts/mix/oneOfValues';\nimport { WithBGuardType } from '../commonTypes';\nimport { BuildSchemaError } from '../exceptions';\nimport { ONLY_ONCE } from '../helpers/constants';\nimport { _setStrictType } from '../helpers/setStrictType';\nimport { CommonSchema } from './CommonSchema';\n\nexport class BigIntSchema extends CommonSchema {\n protected _bigint = 1;\n private limit: boolean | undefined;\n\n /**\n * Restricts the schema to exactly match the specified value and infers the literal value as the TypeScript type.\n *\n * @param expectedValue - The value that the schema must exactly match.\n * @returns - The schema instance restricted to the specified value, with the literal value inferred as the TypeScript type\n *\n * @example - bigint().equalTo(42n); // Infers the type 42n\n */\n public equalTo<Y extends bigint>(expectedValue: Y): WithBGuardType<this, Y> {\n this.defaultValueCheck();\n this.limitCheck();\n _setStrictType(this, `${expectedValue}n`);\n return this.custom(equalTo(expectedValue)) as WithBGuardType<this, Y>;\n }\n\n /**\n * Restricts the schema to match one of the specified values and infers the union of those values as the TypeScript type.\n *\n * @param expectedValues - An array of values that the schema can match.\n * @returns - The schema instance restricted to one of the specified values, with the union of those values inferred as the TypeScript type.\n *\n * @example\n * bigint().oneOfValues([5n, 7n]); // Infers the type 5n | 7n\n */\n public oneOfValues<Y extends bigint>(expectedValue: Y[]): WithBGuardType<this, Y> {\n this.defaultValueCheck();\n this.limitCheck();\n _setStrictType(\n this,\n expectedValue.map((el) => `${el}n`),\n );\n return this.custom(oneOfValues(expectedValue)) as WithBGuardType<this, Y>;\n }\n\n private limitCheck() {\n if (this.limit) throw new BuildSchemaError(ONLY_ONCE);\n this.limit = true;\n }\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/schemas/BigIntSchema.ts"],"sourcesContent":["import { equalTo } from '../asserts/mix/equalTo';\nimport { oneOfValues } from '../asserts/mix/oneOfValues';\nimport { WithBGuardType } from '../commonTypes';\nimport { BuildSchemaError } from '../exceptions';\nimport { ONLY_ONCE } from '../helpers/constants';\nimport { _setStrictType } from '../helpers/setStrictType';\nimport { CommonSchema } from './CommonSchema';\n\nexport class BigIntSchema extends CommonSchema {\n protected _bigint = 1;\n private limit: boolean | undefined;\n\n /**\n * Restricts the schema to exactly match the specified value and infers the literal value as the TypeScript type.\n *\n * @param expectedValue - The value that the schema must exactly match.\n * @returns - The schema instance restricted to the specified value, with the literal value inferred as the TypeScript type\n *\n * @example - bigint().equalTo(42n); // Infers the type 42n\n */\n public equalTo<Y extends bigint>(expectedValue: Y): WithBGuardType<this, Y> {\n this.defaultValueCheck();\n this.limitCheck();\n _setStrictType(this, `${expectedValue}n`);\n return this.custom(equalTo(expectedValue)) as WithBGuardType<this, Y>;\n }\n\n /**\n * Restricts the schema to match one of the specified values and infers the union of those values as the TypeScript type.\n *\n * @param expectedValues - An array of values that the schema can match.\n * @returns - The schema instance restricted to one of the specified values, with the union of those values inferred as the TypeScript type.\n *\n * @example\n * bigint().oneOfValues([5n, 7n]); // Infers the type 5n | 7n\n */\n public oneOfValues<Y extends bigint>(expectedValue: Y[]): WithBGuardType<this, Y> {\n this.defaultValueCheck();\n this.limitCheck();\n _setStrictType(\n this,\n expectedValue.map((el) => `${el}n`),\n );\n return this.custom(oneOfValues(expectedValue)) as WithBGuardType<this, Y>;\n }\n\n private limitCheck() {\n if (this.limit) throw new BuildSchemaError(ONLY_ONCE);\n this.limit = true;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAQO,IAAM,eAAN,cAA2B,aAAa;AAAA,EACnC,UAAU;AAAA,EACZ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUD,QAA0B,eAA2C;AAC1E,SAAK,kBAAkB;AACvB,SAAK,WAAW;AAChB,mBAAe,MAAM,GAAG,aAAa,GAAG;AACxC,WAAO,KAAK,OAAO,QAAQ,aAAa,CAAC;AAAA,EAC3C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWO,YAA8B,eAA6C;AAChF,SAAK,kBAAkB;AACvB,SAAK,WAAW;AAChB;AAAA,MACE;AAAA,MACA,cAAc,IAAI,CAAC,OAAO,GAAG,EAAE,GAAG;AAAA,IACpC;AACA,WAAO,KAAK,OAAO,YAAY,aAAa,CAAC;AAAA,EAC/C;AAAA,EAEQ,aAAa;AACnB,QAAI,KAAK,MAAO,OAAM,IAAI,iBAAiB,SAAS;AACpD,SAAK,QAAQ;AAAA,EACf;AACF;","names":[]}
|
package/lib/chunk-UEYMBPZN.mjs
DELETED
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
parseOrFail
|
|
3
|
-
} from "./chunk-IFQLPXCZ.mjs";
|
|
4
|
-
import {
|
|
5
|
-
ctxSymbol
|
|
6
|
-
} from "./chunk-MQRXWXHP.mjs";
|
|
7
|
-
import {
|
|
8
|
-
BuildSchemaError
|
|
9
|
-
} from "./chunk-ZTCXXAKD.mjs";
|
|
10
|
-
|
|
11
|
-
// src/schemas/CommonSchema.ts
|
|
12
|
-
var CommonSchema = class {
|
|
13
|
-
[ctxSymbol];
|
|
14
|
-
constructor(ctx) {
|
|
15
|
-
this[ctxSymbol] = ctx;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* @param validators - One or more custom validation functions.
|
|
19
|
-
* @returns {this} The schema instance with the added custom validation.
|
|
20
|
-
*/
|
|
21
|
-
custom(...validators) {
|
|
22
|
-
this.defaultValueCheck();
|
|
23
|
-
this[ctxSymbol].requiredValidations.push(...validators);
|
|
24
|
-
return this;
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Marks the schema as nullable, allowing the value to be `null`.
|
|
28
|
-
*
|
|
29
|
-
* @returns {WithNull<this>} The schema instance marked as nullable.
|
|
30
|
-
*/
|
|
31
|
-
nullable() {
|
|
32
|
-
this.defaultValueCheck();
|
|
33
|
-
this[ctxSymbol].isNullable = true;
|
|
34
|
-
return this;
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Marks the schema as optional, allowing the value to be `undefined`.
|
|
38
|
-
*
|
|
39
|
-
* @returns {WithUndefined<this>} The schema instance marked as optional.
|
|
40
|
-
*/
|
|
41
|
-
optional() {
|
|
42
|
-
this.defaultValueCheck();
|
|
43
|
-
this[ctxSymbol].isOptional = true;
|
|
44
|
-
return this;
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Marks the schema as optional, allowing the value to be `undefined`.
|
|
48
|
-
*
|
|
49
|
-
* @returns {this} The schema instance. This method should be used as a last one because it does the check of previous methods and
|
|
50
|
-
*/
|
|
51
|
-
default(defaultValue) {
|
|
52
|
-
const ctx = this[ctxSymbol];
|
|
53
|
-
if (ctx.isOptional) {
|
|
54
|
-
throw new BuildSchemaError(`Cannot call method 'default' after method 'optional'`);
|
|
55
|
-
}
|
|
56
|
-
try {
|
|
57
|
-
parseOrFail(this, defaultValue);
|
|
58
|
-
} catch (e) {
|
|
59
|
-
throw new BuildSchemaError(e.message);
|
|
60
|
-
}
|
|
61
|
-
this[ctxSymbol].defaultValue = defaultValue;
|
|
62
|
-
return this;
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* Applies a transformation to the input value before any validation occurs.
|
|
66
|
-
* The transformation should return a value of the same type as the inferred type of the schema,
|
|
67
|
-
* ensuring that the overall type is not altered.
|
|
68
|
-
*
|
|
69
|
-
* @template In - The type of the input value before transformation (defaults to `unknown`).
|
|
70
|
-
* @param {TransformCallback<In, InferType<this>>} cb - The callback function that performs the transformation.
|
|
71
|
-
* @returns {this} The updated schema with the applied transformation.
|
|
72
|
-
*
|
|
73
|
-
* @example
|
|
74
|
-
* const schema = string()
|
|
75
|
-
* .nullable()
|
|
76
|
-
* .transformBeforeValidation((val) => val + '') // Ensure the value is a string
|
|
77
|
-
* .transformBeforeValidation((val: string) => (val === '' ? null : val)); // Convert empty strings to null
|
|
78
|
-
*
|
|
79
|
-
* // Parse 'test' will pass as 'test' is a valid string longer than 3 characters.
|
|
80
|
-
* parseOrFail(schema, 'test');
|
|
81
|
-
*
|
|
82
|
-
* // Parsing '' will be transformed to null and will pass due to .nullable().
|
|
83
|
-
* parseOrFail(schema, '');
|
|
84
|
-
*/
|
|
85
|
-
transformBeforeValidation(cb) {
|
|
86
|
-
const ctx = this[ctxSymbol];
|
|
87
|
-
if (ctx.transformListBefore) {
|
|
88
|
-
ctx.transformListBefore.push(cb);
|
|
89
|
-
} else {
|
|
90
|
-
ctx.transformListBefore = [cb];
|
|
91
|
-
}
|
|
92
|
-
return this;
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
|
-
* Assigns a unique identifier to the schema.
|
|
96
|
-
* This ID can be used to track or map validation errors back to specific fields
|
|
97
|
-
* in a form or other structures.
|
|
98
|
-
*
|
|
99
|
-
* @param {string} value - The unique identifier for the schema.
|
|
100
|
-
* @returns {this} The updated schema with the assigned ID.
|
|
101
|
-
*
|
|
102
|
-
* @example
|
|
103
|
-
* const schema = string().id('username');
|
|
104
|
-
*/
|
|
105
|
-
id(value) {
|
|
106
|
-
return this.meta("id", value);
|
|
107
|
-
}
|
|
108
|
-
/**
|
|
109
|
-
* Provides a description for the schema, offering additional context or information.
|
|
110
|
-
* The description can be used when displaying validation errors or for documentation purposes.
|
|
111
|
-
*
|
|
112
|
-
* @param {string} value - The description for the schema.
|
|
113
|
-
* @returns {this} The updated schema with the added description.
|
|
114
|
-
*
|
|
115
|
-
* @example
|
|
116
|
-
* const schema = string().description('The username of the account holder.');
|
|
117
|
-
*/
|
|
118
|
-
description(value) {
|
|
119
|
-
return this.meta("description", value);
|
|
120
|
-
}
|
|
121
|
-
meta(key, value) {
|
|
122
|
-
const ctx = this[ctxSymbol];
|
|
123
|
-
ctx.meta = { ...ctx.meta, [key]: value };
|
|
124
|
-
return this;
|
|
125
|
-
}
|
|
126
|
-
defaultValueCheck() {
|
|
127
|
-
if (this[ctxSymbol].defaultValue !== void 0) {
|
|
128
|
-
throw new BuildSchemaError("Default value must be the last method called in schema");
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
};
|
|
132
|
-
|
|
133
|
-
export {
|
|
134
|
-
CommonSchema
|
|
135
|
-
};
|
|
136
|
-
//# sourceMappingURL=chunk-UEYMBPZN.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/schemas/CommonSchema.ts"],"sourcesContent":["import type { RequiredValidation } from '../ExceptionContext';\nimport { InferType } from '../InferType';\nimport { MetaContext, BaseType, WithNull, WithUndefined, TransformCallback } from '../commonTypes';\nimport { BuildSchemaError } from '../exceptions';\nimport { ctxSymbol } from '../helpers/core';\nimport { parseOrFail } from '../parseOrFail';\n\nexport type ObjectShapeSchemaType = Record<string, CommonSchema>;\n\nexport interface ValidatorContext {\n type: BaseType[];\n isNullable?: boolean;\n isOptional?: boolean;\n requiredValidations: RequiredValidation[];\n array?: CommonSchema;\n object?: ObjectShapeSchemaType;\n allowUnrecognizedObjectProps?: boolean;\n strictType?: boolean;\n strictTypeValue?: unknown;\n date?: boolean;\n defaultValue?: unknown;\n meta?: MetaContext;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n transformListBefore?: TransformCallback<any, any>[];\n}\n\nexport class CommonSchema {\n [ctxSymbol]: ValidatorContext;\n constructor(ctx: ValidatorContext) {\n this[ctxSymbol] = ctx;\n }\n\n /**\n * @param validators - One or more custom validation functions.\n * @returns {this} The schema instance with the added custom validation.\n */\n public custom(...validators: RequiredValidation[]): this {\n this.defaultValueCheck();\n this[ctxSymbol].requiredValidations.push(...validators);\n return this;\n }\n\n /**\n * Marks the schema as nullable, allowing the value to be `null`.\n *\n * @returns {WithNull<this>} The schema instance marked as nullable.\n */\n public nullable(): WithNull<this> {\n this.defaultValueCheck();\n this[ctxSymbol].isNullable = true;\n return this as WithNull<this>;\n }\n\n /**\n * Marks the schema as optional, allowing the value to be `undefined`.\n *\n * @returns {WithUndefined<this>} The schema instance marked as optional.\n */\n public optional(): WithUndefined<this> {\n this.defaultValueCheck();\n this[ctxSymbol].isOptional = true;\n return this as WithUndefined<this>;\n }\n\n /**\n * Marks the schema as optional, allowing the value to be `undefined`.\n *\n * @returns {this} The schema instance. This method should be used as a last one because it does the check of previous methods and\n */\n public default(defaultValue: InferType<this>): this {\n const ctx = this[ctxSymbol];\n if (ctx.isOptional) {\n throw new BuildSchemaError(`Cannot call method 'default' after method 'optional'`);\n }\n\n try {\n parseOrFail(this, defaultValue);\n } catch (e) {\n throw new BuildSchemaError((e as Error).message);\n }\n\n this[ctxSymbol].defaultValue = defaultValue;\n return this;\n }\n\n /**\n * Applies a transformation to the input value before any validation occurs.\n * The transformation should return a value of the same type as the inferred type of the schema,\n * ensuring that the overall type is not altered.\n *\n * @template In - The type of the input value before transformation (defaults to `unknown`).\n * @param {TransformCallback<In, InferType<this>>} cb - The callback function that performs the transformation.\n * @returns {this} The updated schema with the applied transformation.\n *\n * @example\n * const schema = string()\n * .nullable()\n * .transformBeforeValidation((val) => val + '') // Ensure the value is a string\n * .transformBeforeValidation((val: string) => (val === '' ? null : val)); // Convert empty strings to null\n *\n * // Parse 'test' will pass as 'test' is a valid string longer than 3 characters.\n * parseOrFail(schema, 'test');\n *\n * // Parsing '' will be transformed to null and will pass due to .nullable().\n * parseOrFail(schema, '');\n */\n public transformBeforeValidation<In>(cb: TransformCallback<In, InferType<this>>): this {\n const ctx = this[ctxSymbol];\n if (ctx.transformListBefore) {\n ctx.transformListBefore.push(cb);\n } else {\n ctx.transformListBefore = [cb];\n }\n\n return this;\n }\n\n /**\n * Assigns a unique identifier to the schema.\n * This ID can be used to track or map validation errors back to specific fields\n * in a form or other structures.\n *\n * @param {string} value - The unique identifier for the schema.\n * @returns {this} The updated schema with the assigned ID.\n *\n * @example\n * const schema = string().id('username');\n */\n public id(value: string): this {\n return this.meta('id', value);\n }\n\n /**\n * Provides a description for the schema, offering additional context or information.\n * The description can be used when displaying validation errors or for documentation purposes.\n *\n * @param {string} value - The description for the schema.\n * @returns {this} The updated schema with the added description.\n *\n * @example\n * const schema = string().description('The username of the account holder.');\n */\n public description(value: string): this {\n return this.meta('description', value);\n }\n\n private meta(key: string, value: string): this {\n const ctx = this[ctxSymbol];\n ctx.meta = { ...ctx.meta, [key]: value };\n return this;\n }\n\n protected defaultValueCheck() {\n if (this[ctxSymbol].defaultValue !== undefined) {\n throw new BuildSchemaError('Default value must be the last method called in schema');\n }\n }\n}\n\ntype TypeMapping = {\n number: number;\n string: string;\n boolean: boolean;\n undefined: undefined;\n object: object;\n // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type\n function: Function;\n symbol: symbol;\n bigint: bigint;\n};\n\nexport type MapMixTypes<T extends BaseType[]> = T extends (infer U)[]\n ? U extends keyof TypeMapping\n ? TypeMapping[U]\n : never\n : never;\n"],"mappings":";;;;;;;;;;;AA0BO,IAAM,eAAN,MAAmB;AAAA,EACxB,CAAC,SAAS;AAAA,EACV,YAAY,KAAuB;AACjC,SAAK,SAAS,IAAI;AAAA,EACpB;AAAA;AAAA;AAAA;AAAA;AAAA,EAMO,UAAU,YAAwC;AACvD,SAAK,kBAAkB;AACvB,SAAK,SAAS,EAAE,oBAAoB,KAAK,GAAG,UAAU;AACtD,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOO,WAA2B;AAChC,SAAK,kBAAkB;AACvB,SAAK,SAAS,EAAE,aAAa;AAC7B,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOO,WAAgC;AACrC,SAAK,kBAAkB;AACvB,SAAK,SAAS,EAAE,aAAa;AAC7B,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOO,QAAQ,cAAqC;AAClD,UAAM,MAAM,KAAK,SAAS;AAC1B,QAAI,IAAI,YAAY;AAClB,YAAM,IAAI,iBAAiB,sDAAsD;AAAA,IACnF;AAEA,QAAI;AACF,kBAAY,MAAM,YAAY;AAAA,IAChC,SAAS,GAAG;AACV,YAAM,IAAI,iBAAkB,EAAY,OAAO;AAAA,IACjD;AAEA,SAAK,SAAS,EAAE,eAAe;AAC/B,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAuBO,0BAA8B,IAAkD;AACrF,UAAM,MAAM,KAAK,SAAS;AAC1B,QAAI,IAAI,qBAAqB;AAC3B,UAAI,oBAAoB,KAAK,EAAE;AAAA,IACjC,OAAO;AACL,UAAI,sBAAsB,CAAC,EAAE;AAAA,IAC/B;AAEA,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAaO,GAAG,OAAqB;AAC7B,WAAO,KAAK,KAAK,MAAM,KAAK;AAAA,EAC9B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAYO,YAAY,OAAqB;AACtC,WAAO,KAAK,KAAK,eAAe,KAAK;AAAA,EACvC;AAAA,EAEQ,KAAK,KAAa,OAAqB;AAC7C,UAAM,MAAM,KAAK,SAAS;AAC1B,QAAI,OAAO,EAAE,GAAG,IAAI,MAAM,CAAC,GAAG,GAAG,MAAM;AACvC,WAAO;AAAA,EACT;AAAA,EAEU,oBAAoB;AAC5B,QAAI,KAAK,SAAS,EAAE,iBAAiB,QAAW;AAC9C,YAAM,IAAI,iBAAiB,wDAAwD;AAAA,IACrF;AAAA,EACF;AACF;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/bguard/bguard/lib/chunk-UTPG4GZB.js","../src/asserts/mix/equalTo.ts"],"names":[],"mappings":"AAAA;AACE;AACF,sDAA4B;AAC5B;AACA;ACDA,IAAM,oBAAA,EAAsB,6CAAA;AAC5B,IAAM,gBAAA,EAAkB,WAAA;AAejB,IAAM,QAAA,EACX,CAAC,QAAA,EAAA,GACD,CAAC,QAAA,EAAmB,GAAA,EAAA,GAA0B;AAC5C,EAAA,GAAA,CAAI,SAAA,IAAa,QAAA,EAAU,GAAA,CAAI,QAAA,CAAS,QAAA,EAAU,QAAA,EAAU,eAAe,CAAA;AAC7E,CAAA;AAEF,OAAA,CAAQ,IAAA,EAAM,eAAA;AACd,OAAA,CAAQ,QAAA,EAAU,mBAAA;AAClB,iDAAA,OAA0B,CAAA;ADd1B;AACA;AACE;AACF,0BAAC","file":"/home/runner/work/bguard/bguard/lib/chunk-UTPG4GZB.js","sourcesContent":[null,"import { ExceptionContext, RequiredValidation } from '../../ExceptionContext';\nimport { setToDefaultLocale } from '../../translationMap';\n\nconst equalToErrorMessage = 'The received value is not equal to expected';\nconst equalToErrorKey = 'm:equalTo';\n\n/**\n * @description Creates a custom assertion that checks if a value is equal to the expected value.\n * @notice It has already been implemented in the number, bigint and string schema. There is no need to use it as a custom assert.\n * @param {unknown} expected The value that the received value is expected to match.\n * @returns {RequiredValidation} A validation function that takes a received value and an exception context.\n * @throws {ValidationError} If the received value does not match the expected value.\n * @example\n * const schema = number().custom(equalTo(5)); // Define a schema with a custom assertion\n * parseOrFail(schema, 5); // Valid\n * parseOrFail(schema, 3); // Throws an error: 'The received value is not equal to expected'\n *\n * @translation Error Translation Key = 'm:equalTo'\n */\nexport const equalTo =\n (expected: unknown): RequiredValidation =>\n (received: unknown, ctx: ExceptionContext) => {\n if (expected !== received) ctx.addIssue(expected, received, equalToErrorKey);\n };\n\nequalTo.key = equalToErrorKey;\nequalTo.message = equalToErrorMessage;\nsetToDefaultLocale(equalTo);\n"]}
|
package/lib/chunk-VIFJBTQO.mjs
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
CommonSchema
|
|
3
|
-
} from "./chunk-UEYMBPZN.mjs";
|
|
4
|
-
import {
|
|
5
|
-
ctxSymbol
|
|
6
|
-
} from "./chunk-MQRXWXHP.mjs";
|
|
7
|
-
|
|
8
|
-
// src/schemas/DateSchema.ts
|
|
9
|
-
var DateSchema = class extends CommonSchema {
|
|
10
|
-
_date = 1;
|
|
11
|
-
constructor(ctx) {
|
|
12
|
-
super(ctx);
|
|
13
|
-
this[ctxSymbol].date = true;
|
|
14
|
-
}
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
export {
|
|
18
|
-
DateSchema
|
|
19
|
-
};
|
|
20
|
-
//# sourceMappingURL=chunk-VIFJBTQO.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/schemas/DateSchema.ts"],"sourcesContent":["import { ctxSymbol } from '../helpers/core';\nimport { CommonSchema, ValidatorContext } from './CommonSchema';\n\nexport class DateSchema extends CommonSchema {\n protected _date = 1;\n\n constructor(ctx: ValidatorContext) {\n super(ctx);\n this[ctxSymbol].date = true;\n }\n}\n"],"mappings":";;;;;;;;AAGO,IAAM,aAAN,cAAyB,aAAa;AAAA,EACjC,QAAQ;AAAA,EAElB,YAAY,KAAuB;AACjC,UAAM,GAAG;AACT,SAAK,SAAS,EAAE,OAAO;AAAA,EACzB;AACF;","names":[]}
|
package/lib/chunk-W2SQHSOS.mjs
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
equalTo
|
|
3
|
-
} from "./chunk-EMOOEIPZ.mjs";
|
|
4
|
-
import {
|
|
5
|
-
oneOfValues
|
|
6
|
-
} from "./chunk-P54CF5QN.mjs";
|
|
7
|
-
import {
|
|
8
|
-
ONLY_ONCE
|
|
9
|
-
} from "./chunk-ASZW6XRM.mjs";
|
|
10
|
-
import {
|
|
11
|
-
_setStrictType
|
|
12
|
-
} from "./chunk-YSCVE4PJ.mjs";
|
|
13
|
-
import {
|
|
14
|
-
CommonSchema
|
|
15
|
-
} from "./chunk-UEYMBPZN.mjs";
|
|
16
|
-
import {
|
|
17
|
-
BuildSchemaError
|
|
18
|
-
} from "./chunk-ZTCXXAKD.mjs";
|
|
19
|
-
|
|
20
|
-
// src/schemas/NumberSchema.ts
|
|
21
|
-
var NumberSchema = class extends CommonSchema {
|
|
22
|
-
_number = 1;
|
|
23
|
-
limit;
|
|
24
|
-
/**
|
|
25
|
-
* Restricts the schema to exactly match the specified value and infers the literal value as the TypeScript type.
|
|
26
|
-
*
|
|
27
|
-
* @param expectedValue - The value that the schema must exactly match.
|
|
28
|
-
* @returns - The schema instance restricted to the specified value, with the literal value inferred as the TypeScript type
|
|
29
|
-
*
|
|
30
|
-
* @example - number().equalTo(42); // Infers the type 42
|
|
31
|
-
*/
|
|
32
|
-
equalTo(expectedValue) {
|
|
33
|
-
if (this.limit) throw new BuildSchemaError(ONLY_ONCE);
|
|
34
|
-
this.limit = true;
|
|
35
|
-
_setStrictType(this, expectedValue);
|
|
36
|
-
return this.custom(equalTo(expectedValue));
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Restricts the schema to match one of the specified values and infers the union of those values as the TypeScript type.
|
|
40
|
-
*
|
|
41
|
-
* @param expectedValues - An array of values that the schema can match.
|
|
42
|
-
* @returns - The schema instance restricted to one of the specified values, with the union of those values inferred as the TypeScript type.
|
|
43
|
-
*
|
|
44
|
-
* @example
|
|
45
|
-
* number().oneOfValues([5, 7]); // Infers the type 5 | 7
|
|
46
|
-
*/
|
|
47
|
-
oneOfValues(expectedValue) {
|
|
48
|
-
if (this.limit) throw new BuildSchemaError(ONLY_ONCE);
|
|
49
|
-
this.limit = true;
|
|
50
|
-
_setStrictType(this, expectedValue);
|
|
51
|
-
return this.custom(oneOfValues(expectedValue));
|
|
52
|
-
}
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
export {
|
|
56
|
-
NumberSchema
|
|
57
|
-
};
|
|
58
|
-
//# sourceMappingURL=chunk-W2SQHSOS.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/schemas/NumberSchema.ts"],"sourcesContent":["import { equalTo } from '../asserts/mix/equalTo';\nimport { oneOfValues } from '../asserts/mix/oneOfValues';\nimport { WithBGuardType } from '../commonTypes';\nimport { BuildSchemaError } from '../exceptions';\nimport { ONLY_ONCE } from '../helpers/constants';\nimport { _setStrictType } from '../helpers/setStrictType';\nimport { CommonSchema } from './CommonSchema';\n\nexport class NumberSchema extends CommonSchema {\n protected _number = 1;\n private limit: boolean | undefined;\n\n /**\n * Restricts the schema to exactly match the specified value and infers the literal value as the TypeScript type.\n *\n * @param expectedValue - The value that the schema must exactly match.\n * @returns - The schema instance restricted to the specified value, with the literal value inferred as the TypeScript type\n *\n * @example - number().equalTo(42); // Infers the type 42\n */\n public equalTo<Y extends number>(expectedValue: Y): WithBGuardType<this, Y> {\n if (this.limit) throw new BuildSchemaError(ONLY_ONCE);\n this.limit = true;\n _setStrictType(this, expectedValue);\n return this.custom(equalTo(expectedValue)) as WithBGuardType<this, Y>;\n }\n\n /**\n * Restricts the schema to match one of the specified values and infers the union of those values as the TypeScript type.\n *\n * @param expectedValues - An array of values that the schema can match.\n * @returns - The schema instance restricted to one of the specified values, with the union of those values inferred as the TypeScript type.\n *\n * @example\n * number().oneOfValues([5, 7]); // Infers the type 5 | 7\n */\n public oneOfValues<Y extends number>(expectedValue: Y[]): WithBGuardType<this, Y> {\n if (this.limit) throw new BuildSchemaError(ONLY_ONCE);\n this.limit = true;\n _setStrictType(this, expectedValue);\n return this.custom(oneOfValues(expectedValue)) as WithBGuardType<this, Y>;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAQO,IAAM,eAAN,cAA2B,aAAa;AAAA,EACnC,UAAU;AAAA,EACZ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUD,QAA0B,eAA2C;AAC1E,QAAI,KAAK,MAAO,OAAM,IAAI,iBAAiB,SAAS;AACpD,SAAK,QAAQ;AACb,mBAAe,MAAM,aAAa;AAClC,WAAO,KAAK,OAAO,QAAQ,aAAa,CAAC;AAAA,EAC3C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWO,YAA8B,eAA6C;AAChF,QAAI,KAAK,MAAO,OAAM,IAAI,iBAAiB,SAAS;AACpD,SAAK,QAAQ;AACb,mBAAe,MAAM,aAAa;AAClC,WAAO,KAAK,OAAO,YAAY,aAAa,CAAC;AAAA,EAC/C;AACF;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/schemas/ArraySchema.ts"],"sourcesContent":["import { ctxSymbol } from '../helpers/core';\nimport { BuildSchemaError } from '../exceptions';\nimport { CommonSchema, ValidatorContext } from './CommonSchema';\n\nexport class ArraySchema extends CommonSchema {\n protected _array = 1;\n constructor(ctx: ValidatorContext, arraySchema: CommonSchema) {\n super(ctx);\n this.validateArrayEntry(arraySchema);\n this[ctxSymbol].array = arraySchema;\n }\n\n private validateArrayEntry(arraySchema: CommonSchema) {\n if (!arraySchema) throw new BuildSchemaError('Missing schema in array method');\n if (!(arraySchema instanceof CommonSchema)) throw new BuildSchemaError('Invalid schema in array method');\n }\n}\n"],"mappings":";;;;;;;;;;;AAIO,IAAM,cAAN,cAA0B,aAAa;AAAA,EAClC,SAAS;AAAA,EACnB,YAAY,KAAuB,aAA2B;AAC5D,UAAM,GAAG;AACT,SAAK,mBAAmB,WAAW;AACnC,SAAK,SAAS,EAAE,QAAQ;AAAA,EAC1B;AAAA,EAEQ,mBAAmB,aAA2B;AACpD,QAAI,CAAC,YAAa,OAAM,IAAI,iBAAiB,gCAAgC;AAC7E,QAAI,EAAE,uBAAuB,cAAe,OAAM,IAAI,iBAAiB,gCAAgC;AAAA,EACzG;AACF;","names":[]}
|
package/lib/chunk-XT5E3MPI.mjs
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
_setStrictType
|
|
3
|
-
} from "./chunk-YSCVE4PJ.mjs";
|
|
4
|
-
import {
|
|
5
|
-
CommonSchema
|
|
6
|
-
} from "./chunk-UEYMBPZN.mjs";
|
|
7
|
-
|
|
8
|
-
// src/schemas/BooleanSchema.ts
|
|
9
|
-
var isBoolean = (expected) => (received, ctx) => {
|
|
10
|
-
if (received !== expected) ctx.addIssue(expected, received, "c:isBoolean");
|
|
11
|
-
};
|
|
12
|
-
var BooleanSchema = class extends CommonSchema {
|
|
13
|
-
_boolean = 1;
|
|
14
|
-
/**
|
|
15
|
-
* Restricts the schema to exactly match the boolean value true and infers the true value as the TypeScript type.
|
|
16
|
-
*
|
|
17
|
-
* @returns - The schema instance restricted to the value true, with the true value inferred as the TypeScript type
|
|
18
|
-
*
|
|
19
|
-
* @example - boolean().onlyTrue(); // Infers the type true
|
|
20
|
-
*/
|
|
21
|
-
onlyTrue() {
|
|
22
|
-
_setStrictType(this, true);
|
|
23
|
-
return this.custom(isBoolean(true));
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Restricts the schema to exactly match the boolean value false and infers the false value as the TypeScript type.
|
|
27
|
-
*
|
|
28
|
-
* @returns - The schema instance restricted to the value false, with the false value inferred as the TypeScript type
|
|
29
|
-
*
|
|
30
|
-
* @example - boolean().onlyFalse(); // Infers the type false
|
|
31
|
-
*/
|
|
32
|
-
onlyFalse() {
|
|
33
|
-
_setStrictType(this, false);
|
|
34
|
-
return this.custom(isBoolean(false));
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
export {
|
|
39
|
-
BooleanSchema
|
|
40
|
-
};
|
|
41
|
-
//# sourceMappingURL=chunk-XT5E3MPI.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/schemas/BooleanSchema.ts"],"sourcesContent":["import { CommonSchema } from './CommonSchema';\nimport { WithBGuardType } from '../commonTypes';\nimport { _setStrictType } from '../helpers/setStrictType';\nimport { ExceptionContext } from '../ExceptionContext';\n\nconst isBoolean = (expected: boolean) => (received: boolean, ctx: ExceptionContext) => {\n if (received !== expected) ctx.addIssue(expected, received, 'c:isBoolean');\n};\n\nexport class BooleanSchema extends CommonSchema {\n protected _boolean = 1;\n\n /**\n * Restricts the schema to exactly match the boolean value true and infers the true value as the TypeScript type.\n *\n * @returns - The schema instance restricted to the value true, with the true value inferred as the TypeScript type\n *\n * @example - boolean().onlyTrue(); // Infers the type true\n */\n public onlyTrue(): WithBGuardType<this, true> {\n _setStrictType(this, true);\n return this.custom(isBoolean(true)) as WithBGuardType<this, true>;\n }\n\n /**\n * Restricts the schema to exactly match the boolean value false and infers the false value as the TypeScript type.\n *\n * @returns - The schema instance restricted to the value false, with the false value inferred as the TypeScript type\n *\n * @example - boolean().onlyFalse(); // Infers the type false\n */\n public onlyFalse(): WithBGuardType<this, false> {\n _setStrictType(this, false);\n return this.custom(isBoolean(false)) as WithBGuardType<this, false>;\n }\n}\n"],"mappings":";;;;;;;;AAKA,IAAM,YAAY,CAAC,aAAsB,CAAC,UAAmB,QAA0B;AACrF,MAAI,aAAa,SAAU,KAAI,SAAS,UAAU,UAAU,aAAa;AAC3E;AAEO,IAAM,gBAAN,cAA4B,aAAa;AAAA,EACpC,WAAW;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASd,WAAuC;AAC5C,mBAAe,MAAM,IAAI;AACzB,WAAO,KAAK,OAAO,UAAU,IAAI,CAAC;AAAA,EACpC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASO,YAAyC;AAC9C,mBAAe,MAAM,KAAK;AAC1B,WAAO,KAAK,OAAO,UAAU,KAAK,CAAC;AAAA,EACrC;AACF;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/helpers/setStrictType.ts"],"sourcesContent":["import { ctxSymbol } from './core';\nimport type { CommonSchema } from '../schemas/CommonSchema';\n\nexport function _setStrictType(that: CommonSchema, val: unknown) {\n that[ctxSymbol].strictType = true;\n that[ctxSymbol].strictTypeValue = val;\n}\n"],"mappings":";;;;;AAGO,SAAS,eAAe,MAAoB,KAAc;AAC/D,OAAK,SAAS,EAAE,aAAa;AAC7B,OAAK,SAAS,EAAE,kBAAkB;AACpC;","names":[]}
|