@warlock.js/core 3.0.11 → 3.0.13

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 (380) hide show
  1. package/bin/warlock-loader.mjs +9 -9
  2. package/cjs/application.js +1 -1
  3. package/cjs/application.js.map +1 -1
  4. package/cjs/console/commander.js +1 -1
  5. package/cjs/console/commander.js.map +1 -1
  6. package/cjs/http/UploadedFile.js +3 -3
  7. package/cjs/http/UploadedFile.js.map +1 -1
  8. package/cjs/http/errors/index.d.ts +2 -0
  9. package/cjs/http/errors/index.d.ts.map +1 -0
  10. package/cjs/http/errors/resource-not-found.error.d.ts +13 -0
  11. package/cjs/http/errors/resource-not-found.error.d.ts.map +1 -0
  12. package/cjs/http/errors/resource-not-found.error.js +24 -0
  13. package/cjs/http/errors/resource-not-found.error.js.map +1 -0
  14. package/cjs/http/index.d.ts +1 -0
  15. package/cjs/http/index.d.ts.map +1 -1
  16. package/cjs/http/middleware/_inject-request-context.d.ts.map +1 -1
  17. package/cjs/http/middleware/cache-response-middleware.d.ts.map +1 -1
  18. package/cjs/http/middleware/cache-response-middleware.js +0 -1
  19. package/cjs/http/middleware/cache-response-middleware.js.map +1 -1
  20. package/cjs/http/plugins/index.d.ts +1 -1
  21. package/cjs/http/plugins/index.d.ts.map +1 -1
  22. package/cjs/http/request.d.ts +20 -5
  23. package/cjs/http/request.d.ts.map +1 -1
  24. package/cjs/http/request.js +34 -5
  25. package/cjs/http/request.js.map +1 -1
  26. package/cjs/http/response.d.ts +3 -2
  27. package/cjs/http/response.d.ts.map +1 -1
  28. package/cjs/http/response.js +15 -4
  29. package/cjs/http/response.js.map +1 -1
  30. package/cjs/http/types.d.ts +12 -0
  31. package/cjs/http/types.d.ts.map +1 -1
  32. package/cjs/index.d.ts +2 -0
  33. package/cjs/index.d.ts.map +1 -1
  34. package/cjs/index.js +1 -1
  35. package/cjs/modules/uploads/controllers/upload-files.d.ts.map +1 -1
  36. package/cjs/modules/uploads/controllers/upload-files.js +7 -7
  37. package/cjs/modules/uploads/controllers/upload-files.js.map +1 -1
  38. package/cjs/modules/uploads/output/upload-output.d.ts.map +1 -1
  39. package/cjs/modules/uploads/output/upload-output.js +2 -2
  40. package/cjs/modules/uploads/output/upload-output.js.map +1 -1
  41. package/cjs/modules/uploads/utils/get-watermark-options.js +1 -1
  42. package/cjs/modules/uploads/utils/get-watermark-options.js.map +1 -1
  43. package/cjs/output/output.js +1 -1
  44. package/cjs/output/output.js.map +1 -1
  45. package/cjs/react/index.d.ts +1 -10
  46. package/cjs/react/index.d.ts.map +1 -1
  47. package/cjs/react/index.js +3 -4
  48. package/cjs/react/index.js.map +1 -1
  49. package/cjs/repositories/repository-list-manager.js +1 -1
  50. package/cjs/repositories/repository-list-manager.js.map +1 -1
  51. package/cjs/router/router.d.ts +0 -8
  52. package/cjs/router/router.d.ts.map +1 -1
  53. package/cjs/router/router.js +3 -36
  54. package/cjs/router/router.js.map +1 -1
  55. package/cjs/router/types.d.ts +1 -1
  56. package/cjs/router/types.d.ts.map +1 -1
  57. package/cjs/starters/http-server-starter.d.ts.map +1 -1
  58. package/cjs/starters/http-server-starter.js +7 -2
  59. package/cjs/starters/http-server-starter.js.map +1 -1
  60. package/cjs/starters/start-cli-server.d.ts.map +1 -1
  61. package/cjs/starters/start-cli-server.js +10 -1
  62. package/cjs/starters/start-cli-server.js.map +1 -1
  63. package/cjs/starters/start-http-server.d.ts +3 -2
  64. package/cjs/starters/start-http-server.d.ts.map +1 -1
  65. package/cjs/starters/start-http-server.js +19 -8
  66. package/cjs/starters/start-http-server.js.map +1 -1
  67. package/cjs/utils/date-output.d.ts.map +1 -1
  68. package/cjs/utils/date-output.js +2 -4
  69. package/cjs/utils/date-output.js.map +1 -1
  70. package/cjs/utils/get-localized.d.ts.map +1 -1
  71. package/cjs/utils/get-localized.js.map +1 -1
  72. package/cjs/utils/glob.js +2 -2
  73. package/cjs/utils/glob.js.map +1 -1
  74. package/cjs/v/database/exists-except-current-id.d.ts +7 -0
  75. package/cjs/v/database/exists-except-current-id.d.ts.map +1 -0
  76. package/cjs/v/database/exists-except-current-id.js +23 -0
  77. package/cjs/v/database/exists-except-current-id.js.map +1 -0
  78. package/cjs/v/database/exists-except-current-user.d.ts +7 -0
  79. package/cjs/v/database/exists-except-current-user.d.ts.map +1 -0
  80. package/cjs/v/database/exists-except-current-user.js +25 -0
  81. package/cjs/v/database/exists-except-current-user.js.map +1 -0
  82. package/cjs/v/database/exists.d.ts +7 -0
  83. package/cjs/v/database/exists.d.ts.map +1 -0
  84. package/cjs/v/database/exists.js +21 -0
  85. package/cjs/v/database/exists.js.map +1 -0
  86. package/cjs/v/database/index.d.ts +12 -0
  87. package/cjs/v/database/index.d.ts.map +1 -0
  88. package/cjs/v/database/types.d.ts +68 -0
  89. package/cjs/v/database/types.d.ts.map +1 -0
  90. package/cjs/v/database/unique-except-current-id.d.ts +7 -0
  91. package/cjs/v/database/unique-except-current-id.d.ts.map +1 -0
  92. package/cjs/v/database/unique-except-current-id.js +23 -0
  93. package/cjs/v/database/unique-except-current-id.js.map +1 -0
  94. package/cjs/v/database/unique-except-current-user.d.ts +7 -0
  95. package/cjs/v/database/unique-except-current-user.d.ts.map +1 -0
  96. package/cjs/v/database/unique-except-current-user.js +25 -0
  97. package/cjs/v/database/unique-except-current-user.js.map +1 -0
  98. package/cjs/v/database/unique.d.ts +7 -0
  99. package/cjs/v/database/unique.d.ts.map +1 -0
  100. package/cjs/v/database/unique.js +30 -0
  101. package/cjs/v/database/unique.js.map +1 -0
  102. package/cjs/v/file/file.d.ts +22 -0
  103. package/cjs/v/file/file.d.ts.map +1 -0
  104. package/cjs/v/file/file.js +60 -0
  105. package/cjs/v/file/file.js.map +1 -0
  106. package/cjs/v/file/index.d.ts +6 -0
  107. package/cjs/v/file/index.d.ts.map +1 -0
  108. package/cjs/v/index.d.ts +17 -0
  109. package/cjs/v/index.d.ts.map +1 -0
  110. package/cjs/v/init.d.ts +7 -0
  111. package/cjs/v/init.d.ts.map +1 -0
  112. package/cjs/v/init.js +40 -0
  113. package/cjs/v/init.js.map +1 -0
  114. package/cjs/v/plugins/database-plugin.d.ts +14 -0
  115. package/cjs/v/plugins/database-plugin.d.ts.map +1 -0
  116. package/cjs/v/plugins/database-plugin.js +95 -0
  117. package/cjs/v/plugins/database-plugin.js.map +1 -0
  118. package/cjs/v/plugins/file-plugin.d.ts +11 -0
  119. package/cjs/v/plugins/file-plugin.d.ts.map +1 -0
  120. package/cjs/v/plugins/file-plugin.js +17 -0
  121. package/cjs/v/plugins/file-plugin.js.map +1 -0
  122. package/cjs/v/plugins/index.d.ts +8 -0
  123. package/cjs/v/plugins/index.d.ts.map +1 -0
  124. package/cjs/v/string/index.d.ts +6 -0
  125. package/cjs/v/string/index.d.ts.map +1 -0
  126. package/cjs/v/string/uploadable.d.ts +6 -0
  127. package/cjs/v/string/uploadable.d.ts.map +1 -0
  128. package/cjs/v/string/uploadable.js +14 -0
  129. package/cjs/v/string/uploadable.js.map +1 -0
  130. package/cjs/v/types.d.ts +53 -0
  131. package/cjs/v/types.d.ts.map +1 -0
  132. package/cjs/v/validators/file-validator.d.ts +36 -0
  133. package/cjs/v/validators/file-validator.d.ts.map +1 -0
  134. package/cjs/v/validators/file-validator.js +88 -0
  135. package/cjs/v/validators/file-validator.js.map +1 -0
  136. package/cjs/v/validators/index.d.ts +7 -0
  137. package/cjs/v/validators/index.d.ts.map +1 -0
  138. package/cjs/validator/index.d.ts +0 -1
  139. package/cjs/validator/index.d.ts.map +1 -1
  140. package/cjs/validator/locales.js +518 -10
  141. package/cjs/validator/locales.js.map +1 -1
  142. package/cjs/validator/types.d.ts +28 -0
  143. package/cjs/validator/types.d.ts.map +1 -1
  144. package/cjs/validator/validateAll.d.ts.map +1 -1
  145. package/cjs/validator/validateAll.js +5 -2
  146. package/cjs/validator/validateAll.js.map +1 -1
  147. package/esm/application.js +1 -1
  148. package/esm/application.js.map +1 -1
  149. package/esm/console/commander.js +1 -1
  150. package/esm/console/commander.js.map +1 -1
  151. package/esm/http/errors/index.d.ts +2 -0
  152. package/esm/http/errors/index.d.ts.map +1 -0
  153. package/esm/http/errors/resource-not-found.error.d.ts +13 -0
  154. package/esm/http/errors/resource-not-found.error.d.ts.map +1 -0
  155. package/esm/http/errors/resource-not-found.error.js +24 -0
  156. package/esm/http/errors/resource-not-found.error.js.map +1 -0
  157. package/esm/http/index.d.ts +1 -0
  158. package/esm/http/index.d.ts.map +1 -1
  159. package/esm/http/middleware/_inject-request-context.d.ts.map +1 -1
  160. package/esm/http/middleware/cache-response-middleware.d.ts.map +1 -1
  161. package/esm/http/middleware/cache-response-middleware.js +0 -1
  162. package/esm/http/middleware/cache-response-middleware.js.map +1 -1
  163. package/esm/http/plugins/index.d.ts +1 -1
  164. package/esm/http/plugins/index.d.ts.map +1 -1
  165. package/esm/http/request.d.ts +20 -5
  166. package/esm/http/request.d.ts.map +1 -1
  167. package/esm/http/request.js +34 -5
  168. package/esm/http/request.js.map +1 -1
  169. package/esm/http/response.d.ts +3 -2
  170. package/esm/http/response.d.ts.map +1 -1
  171. package/esm/http/response.js +16 -5
  172. package/esm/http/response.js.map +1 -1
  173. package/esm/http/types.d.ts +12 -0
  174. package/esm/http/types.d.ts.map +1 -1
  175. package/esm/index.d.ts +2 -0
  176. package/esm/index.d.ts.map +1 -1
  177. package/esm/index.js +1 -1
  178. package/esm/modules/uploads/controllers/upload-files.d.ts.map +1 -1
  179. package/esm/modules/uploads/controllers/upload-files.js +2 -2
  180. package/esm/modules/uploads/controllers/upload-files.js.map +1 -1
  181. package/esm/modules/uploads/output/upload-output.d.ts.map +1 -1
  182. package/esm/modules/uploads/output/upload-output.js +2 -2
  183. package/esm/modules/uploads/output/upload-output.js.map +1 -1
  184. package/esm/modules/uploads/utils/get-watermark-options.js +1 -1
  185. package/esm/modules/uploads/utils/get-watermark-options.js.map +1 -1
  186. package/esm/output/output.js +1 -1
  187. package/esm/output/output.js.map +1 -1
  188. package/esm/react/index.d.ts +1 -10
  189. package/esm/react/index.d.ts.map +1 -1
  190. package/esm/react/index.js +2 -3
  191. package/esm/react/index.js.map +1 -1
  192. package/esm/repositories/repository-list-manager.js +1 -1
  193. package/esm/repositories/repository-list-manager.js.map +1 -1
  194. package/esm/router/router.d.ts +0 -8
  195. package/esm/router/router.d.ts.map +1 -1
  196. package/esm/router/router.js +3 -36
  197. package/esm/router/router.js.map +1 -1
  198. package/esm/router/types.d.ts +1 -1
  199. package/esm/router/types.d.ts.map +1 -1
  200. package/esm/starters/http-server-starter.d.ts.map +1 -1
  201. package/esm/starters/http-server-starter.js +7 -2
  202. package/esm/starters/http-server-starter.js.map +1 -1
  203. package/esm/starters/start-cli-server.d.ts.map +1 -1
  204. package/esm/starters/start-cli-server.js +10 -1
  205. package/esm/starters/start-cli-server.js.map +1 -1
  206. package/esm/starters/start-http-server.d.ts +3 -2
  207. package/esm/starters/start-http-server.d.ts.map +1 -1
  208. package/esm/starters/start-http-server.js +19 -8
  209. package/esm/starters/start-http-server.js.map +1 -1
  210. package/esm/utils/date-output.d.ts.map +1 -1
  211. package/esm/utils/date-output.js +2 -4
  212. package/esm/utils/date-output.js.map +1 -1
  213. package/esm/utils/get-localized.d.ts.map +1 -1
  214. package/esm/utils/get-localized.js.map +1 -1
  215. package/esm/v/database/exists-except-current-id.d.ts +7 -0
  216. package/esm/v/database/exists-except-current-id.d.ts.map +1 -0
  217. package/esm/v/database/exists-except-current-id.js +23 -0
  218. package/esm/v/database/exists-except-current-id.js.map +1 -0
  219. package/esm/v/database/exists-except-current-user.d.ts +7 -0
  220. package/esm/v/database/exists-except-current-user.d.ts.map +1 -0
  221. package/esm/v/database/exists-except-current-user.js +25 -0
  222. package/esm/v/database/exists-except-current-user.js.map +1 -0
  223. package/esm/v/database/exists.d.ts +7 -0
  224. package/esm/v/database/exists.d.ts.map +1 -0
  225. package/esm/v/database/exists.js +21 -0
  226. package/esm/v/database/exists.js.map +1 -0
  227. package/esm/v/database/index.d.ts +12 -0
  228. package/esm/v/database/index.d.ts.map +1 -0
  229. package/esm/v/database/types.d.ts +68 -0
  230. package/esm/v/database/types.d.ts.map +1 -0
  231. package/esm/v/database/unique-except-current-id.d.ts +7 -0
  232. package/esm/v/database/unique-except-current-id.d.ts.map +1 -0
  233. package/esm/v/database/unique-except-current-id.js +23 -0
  234. package/esm/v/database/unique-except-current-id.js.map +1 -0
  235. package/esm/v/database/unique-except-current-user.d.ts +7 -0
  236. package/esm/v/database/unique-except-current-user.d.ts.map +1 -0
  237. package/esm/v/database/unique-except-current-user.js +25 -0
  238. package/esm/v/database/unique-except-current-user.js.map +1 -0
  239. package/esm/v/database/unique.d.ts +7 -0
  240. package/esm/v/database/unique.d.ts.map +1 -0
  241. package/esm/v/database/unique.js +30 -0
  242. package/esm/v/database/unique.js.map +1 -0
  243. package/esm/v/file/file.d.ts +22 -0
  244. package/esm/v/file/file.d.ts.map +1 -0
  245. package/esm/v/file/file.js +60 -0
  246. package/esm/v/file/file.js.map +1 -0
  247. package/esm/v/file/index.d.ts +6 -0
  248. package/esm/v/file/index.d.ts.map +1 -0
  249. package/esm/v/index.d.ts +17 -0
  250. package/esm/v/index.d.ts.map +1 -0
  251. package/esm/v/init.d.ts +7 -0
  252. package/esm/v/init.d.ts.map +1 -0
  253. package/esm/v/init.js +40 -0
  254. package/esm/v/init.js.map +1 -0
  255. package/esm/v/plugins/database-plugin.d.ts +14 -0
  256. package/esm/v/plugins/database-plugin.d.ts.map +1 -0
  257. package/esm/v/plugins/database-plugin.js +95 -0
  258. package/esm/v/plugins/database-plugin.js.map +1 -0
  259. package/esm/v/plugins/file-plugin.d.ts +11 -0
  260. package/esm/v/plugins/file-plugin.d.ts.map +1 -0
  261. package/esm/v/plugins/file-plugin.js +17 -0
  262. package/esm/v/plugins/file-plugin.js.map +1 -0
  263. package/esm/v/plugins/index.d.ts +8 -0
  264. package/esm/v/plugins/index.d.ts.map +1 -0
  265. package/esm/v/string/index.d.ts +6 -0
  266. package/esm/v/string/index.d.ts.map +1 -0
  267. package/esm/v/string/uploadable.d.ts +6 -0
  268. package/esm/v/string/uploadable.d.ts.map +1 -0
  269. package/esm/v/string/uploadable.js +14 -0
  270. package/esm/v/string/uploadable.js.map +1 -0
  271. package/esm/v/types.d.ts +53 -0
  272. package/esm/v/types.d.ts.map +1 -0
  273. package/esm/v/validators/file-validator.d.ts +36 -0
  274. package/esm/v/validators/file-validator.d.ts.map +1 -0
  275. package/esm/v/validators/file-validator.js +88 -0
  276. package/esm/v/validators/file-validator.js.map +1 -0
  277. package/esm/v/validators/index.d.ts +7 -0
  278. package/esm/v/validators/index.d.ts.map +1 -0
  279. package/esm/validator/index.d.ts +0 -1
  280. package/esm/validator/index.d.ts.map +1 -1
  281. package/esm/validator/locales.js +518 -10
  282. package/esm/validator/locales.js.map +1 -1
  283. package/esm/validator/types.d.ts +28 -0
  284. package/esm/validator/types.d.ts.map +1 -1
  285. package/esm/validator/validateAll.d.ts.map +1 -1
  286. package/esm/validator/validateAll.js +4 -1
  287. package/esm/validator/validateAll.js.map +1 -1
  288. package/package.json +3 -3
  289. package/cjs/react/page-renderer.d.ts +0 -18
  290. package/cjs/react/page-renderer.d.ts.map +0 -1
  291. package/cjs/react/page-renderer.js +0 -69
  292. package/cjs/react/page-renderer.js.map +0 -1
  293. package/cjs/react/plugin.d.ts +0 -15
  294. package/cjs/react/plugin.d.ts.map +0 -1
  295. package/cjs/react/plugin.js +0 -22
  296. package/cjs/react/plugin.js.map +0 -1
  297. package/cjs/react/vite-config.d.ts +0 -9
  298. package/cjs/react/vite-config.d.ts.map +0 -1
  299. package/cjs/react/vite-config.js +0 -74
  300. package/cjs/react/vite-config.js.map +0 -1
  301. package/cjs/validator/v/array-validator.d.ts +0 -21
  302. package/cjs/validator/v/array-validator.d.ts.map +0 -1
  303. package/cjs/validator/v/base-validator.d.ts +0 -117
  304. package/cjs/validator/v/base-validator.d.ts.map +0 -1
  305. package/cjs/validator/v/database.d.ts +0 -8
  306. package/cjs/validator/v/database.d.ts.map +0 -1
  307. package/cjs/validator/v/database.js +0 -129
  308. package/cjs/validator/v/database.js.map +0 -1
  309. package/cjs/validator/v/index.d.ts +0 -3
  310. package/cjs/validator/v/index.d.ts.map +0 -1
  311. package/cjs/validator/v/mutators.d.ts +0 -24
  312. package/cjs/validator/v/mutators.d.ts.map +0 -1
  313. package/cjs/validator/v/mutators.js +0 -88
  314. package/cjs/validator/v/mutators.js.map +0 -1
  315. package/cjs/validator/v/number-validator.d.ts +0 -21
  316. package/cjs/validator/v/number-validator.d.ts.map +0 -1
  317. package/cjs/validator/v/object-validator.d.ts +0 -37
  318. package/cjs/validator/v/object-validator.d.ts.map +0 -1
  319. package/cjs/validator/v/rules.d.ts +0 -265
  320. package/cjs/validator/v/rules.d.ts.map +0 -1
  321. package/cjs/validator/v/rules.js +0 -914
  322. package/cjs/validator/v/rules.js.map +0 -1
  323. package/cjs/validator/v/schema.d.ts +0 -625
  324. package/cjs/validator/v/schema.d.ts.map +0 -1
  325. package/cjs/validator/v/schema.js +0 -1212
  326. package/cjs/validator/v/schema.js.map +0 -1
  327. package/cjs/validator/v/string-validator.d.ts +0 -41
  328. package/cjs/validator/v/string-validator.d.ts.map +0 -1
  329. package/cjs/validator/v/types.d.ts +0 -180
  330. package/cjs/validator/v/types.d.ts.map +0 -1
  331. package/cjs/validator/v/utils.d.ts +0 -5
  332. package/cjs/validator/v/utils.d.ts.map +0 -1
  333. package/cjs/validator/v/utils.js +0 -29
  334. package/cjs/validator/v/utils.js.map +0 -1
  335. package/esm/react/page-renderer.d.ts +0 -18
  336. package/esm/react/page-renderer.d.ts.map +0 -1
  337. package/esm/react/page-renderer.js +0 -69
  338. package/esm/react/page-renderer.js.map +0 -1
  339. package/esm/react/plugin.d.ts +0 -15
  340. package/esm/react/plugin.d.ts.map +0 -1
  341. package/esm/react/plugin.js +0 -22
  342. package/esm/react/plugin.js.map +0 -1
  343. package/esm/react/vite-config.d.ts +0 -9
  344. package/esm/react/vite-config.d.ts.map +0 -1
  345. package/esm/react/vite-config.js +0 -74
  346. package/esm/react/vite-config.js.map +0 -1
  347. package/esm/validator/v/array-validator.d.ts +0 -21
  348. package/esm/validator/v/array-validator.d.ts.map +0 -1
  349. package/esm/validator/v/base-validator.d.ts +0 -117
  350. package/esm/validator/v/base-validator.d.ts.map +0 -1
  351. package/esm/validator/v/database.d.ts +0 -8
  352. package/esm/validator/v/database.d.ts.map +0 -1
  353. package/esm/validator/v/database.js +0 -129
  354. package/esm/validator/v/database.js.map +0 -1
  355. package/esm/validator/v/index.d.ts +0 -3
  356. package/esm/validator/v/index.d.ts.map +0 -1
  357. package/esm/validator/v/mutators.d.ts +0 -24
  358. package/esm/validator/v/mutators.d.ts.map +0 -1
  359. package/esm/validator/v/mutators.js +0 -88
  360. package/esm/validator/v/mutators.js.map +0 -1
  361. package/esm/validator/v/number-validator.d.ts +0 -21
  362. package/esm/validator/v/number-validator.d.ts.map +0 -1
  363. package/esm/validator/v/object-validator.d.ts +0 -37
  364. package/esm/validator/v/object-validator.d.ts.map +0 -1
  365. package/esm/validator/v/rules.d.ts +0 -265
  366. package/esm/validator/v/rules.d.ts.map +0 -1
  367. package/esm/validator/v/rules.js +0 -914
  368. package/esm/validator/v/rules.js.map +0 -1
  369. package/esm/validator/v/schema.d.ts +0 -625
  370. package/esm/validator/v/schema.d.ts.map +0 -1
  371. package/esm/validator/v/schema.js +0 -1212
  372. package/esm/validator/v/schema.js.map +0 -1
  373. package/esm/validator/v/string-validator.d.ts +0 -41
  374. package/esm/validator/v/string-validator.d.ts.map +0 -1
  375. package/esm/validator/v/types.d.ts +0 -180
  376. package/esm/validator/v/types.d.ts.map +0 -1
  377. package/esm/validator/v/utils.d.ts +0 -5
  378. package/esm/validator/v/utils.d.ts.map +0 -1
  379. package/esm/validator/v/utils.js +0 -29
  380. package/esm/validator/v/utils.js.map +0 -1
