@warlock.js/seal 3.0.14

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 (642) hide show
  1. package/README.md +373 -0
  2. package/cjs/config.d.ts +48 -0
  3. package/cjs/config.d.ts.map +1 -0
  4. package/cjs/config.js +42 -0
  5. package/cjs/config.js.map +1 -0
  6. package/cjs/factory/index.d.ts +3 -0
  7. package/cjs/factory/index.d.ts.map +1 -0
  8. package/cjs/factory/validate.d.ts +8 -0
  9. package/cjs/factory/validate.d.ts.map +1 -0
  10. package/cjs/factory/validate.js +21 -0
  11. package/cjs/factory/validate.js.map +1 -0
  12. package/cjs/factory/validators.d.ts +32 -0
  13. package/cjs/factory/validators.d.ts.map +1 -0
  14. package/cjs/factory/validators.js +38 -0
  15. package/cjs/factory/validators.js.map +1 -0
  16. package/cjs/helpers/date-helpers.d.ts +16 -0
  17. package/cjs/helpers/date-helpers.d.ts.map +1 -0
  18. package/cjs/helpers/date-helpers.js +25 -0
  19. package/cjs/helpers/date-helpers.js.map +1 -0
  20. package/cjs/helpers/get-field-value.d.ts +37 -0
  21. package/cjs/helpers/get-field-value.d.ts.map +1 -0
  22. package/cjs/helpers/get-field-value.js +40 -0
  23. package/cjs/helpers/get-field-value.js.map +1 -0
  24. package/cjs/helpers/index.d.ts +5 -0
  25. package/cjs/helpers/index.d.ts.map +1 -0
  26. package/cjs/helpers/path-helpers.d.ts +5 -0
  27. package/cjs/helpers/path-helpers.d.ts.map +1 -0
  28. package/cjs/helpers/path-helpers.js +8 -0
  29. package/cjs/helpers/path-helpers.js.map +1 -0
  30. package/cjs/helpers/validation-helpers.d.ts +4 -0
  31. package/cjs/helpers/validation-helpers.d.ts.map +1 -0
  32. package/cjs/helpers/validation-helpers.js +39 -0
  33. package/cjs/helpers/validation-helpers.js.map +1 -0
  34. package/cjs/index.d.ts +29 -0
  35. package/cjs/index.d.ts.map +1 -0
  36. package/cjs/index.js +1 -0
  37. package/cjs/index.js.map +1 -0
  38. package/cjs/mutators/array-mutators.d.ts +12 -0
  39. package/cjs/mutators/array-mutators.d.ts.map +1 -0
  40. package/cjs/mutators/array-mutators.js +37 -0
  41. package/cjs/mutators/array-mutators.js.map +1 -0
  42. package/cjs/mutators/date-mutators.d.ts +39 -0
  43. package/cjs/mutators/date-mutators.d.ts.map +1 -0
  44. package/cjs/mutators/date-mutators.js +120 -0
  45. package/cjs/mutators/date-mutators.js.map +1 -0
  46. package/cjs/mutators/index.d.ts +6 -0
  47. package/cjs/mutators/index.d.ts.map +1 -0
  48. package/cjs/mutators/number-mutators.d.ts +8 -0
  49. package/cjs/mutators/number-mutators.d.ts.map +1 -0
  50. package/cjs/mutators/number-mutators.js +18 -0
  51. package/cjs/mutators/number-mutators.js.map +1 -0
  52. package/cjs/mutators/object-mutators.d.ts +8 -0
  53. package/cjs/mutators/object-mutators.d.ts.map +1 -0
  54. package/cjs/mutators/object-mutators.js +50 -0
  55. package/cjs/mutators/object-mutators.js.map +1 -0
  56. package/cjs/mutators/string-mutators.d.ts +72 -0
  57. package/cjs/mutators/string-mutators.d.ts.map +1 -0
  58. package/cjs/mutators/string-mutators.js +193 -0
  59. package/cjs/mutators/string-mutators.js.map +1 -0
  60. package/cjs/plugins/index.d.ts +7 -0
  61. package/cjs/plugins/index.d.ts.map +1 -0
  62. package/cjs/plugins/plugin-system.d.ts +71 -0
  63. package/cjs/plugins/plugin-system.d.ts.map +1 -0
  64. package/cjs/plugins/plugin-system.js +68 -0
  65. package/cjs/plugins/plugin-system.js.map +1 -0
  66. package/cjs/rules/array/array-rules.d.ts +12 -0
  67. package/cjs/rules/array/array-rules.d.ts.map +1 -0
  68. package/cjs/rules/array/array-rules.js +44 -0
  69. package/cjs/rules/array/array-rules.js.map +1 -0
  70. package/cjs/rules/array/index.d.ts +2 -0
  71. package/cjs/rules/array/index.d.ts.map +1 -0
  72. package/cjs/rules/color/color-rules.d.ts +30 -0
  73. package/cjs/rules/color/color-rules.d.ts.map +1 -0
  74. package/cjs/rules/color/color-rules.js +120 -0
  75. package/cjs/rules/color/color-rules.js.map +1 -0
  76. package/cjs/rules/color/index.d.ts +2 -0
  77. package/cjs/rules/color/index.d.ts.map +1 -0
  78. package/cjs/rules/common/enum.d.ts +26 -0
  79. package/cjs/rules/common/enum.d.ts.map +1 -0
  80. package/cjs/rules/common/enum.js +55 -0
  81. package/cjs/rules/common/enum.js.map +1 -0
  82. package/cjs/rules/common/equals-field-rules.d.ts +18 -0
  83. package/cjs/rules/common/equals-field-rules.d.ts.map +1 -0
  84. package/cjs/rules/common/equals-field-rules.js +38 -0
  85. package/cjs/rules/common/equals-field-rules.js.map +1 -0
  86. package/cjs/rules/common/index.d.ts +5 -0
  87. package/cjs/rules/common/index.d.ts.map +1 -0
  88. package/cjs/rules/common/type-rules.d.ts +34 -0
  89. package/cjs/rules/common/type-rules.d.ts.map +1 -0
  90. package/cjs/rules/common/type-rules.js +104 -0
  91. package/cjs/rules/common/type-rules.js.map +1 -0
  92. package/cjs/rules/common/unknown-key.d.ts +9 -0
  93. package/cjs/rules/common/unknown-key.d.ts.map +1 -0
  94. package/cjs/rules/common/unknown-key.js +20 -0
  95. package/cjs/rules/common/unknown-key.js.map +1 -0
  96. package/cjs/rules/conditional/index.d.ts +9 -0
  97. package/cjs/rules/conditional/index.d.ts.map +1 -0
  98. package/cjs/rules/conditional/present-if-rules.d.ts +45 -0
  99. package/cjs/rules/conditional/present-if-rules.d.ts.map +1 -0
  100. package/cjs/rules/conditional/present-if-rules.js +98 -0
  101. package/cjs/rules/conditional/present-if-rules.js.map +1 -0
  102. package/cjs/rules/conditional/present-unless-rules.d.ts +11 -0
  103. package/cjs/rules/conditional/present-unless-rules.d.ts.map +1 -0
  104. package/cjs/rules/conditional/present-unless-rules.js +20 -0
  105. package/cjs/rules/conditional/present-unless-rules.js.map +1 -0
  106. package/cjs/rules/conditional/present-with-rules.d.ts +26 -0
  107. package/cjs/rules/conditional/present-with-rules.d.ts.map +1 -0
  108. package/cjs/rules/conditional/present-with-rules.js +63 -0
  109. package/cjs/rules/conditional/present-with-rules.js.map +1 -0
  110. package/cjs/rules/conditional/present-without-rules.d.ts +26 -0
  111. package/cjs/rules/conditional/present-without-rules.d.ts.map +1 -0
  112. package/cjs/rules/conditional/present-without-rules.js +63 -0
  113. package/cjs/rules/conditional/present-without-rules.js.map +1 -0
  114. package/cjs/rules/conditional/required-if-rules.d.ts +45 -0
  115. package/cjs/rules/conditional/required-if-rules.d.ts.map +1 -0
  116. package/cjs/rules/conditional/required-if-rules.js +98 -0
  117. package/cjs/rules/conditional/required-if-rules.js.map +1 -0
  118. package/cjs/rules/conditional/required-unless-rules.d.ts +11 -0
  119. package/cjs/rules/conditional/required-unless-rules.d.ts.map +1 -0
  120. package/cjs/rules/conditional/required-unless-rules.js +20 -0
  121. package/cjs/rules/conditional/required-unless-rules.js.map +1 -0
  122. package/cjs/rules/conditional/required-with-rules.d.ts +26 -0
  123. package/cjs/rules/conditional/required-with-rules.d.ts.map +1 -0
  124. package/cjs/rules/conditional/required-with-rules.js +63 -0
  125. package/cjs/rules/conditional/required-with-rules.js.map +1 -0
  126. package/cjs/rules/conditional/required-without-rules.d.ts +26 -0
  127. package/cjs/rules/conditional/required-without-rules.d.ts.map +1 -0
  128. package/cjs/rules/conditional/required-without-rules.js +63 -0
  129. package/cjs/rules/conditional/required-without-rules.js.map +1 -0
  130. package/cjs/rules/core/equal.d.ts +8 -0
  131. package/cjs/rules/core/equal.d.ts.map +1 -0
  132. package/cjs/rules/core/equal.js +13 -0
  133. package/cjs/rules/core/equal.js.map +1 -0
  134. package/cjs/rules/core/forbidden.d.ts +6 -0
  135. package/cjs/rules/core/forbidden.d.ts.map +1 -0
  136. package/cjs/rules/core/forbidden.js +13 -0
  137. package/cjs/rules/core/forbidden.js.map +1 -0
  138. package/cjs/rules/core/index.d.ts +5 -0
  139. package/cjs/rules/core/index.d.ts.map +1 -0
  140. package/cjs/rules/core/required.d.ts +11 -0
  141. package/cjs/rules/core/required.d.ts.map +1 -0
  142. package/cjs/rules/core/required.js +31 -0
  143. package/cjs/rules/core/required.js.map +1 -0
  144. package/cjs/rules/core/when.d.ts +6 -0
  145. package/cjs/rules/core/when.d.ts.map +1 -0
  146. package/cjs/rules/core/when.js +40 -0
  147. package/cjs/rules/core/when.js.map +1 -0
  148. package/cjs/rules/date/date-comparison-rules.d.ts +25 -0
  149. package/cjs/rules/date/date-comparison-rules.d.ts.map +1 -0
  150. package/cjs/rules/date/date-comparison-rules.js +78 -0
  151. package/cjs/rules/date/date-comparison-rules.js.map +1 -0
  152. package/cjs/rules/date/date-day-rules.d.ts +21 -0
  153. package/cjs/rules/date/date-day-rules.d.ts.map +1 -0
  154. package/cjs/rules/date/date-day-rules.js +65 -0
  155. package/cjs/rules/date/date-day-rules.js.map +1 -0
  156. package/cjs/rules/date/date-field-comparison-rules.d.ts +28 -0
  157. package/cjs/rules/date/date-field-comparison-rules.d.ts.map +1 -0
  158. package/cjs/rules/date/date-field-comparison-rules.js +90 -0
  159. package/cjs/rules/date/date-field-comparison-rules.js.map +1 -0
  160. package/cjs/rules/date/date-period-rules.d.ts +108 -0
  161. package/cjs/rules/date/date-period-rules.d.ts.map +1 -0
  162. package/cjs/rules/date/date-period-rules.js +566 -0
  163. package/cjs/rules/date/date-period-rules.js.map +1 -0
  164. package/cjs/rules/date/date-relative-rules.d.ts +20 -0
  165. package/cjs/rules/date/date-relative-rules.d.ts.map +1 -0
  166. package/cjs/rules/date/date-relative-rules.js +57 -0
  167. package/cjs/rules/date/date-relative-rules.js.map +1 -0
  168. package/cjs/rules/date/date-special-rules.d.ts +20 -0
  169. package/cjs/rules/date/date-special-rules.d.ts.map +1 -0
  170. package/cjs/rules/date/date-special-rules.js +72 -0
  171. package/cjs/rules/date/date-special-rules.js.map +1 -0
  172. package/cjs/rules/date/date.d.ts +93 -0
  173. package/cjs/rules/date/date.d.ts.map +1 -0
  174. package/cjs/rules/date/date.js +279 -0
  175. package/cjs/rules/date/date.js.map +1 -0
  176. package/cjs/rules/date/index.d.ts +8 -0
  177. package/cjs/rules/date/index.d.ts.map +1 -0
  178. package/cjs/rules/file/dimensions.d.ts +26 -0
  179. package/cjs/rules/file/dimensions.d.ts.map +1 -0
  180. package/cjs/rules/file/dimensions.js +56 -0
  181. package/cjs/rules/file/dimensions.js.map +1 -0
  182. package/cjs/rules/file/file-size.d.ts +14 -0
  183. package/cjs/rules/file/file-size.d.ts.map +1 -0
  184. package/cjs/rules/file/file-size.js +26 -0
  185. package/cjs/rules/file/file-size.js.map +1 -0
  186. package/cjs/rules/file/index.d.ts +11 -0
  187. package/cjs/rules/file/index.d.ts.map +1 -0
  188. package/cjs/rules/index.d.ts +19 -0
  189. package/cjs/rules/index.d.ts.map +1 -0
  190. package/cjs/rules/length/index.d.ts +2 -0
  191. package/cjs/rules/length/index.d.ts.map +1 -0
  192. package/cjs/rules/length/length-rules.d.ts +49 -0
  193. package/cjs/rules/length/length-rules.d.ts.map +1 -0
  194. package/cjs/rules/length/length-rules.js +116 -0
  195. package/cjs/rules/length/length-rules.js.map +1 -0
  196. package/cjs/rules/number/index.d.ts +2 -0
  197. package/cjs/rules/number/index.d.ts.map +1 -0
  198. package/cjs/rules/number/number-rules.d.ts +43 -0
  199. package/cjs/rules/number/number-rules.d.ts.map +1 -0
  200. package/cjs/rules/number/number-rules.js +107 -0
  201. package/cjs/rules/number/number-rules.js.map +1 -0
  202. package/cjs/rules/scalar/accepted-rule.d.ts +39 -0
  203. package/cjs/rules/scalar/accepted-rule.d.ts.map +1 -0
  204. package/cjs/rules/scalar/accepted-rule.js +110 -0
  205. package/cjs/rules/scalar/accepted-rule.js.map +1 -0
  206. package/cjs/rules/scalar/declined-rule.d.ts +39 -0
  207. package/cjs/rules/scalar/declined-rule.d.ts.map +1 -0
  208. package/cjs/rules/scalar/declined-rule.js +110 -0
  209. package/cjs/rules/scalar/declined-rule.js.map +1 -0
  210. package/cjs/rules/scalar/index.d.ts +3 -0
  211. package/cjs/rules/scalar/index.d.ts.map +1 -0
  212. package/cjs/rules/string/alpha.d.ts +14 -0
  213. package/cjs/rules/string/alpha.d.ts.map +1 -0
  214. package/cjs/rules/string/alpha.js +39 -0
  215. package/cjs/rules/string/alpha.js.map +1 -0
  216. package/cjs/rules/string/credit-card.d.ts +6 -0
  217. package/cjs/rules/string/credit-card.d.ts.map +1 -0
  218. package/cjs/rules/string/credit-card.js +31 -0
  219. package/cjs/rules/string/credit-card.js.map +1 -0
  220. package/cjs/rules/string/email.d.ts +6 -0
  221. package/cjs/rules/string/email.d.ts.map +1 -0
  222. package/cjs/rules/string/email.js +13 -0
  223. package/cjs/rules/string/email.js.map +1 -0
  224. package/cjs/rules/string/index.d.ts +17 -0
  225. package/cjs/rules/string/index.d.ts.map +1 -0
  226. package/cjs/rules/string/ip.d.ts +14 -0
  227. package/cjs/rules/string/ip.d.ts.map +1 -0
  228. package/cjs/rules/string/ip.js +39 -0
  229. package/cjs/rules/string/ip.js.map +1 -0
  230. package/cjs/rules/string/matches.d.ts +8 -0
  231. package/cjs/rules/string/matches.d.ts.map +1 -0
  232. package/cjs/rules/string/matches.js +14 -0
  233. package/cjs/rules/string/matches.js.map +1 -0
  234. package/cjs/rules/string/pattern.d.ts +8 -0
  235. package/cjs/rules/string/pattern.d.ts.map +1 -0
  236. package/cjs/rules/string/pattern.js +13 -0
  237. package/cjs/rules/string/pattern.js.map +1 -0
  238. package/cjs/rules/string/string-comparison.d.ts +26 -0
  239. package/cjs/rules/string/string-comparison.d.ts.map +1 -0
  240. package/cjs/rules/string/string-comparison.js +52 -0
  241. package/cjs/rules/string/string-comparison.js.map +1 -0
  242. package/cjs/rules/string/strong-password-rule.d.ts +14 -0
  243. package/cjs/rules/string/strong-password-rule.d.ts.map +1 -0
  244. package/cjs/rules/string/strong-password-rule.js +38 -0
  245. package/cjs/rules/string/strong-password-rule.js.map +1 -0
  246. package/cjs/rules/string/url.d.ts +6 -0
  247. package/cjs/rules/string/url.d.ts.map +1 -0
  248. package/cjs/rules/string/url.js +16 -0
  249. package/cjs/rules/string/url.js.map +1 -0
  250. package/cjs/rules/string/without-whitespace.d.ts +6 -0
  251. package/cjs/rules/string/without-whitespace.d.ts.map +1 -0
  252. package/cjs/rules/string/without-whitespace.js +13 -0
  253. package/cjs/rules/string/without-whitespace.js.map +1 -0
  254. package/cjs/types/conditional-types.d.ts +15 -0
  255. package/cjs/types/conditional-types.d.ts.map +1 -0
  256. package/cjs/types/context-types.d.ts +44 -0
  257. package/cjs/types/context-types.d.ts.map +1 -0
  258. package/cjs/types/data-transformer-types.d.ts +25 -0
  259. package/cjs/types/data-transformer-types.d.ts.map +1 -0
  260. package/cjs/types/date-types.d.ts +9 -0
  261. package/cjs/types/date-types.d.ts.map +1 -0
  262. package/cjs/types/date-types.js +12 -0
  263. package/cjs/types/date-types.js.map +1 -0
  264. package/cjs/types/index.d.ts +10 -0
  265. package/cjs/types/index.d.ts.map +1 -0
  266. package/cjs/types/inference-types.d.ts +29 -0
  267. package/cjs/types/inference-types.d.ts.map +1 -0
  268. package/cjs/types/mutator-types.d.ts +27 -0
  269. package/cjs/types/mutator-types.d.ts.map +1 -0
  270. package/cjs/types/result-types.d.ts +19 -0
  271. package/cjs/types/result-types.d.ts.map +1 -0
  272. package/cjs/types/rule-types.d.ts +53 -0
  273. package/cjs/types/rule-types.d.ts.map +1 -0
  274. package/cjs/types/schema-types.d.ts +6 -0
  275. package/cjs/types/schema-types.d.ts.map +1 -0
  276. package/cjs/validators/any-validator.d.ts +7 -0
  277. package/cjs/validators/any-validator.d.ts.map +1 -0
  278. package/cjs/validators/any-validator.js +5 -0
  279. package/cjs/validators/any-validator.js.map +1 -0
  280. package/cjs/validators/array-validator.d.ts +51 -0
  281. package/cjs/validators/array-validator.d.ts.map +1 -0
  282. package/cjs/validators/array-validator.js +120 -0
  283. package/cjs/validators/array-validator.js.map +1 -0
  284. package/cjs/validators/base-validator.d.ts +500 -0
  285. package/cjs/validators/base-validator.d.ts.map +1 -0
  286. package/cjs/validators/base-validator.js +950 -0
  287. package/cjs/validators/base-validator.js.map +1 -0
  288. package/cjs/validators/boolean-validator.d.ts +43 -0
  289. package/cjs/validators/boolean-validator.d.ts.map +1 -0
  290. package/cjs/validators/boolean-validator.js +48 -0
  291. package/cjs/validators/boolean-validator.js.map +1 -0
  292. package/cjs/validators/date-validator.d.ts +303 -0
  293. package/cjs/validators/date-validator.d.ts.map +1 -0
  294. package/cjs/validators/date-validator.js +639 -0
  295. package/cjs/validators/date-validator.js.map +1 -0
  296. package/cjs/validators/float-validator.d.ts +8 -0
  297. package/cjs/validators/float-validator.d.ts.map +1 -0
  298. package/cjs/validators/float-validator.js +9 -0
  299. package/cjs/validators/float-validator.js.map +1 -0
  300. package/cjs/validators/index.d.ts +20 -0
  301. package/cjs/validators/index.d.ts.map +1 -0
  302. package/cjs/validators/int-validator.d.ts +8 -0
  303. package/cjs/validators/int-validator.d.ts.map +1 -0
  304. package/cjs/validators/int-validator.js +9 -0
  305. package/cjs/validators/int-validator.js.map +1 -0
  306. package/cjs/validators/number-validator.d.ts +35 -0
  307. package/cjs/validators/number-validator.d.ts.map +1 -0
  308. package/cjs/validators/number-validator.js +66 -0
  309. package/cjs/validators/number-validator.js.map +1 -0
  310. package/cjs/validators/object-validator.d.ts +24 -0
  311. package/cjs/validators/object-validator.d.ts.map +1 -0
  312. package/cjs/validators/object-validator.js +120 -0
  313. package/cjs/validators/object-validator.js.map +1 -0
  314. package/cjs/validators/scalar-validator.d.ts +74 -0
  315. package/cjs/validators/scalar-validator.d.ts.map +1 -0
  316. package/cjs/validators/scalar-validator.js +145 -0
  317. package/cjs/validators/scalar-validator.js.map +1 -0
  318. package/cjs/validators/string-validator.d.ts +187 -0
  319. package/cjs/validators/string-validator.d.ts.map +1 -0
  320. package/cjs/validators/string-validator.js +404 -0
  321. package/cjs/validators/string-validator.js.map +1 -0
  322. package/esm/config.d.ts +48 -0
  323. package/esm/config.d.ts.map +1 -0
  324. package/esm/config.js +42 -0
  325. package/esm/config.js.map +1 -0
  326. package/esm/factory/index.d.ts +3 -0
  327. package/esm/factory/index.d.ts.map +1 -0
  328. package/esm/factory/validate.d.ts +8 -0
  329. package/esm/factory/validate.d.ts.map +1 -0
  330. package/esm/factory/validate.js +21 -0
  331. package/esm/factory/validate.js.map +1 -0
  332. package/esm/factory/validators.d.ts +32 -0
  333. package/esm/factory/validators.d.ts.map +1 -0
  334. package/esm/factory/validators.js +38 -0
  335. package/esm/factory/validators.js.map +1 -0
  336. package/esm/helpers/date-helpers.d.ts +16 -0
  337. package/esm/helpers/date-helpers.d.ts.map +1 -0
  338. package/esm/helpers/date-helpers.js +25 -0
  339. package/esm/helpers/date-helpers.js.map +1 -0
  340. package/esm/helpers/get-field-value.d.ts +37 -0
  341. package/esm/helpers/get-field-value.d.ts.map +1 -0
  342. package/esm/helpers/get-field-value.js +40 -0
  343. package/esm/helpers/get-field-value.js.map +1 -0
  344. package/esm/helpers/index.d.ts +5 -0
  345. package/esm/helpers/index.d.ts.map +1 -0
  346. package/esm/helpers/path-helpers.d.ts +5 -0
  347. package/esm/helpers/path-helpers.d.ts.map +1 -0
  348. package/esm/helpers/path-helpers.js +8 -0
  349. package/esm/helpers/path-helpers.js.map +1 -0
  350. package/esm/helpers/validation-helpers.d.ts +4 -0
  351. package/esm/helpers/validation-helpers.d.ts.map +1 -0
  352. package/esm/helpers/validation-helpers.js +39 -0
  353. package/esm/helpers/validation-helpers.js.map +1 -0
  354. package/esm/index.d.ts +29 -0
  355. package/esm/index.d.ts.map +1 -0
  356. package/esm/index.js +1 -0
  357. package/esm/index.js.map +1 -0
  358. package/esm/mutators/array-mutators.d.ts +12 -0
  359. package/esm/mutators/array-mutators.d.ts.map +1 -0
  360. package/esm/mutators/array-mutators.js +37 -0
  361. package/esm/mutators/array-mutators.js.map +1 -0
  362. package/esm/mutators/date-mutators.d.ts +39 -0
  363. package/esm/mutators/date-mutators.d.ts.map +1 -0
  364. package/esm/mutators/date-mutators.js +120 -0
  365. package/esm/mutators/date-mutators.js.map +1 -0
  366. package/esm/mutators/index.d.ts +6 -0
  367. package/esm/mutators/index.d.ts.map +1 -0
  368. package/esm/mutators/number-mutators.d.ts +8 -0
  369. package/esm/mutators/number-mutators.d.ts.map +1 -0
  370. package/esm/mutators/number-mutators.js +18 -0
  371. package/esm/mutators/number-mutators.js.map +1 -0
  372. package/esm/mutators/object-mutators.d.ts +8 -0
  373. package/esm/mutators/object-mutators.d.ts.map +1 -0
  374. package/esm/mutators/object-mutators.js +50 -0
  375. package/esm/mutators/object-mutators.js.map +1 -0
  376. package/esm/mutators/string-mutators.d.ts +72 -0
  377. package/esm/mutators/string-mutators.d.ts.map +1 -0
  378. package/esm/mutators/string-mutators.js +193 -0
  379. package/esm/mutators/string-mutators.js.map +1 -0
  380. package/esm/plugins/index.d.ts +7 -0
  381. package/esm/plugins/index.d.ts.map +1 -0
  382. package/esm/plugins/plugin-system.d.ts +71 -0
  383. package/esm/plugins/plugin-system.d.ts.map +1 -0
  384. package/esm/plugins/plugin-system.js +68 -0
  385. package/esm/plugins/plugin-system.js.map +1 -0
  386. package/esm/rules/array/array-rules.d.ts +12 -0
  387. package/esm/rules/array/array-rules.d.ts.map +1 -0
  388. package/esm/rules/array/array-rules.js +44 -0
  389. package/esm/rules/array/array-rules.js.map +1 -0
  390. package/esm/rules/array/index.d.ts +2 -0
  391. package/esm/rules/array/index.d.ts.map +1 -0
  392. package/esm/rules/color/color-rules.d.ts +30 -0
  393. package/esm/rules/color/color-rules.d.ts.map +1 -0
  394. package/esm/rules/color/color-rules.js +120 -0
  395. package/esm/rules/color/color-rules.js.map +1 -0
  396. package/esm/rules/color/index.d.ts +2 -0
  397. package/esm/rules/color/index.d.ts.map +1 -0
  398. package/esm/rules/common/enum.d.ts +26 -0
  399. package/esm/rules/common/enum.d.ts.map +1 -0
  400. package/esm/rules/common/enum.js +55 -0
  401. package/esm/rules/common/enum.js.map +1 -0
  402. package/esm/rules/common/equals-field-rules.d.ts +18 -0
  403. package/esm/rules/common/equals-field-rules.d.ts.map +1 -0
  404. package/esm/rules/common/equals-field-rules.js +38 -0
  405. package/esm/rules/common/equals-field-rules.js.map +1 -0
  406. package/esm/rules/common/index.d.ts +5 -0
  407. package/esm/rules/common/index.d.ts.map +1 -0
  408. package/esm/rules/common/type-rules.d.ts +34 -0
  409. package/esm/rules/common/type-rules.d.ts.map +1 -0
  410. package/esm/rules/common/type-rules.js +104 -0
  411. package/esm/rules/common/type-rules.js.map +1 -0
  412. package/esm/rules/common/unknown-key.d.ts +9 -0
  413. package/esm/rules/common/unknown-key.d.ts.map +1 -0
  414. package/esm/rules/common/unknown-key.js +20 -0
  415. package/esm/rules/common/unknown-key.js.map +1 -0
  416. package/esm/rules/conditional/index.d.ts +9 -0
  417. package/esm/rules/conditional/index.d.ts.map +1 -0
  418. package/esm/rules/conditional/present-if-rules.d.ts +45 -0
  419. package/esm/rules/conditional/present-if-rules.d.ts.map +1 -0
  420. package/esm/rules/conditional/present-if-rules.js +98 -0
  421. package/esm/rules/conditional/present-if-rules.js.map +1 -0
  422. package/esm/rules/conditional/present-unless-rules.d.ts +11 -0
  423. package/esm/rules/conditional/present-unless-rules.d.ts.map +1 -0
  424. package/esm/rules/conditional/present-unless-rules.js +20 -0
  425. package/esm/rules/conditional/present-unless-rules.js.map +1 -0
  426. package/esm/rules/conditional/present-with-rules.d.ts +26 -0
  427. package/esm/rules/conditional/present-with-rules.d.ts.map +1 -0
  428. package/esm/rules/conditional/present-with-rules.js +63 -0
  429. package/esm/rules/conditional/present-with-rules.js.map +1 -0
  430. package/esm/rules/conditional/present-without-rules.d.ts +26 -0
  431. package/esm/rules/conditional/present-without-rules.d.ts.map +1 -0
  432. package/esm/rules/conditional/present-without-rules.js +63 -0
  433. package/esm/rules/conditional/present-without-rules.js.map +1 -0
  434. package/esm/rules/conditional/required-if-rules.d.ts +45 -0
  435. package/esm/rules/conditional/required-if-rules.d.ts.map +1 -0
  436. package/esm/rules/conditional/required-if-rules.js +98 -0
  437. package/esm/rules/conditional/required-if-rules.js.map +1 -0
  438. package/esm/rules/conditional/required-unless-rules.d.ts +11 -0
  439. package/esm/rules/conditional/required-unless-rules.d.ts.map +1 -0
  440. package/esm/rules/conditional/required-unless-rules.js +20 -0
  441. package/esm/rules/conditional/required-unless-rules.js.map +1 -0
  442. package/esm/rules/conditional/required-with-rules.d.ts +26 -0
  443. package/esm/rules/conditional/required-with-rules.d.ts.map +1 -0
  444. package/esm/rules/conditional/required-with-rules.js +63 -0
  445. package/esm/rules/conditional/required-with-rules.js.map +1 -0
  446. package/esm/rules/conditional/required-without-rules.d.ts +26 -0
  447. package/esm/rules/conditional/required-without-rules.d.ts.map +1 -0
  448. package/esm/rules/conditional/required-without-rules.js +63 -0
  449. package/esm/rules/conditional/required-without-rules.js.map +1 -0
  450. package/esm/rules/core/equal.d.ts +8 -0
  451. package/esm/rules/core/equal.d.ts.map +1 -0
  452. package/esm/rules/core/equal.js +13 -0
  453. package/esm/rules/core/equal.js.map +1 -0
  454. package/esm/rules/core/forbidden.d.ts +6 -0
  455. package/esm/rules/core/forbidden.d.ts.map +1 -0
  456. package/esm/rules/core/forbidden.js +13 -0
  457. package/esm/rules/core/forbidden.js.map +1 -0
  458. package/esm/rules/core/index.d.ts +5 -0
  459. package/esm/rules/core/index.d.ts.map +1 -0
  460. package/esm/rules/core/required.d.ts +11 -0
  461. package/esm/rules/core/required.d.ts.map +1 -0
  462. package/esm/rules/core/required.js +31 -0
  463. package/esm/rules/core/required.js.map +1 -0
  464. package/esm/rules/core/when.d.ts +6 -0
  465. package/esm/rules/core/when.d.ts.map +1 -0
  466. package/esm/rules/core/when.js +40 -0
  467. package/esm/rules/core/when.js.map +1 -0
  468. package/esm/rules/date/date-comparison-rules.d.ts +25 -0
  469. package/esm/rules/date/date-comparison-rules.d.ts.map +1 -0
  470. package/esm/rules/date/date-comparison-rules.js +78 -0
  471. package/esm/rules/date/date-comparison-rules.js.map +1 -0
  472. package/esm/rules/date/date-day-rules.d.ts +21 -0
  473. package/esm/rules/date/date-day-rules.d.ts.map +1 -0
  474. package/esm/rules/date/date-day-rules.js +65 -0
  475. package/esm/rules/date/date-day-rules.js.map +1 -0
  476. package/esm/rules/date/date-field-comparison-rules.d.ts +28 -0
  477. package/esm/rules/date/date-field-comparison-rules.d.ts.map +1 -0
  478. package/esm/rules/date/date-field-comparison-rules.js +90 -0
  479. package/esm/rules/date/date-field-comparison-rules.js.map +1 -0
  480. package/esm/rules/date/date-period-rules.d.ts +108 -0
  481. package/esm/rules/date/date-period-rules.d.ts.map +1 -0
  482. package/esm/rules/date/date-period-rules.js +566 -0
  483. package/esm/rules/date/date-period-rules.js.map +1 -0
  484. package/esm/rules/date/date-relative-rules.d.ts +20 -0
  485. package/esm/rules/date/date-relative-rules.d.ts.map +1 -0
  486. package/esm/rules/date/date-relative-rules.js +57 -0
  487. package/esm/rules/date/date-relative-rules.js.map +1 -0
  488. package/esm/rules/date/date-special-rules.d.ts +20 -0
  489. package/esm/rules/date/date-special-rules.d.ts.map +1 -0
  490. package/esm/rules/date/date-special-rules.js +72 -0
  491. package/esm/rules/date/date-special-rules.js.map +1 -0
  492. package/esm/rules/date/date.d.ts +93 -0
  493. package/esm/rules/date/date.d.ts.map +1 -0
  494. package/esm/rules/date/date.js +279 -0
  495. package/esm/rules/date/date.js.map +1 -0
  496. package/esm/rules/date/index.d.ts +8 -0
  497. package/esm/rules/date/index.d.ts.map +1 -0
  498. package/esm/rules/file/dimensions.d.ts +26 -0
  499. package/esm/rules/file/dimensions.d.ts.map +1 -0
  500. package/esm/rules/file/dimensions.js +56 -0
  501. package/esm/rules/file/dimensions.js.map +1 -0
  502. package/esm/rules/file/file-size.d.ts +14 -0
  503. package/esm/rules/file/file-size.d.ts.map +1 -0
  504. package/esm/rules/file/file-size.js +26 -0
  505. package/esm/rules/file/file-size.js.map +1 -0
  506. package/esm/rules/file/index.d.ts +11 -0
  507. package/esm/rules/file/index.d.ts.map +1 -0
  508. package/esm/rules/index.d.ts +19 -0
  509. package/esm/rules/index.d.ts.map +1 -0
  510. package/esm/rules/length/index.d.ts +2 -0
  511. package/esm/rules/length/index.d.ts.map +1 -0
  512. package/esm/rules/length/length-rules.d.ts +49 -0
  513. package/esm/rules/length/length-rules.d.ts.map +1 -0
  514. package/esm/rules/length/length-rules.js +116 -0
  515. package/esm/rules/length/length-rules.js.map +1 -0
  516. package/esm/rules/number/index.d.ts +2 -0
  517. package/esm/rules/number/index.d.ts.map +1 -0
  518. package/esm/rules/number/number-rules.d.ts +43 -0
  519. package/esm/rules/number/number-rules.d.ts.map +1 -0
  520. package/esm/rules/number/number-rules.js +107 -0
  521. package/esm/rules/number/number-rules.js.map +1 -0
  522. package/esm/rules/scalar/accepted-rule.d.ts +39 -0
  523. package/esm/rules/scalar/accepted-rule.d.ts.map +1 -0
  524. package/esm/rules/scalar/accepted-rule.js +110 -0
  525. package/esm/rules/scalar/accepted-rule.js.map +1 -0
  526. package/esm/rules/scalar/declined-rule.d.ts +39 -0
  527. package/esm/rules/scalar/declined-rule.d.ts.map +1 -0
  528. package/esm/rules/scalar/declined-rule.js +110 -0
  529. package/esm/rules/scalar/declined-rule.js.map +1 -0
  530. package/esm/rules/scalar/index.d.ts +3 -0
  531. package/esm/rules/scalar/index.d.ts.map +1 -0
  532. package/esm/rules/string/alpha.d.ts +14 -0
  533. package/esm/rules/string/alpha.d.ts.map +1 -0
  534. package/esm/rules/string/alpha.js +39 -0
  535. package/esm/rules/string/alpha.js.map +1 -0
  536. package/esm/rules/string/credit-card.d.ts +6 -0
  537. package/esm/rules/string/credit-card.d.ts.map +1 -0
  538. package/esm/rules/string/credit-card.js +31 -0
  539. package/esm/rules/string/credit-card.js.map +1 -0
  540. package/esm/rules/string/email.d.ts +6 -0
  541. package/esm/rules/string/email.d.ts.map +1 -0
  542. package/esm/rules/string/email.js +13 -0
  543. package/esm/rules/string/email.js.map +1 -0
  544. package/esm/rules/string/index.d.ts +17 -0
  545. package/esm/rules/string/index.d.ts.map +1 -0
  546. package/esm/rules/string/ip.d.ts +14 -0
  547. package/esm/rules/string/ip.d.ts.map +1 -0
  548. package/esm/rules/string/ip.js +39 -0
  549. package/esm/rules/string/ip.js.map +1 -0
  550. package/esm/rules/string/matches.d.ts +8 -0
  551. package/esm/rules/string/matches.d.ts.map +1 -0
  552. package/esm/rules/string/matches.js +14 -0
  553. package/esm/rules/string/matches.js.map +1 -0
  554. package/esm/rules/string/pattern.d.ts +8 -0
  555. package/esm/rules/string/pattern.d.ts.map +1 -0
  556. package/esm/rules/string/pattern.js +13 -0
  557. package/esm/rules/string/pattern.js.map +1 -0
  558. package/esm/rules/string/string-comparison.d.ts +26 -0
  559. package/esm/rules/string/string-comparison.d.ts.map +1 -0
  560. package/esm/rules/string/string-comparison.js +52 -0
  561. package/esm/rules/string/string-comparison.js.map +1 -0
  562. package/esm/rules/string/strong-password-rule.d.ts +14 -0
  563. package/esm/rules/string/strong-password-rule.d.ts.map +1 -0
  564. package/esm/rules/string/strong-password-rule.js +38 -0
  565. package/esm/rules/string/strong-password-rule.js.map +1 -0
  566. package/esm/rules/string/url.d.ts +6 -0
  567. package/esm/rules/string/url.d.ts.map +1 -0
  568. package/esm/rules/string/url.js +16 -0
  569. package/esm/rules/string/url.js.map +1 -0
  570. package/esm/rules/string/without-whitespace.d.ts +6 -0
  571. package/esm/rules/string/without-whitespace.d.ts.map +1 -0
  572. package/esm/rules/string/without-whitespace.js +13 -0
  573. package/esm/rules/string/without-whitespace.js.map +1 -0
  574. package/esm/types/conditional-types.d.ts +15 -0
  575. package/esm/types/conditional-types.d.ts.map +1 -0
  576. package/esm/types/context-types.d.ts +44 -0
  577. package/esm/types/context-types.d.ts.map +1 -0
  578. package/esm/types/data-transformer-types.d.ts +25 -0
  579. package/esm/types/data-transformer-types.d.ts.map +1 -0
  580. package/esm/types/date-types.d.ts +9 -0
  581. package/esm/types/date-types.d.ts.map +1 -0
  582. package/esm/types/date-types.js +12 -0
  583. package/esm/types/date-types.js.map +1 -0
  584. package/esm/types/index.d.ts +10 -0
  585. package/esm/types/index.d.ts.map +1 -0
  586. package/esm/types/inference-types.d.ts +29 -0
  587. package/esm/types/inference-types.d.ts.map +1 -0
  588. package/esm/types/mutator-types.d.ts +27 -0
  589. package/esm/types/mutator-types.d.ts.map +1 -0
  590. package/esm/types/result-types.d.ts +19 -0
  591. package/esm/types/result-types.d.ts.map +1 -0
  592. package/esm/types/rule-types.d.ts +53 -0
  593. package/esm/types/rule-types.d.ts.map +1 -0
  594. package/esm/types/schema-types.d.ts +6 -0
  595. package/esm/types/schema-types.d.ts.map +1 -0
  596. package/esm/validators/any-validator.d.ts +7 -0
  597. package/esm/validators/any-validator.d.ts.map +1 -0
  598. package/esm/validators/any-validator.js +5 -0
  599. package/esm/validators/any-validator.js.map +1 -0
  600. package/esm/validators/array-validator.d.ts +51 -0
  601. package/esm/validators/array-validator.d.ts.map +1 -0
  602. package/esm/validators/array-validator.js +120 -0
  603. package/esm/validators/array-validator.js.map +1 -0
  604. package/esm/validators/base-validator.d.ts +500 -0
  605. package/esm/validators/base-validator.d.ts.map +1 -0
  606. package/esm/validators/base-validator.js +950 -0
  607. package/esm/validators/base-validator.js.map +1 -0
  608. package/esm/validators/boolean-validator.d.ts +43 -0
  609. package/esm/validators/boolean-validator.d.ts.map +1 -0
  610. package/esm/validators/boolean-validator.js +48 -0
  611. package/esm/validators/boolean-validator.js.map +1 -0
  612. package/esm/validators/date-validator.d.ts +303 -0
  613. package/esm/validators/date-validator.d.ts.map +1 -0
  614. package/esm/validators/date-validator.js +639 -0
  615. package/esm/validators/date-validator.js.map +1 -0
  616. package/esm/validators/float-validator.d.ts +8 -0
  617. package/esm/validators/float-validator.d.ts.map +1 -0
  618. package/esm/validators/float-validator.js +9 -0
  619. package/esm/validators/float-validator.js.map +1 -0
  620. package/esm/validators/index.d.ts +20 -0
  621. package/esm/validators/index.d.ts.map +1 -0
  622. package/esm/validators/int-validator.d.ts +8 -0
  623. package/esm/validators/int-validator.d.ts.map +1 -0
  624. package/esm/validators/int-validator.js +9 -0
  625. package/esm/validators/int-validator.js.map +1 -0
  626. package/esm/validators/number-validator.d.ts +35 -0
  627. package/esm/validators/number-validator.d.ts.map +1 -0
  628. package/esm/validators/number-validator.js +66 -0
  629. package/esm/validators/number-validator.js.map +1 -0
  630. package/esm/validators/object-validator.d.ts +24 -0
  631. package/esm/validators/object-validator.d.ts.map +1 -0
  632. package/esm/validators/object-validator.js +120 -0
  633. package/esm/validators/object-validator.js.map +1 -0
  634. package/esm/validators/scalar-validator.d.ts +74 -0
  635. package/esm/validators/scalar-validator.d.ts.map +1 -0
  636. package/esm/validators/scalar-validator.js +145 -0
  637. package/esm/validators/scalar-validator.js.map +1 -0
  638. package/esm/validators/string-validator.d.ts +187 -0
  639. package/esm/validators/string-validator.d.ts.map +1 -0
  640. package/esm/validators/string-validator.js +404 -0
  641. package/esm/validators/string-validator.js.map +1 -0
  642. package/package.json +29 -0
