valgen 5.9.0 → 5.12.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 (120) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/README.md +3 -3
  3. package/cjs/core/utilities.js +4 -4
  4. package/cjs/rules/format-rules/is-alpha.js +3 -3
  5. package/cjs/rules/format-rules/is-ascii.js +2 -2
  6. package/cjs/rules/format-rules/is-base64.js +2 -2
  7. package/cjs/rules/format-rules/is-btc-address.js +2 -2
  8. package/cjs/rules/format-rules/is-credit-card.js +2 -2
  9. package/cjs/rules/format-rules/is-decimal.js +2 -2
  10. package/cjs/rules/format-rules/is-ean.js +2 -2
  11. package/cjs/rules/format-rules/is-email.js +7 -7
  12. package/cjs/rules/format-rules/is-eth-address.js +2 -2
  13. package/cjs/rules/format-rules/is-fqdn.js +2 -2
  14. package/cjs/rules/format-rules/is-hash.js +2 -2
  15. package/cjs/rules/format-rules/is-hex-color.js +2 -2
  16. package/cjs/rules/format-rules/is-hex.js +2 -2
  17. package/cjs/rules/format-rules/is-iban.js +3 -3
  18. package/cjs/rules/format-rules/is-ip.js +3 -3
  19. package/cjs/rules/format-rules/is-issn.js +2 -2
  20. package/cjs/rules/format-rules/is-jwt.js +2 -2
  21. package/cjs/rules/format-rules/is-lowercase.js +3 -3
  22. package/cjs/rules/format-rules/is-mac-address.js +2 -2
  23. package/cjs/rules/format-rules/is-mobile-phone.js +2 -2
  24. package/cjs/rules/format-rules/is-object-id.js +1 -1
  25. package/cjs/rules/format-rules/is-passport-number.js +2 -2
  26. package/cjs/rules/format-rules/is-port.js +5 -3
  27. package/cjs/rules/format-rules/is-url.js +2 -2
  28. package/cjs/rules/format-rules/is-uuid.js +2 -2
  29. package/cjs/rules/format-rules/is-vat-number.js +2 -2
  30. package/cjs/tsconfig-build-cjs.tsbuildinfo +1 -0
  31. package/esm/core/utilities.js +1 -1
  32. package/esm/rules/format-rules/is-alpha.js +2 -2
  33. package/esm/rules/format-rules/is-ascii.js +2 -2
  34. package/esm/rules/format-rules/is-base64.js +2 -2
  35. package/esm/rules/format-rules/is-btc-address.js +2 -2
  36. package/esm/rules/format-rules/is-credit-card.js +2 -2
  37. package/esm/rules/format-rules/is-decimal.js +2 -2
  38. package/esm/rules/format-rules/is-ean.js +2 -2
  39. package/esm/rules/format-rules/is-email.js +2 -2
  40. package/esm/rules/format-rules/is-eth-address.js +2 -2
  41. package/esm/rules/format-rules/is-fqdn.js +2 -2
  42. package/esm/rules/format-rules/is-hash.js +2 -2
  43. package/esm/rules/format-rules/is-hex-color.js +2 -2
  44. package/esm/rules/format-rules/is-hex.js +2 -2
  45. package/esm/rules/format-rules/is-iban.js +2 -2
  46. package/esm/rules/format-rules/is-ip.js +2 -2
  47. package/esm/rules/format-rules/is-issn.js +2 -2
  48. package/esm/rules/format-rules/is-jwt.js +2 -2
  49. package/esm/rules/format-rules/is-lowercase.js +2 -2
  50. package/esm/rules/format-rules/is-mac-address.js +2 -2
  51. package/esm/rules/format-rules/is-mobile-phone.js +2 -2
  52. package/esm/rules/format-rules/is-object-id.js +1 -1
  53. package/esm/rules/format-rules/is-passport-number.js +2 -2
  54. package/esm/rules/format-rules/is-port.js +5 -3
  55. package/esm/rules/format-rules/is-url.js +2 -2
  56. package/esm/rules/format-rules/is-uuid.js +2 -2
  57. package/esm/rules/format-rules/is-vat-number.js +2 -2
  58. package/esm/rules/logical-rules/is-defined.js +1 -1
  59. package/esm/rules/logical-rules/is-empty.js +1 -1
  60. package/esm/rules/type-rules/is-bigint.js +1 -1
  61. package/esm/rules/type-rules/is-date.js +1 -1
  62. package/esm/rules/type-rules/is-null.js +1 -1
  63. package/esm/rules/type-rules/is-number.js +1 -1
  64. package/esm/rules/utility-rules/exists.js +1 -1
  65. package/esm/rules/utility-rules/union.js +1 -1
  66. package/esm/tsconfig-build-esm.tsbuildinfo +1 -0
  67. package/package.json +5 -5
  68. package/types/core/utilities.d.ts +2 -1
  69. package/types/core/validation-error.d.ts +1 -1
  70. package/types/core/validator.d.ts +2 -2
  71. package/types/index.d.cts +1 -1
  72. package/types/index.d.ts +1 -1
  73. package/types/rules/format-rules/is-alpha.d.ts +1 -1
  74. package/types/rules/format-rules/is-ascii.d.ts +1 -1
  75. package/types/rules/format-rules/is-base64.d.ts +2 -2
  76. package/types/rules/format-rules/is-btc-address.d.ts +1 -1
  77. package/types/rules/format-rules/is-credit-card.d.ts +2 -2
  78. package/types/rules/format-rules/is-decimal.d.ts +1 -1
  79. package/types/rules/format-rules/is-ean.d.ts +1 -1
  80. package/types/rules/format-rules/is-email.d.ts +1 -1
  81. package/types/rules/format-rules/is-eth-address.d.ts +1 -1
  82. package/types/rules/format-rules/is-fqdn.d.ts +1 -1
  83. package/types/rules/format-rules/is-hash.d.ts +2 -2
  84. package/types/rules/format-rules/is-hex-color.d.ts +1 -1
  85. package/types/rules/format-rules/is-hex.d.ts +1 -1
  86. package/types/rules/format-rules/is-iban.d.ts +1 -1
  87. package/types/rules/format-rules/is-ip.d.ts +1 -1
  88. package/types/rules/format-rules/is-issn.d.ts +1 -1
  89. package/types/rules/format-rules/is-jwt.d.ts +1 -1
  90. package/types/rules/format-rules/is-lowercase.d.ts +1 -1
  91. package/types/rules/format-rules/is-mac-address.d.ts +1 -1
  92. package/types/rules/format-rules/is-mobile-phone.d.ts +2 -2
  93. package/types/rules/format-rules/is-object-id.d.ts +1 -1
  94. package/types/rules/format-rules/is-passport-number.d.ts +1 -1
  95. package/types/rules/format-rules/is-port.d.ts +2 -2
  96. package/types/rules/format-rules/is-url.d.ts +2 -2
  97. package/types/rules/format-rules/is-uuid.d.ts +1 -1
  98. package/types/rules/format-rules/is-vat-number.d.ts +1 -1
  99. package/types/rules/format-rules/matches.d.ts +1 -1
  100. package/types/rules/logical-rules/is-defined.d.ts +1 -1
  101. package/types/rules/logical-rules/is-empty.d.ts +1 -1
  102. package/types/rules/logical-rules/range.d.ts +1 -1
  103. package/types/rules/type-rules/is-array.d.ts +1 -1
  104. package/types/rules/type-rules/is-bigint.d.ts +1 -1
  105. package/types/rules/type-rules/is-boolean.d.ts +1 -1
  106. package/types/rules/type-rules/is-date.d.ts +1 -1
  107. package/types/rules/type-rules/is-enum.d.ts +1 -1
  108. package/types/rules/type-rules/is-integer.d.ts +1 -1
  109. package/types/rules/type-rules/is-null.d.ts +1 -1
  110. package/types/rules/type-rules/is-number.d.ts +1 -1
  111. package/types/rules/type-rules/is-object.d.ts +1 -1
  112. package/types/rules/type-rules/is-record.d.ts +1 -1
  113. package/types/rules/type-rules/is-string.d.ts +1 -1
  114. package/types/rules/type-rules/is-tuple.d.ts +1 -1
  115. package/types/rules/type-rules/is-undefined.d.ts +1 -1
  116. package/types/rules/utility-rules/exists.d.ts +1 -1
  117. package/types/rules/utility-rules/optional.d.ts +2 -2
  118. package/types/rules/utility-rules/pipe.d.ts +1 -1
  119. package/types/rules/utility-rules/required.d.ts +2 -2
  120. package/types/rules/utility-rules/union.d.ts +1 -1
