valgen 5.12.0 → 5.13.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/CHANGELOG.md +11 -0
- package/cjs/core/context.js +2 -0
- package/cjs/core/validation-error.js +2 -1
- package/cjs/core/validator.js +12 -6
- package/cjs/rules/format-rules/is-alpha.js +2 -2
- package/cjs/rules/format-rules/is-ascii.js +1 -1
- package/cjs/rules/format-rules/is-base64.js +1 -1
- package/cjs/rules/format-rules/is-btc-address.js +1 -1
- package/cjs/rules/format-rules/is-credit-card.js +1 -1
- package/cjs/rules/format-rules/is-decimal.js +1 -1
- package/cjs/rules/format-rules/is-ean.js +1 -1
- package/cjs/rules/format-rules/is-email.js +1 -10
- package/cjs/rules/format-rules/is-eth-address.js +1 -1
- package/cjs/rules/format-rules/is-fqdn.js +1 -2
- package/cjs/rules/format-rules/is-hash.js +1 -1
- package/cjs/rules/format-rules/is-hex-color.js +1 -1
- package/cjs/rules/format-rules/is-hex.js +1 -1
- package/cjs/rules/format-rules/is-iban.js +2 -2
- package/cjs/rules/format-rules/is-ip.js +2 -2
- package/cjs/rules/format-rules/is-issn.js +1 -2
- package/cjs/rules/format-rules/is-jwt.js +1 -1
- package/cjs/rules/format-rules/is-lowercase.js +2 -2
- package/cjs/rules/format-rules/is-mac-address.js +1 -2
- package/cjs/rules/format-rules/is-mobile-phone.js +1 -1
- package/cjs/rules/format-rules/is-object-id.js +1 -1
- package/cjs/rules/format-rules/is-passport-number.js +1 -1
- package/cjs/rules/format-rules/is-port.js +1 -1
- package/cjs/rules/format-rules/is-url.js +1 -1
- package/cjs/rules/format-rules/is-uuid.js +1 -1
- package/cjs/rules/format-rules/is-vat-number.js +1 -1
- package/cjs/rules/format-rules/matches.js +1 -1
- package/cjs/rules/logical-rules/is-defined.js +1 -1
- package/cjs/rules/logical-rules/is-empty.js +12 -12
- package/cjs/rules/logical-rules/range.js +5 -5
- package/cjs/rules/type-rules/is-array.js +6 -2
- package/cjs/rules/type-rules/is-bigint.js +1 -2
- package/cjs/rules/type-rules/is-boolean.js +1 -2
- package/cjs/rules/type-rules/is-date.js +4 -6
- package/cjs/rules/type-rules/is-integer.js +1 -6
- package/cjs/rules/type-rules/is-null.js +1 -1
- package/cjs/rules/type-rules/is-number.js +1 -6
- package/cjs/rules/type-rules/is-object.js +1 -1
- package/cjs/rules/type-rules/is-record.js +6 -4
- package/cjs/rules/type-rules/is-string.js +1 -1
- package/cjs/rules/type-rules/is-tuple.js +1 -1
- package/cjs/rules/type-rules/is-undefined.js +1 -1
- package/cjs/rules/utility-rules/get-length.js +1 -1
- package/cjs/rules/utility-rules/required.js +1 -1
- package/cjs/tsconfig-build-cjs.tsbuildinfo +1 -1
- package/esm/core/context.js +2 -0
- package/esm/core/validation-error.js +2 -1
- package/esm/core/validator.js +12 -6
- package/esm/rules/format-rules/is-alpha.js +2 -2
- package/esm/rules/format-rules/is-ascii.js +1 -1
- package/esm/rules/format-rules/is-base64.js +1 -1
- package/esm/rules/format-rules/is-btc-address.js +1 -1
- package/esm/rules/format-rules/is-credit-card.js +1 -1
- package/esm/rules/format-rules/is-decimal.js +1 -1
- package/esm/rules/format-rules/is-ean.js +1 -1
- package/esm/rules/format-rules/is-email.js +1 -10
- package/esm/rules/format-rules/is-eth-address.js +1 -1
- package/esm/rules/format-rules/is-fqdn.js +1 -2
- package/esm/rules/format-rules/is-hash.js +1 -1
- package/esm/rules/format-rules/is-hex-color.js +1 -1
- package/esm/rules/format-rules/is-hex.js +1 -1
- package/esm/rules/format-rules/is-iban.js +2 -2
- package/esm/rules/format-rules/is-ip.js +2 -2
- package/esm/rules/format-rules/is-issn.js +1 -2
- package/esm/rules/format-rules/is-jwt.js +1 -1
- package/esm/rules/format-rules/is-lowercase.js +2 -2
- package/esm/rules/format-rules/is-mac-address.js +1 -2
- package/esm/rules/format-rules/is-mobile-phone.js +1 -1
- package/esm/rules/format-rules/is-object-id.js +1 -1
- package/esm/rules/format-rules/is-passport-number.js +1 -1
- package/esm/rules/format-rules/is-port.js +1 -1
- package/esm/rules/format-rules/is-url.js +1 -1
- package/esm/rules/format-rules/is-uuid.js +1 -1
- package/esm/rules/format-rules/is-vat-number.js +1 -1
- package/esm/rules/format-rules/matches.js +1 -1
- package/esm/rules/logical-rules/is-defined.js +1 -1
- package/esm/rules/logical-rules/is-empty.js +12 -12
- package/esm/rules/logical-rules/range.js +5 -5
- package/esm/rules/type-rules/is-array.js +6 -2
- package/esm/rules/type-rules/is-bigint.js +1 -2
- package/esm/rules/type-rules/is-boolean.js +1 -2
- package/esm/rules/type-rules/is-date.js +4 -6
- package/esm/rules/type-rules/is-integer.js +1 -6
- package/esm/rules/type-rules/is-null.js +1 -1
- package/esm/rules/type-rules/is-number.js +1 -6
- package/esm/rules/type-rules/is-object.js +1 -1
- package/esm/rules/type-rules/is-record.js +6 -4
- package/esm/rules/type-rules/is-string.js +1 -1
- package/esm/rules/type-rules/is-tuple.js +1 -1
- package/esm/rules/type-rules/is-undefined.js +1 -1
- package/esm/rules/utility-rules/get-length.js +1 -1
- package/esm/rules/utility-rules/required.js +1 -1
- package/esm/tsconfig-build-esm.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/types/core/context.d.ts +1 -0
- package/types/index.d.cts +1 -1
- package/types/index.d.ts +1 -1
- package/types/rules/format-rules/is-object-id.d.ts +1 -1
|
@@ -10,29 +10,29 @@ export function isEmpty(options) {
|
|
|
10
10
|
if (typeof input === 'string') {
|
|
11
11
|
if (!input)
|
|
12
12
|
return input;
|
|
13
|
-
context.fail(_this, `
|
|
13
|
+
context.fail(_this, `Value must be an empty string`, input);
|
|
14
14
|
}
|
|
15
15
|
else if (Array.isArray(input)) {
|
|
16
16
|
if (!input.length)
|
|
17
17
|
return input;
|
|
18
|
-
context.fail(_this, `
|
|
18
|
+
context.fail(_this, `Value must be an empty array`, input);
|
|
19
19
|
}
|
|
20
20
|
else if (input instanceof Set) {
|
|
21
21
|
if (!input.size)
|
|
22
22
|
return input;
|
|
23
|
-
context.fail(_this, `
|
|
23
|
+
context.fail(_this, `Value must be an empty Set`, input);
|
|
24
24
|
}
|
|
25
25
|
else if (input instanceof Map) {
|
|
26
26
|
if (!input.size)
|
|
27
27
|
return input;
|
|
28
|
-
context.fail(_this, `
|
|
28
|
+
context.fail(_this, `Value must be an empty Map`, input);
|
|
29
29
|
}
|
|
30
30
|
else if (typeof input === 'object') {
|
|
31
31
|
if (!Object.keys(input).length)
|
|
32
32
|
return input;
|
|
33
|
-
context.fail(_this, `
|
|
33
|
+
context.fail(_this, `Value must be an empty Object`, input);
|
|
34
34
|
}
|
|
35
|
-
context.fail(_this, `
|
|
35
|
+
context.fail(_this, `Value must be empty`, input);
|
|
36
36
|
}, options);
|
|
37
37
|
}
|
|
38
38
|
/**
|
|
@@ -45,29 +45,29 @@ export function isNotEmpty(options) {
|
|
|
45
45
|
if (typeof input === 'string') {
|
|
46
46
|
if (input)
|
|
47
47
|
return input;
|
|
48
|
-
context.fail(_this, `Value
|
|
48
|
+
context.fail(_this, `Value must not be empty`, input);
|
|
49
49
|
}
|
|
50
50
|
else if (Array.isArray(input)) {
|
|
51
51
|
if (input.length)
|
|
52
52
|
return input;
|
|
53
|
-
context.fail(_this, `
|
|
53
|
+
context.fail(_this, `Array must not be empty`, input);
|
|
54
54
|
}
|
|
55
55
|
else if (input instanceof Set) {
|
|
56
56
|
if (input.size)
|
|
57
57
|
return input;
|
|
58
|
-
context.fail(_this, `
|
|
58
|
+
context.fail(_this, `Set must not be empty`, input);
|
|
59
59
|
}
|
|
60
60
|
else if (input instanceof Map) {
|
|
61
61
|
if (input.size)
|
|
62
62
|
return input;
|
|
63
|
-
context.fail(_this, `
|
|
63
|
+
context.fail(_this, `Map must not be empty`, input);
|
|
64
64
|
}
|
|
65
65
|
else if (typeof input === 'object') {
|
|
66
66
|
if (Object.keys(input).length)
|
|
67
67
|
return input;
|
|
68
|
-
context.fail(_this, `
|
|
68
|
+
context.fail(_this, `Object must not be empty`, input);
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
|
-
context.fail(_this, `Value
|
|
71
|
+
context.fail(_this, `Value must not be empty`, input);
|
|
72
72
|
}, options);
|
|
73
73
|
}
|
|
@@ -50,7 +50,7 @@ export function isGt(minValue, options) {
|
|
|
50
50
|
input.toLowerCase() > minValue.toLowerCase()))) {
|
|
51
51
|
return input;
|
|
52
52
|
}
|
|
53
|
-
context.fail(_this, `
|
|
53
|
+
context.fail(_this, `Value must be greater than ${typeof minValue === 'string' ? `"${minValue}"` : minValue}`, input);
|
|
54
54
|
}, options);
|
|
55
55
|
}
|
|
56
56
|
export function isGte(minValue, options) {
|
|
@@ -72,7 +72,7 @@ export function isGte(minValue, options) {
|
|
|
72
72
|
input.toLowerCase() >= minValue.toLowerCase()))) {
|
|
73
73
|
return input;
|
|
74
74
|
}
|
|
75
|
-
context.fail(_this, `
|
|
75
|
+
context.fail(_this, `Value must be greater than or equal to ${typeof minValue === 'string' ? `"${minValue}"` : minValue}`, input);
|
|
76
76
|
}, options);
|
|
77
77
|
}
|
|
78
78
|
export function isLt(maxValue, options) {
|
|
@@ -94,7 +94,7 @@ export function isLt(maxValue, options) {
|
|
|
94
94
|
input.toLowerCase() < maxValue.toLowerCase()))) {
|
|
95
95
|
return input;
|
|
96
96
|
}
|
|
97
|
-
context.fail(_this, `
|
|
97
|
+
context.fail(_this, `Value must be lover than ${typeof maxValue === 'string' ? `"${maxValue}"` : maxValue}`, input);
|
|
98
98
|
}, options);
|
|
99
99
|
}
|
|
100
100
|
export function isLte(maxValue, options) {
|
|
@@ -116,7 +116,7 @@ export function isLte(maxValue, options) {
|
|
|
116
116
|
input.toLowerCase() <= maxValue.toLowerCase()))) {
|
|
117
117
|
return input;
|
|
118
118
|
}
|
|
119
|
-
context.fail(_this, `
|
|
119
|
+
context.fail(_this, `Value must be lover than or equal to ${typeof maxValue === 'string' ? `"${maxValue}"` : maxValue}`, input);
|
|
120
120
|
}, options);
|
|
121
121
|
}
|
|
122
122
|
/**
|
|
@@ -127,7 +127,7 @@ export const lengthMin = (minValue) => allOf([
|
|
|
127
127
|
pipe([
|
|
128
128
|
getLength(),
|
|
129
129
|
isGte(minValue, {
|
|
130
|
-
onFail: () => `
|
|
130
|
+
onFail: () => `Value length must be at least ${minValue}`,
|
|
131
131
|
}),
|
|
132
132
|
]),
|
|
133
133
|
]);
|
|
@@ -11,7 +11,7 @@ export function isArray(itemValidator, options) {
|
|
|
11
11
|
if (output != null && coerce && !Array.isArray(output))
|
|
12
12
|
output = [output];
|
|
13
13
|
if (!Array.isArray(output)) {
|
|
14
|
-
context.fail(_this, `
|
|
14
|
+
context.fail(_this, `Value must be an array`, input);
|
|
15
15
|
return;
|
|
16
16
|
}
|
|
17
17
|
if (!itemValidator)
|
|
@@ -30,7 +30,11 @@ export function isArray(itemValidator, options) {
|
|
|
30
30
|
? context.location + `[${i}]`
|
|
31
31
|
: `<Array>[${i}]`;
|
|
32
32
|
itemContext.index = i;
|
|
33
|
-
v = itemValidator(v,
|
|
33
|
+
v = itemValidator(v, {
|
|
34
|
+
onFail(issue) {
|
|
35
|
+
return `Item at index [${i}] is not a valid. ` + issue.message;
|
|
36
|
+
},
|
|
37
|
+
}, itemContext);
|
|
34
38
|
out.push(v);
|
|
35
39
|
}
|
|
36
40
|
return out;
|
|
@@ -13,7 +13,6 @@ export function isBigint(options) {
|
|
|
13
13
|
(typeof input === 'string' && coerce)) {
|
|
14
14
|
return BigInt(input);
|
|
15
15
|
}
|
|
16
|
-
|
|
17
|
-
context.fail(_this, `${t}"{{value}}" is not a valid BigInt value`, input);
|
|
16
|
+
context.fail(_this, `Value must be a BigInt`, input);
|
|
18
17
|
}, options);
|
|
19
18
|
}
|
|
@@ -23,7 +23,6 @@ export function isBoolean(options) {
|
|
|
23
23
|
}
|
|
24
24
|
if (typeof output === 'boolean')
|
|
25
25
|
return output;
|
|
26
|
-
|
|
27
|
-
context.fail(_this, `${t}"{{value}}" is not a valid boolean value`, input);
|
|
26
|
+
context.fail(_this, `Value must be a boolean`, input);
|
|
28
27
|
}, options);
|
|
29
28
|
}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { formatISO, parseISO } from 'date-fns';
|
|
2
2
|
import { validator, } from '../../core/index.js';
|
|
3
|
-
|
|
4
|
-
const DATE_PATTERN =
|
|
5
|
-
// eslint-disable-next-line max-len
|
|
6
|
-
/^(\d{4})(?:-(0[0-9]|1[0-2]))?(?:-([0-2][0-9]|3[0-1]))?(?:[T ](([0-1][0-9]|2[0-4]):([0-5][0-9])(?::([0-5][0-9]))?(?:\.(\d{0,3}))?)?((?:[+-](0[0-9]|1[0-2])(?::(\d{2}))?)|Z)?)?$/;
|
|
3
|
+
// noinspection RegExpUnnecessaryNonCapturingGroup
|
|
4
|
+
const DATE_PATTERN = /^(\d{4})(?:-(0[0-9]|1[0-2]))?(?:-([0-2][0-9]|3[0-1]))?(?:[T ](([0-1][0-9]|2[0-4]):([0-5][0-9])(?::([0-5][0-9]))?(?:\.(\d{0,3}))?)?((?:[+-](0[0-9]|1[0-2])(?::(\d{2}))?)|Z)?)?$/;
|
|
7
5
|
/**
|
|
8
6
|
* Validates if value is instance of "Date".
|
|
9
7
|
* Converts input value to Date if coerce option is set to 'true'.
|
|
@@ -36,7 +34,7 @@ export function isDate(options) {
|
|
|
36
34
|
d.setHours(0, 0, 0, 0);
|
|
37
35
|
return d;
|
|
38
36
|
}
|
|
39
|
-
context.fail(_this, `
|
|
37
|
+
context.fail(_this, `Value must be a valid date`, input, {
|
|
40
38
|
...options,
|
|
41
39
|
});
|
|
42
40
|
}, options);
|
|
@@ -89,7 +87,7 @@ export function isDateString(options) {
|
|
|
89
87
|
? formatISO(input, { representation: 'date' })
|
|
90
88
|
: formatISO(input).substring(0, 19);
|
|
91
89
|
}
|
|
92
|
-
context.fail(_this, `
|
|
90
|
+
context.fail(_this, `Value must be a valid date string`, input, {
|
|
93
91
|
...options,
|
|
94
92
|
});
|
|
95
93
|
}, options);
|
|
@@ -22,11 +22,6 @@ export function isInteger(options) {
|
|
|
22
22
|
Number.isInteger(output)) {
|
|
23
23
|
return output;
|
|
24
24
|
}
|
|
25
|
-
|
|
26
|
-
? 'BigInt '
|
|
27
|
-
: typeof input === 'string'
|
|
28
|
-
? 'String '
|
|
29
|
-
: '';
|
|
30
|
-
context.fail(_this, `${t}"{{value}}" is not a valid integer value`, input);
|
|
25
|
+
context.fail(_this, `Value must be a valid integer value`, input);
|
|
31
26
|
}, options);
|
|
32
27
|
}
|
|
@@ -7,7 +7,7 @@ export function isNull(options) {
|
|
|
7
7
|
return validator('isNull', (input, context, _this) => {
|
|
8
8
|
if (input === null)
|
|
9
9
|
return input;
|
|
10
|
-
context.fail(_this, `
|
|
10
|
+
context.fail(_this, `Value must be null`, input);
|
|
11
11
|
}, options);
|
|
12
12
|
}
|
|
13
13
|
/**
|
|
@@ -19,11 +19,6 @@ export function isNumber(options) {
|
|
|
19
19
|
}
|
|
20
20
|
if (typeof output === 'number' && !isNaN(output))
|
|
21
21
|
return output;
|
|
22
|
-
|
|
23
|
-
? 'BigInt '
|
|
24
|
-
: typeof input === 'string'
|
|
25
|
-
? 'String '
|
|
26
|
-
: '';
|
|
27
|
-
context.fail(_this, `${t}"{{value}}" is not a valid number value`, input);
|
|
22
|
+
context.fail(_this, `Value must be a number`, input);
|
|
28
23
|
}, options);
|
|
29
24
|
}
|
|
@@ -42,7 +42,7 @@ export function isObject(schema, options) {
|
|
|
42
42
|
if (typeof output === 'string' && coerce)
|
|
43
43
|
output = JSON.parse(output);
|
|
44
44
|
if (!(output && typeof output === 'object')) {
|
|
45
|
-
context.fail(_this, `
|
|
45
|
+
context.fail(_this, `Value must be an object`, input);
|
|
46
46
|
return;
|
|
47
47
|
}
|
|
48
48
|
const keys = [...Object.keys(output), ...schemaKeys];
|
|
@@ -7,7 +7,7 @@ import { validator, } from '../../core/index.js';
|
|
|
7
7
|
export function isRecord(keyRule, valueRule, options) {
|
|
8
8
|
return validator('isRecord', (input, context, _this) => {
|
|
9
9
|
if (!(input && typeof input === 'object')) {
|
|
10
|
-
context.fail(_this, `
|
|
10
|
+
context.fail(_this, `Value must be an object`, input);
|
|
11
11
|
return;
|
|
12
12
|
}
|
|
13
13
|
const keyContext = context.extend();
|
|
@@ -23,9 +23,11 @@ export function isRecord(keyRule, valueRule, options) {
|
|
|
23
23
|
k = keys[i];
|
|
24
24
|
v = input[k];
|
|
25
25
|
// Validate key
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
k = keyRule(k, {
|
|
27
|
+
onFail(issue) {
|
|
28
|
+
return `${k} is not a valid key. ` + issue.message;
|
|
29
|
+
},
|
|
30
|
+
}, keyContext);
|
|
29
31
|
// Validate value
|
|
30
32
|
valueContext.property = k;
|
|
31
33
|
valueContext.location = location + (location ? '.' : '') + k;
|
|
@@ -20,7 +20,7 @@ export function isString(options) {
|
|
|
20
20
|
}
|
|
21
21
|
if (typeof output === 'string')
|
|
22
22
|
return output;
|
|
23
|
-
context.fail(_this, `
|
|
23
|
+
context.fail(_this, `Value must be a string`, input);
|
|
24
24
|
}, options);
|
|
25
25
|
}
|
|
26
26
|
export function stringReplace(searchValue, replacer) {
|
|
@@ -6,7 +6,7 @@ export function isTuple(items, options) {
|
|
|
6
6
|
if (output != null && coerce && !Array.isArray(output))
|
|
7
7
|
output = [output];
|
|
8
8
|
if (!Array.isArray(input)) {
|
|
9
|
-
context.fail(_this, `
|
|
9
|
+
context.fail(_this, `Value must be a tuple`, input);
|
|
10
10
|
return;
|
|
11
11
|
}
|
|
12
12
|
const location = context.location || '';
|
|
@@ -6,7 +6,7 @@ import { validator, } from '../../core/index.js';
|
|
|
6
6
|
export function required(nested, options) {
|
|
7
7
|
return validator('required', (input, context, _this) => {
|
|
8
8
|
if (input == null) {
|
|
9
|
-
context.fail(_this, `
|
|
9
|
+
context.fail(_this, `Value required`, input);
|
|
10
10
|
return;
|
|
11
11
|
}
|
|
12
12
|
return nested(input, context);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"root":["../../src/constants.ts","../../src/factories.ts","../../src/index.ts","../../src/core/constants.ts","../../src/core/context.ts","../../src/core/index.ts","../../src/core/types.ts","../../src/core/utilities.ts","../../src/core/validation-error.ts","../../src/core/validator.ts","../../src/helpers/object.utils.ts","../../src/helpers/omit-undefined.ts","../../src/helpers/string.utils.ts","../../src/rules/index.ts","../../src/rules/format-rules/is-alpha.ts","../../src/rules/format-rules/is-ascii.ts","../../src/rules/format-rules/is-base64.ts","../../src/rules/format-rules/is-btc-address.ts","../../src/rules/format-rules/is-credit-card.ts","../../src/rules/format-rules/is-decimal.ts","../../src/rules/format-rules/is-ean.ts","../../src/rules/format-rules/is-email.ts","../../src/rules/format-rules/is-eth-address.ts","../../src/rules/format-rules/is-fqdn.ts","../../src/rules/format-rules/is-hash.ts","../../src/rules/format-rules/is-hex-color.ts","../../src/rules/format-rules/is-hex.ts","../../src/rules/format-rules/is-iban.ts","../../src/rules/format-rules/is-ip.ts","../../src/rules/format-rules/is-issn.ts","../../src/rules/format-rules/is-jwt.ts","../../src/rules/format-rules/is-lowercase.ts","../../src/rules/format-rules/is-mac-address.ts","../../src/rules/format-rules/is-mobile-phone.ts","../../src/rules/format-rules/is-object-id.ts","../../src/rules/format-rules/is-passport-number.ts","../../src/rules/format-rules/is-port.ts","../../src/rules/format-rules/is-url.ts","../../src/rules/format-rules/is-uuid.ts","../../src/rules/format-rules/is-vat-number.ts","../../src/rules/format-rules/matches.ts","../../src/rules/logical-rules/is-defined.ts","../../src/rules/logical-rules/is-empty.ts","../../src/rules/logical-rules/range.ts","../../src/rules/type-rules/is-any.ts","../../src/rules/type-rules/is-array.ts","../../src/rules/type-rules/is-bigint.ts","../../src/rules/type-rules/is-boolean.ts","../../src/rules/type-rules/is-date.ts","../../src/rules/type-rules/is-enum.ts","../../src/rules/type-rules/is-integer.ts","../../src/rules/type-rules/is-null.ts","../../src/rules/type-rules/is-number.ts","../../src/rules/type-rules/is-object.ts","../../src/rules/type-rules/is-record.ts","../../src/rules/type-rules/is-string.ts","../../src/rules/type-rules/is-tuple.ts","../../src/rules/type-rules/is-undefined.ts","../../src/rules/utility-rules/exists.ts","../../src/rules/utility-rules/get-length.ts","../../src/rules/utility-rules/optional.ts","../../src/rules/utility-rules/pipe.ts","../../src/rules/utility-rules/required.ts","../../src/rules/utility-rules/union.ts"],"version":"5.
|
|
1
|
+
{"root":["../../src/constants.ts","../../src/factories.ts","../../src/index.ts","../../src/core/constants.ts","../../src/core/context.ts","../../src/core/index.ts","../../src/core/types.ts","../../src/core/utilities.ts","../../src/core/validation-error.ts","../../src/core/validator.ts","../../src/helpers/object.utils.ts","../../src/helpers/omit-undefined.ts","../../src/helpers/string.utils.ts","../../src/rules/index.ts","../../src/rules/format-rules/is-alpha.ts","../../src/rules/format-rules/is-ascii.ts","../../src/rules/format-rules/is-base64.ts","../../src/rules/format-rules/is-btc-address.ts","../../src/rules/format-rules/is-credit-card.ts","../../src/rules/format-rules/is-decimal.ts","../../src/rules/format-rules/is-ean.ts","../../src/rules/format-rules/is-email.ts","../../src/rules/format-rules/is-eth-address.ts","../../src/rules/format-rules/is-fqdn.ts","../../src/rules/format-rules/is-hash.ts","../../src/rules/format-rules/is-hex-color.ts","../../src/rules/format-rules/is-hex.ts","../../src/rules/format-rules/is-iban.ts","../../src/rules/format-rules/is-ip.ts","../../src/rules/format-rules/is-issn.ts","../../src/rules/format-rules/is-jwt.ts","../../src/rules/format-rules/is-lowercase.ts","../../src/rules/format-rules/is-mac-address.ts","../../src/rules/format-rules/is-mobile-phone.ts","../../src/rules/format-rules/is-object-id.ts","../../src/rules/format-rules/is-passport-number.ts","../../src/rules/format-rules/is-port.ts","../../src/rules/format-rules/is-url.ts","../../src/rules/format-rules/is-uuid.ts","../../src/rules/format-rules/is-vat-number.ts","../../src/rules/format-rules/matches.ts","../../src/rules/logical-rules/is-defined.ts","../../src/rules/logical-rules/is-empty.ts","../../src/rules/logical-rules/range.ts","../../src/rules/type-rules/is-any.ts","../../src/rules/type-rules/is-array.ts","../../src/rules/type-rules/is-bigint.ts","../../src/rules/type-rules/is-boolean.ts","../../src/rules/type-rules/is-date.ts","../../src/rules/type-rules/is-enum.ts","../../src/rules/type-rules/is-integer.ts","../../src/rules/type-rules/is-null.ts","../../src/rules/type-rules/is-number.ts","../../src/rules/type-rules/is-object.ts","../../src/rules/type-rules/is-record.ts","../../src/rules/type-rules/is-string.ts","../../src/rules/type-rules/is-tuple.ts","../../src/rules/type-rules/is-undefined.ts","../../src/rules/utility-rules/exists.ts","../../src/rules/utility-rules/get-length.ts","../../src/rules/utility-rules/optional.ts","../../src/rules/utility-rules/pipe.ts","../../src/rules/utility-rules/required.ts","../../src/rules/utility-rules/union.ts"],"version":"5.7.3"}
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "valgen",
|
|
3
3
|
"description": "Fast runtime type validator, converter and io (encoding/decoding) library",
|
|
4
|
-
"version": "5.
|
|
4
|
+
"version": "5.13.0",
|
|
5
5
|
"author": "Panates",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"dependencies": {
|
|
8
8
|
"@browsery/validator": "^13.12.0-r1",
|
|
9
9
|
"date-fns": "^4.1.0",
|
|
10
|
-
"ts-gems": "^3.
|
|
10
|
+
"ts-gems": "^3.11.3",
|
|
11
11
|
"tslib": "^2.8.1"
|
|
12
12
|
},
|
|
13
13
|
"type": "module",
|
package/types/core/context.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ErrorIssue, ExecutionOptions, OnFailFunction } from './types.js';
|
|
2
2
|
import type { Validator } from './validator.js';
|
|
3
3
|
export declare class Context implements ExecutionOptions {
|
|
4
|
+
isRoot: boolean;
|
|
4
5
|
errors: ErrorIssue[];
|
|
5
6
|
maxErrors?: number;
|
|
6
7
|
onFail?: OnFailFunction;
|
package/types/index.d.cts
CHANGED
|
@@ -19,7 +19,7 @@ declare const isDefined: import("./core/validator.js").Validator<any, unknown, i
|
|
|
19
19
|
declare const isUndefined: import("./core/validator.js").Validator<any, unknown, import("./core/types.js").ExecutionOptions>;
|
|
20
20
|
declare const isNumber: import("./core/validator.js").Validator<number, unknown, import("./core/types.js").ExecutionOptions>;
|
|
21
21
|
declare const isObject: vg.IsObject.Validator<object, string | object>;
|
|
22
|
-
declare const isObjectId: import("./core/validator.js").Validator<string | vg.ObjectIdLike | Uint8Array
|
|
22
|
+
declare const isObjectId: import("./core/validator.js").Validator<string | vg.ObjectIdLike | Uint8Array<ArrayBufferLike>, unknown, import("./core/types.js").ExecutionOptions>;
|
|
23
23
|
declare const isString: import("./core/validator.js").Validator<string, unknown, import("./core/types.js").ExecutionOptions>;
|
|
24
24
|
declare const isUUID: import("./core/validator.js").Validator<string, string, import("./core/types.js").ExecutionOptions>;
|
|
25
25
|
declare const isUUID1: import("./core/validator.js").Validator<string, string, import("./core/types.js").ExecutionOptions>;
|
package/types/index.d.ts
CHANGED
|
@@ -19,7 +19,7 @@ declare const isDefined: import("./core/validator.js").Validator<any, unknown, i
|
|
|
19
19
|
declare const isUndefined: import("./core/validator.js").Validator<any, unknown, import("./core/types.js").ExecutionOptions>;
|
|
20
20
|
declare const isNumber: import("./core/validator.js").Validator<number, unknown, import("./core/types.js").ExecutionOptions>;
|
|
21
21
|
declare const isObject: vg.IsObject.Validator<object, string | object>;
|
|
22
|
-
declare const isObjectId: import("./core/validator.js").Validator<string | vg.ObjectIdLike | Uint8Array
|
|
22
|
+
declare const isObjectId: import("./core/validator.js").Validator<string | vg.ObjectIdLike | Uint8Array<ArrayBufferLike>, unknown, import("./core/types.js").ExecutionOptions>;
|
|
23
23
|
declare const isString: import("./core/validator.js").Validator<string, unknown, import("./core/types.js").ExecutionOptions>;
|
|
24
24
|
declare const isUUID: import("./core/validator.js").Validator<string, string, import("./core/types.js").ExecutionOptions>;
|
|
25
25
|
declare const isUUID1: import("./core/validator.js").Validator<string, string, import("./core/types.js").ExecutionOptions>;
|
|
@@ -7,4 +7,4 @@ export declare interface ObjectIdLike {
|
|
|
7
7
|
* Validates if value is an "ObjectId".
|
|
8
8
|
* @validator isObjectId
|
|
9
9
|
*/
|
|
10
|
-
export declare function isObjectId(options?: ValidationOptions): import("../../core/validator.js").Validator<string | ObjectIdLike | Uint8Array
|
|
10
|
+
export declare function isObjectId(options?: ValidationOptions): import("../../core/validator.js").Validator<string | ObjectIdLike | Uint8Array<ArrayBufferLike>, unknown, import("../../core/types.js").ExecutionOptions>;
|