bguard 0.0.8 → 0.1.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 +507 -23
- package/lib/{CommonSchema-BIe85W_A.d.mts → CommonSchema-BbGNki0L.d.ts} +7 -4
- package/lib/{CommonSchema-BIe85W_A.d.ts → CommonSchema-CjsYE4dC.d.mts} +7 -4
- package/lib/InferType.d.mts +2 -1
- package/lib/InferType.d.ts +2 -1
- package/lib/asserts/array/index.d.mts +4 -3
- package/lib/asserts/array/index.d.ts +4 -3
- package/lib/asserts/array/index.js +6 -6
- package/lib/asserts/array/index.mjs +5 -5
- package/lib/asserts/boolean/index.d.mts +4 -3
- package/lib/asserts/boolean/index.d.ts +4 -3
- package/lib/asserts/boolean/index.js +7 -6
- package/lib/asserts/boolean/index.js.map +1 -1
- package/lib/asserts/boolean/index.mjs +6 -5
- package/lib/asserts/mix/equalTo.d.mts +22 -0
- package/lib/asserts/mix/equalTo.d.ts +22 -0
- package/lib/asserts/mix/equalTo.js +9 -0
- package/lib/asserts/mix/equalTo.js.map +1 -0
- package/lib/asserts/mix/equalTo.mjs +9 -0
- package/lib/asserts/{common → mix}/index.d.mts +5 -4
- package/lib/asserts/{common → mix}/index.d.ts +5 -4
- package/lib/asserts/mix/index.js +10 -0
- package/lib/asserts/mix/index.js.map +1 -0
- package/lib/asserts/mix/index.mjs +10 -0
- package/lib/asserts/mix/oneOfValues.d.mts +23 -0
- package/lib/asserts/mix/oneOfValues.d.ts +23 -0
- package/lib/asserts/mix/oneOfValues.js +9 -0
- package/lib/asserts/mix/oneOfValues.js.map +1 -0
- package/lib/asserts/mix/oneOfValues.mjs +9 -0
- package/lib/asserts/number/index.d.mts +4 -3
- package/lib/asserts/number/index.d.ts +4 -3
- package/lib/asserts/number/index.js +10 -7
- package/lib/asserts/number/index.js.map +1 -1
- package/lib/asserts/number/index.mjs +9 -6
- package/lib/asserts/number/max.d.mts +15 -10
- package/lib/asserts/number/max.d.ts +15 -10
- package/lib/asserts/number/max.js +11 -4
- package/lib/asserts/number/max.js.map +1 -1
- package/lib/asserts/number/max.mjs +12 -5
- package/lib/asserts/number/max.mjs.map +1 -1
- package/lib/asserts/number/maxExcluded.d.mts +14 -9
- package/lib/asserts/number/maxExcluded.d.ts +14 -9
- package/lib/asserts/number/maxExcluded.js +11 -4
- package/lib/asserts/number/maxExcluded.js.map +1 -1
- package/lib/asserts/number/maxExcluded.mjs +12 -5
- package/lib/asserts/number/maxExcluded.mjs.map +1 -1
- package/lib/asserts/number/min.d.mts +15 -10
- package/lib/asserts/number/min.d.ts +15 -10
- package/lib/asserts/number/min.js +11 -4
- package/lib/asserts/number/min.js.map +1 -1
- package/lib/asserts/number/min.mjs +12 -5
- package/lib/asserts/number/min.mjs.map +1 -1
- package/lib/asserts/number/minExcluded.d.mts +15 -10
- package/lib/asserts/number/minExcluded.d.ts +15 -10
- package/lib/asserts/number/minExcluded.js +11 -4
- package/lib/asserts/number/minExcluded.js.map +1 -1
- package/lib/asserts/number/minExcluded.mjs +12 -5
- package/lib/asserts/number/minExcluded.mjs.map +1 -1
- package/lib/asserts/number/negative.d.mts +14 -9
- package/lib/asserts/number/negative.d.ts +14 -9
- package/lib/asserts/number/negative.js +11 -3
- package/lib/asserts/number/negative.js.map +1 -1
- package/lib/asserts/number/negative.mjs +12 -4
- package/lib/asserts/number/negative.mjs.map +1 -1
- package/lib/asserts/number/positive.d.mts +14 -9
- package/lib/asserts/number/positive.d.ts +14 -9
- package/lib/asserts/number/positive.js +11 -3
- package/lib/asserts/number/positive.js.map +1 -1
- package/lib/asserts/number/positive.mjs +12 -4
- package/lib/asserts/number/positive.mjs.map +1 -1
- package/lib/asserts/object/index.d.mts +4 -3
- package/lib/asserts/object/index.d.ts +4 -3
- package/lib/asserts/object/index.js +6 -6
- package/lib/asserts/object/index.mjs +5 -5
- package/lib/asserts/string/email.d.mts +13 -9
- package/lib/asserts/string/email.d.ts +13 -9
- package/lib/asserts/string/email.js +11 -4
- package/lib/asserts/string/email.js.map +1 -1
- package/lib/asserts/string/email.mjs +12 -5
- package/lib/asserts/string/email.mjs.map +1 -1
- package/lib/asserts/string/index.d.mts +4 -3
- package/lib/asserts/string/index.d.ts +4 -3
- package/lib/asserts/string/index.js +10 -7
- package/lib/asserts/string/index.js.map +1 -1
- package/lib/asserts/string/index.mjs +9 -6
- package/lib/asserts/string/maxLength.d.mts +14 -9
- package/lib/asserts/string/maxLength.d.ts +14 -9
- package/lib/asserts/string/maxLength.js +11 -4
- package/lib/asserts/string/maxLength.js.map +1 -1
- package/lib/asserts/string/maxLength.mjs +12 -5
- package/lib/asserts/string/maxLength.mjs.map +1 -1
- package/lib/asserts/string/minLength.d.mts +14 -9
- package/lib/asserts/string/minLength.d.ts +14 -9
- package/lib/asserts/string/minLength.js +11 -4
- package/lib/asserts/string/minLength.js.map +1 -1
- package/lib/asserts/string/minLength.mjs +12 -5
- package/lib/asserts/string/minLength.mjs.map +1 -1
- package/lib/asserts/string/regExp.d.mts +14 -9
- package/lib/asserts/string/regExp.d.ts +14 -9
- package/lib/asserts/string/regExp.js +11 -4
- package/lib/asserts/string/regExp.js.map +1 -1
- package/lib/asserts/string/regExp.mjs +12 -5
- package/lib/asserts/string/regExp.mjs.map +1 -1
- package/lib/{chunk-32IQXZRK.mjs → chunk-2PM3K3OE.mjs} +2 -2
- package/lib/{chunk-32IQXZRK.mjs.map → chunk-2PM3K3OE.mjs.map} +1 -1
- package/lib/chunk-3HTYHE2X.mjs +54 -0
- package/lib/chunk-3HTYHE2X.mjs.map +1 -0
- package/lib/chunk-3O4WCRC2.mjs +21 -0
- package/lib/chunk-3O4WCRC2.mjs.map +1 -0
- package/lib/chunk-4CYIMDP2.js +21 -0
- package/lib/chunk-4CYIMDP2.js.map +1 -0
- package/lib/{chunk-QKGQ4XZC.js → chunk-4RNK3I74.js} +3 -3
- package/lib/{chunk-QKGQ4XZC.js.map → chunk-4RNK3I74.js.map} +1 -1
- package/lib/chunk-5BVJ6YMH.js +54 -0
- package/lib/chunk-5BVJ6YMH.js.map +1 -0
- package/lib/chunk-6TH3DBDK.js +53 -0
- package/lib/chunk-6TH3DBDK.js.map +1 -0
- package/lib/chunk-7XFLH6R2.mjs +44 -0
- package/lib/chunk-7XFLH6R2.mjs.map +1 -0
- package/lib/{chunk-BGMR7A6X.mjs → chunk-B6TFELXR.mjs} +2 -2
- package/lib/{chunk-BGMR7A6X.mjs.map → chunk-B6TFELXR.mjs.map} +1 -1
- package/lib/{chunk-GEZME6V2.mjs → chunk-CCBCDJXS.mjs} +11 -6
- package/lib/chunk-CCBCDJXS.mjs.map +1 -0
- package/lib/chunk-CLG3QRZC.mjs +47 -0
- package/lib/chunk-CLG3QRZC.mjs.map +1 -0
- package/lib/chunk-DJSLA2ZV.js +27 -0
- package/lib/chunk-DJSLA2ZV.js.map +1 -0
- package/lib/{chunk-L7HUXYFV.mjs → chunk-DPBE7TAQ.mjs} +2 -2
- package/lib/chunk-DPBE7TAQ.mjs.map +1 -0
- package/lib/{chunk-APTTIN2L.js → chunk-EGEHSELT.js} +6 -6
- package/lib/chunk-EGEHSELT.js.map +1 -0
- package/lib/chunk-F5MSBL33.js +50 -0
- package/lib/chunk-F5MSBL33.js.map +1 -0
- package/lib/chunk-FTLRX2XG.mjs +50 -0
- package/lib/chunk-FTLRX2XG.mjs.map +1 -0
- package/lib/chunk-H7CPKW53.js +47 -0
- package/lib/chunk-H7CPKW53.js.map +1 -0
- package/lib/{chunk-A7I2JEQO.js → chunk-HDSGCAHH.js} +3 -3
- package/lib/{chunk-A7I2JEQO.js.map → chunk-HDSGCAHH.js.map} +1 -1
- package/lib/{chunk-L6A7NXUJ.js → chunk-IEUXIOL6.js} +3 -3
- package/lib/{chunk-L6A7NXUJ.js.map → chunk-IEUXIOL6.js.map} +1 -1
- package/lib/chunk-IRG4OQAB.js +63 -0
- package/lib/chunk-IRG4OQAB.js.map +1 -0
- package/lib/chunk-J4VKFJQK.js +21 -0
- package/lib/chunk-J4VKFJQK.js.map +1 -0
- package/lib/{chunk-A2SAWKJA.mjs → chunk-JDGZCBXF.mjs} +2 -2
- package/lib/{chunk-A2SAWKJA.mjs.map → chunk-JDGZCBXF.mjs.map} +1 -1
- package/lib/chunk-JSGZ7DKT.js +14 -0
- package/lib/chunk-JSGZ7DKT.js.map +1 -0
- package/lib/{chunk-AJ4WV5DG.mjs → chunk-MRISXZQ4.mjs} +3 -3
- package/lib/chunk-MRISXZQ4.mjs.map +1 -0
- package/lib/{chunk-A3UTB4RE.mjs → chunk-NDQM5OL4.mjs} +4 -4
- package/lib/chunk-NDQM5OL4.mjs.map +1 -0
- package/lib/chunk-NNFYXHLU.mjs +21 -0
- package/lib/chunk-NNFYXHLU.mjs.map +1 -0
- package/lib/{chunk-KCBOOOTF.mjs → chunk-NTC2XQ36.mjs} +2 -2
- package/lib/{chunk-KCBOOOTF.mjs.map → chunk-NTC2XQ36.mjs.map} +1 -1
- package/lib/chunk-PG2R7P7G.mjs +27 -0
- package/lib/chunk-PG2R7P7G.mjs.map +1 -0
- package/lib/chunk-PH2PMUZP.mjs +63 -0
- package/lib/chunk-PH2PMUZP.mjs.map +1 -0
- package/lib/chunk-QQNQ4IDN.js +13 -0
- package/lib/chunk-QQNQ4IDN.js.map +1 -0
- package/lib/{chunk-PJP63SJT.js → chunk-RL4MSI7R.js} +3 -3
- package/lib/{chunk-PJP63SJT.js.map → chunk-RL4MSI7R.js.map} +1 -1
- package/lib/chunk-RQH4LXBW.js +47 -0
- package/lib/chunk-RQH4LXBW.js.map +1 -0
- package/lib/chunk-RRQOET3X.js +28 -0
- package/lib/chunk-RRQOET3X.js.map +1 -0
- package/lib/chunk-RYVUYVEE.mjs +14 -0
- package/lib/chunk-RYVUYVEE.mjs.map +1 -0
- package/lib/{chunk-QYLH5ZAC.mjs → chunk-TCQY2R3U.mjs} +25 -4
- package/lib/chunk-TCQY2R3U.mjs.map +1 -0
- package/lib/{chunk-K2S3FS5K.js → chunk-VHEA4JZ5.js} +3 -3
- package/lib/{chunk-K2S3FS5K.js.map → chunk-VHEA4JZ5.js.map} +1 -1
- package/lib/{chunk-VPFIIM2X.js → chunk-WBERBAL4.js} +11 -6
- package/lib/chunk-WBERBAL4.js.map +1 -0
- package/lib/chunk-WK4O3HH4.js +44 -0
- package/lib/chunk-WK4O3HH4.js.map +1 -0
- package/lib/{chunk-3FEJUC3K.mjs → chunk-YML32TPA.mjs} +2 -2
- package/lib/{chunk-3FEJUC3K.mjs.map → chunk-YML32TPA.mjs.map} +1 -1
- package/lib/chunk-YUESB2WV.mjs +47 -0
- package/lib/chunk-YUESB2WV.mjs.map +1 -0
- package/lib/codeGen.d.mts +7 -0
- package/lib/codeGen.d.ts +7 -0
- package/lib/codeGen.js +51 -0
- package/lib/codeGen.js.map +1 -0
- package/lib/codeGen.mjs +51 -0
- package/lib/codeGen.mjs.map +1 -0
- package/lib/commonTypes.d.mts +31 -0
- package/lib/commonTypes.d.ts +31 -0
- package/lib/commonTypes.js +1 -0
- package/lib/commonTypes.js.map +1 -0
- package/lib/commonTypes.mjs +1 -0
- package/lib/exceptions.d.mts +4 -2
- package/lib/exceptions.d.ts +4 -2
- package/lib/exceptions.js +2 -2
- package/lib/exceptions.mjs +3 -3
- package/lib/helpers/core.d.mts +2 -0
- package/lib/helpers/core.d.ts +2 -0
- package/lib/helpers/core.js +10 -0
- package/lib/helpers/core.js.map +1 -0
- package/lib/helpers/core.mjs +10 -0
- package/lib/helpers/core.mjs.map +1 -0
- package/lib/helpers/setStrictType.d.mts +6 -0
- package/lib/helpers/setStrictType.d.ts +6 -0
- package/lib/helpers/setStrictType.js +9 -0
- package/lib/helpers/setStrictType.js.map +1 -0
- package/lib/helpers/setStrictType.mjs +9 -0
- package/lib/helpers/setStrictType.mjs.map +1 -0
- package/lib/index.d.mts +7 -4
- package/lib/index.d.ts +7 -4
- package/lib/index.js +31 -17
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +38 -24
- package/lib/parse.d.mts +66 -0
- package/lib/parse.d.ts +66 -0
- package/lib/parse.js +10 -0
- package/lib/parse.js.map +1 -0
- package/lib/parse.mjs +10 -0
- package/lib/parse.mjs.map +1 -0
- package/lib/{parseSchema.d.mts → parseOrFail.d.mts} +16 -5
- package/lib/{parseSchema.d.ts → parseOrFail.d.ts} +16 -5
- package/lib/parseOrFail.js +10 -0
- package/lib/parseOrFail.js.map +1 -0
- package/lib/parseOrFail.mjs +10 -0
- package/lib/parseOrFail.mjs.map +1 -0
- package/lib/schemas/ArraySchema.d.mts +2 -1
- package/lib/schemas/ArraySchema.d.ts +2 -1
- package/lib/schemas/ArraySchema.js +5 -5
- package/lib/schemas/ArraySchema.mjs +4 -4
- package/lib/schemas/BooleanSchema.d.mts +2 -1
- package/lib/schemas/BooleanSchema.d.ts +2 -1
- package/lib/schemas/BooleanSchema.js +6 -5
- package/lib/schemas/BooleanSchema.js.map +1 -1
- package/lib/schemas/BooleanSchema.mjs +5 -4
- package/lib/schemas/CommonSchema.d.mts +2 -1
- package/lib/schemas/CommonSchema.d.ts +2 -1
- package/lib/schemas/CommonSchema.js +4 -4
- package/lib/schemas/CommonSchema.mjs +3 -3
- package/lib/schemas/NumberSchema.d.mts +12 -1
- package/lib/schemas/NumberSchema.d.ts +12 -1
- package/lib/schemas/NumberSchema.js +9 -6
- package/lib/schemas/NumberSchema.js.map +1 -1
- package/lib/schemas/NumberSchema.mjs +8 -5
- package/lib/schemas/ObjectSchema.d.mts +20 -1
- package/lib/schemas/ObjectSchema.d.ts +20 -1
- package/lib/schemas/ObjectSchema.js +5 -5
- package/lib/schemas/ObjectSchema.mjs +4 -4
- package/lib/schemas/StringSchema.d.mts +12 -1
- package/lib/schemas/StringSchema.d.ts +12 -1
- package/lib/schemas/StringSchema.js +9 -6
- package/lib/schemas/StringSchema.js.map +1 -1
- package/lib/schemas/StringSchema.mjs +8 -5
- package/lib/translationMap.d.mts +12 -0
- package/lib/translationMap.d.ts +12 -0
- package/lib/translationMap.js +14 -0
- package/lib/translationMap.js.map +1 -0
- package/lib/translationMap.mjs +14 -0
- package/lib/translationMap.mjs.map +1 -0
- package/package.json +35 -18
- package/lib/asserts/common/equalTo.d.mts +0 -29
- package/lib/asserts/common/equalTo.d.ts +0 -29
- package/lib/asserts/common/equalTo.js +0 -8
- package/lib/asserts/common/equalTo.js.map +0 -1
- package/lib/asserts/common/equalTo.mjs +0 -8
- package/lib/asserts/common/index.js +0 -10
- package/lib/asserts/common/index.js.map +0 -1
- package/lib/asserts/common/index.mjs +0 -10
- package/lib/chunk-2AP4OQMT.js +0 -26
- package/lib/chunk-2AP4OQMT.js.map +0 -1
- package/lib/chunk-5NCJN6D2.js +0 -70
- package/lib/chunk-5NCJN6D2.js.map +0 -1
- package/lib/chunk-5ZMICHV3.js +0 -21
- package/lib/chunk-5ZMICHV3.js.map +0 -1
- package/lib/chunk-63IQFNFO.mjs +0 -27
- package/lib/chunk-63IQFNFO.mjs.map +0 -1
- package/lib/chunk-A3UTB4RE.mjs.map +0 -1
- package/lib/chunk-AJ4WV5DG.mjs.map +0 -1
- package/lib/chunk-APTTIN2L.js.map +0 -1
- package/lib/chunk-AXOP6HPJ.js +0 -14
- package/lib/chunk-AXOP6HPJ.js.map +0 -1
- package/lib/chunk-FCFO5J5Y.mjs +0 -14
- package/lib/chunk-FCFO5J5Y.mjs.map +0 -1
- package/lib/chunk-GEZME6V2.mjs.map +0 -1
- package/lib/chunk-GNBSKTFV.js +0 -27
- package/lib/chunk-GNBSKTFV.js.map +0 -1
- package/lib/chunk-IQ3QYABE.js +0 -32
- package/lib/chunk-IQ3QYABE.js.map +0 -1
- package/lib/chunk-L7HUXYFV.mjs.map +0 -1
- package/lib/chunk-LHTJHMKJ.mjs +0 -27
- package/lib/chunk-LHTJHMKJ.mjs.map +0 -1
- package/lib/chunk-NOADI6PO.mjs +0 -21
- package/lib/chunk-NOADI6PO.mjs.map +0 -1
- package/lib/chunk-NWY33MFU.js +0 -13
- package/lib/chunk-NWY33MFU.js.map +0 -1
- package/lib/chunk-P3Y6IWFA.mjs +0 -70
- package/lib/chunk-P3Y6IWFA.mjs.map +0 -1
- package/lib/chunk-PDVXBE27.js +0 -27
- package/lib/chunk-PDVXBE27.js.map +0 -1
- package/lib/chunk-QJOXKH7A.mjs +0 -26
- package/lib/chunk-QJOXKH7A.mjs.map +0 -1
- package/lib/chunk-QYLH5ZAC.mjs.map +0 -1
- package/lib/chunk-VPFIIM2X.js.map +0 -1
- package/lib/chunk-YXHH5BF6.js +0 -28
- package/lib/chunk-YXHH5BF6.js.map +0 -1
- package/lib/core.d.mts +0 -1
- package/lib/core.d.ts +0 -1
- package/lib/core.js +0 -10
- package/lib/core.js.map +0 -1
- package/lib/core.mjs +0 -10
- package/lib/parseSchema.js +0 -9
- package/lib/parseSchema.js.map +0 -1
- package/lib/parseSchema.mjs +0 -9
- /package/lib/asserts/{common → mix}/equalTo.mjs.map +0 -0
- /package/lib/asserts/{common → mix}/index.mjs.map +0 -0
- /package/lib/{core.mjs.map → asserts/mix/oneOfValues.mjs.map} +0 -0
- /package/lib/{parseSchema.mjs.map → commonTypes.mjs.map} +0 -0
package/lib/InferType.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { ArraySchema, ExtractFromArray } from './schemas/ArraySchema.js';
|
|
2
2
|
import { WithBoolean, BooleanSchema, ExtractFromBoolean } from './schemas/BooleanSchema.js';
|
|
3
|
-
import { W as WithUndefined, a as WithNull, b as WithMix, E as ExtractFromMix, C as CommonSchema } from './CommonSchema-
|
|
3
|
+
import { W as WithUndefined, a as WithNull, b as WithMix, E as ExtractFromMix, C as CommonSchema } from './CommonSchema-BbGNki0L.js';
|
|
4
4
|
import { WithNumber, NumberSchema, ExtractFromNumber } from './schemas/NumberSchema.js';
|
|
5
5
|
import { ObjectSchema, WithObject } from './schemas/ObjectSchema.js';
|
|
6
6
|
import { WithString, StringSchema, ExtractFromString } from './schemas/StringSchema.js';
|
|
7
|
+
import './commonTypes.js';
|
|
7
8
|
|
|
8
9
|
type InferType<T> = T extends WithUndefined<WithNull<WithString<StringSchema>>> ? ExtractFromString<T> | null | undefined : T extends WithUndefined<WithString<StringSchema>> ? ExtractFromString<T> | undefined : T extends WithNull<WithString<StringSchema>> ? ExtractFromString<T> | null : T extends WithString<StringSchema> ? ExtractFromString<T> : T extends WithUndefined<WithNull<StringSchema>> ? string | null | undefined : T extends WithUndefined<StringSchema> ? string | undefined : T extends WithNull<StringSchema> ? string | null : T extends StringSchema ? string : T extends WithUndefined<WithNull<WithNumber<NumberSchema>>> ? ExtractFromNumber<T> | null | undefined : T extends WithUndefined<WithNumber<NumberSchema>> ? ExtractFromNumber<T> | undefined : T extends WithNull<WithNumber<NumberSchema>> ? ExtractFromNumber<T> | null : T extends WithNumber<NumberSchema> ? ExtractFromNumber<T> : T extends WithUndefined<WithNull<NumberSchema>> ? number | null | undefined : T extends WithUndefined<NumberSchema> ? number | undefined : T extends WithNull<NumberSchema> ? number | null : T extends NumberSchema ? number : T extends WithUndefined<WithNull<WithBoolean<BooleanSchema>>> ? ExtractFromBoolean<T> | null | undefined : T extends WithUndefined<WithBoolean<BooleanSchema>> ? ExtractFromBoolean<T> | undefined : T extends WithNull<WithBoolean<BooleanSchema>> ? ExtractFromBoolean<T> | null : T extends WithBoolean<BooleanSchema> ? ExtractFromBoolean<T> : T extends WithUndefined<WithNull<BooleanSchema>> ? boolean | null | undefined : T extends WithUndefined<BooleanSchema> ? boolean | undefined : T extends WithNull<BooleanSchema> ? boolean | null : T extends BooleanSchema ? boolean : T extends WithUndefined<WithNull<ArraySchema>> ? InferType<ExtractFromArray<T>>[] | null | undefined : T extends WithUndefined<ArraySchema> ? InferType<ExtractFromArray<T>>[] | undefined : T extends WithNull<ArraySchema> ? InferType<ExtractFromArray<T>>[] | null : T extends ArraySchema ? InferType<ExtractFromArray<T>>[] : T extends WithUndefined<WithNull<ObjectSchema>> ? ExtractFromObject<T> | null | undefined : T extends WithUndefined<ObjectSchema> ? ExtractFromObject<T> | undefined : T extends WithNull<ObjectSchema> ? ExtractFromObject<T> | null : T extends ObjectSchema ? ExtractFromObject<T> : T extends WithUndefined<WithNull<WithMix>> ? ExtractFromMix<T> | null | undefined : T extends WithUndefined<WithMix> ? ExtractFromMix<T> | undefined : T extends WithNull<WithMix> ? ExtractFromMix<T> | null : T extends WithMix ? ExtractFromMix<T> : unknown;
|
|
9
10
|
type Merge<T> = T extends infer U ? {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { WithArray } from '../../schemas/ArraySchema.mjs';
|
|
2
|
-
import { C as CommonSchema } from '../../CommonSchema-
|
|
2
|
+
import { C as CommonSchema } from '../../CommonSchema-CjsYE4dC.mjs';
|
|
3
|
+
import '../../commonTypes.mjs';
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* Creates a new schema for validating arrays where each element must match the specified schema.
|
|
@@ -10,8 +11,8 @@ import { C as CommonSchema } from '../../CommonSchema-BIe85W_A.mjs';
|
|
|
10
11
|
*
|
|
11
12
|
* @example
|
|
12
13
|
* const schema = array(string());
|
|
13
|
-
*
|
|
14
|
-
*
|
|
14
|
+
* parseOrFail(schema, ['hello', 'world']); // Validates successfully
|
|
15
|
+
* parseOrFail(schema, ['hello', 123]); // Throws a validation error
|
|
15
16
|
*/
|
|
16
17
|
declare function array<T extends CommonSchema>(arraySchema: T): WithArray<T>;
|
|
17
18
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { WithArray } from '../../schemas/ArraySchema.js';
|
|
2
|
-
import { C as CommonSchema } from '../../CommonSchema-
|
|
2
|
+
import { C as CommonSchema } from '../../CommonSchema-BbGNki0L.js';
|
|
3
|
+
import '../../commonTypes.js';
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* Creates a new schema for validating arrays where each element must match the specified schema.
|
|
@@ -10,8 +11,8 @@ import { C as CommonSchema } from '../../CommonSchema-BIe85W_A.js';
|
|
|
10
11
|
*
|
|
11
12
|
* @example
|
|
12
13
|
* const schema = array(string());
|
|
13
|
-
*
|
|
14
|
-
*
|
|
14
|
+
* parseOrFail(schema, ['hello', 'world']); // Validates successfully
|
|
15
|
+
* parseOrFail(schema, ['hello', 123]); // Throws a validation error
|
|
15
16
|
*/
|
|
16
17
|
declare function array<T extends CommonSchema>(arraySchema: T): WithArray<T>;
|
|
17
18
|
|
|
@@ -1,11 +1,11 @@
|
|
|
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 _chunkIEUXIOL6js = require('../../chunk-IEUXIOL6.js');
|
|
4
|
+
require('../../chunk-RRQOET3X.js');
|
|
5
|
+
require('../../chunk-EGEHSELT.js');
|
|
6
|
+
require('../../chunk-IRG4OQAB.js');
|
|
7
|
+
require('../../chunk-WK4O3HH4.js');
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
exports.array =
|
|
10
|
+
exports.array = _chunkIEUXIOL6js.array;
|
|
11
11
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
array
|
|
3
|
-
} from "../../chunk-
|
|
4
|
-
import "../../chunk-
|
|
5
|
-
import "../../chunk-
|
|
6
|
-
import "../../chunk-
|
|
7
|
-
import "../../chunk-
|
|
3
|
+
} from "../../chunk-JDGZCBXF.mjs";
|
|
4
|
+
import "../../chunk-NDQM5OL4.mjs";
|
|
5
|
+
import "../../chunk-DPBE7TAQ.mjs";
|
|
6
|
+
import "../../chunk-PH2PMUZP.mjs";
|
|
7
|
+
import "../../chunk-7XFLH6R2.mjs";
|
|
8
8
|
export {
|
|
9
9
|
array
|
|
10
10
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { BooleanSchema } from '../../schemas/BooleanSchema.mjs';
|
|
2
|
-
import '../../CommonSchema-
|
|
2
|
+
import '../../CommonSchema-CjsYE4dC.mjs';
|
|
3
|
+
import '../../commonTypes.mjs';
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* Creates a new schema for validating boolean values.
|
|
@@ -8,8 +9,8 @@ import '../../CommonSchema-BIe85W_A.mjs';
|
|
|
8
9
|
*
|
|
9
10
|
* @example
|
|
10
11
|
* const schema = boolean();
|
|
11
|
-
*
|
|
12
|
-
*
|
|
12
|
+
* parseOrFail(schema, true); // Validates successfully
|
|
13
|
+
* parseOrFail(schema, 'true'); // Throws a validation error
|
|
13
14
|
*/
|
|
14
15
|
declare function boolean(): BooleanSchema;
|
|
15
16
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { BooleanSchema } from '../../schemas/BooleanSchema.js';
|
|
2
|
-
import '../../CommonSchema-
|
|
2
|
+
import '../../CommonSchema-BbGNki0L.js';
|
|
3
|
+
import '../../commonTypes.js';
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* Creates a new schema for validating boolean values.
|
|
@@ -8,8 +9,8 @@ import '../../CommonSchema-BIe85W_A.js';
|
|
|
8
9
|
*
|
|
9
10
|
* @example
|
|
10
11
|
* const schema = boolean();
|
|
11
|
-
*
|
|
12
|
-
*
|
|
12
|
+
* parseOrFail(schema, true); // Validates successfully
|
|
13
|
+
* parseOrFail(schema, 'true'); // Throws a validation error
|
|
13
14
|
*/
|
|
14
15
|
declare function boolean(): BooleanSchema;
|
|
15
16
|
|
|
@@ -1,11 +1,12 @@
|
|
|
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 _chunkHDSGCAHHjs = require('../../chunk-HDSGCAHH.js');
|
|
4
|
+
require('../../chunk-WBERBAL4.js');
|
|
5
|
+
require('../../chunk-JSGZ7DKT.js');
|
|
6
|
+
require('../../chunk-EGEHSELT.js');
|
|
7
|
+
require('../../chunk-IRG4OQAB.js');
|
|
8
|
+
require('../../chunk-WK4O3HH4.js');
|
|
8
9
|
|
|
9
10
|
|
|
10
|
-
exports.boolean =
|
|
11
|
+
exports.boolean = _chunkHDSGCAHHjs.boolean;
|
|
11
12
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/bguard/bguard/lib/asserts/boolean/index.js"],"names":[],"mappings":"AAAA;AACE;AACF,0DAAgC;AAChC,mCAAgC;AAChC,mCAAgC;AAChC,mCAAgC;AAChC,mCAAgC;AAChC;AACE;AACF,2CAAC","file":"/home/runner/work/bguard/bguard/lib/asserts/boolean/index.js"}
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/bguard/bguard/lib/asserts/boolean/index.js"],"names":[],"mappings":"AAAA;AACE;AACF,0DAAgC;AAChC,mCAAgC;AAChC,mCAAgC;AAChC,mCAAgC;AAChC,mCAAgC;AAChC,mCAAgC;AAChC;AACE;AACF,2CAAC","file":"/home/runner/work/bguard/bguard/lib/asserts/boolean/index.js"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
boolean
|
|
3
|
-
} from "../../chunk-
|
|
4
|
-
import "../../chunk-
|
|
5
|
-
import "../../chunk-
|
|
6
|
-
import "../../chunk-
|
|
7
|
-
import "../../chunk-
|
|
3
|
+
} from "../../chunk-YML32TPA.mjs";
|
|
4
|
+
import "../../chunk-CCBCDJXS.mjs";
|
|
5
|
+
import "../../chunk-RYVUYVEE.mjs";
|
|
6
|
+
import "../../chunk-DPBE7TAQ.mjs";
|
|
7
|
+
import "../../chunk-PH2PMUZP.mjs";
|
|
8
|
+
import "../../chunk-7XFLH6R2.mjs";
|
|
8
9
|
export {
|
|
9
10
|
boolean
|
|
10
11
|
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { RequiredValidation } from '../../commonTypes.mjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @description Creates a custom assertion that checks if a value is equal to the expected value.
|
|
5
|
+
* @notice It has already been implemented in the number and string schema. There is no need to use it as a custom assert.
|
|
6
|
+
* @param {unknown} expected The value that the received value is expected to match.
|
|
7
|
+
* @returns {RequiredValidation} A validation function that takes a received value and an exception context.
|
|
8
|
+
* @throws {ValidationError} If the received value does not match the expected value.
|
|
9
|
+
* @example
|
|
10
|
+
* const schema = number().custom(equalTo(5)); // Define a schema with a custom assertion
|
|
11
|
+
* parseOrFail(schema, 5); // Valid
|
|
12
|
+
* parseOrFail(schema, 3); // Throws an error: 'The received value is not equal to expected'
|
|
13
|
+
*
|
|
14
|
+
* @translation Error Translation Key = 'm:equalTo'
|
|
15
|
+
*/
|
|
16
|
+
declare const equalTo: {
|
|
17
|
+
(expected: unknown): RequiredValidation;
|
|
18
|
+
key: string;
|
|
19
|
+
message: string;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export { equalTo };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { RequiredValidation } from '../../commonTypes.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @description Creates a custom assertion that checks if a value is equal to the expected value.
|
|
5
|
+
* @notice It has already been implemented in the number and string schema. There is no need to use it as a custom assert.
|
|
6
|
+
* @param {unknown} expected The value that the received value is expected to match.
|
|
7
|
+
* @returns {RequiredValidation} A validation function that takes a received value and an exception context.
|
|
8
|
+
* @throws {ValidationError} If the received value does not match the expected value.
|
|
9
|
+
* @example
|
|
10
|
+
* const schema = number().custom(equalTo(5)); // Define a schema with a custom assertion
|
|
11
|
+
* parseOrFail(schema, 5); // Valid
|
|
12
|
+
* parseOrFail(schema, 3); // Throws an error: 'The received value is not equal to expected'
|
|
13
|
+
*
|
|
14
|
+
* @translation Error Translation Key = 'm:equalTo'
|
|
15
|
+
*/
|
|
16
|
+
declare const equalTo: {
|
|
17
|
+
(expected: unknown): RequiredValidation;
|
|
18
|
+
key: string;
|
|
19
|
+
message: string;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export { equalTo };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
var _chunkJ4VKFJQKjs = require('../../chunk-J4VKFJQK.js');
|
|
4
|
+
require('../../chunk-5BVJ6YMH.js');
|
|
5
|
+
require('../../chunk-WK4O3HH4.js');
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
exports.equalTo = _chunkJ4VKFJQKjs.equalTo;
|
|
9
|
+
//# sourceMappingURL=equalTo.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/bguard/bguard/lib/asserts/mix/equalTo.js"],"names":[],"mappings":"AAAA;AACE;AACF,0DAAgC;AAChC,mCAAgC;AAChC,mCAAgC;AAChC;AACE;AACF,2CAAC","file":"/home/runner/work/bguard/bguard/lib/asserts/mix/equalTo.js"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { PrimitiveType } from '../../commonTypes.mjs';
|
|
2
|
+
import { b as WithMix, M as MapMixTypes } from '../../CommonSchema-CjsYE4dC.mjs';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* Creates a new schema for validating values that can match any one of the specified primitive types.
|
|
@@ -9,9 +10,9 @@ import { P as PrimitiveType, b as WithMix, M as MapMixTypes } from '../../Common
|
|
|
9
10
|
*
|
|
10
11
|
* @example
|
|
11
12
|
* const schema = oneOfTypes(['string', 'number']);
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
13
|
+
* parseOrFail(schema, 'hello'); // Validates successfully
|
|
14
|
+
* parseOrFail(schema, 42); // Validates successfully
|
|
15
|
+
* parseOrFail(schema, true); // Throws a validation error
|
|
15
16
|
*/
|
|
16
17
|
declare function oneOfTypes<T extends PrimitiveType[]>(valueTypes: T): WithMix<MapMixTypes<T>>;
|
|
17
18
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { PrimitiveType } from '../../commonTypes.js';
|
|
2
|
+
import { b as WithMix, M as MapMixTypes } from '../../CommonSchema-BbGNki0L.js';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* Creates a new schema for validating values that can match any one of the specified primitive types.
|
|
@@ -9,9 +10,9 @@ import { P as PrimitiveType, b as WithMix, M as MapMixTypes } from '../../Common
|
|
|
9
10
|
*
|
|
10
11
|
* @example
|
|
11
12
|
* const schema = oneOfTypes(['string', 'number']);
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
13
|
+
* parseOrFail(schema, 'hello'); // Validates successfully
|
|
14
|
+
* parseOrFail(schema, 42); // Validates successfully
|
|
15
|
+
* parseOrFail(schema, true); // Throws a validation error
|
|
15
16
|
*/
|
|
16
17
|
declare function oneOfTypes<T extends PrimitiveType[]>(valueTypes: T): WithMix<MapMixTypes<T>>;
|
|
17
18
|
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
var _chunkQQNQ4IDNjs = require('../../chunk-QQNQ4IDN.js');
|
|
4
|
+
require('../../chunk-EGEHSELT.js');
|
|
5
|
+
require('../../chunk-IRG4OQAB.js');
|
|
6
|
+
require('../../chunk-WK4O3HH4.js');
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
exports.oneOfTypes = _chunkQQNQ4IDNjs.oneOfTypes;
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/bguard/bguard/lib/asserts/mix/index.js"],"names":[],"mappings":"AAAA;AACE;AACF,0DAAgC;AAChC,mCAAgC;AAChC,mCAAgC;AAChC,mCAAgC;AAChC;AACE;AACF,iDAAC","file":"/home/runner/work/bguard/bguard/lib/asserts/mix/index.js"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { RequiredValidation } from '../../commonTypes.mjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @description Creates a custom assertion that checks if a value is equal to the one of expected values.
|
|
5
|
+
* @notice It has already been implemented in the number and string schema. There is no need to use it as a custom assert.
|
|
6
|
+
* @param {unknown} expected The value that the received value is expected to match.
|
|
7
|
+
* @returns {RequiredValidation} A validation function that takes a received value and an exception context.
|
|
8
|
+
* @throws {ValidationError} If the received value does not match at least one of the expected values.
|
|
9
|
+
* @example
|
|
10
|
+
* const schema = number().custom(oneOfValues([5, 4])); // Define a schema with a custom assertion
|
|
11
|
+
* parseOrFail(schema, 5); // Valid
|
|
12
|
+
* parseOrFail(schema, 4); // Valid
|
|
13
|
+
* parseOrFail(schema, 3); // Throws an error: 'The received value is not equal to expected'
|
|
14
|
+
*
|
|
15
|
+
* @translation Error Translation Key = 'm:oneOfValues'
|
|
16
|
+
*/
|
|
17
|
+
declare const oneOfValues: {
|
|
18
|
+
(expected: unknown[]): RequiredValidation;
|
|
19
|
+
key: string;
|
|
20
|
+
message: string;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export { oneOfValues };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { RequiredValidation } from '../../commonTypes.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @description Creates a custom assertion that checks if a value is equal to the one of expected values.
|
|
5
|
+
* @notice It has already been implemented in the number and string schema. There is no need to use it as a custom assert.
|
|
6
|
+
* @param {unknown} expected The value that the received value is expected to match.
|
|
7
|
+
* @returns {RequiredValidation} A validation function that takes a received value and an exception context.
|
|
8
|
+
* @throws {ValidationError} If the received value does not match at least one of the expected values.
|
|
9
|
+
* @example
|
|
10
|
+
* const schema = number().custom(oneOfValues([5, 4])); // Define a schema with a custom assertion
|
|
11
|
+
* parseOrFail(schema, 5); // Valid
|
|
12
|
+
* parseOrFail(schema, 4); // Valid
|
|
13
|
+
* parseOrFail(schema, 3); // Throws an error: 'The received value is not equal to expected'
|
|
14
|
+
*
|
|
15
|
+
* @translation Error Translation Key = 'm:oneOfValues'
|
|
16
|
+
*/
|
|
17
|
+
declare const oneOfValues: {
|
|
18
|
+
(expected: unknown[]): RequiredValidation;
|
|
19
|
+
key: string;
|
|
20
|
+
message: string;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export { oneOfValues };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
var _chunk4CYIMDP2js = require('../../chunk-4CYIMDP2.js');
|
|
4
|
+
require('../../chunk-5BVJ6YMH.js');
|
|
5
|
+
require('../../chunk-WK4O3HH4.js');
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
exports.oneOfValues = _chunk4CYIMDP2js.oneOfValues;
|
|
9
|
+
//# sourceMappingURL=oneOfValues.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/bguard/bguard/lib/asserts/mix/oneOfValues.js"],"names":[],"mappings":"AAAA;AACE;AACF,0DAAgC;AAChC,mCAAgC;AAChC,mCAAgC;AAChC;AACE;AACF,mDAAC","file":"/home/runner/work/bguard/bguard/lib/asserts/mix/oneOfValues.js"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { NumberSchema } from '../../schemas/NumberSchema.mjs';
|
|
2
|
-
import '../../CommonSchema-
|
|
2
|
+
import '../../CommonSchema-CjsYE4dC.mjs';
|
|
3
|
+
import '../../commonTypes.mjs';
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* Creates a new schema for validating number values.
|
|
@@ -8,8 +9,8 @@ import '../../CommonSchema-BIe85W_A.mjs';
|
|
|
8
9
|
*
|
|
9
10
|
* @example
|
|
10
11
|
* const schema = number();
|
|
11
|
-
*
|
|
12
|
-
*
|
|
12
|
+
* parseOrFail(schema, 42); // Validates successfully
|
|
13
|
+
* parseOrFail(schema, '42'); // Throws a validation error
|
|
13
14
|
*/
|
|
14
15
|
declare function number(): NumberSchema;
|
|
15
16
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { NumberSchema } from '../../schemas/NumberSchema.js';
|
|
2
|
-
import '../../CommonSchema-
|
|
2
|
+
import '../../CommonSchema-BbGNki0L.js';
|
|
3
|
+
import '../../commonTypes.js';
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* Creates a new schema for validating number values.
|
|
@@ -8,8 +9,8 @@ import '../../CommonSchema-BIe85W_A.js';
|
|
|
8
9
|
*
|
|
9
10
|
* @example
|
|
10
11
|
* const schema = number();
|
|
11
|
-
*
|
|
12
|
-
*
|
|
12
|
+
* parseOrFail(schema, 42); // Validates successfully
|
|
13
|
+
* parseOrFail(schema, '42'); // Throws a validation error
|
|
13
14
|
*/
|
|
14
15
|
declare function number(): NumberSchema;
|
|
15
16
|
|
|
@@ -1,12 +1,15 @@
|
|
|
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-
|
|
8
|
-
require('../../chunk-
|
|
3
|
+
var _chunk4RNK3I74js = require('../../chunk-4RNK3I74.js');
|
|
4
|
+
require('../../chunk-RQH4LXBW.js');
|
|
5
|
+
require('../../chunk-J4VKFJQK.js');
|
|
6
|
+
require('../../chunk-4CYIMDP2.js');
|
|
7
|
+
require('../../chunk-JSGZ7DKT.js');
|
|
8
|
+
require('../../chunk-EGEHSELT.js');
|
|
9
|
+
require('../../chunk-IRG4OQAB.js');
|
|
10
|
+
require('../../chunk-5BVJ6YMH.js');
|
|
11
|
+
require('../../chunk-WK4O3HH4.js');
|
|
9
12
|
|
|
10
13
|
|
|
11
|
-
exports.number =
|
|
14
|
+
exports.number = _chunk4RNK3I74js.number;
|
|
12
15
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/bguard/bguard/lib/asserts/number/index.js"],"names":[],"mappings":"AAAA;AACE;AACF,0DAAgC;AAChC,mCAAgC;AAChC,mCAAgC;AAChC,mCAAgC;AAChC,mCAAgC;AAChC,mCAAgC;AAChC;AACE;AACF,yCAAC","file":"/home/runner/work/bguard/bguard/lib/asserts/number/index.js"}
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/bguard/bguard/lib/asserts/number/index.js"],"names":[],"mappings":"AAAA;AACE;AACF,0DAAgC;AAChC,mCAAgC;AAChC,mCAAgC;AAChC,mCAAgC;AAChC,mCAAgC;AAChC,mCAAgC;AAChC,mCAAgC;AAChC,mCAAgC;AAChC,mCAAgC;AAChC;AACE;AACF,yCAAC","file":"/home/runner/work/bguard/bguard/lib/asserts/number/index.js"}
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
number
|
|
3
|
-
} from "../../chunk-
|
|
4
|
-
import "../../chunk-
|
|
5
|
-
import "../../chunk-
|
|
6
|
-
import "../../chunk-
|
|
7
|
-
import "../../chunk-
|
|
8
|
-
import "../../chunk-
|
|
3
|
+
} from "../../chunk-B6TFELXR.mjs";
|
|
4
|
+
import "../../chunk-CLG3QRZC.mjs";
|
|
5
|
+
import "../../chunk-NNFYXHLU.mjs";
|
|
6
|
+
import "../../chunk-3O4WCRC2.mjs";
|
|
7
|
+
import "../../chunk-RYVUYVEE.mjs";
|
|
8
|
+
import "../../chunk-DPBE7TAQ.mjs";
|
|
9
|
+
import "../../chunk-PH2PMUZP.mjs";
|
|
10
|
+
import "../../chunk-3HTYHE2X.mjs";
|
|
11
|
+
import "../../chunk-7XFLH6R2.mjs";
|
|
9
12
|
export {
|
|
10
13
|
number
|
|
11
14
|
};
|
|
@@ -1,17 +1,22 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { RequiredValidation } from '../../commonTypes.mjs';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* Asserts that a number value does not exceed a specified maximum value.
|
|
5
|
-
*
|
|
6
|
-
* @
|
|
7
|
-
* @
|
|
8
|
-
*
|
|
4
|
+
* @description Asserts that a number value does not exceed a specified maximum value.
|
|
5
|
+
* @param {number} expected The maximum allowable value.
|
|
6
|
+
* @returns {RequiredValidation} A validation function that takes a received number and an exception context.
|
|
7
|
+
* @throws {ValidationError} if the received value exceeds the expected maximum value.
|
|
9
8
|
* @example
|
|
10
9
|
* const schema = number().custom(max(100));
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
10
|
+
* parseOrFail(schema, 99); // Valid
|
|
11
|
+
* parseOrFail(schema, 100); // Valid
|
|
12
|
+
* parseOrFail(schema, 101); // Throws an error: 'The received value is greater than expected'
|
|
13
|
+
*
|
|
14
|
+
* @translation Error Translation Key = 'n:max'
|
|
14
15
|
*/
|
|
15
|
-
declare const max:
|
|
16
|
+
declare const max: {
|
|
17
|
+
(expected: number): RequiredValidation;
|
|
18
|
+
key: string;
|
|
19
|
+
message: string;
|
|
20
|
+
};
|
|
16
21
|
|
|
17
22
|
export { max };
|
|
@@ -1,17 +1,22 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { RequiredValidation } from '../../commonTypes.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* Asserts that a number value does not exceed a specified maximum value.
|
|
5
|
-
*
|
|
6
|
-
* @
|
|
7
|
-
* @
|
|
8
|
-
*
|
|
4
|
+
* @description Asserts that a number value does not exceed a specified maximum value.
|
|
5
|
+
* @param {number} expected The maximum allowable value.
|
|
6
|
+
* @returns {RequiredValidation} A validation function that takes a received number and an exception context.
|
|
7
|
+
* @throws {ValidationError} if the received value exceeds the expected maximum value.
|
|
9
8
|
* @example
|
|
10
9
|
* const schema = number().custom(max(100));
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
10
|
+
* parseOrFail(schema, 99); // Valid
|
|
11
|
+
* parseOrFail(schema, 100); // Valid
|
|
12
|
+
* parseOrFail(schema, 101); // Throws an error: 'The received value is greater than expected'
|
|
13
|
+
*
|
|
14
|
+
* @translation Error Translation Key = 'n:max'
|
|
14
15
|
*/
|
|
15
|
-
declare const max:
|
|
16
|
+
declare const max: {
|
|
17
|
+
(expected: number): RequiredValidation;
|
|
18
|
+
key: string;
|
|
19
|
+
message: string;
|
|
20
|
+
};
|
|
16
21
|
|
|
17
22
|
export { max };
|
|
@@ -1,12 +1,19 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunk5BVJ6YMHjs = require('../../chunk-5BVJ6YMH.js');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
var _chunkWK4O3HH4js = require('../../chunk-WK4O3HH4.js');
|
|
4
7
|
|
|
5
8
|
// src/asserts/number/max.ts
|
|
6
|
-
var
|
|
7
|
-
|
|
8
|
-
|
|
9
|
+
var maxErrorMessage = "The received value is greater than expected";
|
|
10
|
+
var maxErrorKey = "n:max";
|
|
11
|
+
var max = (expected) => (received, ctx) => {
|
|
12
|
+
if (expected < received) _chunkWK4O3HH4js.guardException.call(void 0, expected, received, ctx, maxErrorKey);
|
|
9
13
|
};
|
|
14
|
+
max.key = maxErrorKey;
|
|
15
|
+
max.message = maxErrorMessage;
|
|
16
|
+
_chunk5BVJ6YMHjs.setToDefaultLocale.call(void 0, max);
|
|
10
17
|
|
|
11
18
|
|
|
12
19
|
exports.max = max;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/bguard/bguard/lib/asserts/number/max.js","../../../src/asserts/number/max.ts"],"names":[],"mappings":"AAAA;AACE;AACF,0DAAgC;AAChC;AACA;
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/bguard/bguard/lib/asserts/number/max.js","../../../src/asserts/number/max.ts"],"names":[],"mappings":"AAAA;AACE;AACF,0DAAgC;AAChC;AACE;AACF,0DAAgC;AAChC;AACA;ACHA,IAAM,gBAAA,EAAkB,6CAAA;AACxB,IAAM,YAAA,EAAc,OAAA;AAeb,IAAM,IAAA,EACX,CAAC,QAAA,EAAA,GACD,CAAC,QAAA,EAAkB,GAAA,EAAA,GAA0B;AAC3C,EAAA,GAAA,CAAI,SAAA,EAAW,QAAA,EAAU,6CAAA,QAAe,EAAU,QAAA,EAAU,GAAA,EAAK,WAAW,CAAA;AAC9E,CAAA;AAEF,GAAA,CAAI,IAAA,EAAM,WAAA;AACV,GAAA,CAAI,QAAA,EAAU,eAAA;AACd,iDAAA,GAAsB,CAAA;ADZtB;AACE;AACF,kBAAC","file":"/home/runner/work/bguard/bguard/lib/asserts/number/max.js","sourcesContent":[null,"import { setToDefaultLocale } from '../../translationMap';\nimport { guardException } from '../../exceptions';\nimport { ExceptionContext, RequiredValidation } from '../../commonTypes';\n\nconst maxErrorMessage = 'The received value is greater than expected';\nconst maxErrorKey = 'n:max';\n\n/**\n * @description Asserts that a number value does not exceed a specified maximum value.\n * @param {number} expected The maximum allowable value.\n * @returns {RequiredValidation} A validation function that takes a received number and an exception context.\n * @throws {ValidationError} if the received value exceeds the expected maximum value.\n * @example\n * const schema = number().custom(max(100));\n * parseOrFail(schema, 99); // Valid\n * parseOrFail(schema, 100); // Valid\n * parseOrFail(schema, 101); // Throws an error: 'The received value is greater than expected'\n *\n * @translation Error Translation Key = 'n:max'\n */\nexport const max =\n (expected: number): RequiredValidation =>\n (received: number, ctx: ExceptionContext) => {\n if (expected < received) guardException(expected, received, ctx, maxErrorKey);\n };\n\nmax.key = maxErrorKey;\nmax.message = maxErrorMessage;\nsetToDefaultLocale(max);\n"]}
|
|
@@ -1,12 +1,19 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
} from "../../chunk-
|
|
2
|
+
setToDefaultLocale
|
|
3
|
+
} from "../../chunk-3HTYHE2X.mjs";
|
|
4
|
+
import {
|
|
5
|
+
guardException
|
|
6
|
+
} from "../../chunk-7XFLH6R2.mjs";
|
|
4
7
|
|
|
5
8
|
// src/asserts/number/max.ts
|
|
6
|
-
var
|
|
7
|
-
|
|
8
|
-
|
|
9
|
+
var maxErrorMessage = "The received value is greater than expected";
|
|
10
|
+
var maxErrorKey = "n:max";
|
|
11
|
+
var max = (expected) => (received, ctx) => {
|
|
12
|
+
if (expected < received) guardException(expected, received, ctx, maxErrorKey);
|
|
9
13
|
};
|
|
14
|
+
max.key = maxErrorKey;
|
|
15
|
+
max.message = maxErrorMessage;
|
|
16
|
+
setToDefaultLocale(max);
|
|
10
17
|
export {
|
|
11
18
|
max
|
|
12
19
|
};
|