valgen 5.18.2 → 5.19.1

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 (208) hide show
  1. package/{types/constants.d.ts → constants.d.ts} +1 -0
  2. package/{esm/constants.js → constants.js} +1 -0
  3. package/{esm/core → core}/context.js +12 -2
  4. package/{esm/core → core}/validation-error.js +1 -1
  5. package/{types/index.d.ts → index.d.ts} +63 -59
  6. package/{esm/index.js → index.js} +10 -1
  7. package/package.json +9 -25
  8. package/{types/rules → rules}/type-rules/is-date.d.ts +6 -6
  9. package/{esm/rules → rules}/type-rules/is-date.js +21 -10
  10. package/CHANGELOG.md +0 -384
  11. package/cjs/constants.js +0 -7
  12. package/cjs/core/constants.js +0 -5
  13. package/cjs/core/context.js +0 -74
  14. package/cjs/core/index.js +0 -9
  15. package/cjs/core/types.js +0 -2
  16. package/cjs/core/utilities.js +0 -30
  17. package/cjs/core/validation-error.js +0 -12
  18. package/cjs/core/validator.js +0 -71
  19. package/cjs/factories.js +0 -4
  20. package/cjs/helpers/object.utils.js +0 -18
  21. package/cjs/helpers/omit-undefined.js +0 -14
  22. package/cjs/helpers/string.utils.js +0 -6
  23. package/cjs/index.js +0 -129
  24. package/cjs/package.json +0 -3
  25. package/cjs/rules/format-rules/is-alpha.js +0 -30
  26. package/cjs/rules/format-rules/is-ascii.js +0 -17
  27. package/cjs/rules/format-rules/is-base64.js +0 -18
  28. package/cjs/rules/format-rules/is-btc-address.js +0 -18
  29. package/cjs/rules/format-rules/is-credit-card.js +0 -19
  30. package/cjs/rules/format-rules/is-decimal.js +0 -19
  31. package/cjs/rules/format-rules/is-ean.js +0 -17
  32. package/cjs/rules/format-rules/is-email.js +0 -66
  33. package/cjs/rules/format-rules/is-eth-address.js +0 -18
  34. package/cjs/rules/format-rules/is-fqdn.js +0 -21
  35. package/cjs/rules/format-rules/is-hash.js +0 -18
  36. package/cjs/rules/format-rules/is-hex-color.js +0 -18
  37. package/cjs/rules/format-rules/is-hex.js +0 -18
  38. package/cjs/rules/format-rules/is-iban.js +0 -29
  39. package/cjs/rules/format-rules/is-ip.js +0 -35
  40. package/cjs/rules/format-rules/is-issn.js +0 -21
  41. package/cjs/rules/format-rules/is-jwt.js +0 -17
  42. package/cjs/rules/format-rules/is-lowercase.js +0 -31
  43. package/cjs/rules/format-rules/is-mac-address.js +0 -24
  44. package/cjs/rules/format-rules/is-mobile-phone.js +0 -22
  45. package/cjs/rules/format-rules/is-object-id.js +0 -28
  46. package/cjs/rules/format-rules/is-passport-number.js +0 -19
  47. package/cjs/rules/format-rules/is-port.js +0 -22
  48. package/cjs/rules/format-rules/is-time.js +0 -51
  49. package/cjs/rules/format-rules/is-url.js +0 -20
  50. package/cjs/rules/format-rules/is-uuid.js +0 -20
  51. package/cjs/rules/format-rules/is-vat-number.js +0 -18
  52. package/cjs/rules/format-rules/matches.js +0 -22
  53. package/cjs/rules/index.js +0 -56
  54. package/cjs/rules/logical-rules/is-defined.js +0 -15
  55. package/cjs/rules/logical-rules/is-empty.js +0 -110
  56. package/cjs/rules/logical-rules/is-equal.js +0 -32
  57. package/cjs/rules/logical-rules/range.js +0 -175
  58. package/cjs/rules/type-rules/is-any.js +0 -10
  59. package/cjs/rules/type-rules/is-array.js +0 -45
  60. package/cjs/rules/type-rules/is-bigint.js +0 -21
  61. package/cjs/rules/type-rules/is-boolean.js +0 -31
  62. package/cjs/rules/type-rules/is-date.js +0 -180
  63. package/cjs/rules/type-rules/is-enum.js +0 -31
  64. package/cjs/rules/type-rules/is-integer.js +0 -30
  65. package/cjs/rules/type-rules/is-null.js +0 -54
  66. package/cjs/rules/type-rules/is-number.js +0 -27
  67. package/cjs/rules/type-rules/is-object.js +0 -113
  68. package/cjs/rules/type-rules/is-record.js +0 -42
  69. package/cjs/rules/type-rules/is-string.js +0 -81
  70. package/cjs/rules/type-rules/is-tuple.js +0 -38
  71. package/cjs/rules/type-rules/is-undefined.js +0 -17
  72. package/cjs/rules/utility-rules/all-of.js +0 -20
  73. package/cjs/rules/utility-rules/exists.js +0 -18
  74. package/cjs/rules/utility-rules/get-length.js +0 -29
  75. package/cjs/rules/utility-rules/one-of.js +0 -59
  76. package/cjs/rules/utility-rules/optional.js +0 -15
  77. package/cjs/rules/utility-rules/pipe.js +0 -28
  78. package/cjs/rules/utility-rules/required.js +0 -19
  79. package/cjs/tsconfig-build-cjs.tsbuildinfo +0 -1
  80. package/esm/package.json +0 -3
  81. package/esm/tsconfig-build-esm.tsbuildinfo +0 -1
  82. package/types/index.d.cts +0 -65
  83. /package/{types/core → core}/constants.d.ts +0 -0
  84. /package/{esm/core → core}/constants.js +0 -0
  85. /package/{types/core → core}/context.d.ts +0 -0
  86. /package/{types/core → core}/index.d.ts +0 -0
  87. /package/{esm/core → core}/index.js +0 -0
  88. /package/{types/core → core}/types.d.ts +0 -0
  89. /package/{esm/core → core}/types.js +0 -0
  90. /package/{types/core → core}/utilities.d.ts +0 -0
  91. /package/{esm/core → core}/utilities.js +0 -0
  92. /package/{types/core → core}/validation-error.d.ts +0 -0
  93. /package/{types/core → core}/validator.d.ts +0 -0
  94. /package/{esm/core → core}/validator.js +0 -0
  95. /package/{types/factories.d.ts → factories.d.ts} +0 -0
  96. /package/{esm/factories.js → factories.js} +0 -0
  97. /package/{types/helpers → helpers}/object.utils.d.ts +0 -0
  98. /package/{esm/helpers → helpers}/object.utils.js +0 -0
  99. /package/{types/helpers → helpers}/omit-undefined.d.ts +0 -0
  100. /package/{esm/helpers → helpers}/omit-undefined.js +0 -0
  101. /package/{types/helpers → helpers}/string.utils.d.ts +0 -0
  102. /package/{esm/helpers → helpers}/string.utils.js +0 -0
  103. /package/{types/rules → rules}/format-rules/is-alpha.d.ts +0 -0
  104. /package/{esm/rules → rules}/format-rules/is-alpha.js +0 -0
  105. /package/{types/rules → rules}/format-rules/is-ascii.d.ts +0 -0
  106. /package/{esm/rules → rules}/format-rules/is-ascii.js +0 -0
  107. /package/{types/rules → rules}/format-rules/is-base64.d.ts +0 -0
  108. /package/{esm/rules → rules}/format-rules/is-base64.js +0 -0
  109. /package/{types/rules → rules}/format-rules/is-btc-address.d.ts +0 -0
  110. /package/{esm/rules → rules}/format-rules/is-btc-address.js +0 -0
  111. /package/{types/rules → rules}/format-rules/is-credit-card.d.ts +0 -0
  112. /package/{esm/rules → rules}/format-rules/is-credit-card.js +0 -0
  113. /package/{types/rules → rules}/format-rules/is-decimal.d.ts +0 -0
  114. /package/{esm/rules → rules}/format-rules/is-decimal.js +0 -0
  115. /package/{types/rules → rules}/format-rules/is-ean.d.ts +0 -0
  116. /package/{esm/rules → rules}/format-rules/is-ean.js +0 -0
  117. /package/{types/rules → rules}/format-rules/is-email.d.ts +0 -0
  118. /package/{esm/rules → rules}/format-rules/is-email.js +0 -0
  119. /package/{types/rules → rules}/format-rules/is-eth-address.d.ts +0 -0
  120. /package/{esm/rules → rules}/format-rules/is-eth-address.js +0 -0
  121. /package/{types/rules → rules}/format-rules/is-fqdn.d.ts +0 -0
  122. /package/{esm/rules → rules}/format-rules/is-fqdn.js +0 -0
  123. /package/{types/rules → rules}/format-rules/is-hash.d.ts +0 -0
  124. /package/{esm/rules → rules}/format-rules/is-hash.js +0 -0
  125. /package/{types/rules → rules}/format-rules/is-hex-color.d.ts +0 -0
  126. /package/{esm/rules → rules}/format-rules/is-hex-color.js +0 -0
  127. /package/{types/rules → rules}/format-rules/is-hex.d.ts +0 -0
  128. /package/{esm/rules → rules}/format-rules/is-hex.js +0 -0
  129. /package/{types/rules → rules}/format-rules/is-iban.d.ts +0 -0
  130. /package/{esm/rules → rules}/format-rules/is-iban.js +0 -0
  131. /package/{types/rules → rules}/format-rules/is-ip.d.ts +0 -0
  132. /package/{esm/rules → rules}/format-rules/is-ip.js +0 -0
  133. /package/{types/rules → rules}/format-rules/is-issn.d.ts +0 -0
  134. /package/{esm/rules → rules}/format-rules/is-issn.js +0 -0
  135. /package/{types/rules → rules}/format-rules/is-jwt.d.ts +0 -0
  136. /package/{esm/rules → rules}/format-rules/is-jwt.js +0 -0
  137. /package/{types/rules → rules}/format-rules/is-lowercase.d.ts +0 -0
  138. /package/{esm/rules → rules}/format-rules/is-lowercase.js +0 -0
  139. /package/{types/rules → rules}/format-rules/is-mac-address.d.ts +0 -0
  140. /package/{esm/rules → rules}/format-rules/is-mac-address.js +0 -0
  141. /package/{types/rules → rules}/format-rules/is-mobile-phone.d.ts +0 -0
  142. /package/{esm/rules → rules}/format-rules/is-mobile-phone.js +0 -0
  143. /package/{types/rules → rules}/format-rules/is-object-id.d.ts +0 -0
  144. /package/{esm/rules → rules}/format-rules/is-object-id.js +0 -0
  145. /package/{types/rules → rules}/format-rules/is-passport-number.d.ts +0 -0
  146. /package/{esm/rules → rules}/format-rules/is-passport-number.js +0 -0
  147. /package/{types/rules → rules}/format-rules/is-port.d.ts +0 -0
  148. /package/{esm/rules → rules}/format-rules/is-port.js +0 -0
  149. /package/{types/rules → rules}/format-rules/is-time.d.ts +0 -0
  150. /package/{esm/rules → rules}/format-rules/is-time.js +0 -0
  151. /package/{types/rules → rules}/format-rules/is-url.d.ts +0 -0
  152. /package/{esm/rules → rules}/format-rules/is-url.js +0 -0
  153. /package/{types/rules → rules}/format-rules/is-uuid.d.ts +0 -0
  154. /package/{esm/rules → rules}/format-rules/is-uuid.js +0 -0
  155. /package/{types/rules → rules}/format-rules/is-vat-number.d.ts +0 -0
  156. /package/{esm/rules → rules}/format-rules/is-vat-number.js +0 -0
  157. /package/{types/rules → rules}/format-rules/matches.d.ts +0 -0
  158. /package/{esm/rules → rules}/format-rules/matches.js +0 -0
  159. /package/{types/rules → rules}/index.d.ts +0 -0
  160. /package/{esm/rules → rules}/index.js +0 -0
  161. /package/{types/rules → rules}/logical-rules/is-defined.d.ts +0 -0
  162. /package/{esm/rules → rules}/logical-rules/is-defined.js +0 -0
  163. /package/{types/rules → rules}/logical-rules/is-empty.d.ts +0 -0
  164. /package/{esm/rules → rules}/logical-rules/is-empty.js +0 -0
  165. /package/{types/rules → rules}/logical-rules/is-equal.d.ts +0 -0
  166. /package/{esm/rules → rules}/logical-rules/is-equal.js +0 -0
  167. /package/{types/rules → rules}/logical-rules/range.d.ts +0 -0
  168. /package/{esm/rules → rules}/logical-rules/range.js +0 -0
  169. /package/{types/rules → rules}/type-rules/is-any.d.ts +0 -0
  170. /package/{esm/rules → rules}/type-rules/is-any.js +0 -0
  171. /package/{types/rules → rules}/type-rules/is-array.d.ts +0 -0
  172. /package/{esm/rules → rules}/type-rules/is-array.js +0 -0
  173. /package/{types/rules → rules}/type-rules/is-bigint.d.ts +0 -0
  174. /package/{esm/rules → rules}/type-rules/is-bigint.js +0 -0
  175. /package/{types/rules → rules}/type-rules/is-boolean.d.ts +0 -0
  176. /package/{esm/rules → rules}/type-rules/is-boolean.js +0 -0
  177. /package/{types/rules → rules}/type-rules/is-enum.d.ts +0 -0
  178. /package/{esm/rules → rules}/type-rules/is-enum.js +0 -0
  179. /package/{types/rules → rules}/type-rules/is-integer.d.ts +0 -0
  180. /package/{esm/rules → rules}/type-rules/is-integer.js +0 -0
  181. /package/{types/rules → rules}/type-rules/is-null.d.ts +0 -0
  182. /package/{esm/rules → rules}/type-rules/is-null.js +0 -0
  183. /package/{types/rules → rules}/type-rules/is-number.d.ts +0 -0
  184. /package/{esm/rules → rules}/type-rules/is-number.js +0 -0
  185. /package/{types/rules → rules}/type-rules/is-object.d.ts +0 -0
  186. /package/{esm/rules → rules}/type-rules/is-object.js +0 -0
  187. /package/{types/rules → rules}/type-rules/is-record.d.ts +0 -0
  188. /package/{esm/rules → rules}/type-rules/is-record.js +0 -0
  189. /package/{types/rules → rules}/type-rules/is-string.d.ts +0 -0
  190. /package/{esm/rules → rules}/type-rules/is-string.js +0 -0
  191. /package/{types/rules → rules}/type-rules/is-tuple.d.ts +0 -0
  192. /package/{esm/rules → rules}/type-rules/is-tuple.js +0 -0
  193. /package/{types/rules → rules}/type-rules/is-undefined.d.ts +0 -0
  194. /package/{esm/rules → rules}/type-rules/is-undefined.js +0 -0
  195. /package/{types/rules → rules}/utility-rules/all-of.d.ts +0 -0
  196. /package/{esm/rules → rules}/utility-rules/all-of.js +0 -0
  197. /package/{types/rules → rules}/utility-rules/exists.d.ts +0 -0
  198. /package/{esm/rules → rules}/utility-rules/exists.js +0 -0
  199. /package/{types/rules → rules}/utility-rules/get-length.d.ts +0 -0
  200. /package/{esm/rules → rules}/utility-rules/get-length.js +0 -0
  201. /package/{types/rules → rules}/utility-rules/one-of.d.ts +0 -0
  202. /package/{esm/rules → rules}/utility-rules/one-of.js +0 -0
  203. /package/{types/rules → rules}/utility-rules/optional.d.ts +0 -0
  204. /package/{esm/rules → rules}/utility-rules/optional.js +0 -0
  205. /package/{types/rules → rules}/utility-rules/pipe.d.ts +0 -0
  206. /package/{esm/rules → rules}/utility-rules/pipe.js +0 -0
  207. /package/{types/rules → rules}/utility-rules/required.d.ts +0 -0
  208. /package/{esm/rules → rules}/utility-rules/required.js +0 -0