@@ -0,0 +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,4 +1,4 @@
1
- import { isValidator, validator, } from './index.js';
1
+ import { isValidator, validator } from './validator.js';
2
2
  /**
3
3
  * Forwards codec process to a sub codec. Useful for circular checks
4
4
  * @validator forwardRef
@@ -1,5 +1,5 @@
1
- import * as validatorJS from 'validator';
2
- import { validator } from '../../core/index.js';
1
+ import validatorJS from '@browsery/validator';
2
+ import { validator, } from '../../core/index.js';
3
3
  /**
4
4
  * Check if the string contains only letters (a-zA-Z).
5
5
  * @validator isAlpha
@@ -1,5 +1,5 @@
1
- import * as validatorJS from 'validator';
2
- import { validator } from '../../core/index.js';
1
+ import validatorJS from '@browsery/validator';
2
+ import { validator, } from '../../core/index.js';
3
3
  /**
4
4
  * Check if the string contains ASCII chars only.
5
5
  * @validator isAscii
@@ -1,5 +1,5 @@
1
- import * as validatorJS from 'validator';
2
- import { validator } from '../../core/index.js';
1
+ import validatorJS from '@browsery/validator';
2
+ import { validator, } from '../../core/index.js';
3
3
  /**
4
4
  * Validates if value is a "Base64" string.
5
5
  * @validator isBase64
@@ -1,5 +1,5 @@
1
- import * as validatorJS from 'validator';
2
- import { validator } from '../../core/index.js';
1
+ import validatorJS from '@browsery/validator';
2
+ import { validator, } from '../../core/index.js';
3
3
  /**
4
4
  * Validates if value is a BTC address.
5
5
  * @validator isBtcAddress
@@ -1,5 +1,5 @@
1
- import * as validatorJS from 'validator';
2
- import { validator } from '../../core/index.js';
1
+ import validatorJS from '@browsery/validator';
2
+ import { validator, } from '../../core/index.js';
3
3
  /**
4
4
  * Validates if value is a credit card number
5
5
  * @validator isCreditCard
@@ -1,5 +1,5 @@
1
- import * as validatorJS from 'validator';
2
- import { validator } from '../../core/index.js';
1
+ import validatorJS from '@browsery/validator';
2
+ import { validator, } from '../../core/index.js';
3
3
  /**
4
4
  * Check if the string represents a decimal number,
5
5
  * such as `0.1`, `.3`, `1.1`, `1.00003`, `4.0` etc.
@@ -1,5 +1,5 @@
1
- import * as validatorJS from 'validator';
2
- import { validator } from '../../core/index.js';
1
+ import validatorJS from '@browsery/validator';
2
+ import { validator, } from '../../core/index.js';
3
3
  /**
4
4
  * Validates if value is an EAN (European Article Number)
5
5
  * @validator isEAN
@@ -1,5 +1,5 @@
1
- import * as validatorJS from 'validator';
2
- import { validator } from '../../core/index.js';
1
+ import validatorJS from '@browsery/validator';
2
+ import { validator, } from '../../core/index.js';
3
3
  /**
4
4
  * Validates if value is a valid Email
5
5
  * @validator isEmail
@@ -1,5 +1,5 @@
1
- import * as validatorJS from 'validator';
2
- import { validator } from '../../core/index.js';
1
+ import validatorJS from '@browsery/validator';
2
+ import { validator, } from '../../core/index.js';
3
3
  /**
4
4
  * Validates if value is a ETH (Ethereum) address.
5
5
  * @validator isETHAddress
@@ -1,5 +1,5 @@
1
- import * as validatorJS from 'validator';
2
- import { validator } from '../../core/index.js';
1
+ import validatorJS from '@browsery/validator';
2
+ import { validator, } from '../../core/index.js';
3
3
  /**
4
4
  * Validates if value is an FQDN
5
5
  * @validator isFQDN
@@ -1,5 +1,5 @@
1
- import * as validatorJS from 'validator';
2
- import { validator } from '../../core/index.js';
1
+ import validatorJS from '@browsery/validator';
2
+ import { validator, } from '../../core/index.js';
3
3
  /**
4
4
  * Validates if value a hash of type algorithm
5
5
  * @validator isHash
@@ -1,5 +1,5 @@
1
- import * as validatorJS from 'validator';
2
- import { validator } from '../../core/index.js';
1
+ import validatorJS from '@browsery/validator';
2
+ import { validator, } from '../../core/index.js';
3
3
  /**
4
4
  * Validates if value is a Hex Color
5
5
  * @validator isHexColor
@@ -1,5 +1,5 @@
1
- import * as validatorJS from 'validator';
2
- import { validator } from '../../core/index.js';
1
+ import validatorJS from '@browsery/validator';
2
+ import { validator, } from '../../core/index.js';
3
3
  /**
4
4
  * Check if the string is a hexadecimal number.
5
5
  * @validator isHex
@@ -1,5 +1,5 @@
1
- import * as validatorJS from 'validator';
2
- import { validator } from '../../core/index.js';
1
+ import validatorJS from '@browsery/validator';
2
+ import { validator, } from '../../core/index.js';
3
3
  /**
4
4
  * Validates if value is an IBAN (International Bank Account Number)
5
5
  * @validator isIBAN
@@ -1,5 +1,5 @@
1
- import * as validatorJS from 'validator';
2
- import { validator } from '../../core/index.js';
1
+ import validatorJS from '@browsery/validator';
2
+ import { validator, } from '../../core/index.js';
3
3
  /**
4
4
  * Validates if value is an IP
5
5
  * @validator isIP
@@ -1,5 +1,5 @@
1
- import * as validatorJS from 'validator';
2
- import { validator } from '../../core/index.js';
1
+ import validatorJS from '@browsery/validator';
2
+ import { validator, } from '../../core/index.js';
3
3
  /**
4
4
  * Validates if value is an ISSN
5
5
  * @validator isISSN
@@ -1,5 +1,5 @@
1
- import * as validatorJS from 'validator';
2
- import { validator } from '../../core/index.js';
1
+ import validatorJS from '@browsery/validator';
2
+ import { validator, } from '../../core/index.js';
3
3
  /**
4
4
  * Validates if value a valid JWT token
5
5
  * @validator isJWT
@@ -1,5 +1,5 @@
1
- import * as validatorJS from 'validator';
2
- import { validator } from '../../core/index.js';
1
+ import validatorJS from '@browsery/validator';
2
+ import { validator, } from '../../core/index.js';
3
3
  /**
4
4
  * Validates if value a Lowercase string
5
5
  * @validator isLowercase
@@ -1,5 +1,5 @@
1
- import * as validatorJS from 'validator';
2
- import { validator } from '../../core/index.js';
1
+ import validatorJS from '@browsery/validator';
2
+ import { validator, } from '../../core/index.js';
3
3
  /**
4
4
  * Validates if value is an MACAddress
5
5
  * @validator isMACAddress
@@ -1,5 +1,5 @@
1
- import * as validatorJS from 'validator';
2
- import { validator } from '../../core/index.js';
1
+ import validatorJS from '@browsery/validator';
2
+ import { validator, } from '../../core/index.js';
3
3
  /**
4
4
  * Validates if value is a valid Email
5
5
  * @validator isMobilePhone
@@ -1,4 +1,4 @@
1
- import validatorJS from 'validator';
1
+ import validatorJS from '@browsery/validator';
2
2
  import { validator, } from '../../core/index.js';
3
3
  /**
4
4
  * Validates if value is an "ObjectId".
@@ -1,5 +1,5 @@
1
- import * as validatorJS from 'validator';
2
- import { validator } from '../../core/index.js';
1
+ import validatorJS from '@browsery/validator';
2
+ import { validator, } from '../../core/index.js';
3
3
  /**
4
4
  * Validates if value is a passport number
5
5
  * @validator isPassportNumber
@@ -1,15 +1,17 @@
1
- import * as validatorJS from 'validator';
2
- import { validator } from '../../core/index.js';
1
+ import validatorJS from '@browsery/validator';
2
+ import { validator, } from '../../core/index.js';
3
3
  /**
4
4
  * Validates if value is a port number
5
5
  * @validator isPort
6
6
  */
