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.
Files changed (102) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/cjs/core/context.js +2 -0
  3. package/cjs/core/validation-error.js +2 -1
  4. package/cjs/core/validator.js +12 -6
  5. package/cjs/rules/format-rules/is-alpha.js +2 -2
  6. package/cjs/rules/format-rules/is-ascii.js +1 -1
  7. package/cjs/rules/format-rules/is-base64.js +1 -1
  8. package/cjs/rules/format-rules/is-btc-address.js +1 -1
  9. package/cjs/rules/format-rules/is-credit-card.js +1 -1
  10. package/cjs/rules/format-rules/is-decimal.js +1 -1
  11. package/cjs/rules/format-rules/is-ean.js +1 -1
  12. package/cjs/rules/format-rules/is-email.js +1 -10
  13. package/cjs/rules/format-rules/is-eth-address.js +1 -1
  14. package/cjs/rules/format-rules/is-fqdn.js +1 -2
  15. package/cjs/rules/format-rules/is-hash.js +1 -1
  16. package/cjs/rules/format-rules/is-hex-color.js +1 -1
  17. package/cjs/rules/format-rules/is-hex.js +1 -1
  18. package/cjs/rules/format-rules/is-iban.js +2 -2
  19. package/cjs/rules/format-rules/is-ip.js +2 -2
  20. package/cjs/rules/format-rules/is-issn.js +1 -2
  21. package/cjs/rules/format-rules/is-jwt.js +1 -1
  22. package/cjs/rules/format-rules/is-lowercase.js +2 -2
  23. package/cjs/rules/format-rules/is-mac-address.js +1 -2
  24. package/cjs/rules/format-rules/is-mobile-phone.js +1 -1
  25. package/cjs/rules/format-rules/is-object-id.js +1 -1
  26. package/cjs/rules/format-rules/is-passport-number.js +1 -1
  27. package/cjs/rules/format-rules/is-port.js +1 -1
  28. package/cjs/rules/format-rules/is-url.js +1 -1
  29. package/cjs/rules/format-rules/is-uuid.js +1 -1
  30. package/cjs/rules/format-rules/is-vat-number.js +1 -1
  31. package/cjs/rules/format-rules/matches.js +1 -1
  32. package/cjs/rules/logical-rules/is-defined.js +1 -1
  33. package/cjs/rules/logical-rules/is-empty.js +12 -12
  34. package/cjs/rules/logical-rules/range.js +5 -5
  35. package/cjs/rules/type-rules/is-array.js +6 -2
  36. package/cjs/rules/type-rules/is-bigint.js +1 -2
  37. package/cjs/rules/type-rules/is-boolean.js +1 -2
  38. package/cjs/rules/type-rules/is-date.js +4 -6
  39. package/cjs/rules/type-rules/is-integer.js +1 -6
  40. package/cjs/rules/type-rules/is-null.js +1 -1
  41. package/cjs/rules/type-rules/is-number.js +1 -6
  42. package/cjs/rules/type-rules/is-object.js +1 -1
  43. package/cjs/rules/type-rules/is-record.js +6 -4
  44. package/cjs/rules/type-rules/is-string.js +1 -1
  45. package/cjs/rules/type-rules/is-tuple.js +1 -1
  46. package/cjs/rules/type-rules/is-undefined.js +1 -1
  47. package/cjs/rules/utility-rules/get-length.js +1 -1
  48. package/cjs/rules/utility-rules/required.js +1 -1
  49. package/cjs/tsconfig-build-cjs.tsbuildinfo +1 -1
  50. package/esm/core/context.js +2 -0
  51. package/esm/core/validation-error.js +2 -1
  52. package/esm/core/validator.js +12 -6
  53. package/esm/rules/format-rules/is-alpha.js +2 -2
  54. package/esm/rules/format-rules/is-ascii.js +1 -1
  55. package/esm/rules/format-rules/is-base64.js +1 -1
  56. package/esm/rules/format-rules/is-btc-address.js +1 -1
  57. package/esm/rules/format-rules/is-credit-card.js +1 -1
  58. package/esm/rules/format-rules/is-decimal.js +1 -1
  59. package/esm/rules/format-rules/is-ean.js +1 -1
  60. package/esm/rules/format-rules/is-email.js +1 -10
  61. package/esm/rules/format-rules/is-eth-address.js +1 -1
  62. package/esm/rules/format-rules/is-fqdn.js +1 -2
  63. package/esm/rules/format-rules/is-hash.js +1 -1
  64. package/esm/rules/format-rules/is-hex-color.js +1 -1
  65. package/esm/rules/format-rules/is-hex.js +1 -1
  66. package/esm/rules/format-rules/is-iban.js +2 -2
  67. package/esm/rules/format-rules/is-ip.js +2 -2
  68. package/esm/rules/format-rules/is-issn.js +1 -2
  69. package/esm/rules/format-rules/is-jwt.js +1 -1
  70. package/esm/rules/format-rules/is-lowercase.js +2 -2
  71. package/esm/rules/format-rules/is-mac-address.js +1 -2
  72. package/esm/rules/format-rules/is-mobile-phone.js +1 -1
  73. package/esm/rules/format-rules/is-object-id.js +1 -1
  74. package/esm/rules/format-rules/is-passport-number.js +1 -1
  75. package/esm/rules/format-rules/is-port.js +1 -1
  76. package/esm/rules/format-rules/is-url.js +1 -1
  77. package/esm/rules/format-rules/is-uuid.js +1 -1
  78. package/esm/rules/format-rules/is-vat-number.js +1 -1
  79. package/esm/rules/format-rules/matches.js +1 -1
  80. package/esm/rules/logical-rules/is-defined.js +1 -1
  81. package/esm/rules/logical-rules/is-empty.js +12 -12
  82. package/esm/rules/logical-rules/range.js +5 -5
  83. package/esm/rules/type-rules/is-array.js +6 -2
  84. package/esm/rules/type-rules/is-bigint.js +1 -2
  85. package/esm/rules/type-rules/is-boolean.js +1 -2
  86. package/esm/rules/type-rules/is-date.js +4 -6
  87. package/esm/rules/type-rules/is-integer.js +1 -6
  88. package/esm/rules/type-rules/is-null.js +1 -1
  89. package/esm/rules/type-rules/is-number.js +1 -6
  90. package/esm/rules/type-rules/is-object.js +1 -1
  91. package/esm/rules/type-rules/is-record.js +6 -4
  92. package/esm/rules/type-rules/is-string.js +1 -1
  93. package/esm/rules/type-rules/is-tuple.js +1 -1
  94. package/esm/rules/type-rules/is-undefined.js +1 -1
  95. package/esm/rules/utility-rules/get-length.js +1 -1
  96. package/esm/rules/utility-rules/required.js +1 -1
  97. package/esm/tsconfig-build-esm.tsbuildinfo +1 -1
  98. package/package.json +2 -2
  99. package/types/core/context.d.ts +1 -0
  100. package/types/index.d.cts +1 -1
  101. package/types/index.d.ts +1 -1
  102. 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, `Is not an empty string`, input);
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, `Is not an empty array`, input);
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, `Is not an empty Set`, input);
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, `Is not an empty Map`, input);
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, `Is not an empty Object`, input);
33
+ context.fail(_this, `Value must be an empty Object`, input);
34
34
  }