@@ -1,117 +0,0 @@
1
- import { type Request } from "./../../http";
2
- import { type Rule } from "./../rules";
3
- export type ValidationRule = {
4
- rule: Rule;
5
- errorMessage?: string;
6
- translatable?: boolean;
7
- order?: number;
8
- };
9
- export declare abstract class BaseValidator {
10
- errorMessage?: string;
11
- /**
12
- * Input value
13
- */
14
- value: any;
15
- /**
16
- * Errors list
17
- */
18
- protected errorsList: any[];
19
- /**
20
- * Input key
21
- * This is the direct key of the input
22
- * For example, if the key is `user.name` then the key is `name`
23
- */
24
- key: string;
25
- /**
26
- * Input namespace key
27
- * This is the parent key namespace
28
- * for example, if the key is `user.name` then namespace is `user`
29
- */
30
- keyNamespace: string;
31
- /**
32
- * Rules list
33
- */
34
- rules: ValidationRule[];
35
- /**
36
- * Request handler
37
- */
38
- protected request: Request;
39
- /**
40
- * Validator name
41
- */
42
- abstract name: string;
43
- /**
44
- * Base rule
45
- */
46
- protected abstract baseRule: Rule;
47
- configurations: any;
48
- /**
49
- * Set errors list ref
50
- */
51
- setErrorsListRef(errorsList: any[]): this;
52
- /**
53
- * Constructor
54
- */
55
- constructor(errorMessage?: string);
56
- /**
57
- * Init
58
- */
59
- protected init(): void;
60
- /**
61
- * Set request
62
- */
63
- setRequest(request: Request): this;
64
- /**
65
- * Validate the value
66
- */
67
- validate(): Promise<void>;
68
- /**
69
- * Check if value is empty
70
- */
71
- get isEmptyValue(): boolean;
72
- /**
73
- * Get full key
74
- */
75
- get fullKey(): string;
76
- /**
77
- * Add rule
78
- */
79
- addRule(rule: ValidationRule): this;
80
- /**
81
- * Check if validator fails
82
- */
83
- get fails(): boolean;
84
- /**
85
- * Check if validator passes
86
- */
87
- get passes(): boolean;
88
- /**
89
- * Set input value
90
- */
91
- setValue(value: any): this;
92
- /**
93
- * Set input key
94
- */
95
- setKey(key: string): this;
96
- /**
97
- * Set input namespace key (key excluded)
98
- */
99
- setNamespaceKey(key: string): this;
100
- /**
101
- * Add new error
102
- */
103
- addError(rule: string, message: string): this;
104
- /**
105
- * Get errors list
106
- */
107
- errors(): any[];
108
- /**
109
- * Make it required
110
- */
111
- required(errorMessage?: string): this;
112
- /**
113
- * Clone the validator
114
- */
115
- clone(): BaseValidator;
116
- }
117
- //# sourceMappingURL=base-validator.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"base-validator.d.ts","sourceRoot":"","sources":["../../../src/validator/v/base-validator.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAgB,KAAK,IAAI,EAAE,MAAM,YAAY,CAAC;AAErD,MAAM,MAAM,cAAc,GAAG;IAC3B,IAAI,EAAE,IAAI,CAAC;IACX,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,8BAAsB,aAAa;IA2DP,YAAY,CAAC,EAAE,MAAM;IA1D/C;;OAEG;IACI,KAAK,EAAE,GAAG,CAAC;IAElB;;OAEG;IACH,SAAS,CAAC,UAAU,EAAG,GAAG,EAAE,CAAC;IAE7B;;;;OAIG;IACI,GAAG,SAAM;IAEhB;;;;OAIG;IACI,YAAY,SAAM;IAEzB;;OAEG;IACI,KAAK,EAAE,cAAc,EAAE,CAAM;IAEpC;;OAEG;IACH,SAAS,CAAC,OAAO,EAAG,OAAO,CAAC;IAE5B;;OAEG;IACH,SAAgB,IAAI,EAAE,MAAM,CAAC;IAE7B;;OAEG;IACH,SAAS,CAAC,QAAQ,CAAC,QAAQ,EAAE,IAAI,CAAC;IAE3B,cAAc,EAAE,GAAG,CAAM;IAEhC;;OAEG;IACI,gBAAgB,CAAC,UAAU,EAAE,GAAG,EAAE;IAMzC;;OAEG;gBACuB,YAAY,CAAC,EAAE,MAAM;IAE/C;;OAEG;IACH,SAAS,CAAC,IAAI;IAQd;;OAEG;IACI,UAAU,CAAC,OAAO,EAAE,OAAO;IAMlC;;OAEG;IACU,QAAQ;IA4BrB;;OAEG;IACH,IAAW,YAAY,IAAI,OAAO,CAEjC;IAED;;OAEG;IACH,IAAW,OAAO,WAEjB;IAED;;OAEG;IACI,OAAO,CAAC,IAAI,EAAE,cAAc;IAUnC;;OAEG;IACH,IAAW,KAAK,YAEf;IAED;;OAEG;IACH,IAAW,MAAM,YAEhB;IAED;;OAEG;IACI,QAAQ,CAAC,KAAK,EAAE,GAAG;IAM1B;;OAEG;IACI,MAAM,CAAC,GAAG,EAAE,MAAM;IAMzB;;OAEG;IACI,eAAe,CAAC,GAAG,EAAE,MAAM;IAMlC;;OAEG;IACI,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;IAa7C;;OAEG;IACI,MAAM;IAIb;;OAEG;IACI,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM;IAYrC;;OAEG;IACI,KAAK,IAAI,aAAa;CAa9B"}
@@ -1,8 +0,0 @@
1
- import type { ExistsExceptCurrentIdRuleOptions, ExistsExceptCurrentUserRuleOptions, ExistsRuleOptions, SchemaRule, UniqueExceptCurrentIdRuleOptions, UniqueExceptCurrentUserRuleOptions, UniqueRuleOptions } from "./types";
2
- export declare const uniqueRule: SchemaRule<UniqueRuleOptions>;
3
- export declare const uniqueExceptCurrentUserRule: SchemaRule<UniqueExceptCurrentUserRuleOptions>;
4
- export declare const uniqueExceptCurrentIdRule: SchemaRule<UniqueExceptCurrentIdRuleOptions>;
5
- export declare const existsRule: SchemaRule<ExistsRuleOptions>;
6
- export declare const existsExceptCurrentUserRule: SchemaRule<ExistsExceptCurrentUserRuleOptions>;
7
- export declare const existsExceptCurrentIdRule: SchemaRule<ExistsExceptCurrentIdRuleOptions>;
8
- //# sourceMappingURL=database.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"database.d.ts","sourceRoot":"","sources":["../../../src/validator/v/database.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,gCAAgC,EAChC,kCAAkC,EAClC,iBAAiB,EACjB,UAAU,EACV,gCAAgC,EAChC,kCAAkC,EAClC,iBAAiB,EAClB,MAAM,SAAS,CAAC;AAGjB,eAAO,MAAM,UAAU,EAAE,UAAU,CAAC,iBAAiB,CAwCpD,CAAC;AAEF,eAAO,MAAM,2BAA2B,EAAE,UAAU,CAAC,kCAAkC,CAuCpF,CAAC;AAEJ,eAAO,MAAM,yBAAyB,EAAE,UAAU,CAAC,gCAAgC,CA+BhF,CAAC;AAEJ,eAAO,MAAM,UAAU,EAAE,UAAU,CAAC,iBAAiB,CAsBpD,CAAC;AAEF,eAAO,MAAM,2BAA2B,EAAE,UAAU,CAAC,kCAAkC,CAuCpF,CAAC;AAEJ,eAAO,MAAM,yBAAyB,EAAE,UAAU,CAAC,gCAAgC,CA+BhF,CAAC"}
@@ -1,129 +0,0 @@
1
- import {get}from'@mongez/reinforcements';import {Aggregate}from'@warlock.js/cascade';import {useRequestStore}from'../../http/middleware/inject-request-context.js';import {invalidRule,VALID_RULE}from'./utils.js';const uniqueRule = {
2
- name: "unique",
3
- errorMessage: "The :input must be unique",
4
- async validate(value, context) {
5
- const { Model, except, column = context.key, exceptColumnName, exceptValue, query, } = this.context.options;
6
- const dbQuery = typeof Model !== "string" ? Model.aggregate() : new Aggregate(Model);
7
- dbQuery.where(column, value);
8
- if (except) {
9
- const exceptValue = get(context.allValues, except);
10
- if (exceptValue !== undefined) {
11
- dbQuery.where(except, "!=", exceptValue);
12
- }
13
- }
14
- if (exceptColumnName !== undefined) {
15
- dbQuery.where(exceptColumnName, "!=", exceptValue);
16
- }
17
- if (query) {
18
- await query({
19
- query: dbQuery,
20
- value,
21
- allValues: context.allValues,
22
- });
23
- }
24
- const document = await dbQuery.first();
25
- return document ? invalidRule(this, context) : VALID_RULE;
26
- },
27
- };
28
- const uniqueExceptCurrentUserRule = {
29
- name: "uniqueExceptCurrentUser",
30
- errorMessage: "The :input must be unique",
31
- async validate(value, context) {
32
- const { Model, column = context.key, exceptCurrentUserColumn = "id", exceptCurrentUserValue = "id", query, } = this.context.options;
33
- const { user } = useRequestStore();
34
- const dbQuery = typeof Model !== "string" ? Model.aggregate() : new Aggregate(Model);
35
- dbQuery.where(column, value);
36
- if (user) {
37
- dbQuery.where(exceptCurrentUserColumn, "!=", user.get(exceptCurrentUserValue));
38
- }
39
- if (query) {
40
- await query({
41
- query: dbQuery,
42
- value,
43
- allValues: context.allValues,
44
- });
45
- }
46
- const document = await dbQuery.first();
47
- return document ? invalidRule(this, context) : VALID_RULE;
48
- },
49
- };
50
- const uniqueExceptCurrentIdRule = {
51
- name: "uniqueExceptCurrentId",
52
- errorMessage: "The :input must be unique",
53
- async validate(value, context) {
54
- const { Model, column = context.key, exceptCurrentIdColumn = "id", query, } = this.context.options;
55
- const { request } = useRequestStore();
56
- const dbQuery = typeof Model !== "string" ? Model.aggregate() : new Aggregate(Model);
57
- dbQuery.where(column, value);
58
- dbQuery.where(exceptCurrentIdColumn, "!=", request.int("id"));
59
- if (query) {
60
- await query({
61
- query: dbQuery,
62
- value,
63
- allValues: context.allValues,
64
- });
65
- }
66
- const document = await dbQuery.first();
67
- return document ? invalidRule(this, context) : VALID_RULE;
68
- },
69
- };
70
- const existsRule = {
71
- name: "exists",
72
- errorMessage: "The :input must exist",
73
- async validate(value, context) {
74
- const { Model, query, column = context.key } = this.context.options;
75
- const dbQuery = typeof Model !== "string" ? Model.aggregate() : new Aggregate(Model);
76
- dbQuery.where(column, value);
77
- if (query) {
78
- await query({
79
- query: dbQuery,
80
- value,
81
- allValues: context.allValues,
82
- });
83
- }
84
- const document = await dbQuery.first();
85
- return document ? VALID_RULE : invalidRule(this, context);
86
- },
87
- };
88
- const existsExceptCurrentUserRule = {
89
- name: "existsExceptCurrentUser",
90
- errorMessage: "The :input must exist",
91
- async validate(value, context) {
92
- const { Model, query, column = context.key, exceptCurrentUserColumn = "id", exceptCurrentUserValue = "id", } = this.context.options;
93
- const { user } = useRequestStore();
94
- const dbQuery = typeof Model !== "string" ? Model.aggregate() : new Aggregate(Model);
95
- dbQuery.where(column, value);
96
- if (user) {
97
- dbQuery.where(exceptCurrentUserColumn, "!=", user.get(exceptCurrentUserValue));
98
- }
99
- if (query) {
100
- await query({
101
- query: dbQuery,
102
- value,
103
- allValues: context.allValues,
104
- });
105
- }
106
- const document = await dbQuery.first();
107
- return document ? VALID_RULE : invalidRule(this, context);
108
- },
109
- };
110
- const existsExceptCurrentIdRule = {
111
- name: "existsExceptCurrentId",
112
- errorMessage: "The :input must exist",
113
- async validate(value, context) {
114
- const { Model, query, column = context.key, exceptCurrentIdColumn = "id", } = this.context.options;
115
- const { request } = useRequestStore();
116
- const dbQuery = typeof Model !== "string" ? Model.aggregate() : new Aggregate(Model);
117
- dbQuery.where(column, value);
118
- dbQuery.where(exceptCurrentIdColumn, "!=", request.int("id"));
119
- if (query) {
120
- await query({
121
- query: dbQuery,
122
- value,
123
- allValues: context.allValues,
124
- });
125
- }
126
- const document = await dbQuery.first();
127
- return document ? VALID_RULE : invalidRule(this, context);
128
- },
129
- };export{existsExceptCurrentIdRule,existsExceptCurrentUserRule,existsRule,uniqueExceptCurrentIdRule,uniqueExceptCurrentUserRule,uniqueRule};//# sourceMappingURL=database.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"database.js","sources":["../../../src/validator/v/database.ts"],"sourcesContent":[null],"names":[],"mappings":"mNAca,MAAA,UAAU,GAAkC;AACvD,IAAA,IAAI,EAAE,QAAQ;AACd,IAAA,YAAY,EAAE,2BAA2B;AACzC,IAAA,MAAM,QAAQ,CAAC,KAAU,EAAE,OAAO,EAAA;QAChC,MAAM,EACJ,KAAK,EACL,MAAM,EACN,MAAM,GAAG,OAAO,CAAC,GAAG,EACpB,gBAAgB,EAChB,WAAW,EACX,KAAK,GACN,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC;QAEzB,MAAM,OAAO,GACX,OAAO,KAAK,KAAK,QAAQ,GAAG,KAAK,CAAC,SAAS,EAAE,GAAG,IAAI,SAAS,CAAC,KAAK,CAAC,CAAC;AAEvE,QAAA,OAAO,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;AAE7B,QAAA,IAAI,MAAM,EAAE;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CAAC;QAEtC,MAAM,OAAO,GACX,OAAO,KAAK,KAAK,QAAQ,GAAG,KAAK,CAAC,SAAS,EAAE,GAAG,IAAI,SAAS,CAAC,KAAK,CAAC,CAAC;AAEvE,QAAA,OAAO,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;AAC7B,QAAA,OAAO,CAAC,KAAK,CAAC,qBAAqB,EAAE,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC;AAE9D,QAAA,IAAI,KAAK,EAAE;AACT,YAAA,MAAM,KAAK,CAAC;AACV,gBAAA,KAAK,EAAE,OAAO;gBACd,KAAK;gBACL,SAAS,EAAE,OAAO,CAAC,SAAS;AAC7B,aAAA,CAAC,CAAC;AACJ,SAAA;AAED,QAAA,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,KAAK,EAAE,CAAC;AACvC,QAAA,OAAO,QAAQ,GAAG,UAAU,GAAG,WAAW,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;KAC3D;"}
@@ -1,3 +0,0 @@
1
- export * from "./schema";
2
- export * from "./types";
3
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/validator/v/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC"}
@@ -1,24 +0,0 @@
1
- import { type Mutator } from "./types";
2
- export declare const dateMutator: Mutator;
3
- export declare const trimMutator: Mutator;
4
- export declare const lowercaseMutator: Mutator;
5
- export declare const uppercaseMutator: Mutator;
6
- export declare const capitalizeMutator: Mutator;
7
- export declare const numberMutator: Mutator;
8
- export declare const booleanMutator: Mutator;
9
- export declare const stringMutator: Mutator;
10
- export declare const jsonMutator: Mutator;
11
- export declare const trimMultipleWhitespaceMutator: Mutator;
12
- export declare const safeHtmlMutator: Mutator;
13
- export declare const htmlEscapeMutator: Mutator;
14
- export declare const removeSpecialCharactersMutator: Mutator;
15
- export declare const urlDecodeMutator: Mutator;
16
- export declare const roundNumberMutator: Mutator;
17
- export declare const flipArrayMutator: Mutator;
18
- export declare const reverseArrayMutator: Mutator;
19
- export declare const sortArrayMutator: Mutator;
20
- export declare const uniqueArrayMutator: Mutator;
21
- export declare const removeEmptyArrayElementsMutator: Mutator;
22
- export declare const stripUnknownMutator: Mutator;
23
- export declare const objectTrimMutator: Mutator;
24
- //# sourceMappingURL=mutators.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mutators.d.ts","sourceRoot":"","sources":["../../../src/validator/v/mutators.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,SAAS,CAAC;AAEvC,eAAO,MAAM,WAAW,EAAE,OAEzB,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,OAEzB,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,OAE9B,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,OAE9B,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,OAE/B,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,OAI3B,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,OAK5B,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,OAG3B,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,OAMzB,CAAC;AAEF,eAAO,MAAM,6BAA6B,EAAE,OAE3C,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,OAE7B,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,OAQ/B,CAAC;AAEF,eAAO,MAAM,8BAA8B,EAAE,OAE5C,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,OAE9B,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,OAEhC,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,OAE9B,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,OAEjC,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,OAwB9B,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,OAEhC,CAAC;AAEF,eAAO,MAAM,+BAA+B,EAAE,OAE7C,CAAC;AAGF,eAAO,MAAM,mBAAmB,EAAE,OAejC,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,OA6B/B,CAAC"}
@@ -1,88 +0,0 @@
1
- import {capitalize,get,trim}from'@mongez/reinforcements';import {isPlainObject}from'@mongez/supportive-is';const dateMutator = async (date) => {
2
- return new Date(date);
3
- };
4
- const lowercaseMutator = async (value) => {
5
- return value.toString().toLowerCase();
6
- };
7
- const uppercaseMutator = async (value) => {
8
- return value.toString().toUpperCase();
9
- };
10
- const capitalizeMutator = async (value) => {
11
- return capitalize(value);
12
- };
13
- const numberMutator = async (value) => {
14
- if (!value)
15
- return value;
16
- return Number(value);
17
- };
18
- const stringMutator = async (value) => {
19
- if (!value)
20
- return "";
21
- return value.toString();
22
- };
23
- const flipArrayMutator = async (value) => {
24
- return value.reverse();
25
- };
26
- const sortArrayMutator = async (value, context) => {
27
- if (!Array.isArray(value))
28
- return value;
29
- const sortDirection = context.options.direction ?? "asc";
30
- const sortByKey = context.options.key ?? null;
31
- return value.sort((a, b) => {
32
- if (sortByKey) {
33
- const aValue = get(a, sortByKey);
34
- const bValue = get(b, sortByKey);
35
- if (sortDirection === "asc") {
36
- return aValue - bValue;
37
- }
38
- return bValue - aValue;
39
- }
40
- if (sortDirection === "asc") {
41
- return a - b;
42
- }
43
- return b - a;
44
- });
45
- };
46
- const uniqueArrayMutator = async (value) => {
47
- return [...new Set(value)];
48
- };
49
- // Works only with objects
50
- const stripUnknownMutator = async (value, context) => {
51
- const allowedKeys = [
52
- ...(context.ctx.schema ? Object.keys(context.ctx.schema) : []),
53
- ...(context.options.allowedKeys ?? []),
54
- ];
55
- const result = {};
56
- for (const key in value) {
57
- if (allowedKeys.includes(key)) {
58
- result[key] = value[key];
59
- }
60
- }
61
- return result;
62
- };
63
- const objectTrimMutator = async (value, context) => {
64
- if (!isPlainObject(value))
65
- return value;
66
- const result = {};
67
- const recursive = context.options.recursive ?? false;
68
- for (const key in value) {
69
- const item = value[key];
70
- if (recursive) {
71
- if (Array.isArray(item)) {
72
- result[key] = await Promise.all(item.map(async (i) => typeof i === "string"
73
- ? trim(i)
74
- : await objectTrimMutator(i, context)));
75
- }
76
- else if (isPlainObject(item)) {
77
- result[key] = await objectTrimMutator(item, context);
78
- }
79
- else {
80
- result[key] = typeof item === "string" ? trim(item) : item;
81
- }
82
- }
83
- else {
84
- result[key] = typeof item === "string" ? trim(item) : item;
85
- }
86
- }
87
- return result;
88
- };export{capitalizeMutator,dateMutator,flipArrayMutator,lowercaseMutator,numberMutator,objectTrimMutator,sortArrayMutator,stringMutator,stripUnknownMutator,uniqueArrayMutator,uppercaseMutator};//# sourceMappingURL=mutators.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mutators.js","sources":["../../../src/validator/v/mutators.ts"],"sourcesContent":[null],"names":[],"mappings":"iHAIa,WAAW,GAAY,OAAM,IAAI,KAAG;AAC/C,IAAA,OAAO,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC;AACxB,EAAE;MAMW,gBAAgB,GAAY,OAAM,KAAK,KAAG;AACrD,IAAA,OAAO,KAAK,CAAC,QAAQ,EAAE,CAAC,WAAW,EAAE,CAAC;AACxC,EAAE;MAEW,gBAAgB,GAAY,OAAM,KAAK,KAAG;AACrD,IAAA,OAAO,KAAK,CAAC,QAAQ,EAAE,CAAC,WAAW,EAAE,CAAC;AACxC,EAAE;MAEW,iBAAiB,GAAY,OAAM,KAAK,KAAG;AACtD,IAAA,OAAO,UAAU,CAAC,KAAK,CAAC,CAAC;AAC3B,EAAE;MAEW,aAAa,GAAY,OAAM,KAAK,KAAG;AAClD,IAAA,IAAI,CAAC,KAAK;AAAE,QAAA,OAAO,KAAK,CAAC;AAEzB,IAAA,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;AACvB,EAAE;MASW,aAAa,GAAY,OAA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BAC9B,MAAM,CAAC,GAAG,CAAC,GAAG,MAAM,iBAAiB,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;AACtD,aAAA;AAAM,iBAAA;AACL,gBAAA,MAAM,CAAC,GAAG,CAAC,GAAG,OAAO,IAAI,KAAK,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;AAC5D,aAAA;AACF,SAAA;AAAM,aAAA;AACL,YAAA,MAAM,CAAC,GAAG,CAAC,GAAG,OAAO,IAAI,KAAK,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;AAC5D,SAAA;AACF,KAAA;AAED,IAAA,OAAO,MAAM,CAAC;AAChB"}
@@ -1,21 +0,0 @@
1
- import { NumberRule } from "./../rules";
2
- import { BaseValidator } from "./base-validator";
3
- export declare class NumberValidator extends BaseValidator {
4
- /**
5
- * Validator name
6
- */
7
- name: string;
8
- /**
9
- * Base rule
10
- */
11
- protected baseRule: NumberRule;
12
- /**
13
- * Check if value matches the given min value
14
- */
15
- min(length: number, errorMessage?: string): this;
16
- /**
17
- * Check if value matches the given max value
18
- */
19
- max(length: number, errorMessage?: string): this;
20
- }
21
- //# sourceMappingURL=number-validator.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"number-validator.d.ts","sourceRoot":"","sources":["../../../src/validator/v/number-validator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,UAAU,EAAE,MAAM,YAAY,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD,qBAAa,eAAgB,SAAQ,aAAa;IAChD;;OAEG;IACI,IAAI,SAAY;IAEvB;;OAEG;IACH,SAAS,CAAC,QAAQ,aAAoB;IAEtC;;OAEG;IACI,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM;IAOhD;;OAEG;IACI,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM;CAMjD"}
@@ -1,37 +0,0 @@
1
- import { type GenericObject } from "@mongez/reinforcements";
2
- import { ObjectRule } from "./../rules";
3
- import { BaseValidator } from "./base-validator";
4
- export declare class ObjectValidator extends BaseValidator {
5
- /**
6
- * Validator name
7
- */
8
- name: string;
9
- /**
10
- * Base rule
11
- */
12
- protected baseRule: ObjectRule;
13
- /**
14
- * Whether to allow unknown keys
15
- */
16
- protected allowUnknownKeys: boolean;
17
- /**
18
- * Whether to allow unknown keys
19
- */
20
- unknown(allow?: boolean): this;
21
- /**
22
- * Allow unknown keys
23
- *
24
- * @alias unknown(true)
25
- */
26
- allowUnknown(): this;
27
- /**
28
- * Set object validation
29
- */
30
- setObject(object: GenericObject<BaseValidator>): this;
31
- /**
32
- * {@inheritdoc}
33
- */
34
- validate(): Promise<void>;
35
- protected prepareErrorsList(): any[];
36
- }
37
- //# sourceMappingURL=object-validator.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"object-validator.d.ts","sourceRoot":"","sources":["../../../src/validator/v/object-validator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD,qBAAa,eAAgB,SAAQ,aAAa;IAChD;;OAEG;IACI,IAAI,SAAY;IAEvB;;OAEG;IACH,SAAS,CAAC,QAAQ,aAAoB;IAEtC;;OAEG;IACH,SAAS,CAAC,gBAAgB,UAAS;IAEnC;;OAEG;IACI,OAAO,CAAC,KAAK,UAAO;IAK3B;;;;OAIG;IACI,YAAY;IAInB;;OAEG;IACI,SAAS,CAAC,MAAM,EAAE,aAAa,CAAC,aAAa,CAAC;IAKrD;;OAEG;IACU,QAAQ;IA0CrB,SAAS,CAAC,iBAAiB;CAO5B"}