7
7
  export function isPort(options) {
8
8
  return validator('isPort', (input, context, _this) => {
9
+ if (typeof input === 'number')
10
+ input = String(input);
9
11
  if (input != null &&
10
12
  typeof input === 'string' &&
11
13
  validatorJS.isPort(input)) {
12
- return input;
14
+ return parseInt(input, 10);
13
15
  }
14
16
  context.fail(_this, `{{label}} is not a valid port number`, input);
15
17
  }, options);
@@ -1,5 +1,5 @@
1
- import * as validatorJS from 'validator';
2
- import { validator } from '../../core/index.js';
1
+ import validatorJS from '@browsery/validator';
2
+ import { validator, } from '../../core/index.js';
3
3
  /**
4
4
  * Validates if value is an URL
5
5
  * @validator isURL
@@ -1,5 +1,5 @@
1
- import * as validatorJS from 'validator';
2
- import { validator } from '../../core/index.js';
1
+ import validatorJS from '@browsery/validator';
2
+ import { validator, } from '../../core/index.js';
3
3
  /**
4
4
  * Validates if value is an "UUID".
5
5
  * @validator isUUID
@@ -1,5 +1,5 @@
1
- import * as validatorJS from 'validator';
2
- import { validator } from '../../core/index.js';
1
+ import validatorJS from '@browsery/validator';
2
+ import { validator, } from '../../core/index.js';
3
3
  /**
4
4
  * Validates if value is an VAT number
5
5
  * @validator isVAT
@@ -1,4 +1,4 @@
1
- import { validator } from '../../core/index.js';
1
+ import { validator, } from '../../core/index.js';
2
2
  /**
3
3
  * Validates if value is not "undefined" nor "null"
4
4
  * @validator isDefined
@@ -1,4 +1,4 @@
1
- import { validator } from '../../core/index.js';
1
+ import { validator, } from '../../core/index.js';
2
2
  /**
3
3
  * Checks if value is an empty. Value should be string, array, set, map or object
4
4
  * @validator isEmpty
@@ -1,4 +1,4 @@
1
- import { validator } from '../../core/index.js';
1
+ import { validator, } from '../../core/index.js';
2
2
  /**
3
3
  * Validates if value is "BigInt".
4
4
  * Converts input value to number if coerce option is set to 'true'.
@@ -1,5 +1,5 @@
1
1
  import { formatISO, parseISO } from 'date-fns';
2
- import { validator } from '../../core/index.js';
2
+ import { validator, } from '../../core/index.js';
3
3
  /* eslint-disable-next-line max-len */ // noinspection RegExpUnnecessaryNonCapturingGroup
4
4
  const DATE_PATTERN =
5
5
  // eslint-disable-next-line max-len
@@ -1,4 +1,4 @@
1
- import { validator } from '../../core/index.js';
1
+ import { validator, } from '../../core/index.js';
2
2
  /**
3
3
  * Validates if value is "null".
4
4
  * @validator isNull
@@ -1,4 +1,4 @@
1
- import { validator } from '../../core/index.js';
1
+ import { validator, } from '../../core/index.js';
2
2
  /**
3
3
  * Validates if value is "number".
4
4
  * Converts input value to number if coerce option is set to 'true'.
@@ -1,4 +1,4 @@
1
- import { validator } from '../../core/index.js';
1
+ import { validator, } from '../../core/index.js';
2
2
  /**
3
3
  * Validates if property exists
4
4
  * @validator exists
@@ -1,4 +1,4 @@
1
- import { validator } from '../../core/index.js';
1
+ import { validator, } from '../../core/index.js';
2
2
  /**
3
3
  *
4
4
  */
@@ -0,0 +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"}
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "valgen",
3
3
  "description": "Fast runtime type validator, converter and io (encoding/decoding) library",
4
- "version": "5.9.0",
4
+ "version": "5.12.0",
5
5
  "author": "Panates",
6
6
  "license": "MIT",
7
7
  "dependencies": {
8
- "date-fns": "^3.6.0",
9
- "ts-gems": "^3.5.0",
10
- "validator": "^13.12.0",
11
- "tslib": "^2.6.3"
8
+ "@browsery/validator": "^13.12.0-r1",
9
+ "date-fns": "^4.1.0",
10
+ "ts-gems": "^3.6.0",
11
+ "tslib": "^2.8.1"
12
12
  },
13
13
  "type": "module",
14
14
  "exports": {
@@ -1,4 +1,5 @@
1
- import { Context, Validator } from './index.js';
1
+ import type { Context } from './context.js';
2
+ import { type Validator } from './validator.js';
2
3
  /**
3
4
  * Forwards codec process to a sub codec. Useful for circular checks
4
5
  * @validator forwardRef
@@ -1,4 +1,4 @@
1
- import { ErrorIssue } from './types.js';
1
+ import { type ErrorIssue } from './types.js';
2
2
  export declare class ValidationError extends Error {
3
3
  issues: ErrorIssue[];
4
4
  constructor(issues: ErrorIssue[]);
@@ -1,7 +1,7 @@
1
- import { Nullish } from 'ts-gems';
1
+ import type { Nullish } from 'ts-gems';
2
2
  import { kValidatorFn } from './constants.js';
3
3
  import { Context } from './context.js';
4
- import { ErrorIssue, ExecutionOptions, ValidationOptions } from './types.js';
4
+ import type { ErrorIssue, ExecutionOptions, ValidationOptions } from './types.js';
5
5
  export type ValidateFunction<T, I = T, R extends Validator<T, I> = Validator<T, I>> = (input: I, context: Context, _this: R) => Nullish<T>;
6
6
  export interface Validator<T = any, I = any, O extends ExecutionOptions = ExecutionOptions> {
7
7
  (input: I, options?: O, context?: Context): T;
package/types/index.d.cts CHANGED
@@ -32,7 +32,7 @@ declare const isMobilePhone: import("./core/validator.js").Validator<string, str
32
32
  declare const isIP: import("./core/validator.js").Validator<string, string, import("./core/types.js").ExecutionOptions>;
33
33
  declare const isIPRange: import("./core/validator.js").Validator<string, string, import("./core/types.js").ExecutionOptions>;
34
34
  declare const isMACAddress: import("./core/validator.js").Validator<string, string, import("./core/types.js").ExecutionOptions>;
35
- declare const isPort: import("./core/validator.js").Validator<string, string, import("./core/types.js").ExecutionOptions>;
35
+ declare const isPort: import("./core/validator.js").Validator<number, string | number, import("./core/types.js").ExecutionOptions>;
36
36
  declare const isURL: import("./core/validator.js").Validator<string, string, import("./core/types.js").ExecutionOptions>;
37
37
  declare const isBase64: import("./core/validator.js").Validator<string, string, import("./core/types.js").ExecutionOptions>;
38
38
  declare const isSWIFT: import("./core/validator.js").Validator<string, string, import("./core/types.js").ExecutionOptions>;
package/types/index.d.ts CHANGED
@@ -32,7 +32,7 @@ declare const isMobilePhone: import("./core/validator.js").Validator<string, str
32
32
  declare const isIP: import("./core/validator.js").Validator<string, string, import("./core/types.js").ExecutionOptions>;
33
33
  declare const isIPRange: import("./core/validator.js").Validator<string, string, import("./core/types.js").ExecutionOptions>;
34
34
  declare const isMACAddress: import("./core/validator.js").Validator<string, string, import("./core/types.js").ExecutionOptions>;
35
- declare const isPort: import("./core/validator.js").Validator<string, string, import("./core/types.js").ExecutionOptions>;
35
+ declare const isPort: import("./core/validator.js").Validator<number, string | number, import("./core/types.js").ExecutionOptions>;
36
36
  declare const isURL: import("./core/validator.js").Validator<string, string, import("./core/types.js").ExecutionOptions>;
37
37
  declare const isBase64: import("./core/validator.js").Validator<string, string, import("./core/types.js").ExecutionOptions>;
38
38
  declare const isSWIFT: import("./core/validator.js").Validator<string, string, import("./core/types.js").ExecutionOptions>;
@@ -1,4 +1,4 @@
1
- import { ValidationOptions } from '../../core/index.js';
1
+ import { type ValidationOptions } from '../../core/index.js';
2
2
  /**
3
3
  * Check if the string contains only letters (a-zA-Z).
4
4
  * @validator isAlpha
@@ -1,4 +1,4 @@
1
- import { ValidationOptions } from '../../core/index.js';
1
+ import { type ValidationOptions } from '../../core/index.js';
2
2
  /**
3
3
  * Check if the string contains ASCII chars only.
4
4
  * @validator isAscii
@@ -1,5 +1,5 @@
1
- import * as validatorJS from 'validator';
2
- import { ValidationOptions } from '../../core/index.js';
1
+ import validatorJS from '@browsery/validator';
2
+ import { type ValidationOptions } from '../../core/index.js';
3
3
  export interface Base64ValidatorOptions extends ValidationOptions, validatorJS.IsBase64Options {
4
4
  }
5
5
  /**
@@ -1,4 +1,4 @@
1
- import { ValidationOptions } from '../../core/index.js';
1
+ import { type ValidationOptions } from '../../core/index.js';
2
2
  /**
3
3
  * Validates if value is a BTC address.
4
4
  * @validator isBtcAddress
@@ -1,5 +1,5 @@
1
- import * as validatorJS from 'validator';
2
- import { ValidationOptions } from '../../core/index.js';
1
+ import validatorJS from '@browsery/validator';
2
+ import { type ValidationOptions } from '../../core/index.js';
3
3
  export interface CreditCardValidatorOptions extends ValidationOptions, validatorJS.IsCreditCardOptions {
4
4
  }
5
5
  /**
@@ -1,4 +1,4 @@
1
- import { ValidationOptions } from '../../core/index.js';
1
+ import { type ValidationOptions } from '../../core/index.js';
2
2
  /**
3
3
  * Check if the string represents a decimal number,
4
4
  * such as `0.1`, `.3`, `1.1`, `1.00003`, `4.0` etc.
@@ -1,4 +1,4 @@
1
- import { ValidationOptions } from '../../core/index.js';
1
+ import { type ValidationOptions } from '../../core/index.js';
2
2
  /**
3
3
  * Validates if value is an EAN (European Article Number)
4
4
  * @validator isEAN
@@ -1,4 +1,4 @@
1
- import { ValidationOptions } from '../../core/index.js';
1
+ import { type ValidationOptions } from '../../core/index.js';
2
2
  export interface IsEmailOptions extends ValidationOptions {
3
3
  /**
4
4
  * If set to `true`, the validator will also match `Display Name <email-address>`.
@@ -1,4 +1,4 @@
1
- import { ValidationOptions } from '../../core/index.js';
1
+ import { type ValidationOptions } from '../../core/index.js';
2
2
  /**
3
3
  * Validates if value is a ETH (Ethereum) address.
4
4
  * @validator isETHAddress
@@ -1,4 +1,4 @@
1
- import { ValidationOptions } from '../../core/index.js';
1
+ import { type ValidationOptions } from '../../core/index.js';
2
2
  export interface IsFQDNOptions extends ValidationOptions {
3
3
  /**
4
4
  * If set to true, the validator will allow domain starting with `*.` (e.g. `*.example.com` or `*.shop.example.com`).
@@ -1,5 +1,5 @@
1
- import * as validatorJS from 'validator';
2
- import { ValidationOptions } from '../../core/index.js';
1
+ import validatorJS from '@browsery/validator';
2
+ import { type ValidationOptions } from '../../core/index.js';
3
3
  export type HashAlgorithm = validatorJS.HashAlgorithm;
4
4
  /**
5
5
  * Validates if value a hash of type algorithm
@@ -1,4 +1,4 @@
1
- import { ValidationOptions } from '../../core/index.js';
1
+ import { type ValidationOptions } from '../../core/index.js';
2
2
  /**
3
3
  * Validates if value is a Hex Color
4
4
  * @validator isHexColor
@@ -1,4 +1,4 @@
1
- import { ValidationOptions } from '../../core/index.js';
1
+ import { type ValidationOptions } from '../../core/index.js';
2
2
  /**
3
3
  * Check if the string is a hexadecimal number.
4
4
  * @validator isHex
@@ -1,4 +1,4 @@
1
- import { ValidationOptions } from '../../core/index.js';
1
+ import { type ValidationOptions } from '../../core/index.js';
2
2
  /**
3
3
  * Validates if value is an IBAN (International Bank Account Number)
4
4
  * @validator isIBAN
@@ -1,4 +1,4 @@
1
- import { ValidationOptions } from '../../core/index.js';
1
+ import { type ValidationOptions } from '../../core/index.js';
2
2
  /**
3
3
  * Validates if value is an IP
4
4
  * @validator isIP
@@ -1,4 +1,4 @@
1
- import { ValidationOptions } from '../../core/index.js';
1
+ import { type ValidationOptions } from '../../core/index.js';
2
2
  export interface IsISSNOptions extends ValidationOptions {
3
3
  /**
4
4
  * If set to `true`, ISSNs with a lowercase `x` as the check digit are rejected.
@@ -1,4 +1,4 @@
1
- import { ValidationOptions } from '../../core/index.js';
1
+ import { type ValidationOptions } from '../../core/index.js';
2
2
  /**
3
3
  * Validates if value a valid JWT token
4
4
  * @validator isJWT
@@ -1,4 +1,4 @@
1
- import { ValidationOptions } from '../../core/index.js';
1
+ import { type ValidationOptions } from '../../core/index.js';
2
2
  /**
3
3
  * Validates if value a Lowercase string
4
4
  * @validator isLowercase
@@ -1,4 +1,4 @@
1
- import { ValidationOptions } from '../../core/index.js';
1
+ import { type ValidationOptions } from '../../core/index.js';
2
2
  export interface IsMACAddressOptions extends ValidationOptions {
3
3
  /**
4
4
  * If set to `true`, the validator will allow MAC addresses without the colons.
@@ -1,5 +1,5 @@
1
- import * as validatorJS from 'validator';
2
- import { ValidationOptions } from '../../core/index.js';
1
+ import validatorJS from '@browsery/validator';
2
+ import { type ValidationOptions } from '../../core/index.js';
3
3
  export interface IsMobilePhoneOptions extends ValidationOptions {
4
4
  /**
5
5
  * If this is set to `true`, the mobile phone number must be supplied with the country code and therefore must start with `+`.
@@ -1,4 +1,4 @@
1
- import { ValidationOptions } from '../../core/index.js';
1
+ import { type ValidationOptions } from '../../core/index.js';
2
2
  export declare interface ObjectIdLike {
3
3
  id: string | Uint8Array;
4
4
  toHexString(): string;
@@ -1,4 +1,4 @@
1
- import { ValidationOptions } from '../../core/index.js';
1
+ import { type ValidationOptions } from '../../core/index.js';
2
2
  /**
3
3
  * Validates if value is a passport number
4
4
  * @validator isPassportNumber
@@ -1,6 +1,6 @@
1
- import { ValidationOptions } from '../../core/index.js';
1
+ import { type ValidationOptions } from '../../core/index.js';
2
2
  /**
3
3
  * Validates if value is a port number
4
4
  * @validator isPort
5
5
  */
6
- export declare function isPort(options?: ValidationOptions): import("../../core/validator.js").Validator<string, string, import("../../core/types.js").ExecutionOptions>;
6
+ export declare function isPort(options?: ValidationOptions): import("../../core/validator.js").Validator<number, string | number, import("../../core/types.js").ExecutionOptions>;
@@ -1,5 +1,5 @@
1
- import * as validatorJS from 'validator';
2
- import { ValidationOptions } from '../../core/index.js';
1
+ import validatorJS from '@browsery/validator';
2
+ import { type ValidationOptions } from '../../core/index.js';
3
3
  export interface IsURLOptions extends ValidationOptions, validatorJS.IsURLOptions {
4
4
  }
5
5
  /**