35
- context.fail(_this, `Is not empty`, input);
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 is an empty string`, input);
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, `Value is an empty array`, input);
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, `Value is an empty Set`, input);
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, `Value is an empty Map`, input);
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, `Value is an empty Object`, input);
68
+ context.fail(_this, `Object must not be empty`, input);
69
69
  }
70
70
  }
71
- context.fail(_this, `Value is empty`, input);
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, `{{label}} must be greater than ${typeof minValue === 'string' ? `"${minValue}"` : minValue}`, input);
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, `{{label}} must be greater than or equal to ${typeof minValue === 'string' ? `"${minValue}"` : minValue}`, input);
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, `{{label}} must be lover than ${typeof maxValue === 'string' ? `"${maxValue}"` : maxValue}`, input);
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, `{{label}} must be lover than or equal to ${typeof maxValue === 'string' ? `"${maxValue}"` : maxValue}`, input);
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: () => `The length of {{label}} must be at least ${minValue}`,
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, `"{{value}}" is not an array value`, input);
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, itemContext);
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
- const t = typeof input === 'string' ? 'String ' : '';
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
- const t = typeof input === 'string' ? 'String ' : '';
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
- /* eslint-disable-next-line max-len */ // noinspection RegExpUnnecessaryNonCapturingGroup
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, `"{{value}}" is not a valid date value`, input, {
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, `"{{value}}" is not a valid date string`, input, {
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
- const t = typeof input === 'bigint'
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, `{{label}} is not null`, input);
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
- const t = typeof input === 'bigint'
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, `"{{value}}" is not an object`, input);
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, `{{label}} must be an object`, input);
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
- keyContext.property = '@' + k;
27
- keyContext.location = location + (location ? '.@' : '@') + k;
28
- k = keyRule(k, keyContext);
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, `"{{value}}" is not a string`, input);
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, `"{{value}}" is not a valid tuple`, input);
9
+ context.fail(_this, `Value must be a tuple`, input);
10
10
  return;
11
11
  }
12
12
  const location = context.location || '';
@@ -9,6 +9,6 @@ export function isUndefined(options) {
9
9
  return undefined;
10
10
  if (input === undefined)
11
11
  return;
12
- context.fail(_this, `{{label}} mustn't be defined`, input);
12
+ context.fail(_this, `Value must be undefined`, input);
13
13
  }, options);
14
14
  }
@@ -21,6 +21,6 @@ export function getLength() {
21
21
  typeof input.size === 'number') {
22
22
  return input.size;
23
23
  }
24
- context.fail(_this, `Unable to get length of {{label}}`, input);
24
+ context.fail(_this, `Unable to get length`, input);
25
25
  });
26
26
  }
@@ -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, `{{label}} is required`, input);
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.6.3"}
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.12.0",
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.6.0",
10
+ "ts-gems": "^3.11.3",
11
11
  "tslib": "^2.8.1"
12
12
  },
13
13
  "type": "module",
@@ -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, unknown, import("./core/types.js").ExecutionOptions>;
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, unknown, import("./core/types.js").ExecutionOptions>;
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, unknown, import("../../core/types.js").ExecutionOptions>;
10
+ export declare function isObjectId(options?: ValidationOptions): import("../../core/validator.js").Validator<string | ObjectIdLike | Uint8Array<ArrayBufferLike>, unknown, import("../../core/types.js").ExecutionOptions>;