@decaf-ts/decorator-validation 1.11.23 → 1.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 (322) hide show
  1. package/lib/cjs/constants/errors.js.map +1 -0
  2. package/lib/cjs/constants/index.js.map +1 -0
  3. package/lib/cjs/constants/validation.js.map +1 -0
  4. package/lib/{index.cjs → cjs/index.cjs} +1 -1
  5. package/lib/cjs/index.js.map +1 -0
  6. package/lib/cjs/model/Builder.js.map +1 -0
  7. package/lib/cjs/model/Model.js.map +1 -0
  8. package/lib/cjs/model/ModelErrorDefinition.js.map +1 -0
  9. package/lib/cjs/model/ModelRegistry.js.map +1 -0
  10. package/lib/cjs/model/constants.js.map +1 -0
  11. package/lib/cjs/model/construction.js.map +1 -0
  12. package/lib/cjs/model/decorators.js.map +1 -0
  13. package/lib/cjs/model/index.js.map +1 -0
  14. package/lib/{model → cjs/model}/types.js.map +1 -1
  15. package/lib/cjs/model/utils.js.map +1 -0
  16. package/lib/cjs/model/validation.js.map +1 -0
  17. package/lib/cjs/overrides/Metadata.js.map +1 -0
  18. package/lib/cjs/overrides/index.js.map +1 -0
  19. package/lib/cjs/overrides/overrides.js.map +1 -0
  20. package/lib/{overrides → cjs/overrides}/types.js.map +1 -1
  21. package/lib/cjs/types/index.js.map +1 -0
  22. package/lib/{types → cjs/types}/validation.js.map +1 -1
  23. package/lib/cjs/utils/DateBuilder.js.map +1 -0
  24. package/lib/cjs/utils/PathProxy.js.map +1 -0
  25. package/lib/cjs/utils/constants.js.map +1 -0
  26. package/lib/cjs/utils/dates.js.map +1 -0
  27. package/lib/cjs/utils/equality.js.map +1 -0
  28. package/lib/cjs/utils/hashing.js.map +1 -0
  29. package/lib/cjs/utils/index.js.map +1 -0
  30. package/lib/{utils → cjs/utils}/registry.js.map +1 -1
  31. package/lib/cjs/utils/serialization.js.map +1 -0
  32. package/lib/cjs/utils/serializers.js.map +1 -0
  33. package/lib/cjs/utils/strings.js.map +1 -0
  34. package/lib/{utils → cjs/utils}/types.js.map +1 -1
  35. package/lib/cjs/validation/Validation.js.map +1 -0
  36. package/lib/cjs/validation/Validators/AsyncValidator.js.map +1 -0
  37. package/lib/cjs/validation/Validators/BaseValidator.js.map +1 -0
  38. package/lib/cjs/validation/Validators/DateValidator.js.map +1 -0
  39. package/lib/cjs/validation/Validators/DiffValidator.js.map +1 -0
  40. package/lib/cjs/validation/Validators/EmailValidator.js.map +1 -0
  41. package/lib/cjs/validation/Validators/EqualsValidator.js.map +1 -0
  42. package/lib/cjs/validation/Validators/GreaterThanOrEqualValidator.js.map +1 -0
  43. package/lib/cjs/validation/Validators/GreaterThanValidator.js.map +1 -0
  44. package/lib/cjs/validation/Validators/LessThanOrEqualValidator.js.map +1 -0
  45. package/lib/cjs/validation/Validators/LessThanValidator.js.map +1 -0
  46. package/lib/cjs/validation/Validators/ListValidator.js.map +1 -0
  47. package/lib/cjs/validation/Validators/MaxLengthValidator.js.map +1 -0
  48. package/lib/cjs/validation/Validators/MaxValidator.js.map +1 -0
  49. package/lib/cjs/validation/Validators/MinLengthValidator.js.map +1 -0
  50. package/lib/cjs/validation/Validators/MinValidator.js.map +1 -0
  51. package/lib/cjs/validation/Validators/OptionValidator.js.map +1 -0
  52. package/lib/cjs/validation/Validators/PasswordValidator.js.map +1 -0
  53. package/lib/cjs/validation/Validators/PatternValidator.js.map +1 -0
  54. package/lib/cjs/validation/Validators/RequiredValidator.js.map +1 -0
  55. package/lib/cjs/validation/Validators/StepValidator.js.map +1 -0
  56. package/lib/cjs/validation/Validators/TypeValidator.js.map +1 -0
  57. package/lib/cjs/validation/Validators/URLValidator.js.map +1 -0
  58. package/lib/cjs/validation/Validators/Validator.js.map +1 -0
  59. package/lib/cjs/validation/Validators/ValidatorRegistry.js.map +1 -0
  60. package/lib/cjs/validation/Validators/constants.js.map +1 -0
  61. package/lib/cjs/validation/Validators/decorators.js.map +1 -0
  62. package/lib/cjs/validation/Validators/index.js.map +1 -0
  63. package/lib/cjs/validation/Validators/utils.js.map +1 -0
  64. package/lib/cjs/validation/decorators.js.map +1 -0
  65. package/lib/cjs/validation/index.js.map +1 -0
  66. package/lib/cjs/validation/types.js.map +1 -0
  67. package/lib/esm/index.js +1 -1
  68. package/lib/types/index.d.ts +19 -0
  69. package/package.json +12 -5
  70. package/lib/constants/errors.js.map +0 -1
  71. package/lib/constants/index.js.map +0 -1
  72. package/lib/constants/validation.js.map +0 -1
  73. package/lib/esm/constants/errors.d.ts +0 -17
  74. package/lib/esm/constants/index.d.ts +0 -2
  75. package/lib/esm/constants/validation.d.ts +0 -16
  76. package/lib/esm/index.d.ts +0 -20
  77. package/lib/index.d.ts +0 -20
  78. package/lib/index.js.map +0 -1
  79. package/lib/model/Builder.d.ts +0 -86
  80. package/lib/model/Builder.js.map +0 -1
  81. package/lib/model/Model.d.ts +0 -286
  82. package/lib/model/Model.js.map +0 -1
  83. package/lib/model/ModelErrorDefinition.d.ts +0 -22
  84. package/lib/model/ModelErrorDefinition.js.map +0 -1
  85. package/lib/model/ModelRegistry.d.ts +0 -181
  86. package/lib/model/ModelRegistry.js.map +0 -1
  87. package/lib/model/constants.d.ts +0 -65
  88. package/lib/model/constants.js.map +0 -1
  89. package/lib/model/construction.d.ts +0 -46
  90. package/lib/model/construction.js.map +0 -1
  91. package/lib/model/decorators.d.ts +0 -47
  92. package/lib/model/decorators.js.map +0 -1
  93. package/lib/model/index.d.ts +0 -10
  94. package/lib/model/index.js.map +0 -1
  95. package/lib/model/types.d.ts +0 -145
  96. package/lib/model/utils.d.ts +0 -13
  97. package/lib/model/utils.js.map +0 -1
  98. package/lib/model/validation.d.ts +0 -92
  99. package/lib/model/validation.js.map +0 -1
  100. package/lib/overrides/Metadata.d.ts +0 -132
  101. package/lib/overrides/Metadata.js.map +0 -1
  102. package/lib/overrides/index.d.ts +0 -3
  103. package/lib/overrides/index.js.map +0 -1
  104. package/lib/overrides/overrides.d.ts +0 -1
  105. package/lib/overrides/overrides.js.map +0 -1
  106. package/lib/overrides/types.d.ts +0 -17
  107. package/lib/types/index.js.map +0 -1
  108. package/lib/types/validation.d.ts +0 -28
  109. package/lib/utils/DateBuilder.d.ts +0 -121
  110. package/lib/utils/DateBuilder.js.map +0 -1
  111. package/lib/utils/PathProxy.d.ts +0 -43
  112. package/lib/utils/PathProxy.js.map +0 -1
  113. package/lib/utils/constants.d.ts +0 -32
  114. package/lib/utils/constants.js.map +0 -1
  115. package/lib/utils/dates.d.ts +0 -86
  116. package/lib/utils/dates.js.map +0 -1
  117. package/lib/utils/equality.d.ts +0 -56
  118. package/lib/utils/equality.js.map +0 -1
  119. package/lib/utils/hashing.d.ts +0 -82
  120. package/lib/utils/hashing.js.map +0 -1
  121. package/lib/utils/index.d.ts +0 -11
  122. package/lib/utils/index.js.map +0 -1
  123. package/lib/utils/registry.d.ts +0 -68
  124. package/lib/utils/serialization.d.ts +0 -12
  125. package/lib/utils/serialization.js.map +0 -1
  126. package/lib/utils/serializers.d.ts +0 -41
  127. package/lib/utils/serializers.js.map +0 -1
  128. package/lib/utils/strings.d.ts +0 -25
  129. package/lib/utils/strings.js.map +0 -1
  130. package/lib/utils/types.d.ts +0 -35
  131. package/lib/validation/Validation.d.ts +0 -53
  132. package/lib/validation/Validation.js.map +0 -1
  133. package/lib/validation/Validators/AsyncValidator.d.ts +0 -72
  134. package/lib/validation/Validators/AsyncValidator.js.map +0 -1
  135. package/lib/validation/Validators/BaseValidator.d.ts +0 -118
  136. package/lib/validation/Validators/BaseValidator.js.map +0 -1
  137. package/lib/validation/Validators/DateValidator.d.ts +0 -60
  138. package/lib/validation/Validators/DateValidator.js.map +0 -1
  139. package/lib/validation/Validators/DiffValidator.d.ts +0 -29
  140. package/lib/validation/Validators/DiffValidator.js.map +0 -1
  141. package/lib/validation/Validators/EmailValidator.d.ts +0 -60
  142. package/lib/validation/Validators/EmailValidator.js.map +0 -1
  143. package/lib/validation/Validators/EqualsValidator.d.ts +0 -29
  144. package/lib/validation/Validators/EqualsValidator.js.map +0 -1
  145. package/lib/validation/Validators/GreaterThanOrEqualValidator.d.ts +0 -29
  146. package/lib/validation/Validators/GreaterThanOrEqualValidator.js.map +0 -1
  147. package/lib/validation/Validators/GreaterThanValidator.d.ts +0 -29
  148. package/lib/validation/Validators/GreaterThanValidator.js.map +0 -1
  149. package/lib/validation/Validators/LessThanOrEqualValidator.d.ts +0 -29
  150. package/lib/validation/Validators/LessThanOrEqualValidator.js.map +0 -1
  151. package/lib/validation/Validators/LessThanValidator.d.ts +0 -29
  152. package/lib/validation/Validators/LessThanValidator.js.map +0 -1
  153. package/lib/validation/Validators/ListValidator.d.ts +0 -66
  154. package/lib/validation/Validators/ListValidator.js.map +0 -1
  155. package/lib/validation/Validators/MaxLengthValidator.d.ts +0 -29
  156. package/lib/validation/Validators/MaxLengthValidator.js.map +0 -1
  157. package/lib/validation/Validators/MaxValidator.d.ts +0 -74
  158. package/lib/validation/Validators/MaxValidator.js.map +0 -1
  159. package/lib/validation/Validators/MinLengthValidator.d.ts +0 -29
  160. package/lib/validation/Validators/MinLengthValidator.js.map +0 -1
  161. package/lib/validation/Validators/MinValidator.d.ts +0 -74
  162. package/lib/validation/Validators/MinValidator.js.map +0 -1
  163. package/lib/validation/Validators/OptionValidator.d.ts +0 -29
  164. package/lib/validation/Validators/OptionValidator.js.map +0 -1
  165. package/lib/validation/Validators/PasswordValidator.d.ts +0 -28
  166. package/lib/validation/Validators/PasswordValidator.js.map +0 -1
  167. package/lib/validation/Validators/PatternValidator.d.ts +0 -103
  168. package/lib/validation/Validators/PatternValidator.js.map +0 -1
  169. package/lib/validation/Validators/RequiredValidator.d.ts +0 -74
  170. package/lib/validation/Validators/RequiredValidator.js.map +0 -1
  171. package/lib/validation/Validators/StepValidator.d.ts +0 -29
  172. package/lib/validation/Validators/StepValidator.js.map +0 -1
  173. package/lib/validation/Validators/TypeValidator.d.ts +0 -79
  174. package/lib/validation/Validators/TypeValidator.js.map +0 -1
  175. package/lib/validation/Validators/URLValidator.d.ts +0 -61
  176. package/lib/validation/Validators/URLValidator.js.map +0 -1
  177. package/lib/validation/Validators/Validator.d.ts +0 -65
  178. package/lib/validation/Validators/Validator.js.map +0 -1
  179. package/lib/validation/Validators/ValidatorRegistry.d.ts +0 -41
  180. package/lib/validation/Validators/ValidatorRegistry.js.map +0 -1
  181. package/lib/validation/Validators/constants.d.ts +0 -157
  182. package/lib/validation/Validators/constants.js.map +0 -1
  183. package/lib/validation/Validators/decorators.d.ts +0 -12
  184. package/lib/validation/Validators/decorators.js.map +0 -1
  185. package/lib/validation/Validators/index.d.ts +0 -26
  186. package/lib/validation/Validators/index.js.map +0 -1
  187. package/lib/validation/Validators/utils.d.ts +0 -75
  188. package/lib/validation/Validators/utils.js.map +0 -1
  189. package/lib/validation/decorators.d.ts +0 -313
  190. package/lib/validation/decorators.js.map +0 -1
  191. package/lib/validation/index.d.ts +0 -9
  192. package/lib/validation/index.js.map +0 -1
  193. package/lib/validation/types.d.ts +0 -309
  194. package/lib/validation/types.js.map +0 -1
  195. /package/lib/{constants → cjs/constants}/errors.cjs +0 -0
  196. /package/lib/{constants → cjs/constants}/index.cjs +0 -0
  197. /package/lib/{constants → cjs/constants}/validation.cjs +0 -0
  198. /package/lib/{model → cjs/model}/Builder.cjs +0 -0
  199. /package/lib/{model → cjs/model}/Model.cjs +0 -0
  200. /package/lib/{model → cjs/model}/ModelErrorDefinition.cjs +0 -0
  201. /package/lib/{model → cjs/model}/ModelRegistry.cjs +0 -0
  202. /package/lib/{model → cjs/model}/constants.cjs +0 -0
  203. /package/lib/{model → cjs/model}/construction.cjs +0 -0
  204. /package/lib/{model → cjs/model}/decorators.cjs +0 -0
  205. /package/lib/{model → cjs/model}/index.cjs +0 -0
  206. /package/lib/{model → cjs/model}/types.cjs +0 -0
  207. /package/lib/{model → cjs/model}/utils.cjs +0 -0
  208. /package/lib/{model → cjs/model}/validation.cjs +0 -0
  209. /package/lib/{overrides → cjs/overrides}/Metadata.cjs +0 -0
  210. /package/lib/{overrides → cjs/overrides}/index.cjs +0 -0
  211. /package/lib/{overrides → cjs/overrides}/overrides.cjs +0 -0
  212. /package/lib/{overrides → cjs/overrides}/types.cjs +0 -0
  213. /package/lib/{types → cjs/types}/index.cjs +0 -0
  214. /package/lib/{types → cjs/types}/validation.cjs +0 -0
  215. /package/lib/{utils → cjs/utils}/DateBuilder.cjs +0 -0
  216. /package/lib/{utils → cjs/utils}/PathProxy.cjs +0 -0
  217. /package/lib/{utils → cjs/utils}/constants.cjs +0 -0
  218. /package/lib/{utils → cjs/utils}/dates.cjs +0 -0
  219. /package/lib/{utils → cjs/utils}/equality.cjs +0 -0
  220. /package/lib/{utils → cjs/utils}/hashing.cjs +0 -0
  221. /package/lib/{utils → cjs/utils}/index.cjs +0 -0
  222. /package/lib/{utils → cjs/utils}/registry.cjs +0 -0
  223. /package/lib/{utils → cjs/utils}/serialization.cjs +0 -0
  224. /package/lib/{utils → cjs/utils}/serializers.cjs +0 -0
  225. /package/lib/{utils → cjs/utils}/strings.cjs +0 -0
  226. /package/lib/{utils → cjs/utils}/types.cjs +0 -0
  227. /package/lib/{validation → cjs/validation}/Validation.cjs +0 -0
  228. /package/lib/{validation → cjs/validation}/Validators/AsyncValidator.cjs +0 -0
  229. /package/lib/{validation → cjs/validation}/Validators/BaseValidator.cjs +0 -0
  230. /package/lib/{validation → cjs/validation}/Validators/DateValidator.cjs +0 -0
  231. /package/lib/{validation → cjs/validation}/Validators/DiffValidator.cjs +0 -0
  232. /package/lib/{validation → cjs/validation}/Validators/EmailValidator.cjs +0 -0
  233. /package/lib/{validation → cjs/validation}/Validators/EqualsValidator.cjs +0 -0
  234. /package/lib/{validation → cjs/validation}/Validators/GreaterThanOrEqualValidator.cjs +0 -0
  235. /package/lib/{validation → cjs/validation}/Validators/GreaterThanValidator.cjs +0 -0
  236. /package/lib/{validation → cjs/validation}/Validators/LessThanOrEqualValidator.cjs +0 -0
  237. /package/lib/{validation → cjs/validation}/Validators/LessThanValidator.cjs +0 -0
  238. /package/lib/{validation → cjs/validation}/Validators/ListValidator.cjs +0 -0
  239. /package/lib/{validation → cjs/validation}/Validators/MaxLengthValidator.cjs +0 -0
  240. /package/lib/{validation → cjs/validation}/Validators/MaxValidator.cjs +0 -0
  241. /package/lib/{validation → cjs/validation}/Validators/MinLengthValidator.cjs +0 -0
  242. /package/lib/{validation → cjs/validation}/Validators/MinValidator.cjs +0 -0
  243. /package/lib/{validation → cjs/validation}/Validators/OptionValidator.cjs +0 -0
  244. /package/lib/{validation → cjs/validation}/Validators/PasswordValidator.cjs +0 -0
  245. /package/lib/{validation → cjs/validation}/Validators/PatternValidator.cjs +0 -0
  246. /package/lib/{validation → cjs/validation}/Validators/RequiredValidator.cjs +0 -0
  247. /package/lib/{validation → cjs/validation}/Validators/StepValidator.cjs +0 -0
  248. /package/lib/{validation → cjs/validation}/Validators/TypeValidator.cjs +0 -0
  249. /package/lib/{validation → cjs/validation}/Validators/URLValidator.cjs +0 -0
  250. /package/lib/{validation → cjs/validation}/Validators/Validator.cjs +0 -0
  251. /package/lib/{validation → cjs/validation}/Validators/ValidatorRegistry.cjs +0 -0
  252. /package/lib/{validation → cjs/validation}/Validators/constants.cjs +0 -0
  253. /package/lib/{validation → cjs/validation}/Validators/decorators.cjs +0 -0
  254. /package/lib/{validation → cjs/validation}/Validators/index.cjs +0 -0
  255. /package/lib/{validation → cjs/validation}/Validators/utils.cjs +0 -0
  256. /package/lib/{validation → cjs/validation}/decorators.cjs +0 -0
  257. /package/lib/{validation → cjs/validation}/index.cjs +0 -0
  258. /package/lib/{validation → cjs/validation}/types.cjs +0 -0
  259. /package/lib/{constants → types/constants}/errors.d.ts +0 -0
  260. /package/lib/{constants → types/constants}/index.d.ts +0 -0
  261. /package/lib/{constants → types/constants}/validation.d.ts +0 -0
  262. /package/lib/{esm → types}/model/Builder.d.ts +0 -0
  263. /package/lib/{esm → types}/model/Model.d.ts +0 -0
  264. /package/lib/{esm → types}/model/ModelErrorDefinition.d.ts +0 -0
  265. /package/lib/{esm → types}/model/ModelRegistry.d.ts +0 -0
  266. /package/lib/{esm → types}/model/constants.d.ts +0 -0
  267. /package/lib/{esm → types}/model/construction.d.ts +0 -0
  268. /package/lib/{esm → types}/model/decorators.d.ts +0 -0
  269. /package/lib/{esm → types}/model/index.d.ts +0 -0
  270. /package/lib/{esm → types}/model/types.d.ts +0 -0
  271. /package/lib/{esm → types}/model/utils.d.ts +0 -0
  272. /package/lib/{esm → types}/model/validation.d.ts +0 -0
  273. /package/lib/{esm → types}/overrides/Metadata.d.ts +0 -0
  274. /package/lib/{esm → types}/overrides/index.d.ts +0 -0
  275. /package/lib/{esm → types}/overrides/overrides.d.ts +0 -0
  276. /package/lib/{esm → types}/overrides/types.d.ts +0 -0
  277. /package/lib/{esm → types}/types/index.d.ts +0 -0
  278. /package/lib/{esm → types}/types/validation.d.ts +0 -0
  279. /package/lib/{esm → types}/utils/DateBuilder.d.ts +0 -0
  280. /package/lib/{esm → types}/utils/PathProxy.d.ts +0 -0
  281. /package/lib/{esm → types}/utils/constants.d.ts +0 -0
  282. /package/lib/{esm → types}/utils/dates.d.ts +0 -0
  283. /package/lib/{esm → types}/utils/equality.d.ts +0 -0
  284. /package/lib/{esm → types}/utils/hashing.d.ts +0 -0
  285. /package/lib/{esm → types}/utils/index.d.ts +0 -0
  286. /package/lib/{esm → types}/utils/registry.d.ts +0 -0
  287. /package/lib/{esm → types}/utils/serialization.d.ts +0 -0
  288. /package/lib/{esm → types}/utils/serializers.d.ts +0 -0
  289. /package/lib/{esm → types}/utils/strings.d.ts +0 -0
  290. /package/lib/{esm → types}/utils/types.d.ts +0 -0
  291. /package/lib/{esm → types}/validation/Validation.d.ts +0 -0
  292. /package/lib/{esm → types}/validation/Validators/AsyncValidator.d.ts +0 -0
  293. /package/lib/{esm → types}/validation/Validators/BaseValidator.d.ts +0 -0
  294. /package/lib/{esm → types}/validation/Validators/DateValidator.d.ts +0 -0
  295. /package/lib/{esm → types}/validation/Validators/DiffValidator.d.ts +0 -0
  296. /package/lib/{esm → types}/validation/Validators/EmailValidator.d.ts +0 -0
  297. /package/lib/{esm → types}/validation/Validators/EqualsValidator.d.ts +0 -0
  298. /package/lib/{esm → types}/validation/Validators/GreaterThanOrEqualValidator.d.ts +0 -0
  299. /package/lib/{esm → types}/validation/Validators/GreaterThanValidator.d.ts +0 -0
  300. /package/lib/{esm → types}/validation/Validators/LessThanOrEqualValidator.d.ts +0 -0
  301. /package/lib/{esm → types}/validation/Validators/LessThanValidator.d.ts +0 -0
  302. /package/lib/{esm → types}/validation/Validators/ListValidator.d.ts +0 -0
  303. /package/lib/{esm → types}/validation/Validators/MaxLengthValidator.d.ts +0 -0
  304. /package/lib/{esm → types}/validation/Validators/MaxValidator.d.ts +0 -0
  305. /package/lib/{esm → types}/validation/Validators/MinLengthValidator.d.ts +0 -0
  306. /package/lib/{esm → types}/validation/Validators/MinValidator.d.ts +0 -0
  307. /package/lib/{esm → types}/validation/Validators/OptionValidator.d.ts +0 -0
  308. /package/lib/{esm → types}/validation/Validators/PasswordValidator.d.ts +0 -0
  309. /package/lib/{esm → types}/validation/Validators/PatternValidator.d.ts +0 -0
  310. /package/lib/{esm → types}/validation/Validators/RequiredValidator.d.ts +0 -0
  311. /package/lib/{esm → types}/validation/Validators/StepValidator.d.ts +0 -0
  312. /package/lib/{esm → types}/validation/Validators/TypeValidator.d.ts +0 -0
  313. /package/lib/{esm → types}/validation/Validators/URLValidator.d.ts +0 -0
  314. /package/lib/{esm → types}/validation/Validators/Validator.d.ts +0 -0
  315. /package/lib/{esm → types}/validation/Validators/ValidatorRegistry.d.ts +0 -0
  316. /package/lib/{esm → types}/validation/Validators/constants.d.ts +0 -0
  317. /package/lib/{esm → types}/validation/Validators/decorators.d.ts +0 -0
  318. /package/lib/{esm → types}/validation/Validators/index.d.ts +0 -0
  319. /package/lib/{esm → types}/validation/Validators/utils.d.ts +0 -0
  320. /package/lib/{esm → types}/validation/decorators.d.ts +0 -0
  321. /package/lib/{esm → types}/validation/index.d.ts +0 -0
  322. /package/lib/{esm → types}/validation/types.d.ts +0 -0