package/CHANGELOG.md DELETED
@@ -1,384 +0,0 @@
1
- ## Changelog
2
-
3
- ### [v5.18.2](https://github.com/panates/valgen/compare/v5.18.1...v5.18.2) -
4
-
5
- #### 🛠 Refactoring and Updates
6
-
7
- - refactor: Set precision of toDateString() to "day" @Eray Hanoğlu
8
-
9
- ### [v5.18.1](https://github.com/panates/valgen/compare/v5.18.0...v5.18.1) - 27 August 2025
10
-
11
- #### 🪲 Fixes
12
-
13
- - fix: Increased ms precision @Eray Hanoğlu
14
-
15
- ### [v5.18.0](https://github.com/panates/valgen/compare/v5.17.3...v5.18.0) - 31 July 2025
16
-
17
- #### 🚀 New Features
18
-
19
- - feat: isTime accept Date instance @Eray Hanoğlu
20
-
21
- #### 🪲 Fixes
22
-
23
- - fix: Minor fix in isDate rule @Eray Hanoğlu
24
-
25
- ### [v5.17.3](https://github.com/panates/valgen/compare/v5.17.2...v5.17.3) - 30 July 2025
26
-
27
- #### 🚀 New Features
28
-
29
- - feat: isDate can parse date string without signs @Eray Hanoğlu
30
-
31
- ### [v5.17.2](https://github.com/panates/valgen/compare/v5.17.1...v5.17.2) - 29 July 2025
32
-
33
- #### 🛠 Refactoring and Updates
34
-
35
- - refactor: Minor date rule optimization @Eray Hanoğlu
36
-
37
- ### [v5.17.1](https://github.com/panates/valgen/compare/v5.17.0...v5.17.1) - 24 July 2025
38
-
39
- #### 🪲 Fixes
40
-
41
- - fix: isDate milliseconds padding @Eray Hanoğlu
42
-
43
- ### [v5.17.0](https://github.com/panates/valgen/compare/v5.16.0...v5.17.0) - 24 July 2025
44
-
45
- #### 🪲 Fixes
46
-
47
- - refactor: Refactored isDate and isDateString validation rules @Eray Hanoğlu
48
-
49
- #### 🛠 Refactoring and Updates
50
-
51
- - refactor: Refactored isDate and isDateString validation rules @Eray Hanoğlu
52
-
53
- ### [v5.16.0](https://github.com/panates/valgen/compare/v5.15.4...v5.16.0) - 16 July 2025
54
-
55
- #### 🛠 Refactoring and Updates
56
-
57
- - refactor: Refactored isDate and isDateString validation rules @Eray Hanoğlu
58
-
59
- ### [v5.15.4](https://github.com/panates/valgen/compare/v5.15.3...v5.15.4) - 11 July 2025
60
-
61
- #### 🛠 Refactoring and Updates
62
-
63
- - refactor: Exported default isTime rule @Eray Hanoğlu
64
-
65
- ### [v5.15.3](https://github.com/panates/valgen/compare/v5.15.2...v5.15.3) - 20 June 2025
66
-
67
- #### 🚀 New Features
68
-
69
- - feat: Adde default value option to "required" rule @Eray Hanoğlu
70
-
71
- ### [v5.15.2](https://github.com/panates/valgen/compare/v5.15.1...v5.15.2) - 27 May 2025
72
-
73
- #### 🛠 Refactoring and Updates
74
-
75
- - refactor: Refactored isGte, isGt, isLte, isLt typing @Eray Hanoğlu
76
-
77
- ### [v5.15.1](https://github.com/panates/valgen/compare/v5.15.0...v5.15.1) - 27 May 2025
78
-
79
- #### 🚀 New Features
80
-
81
- - feat: Added isTime rule @Eray Hanoğlu
82
-
83
- #### 🪲 Fixes
84
-
85
- - fix: Error message fix @Eray Hanoğlu
86
-
87
- #### 🛠 Refactoring and Updates
88
-
89
- - refactor: Removed path filter @Eray Hanoğlu
90
-
91
- ### [v5.15.0](https://github.com/panates/valgen/compare/v5.14.1...v5.15.0) - 24 April 2025
92
-
93
- #### 🚀 New Features
94
-
95
- - feat: Added discriminator validation to oneOf rule @Eray Hanoğlu
96
- - feat: Added isEqual, isNotEqual rules @Eray Hanoğlu
97
-
98
- #### 🛠 Refactoring and Updates
99
-
100
- - refactor: Fixes and improvements @Eray Hanoğlu
101
- - refactor: Removed union rule. Use oneOf rule instead @Eray Hanoğlu
102
-
103
- ### [v5.14.1](https://github.com/panates/valgen/compare/v5.14.0...v5.14.1) - 21 April 2025
104
-
105
- #### 🪲 Fixes
106
-
107
- - fix: Fixed validation issue while using silent mode @Eray Hanoğlu
108
-
109
- #### 💬 General Changes
110
-
111
- - dev: Moved from nyc to c8 @Eray Hanoğlu
112
- - ci: Added workflows @Eray Hanoğlu
113
- - dev: Fixed nycrc file @Eray Hanoğlu
114
- - dev: Added publishConfig @Eray Hanoğlu
115
- - dev: Fixed nycrc file @Eray Hanoğlu
116
- - dev: Fixed paths @Eray Hanoğlu
117
- - dev: Fixed nycrc file @Eray Hanoğlu
118
- - dev: Fixed nycrc file @Eray Hanoğlu
119
- - dev: Added qc script @Eray Hanoğlu
120
-
121
- ### [v5.14.0](https://github.com/panates/valgen/compare/v5.13.4...v5.14.0) - 30 March 2025
122
-
123
- #### 🛠 Refactoring and Updates
124
-
125
- - refactor: Moved from jest to mocha @Eray Hanoğlu
126
-
127
- ### [v5.13.4](https://github.com/panates/valgen/compare/v5.13.3...v5.13.4) - 26 March 2025
128
-
129
- #### 🪲 Fixes
130
-
131
- - fix: isNotEmpty do not work for number and boolean types @Eray Hanoğlu
132
-
133
- ### [v5.13.3](https://github.com/panates/valgen/compare/v5.13.2...v5.13.3) - 17 March 2025
134
-
135
- #### 🪲 Fixes
136
-
137
- - fix: isEmpty and isNotEmpty rules adds error issue twice @Eray Hanoğlu
138
-
139
- ### [v5.13.2](https://github.com/panates/valgen/compare/v5.13.1...v5.13.2) - 15 March 2025
140
-
141
- #### 🪲 Fixes
142
-
143
- - fix: Fixed ignoring pipe validators if context.errors has items. @Eray Hanoğlu
144
-
145
- ### [v5.13.1](https://github.com/panates/valgen/compare/v5.13.0...v5.13.1) - 14 March 2025
146
-
147
- #### 🪲 Fixes
148
-
149
- - fix: Fixed validation of Date, Buffer and ArrayBuffer objects of isEmpty and isNotEmpty rules @Eray Hanoğlu
150
- - fix: Fixed validation of Date, Buffer and ArrayBuffer objects of isEmpty and isNotEmpty rules @Eray Hanoğlu
151
-
152
- ### [v5.13.0](https://github.com/panates/valgen/compare/v5.12.0...v5.13.0) - 3 February 2025
153
-
154
- #### 🛠 Refactoring and Updates
155
-
156
- - refactor: Updated dependencies @Eray Hanoğlu
157
- - refactor: Changed error messages to "positive sentences" @Eray Hanoğlu
158
-
159
- #### 💬 General Changes
160
-
161
- - dev: Fixed ts config @Eray Hanoğlu
162
- - dev: Added missing script @Eray Hanoğlu
163
-
164
- ### [v5.12.0](https://github.com/panates/valgen/compare/v5.11.0...v5.12.0) - 4 November 2024
165
-
166
- #### 🛠 Refactoring and Updates
167
-
168
- - refactor: Move from 'validator' library to "@browsery/validator" for ESM compatibility @Eray Hanoğlu
169
-
170
- ### [v5.11.0](https://github.com/panates/valgen/compare/v5.10.0...v5.11.0) - 4 November 2024
171
-
172
- #### 💬 General Changes
173
-
174
- - nit: Updated dependencies @Eray Hanoğlu
175
-
176
- ### [v5.10.0](https://github.com/panates/valgen/compare/v5.9.0...v5.10.0) - 14 September 2024
177
-
178
- #### 💬 General Changes
179
-
180
- - fixed: Circular imports @Eray Hanoğlu
181
-
182
- ### [v5.9.0](https://github.com/panates/valgen/compare/v5.8.2...v5.9.0) - 20 August 2024
183
-
184
- #### 💬 General Changes
185
-
186
- - Fixed compatibility for "Node16" and "NodeNext" moduleResolution options @Eray Hanoğlu
187
-
188
- ### [v5.8.2](https://github.com/panates/valgen/compare/v5.8.1...v5.8.2) - 12 August 2024
189
-
190
- #### 💬 General Changes
191
-
192
- - Applied publint to check package.json @Eray Hanoğlu
193
-
194
- ### [v5.8.1](https://github.com/panates/valgen/compare/v5.8.0...v5.8.1) - 12 August 2024
195
-
196
- #### 💬 General Changes
197
-
198
- - Applied publint to check package.json @Eray Hanoğlu
199
-
200
- ### [v5.8.0](https://github.com/panates/valgen/compare/v5.7.0...v5.8.0) - 12 August 2024
201
-
202
- #### 💬 General Changes
203
-
204
- - Rollback to ES2020 @Eray Hanoğlu
205
-
206
- ### [v5.7.0](https://github.com/panates/valgen/compare/v5.6.0...v5.7.0) - 9 August 2024
207
-
208
- #### 💬 General Changes
209
-
210
- - Made ready for Node16 moduleResolution @Eray Hanoğlu
211
-
212
- ### [v5.6.0](https://github.com/panates/valgen/compare/v5.5.0...v5.6.0) - 14 July 2024
213
-
214
- #### 💬 General Changes
215
-
216
- - Added isNotNull and isNotNullish rules @Eray Hanoğlu
217
- - Added isNotNull and isNotNullish rules @Eray Hanoğlu
218
-
219
- ### [v5.5.0](https://github.com/panates/valgen/compare/v5.4.1...v5.5.0) - 14 July 2024
220
-
221
- #### 💬 General Changes
222
-
223
- - Moved eslint config to @panates/eslint-config @Eray Hanoğlu
224
- - Changed error message @Eray Hanoğlu
225
- - Removed coercing of isNull and isNullish rules @Eray Hanoğlu
226
- - Now pipe can return original input value when returnIndex = -1 @Eray Hanoğlu
227
-
228
- ### [v5.4.1](https://github.com/panates/valgen/compare/v5.4.0...v5.4.1) - 18 May 2024
229
-
230
- #### 💬 General Changes
231
-
232
- - Exposed toBigint @Eray Hanoğlu
233
-
234
- ### [v5.4.0](https://github.com/panates/valgen/compare/v5.3.2...v5.4.0) - 18 May 2024
235
-
236
- #### 💬 General Changes
237
-
238
- - Added returnIndex to pipe() @Eray Hanoğlu
239
- - Updated circleci config @Eray Hanoğlu
240
-
241
- ### [v5.3.2](https://github.com/panates/valgen/compare/v5.3.1...v5.3.2) - 18 May 2024
242
-
243
- #### 💬 General Changes
244
-
245
- - Updated dependencies @Eray Hanoğlu
246
- - Fixed coveralls token @Eray Hanoğlu
247
-
248
- ### [v5.3.1](https://github.com/panates/valgen/compare/v5.3.0...v5.3.1) - 18 May 2024
249
-
250
- #### 💬 General Changes
251
-
252
- - Reorganized many rules @Eray Hanoğlu
253
- - Updated code documentation @Eray Hanoğlu
254
- - Fixed rule name @Eray Hanoğlu
255
-
256
- ### [v5.3.0](https://github.com/panates/valgen/compare/v5.2.2...v5.3.0) - 6 May 2024
257
-
258
- #### 💬 General Changes
259
-
260
- - Added validation generation option to enable coercing by default. @Eray Hanoğlu
261
-
262
- ### [v5.2.2](https://github.com/panates/valgen/compare/v5.2.1...v5.2.2) - 29 March 2024
263
-
264
- #### 💬 General Changes
265
-
266
- - Updated dependencies @Eray Hanoğlu
267
- - Updated dependencies @Eray Hanoğlu
268
-
269
- ### [v5.2.1](https://github.com/panates/valgen/compare/v5.2.0...v5.2.1) - 27 March 2024
270
-
271
- #### 💬 General Changes
272
-
273
- - Updated dependencies @Eray Hanoğlu
274
-
275
- ### [v5.2.0](https://github.com/panates/valgen/compare/v5.1.0...v5.2.0) - 4 January 2024
276
-
277
- #### 💬 General Changes
278
-
279
- - Now validator options persist in context @Eray Hanoğlu
280
-
281
- ### [v5.1.0](https://github.com/panates/valgen/compare/v5.0.1...v5.1.0) - 23 December 2023
282
-
283
- #### 💬 General Changes
284
-
285
- - Moved from "dayjs" to "date-fns" @Eray Hanoğlu
286
-
287
- ### [v5.0.1](https://github.com/panates/valgen/compare/v5.0.0...v5.0.1) - 23 December 2023
288
-
289
- #### 💬 General Changes
290
-
291
- - Added new rules @Eray Hanoğlu
292
- - Moved all validator factories into "factories" namespace, @Eray Hanoğlu
293
-
294
- ## [v5.0.0](https://github.com/panates/valgen/compare/v4.3.2...v5.0.0) - 21 December 2023
295
-
296
- #### 💬 General Changes
297
-
298
- - Moved all validator factories into "factories" namespace, @Eray Hanoğlu
299
-
300
- ### [v4.3.2](https://github.com/panates/valgen/compare/v4.3.1...v4.3.2) - 8 December 2023
301
-
302
- #### 💬 General Changes
303
-
304
- - Updated dependenices @Eray Hanoğlu
305
- - Pass "_this" parameter to preValidation and postValidation methods @Eray Hanoğlu
306
-
307
- ### [v4.3.1](https://github.com/panates/valgen/compare/v4.3.0...v4.3.1) - 4 December 2023
308
-
309
- #### 💬 General Changes
310
-
311
- - Made preValidation and postValidation static @Eray Hanoğlu
312
-
313
- ### [v4.3.0](https://github.com/panates/valgen/compare/v4.2.5...v4.3.0) - 2 December 2023
314
-
315
- #### 💬 General Changes
316
-
317
- - Updated dependencies @Eray Hanoğlu
318
- - Added [preValidation] and [postValidation] to isObject rule @Eray Hanoğlu
319
-
320
- ### [v4.2.5](https://github.com/panates/valgen/compare/v4.2.4...v4.2.5) - 27 November 2023
321
-
322
- #### 💬 General Changes
323
-
324
- - Fixed isArray error location property. @Eray Hanoğlu
325
-
326
- ### [v4.2.4](https://github.com/panates/valgen/compare/v4.2.3...v4.2.4) - 20 November 2023
327
-
328
- #### 💬 General Changes
329
-
330
- - Added json parsing feature to isObject validator @Eray Hanoğlu
331
-
332
- ### [v4.2.3](https://github.com/panates/valgen/compare/v4.2.2...v4.2.3) - 20 November 2023
333
-
334
- #### 💬 General Changes
335
-
336
- - Optimized error messages @Eray Hanoğlu
337
-
338
- ### [v4.2.2](https://github.com/panates/valgen/compare/v4.2.1...v4.2.2) - 15 November 2023
339
-
340
- #### 💬 General Changes
341
-
342
- - Changed "trim" option @Eray Hanoğlu
343
-
344
- ### [v4.2.1](https://github.com/panates/valgen/compare/v4.2.0...v4.2.1) - 15 November 2023
345
-
346
- #### 💬 General Changes
347
-
348
- - Fixed generating invalid date string @Eray Hanoğlu
349
-
350
- ### [v4.2.0](https://github.com/panates/valgen/compare/v4.1.0...v4.2.0) - 15 November 2023
351
-
352
- #### 💬 General Changes
353
-
354
- - Removed "format" option and added "precision" option to isDate validator @Eray Hanoğlu
355
- - Added test for "label" option @Eray Hanoğlu
356
-
357
- ### [v4.1.0](https://github.com/panates/valgen/compare/v4.0.1...v4.1.0) - 31 October 2023
358
-
359
- #### 💬 General Changes
360
-
361
- - Updated validation messages. @Eray Hanoğlu
362
-
363
- ### [v4.0.1](https://github.com/panates/valgen/compare/v4.0.0...v4.0.1) - 24 October 2023
364
-
365
- #### 💬 General Changes
366
-
367
- - Added "coerce" option to isNull and isUndefined rules @Eray Hanoğlu
368
-
369
- ## [v4.0.0](https://github.com/panates/valgen/compare/v3.2.1...v4.0.0) - 17 August 2023
370
-
371
- #### 💬 General Changes
372
-
373
- - Initial release of v4.0.0-alpha.1 @Eray Hanoğlu
374
- - Implemented all initial validators and tests @Eray Hanoğlu
375
- - Updated dependencies @Eray Hanoğlu
376
- - Better error handling @Eray Hanoğlu
377
- - Updated deps @Eray Hanoğlu
378
- - Added isBigint validator @Eray Hanoğlu
379
- - Fixed isObject coerce issue @Eray Hanoğlu
380
- - Improved isDateString @Eray Hanoğlu
381
- - Updated dayjs @Eray Hanoğlu
382
- - Updated deps @Eray Hanoğlu
383
- - Updated deps @Eray Hanoğlu
384
- - Fixed isObject coerce issue @Eray Hanoğlu
package/cjs/constants.js DELETED
@@ -1,7 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.VALIDATE_NESTED_METADATA = exports.VALIDATE_METADATA = exports.preValidation = exports.postValidation = void 0;
4
- exports.postValidation = Symbol('postValidation');
5
- exports.preValidation = Symbol('preValidation');
6
- exports.VALIDATE_METADATA = Symbol('VALIDATE_METADATA');
7
- exports.VALIDATE_NESTED_METADATA = Symbol('VALIDATE_NESTED_METADATA');
@@ -1,5 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.kOptions = exports.kValidatorFn = void 0;
4
- exports.kValidatorFn = Symbol.for('kValidatorFn');
5
- exports.kOptions = Symbol.for('kOptions');
@@ -1,74 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Context = void 0;
4
- const omit_undefined_js_1 = require("../helpers/omit-undefined.js");
5
- const validation_error_js_1 = require("./validation-error.js");
6
- const VARIABLE_REPLACE_PATTERN = /{{([^}]*)}}/g;
7
- const OPTIONAL_VAR_PATTERN = /^([^?]+)(?:\||(.*))?$/;
8
- class Context {
9
- constructor(options) {
10
- this.isRoot = true;
11
- this.errors = [];
12
- Object.assign(this, options);
13
- }
14
- fail(rule, message, value, details) {
15
- const issue = (0, omit_undefined_js_1.omitUndefined)({
16
- message: message instanceof Error ? message.message : String(message),
17
- rule: rule.id,
18
- root: this.root,
19
- location: this.location,
20
- context: this.context,
21
- property: this.property,
22
- index: this.index,
23
- label: this.label,
24
- value,
25
- ...details,
26
- });
27
- issue.value = value;
28
- if (this.onFail) {
29
- const x = this.onFail(issue, this);
30
- if (!x)
31
- return;
32
- if (typeof x === 'object')
33
- Object.assign(issue, x);
34
- else
35
- issue.message = String(x);
36
- }
37
- issue.message = ('' + issue.message).replace(VARIABLE_REPLACE_PATTERN, (x, g) => {
38
- const m = OPTIONAL_VAR_PATTERN.exec(g);
39
- if (!m)
40
- return x;
41
- const k = m[1];
42
- let v = issue[k];
43
- if (k === 'value') {
44
- const s = String(issue.value);
45
- return s.length < 30 ? s : s.substring(0, 30) + '..';
46
- }
47
- if (!v && k === 'label' && (this.location || this.property)) {
48
- v = '`' + (this.location || this.property) + '`';
49
- }
50
- if (v != null)
51
- return v;
52
- if (m[2])
53
- return m[2];
54
- return m[1] === 'label' ? 'Value' : x;
55
- });
56
- this.errors.push(issue);
57
- if (this.errors.length >= (this.maxErrors ?? Infinity)) {
58
- throw new validation_error_js_1.ValidationError(this.errors);
59
- }
60
- }
61
- extend(options) {
62
- const extended = {};
63
- if (options) {
64
- for (const [k, v] of Object.entries(options)) {
65
- if (v !== undefined)
66
- extended[k] = v;
67
- }
68
- }
69
- extended.isRoot = false;
70
- Object.setPrototypeOf(extended, this);
71
- return extended;
72
- }
73
- }
74
- exports.Context = Context;
package/cjs/core/index.js DELETED
@@ -1,9 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- tslib_1.__exportStar(require("./constants.js"), exports);
5
- tslib_1.__exportStar(require("./context.js"), exports);
6
- tslib_1.__exportStar(require("./types.js"), exports);
7
- tslib_1.__exportStar(require("./utilities.js"), exports);
8
- tslib_1.__exportStar(require("./validation-error.js"), exports);
9
- tslib_1.__exportStar(require("./validator.js"), exports);
package/cjs/core/types.js DELETED
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,30 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.forwardRef = forwardRef;
4
- exports.iif = iif;
5
- const validator_js_1 = require("./validator.js");
6
- /**
7
- * Forwards codec process to a sub codec. Useful for circular checks
8
- * @validator forwardRef
9
- */
10
- function forwardRef(fn) {
11
- return (0, validator_js_1.validator)('forwardRef', (input, context) => {
12
- const nested = fn(context);
13
- return nested(input, context);
14
- });
15
- }
16
- function iif(check, _then, _else) {
17
- return (0, validator_js_1.validator)('iif', (input, context) => {
18
- let c = _else;
19
- try {
20
- if (check(input) !== undefined)
21
- c = _then;
22
- }
23
- catch {
24
- // ignored
25
- }
26
- if ((0, validator_js_1.isValidator)(c))
27
- return c(input, context);
28
- return c;
29
- });
30
- }
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ValidationError = void 0;
4
- class ValidationError extends Error {
5
- constructor(issues) {
6
- super(issues[0].message +
7
- (issues[0].location ? `\n at ${issues[0].location}` : ''));
8
- this.issues = [];
9
- this.issues = issues;
10
- }
11
- }
12
- exports.ValidationError = ValidationError;
@@ -1,71 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.validator = validator;
4
- exports.isValidator = isValidator;
5
- const string_utils_js_1 = require("../helpers/string.utils.js");
6
- const constants_js_1 = require("./constants.js");
7
- const context_js_1 = require("./context.js");
8
- const validation_error_js_1 = require("./validation-error.js");
9
- let unnamedValidatorIndex = 0;
10
- function validator(arg0, arg1, arg2) {
11
- let id = '';
12
- let fn;
13
- let validatorOptions;
14
- if (typeof arg0 === 'string') {
15
- id = arg0;
16
- fn = arg1;
17
- validatorOptions = arg2;
18
- }
19
- else {
20
- fn = arg0;
21
- validatorOptions = arg1;
22
- }
23
- if (typeof fn !== 'function') {
24
- throw new TypeError('You must provide a rule function argument');
25
- }
26
- id = id || fn.name || 'validator' + ++unnamedValidatorIndex;
27
- const name = fn.name || (0, string_utils_js_1.camelCase)(id);
28
- const _rule = {
29
- [name](input, options, context) {
30
- if (context) {
31
- if (options || validatorOptions)
32
- context = context.extend({ ...validatorOptions, ...options });
33
- }
34
- else {
35
- context =
36
- options instanceof context_js_1.Context
37
- ? options.extend({ ...validatorOptions })
38
- : new context_js_1.Context({ ...validatorOptions, ...options });
39
- }
40
- let value;
41
- try {
42
- value = fn(input, context, _rule);
43
- }
44
- catch (e) {
45
- if (e instanceof validation_error_js_1.ValidationError)
46
- throw e;
47
- context.fail(_rule, e, input);
48
- }
49
- if (context.isRoot && context.errors.length) {
50
- throw new validation_error_js_1.ValidationError(context.errors);
51
- }
52
- return value;
53
- },
54
- }[name];
55
- _rule.id = id;
56
- _rule[constants_js_1.kValidatorFn] = fn;
57
- _rule[constants_js_1.kOptions] = validatorOptions || {};
58
- _rule.silent = (input, options, context) => {
59
- try {
60
- const value = _rule(input, options, context);
61
- return { value };
62
- }
63
- catch (e) {
64
- return { errors: e.issues };
65
- }
66
- };
67
- return _rule;
68
- }
69
- function isValidator(x) {
70
- return !!(typeof x === 'function' && x.id && x[constants_js_1.kValidatorFn]);
71
- }
package/cjs/factories.js DELETED
@@ -1,4 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- tslib_1.__exportStar(require("./rules/index.js"), exports);
@@ -1,18 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.omitKeys = omitKeys;
4
- exports.pickKeys = pickKeys;
5
- function omitKeys(o, keys) {
6
- return Object.keys(o).reduce((a, k) => {
7
- if (!keys.includes(k))
8
- a[k] = o[k];
9
- return a;
10
- }, {});
11
- }
12
- function pickKeys(o, keys) {
13
- return Object.keys(o).reduce((a, k) => {
14
- if (keys.includes(k))
15
- a[k] = o[k];
16
- return a;
17
- }, {});
18
- }
@@ -1,14 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.omitUndefined = omitUndefined;
4
- function omitUndefined(obj, recursive) {
5
- if (!(obj && typeof obj === 'object'))
6
- return obj;
7
- for (const k of Object.keys(obj)) {
8
- if (obj[k] === undefined)
9
- delete obj[k];
10
- else if (recursive && typeof obj[k] === 'object')
11
- omitUndefined(obj[k]);
12
- }
13
- return obj;
14
- }
@@ -1,6 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.camelCase = camelCase;
4
- function camelCase(v) {
5
- return v.replace(/[\W_\s]+([^\W_\s])/g, (arg$, c) => c[0].toUpperCase());
6
- }