package/esm/config.js ADDED
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Seal Configuration
3
+ *
4
+ * Global configuration for the Seal validation library
5
+ */
6
+ /**
7
+ * Global Seal configuration
8
+ */
9
+ const config = {
10
+ firstErrorOnly: true,
11
+ };
12
+ /**
13
+ * Configure Seal globally
14
+ *
15
+ * @example
16
+ * ```ts
17
+ * import { configureSeal } from "@warlock.js/seal";
18
+ * import { trans } from "@mongez/localization";
19
+ *
20
+ * configureSeal({
21
+ * translateRule: (ruleTranslation) => trans(`validation.${ruleTranslation.rule.name}`, ruleTranslation.attributes),
22
+ * translateAttribute: (attributeTranslation) => trans(`validation.attributes.${attributeTranslation.rule.name}.${attributeTranslation.attribute}`, attributeTranslation.context.allValues),
23
+ * });
24
+ * ```
25
+ */
26
+ function configureSeal(options) {
27
+ Object.assign(config, options);
28
+ }
29
+ /**
30
+ * Get current Seal configuration
31
+ */
32
+ function getSealConfig() {
33
+ return config;
34
+ }
35
+ /**
36
+ * Reset configuration to defaults
37
+ */
38
+ function resetSealConfig() {
39
+ delete config.translateRule;
40
+ delete config.translateAttribute;
41
+ config.firstErrorOnly = true;
42
+ }export{configureSeal,getSealConfig,resetSealConfig};//# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.js","sources":["../src/config.ts"],"sourcesContent":[null],"names":[],"mappings":"AAAA;;;;AAIG;AA8BH;;AAEG;AACH,MAAM,MAAM,GAAe;AACzB,IAAA,cAAc,EAAE,IAAI;CACrB,CAAC;AAEF;;;;;;;;;;;;;AAaG;AACG,SAAU,aAAa,CAAC,OAA4B,EAAA;AACxD,IAAA,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AACjC,CAAC;AAED;;AAEG;SACa,aAAa,GAAA;AAC3B,IAAA,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;AAEG;SACa,eAAe,GAAA;IAC7B,OAAO,MAAM,CAAC,aAAa,CAAC;IAC5B,OAAO,MAAM,CAAC,kBAAkB,CAAC;AAEjC,IAAA,MAAM,CAAC,cAAc,GAAG,IAAI,CAAC;AAC/B"}
@@ -0,0 +1,3 @@
1
+ export * from "./validate";
2
+ export * from "./validators";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/factory/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { type SealConfig } from "../config";
2
+ import type { ValidationResult } from "../types";
3
+ import type { BaseValidator } from "../validators";
4
+ /**
5
+ * Validate data against a schema
6
+ */
7
+ export declare const validate: <T extends BaseValidator>(schema: T, data: any, configurations?: SealConfig) => Promise<ValidationResult>;
8
+ //# sourceMappingURL=validate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../src/factory/validate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,UAAU,EAAE,MAAM,WAAW,CAAC;AAC3D,OAAO,KAAK,EAAiB,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAChE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAEnD;;GAEG;AACH,eAAO,MAAM,QAAQ,6CAEb,GAAG,mBACO,UAAU,KACzB,QAAQ,gBAAgB,CAiB1B,CAAC"}
@@ -0,0 +1,21 @@
1
+ import {getSealConfig}from'../config.js';/**
2
+ * Validate data against a schema
3
+ */
4
+ const validate = async (schema, data, // Temporarily use any - will fix type inference
5
+ configurations = getSealConfig()) => {
6
+ const context = {
7
+ allValues: data,
8
+ parent: null,
9
+ value: data,
10
+ key: "",
11
+ path: "",
12
+ translateRule(ruleTranslation) {
13
+ return configurations.translateRule?.(ruleTranslation) ?? "";
14
+ },
15
+ translateAttribute(attributeTranslation) {
16
+ return configurations.translateAttribute?.(attributeTranslation) ?? "";
17
+ },
18
+ configurations,
19
+ };
20
+ return await schema.validate(data, context);
21
+ };export{validate};//# sourceMappingURL=validate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validate.js","sources":["../../src/factory/validate.ts"],"sourcesContent":[null],"names":[],"mappings":"yCAIA;;AAEG;AACU,MAAA,QAAQ,GAAG,OACtB,MAAS,EACT,IAAS;AACT,cAA6B,GAAA,aAAa,EAAE,KACf;AAC7B,IAAA,MAAM,OAAO,GAAkB;AAC7B,QAAA,SAAS,EAAE,IAAI;AACf,QAAA,MAAM,EAAE,IAAI;AACZ,QAAA,KAAK,EAAE,IAAI;AACX,QAAA,GAAG,EAAE,EAAE;AACP,QAAA,IAAI,EAAE,EAAE;AACR,QAAA,aAAa,CAAC,eAAe,EAAA;YAC3B,OAAO,cAAc,CAAC,aAAa,GAAG,eAAe,CAAC,IAAI,EAAE,CAAC;SAC9D;AACD,QAAA,kBAAkB,CAAC,oBAAoB,EAAA;YACrC,OAAO,cAAc,CAAC,kBAAkB,GAAG,oBAAoB,CAAC,IAAI,EAAE,CAAC;SACxE;QACD,cAAc;KACf,CAAC;IAEF,OAAO,MAAM,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;AAC9C"}
@@ -0,0 +1,32 @@
1
+ import type { Schema, ValidationResult } from "../types";
2
+ import type { BaseValidator } from "../validators";
3
+ import { AnyValidator, ArrayValidator, BooleanValidator, DateValidator, FloatValidator, IntValidator, NumberValidator, ObjectValidator, ScalarValidator, StringValidator } from "../validators";
4
+ /**
5
+ * Seal factory object - creates instances of validators
6
+ *
7
+ * Use 'v' to create validation schemas (seals) for your data
8
+ */
9
+ export declare const v: ValidatorV;
10
+ export interface ValidatorV {
11
+ object: <T extends Schema>(schema: T, errorMessage?: string) => ObjectValidator & {
12
+ schema: T;
13
+ };
14
+ any: () => AnyValidator;
15
+ forbidden: () => AnyValidator;
16
+ array: <T extends BaseValidator>(validator: T, errorMessage?: string) => ArrayValidator & {
17
+ validator: T;
18
+ };
19
+ date: (errorMessage?: string) => DateValidator;
20
+ string: (errorMessage?: string) => StringValidator;
21
+ enum: (values: any, errorMessage?: string) => ScalarValidator;
22
+ number: (errorMessage?: string) => NumberValidator;
23
+ int: (errorMessage?: string) => IntValidator;
24
+ float: (errorMessage?: string) => FloatValidator;
25
+ boolean: (errorMessage?: string) => BooleanValidator;
26
+ scalar: (errorMessage?: string) => ScalarValidator;
27
+ localized: (valueValidator?: BaseValidator, errorMessage?: string) => ArrayValidator & {
28
+ validator: BaseValidator;
29
+ };
30
+ validate: <T extends BaseValidator>(schema: T, data: any) => Promise<ValidationResult>;
31
+ }
32
+ //# sourceMappingURL=validators.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validators.d.ts","sourceRoot":"","sources":["../../src/factory/validators.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AACzD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EACL,YAAY,EACZ,cAAc,EACd,gBAAgB,EAChB,aAAa,EACb,cAAc,EACd,YAAY,EACZ,eAAe,EACf,eAAe,EACf,eAAe,EACf,eAAe,EAChB,MAAM,eAAe,CAAC;AAGvB;;;;GAIG;AACH,eAAO,MAAM,CAAC,EAAE,UAwDU,CAAC;AAE3B,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,CAAC,CAAC,SAAS,MAAM,EACvB,MAAM,EAAE,CAAC,EACT,YAAY,CAAC,EAAE,MAAM,KAClB,eAAe,GAAG;QACrB,MAAM,EAAE,CAAC,CAAC;KACX,CAAC;IACF,GAAG,EAAE,MAAM,YAAY,CAAC;IACxB,SAAS,EAAE,MAAM,YAAY,CAAC;IAC9B,KAAK,EAAE,CAAC,CAAC,SAAS,aAAa,EAC7B,SAAS,EAAE,CAAC,EACZ,YAAY,CAAC,EAAE,MAAM,KAClB,cAAc,GAAG;QACpB,SAAS,EAAE,CAAC,CAAC;KACd,CAAC;IACF,IAAI,EAAE,CAAC,YAAY,CAAC,EAAE,MAAM,KAAK,aAAa,CAAC;IAC/C,MAAM,EAAE,CAAC,YAAY,CAAC,EAAE,MAAM,KAAK,eAAe,CAAC;IACnD,IAAI,EAAE,CAAC,MAAM,EAAE,GAAG,EAAE,YAAY,CAAC,EAAE,MAAM,KAAK,eAAe,CAAC;IAC9D,MAAM,EAAE,CAAC,YAAY,CAAC,EAAE,MAAM,KAAK,eAAe,CAAC;IACnD,GAAG,EAAE,CAAC,YAAY,CAAC,EAAE,MAAM,KAAK,YAAY,CAAC;IAC7C,KAAK,EAAE,CAAC,YAAY,CAAC,EAAE,MAAM,KAAK,cAAc,CAAC;IACjD,OAAO,EAAE,CAAC,YAAY,CAAC,EAAE,MAAM,KAAK,gBAAgB,CAAC;IACrD,MAAM,EAAE,CAAC,YAAY,CAAC,EAAE,MAAM,KAAK,eAAe,CAAC;IACnD,SAAS,EAAE,CACT,cAAc,CAAC,EAAE,aAAa,EAC9B,YAAY,CAAC,EAAE,MAAM,KAClB,cAAc,GAAG;QACpB,SAAS,EAAE,aAAa,CAAC;KAC1B,CAAC;IACF,QAAQ,EAAE,CAAC,CAAC,SAAS,aAAa,EAChC,MAAM,EAAE,CAAC,EACT,IAAI,EAAE,GAAG,KACN,OAAO,CAAC,gBAAgB,CAAC,CAAC;CAChC"}
@@ -0,0 +1,38 @@
1
+ import {AnyValidator}from'../validators/any-validator.js';import {ArrayValidator}from'../validators/array-validator.js';import'@mongez/reinforcements';import'@mongez/supportive-is';import'net';import {BooleanValidator}from'../validators/boolean-validator.js';import {DateValidator}from'../validators/date-validator.js';import {FloatValidator}from'../validators/float-validator.js';import {IntValidator}from'../validators/int-validator.js';import {NumberValidator}from'../validators/number-validator.js';import {ObjectValidator}from'../validators/object-validator.js';import {ScalarValidator}from'../validators/scalar-validator.js';import {StringValidator}from'../validators/string-validator.js';import {validate}from'./validate.js';/**
2
+ * Seal factory object - creates instances of validators
3
+ *
4
+ * Use 'v' to create validation schemas (seals) for your data
5
+ */
6
+ const v = {
7
+ /** Create an object validator */
8
+ object: (schema, errorMessage) => new ObjectValidator(schema, errorMessage),
9
+ /** Create an any validator */
10
+ any: () => new AnyValidator(),
11
+ /** Create a forbidden validator */
12
+ forbidden: () => v.any().forbidden(),
13
+ /** Create an array validator */
14
+ array: (validator, errorMessage) => new ArrayValidator(validator, errorMessage),
15
+ /** Create a date validator */
16
+ date: (errorMessage) => new DateValidator(errorMessage),
17
+ /** Create a string validator */
18
+ string: (errorMessage) => new StringValidator(errorMessage),
19
+ /** Create an enum validator */
20
+ enum: (values, errorMessage) => new StringValidator().enum(values, errorMessage),
21
+ /** Create a number validator */
22
+ number: (errorMessage) => new NumberValidator(errorMessage),
23
+ /** Create an integer validator */
24
+ int: (errorMessage) => new IntValidator(errorMessage),
25
+ /** Create a float validator */
26
+ float: (errorMessage) => new FloatValidator(errorMessage),
27
+ /** Create a boolean validator */
28
+ boolean: (errorMessage) => new BooleanValidator(errorMessage),
29
+ /** Create a scalar validator */
30
+ scalar: (errorMessage) => new ScalarValidator(errorMessage),
31
+ /** Create a localized array validator */
32
+ localized: (valueValidator, errorMessage) => v.array(v.object({
33
+ localeCode: v.string().required(),
34
+ value: (valueValidator || v.string()).required(),
35
+ }), errorMessage),
36
+ /** Validate data against a schema */
37
+ validate: validate,
38
+ };export{v};//# sourceMappingURL=validators.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validators.js","sources":["../../src/factory/validators.ts"],"sourcesContent":[null],"names":["validateFunction"],"mappings":"4tBAgBA;;;;AAIG;AACU,MAAA,CAAC,GAAe;;AAE3B,IAAA,MAAM,EAAE,CAAmB,MAAS,EAAE,YAAqB,KACzD,IAAI,eAAe,CAAC,MAAM,EAAE,YAAY,CAEvC;;AAGH,IAAA,GAAG,EAAE,MAAM,IAAI,YAAY,EAAE;;IAG7B,SAAS,EAAE,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC,SAAS,EAAE;;AAGpC,IAAA,KAAK,EAAE,CAA0B,SAAY,EAAE,YAAqB,KAClE,IAAI,cAAc,CAAC,SAAS,EAAE,YAAY,CAEzC;;IAGH,IAAI,EAAE,CAAC,YAAqB,KAAK,IAAI,aAAa,CAAC,YAAY,CAAC;;IAGhE,MAAM,EAAE,CAAC,YAAqB,KAAK,IAAI,eAAe,CAAC,YAAY,CAAC;;AAGpE,IAAA,IAAI,EAAE,CAAC,MAAW,EAAE,YAAqB,KACvC,IAAI,eAAe,EAAE,CAAC,IAAI,CAAC,MAAM,EAAE,YAAY,CAAC;;IAGlD,MAAM,EAAE,CAAC,YAAqB,KAAK,IAAI,eAAe,CAAC,YAAY,CAAC;;IAGpE,GAAG,EAAE,CAAC,YAAqB,KAAK,IAAI,YAAY,CAAC,YAAY,CAAC;;IAG9D,KAAK,EAAE,CAAC,YAAqB,KAAK,IAAI,cAAc,CAAC,YAAY,CAAC;;IAGlE,OAAO,EAAE,CAAC,YAAqB,KAAK,IAAI,gBAAgB,CAAC,YAAY,CAAC;;IAGtE,MAAM,EAAE,CAAC,YAAqB,KAAK,IAAI,eAAe,CAAC,YAAY,CAAC;;AAGpE,IAAA,SAAS,EAAE,CAAC,cAA8B,EAAE,YAAqB,KAC/D,CAAC,CAAC,KAAK,CACL,CAAC,CAAC,MAAM,CAAC;AACP,QAAA,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;QACjC,KAAK,EAAE,CAAC,cAAc,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,QAAQ,EAAE;KACjD,CAAC,EACF,YAAY,CACb;;AAGH,IAAA,QAAQ,EAAEA,QAAgB;"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Detect if value is a date value or field name
3
+ *
4
+ * Date values:
5
+ * - Date instance
6
+ * - Number (timestamp)
7
+ * - String with date separators (- or /)
8
+ *
9
+ * Field names:
10
+ * - Strings without - or /
11
+ *
12
+ * @param value - Value to check
13
+ * @returns true if it's a date value, false if it's a field name
14
+ */
15
+ export declare function isDateValue(value: any): boolean;
16
+ //# sourceMappingURL=date-helpers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"date-helpers.d.ts","sourceRoot":"","sources":["../../src/helpers/date-helpers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,GAAG,GAAG,OAAO,CAU/C"}
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Detect if value is a date value or field name
3
+ *
4
+ * Date values:
5
+ * - Date instance
6
+ * - Number (timestamp)
7
+ * - String with date separators (- or /)
8
+ *
9
+ * Field names:
10
+ * - Strings without - or /
11
+ *
12
+ * @param value - Value to check
13
+ * @returns true if it's a date value, false if it's a field name
14
+ */
15
+ function isDateValue(value) {
16
+ if (value instanceof Date)
17
+ return true;
18
+ if (typeof value === "number")
19
+ return true;
20
+ if (typeof value === "string" &&
21
+ (value.includes("-") || value.includes("/"))) {
22
+ return true;
23
+ }
24
+ return false;
25
+ }export{isDateValue};//# sourceMappingURL=date-helpers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"date-helpers.js","sources":["../../src/helpers/date-helpers.ts"],"sourcesContent":[null],"names":[],"mappings":"AAAA;;;;;;;;;;;;;AAaG;AACG,SAAU,WAAW,CAAC,KAAU,EAAA;IACpC,IAAI,KAAK,YAAY,IAAI;AAAE,QAAA,OAAO,IAAI,CAAC;IACvC,IAAI,OAAO,KAAK,KAAK,QAAQ;AAAE,QAAA,OAAO,IAAI,CAAC;IAC3C,IACE,OAAO,KAAK,KAAK,QAAQ;AACzB,SAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,EAC5C;AACA,QAAA,OAAO,IAAI,CAAC;AACb,KAAA;AACD,IAAA,OAAO,KAAK,CAAC;AACf"}
@@ -0,0 +1,37 @@
1
+ import type { ContextualSchemaRule, SchemaContext } from "../types";
2
+ /**
3
+ * Get field value based on scope from rule options
4
+ *
5
+ * This utility extracts a field value from either the global context or sibling context
6
+ * based on the `scope` option in the rule's context.
7
+ *
8
+ * @param rule - The contextual schema rule containing options with:
9
+ * - `field` (or custom fieldKey): The field name to extract
10
+ * - `scope` (optional): Either "global" (default) or "sibling"
11
+ * @param context - The schema validation context containing allValues and parent
12
+ * @param fieldKey - The key in rule.context.options that contains the field name (defaults to "field")
13
+ *
14
+ * @returns The value of the specified field from the appropriate source
15
+ *
16
+ * @example
17
+ * // In a validation rule with scope support:
18
+ * async validate(value: any, context) {
19
+ * const otherFieldValue = getFieldValue(this, context);
20
+ * // Extracts from context.allValues if scope is "global"
21
+ * // Extracts from context.parent if scope is "sibling"
22
+ * }
23
+ *
24
+ * @example
25
+ * // Using a custom field key:
26
+ * async validate(value: any, context) {
27
+ * const compareValue = getFieldValue(this, context, "compareField");
28
+ * // Looks for rule.context.options.compareField instead of .field
29
+ * }
30
+ *
31
+ * @remarks
32
+ * - **Global scope** (`scope: "global"`): Searches the entire input data (context.allValues)
33
+ * - **Sibling scope** (`scope: "sibling"`): Searches only within the parent object (context.parent)
34
+ * - Uses `@mongez/reinforcements.get()` to support nested paths (e.g., "user.email")
35
+ */
36
+ export declare function getFieldValue(rule: ContextualSchemaRule, context: SchemaContext, fieldKey?: string): any;
37
+ //# sourceMappingURL=get-field-value.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-field-value.d.ts","sourceRoot":"","sources":["../../src/helpers/get-field-value.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEpE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,wBAAgB,aAAa,CAC3B,IAAI,EAAE,oBAAoB,EAC1B,OAAO,EAAE,aAAa,EACtB,QAAQ,SAAU,OAMnB"}
@@ -0,0 +1,40 @@
1
+ import {get}from'@mongez/reinforcements';/**
2
+ * Get field value based on scope from rule options
3
+ *
4
+ * This utility extracts a field value from either the global context or sibling context
5
+ * based on the `scope` option in the rule's context.
6
+ *
7
+ * @param rule - The contextual schema rule containing options with:
8
+ * - `field` (or custom fieldKey): The field name to extract
9
+ * - `scope` (optional): Either "global" (default) or "sibling"
10
+ * @param context - The schema validation context containing allValues and parent
11
+ * @param fieldKey - The key in rule.context.options that contains the field name (defaults to "field")
12
+ *
13
+ * @returns The value of the specified field from the appropriate source
14
+ *
15
+ * @example
16
+ * // In a validation rule with scope support:
17
+ * async validate(value: any, context) {
18
+ * const otherFieldValue = getFieldValue(this, context);
19
+ * // Extracts from context.allValues if scope is "global"
20
+ * // Extracts from context.parent if scope is "sibling"
21
+ * }
22
+ *
23
+ * @example
24
+ * // Using a custom field key:
25
+ * async validate(value: any, context) {
26
+ * const compareValue = getFieldValue(this, context, "compareField");
27
+ * // Looks for rule.context.options.compareField instead of .field
28
+ * }
29
+ *
30
+ * @remarks
31
+ * - **Global scope** (`scope: "global"`): Searches the entire input data (context.allValues)
32
+ * - **Sibling scope** (`scope: "sibling"`): Searches only within the parent object (context.parent)
33
+ * - Uses `@mongez/reinforcements.get()` to support nested paths (e.g., "user.email")
34
+ */
35
+ function getFieldValue(rule, context, fieldKey = "field") {
36
+ const field = rule.context.options[fieldKey];
37
+ const scope = rule.context.options.scope || "global";
38
+ const source = scope === "sibling" ? context.parent : context.allValues;
39
+ return get(source, field);
40
+ }export{getFieldValue};//# sourceMappingURL=get-field-value.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-field-value.js","sources":["../../src/helpers/get-field-value.ts"],"sourcesContent":[null],"names":[],"mappings":"yCAGA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiCG;AACG,SAAU,aAAa,CAC3B,IAA0B,EAC1B,OAAsB,EACtB,QAAQ,GAAG,OAAO,EAAA;IAElB,MAAM,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC7C,MAAM,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,IAAI,QAAQ,CAAC;AACrD,IAAA,MAAM,MAAM,GAAG,KAAK,KAAK,SAAS,GAAG,OAAO,CAAC,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC;AACxE,IAAA,OAAO,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;AAC5B"}
@@ -0,0 +1,5 @@
1
+ export * from "./date-helpers";
2
+ export * from "./get-field-value";
3
+ export * from "./path-helpers";
4
+ export * from "./validation-helpers";
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/helpers/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Set the key path for nested validation
3
+ */
4
+ export declare const setKeyPath: (path: string, key: string) => string;
5
+ //# sourceMappingURL=path-helpers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"path-helpers.d.ts","sourceRoot":"","sources":["../../src/helpers/path-helpers.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,UAAU,SAAU,MAAM,OAAO,MAAM,KAAG,MAGtD,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Set the key path for nested validation
3
+ */
4
+ const setKeyPath = (path, key) => {
5
+ if (!path)
6
+ return key;
7
+ return `${path}.${key}`;
8
+ };export{setKeyPath};//# sourceMappingURL=path-helpers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"path-helpers.js","sources":["../../src/helpers/path-helpers.ts"],"sourcesContent":[null],"names":[],"mappings":"AAAA;;AAEG;MACU,UAAU,GAAG,CAAC,IAAY,EAAE,GAAW,KAAY;AAC9D,IAAA,IAAI,CAAC,IAAI;AAAE,QAAA,OAAO,GAAG,CAAC;AACtB,IAAA,OAAO,CAAG,EAAA,IAAI,CAAI,CAAA,EAAA,GAAG,EAAE,CAAC;AAC1B"}
@@ -0,0 +1,4 @@
1
+ import type { ContextualSchemaRule, RuleResult, SchemaContext } from "../types";
2
+ export declare const VALID_RULE: RuleResult;
3
+ export declare const invalidRule: (rule: ContextualSchemaRule, context: SchemaContext) => RuleResult;
4
+ //# sourceMappingURL=validation-helpers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validation-helpers.d.ts","sourceRoot":"","sources":["../../src/helpers/validation-helpers.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEhF,eAAO,MAAM,UAAU,EAAE,UAExB,CAAC;AAEF,eAAO,MAAM,WAAW,SAChB,oBAAoB,WACjB,aAAa,KACrB,UA4CF,CAAC"}
@@ -0,0 +1,39 @@
1
+ import {getSealConfig}from'../config.js';const VALID_RULE = {
2
+ isValid: true,
3
+ };
4
+ const invalidRule = (rule, context) => {
5
+ const attributes = { ...rule.context.options, ...context.allValues };
6
+ attributes.input = context.path || context.key || "data";
7
+ attributes.path = context.path;
8
+ attributes.key = context.key;
9
+ attributes.value = context.value;
10
+ const translator = getSealConfig().translateAttribute;
11
+ if (translator) {
12
+ for (const key in attributes) {
13
+ // Special handling for the input attribute
14
+ if (key === "input") {
15
+ const translation = rule.context.attributesList?.input ||
16
+ translator({ attribute: "input", context, rule });
17
+ if (translation !== "input") {
18
+ attributes.input = translation;
19
+ continue;
20
+ }
21
+ }
22
+ const value = attributes[key];
23
+ attributes[key] =
24
+ rule.context.attributesList?.[value] ||
25
+ translator({ attribute: value, context, rule }) ||
26
+ value;
27
+ }
28
+ }
29
+ const error = rule.context.errorMessage ||
30
+ rule.errorMessage ||
31
+ context.translateRule?.({ rule, context, attributes }) ||
32
+ rule.defaultErrorMessage;
33
+ return {
34
+ isValid: false,
35
+ error,
36
+ input: context.key,
37
+ path: context.path,
38
+ };
39
+ };export{VALID_RULE,invalidRule};//# sourceMappingURL=validation-helpers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validation-helpers.js","sources":["../../src/helpers/validation-helpers.ts"],"sourcesContent":[null],"names":[],"mappings":"yCAGa,MAAA,UAAU,GAAe;AACpC,IAAA,OAAO,EAAE,IAAI;EACb;MAEW,WAAW,GAAG,CACzB,IAA0B,EAC1B,OAAsB,KACR;AACd,IAAA,MAAM,UAAU,GAAG,EAAE,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC;AAErE,IAAA,UAAU,CAAC,KAAK,GAAG,OAAO,CAAC,IAAI,IAAI,OAAO,CAAC,GAAG,IAAI,MAAM,CAAC;AACzD,IAAA,UAAU,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;AAC/B,IAAA,UAAU,CAAC,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC;AAC7B,IAAA,UAAU,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;AAEjC,IAAA,MAAM,UAAU,GAAG,aAAa,EAAE,CAAC,kBAAkB,CAAC;AAEtD,IAAA,IAAI,UAAU,EAAE;AACd,QAAA,KAAK,MAAM,GAAG,IAAI,UAAU,EAAE;;YAE5B,IAAI,GAAG,KAAK,OAAO,EAAE;gBACnB,MAAM,WAAW,GACf,IAAI,CAAC,OAAO,CAAC,cAAc,EAAE,KAAK;oBAClC,UAAU,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;gBAEpD,IAAI,WAAW,KAAK,OAAO,EAAE;AAC3B,oBAAA,UAAU,CAAC,KAAK,GAAG,WAAW,CAAC;oBAC/B,SAAS;AACV,iBAAA;AACF,aAAA;AAED,YAAA,MAAM,KAAK,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC;YAC9B,UAAU,CAAC,GAAG,CAAC;AACb,gBAAA,IAAI,CAAC,OAAO,CAAC,cAAc,GAAG,KAAK,CAAC;oBACpC,UAAU,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;AAC/C,oBAAA,KAAK,CAAC;AACT,SAAA;AACF,KAAA;AAED,IAAA,MAAM,KAAK,GACT,IAAI,CAAC,OAAO,CAAC,YAAY;AACzB,QAAA,IAAI,CAAC,YAAY;QACjB,OAAO,CAAC,aAAa,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,UAAU,EAAE,CAAC;QACtD,IAAI,CAAC,mBAAoB,CAAC;IAE5B,OAAO;AACL,QAAA,OAAO,EAAE,KAAK;QACd,KAAK;QACL,KAAK,EAAE,OAAO,CAAC,GAAG;QAClB,IAAI,EAAE,OAAO,CAAC,IAAI;KACnB,CAAC;AACJ"}
package/esm/index.d.ts ADDED
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Warlock Seal - Type-Safe Validation Library
3
+ *
4
+ * A powerful, framework-agnostic validation library with TypeScript support
5
+ *
6
+ * Package: @warlock.js/seal
7
+ *
8
+ * Cast validation seals on your schemas to protect your data!
9
+ *
10
+ * Structure:
11
+ * - validators/ - Core validators (framework-agnostic)
12
+ * - rules/ - Core validation rules
13
+ * - types/ - Type definitions
14
+ * - helpers/ - Utilities
15
+ * - mutators/ - Data transformations
16
+ * - factory/ - v object and validate function
17
+ *
18
+ * Framework-specific features (FileValidator, database rules) are in:
19
+ * @warlock.js/core/v (src/warlock/v/)
20
+ */
21
+ export * from "./validators";
22
+ export * from "./types";
23
+ export * from "./helpers";
24
+ export * from "./mutators";
25
+ export * from "./rules";
26
+ export * from "./factory";
27
+ export * from "./plugins";
28
+ export * from "./config";
29
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAGH,cAAc,cAAc,CAAC;AAG7B,cAAc,SAAS,CAAC;AAGxB,cAAc,WAAW,CAAC;AAG1B,cAAc,YAAY,CAAC;AAG3B,cAAc,SAAS,CAAC;AAGxB,cAAc,WAAW,CAAC;AAG1B,cAAc,WAAW,CAAC;AAG1B,cAAc,UAAU,CAAC"}
package/esm/index.js ADDED
@@ -0,0 +1 @@
1
+ export{AnyValidator}from'./validators/any-validator.js';export{ArrayValidator}from'./validators/array-validator.js';export{BaseValidator}from'./validators/base-validator.js';export{BooleanValidator}from'./validators/boolean-validator.js';export{DateValidator}from'./validators/date-validator.js';export{FloatValidator}from'./validators/float-validator.js';export{IntValidator}from'./validators/int-validator.js';export{NumberValidator}from'./validators/number-validator.js';export{ObjectValidator}from'./validators/object-validator.js';export{ScalarValidator}from'./validators/scalar-validator.js';export{StringValidator}from'./validators/string-validator.js';export{WEEK_DAYS}from'./types/date-types.js';export{isDateValue}from'./helpers/date-helpers.js';export{getFieldValue}from'./helpers/get-field-value.js';export{setKeyPath}from'./helpers/path-helpers.js';export{VALID_RULE,invalidRule}from'./helpers/validation-helpers.js';export{flipArrayMutator,removeEmptyArrayElementsMutator,reverseArrayMutator,sortArrayMutator,uniqueArrayMutator}from'./mutators/array-mutators.js';export{addDaysMutator,addHoursMutator,addMonthsMutator,addYearsMutator,dateMutator,toDateOnlyMutator,toEndOfDayMutator,toEndOfMonthMutator,toEndOfYearMutator,toFormatMutator,toISOStringMutator,toStartOfDayMutator,toStartOfMonthMutator,toStartOfYearMutator,toTimeOnlyMutator,toTimestampMutator,toUTCMutator}from'./mutators/date-mutators.js';export{booleanMutator,numberMutator,roundNumberMutator}from'./mutators/number-mutators.js';export{jsonMutator,objectTrimMutator,stripUnknownMutator}from'./mutators/object-mutators.js';export{alphaOnlyMutator,alphanumericOnlyMutator,appendMutator,base64DecodeMutator,base64EncodeMutator,camelCaseMutator,capitalizeMutator,htmlEscapeMutator,kebabCaseMutator,lowercaseMutator,ltrimMutator,maskMutator,padEndMutator,padStartMutator,pascalCaseMutator,prependMutator,removeNumbersMutator,removeSpecialCharactersMutator,repeatMutator,replaceAllMutator,replaceMutator,reverseMutator,rtrimMutator,safeHtmlMutator,slugMutator,snakeCaseMutator,stringifyMutator,titleCaseMutator,trimMultipleWhitespaceMutator,trimMutator,truncateMutator,unescapeHtmlMutator,uppercaseMutator,urlDecodeMutator,urlEncodeMutator}from'./mutators/string-mutators.js';export{equalRule}from'./rules/core/equal.js';export{forbiddenRule}from'./rules/core/forbidden.js';export{presentRule,requiredRule}from'./rules/core/required.js';export{whenRule}from'./rules/core/when.js';export{alphaNumericRule,alphaRule,isNumericRule}from'./rules/string/alpha.js';export{isCreditCardRule}from'./rules/string/credit-card.js';export{emailRule}from'./rules/string/email.js';export{ip4Rule,ip6Rule,ipRule}from'./rules/string/ip.js';export{matchesRule}from'./rules/string/matches.js';export{patternRule}from'./rules/string/pattern.js';export{containsRule,endsWithRule,notContainsRule,startsWithRule}from'./rules/string/string-comparison.js';export{strongPasswordRule}from'./rules/string/strong-password-rule.js';export{urlRule}from'./rules/string/url.js';export{withoutWhitespaceRule}from'./rules/string/without-whitespace.js';export{betweenNumbersRule,evenRule,maxRule,minRule,moduloRule,negativeRule,oddRule,positiveRule}from'./rules/number/number-rules.js';export{betweenLengthRule,lengthRule,maxLengthRule,maxWordsRule,minLengthRule,minWordsRule,wordsRule}from'./rules/length/length-rules.js';export{sortedArrayRule,uniqueArrayRule}from'./rules/array/array-rules.js';export{ageRule,beforeHourRule,beforeMinuteRule,beforeTodayRule,betweenHoursRule,betweenMinutesRule,dateRule,fromHourRule,fromMinuteRule,fromTodayRule,maxAgeRule,maxDateRule,minAgeRule,minDateRule,weekDayRule}from'./rules/date/date.js';export{afterTodayRule,betweenDatesRule,futureRule,pastRule,todayRule}from'./rules/date/date-comparison-rules.js';export{businessDayRule,weekdayRule,weekdaysRule,weekendRule}from'./rules/date/date-day-rules.js';export{afterFieldRule,beforeFieldRule,sameAsFieldDateRule}from'./rules/date/date-field-comparison-rules.js';export{betweenDaysRule,betweenMonthsRule,betweenTimesRule,betweenYearsRule,maxDayRule,maxMonthRule,maxYearRule,minDayRule,minMonthRule,minYearRule,monthRule,quarterRule,yearRule}from'./rules/date/date-period-rules.js';export{withinDaysRule,withinFutureDaysRule,withinPastDaysRule}from'./rules/date/date-relative-rules.js';export{betweenAgeRule,birthdayRule,leapYearRule}from'./rules/date/date-special-rules.js';export{maxHeightRule,maxWidthRule,minHeightRule,minWidthRule}from'./rules/file/dimensions.js';export{maxFileSizeRule,minFileSizeRule}from'./rules/file/file-size.js';export{colorRule,darkColorRule,hexColorRule,hslColorRule,lightColorRule,rgbColorRule,rgbaColorRule}from'./rules/color/color-rules.js';export{requiredIfEmptyRule,requiredIfInRule,requiredIfNotEmptyRule,requiredIfNotInRule,requiredIfRule}from'./rules/conditional/required-if-rules.js';export{requiredUnlessRule}from'./rules/conditional/required-unless-rules.js';export{requiredWithAllRule,requiredWithAnyRule,requiredWithRule}from'./rules/conditional/required-with-rules.js';export{requiredWithoutAllRule,requiredWithoutAnyRule,requiredWithoutRule}from'./rules/conditional/required-without-rules.js';export{presentIfEmptyRule,presentIfInRule,presentIfNotEmptyRule,presentIfNotInRule,presentIfRule}from'./rules/conditional/present-if-rules.js';export{presentUnlessRule}from'./rules/conditional/present-unless-rules.js';export{presentWithAllRule,presentWithAnyRule,presentWithRule}from'./rules/conditional/present-with-rules.js';export{presentWithoutAllRule,presentWithoutAnyRule,presentWithoutRule}from'./rules/conditional/present-without-rules.js';export{allowedValuesRule,enumRule,inRule,notAllowedValuesRule}from'./rules/common/enum.js';export{equalsFieldRule,notEqualsFieldRule}from'./rules/common/equals-field-rules.js';export{arrayRule,booleanRule,floatRule,intRule,numberRule,objectRule,scalarRule,stringRule}from'./rules/common/type-rules.js';export{unknownKeyRule}from'./rules/common/unknown-key.js';export{validate}from'./factory/validate.js';export{v}from'./factory/validators.js';export{getInstalledPlugins,hasPlugin,registerPlugin,unregisterPlugin}from'./plugins/plugin-system.js';export{configureSeal,getSealConfig,resetSealConfig}from'./config.js';//# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,12 @@
1
+ import type { Mutator } from "../types";
2
+ /** Reverse array order */
3
+ export declare const flipArrayMutator: Mutator;
4
+ /** Reverse array order (alias) */
5
+ export declare const reverseArrayMutator: Mutator;
6
+ /** Sort array */
7
+ export declare const sortArrayMutator: Mutator;
8
+ /** Make array have only unique values */
9
+ export declare const uniqueArrayMutator: Mutator;
10
+ /** Remove empty elements from array */
11
+ export declare const removeEmptyArrayElementsMutator: Mutator;
12
+ //# sourceMappingURL=array-mutators.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"array-mutators.d.ts","sourceRoot":"","sources":["../../src/mutators/array-mutators.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAExC,0BAA0B;AAC1B,eAAO,MAAM,gBAAgB,EAAE,OAE9B,CAAC;AAEF,kCAAkC;AAClC,eAAO,MAAM,mBAAmB,EAAE,OAEjC,CAAC;AAEF,iBAAiB;AACjB,eAAO,MAAM,gBAAgB,EAAE,OAsB9B,CAAC;AAEF,yCAAyC;AACzC,eAAO,MAAM,kBAAkB,EAAE,OAEhC,CAAC;AAEF,uCAAuC;AACvC,eAAO,MAAM,+BAA+B,EAAE,OAE7C,CAAC"}
@@ -0,0 +1,37 @@
1
+ import {get}from'@mongez/reinforcements';import {isEmpty}from'@mongez/supportive-is';/** Reverse array order */
2
+ const flipArrayMutator = async (value) => {
3
+ return value.reverse();
4
+ };
5
+ /** Reverse array order (alias) */
6
+ const reverseArrayMutator = async (value) => {
7
+ return value.reverse();
8
+ };
9
+ /** Sort array */
10
+ const sortArrayMutator = async (value, context) => {
11
+ if (!Array.isArray(value))
12
+ return value;
13
+ const sortDirection = context.options.direction ?? "asc";
14
+ const sortByKey = context.options.key ?? null;
15
+ return value.sort((a, b) => {
16
+ if (sortByKey) {
17
+ const aValue = get(a, sortByKey);
18
+ const bValue = get(b, sortByKey);
19
+ if (sortDirection === "asc") {
20
+ return aValue - bValue;
21
+ }
22
+ return bValue - aValue;
23
+ }
24
+ if (sortDirection === "asc") {
25
+ return a - b;
26
+ }
27
+ return b - a;
28
+ });
29
+ };
30
+ /** Make array have only unique values */
31
+ const uniqueArrayMutator = async (value) => {
32
+ return [...new Set(value)];
33
+ };
34
+ /** Remove empty elements from array */
35
+ const removeEmptyArrayElementsMutator = async (value) => {
36
+ return value.filter((item) => !isEmpty(item));
37
+ };export{flipArrayMutator,removeEmptyArrayElementsMutator,reverseArrayMutator,sortArrayMutator,uniqueArrayMutator};//# sourceMappingURL=array-mutators.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"array-mutators.js","sources":["../../src/mutators/array-mutators.ts"],"sourcesContent":[null],"names":[],"mappings":"qFAIA;MACa,gBAAgB,GAAY,OAAM,KAAK,KAAG;AACrD,IAAA,OAAO,KAAK,CAAC,OAAO,EAAE,CAAC;AACzB,EAAE;AAEF;MACa,mBAAmB,GAAY,OAAM,KAAK,KAAG;AACxD,IAAA,OAAO,KAAK,CAAC,OAAO,EAAE,CAAC;AACzB,EAAE;AAEF;AACa,MAAA,gBAAgB,GAAY,OAAO,KAAK,EAAE,OAAO,KAAI;AAChE,IAAA,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;AAAE,QAAA,OAAO,KAAK,CAAC;IAExC,MAAM,aAAa,GAAG,OAAO,CAAC,OAAO,CAAC,SAAS,IAAI,KAAK,CAAC;IACzD,MAAM,SAAS,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,IAAI,IAAI,CAAC;IAE9C,OAAO,KAAK,CAAC,IAAI,CAAC,CAAC,CAAM,EAAE,CAAM,KAAI;AACnC,QAAA,IAAI,SAAS,EAAE;YACb,MAAM,MAAM,GAAG,GAAG,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC;YACjC,MAAM,MAAM,GAAG,GAAG,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC;YAEjC,IAAI,aAAa,KAAK,KAAK,EAAE;gBAC3B,OAAO,MAAM,GAAG,MAAM,CAAC;AACxB,aAAA;YACD,OAAO,MAAM,GAAG,MAAM,CAAC;AACxB,SAAA;QAED,IAAI,aAAa,KAAK,KAAK,EAAE;YAC3B,OAAO,CAAC,GAAG,CAAC,CAAC;AACd,SAAA;QACD,OAAO,CAAC,GAAG,CAAC,CAAC;AACf,KAAC,CAAC,CAAC;AACL,EAAE;AAEF;MACa,kBAAkB,GAAY,OAAM,KAAK,KAAG;IACvD,OAAO,CAAC,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC;AAC7B,EAAE;AAEF;MACa,+BAA+B,GAAY,OAAM,KAAK,KAAG;AACpE,IAAA,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC,IAAS,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;AACrD"}
@@ -0,0 +1,39 @@
1
+ import type { Mutator } from "../types";
2
+ /**
3
+ * Convert value to Date object
4
+ * Returns Invalid Date if value cannot be converted
5
+ */
6
+ export declare const dateMutator: Mutator;
7
+ /** Convert date to ISO string format */
8
+ export declare const toISOStringMutator: Mutator;
9
+ /** Convert date to Unix timestamp (milliseconds) */
10
+ export declare const toTimestampMutator: Mutator;
11
+ /** Convert date to start of day (00:00:00) */
12
+ export declare const toStartOfDayMutator: Mutator;
13
+ /** Convert date to end of day (23:59:59.999) */
14
+ export declare const toEndOfDayMutator: Mutator;
15
+ /** Add or subtract days from date */
16
+ export declare const addDaysMutator: Mutator;
17
+ /** Add or subtract months from date */
18
+ export declare const addMonthsMutator: Mutator;
19
+ /** Add or subtract years from date */
20
+ export declare const addYearsMutator: Mutator;
21
+ /** Add or subtract hours from date */
22
+ export declare const addHoursMutator: Mutator;
23
+ /** Convert date to UTC */
24
+ export declare const toUTCMutator: Mutator;
25
+ /** Convert date to specific format using dayjs */
26
+ export declare const toFormatMutator: Mutator;
27
+ /** Convert to date only (remove time) */
28
+ export declare const toDateOnlyMutator: Mutator;
29
+ /** Convert to time only (HH:MM:SS) */
30
+ export declare const toTimeOnlyMutator: Mutator;
31
+ /** Set to start of month */
32
+ export declare const toStartOfMonthMutator: Mutator;
33
+ /** Set to end of month */
34
+ export declare const toEndOfMonthMutator: Mutator;
35
+ /** Set to start of year */
36
+ export declare const toStartOfYearMutator: Mutator;
37
+ /** Set to end of year */
38
+ export declare const toEndOfYearMutator: Mutator;
39
+ //# sourceMappingURL=date-mutators.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"date-mutators.d.ts","sourceRoot":"","sources":["../../src/mutators/date-mutators.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAExC;;;GAGG;AACH,eAAO,MAAM,WAAW,EAAE,OAiBzB,CAAC;AAEF,wCAAwC;AACxC,eAAO,MAAM,kBAAkB,EAAE,OAGhC,CAAC;AAEF,oDAAoD;AACpD,eAAO,MAAM,kBAAkB,EAAE,OAGhC,CAAC;AAEF,8CAA8C;AAC9C,eAAO,MAAM,mBAAmB,EAAE,OAIjC,CAAC;AAEF,gDAAgD;AAChD,eAAO,MAAM,iBAAiB,EAAE,OAI/B,CAAC;AAEF,qCAAqC;AACrC,eAAO,MAAM,cAAc,EAAE,OAK5B,CAAC;AAEF,uCAAuC;AACvC,eAAO,MAAM,gBAAgB,EAAE,OAK9B,CAAC;AAEF,sCAAsC;AACtC,eAAO,MAAM,eAAe,EAAE,OAK7B,CAAC;AAEF,sCAAsC;AACtC,eAAO,MAAM,eAAe,EAAE,OAK7B,CAAC;AAEF,0BAA0B;AAC1B,eAAO,MAAM,YAAY,EAAE,OAG1B,CAAC;AAEF,kDAAkD;AAClD,eAAO,MAAM,eAAe,EAAE,OAG7B,CAAC;AAEF,yCAAyC;AACzC,eAAO,MAAM,iBAAiB,EAAE,OAG/B,CAAC;AAEF,sCAAsC;AACtC,eAAO,MAAM,iBAAiB,EAAE,OAG/B,CAAC;AAEF,4BAA4B;AAC5B,eAAO,MAAM,qBAAqB,EAAE,OAKnC,CAAC;AAEF,0BAA0B;AAC1B,eAAO,MAAM,mBAAmB,EAAE,OAMjC,CAAC;AAEF,2BAA2B;AAC3B,eAAO,MAAM,oBAAoB,EAAE,OAMlC,CAAC;AAEF,yBAAyB;AACzB,eAAO,MAAM,kBAAkB,EAAE,OAMhC,CAAC"}