@@ -1,82 +0,0 @@
1
- /**
2
- * @summary Mimics Java's String's Hash implementation
3
- *
4
- * @param {string | number | symbol | Date} obj
5
- * @return {number} hash value of obj
6
- *
7
- * @function hashCode
8
- * @memberOf module:decorator-validation
9
- * @category Model
10
- */
11
- export declare function hashCode(obj: string | number | symbol | Date): string;
12
- /**
13
- * @summary Defines teh type for a Hashing function
14
- * @memberOf module:decorator-validation
15
- * @category Model
16
- */
17
- export type HashingFunction = (value: any, ...args: any[]) => string;
18
- /**
19
- * @summary Hashes an object by combining the hash of all its properties
20
- *
21
- * @param {Record<string, any>} obj
22
- * @return {string} the resulting hash
23
- *
24
- * @function hashObj
25
- * @memberOf module:decorator-validation
26
- * @category Model
27
- */
28
- export declare function hashObj(obj: Record<string, any> | any[]): string;
29
- export declare const DefaultHashingMethod = "default";
30
- /**
31
- * @description Manages hashing methods and provides a unified hashing interface
32
- * @summary A utility class that provides a registry for different hashing functions and methods to hash objects.
33
- * The class maintains a cache of registered hashing functions and allows setting a default hashing method.
34
- * It prevents direct instantiation and provides static methods for registration and hashing.
35
- *
36
- * @class Hashing
37
- * @category Model
38
- *
39
- * @example
40
- * ```typescript
41
- * // Register a custom hashing function
42
- * Hashing.register('md5', (obj) => createMD5Hash(obj), true);
43
- *
44
- * // Hash an object using default method
45
- * const hash1 = Hashing.hash(myObject);
46
- *
47
- * // Hash using specific method
48
- * const hash2 = Hashing.hash(myObject, 'md5');
49
- * ```
50
- */
51
- export declare class Hashing {
52
- /**
53
- * @description Current default hashing method identifier
54
- * @private
55
- */
56
- private static current;
57
- /**
58
- * @description Cache of registered hashing functions
59
- * @private
60
- */
61
- private static cache;
62
- private constructor();
63
- /**
64
- * @description Retrieves a registered hashing function
65
- * @summary Fetches a hashing function from the cache by its key. Throws an error if the method is not registered.
66
- *
67
- * @param {string} key - The identifier of the hashing function to retrieve
68
- * @return {HashingFunction} The requested hashing function
69
- * @private
70
- */
71
- private static get;
72
- /**
73
- * @description Registers a new hashing function
74
- * @summary Adds a new hashing function to the registry. Optionally sets it as the default method.
75
- * Throws an error if a method with the same key is already registered.
76
- *
77
- * @param {string} key - The identifier for the hashing function
78
- */
79
- static register(key: string, func: HashingFunction, setDefault?: boolean): void;
80
- static hash(obj: any, method?: string, ...args: any[]): any;
81
- static setDefault(method: string): void;
82
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"hashing.js","sourceRoot":"","sources":["../../src/utils/hashing.ts"],"names":[],"mappings":";;;AAUA,4BASC;AAmBD,0BA6BC;AAnED;;;;;;;;;GASG;AACH,SAAgB,QAAQ,CAAC,GAAoC;IAC3D,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;IAClB,IAAI,IAAI,GAAG,CAAC,CAAC;IACb,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACpC,MAAM,SAAS,GAAG,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;QACpC,IAAI,GAAG,CAAC,IAAI,IAAI,CAAC,CAAC,GAAG,IAAI,GAAG,SAAS,CAAC;QACtC,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC,CAAC,2BAA2B;IACjD,CAAC;IACD,OAAO,IAAI,CAAC,QAAQ,EAAE,CAAC;AACzB,CAAC;AASD;;;;;;;;;GASG;AACH,SAAgB,OAAO,CAAC,GAAgC;IACtD,MAAM,WAAW,GAAG,UAAU,CAAkB,EAAE,EAAO;QACvD,MAAM,MAAM,GAAG,YAAY,CAAC,EAAE,CAAC,CAAC;QAEhC,IAAI,OAAO,MAAM,KAAK,QAAQ;YAC5B,OAAO,YAAY,CAAC,CAAE,CAAY,IAAI,EAAE,CAAC,GAAG,YAAY,CAAC,EAAE,CAAC,CAAC,CAAC;QAEhE,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACX,CAAC,GAAG,CAAE,CAAY,IAAI,CAAC,CAA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;;;OAOG;IACK,MAAM,CAAC,GAAG,CAAC,GAAW;QAC5B,IAAI,GAAG,IAAI,IAAI,CAAC,KAAK;YAAE,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAC9C,MAAM,IAAI,KAAK,CAAC,sCAAsC,GAAG,EAAE,CAAC,CAAC;IAC/D,CAAC;IAED;;;;;;OAMG;IACH,MAAM,CAAC,QAAQ,CACb,GAAW,EACX,IAAqB,EACrB,UAAU,GAAG,KAAK;QAElB,IAAI,GAAG,IAAI,IAAI,CAAC,KAAK;YACnB,MAAM,IAAI,KAAK,CAAC,kBAAkB,GAAG,qBAAqB,CAAC,CAAC;QAC9D,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC;QACvB,IAAI,UAAU;YAAE,IAAI,CAAC,OAAO,GAAG,GAAG,CAAC;IACrC,CAAC;IAED,MAAM,CAAC,IAAI,CAAC,GAAQ,EAAE,MAAe,EAAE,GAAG,IAAW;QACnD,IAAI,CAAC,MAAM;YAAE,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC;QACzD,OAAO,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC;IACxC,CAAC;IAED,MAAM,CAAC,UAAU,CAAC,MAAc;QAC9B,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IAClC,CAAC;;AAvDH,0BAwDC"}
@@ -1,11 +0,0 @@
1
- export * from "./constants";
2
- export * from "./DateBuilder";
3
- export * from "./dates";
4
- export * from "./equality";
5
- export * from "./hashing";
6
- export * from "./PathProxy";
7
- export * from "./registry";
8
- export * from "./serializers";
9
- export * from "./serialization";
10
- export * from "./strings";
11
- export * from "./types";
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kDAA4B;AAC5B,oDAA8B;AAC9B,8CAAwB;AACxB,iDAA2B;AAC3B,gDAA0B;AAC1B,kDAA4B;AAC5B,iDAA2B;AAC3B,oDAA8B,CAAC,kCAAkC;AACjE,sDAAgC;AAChC,gDAA0B;AAC1B,8CAAwB"}
@@ -1,68 +0,0 @@
1
- import { Constructor } from "@decaf-ts/decoration";
2
- /**
3
- * @summary Basic interface for Registries
4
- *
5
- * @interface IRegistry
6
- *
7
- * @category Model
8
- */
9
- export interface IRegistry<T> {
10
- /**
11
- * @summary Registers an Object
12
- *
13
- * @param {T} obj
14
- * @param {any[]} args
15
- *
16
- * @method
17
- */
18
- register(obj: T | any, ...args: any[]): void;
19
- /**
20
- * @summary Retrieves an Object if it can find it
21
- *
22
- * @param {any} key
23
- * @param {any[]} args
24
- * @return {T | undefined}
25
- *
26
- * @method
27
- */
28
- get(key: any, ...args: any[]): T | undefined;
29
- }
30
- /**
31
- * @summary Basic Builder Registry Interface
32
- *
33
- * @template T
34
- * @interface BuilderRegistry<T>
35
- *
36
- * @category Model
37
- */
38
- export interface BuilderRegistry<T> extends IRegistry<Constructor<T>> {
39
- /**
40
- * @summary Retrieves an Builder Object by name if it can
41
- *
42
- * @param {string} name
43
- * @param {any[]} args
44
- *
45
- * @method
46
- */
47
- get(name: string, ...args: any[]): Constructor<T> | undefined;
48
- /**
49
- * @summary Registers a constructor by name
50
- *
51
- * @param {Constructor<T>} [constructor]
52
- * @param {name} name
53
- * @param {any[]} args
54
- *
55
- * @method
56
- */
57
- register(constructor: Constructor<T>, name?: string, ...args: any[]): void;
58
- /**
59
- * @summary Builds an Object by name
60
- *
61
- * @param {{}} obj
62
- * @param {any[]} args
63
- * @return T
64
- *
65
- * @method
66
- */
67
- build(obj: Record<string, any> | T, ...args: any[]): T;
68
- }
@@ -1,12 +0,0 @@
1
- import { Constructor } from "@decaf-ts/decoration";
2
- import { Serializer } from "./types";
3
- export declare class Serialization {
4
- private static current;
5
- private static cache;
6
- private constructor();
7
- private static get;
8
- static register(key: string, func: Constructor<Serializer<any>>, setDefault?: boolean): void;
9
- static serialize(obj: any, method?: string, ...args: any[]): any;
10
- static deserialize(obj: string, method?: string, ...args: any[]): any;
11
- static setDefault(method: string): void;
12
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"serialization.js","sourceRoot":"","sources":["../../src/utils/serialization.ts"],"names":[],"mappings":";;;AAEA,+CAAyD;AAEzD,MAAa,aAAa;aACT,YAAO,GAAW,sCAA0B,CAAC;IAI5D,gBAAuB,CAAC;IAEhB,MAAM,CAAC,GAAG,CAAC,GAAW;QAC5B,IAAI,GAAG,IAAI,IAAI,CAAC,KAAK;YAAE,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAC9C,MAAM,IAAI,KAAK,CAAC,4CAA4C,GAAG,EAAE,CAAC,CAAC;IACrE,CAAC;IAED,MAAM,CAAC,QAAQ,CACb,GAAW,EACX,IAAkC,EAClC,UAAU,GAAG,KAAK;QAElB,IAAI,GAAG,IAAI,IAAI,CAAC,KAAK;YACnB,MAAM,IAAI,KAAK,CAAC,wBAAwB,GAAG,qBAAqB,CAAC,CAAC;QACpE,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,IAAI,IAAI,EAAE,CAAC;QAC7B,IAAI,UAAU;YAAE,IAAI,CAAC,OAAO,GAAG,GAAG,CAAC;IACrC,CAAC;IAED,MAAM,CAAC,SAAS,CAAC,GAAQ,EAAE,MAAe,EAAE,GAAG,IAAW;QACxD,IAAI,CAAC,MAAM;YAAE,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,SAAS,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC;QACnE,OAAO,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC;IAClD,CAAC;IAED,MAAM,CAAC,WAAW,CAAC,GAAW,EAAE,MAAe,EAAE,GAAG,IAAW;QAC7D,IAAI,CAAC,MAAM;YAAE,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,WAAW,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC;QACrE,OAAO,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,WAAW,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC;IACpD,CAAC;IAED,MAAM,CAAC,UAAU,CAAC,MAAc;QAC9B,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IAClC,CAAC;;AAnCH,sCAoCC"}
@@ -1,41 +0,0 @@
1
- import { Serializer } from "./types";
2
- import { Model } from "../model/Model";
3
- /**
4
- * @summary Concrete implementation of a {@link Serializer} in JSON format
5
- * @description JS's native JSON.stringify (used here) is not deterministic
6
- * and therefore should not be used for hashing purposes
7
- *
8
- * To keep dependencies low, we will not implement this, but we recommend
9
- * implementing a similar {@link JSONSerializer} using 'deterministic-json' libraries
10
- *
11
- * @class JSONSerializer
12
- * @implements Serializer
13
- *
14
- * @category Model
15
- */
16
- export declare class JSONSerializer<T extends Model<boolean>> implements Serializer<T> {
17
- constructor();
18
- /**
19
- * @summary prepares the model for serialization
20
- * @description returns a shallow copy of the object, containing an enumerable {@link ModelKeys#ANCHOR} property
21
- * so the object can be recognized upon deserialization
22
- *
23
- * @param {T} model
24
- * @protected
25
- */
26
- protected preSerialize(model: T, ...args: any[]): Record<string, any>;
27
- /**
28
- * @summary Rebuilds a model from a serialization
29
- * @param {string} str
30
- *
31
- * @throws {Error} If it fails to parse the string, or to build the model
32
- */
33
- deserialize(str: string, ...args: any[]): T;
34
- /**
35
- * @summary Serializes a model
36
- * @param {T} model
37
- *
38
- * @throws {Error} if fails to serialize
39
- */
40
- serialize(model: T, ...args: any[]): string;
41
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":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,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC;IAClD,CAAC;CACF;AApDD,wCAoDC;AAED,6BAAa,CAAC,OAAO,CAAC,GAAG;IACvB,IAAI,EAAE,IAAI,cAAc,EAAE;CAC3B,CAAC"}
@@ -1,25 +0,0 @@
1
- /**
2
- * @summary Util function to provide string format functionality similar to C#'s string.format
3
- *
4
- * @param {string} string
5
- * @param {Array<string | number>} [args] replacements made by order of appearance (replacement0 wil replace {0} and so on)
6
- * @return {string} formatted string
7
- *
8
- * @function stringFormat
9
- * @memberOf module:decorator-validation
10
- * @category Model
11
- */
12
- export declare function stringFormat(string: string, ...args: (string | number)[]): string;
13
- /**
14
- * @summary Util function to provide string format functionality similar to C#'s string.format
15
- * @description alias for {@link stringFormat}
16
- *
17
- * @param {string} string
18
- * @param {string} args replacements made by order of appearance (replacement0 wil replace {0} and so on)
19
- * @return {string} formatted string
20
- *
21
- * @function sf
22
- * @memberOf module:decorator-validation
23
- * @category Model
24
- */
25
- export declare const sf: typeof stringFormat;
@@ -1 +0,0 @@
1
- {"version":3,"file":"strings.js","sourceRoot":"","sources":["../../src/utils/strings.ts"],"names":[],"mappings":";;;AAWA,oCAMC;AAjBD;;;;;;;;;;GAUG;AACH,SAAgB,YAAY,CAAC,MAAc,EAAE,GAAG,IAAyB;IACvE,OAAO,MAAM,CAAC,OAAO,CAAC,UAAU,EAAE,UAAU,KAAK,EAAE,MAAM;QACvD,OAAO,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,WAAW;YACxC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE;YACzB,CAAC,CAAC,WAAW,CAAC;IAClB,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;;;;;;;;;;GAWG;AACU,QAAA,EAAE,GAAG,YAAY,CAAC"}
@@ -1,35 +0,0 @@
1
- import { Model } from "../model";
2
- /**
3
- * @description Interface for serializing and deserializing model objects
4
- * @summary Defines the contract for classes that can convert model objects to and from string representations.
5
- * Serializers are used to persist models or transmit them over networks.
6
- *
7
- * @interface Serializer
8
- * @template T Type of model that can be serialized, must extend Model
9
- * @memberOf module:decorator-validation
10
- * @category Model
11
- */
12
- export interface Serializer<M extends Model> {
13
- /**
14
- * @description Converts a model object to a string representation
15
- * @summary Serializes a model instance into a string format that can be stored or transmitted.
16
- * Additional arguments can be provided to customize the serialization process.
17
- *
18
- * @param {T} model - The model instance to serialize
19
- * @param {...any} args - Additional arguments for the serialization process
20
- * @return {string} The serialized representation of the model
21
- * @throws {Error} If the model cannot be serialized
22
- */
23
- serialize(model: M, ...args: any[]): string;
24
- /**
25
- * @description Reconstructs a model object from its string representation
26
- * @summary Deserializes a string back into a model instance.
27
- * Additional arguments can be provided to customize the deserialization process.
28
- *
29
- * @param {string} str - The serialized string to convert back to a model
30
- * @param {...any} args - Additional arguments for the deserialization process
31
- * @return {T} The reconstructed model instance
32
- * @throws {Error} If the string cannot be deserialized into a valid model
33
- */
34
- deserialize(str: string, ...args: any[]): M;
35
- }
@@ -1,53 +0,0 @@
1
- import { Validator } from "./Validators/Validator";
2
- import { IValidatorRegistry, ValidatorDefinition } from "./types";
3
- /**
4
- * @summary Static class acting as a namespace for the Validation
5
- *
6
- * @class Validation
7
- * @static
8
- *
9
- * @category Validation
10
- */
11
- export declare class Validation {
12
- private static actingValidatorRegistry?;
13
- private constructor();
14
- /**
15
- * @summary Defines the acting ValidatorRegistry
16
- *
17
- * @param {IValidatorRegistry} validatorRegistry the new implementation of the validator Registry
18
- * @param {function(Validator): Validator} [migrationHandler] the method to map the validator if required;
19
- */
20
- static setRegistry(validatorRegistry: IValidatorRegistry<Validator>, migrationHandler?: (validator: Validator) => Validator): void;
21
- /**
22
- * @summary Returns the current ValidatorRegistry
23
- *
24
- * @return IValidatorRegistry, defaults to {@link ValidatorRegistry}
25
- */
26
- private static getRegistry;
27
- /**
28
- * @summary Retrieves a validator
29
- *
30
- * @param {string} validatorKey one of the {@link ValidationKeys}
31
- * @return {Validator | undefined} the registered Validator or undefined if there is nono matching the provided key
32
- */
33
- static get<T extends Validator>(validatorKey: string): T | undefined;
34
- /**
35
- * @summary Registers the provided validators onto the registry
36
- *
37
- * @param {T[] | ValidatorDefinition[]} validator
38
- */
39
- static register<T extends Validator>(...validator: (ValidatorDefinition | T)[]): void;
40
- /**
41
- * @summary Builds the key to store as Metadata under Reflections
42
- * @description concatenates {@link ValidationKeys#REFLECT} with the provided key
43
- *
44
- * @param {string} key
45
- */
46
- static key(key: string): string;
47
- /**
48
- * @summary Returns all registered validation keys
49
- */
50
- static keys(): string[];
51
- static registerDecorator(key: string, decorator: (...args: any[]) => PropertyDecorator): void;
52
- static decoratorFromKey(key: string): any;
53
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"Validation.js","sourceRoot":"","sources":["../../src/validation/Validation.ts"],"names":[],"mappings":";;;AAEA,0EAAmE;AACnE,0DAAwD;AACxD,wDAA+C;AAC/C,qDAAgD;AAEhD;;;;;;;GAOG;AACH,MAAa,UAAU;aACN,4BAAuB,GACpC,SAAS,CAAC;IAEZ,gBAAuB,CAAC;IAExB;;;;;OAKG;IACH,MAAM,CAAC,WAAW,CAChB,iBAAgD,EAChD,gBAAsD;QAEtD,IAAI,gBAAgB,IAAI,UAAU,CAAC,uBAAuB;YACxD,UAAU,CAAC,uBAAuB,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,CAAC,CAAS,EAAE,EAAE;gBACjE,MAAM,SAAS,GAAG,iBAAiB,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;gBAC3C,IAAI,SAAS;oBAAE,iBAAiB,CAAC,QAAQ,CAAC,gBAAgB,CAAC,SAAS,CAAC,CAAC,CAAC;YACzE,CAAC,CAAC,CAAC;QACL,UAAU,CAAC,uBAAuB,GAAG,iBAAiB,CAAC;IACzD,CAAC;IAED;;;;OAIG;IACK,MAAM,CAAC,WAAW;QACxB,IAAI,CAAC,UAAU,CAAC,uBAAuB;YACrC,UAAU,CAAC,uBAAuB,GAAG,IAAI,qCA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,CAAC,CAC1C,CAAC;QACJ,CAAC;QAAC,OAAO,CAAU,EAAE,CAAC;YACpB,MAAM,IAAI,KAAK,CAAC,iCAAiC,GAAG,KAAK,CAAC,EAAE,CAAC,CAAC;QAChE,CAAC;IACH,CAAC;;AAlGH,gCAmGC"}
@@ -1,72 +0,0 @@
1
- import type { ValidatorOptions } from "../types";
2
- import type { PathProxy } from "../../utils";
3
- import { BaseValidator } from "./BaseValidator";
4
- /**
5
- * @description
6
- * Abstract class for defining asynchronous validators.
7
- *
8
- * This class extends the base `Validator` and enforces that any implementation
9
- * of `hasErrors` must be asynchronous, always returning a Promise.
10
- *
11
- * Use this when the validation process involves asynchronous operations,
12
- * such as API calls, database lookups, or time-based checks (e.g., timeouts).
13
- *
14
- * @example
15
- * ```typescript
16
- * // Example of an asynchronous validator that compares value against a timeout
17
- * class TimeoutValidator extends AsyncValidator<{ timeout?: number }> {
18
- * constructor(message: string = "Validation failed due to timeout") {
19
- * super(message);
20
- * }
21
- *
22
- * async hasErrors(value: number, options?: { timeout?: number }) {
23
- * const delay = options?.timeout ?? 100;
24
- *
25
- * // async call
26
- * await new Promise(res => setTimeout(res, delay));
27
- *
28
- * if (value > delay) {
29
- * // Rejects the validation after waiting the delay if value is greater
30
- * return Promise.resolve(this.getMessage());
31
- * }
32
- *
33
- * // Passes the validation after waiting the delay
34
- * return Promise.resolve(undefined);
35
- * }
36
- * }
37
- *
38
- * // Example usage:
39
- * const validator = new TimeoutValidator();
40
- *
41
- * async function runValidation() {
42
- * const error = await validator.hasErrors(50, { timeout: 100 });
43
- * if (error) {
44
- * return console.error('Validation error:', error);
45
- * }
46
- * console.log('Value is valid');
47
- * }
48
- *
49
- * await runValidation();
50
- * ```
51
- *
52
- * - If `value > timeout`, the validator waits for the delay and then rejects with an error.
53
- * - If `value <= timeout`, the validator waits for the delay and resolves successfully with `undefined`.
54
- *
55
- * @see {@link Validator} For the base synchronous validator.
56
- */
57
- export declare abstract class AsyncValidator<V extends ValidatorOptions> extends BaseValidator<V, true> {
58
- protected constructor(message?: string, ...acceptedTypes: string[]);
59
- /**
60
- * @description
61
- * Asynchronously validates a value.
62
- *
63
- * @template V - Type of the option object that can be passed to the validator
64
- * @param {any} value - The value to validate
65
- * @param {V} [options] - Optional configuration options for customizing validation behavior
66
- * @param {PathProxy<any>} proxy -
67
- * @return Promise<string | undefined> Error message if validation fails, undefined if validation passes
68
- *
69
- * @see {@link Validator}
70
- */
71
- abstract hasErrors(value: any, options?: V, proxy?: PathProxy<any>): Promise<string | undefined>;
72
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"AsyncValidator.js","sourceRoot":"","sources":["../../../src/validation/Validators/AsyncValidator.ts"],"names":[],"mappings":";;;AAEA,uDAAgD;AAChD,+CAAqD;AAErD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoDG;AACH,MAAsB,cAEpB,SAAQ,6BAAsB;IAC9B,YACE,UAAkB,kCAAsB,CAAC,OAAO,EAChD,GAAG,aAAuB;QAE1B,KAAK,CAAC,IAAI,EAAE,OAAO,EAAE,GAAG,aAAa,CAAC,CAAC;IACzC,CAAC;CAmBF;AA3BD,wCA2BC"}
@@ -1,118 +0,0 @@
1
- import { ValidatorOptions } from "../types";
2
- import type { PathProxy } from "../../utils";
3
- import type { ConditionalAsync } from "../../types";
4
- /**
5
- * @description Abstract base class for all validators in the validation framework.
6
- * @summary The BaseValidator class provides the foundation for all synchronous and asynchronous validator implementations.
7
- * It handles type checking, error message formatting, and defines the interface that all validators must implement.
8
- * This class is designed to be extended by specific validator classes that define their own validation logic.
9
- *
10
- * @template V - Validator options type
11
- * @template IsAsync - Whether the validator is async (true) or sync (false). Default `false`.
12
- *
13
- * @param {boolean} async - Defines if the validator is async (must match the subclass signature)
14
- * @param {string} message - Default error message to display when validation fails (defaults to {@link DEFAULT_ERROR_MESSAGES#DEFAULT})
15
- * @param {string[]} acceptedTypes - Type names that this validator accepts (used for runtime type checking)
16
- *
17
- * @class BaseValidator
18
- * @abstract
19
- *
20
- * @example
21
- * // Example of a synchronous validator
22
- * class SyncValidator extends BaseValidator<SomeOptions, false> {
23
- * constructor() {
24
- * super(false, "Sync validation failed", String.name);
25
- * }
26
- *
27
- * public hasErrors(value: any, options?: SomeOptions): string | undefined {
28
- * if (typeof value !== "string") return this.getMessage(this.message);
29
- * return undefined;
30
- * }
31
- * }
32
- *
33
- * @example
34
- * // Example of an asynchronous custom validator
35
- * class AsyncValidator extends BaseValidator<SomeOptions, true> {
36
- * constructor() {
37
- * super(true, "Async validation failed", String.name);
38
- * }
39
- *
40
- * public async hasErrors(value: any, options?: SomeOptions): Promise<string | undefined> {
41
- * const result = await someAsyncCheck(value);
42
- * if (!result) return this.getMessage(this.message);
43
- * return undefined;
44
- * }
45
- * }
46
- *
47
- * @mermaid
48
- * sequenceDiagram
49
- * participant C as Client
50
- * participant V as Validator Subclass
51
- * participant B as BaseValidator
52
- *
53
- * C->>V: new CustomValidator(async, message)
54
- * V->>B: super(async, message, acceptedTypes)
55
- * B->>B: Store message, async flag, and accepted types
56
- * B->>B: Optionally wrap hasErrors with type checking
57
- * C->>V: hasErrors(value, options)
58
- * alt value type not in acceptedTypes
59
- * B-->>C: Type error message
60
- * else value type is accepted
61
- * V->>V: Custom validation logic
62
- * V-->>C: Validation result
63
- * end
64
- *
65
- * @category Validators
66
- */
67
- export declare abstract class BaseValidator<V extends ValidatorOptions = ValidatorOptions, Async extends boolean = false> {
68
- readonly message: string;
69
- readonly acceptedTypes?: string[];
70
- readonly async?: Async;
71
- protected constructor(async: Async, message?: string, ...acceptedTypes: string[]);
72
- /**
73
- * @description Formats an error message with optional arguments
74
- * @summary Creates a formatted error message by replacing placeholders with provided arguments.
75
- * This method uses the string formatting utility to generate consistent error messages
76
- * across all validators.
77
- *
78
- * @param {string} message - The message template with placeholders
79
- * @param {...any} args - Values to insert into the message template
80
- * @return {string} The formatted error message
81
- * @protected
82
- */
83
- protected getMessage(message: string, ...args: any[]): string;
84
- /**
85
- * @description Creates a type-checking wrapper around the hasErrors method
86
- * @summary Wraps the hasErrors method with type validation logic to ensure that
87
- * the value being validated is of an accepted type before performing specific validation.
88
- * This method is called during construction if acceptedTypes are provided.
89
- *
90
- * @param {Function} unbound - The original hasErrors method to be wrapped
91
- * @return {Function} A new function that performs type checking before calling the original method
92
- * @private
93
- */
94
- private checkTypeAndHasErrors;
95
- /**
96
- * @description Validates a value against specific validation rules
97
- * @summary Abstract method that must be implemented by all validator subclasses.
98
- * This method contains the core validation logic that determines whether a value
99
- * is valid according to the specific rules of the validator. If the value is valid,
100
- * the method returns undefined; otherwise, it returns an error message.
101
- *
102
- * @template V - Type of the options object that can be passed to the validator
103
- * @param {any} value - The value to validate
104
- * @param {V} [options] - Optional configuration options for customizing validation behavior
105
- * @param {PathProxy<any>} proxy -
106
- * @return {string | undefined} Error message if validation fails, undefined if validation passes
107
- *
108
- * @abstract
109
- *
110
- * @see Model#validate
111
- */
112
- abstract hasErrors(value: any, options?: V, proxy?: PathProxy<any>): ConditionalAsync<Async, string | undefined>;
113
- /**
114
- * @summary Duck typing for Validators
115
- * @param val
116
- */
117
- static isValidator(val: any): boolean;
118
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"BaseValidator.js","sourceRoot":"","sources":["../../../src/validation/Validators/BaseValidator.ts"],"names":[],"mappings":";;;AAAA,+CAAqD;AACrD,uDAAyC;AAIzC,uCAAqC;AAErC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8DG;AACH,MAAsB,aAAa;IAQjC,YACE,KAAY,EACZ,UAAkB,kCAAsB,CAAC,OAAO,EAChD,GAAG,aAAuB;QAE1B,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QAEvB,IAAI,aAAa,CAAC,MAAM;YAAE,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;QAC7D,IAAI,IAAI,C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
- import { Validator } from "./Validator";
2
- import { DateValidatorOptions } from "../types";
3
- /**
4
- * @description Validator for checking if a value is a valid date
5
- * @summary The DateValidator checks if a value is a valid date object or a string that can be converted to a valid date.
6
- * It validates that the value represents a real date and not an invalid date like "2023-02-31".
7
- * @param {string} [message] - Custom error message to display when validation fails, defaults to {@link DEFAULT_ERROR_MESSAGES#DATE}
8
- * @class DateValidator
9
- * @extends Validator
10
- *
11
- * @category Validators
12
- * @example
13
- * ```typescript
14
- * // Create a date validator with default error message
15
- * const dateValidator = new DateValidator();
16
- *
17
- * // Create a date validator with custom error message
18
- * const customDateValidator = new DateValidator("Please enter a valid date");
19
- *
20
- * // Validate a date
21
- * const result = dateValidator.hasErrors(new Date()); // undefined (valid)
22
- * const invalidResult = dateValidator.hasErrors("not a date"); // Returns error message (invalid)
23
- * ```
24
- * @mermaid
25
- * sequenceDiagram
26
- * participant C as Client
27
- * participant V as DateValidator
28
- *
29
- * C->>V: new DateValidator(message)
30
- * C->>V: hasErrors(value, options)
31
- * alt value is undefined
32
- * V-->>C: undefined (valid)
33
- * else value is string
34
- * V->>V: Convert to Date
35
- * end
36
- * alt Date is invalid (NaN)
37
- * V-->>C: Error message
38
- * else Date is valid
39
- * V-->>C: undefined (valid)
40
- * end
41
- */
42
- export declare class DateValidator extends Validator<DateValidatorOptions> {
43
- constructor(message?: string);
44
- /**
45
- * @description Checks if the provided value is a valid date
46
- * @summary Validates that the given value is a valid date. If the value is a string,
47
- * it attempts to convert it to a Date object. Returns an error message if the date is invalid,
48
- * or undefined if the date is valid or if the value is undefined.
49
- *
50
- * @param {Date | string} value - The value to validate, can be a Date object or a string
51
- * @param {DateValidatorOptions} [options={}] - Optional configuration options for the validator
52
- *
53
- * @return {string | undefined} Error message if validation fails, undefined if validation passes
54
- *
55
- * @override
56
- *
57
- * @see Validator#hasErrors
58
- */
59
- hasErrors(value: Date | string, options?: DateValidatorOptions): string | undefined;
60
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"DateValidator.js","sourceRoot":"","sources":["../../../src/validation/Validators/DateValidator.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+CAAwC;AACxC,+CAAqE;AACrE,iDAAyC;AAGzC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AAEI,IAAM,aAAa,GAAnB,MAAM,aAAc,SAAQ,qBAA+B;IAChE,YAAY,UAAkB,kCAAsB,CAAC,IAAI;QACvD,KAAK,CAAC,OAAO,EAAE,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC;IACtD,CAAC;IAED;;;;;;;;;;;;;;OAcG;IACI,SAAS,CACd,KAAoB,EACpB,UAAgC,EAAE;QAElC,IAAI,KAAK,KAAK,SAAS;YAAE,OAAO;QAEhC,IAAI,OAAO,KAAK,KAAK,QAAQ;YAAE,KAAK,GAAG,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC;QAEvD,IAAI,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,EAAE,CAAC;YAClC,MAAM,EAAE,OAAO,GAAG,EAAE,EAAE,GAAG,OAAO,CAAC;YACjC,OAAO,IAAI,CAAC,UAAU,CAAC,OAAO,IAAI,IAAI,CAAC,OAAO,CAAC,CAAC;QAClD,CAAC;IACH,CAAC;CACF,CAAA;AAjCY,sCAAa;wBAAb,aAAa;IADzB,IAAA,sBAAS,EAAC,0BAAc,CAAC,IAAI,CAAC;;GAClB,aAAa,CAiCzB"}
@@ -1,29 +0,0 @@
1
- import { Validator } from "./Validator";
2
- import { DiffValidatorOptions } from "../types";
3
- import type { PathProxy } from "../../utils";
4
- /**
5
- * @summary Diff Validator
6
- *
7
- * @param {string} [message] defaults to {@link DEFAULT_ERROR_MESSAGES#DiffValidator}
8
- *
9
- * @class DiffValidator
10
- * @extends Validator
11
- *
12
- * @category Validators
13
- */
14
- export declare class DiffValidator extends Validator<DiffValidatorOptions> {
15
- constructor(message?: string);
16
- /**
17
- * @summary Validates a model
18
- *
19
- * @param {string} value
20
- * @param {DiffValidatorOptions} options
21
- * @param {PathProxy<any>} accessor - Proxy-like object used to resolve values from nested structures via path strings.
22
- *
23
- * @return {string | undefined}
24
- *
25
- * @override
26
- * @see Validator#hasErrors
27
- */
28
- hasErrors(value: any, options: DiffValidatorOptions, accessor: PathProxy<any>): string | undefined;
29
- }