@warlock.js/seal 5.29.0 → 5.31.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (443) hide show
  1. package/CHANGELOG.md +59 -0
  2. package/README.md +58 -8
  3. package/cjs/index.cjs +58 -43
  4. package/cjs/index.cjs.map +1 -1
  5. package/cjs/{object-DubGC-xu.cjs → object-VTtA-k1a.cjs} +23 -19
  6. package/cjs/object-VTtA-k1a.cjs.map +1 -0
  7. package/cjs/object.cjs +2 -2
  8. package/cjs/{required-methods-BOVNRtci.cjs → required-methods-chT0TXQS.cjs} +197 -92
  9. package/cjs/required-methods-chT0TXQS.cjs.map +1 -0
  10. package/cjs/{string-DpDpgefH.cjs → string-edcPIpcU.cjs} +8 -8
  11. package/cjs/string-edcPIpcU.cjs.map +1 -0
  12. package/cjs/string.cjs +2 -2
  13. package/esm/config.d.mts +2 -1
  14. package/esm/config.d.mts.map +1 -1
  15. package/esm/config.mjs +1 -1
  16. package/esm/config.mjs.map +1 -1
  17. package/esm/factory/validate.d.mts +9 -6
  18. package/esm/factory/validate.d.mts.map +1 -1
  19. package/esm/factory/validate.mjs +12 -4
  20. package/esm/factory/validate.mjs.map +1 -1
  21. package/esm/factory/validators.d.mts +13 -13
  22. package/esm/factory/validators.d.mts.map +1 -1
  23. package/esm/factory/validators.mjs +8 -2
  24. package/esm/factory/validators.mjs.map +1 -1
  25. package/esm/helpers/date-helpers.d.mts +1 -1
  26. package/esm/helpers/date-helpers.d.mts.map +1 -1
  27. package/esm/helpers/date-helpers.mjs +1 -1
  28. package/esm/helpers/date-helpers.mjs.map +1 -1
  29. package/esm/helpers/file.utils.d.mts +1 -1
  30. package/esm/helpers/file.utils.d.mts.map +1 -1
  31. package/esm/helpers/file.utils.mjs +1 -1
  32. package/esm/helpers/file.utils.mjs.map +1 -1
  33. package/esm/helpers/get-field-value.d.mts +2 -1
  34. package/esm/helpers/get-field-value.d.mts.map +1 -1
  35. package/esm/helpers/get-field-value.mjs +1 -1
  36. package/esm/helpers/get-field-value.mjs.map +1 -1
  37. package/esm/helpers/is-empty-value.mjs +1 -1
  38. package/esm/helpers/is-empty-value.mjs.map +1 -1
  39. package/esm/helpers/path-helpers.d.mts +1 -1
  40. package/esm/helpers/path-helpers.d.mts.map +1 -1
  41. package/esm/helpers/path-helpers.mjs +1 -1
  42. package/esm/helpers/path-helpers.mjs.map +1 -1
  43. package/esm/helpers/validation-helpers.d.mts +2 -1
  44. package/esm/helpers/validation-helpers.d.mts.map +1 -1
  45. package/esm/helpers/validation-helpers.mjs +1 -1
  46. package/esm/helpers/validation-helpers.mjs.map +1 -1
  47. package/esm/index.d.mts +3 -3
  48. package/esm/mutators/array-mutators.d.mts +2 -1
  49. package/esm/mutators/array-mutators.d.mts.map +1 -1
  50. package/esm/mutators/array-mutators.mjs +1 -1
  51. package/esm/mutators/array-mutators.mjs.map +1 -1
  52. package/esm/mutators/boolean-mutators.d.mts +2 -1
  53. package/esm/mutators/boolean-mutators.d.mts.map +1 -1
  54. package/esm/mutators/boolean-mutators.mjs +1 -1
  55. package/esm/mutators/boolean-mutators.mjs.map +1 -1
  56. package/esm/mutators/date-mutators.d.mts +2 -1
  57. package/esm/mutators/date-mutators.d.mts.map +1 -1
  58. package/esm/mutators/date-mutators.mjs +1 -1
  59. package/esm/mutators/date-mutators.mjs.map +1 -1
  60. package/esm/mutators/number-mutators.d.mts +2 -1
  61. package/esm/mutators/number-mutators.d.mts.map +1 -1
  62. package/esm/mutators/number-mutators.mjs +1 -1
  63. package/esm/mutators/number-mutators.mjs.map +1 -1
  64. package/esm/mutators/object-mutators.d.mts +2 -1
  65. package/esm/mutators/object-mutators.d.mts.map +1 -1
  66. package/esm/mutators/object-mutators.mjs +1 -1
  67. package/esm/mutators/object-mutators.mjs.map +1 -1
  68. package/esm/mutators/scalar-mutators.d.mts +2 -1
  69. package/esm/mutators/scalar-mutators.d.mts.map +1 -1
  70. package/esm/mutators/scalar-mutators.mjs +1 -1
  71. package/esm/mutators/scalar-mutators.mjs.map +1 -1
  72. package/esm/mutators/string-mutators.d.mts +2 -1
  73. package/esm/mutators/string-mutators.d.mts.map +1 -1
  74. package/esm/mutators/string-mutators.mjs +3 -3
  75. package/esm/mutators/string-mutators.mjs.map +1 -1
  76. package/esm/object.d.mts +2 -4
  77. package/esm/object.d.mts.map +1 -1
  78. package/esm/object.mjs +1 -1
  79. package/esm/object.mjs.map +1 -1
  80. package/esm/plugins/plugin-system.d.mts +1 -1
  81. package/esm/plugins/plugin-system.d.mts.map +1 -1
  82. package/esm/plugins/plugin-system.mjs +1 -1
  83. package/esm/plugins/plugin-system.mjs.map +1 -1
  84. package/esm/rules/array/array-rules.d.mts +2 -1
  85. package/esm/rules/array/array-rules.d.mts.map +1 -1
  86. package/esm/rules/array/array-rules.mjs +1 -1
  87. package/esm/rules/array/array-rules.mjs.map +1 -1
  88. package/esm/rules/color/color-rules.d.mts +2 -1
  89. package/esm/rules/color/color-rules.d.mts.map +1 -1
  90. package/esm/rules/color/color-rules.mjs +1 -1
  91. package/esm/rules/color/color-rules.mjs.map +1 -1
  92. package/esm/rules/common/enum.d.mts +2 -1
  93. package/esm/rules/common/enum.d.mts.map +1 -1
  94. package/esm/rules/common/enum.mjs +1 -1
  95. package/esm/rules/common/enum.mjs.map +1 -1
  96. package/esm/rules/common/equals-field-rules.d.mts +2 -1
  97. package/esm/rules/common/equals-field-rules.d.mts.map +1 -1
  98. package/esm/rules/common/equals-field-rules.mjs +1 -1
  99. package/esm/rules/common/equals-field-rules.mjs.map +1 -1
  100. package/esm/rules/common/instanceof.d.mts +2 -1
  101. package/esm/rules/common/instanceof.d.mts.map +1 -1
  102. package/esm/rules/common/instanceof.mjs +1 -1
  103. package/esm/rules/common/instanceof.mjs.map +1 -1
  104. package/esm/rules/common/literal.d.mts +2 -1
  105. package/esm/rules/common/literal.d.mts.map +1 -1
  106. package/esm/rules/common/literal.mjs +1 -1
  107. package/esm/rules/common/literal.mjs.map +1 -1
  108. package/esm/rules/common/type-rules.d.mts +2 -1
  109. package/esm/rules/common/type-rules.d.mts.map +1 -1
  110. package/esm/rules/common/type-rules.mjs +1 -1
  111. package/esm/rules/common/type-rules.mjs.map +1 -1
  112. package/esm/rules/common/unknown-key.d.mts +2 -1
  113. package/esm/rules/common/unknown-key.d.mts.map +1 -1
  114. package/esm/rules/common/unknown-key.mjs +1 -1
  115. package/esm/rules/common/unknown-key.mjs.map +1 -1
  116. package/esm/rules/conditional/forbidden-if-rules.d.mts +2 -1
  117. package/esm/rules/conditional/forbidden-if-rules.d.mts.map +1 -1
  118. package/esm/rules/conditional/forbidden-if-rules.mjs +1 -1
  119. package/esm/rules/conditional/forbidden-if-rules.mjs.map +1 -1
  120. package/esm/rules/conditional/present-if-rules.d.mts +2 -1
  121. package/esm/rules/conditional/present-if-rules.d.mts.map +1 -1
  122. package/esm/rules/conditional/present-if-rules.mjs +1 -1
  123. package/esm/rules/conditional/present-if-rules.mjs.map +1 -1
  124. package/esm/rules/conditional/present-unless-rules.d.mts +2 -1
  125. package/esm/rules/conditional/present-unless-rules.d.mts.map +1 -1
  126. package/esm/rules/conditional/present-unless-rules.mjs +1 -1
  127. package/esm/rules/conditional/present-unless-rules.mjs.map +1 -1
  128. package/esm/rules/conditional/present-with-rules.d.mts +2 -1
  129. package/esm/rules/conditional/present-with-rules.d.mts.map +1 -1
  130. package/esm/rules/conditional/present-with-rules.mjs +1 -1
  131. package/esm/rules/conditional/present-with-rules.mjs.map +1 -1
  132. package/esm/rules/conditional/present-without-rules.d.mts +2 -1
  133. package/esm/rules/conditional/present-without-rules.d.mts.map +1 -1
  134. package/esm/rules/conditional/present-without-rules.mjs +1 -1
  135. package/esm/rules/conditional/present-without-rules.mjs.map +1 -1
  136. package/esm/rules/conditional/required-if-rules.d.mts +2 -1
  137. package/esm/rules/conditional/required-if-rules.d.mts.map +1 -1
  138. package/esm/rules/conditional/required-if-rules.mjs +1 -1
  139. package/esm/rules/conditional/required-if-rules.mjs.map +1 -1
  140. package/esm/rules/conditional/required-unless-rules.d.mts +2 -1
  141. package/esm/rules/conditional/required-unless-rules.d.mts.map +1 -1
  142. package/esm/rules/conditional/required-unless-rules.mjs +1 -1
  143. package/esm/rules/conditional/required-unless-rules.mjs.map +1 -1
  144. package/esm/rules/conditional/required-when-rule.d.mts +2 -1
  145. package/esm/rules/conditional/required-when-rule.d.mts.map +1 -1
  146. package/esm/rules/conditional/required-when-rule.mjs +1 -1
  147. package/esm/rules/conditional/required-when-rule.mjs.map +1 -1
  148. package/esm/rules/conditional/required-with-rules.d.mts +2 -1
  149. package/esm/rules/conditional/required-with-rules.d.mts.map +1 -1
  150. package/esm/rules/conditional/required-with-rules.mjs +1 -1
  151. package/esm/rules/conditional/required-with-rules.mjs.map +1 -1
  152. package/esm/rules/conditional/required-without-rules.d.mts +2 -1
  153. package/esm/rules/conditional/required-without-rules.d.mts.map +1 -1
  154. package/esm/rules/conditional/required-without-rules.mjs +1 -1
  155. package/esm/rules/conditional/required-without-rules.mjs.map +1 -1
  156. package/esm/rules/core/equal.d.mts +2 -1
  157. package/esm/rules/core/equal.d.mts.map +1 -1
  158. package/esm/rules/core/equal.mjs +1 -1
  159. package/esm/rules/core/equal.mjs.map +1 -1
  160. package/esm/rules/core/forbidden.d.mts +2 -1
  161. package/esm/rules/core/forbidden.d.mts.map +1 -1
  162. package/esm/rules/core/forbidden.mjs +1 -1
  163. package/esm/rules/core/forbidden.mjs.map +1 -1
  164. package/esm/rules/core/required.d.mts +2 -1
  165. package/esm/rules/core/required.d.mts.map +1 -1
  166. package/esm/rules/core/required.mjs +1 -1
  167. package/esm/rules/core/required.mjs.map +1 -1
  168. package/esm/rules/core/union.d.mts +9 -2
  169. package/esm/rules/core/union.d.mts.map +1 -1
  170. package/esm/rules/core/union.mjs +59 -11
  171. package/esm/rules/core/union.mjs.map +1 -1
  172. package/esm/rules/core/when.d.mts +2 -1
  173. package/esm/rules/core/when.d.mts.map +1 -1
  174. package/esm/rules/core/when.mjs +1 -1
  175. package/esm/rules/core/when.mjs.map +1 -1
  176. package/esm/rules/date/date-comparison-rules.d.mts +2 -1
  177. package/esm/rules/date/date-comparison-rules.d.mts.map +1 -1
  178. package/esm/rules/date/date-comparison-rules.mjs +1 -1
  179. package/esm/rules/date/date-comparison-rules.mjs.map +1 -1
  180. package/esm/rules/date/date-day-rules.d.mts +2 -1
  181. package/esm/rules/date/date-day-rules.d.mts.map +1 -1
  182. package/esm/rules/date/date-day-rules.mjs +1 -1
  183. package/esm/rules/date/date-day-rules.mjs.map +1 -1
  184. package/esm/rules/date/date-field-comparison-rules.d.mts +2 -1
  185. package/esm/rules/date/date-field-comparison-rules.d.mts.map +1 -1
  186. package/esm/rules/date/date-field-comparison-rules.mjs +1 -1
  187. package/esm/rules/date/date-field-comparison-rules.mjs.map +1 -1
  188. package/esm/rules/date/date-period-rules.d.mts +2 -1
  189. package/esm/rules/date/date-period-rules.d.mts.map +1 -1
  190. package/esm/rules/date/date-period-rules.mjs +1 -1
  191. package/esm/rules/date/date-period-rules.mjs.map +1 -1
  192. package/esm/rules/date/date-relative-rules.d.mts +2 -1
  193. package/esm/rules/date/date-relative-rules.d.mts.map +1 -1
  194. package/esm/rules/date/date-relative-rules.mjs +1 -1
  195. package/esm/rules/date/date-relative-rules.mjs.map +1 -1
  196. package/esm/rules/date/date-special-rules.d.mts +2 -1
  197. package/esm/rules/date/date-special-rules.d.mts.map +1 -1
  198. package/esm/rules/date/date-special-rules.mjs +1 -1
  199. package/esm/rules/date/date-special-rules.mjs.map +1 -1
  200. package/esm/rules/date/date.d.mts +2 -1
  201. package/esm/rules/date/date.d.mts.map +1 -1
  202. package/esm/rules/date/date.mjs +1 -1
  203. package/esm/rules/date/date.mjs.map +1 -1
  204. package/esm/rules/file/dimensions.d.mts +2 -1
  205. package/esm/rules/file/dimensions.d.mts.map +1 -1
  206. package/esm/rules/file/dimensions.mjs +1 -1
  207. package/esm/rules/file/dimensions.mjs.map +1 -1
  208. package/esm/rules/file/file-size.d.mts +2 -1
  209. package/esm/rules/file/file-size.d.mts.map +1 -1
  210. package/esm/rules/file/file-size.mjs +1 -1
  211. package/esm/rules/file/file-size.mjs.map +1 -1
  212. package/esm/rules/length/length-rules.d.mts +2 -1
  213. package/esm/rules/length/length-rules.d.mts.map +1 -1
  214. package/esm/rules/length/length-rules.mjs +1 -1
  215. package/esm/rules/length/length-rules.mjs.map +1 -1
  216. package/esm/rules/number/number-rules.d.mts +2 -1
  217. package/esm/rules/number/number-rules.d.mts.map +1 -1
  218. package/esm/rules/number/number-rules.mjs +1 -1
  219. package/esm/rules/number/number-rules.mjs.map +1 -1
  220. package/esm/rules/scalar/accepted-rule.mjs +1 -1
  221. package/esm/rules/scalar/accepted-rule.mjs.map +1 -1
  222. package/esm/rules/scalar/declined-rule.mjs +1 -1
  223. package/esm/rules/scalar/declined-rule.mjs.map +1 -1
  224. package/esm/rules/string/alpha.d.mts +2 -1
  225. package/esm/rules/string/alpha.d.mts.map +1 -1
  226. package/esm/rules/string/alpha.mjs +1 -1
  227. package/esm/rules/string/alpha.mjs.map +1 -1
  228. package/esm/rules/string/credit-card.d.mts +2 -1
  229. package/esm/rules/string/credit-card.d.mts.map +1 -1
  230. package/esm/rules/string/credit-card.mjs +1 -1
  231. package/esm/rules/string/credit-card.mjs.map +1 -1
  232. package/esm/rules/string/email.d.mts +2 -1
  233. package/esm/rules/string/email.d.mts.map +1 -1
  234. package/esm/rules/string/email.mjs +1 -1
  235. package/esm/rules/string/email.mjs.map +1 -1
  236. package/esm/rules/string/id-formats.d.mts +2 -1
  237. package/esm/rules/string/id-formats.d.mts.map +1 -1
  238. package/esm/rules/string/id-formats.mjs +1 -1
  239. package/esm/rules/string/id-formats.mjs.map +1 -1
  240. package/esm/rules/string/ip.d.mts +2 -1
  241. package/esm/rules/string/ip.d.mts.map +1 -1
  242. package/esm/rules/string/ip.mjs +1 -1
  243. package/esm/rules/string/ip.mjs.map +1 -1
  244. package/esm/rules/string/matches.d.mts +2 -1
  245. package/esm/rules/string/matches.d.mts.map +1 -1
  246. package/esm/rules/string/matches.mjs +1 -1
  247. package/esm/rules/string/matches.mjs.map +1 -1
  248. package/esm/rules/string/pattern.d.mts +2 -1
  249. package/esm/rules/string/pattern.d.mts.map +1 -1
  250. package/esm/rules/string/pattern.mjs +1 -1
  251. package/esm/rules/string/pattern.mjs.map +1 -1
  252. package/esm/rules/string/string-comparison.d.mts +2 -1
  253. package/esm/rules/string/string-comparison.d.mts.map +1 -1
  254. package/esm/rules/string/string-comparison.mjs +1 -1
  255. package/esm/rules/string/string-comparison.mjs.map +1 -1
  256. package/esm/rules/string/strong-password-rule.d.mts +2 -1
  257. package/esm/rules/string/strong-password-rule.d.mts.map +1 -1
  258. package/esm/rules/string/strong-password-rule.mjs +1 -1
  259. package/esm/rules/string/strong-password-rule.mjs.map +1 -1
  260. package/esm/rules/string/url.d.mts +2 -1
  261. package/esm/rules/string/url.d.mts.map +1 -1
  262. package/esm/rules/string/url.mjs +1 -1
  263. package/esm/rules/string/url.mjs.map +1 -1
  264. package/esm/rules/string/without-whitespace.d.mts +2 -1
  265. package/esm/rules/string/without-whitespace.d.mts.map +1 -1
  266. package/esm/rules/string/without-whitespace.mjs +1 -1
  267. package/esm/rules/string/without-whitespace.mjs.map +1 -1
  268. package/esm/standard-schema/json-schema.d.mts +1 -1
  269. package/esm/standard-schema/json-schema.d.mts.map +1 -1
  270. package/esm/standard-schema/json-schema.mjs +1 -1
  271. package/esm/standard-schema/json-schema.mjs.map +1 -1
  272. package/esm/standard-schema/map-result.d.mts +2 -1
  273. package/esm/standard-schema/map-result.d.mts.map +1 -1
  274. package/esm/standard-schema/map-result.mjs +1 -1
  275. package/esm/standard-schema/map-result.mjs.map +1 -1
  276. package/esm/standard-schema/types.d.mts +1 -1
  277. package/esm/standard-schema/types.d.mts.map +1 -1
  278. package/esm/string.d.mts +1 -1
  279. package/esm/string.d.mts.map +1 -1
  280. package/esm/string.mjs +1 -1
  281. package/esm/string.mjs.map +1 -1
  282. package/esm/types/conditional-types.d.mts +1 -1
  283. package/esm/types/conditional-types.d.mts.map +1 -1
  284. package/esm/types/context-types.d.mts +8 -2
  285. package/esm/types/context-types.d.mts.map +1 -1
  286. package/esm/types/data-transformer-types.d.mts +1 -1
  287. package/esm/types/data-transformer-types.d.mts.map +1 -1
  288. package/esm/types/date-types.d.mts +1 -1
  289. package/esm/types/date-types.d.mts.map +1 -1
  290. package/esm/types/date-types.mjs +1 -1
  291. package/esm/types/date-types.mjs.map +1 -1
  292. package/esm/types/file.types.d.mts +1 -1
  293. package/esm/types/file.types.d.mts.map +1 -1
  294. package/esm/types/inference-types.d.mts +22 -5
  295. package/esm/types/inference-types.d.mts.map +1 -1
  296. package/esm/types/mutator-types.d.mts +1 -1
  297. package/esm/types/mutator-types.d.mts.map +1 -1
  298. package/esm/types/result-types.d.mts +26 -2
  299. package/esm/types/result-types.d.mts.map +1 -1
  300. package/esm/types/rule-types.d.mts +11 -2
  301. package/esm/types/rule-types.d.mts.map +1 -1
  302. package/esm/types/schema-types.d.mts +1 -1
  303. package/esm/types/schema-types.d.mts.map +1 -1
  304. package/esm/validators/any-validator.d.mts +1 -1
  305. package/esm/validators/any-validator.d.mts.map +1 -1
  306. package/esm/validators/any-validator.mjs +1 -1
  307. package/esm/validators/any-validator.mjs.map +1 -1
  308. package/esm/validators/array-validator.d.mts +1 -1
  309. package/esm/validators/array-validator.d.mts.map +1 -1
  310. package/esm/validators/array-validator.mjs +4 -4
  311. package/esm/validators/array-validator.mjs.map +1 -1
  312. package/esm/validators/base-validator.d.mts +10 -3
  313. package/esm/validators/base-validator.d.mts.map +1 -1
  314. package/esm/validators/base-validator.mjs +67 -18
  315. package/esm/validators/base-validator.mjs.map +1 -1
  316. package/esm/validators/boolean-validator.d.mts +1 -1
  317. package/esm/validators/boolean-validator.d.mts.map +1 -1
  318. package/esm/validators/boolean-validator.mjs +1 -1
  319. package/esm/validators/boolean-validator.mjs.map +1 -1
  320. package/esm/validators/computed-validator.d.mts +1 -1
  321. package/esm/validators/computed-validator.d.mts.map +1 -1
  322. package/esm/validators/computed-validator.mjs +5 -5
  323. package/esm/validators/computed-validator.mjs.map +1 -1
  324. package/esm/validators/date-validator.d.mts +2 -1
  325. package/esm/validators/date-validator.d.mts.map +1 -1
  326. package/esm/validators/date-validator.mjs +1 -1
  327. package/esm/validators/date-validator.mjs.map +1 -1
  328. package/esm/validators/discriminated-union-validator.d.mts +8 -2
  329. package/esm/validators/discriminated-union-validator.d.mts.map +1 -1
  330. package/esm/validators/discriminated-union-validator.mjs +7 -2
  331. package/esm/validators/discriminated-union-validator.mjs.map +1 -1
  332. package/esm/validators/float-validator.d.mts +1 -1
  333. package/esm/validators/float-validator.d.mts.map +1 -1
  334. package/esm/validators/float-validator.mjs +1 -1
  335. package/esm/validators/float-validator.mjs.map +1 -1
  336. package/esm/validators/instanceof-validator.d.mts +1 -1
  337. package/esm/validators/instanceof-validator.d.mts.map +1 -1
  338. package/esm/validators/instanceof-validator.mjs +1 -1
  339. package/esm/validators/instanceof-validator.mjs.map +1 -1
  340. package/esm/validators/int-validator.d.mts +1 -1
  341. package/esm/validators/int-validator.d.mts.map +1 -1
  342. package/esm/validators/int-validator.mjs +1 -1
  343. package/esm/validators/int-validator.mjs.map +1 -1
  344. package/esm/validators/lazy-validator.d.mts +1 -1
  345. package/esm/validators/lazy-validator.d.mts.map +1 -1
  346. package/esm/validators/lazy-validator.mjs +2 -2
  347. package/esm/validators/lazy-validator.mjs.map +1 -1
  348. package/esm/validators/literal-validator.d.mts +1 -1
  349. package/esm/validators/literal-validator.d.mts.map +1 -1
  350. package/esm/validators/literal-validator.mjs +5 -2
  351. package/esm/validators/literal-validator.mjs.map +1 -1
  352. package/esm/validators/managed-validator.d.mts +1 -1
  353. package/esm/validators/managed-validator.d.mts.map +1 -1
  354. package/esm/validators/managed-validator.mjs +1 -1
  355. package/esm/validators/managed-validator.mjs.map +1 -1
  356. package/esm/validators/methods/equality-conditional-methods.d.mts +2 -1
  357. package/esm/validators/methods/equality-conditional-methods.d.mts.map +1 -1
  358. package/esm/validators/methods/equality-conditional-methods.mjs +1 -1
  359. package/esm/validators/methods/equality-conditional-methods.mjs.map +1 -1
  360. package/esm/validators/methods/forbidden-methods.d.mts +1 -1
  361. package/esm/validators/methods/forbidden-methods.d.mts.map +1 -1
  362. package/esm/validators/methods/forbidden-methods.mjs +1 -1
  363. package/esm/validators/methods/forbidden-methods.mjs.map +1 -1
  364. package/esm/validators/methods/present-methods.d.mts +1 -1
  365. package/esm/validators/methods/present-methods.d.mts.map +1 -1
  366. package/esm/validators/methods/present-methods.mjs +1 -1
  367. package/esm/validators/methods/present-methods.mjs.map +1 -1
  368. package/esm/validators/methods/required-methods.d.mts +2 -1
  369. package/esm/validators/methods/required-methods.d.mts.map +1 -1
  370. package/esm/validators/methods/required-methods.mjs +1 -1
  371. package/esm/validators/methods/required-methods.mjs.map +1 -1
  372. package/esm/validators/number-validator.d.mts +1 -1
  373. package/esm/validators/number-validator.d.mts.map +1 -1
  374. package/esm/validators/number-validator.mjs +1 -1
  375. package/esm/validators/number-validator.mjs.map +1 -1
  376. package/esm/validators/numeric-validator.d.mts +1 -1
  377. package/esm/validators/numeric-validator.d.mts.map +1 -1
  378. package/esm/validators/numeric-validator.mjs +1 -1
  379. package/esm/validators/numeric-validator.mjs.map +1 -1
  380. package/esm/validators/object-validator.d.mts +1 -1
  381. package/esm/validators/object-validator.d.mts.map +1 -1
  382. package/esm/validators/object-validator.mjs +14 -10
  383. package/esm/validators/object-validator.mjs.map +1 -1
  384. package/esm/validators/primitive-validator.d.mts +1 -1
  385. package/esm/validators/primitive-validator.d.mts.map +1 -1
  386. package/esm/validators/primitive-validator.mjs +1 -1
  387. package/esm/validators/primitive-validator.mjs.map +1 -1
  388. package/esm/validators/record-validator.d.mts +1 -1
  389. package/esm/validators/record-validator.d.mts.map +1 -1
  390. package/esm/validators/record-validator.mjs +4 -4
  391. package/esm/validators/record-validator.mjs.map +1 -1
  392. package/esm/validators/scalar-validator.d.mts +1 -1
  393. package/esm/validators/scalar-validator.d.mts.map +1 -1
  394. package/esm/validators/scalar-validator.mjs +1 -1
  395. package/esm/validators/scalar-validator.mjs.map +1 -1
  396. package/esm/validators/string-validator.d.mts +1 -1
  397. package/esm/validators/string-validator.d.mts.map +1 -1
  398. package/esm/validators/string-validator.mjs +1 -1
  399. package/esm/validators/string-validator.mjs.map +1 -1
  400. package/esm/validators/tuple-validator.d.mts +1 -1
  401. package/esm/validators/tuple-validator.d.mts.map +1 -1
  402. package/esm/validators/tuple-validator.mjs +4 -4
  403. package/esm/validators/tuple-validator.mjs.map +1 -1
  404. package/esm/validators/union-validator.d.mts +4 -2
  405. package/esm/validators/union-validator.d.mts.map +1 -1
  406. package/esm/validators/union-validator.mjs +4 -2
  407. package/esm/validators/union-validator.mjs.map +1 -1
  408. package/llms-full.txt +664 -533
  409. package/llms.txt +1 -1
  410. package/package.json +3 -2
  411. package/skills/bridge-standard-schema/SKILL.md +60 -36
  412. package/skills/compose-seal-modifiers/SKILL.md +89 -53
  413. package/skills/define-structural-shape/SKILL.md +41 -27
  414. package/skills/define-structural-shape/array-methods.md +27 -27
  415. package/skills/define-structural-shape/object-methods.md +38 -30
  416. package/skills/extend-seal-with-plugins/SKILL.md +39 -5
  417. package/skills/generate-json-schema/SKILL.md +13 -13
  418. package/skills/handle-seal-errors/SKILL.md +26 -28
  419. package/skills/index.md +4 -1
  420. package/skills/overview/SKILL.md +10 -2
  421. package/skills/pick-seal-primitive/SKILL.md +49 -45
  422. package/skills/pick-seal-primitive/date-methods.md +96 -96
  423. package/skills/pick-seal-primitive/number-methods.md +55 -55
  424. package/skills/pick-seal-primitive/string-methods.md +107 -102
  425. package/skills/seal-basics/SKILL.md +15 -15
  426. package/cjs/object-DubGC-xu.cjs.map +0 -1
  427. package/cjs/required-methods-BOVNRtci.cjs.map +0 -1
  428. package/cjs/string-DpDpgefH.cjs.map +0 -1
  429. package/esm/helpers/index.d.mts +0 -5
  430. package/esm/mutators/index.d.mts +0 -7
  431. package/esm/rules/array/index.d.mts +0 -1
  432. package/esm/rules/color/index.d.mts +0 -1
  433. package/esm/rules/common/index.d.mts +0 -6
  434. package/esm/rules/conditional/index.d.mts +0 -10
  435. package/esm/rules/core/index.d.mts +0 -5
  436. package/esm/rules/date/index.d.mts +0 -7
  437. package/esm/rules/file/index.d.mts +0 -2
  438. package/esm/rules/index.d.mts +0 -45
  439. package/esm/rules/length/index.d.mts +0 -1
  440. package/esm/rules/number/index.d.mts +0 -1
  441. package/esm/rules/string/index.d.mts +0 -11
  442. package/esm/standard-schema/index.d.mts +0 -3
  443. package/esm/types/index.d.mts +0 -10
@@ -1 +1 @@
1
- {"version":3,"file":"present-without-rules.d.mts","names":[],"sources":["../../../../../../../../seal/src/rules/conditional/present-without-rules.ts"],"mappings":";;;;;AAQA;cAAa,kBAAA,EAAoB,UAAU;EACzC,KAAA;EACA,KAAA;AAAA;;;;AAAK;cAwBM,qBAAA,EAAuB,UAAU;EAC5C,MAAA;EACA,KAAA;AAAA;;;;;cA+BW,qBAAA,EAAuB,UAAU;EAC5C,MAAA;EACA,KAAA;AAAA"}
1
+ {"version":3,"file":"present-without-rules.d.mts","names":[],"sources":["../../../../../../../../../packages/seal/src/rules/conditional/present-without-rules.ts"],"mappings":";;;;;AAQA;;cAAa,kBAAA,EAAoB,UAAU;EACzC,KAAA;EACA,KAAA;AAAA;;;AAAK;AAwBP;cAAa,qBAAA,EAAuB,UAAU;EAC5C,MAAA;EACA,KAAA;AAAA;;;;AAAK;cA+BM,qBAAA,EAAuB,UAAU;EAC5C,MAAA;EACA,KAAA;AAAA"}
@@ -3,7 +3,7 @@ import { getFieldValue } from "../../helpers/get-field-value.mjs";
3
3
  import "../../helpers/index.mjs";
4
4
  import { get } from "@mongez/reinforcements";
5
5
 
6
- //#region ../seal/src/rules/conditional/present-without-rules.ts
6
+ //#region ../../packages/seal/src/rules/conditional/present-without-rules.ts
7
7
  /**
8
8
  * Present without rule - field must be present if another field is missing
9
9
  * Supports both global and sibling scope
@@ -1 +1 @@
1
- {"version":3,"file":"present-without-rules.mjs","names":[],"sources":["../../../../../../../../seal/src/rules/conditional/present-without-rules.ts"],"sourcesContent":["import { get } from \"@mongez/reinforcements\";\nimport { getFieldValue, invalidRule, VALID_RULE } from \"../../helpers\";\nimport type { SchemaRule } from \"../../types\";\n\n/**\n * Present without rule - field must be present if another field is missing\n * Supports both global and sibling scope\n */\nexport const presentWithoutRule: SchemaRule<{\n field: string;\n scope?: \"global\" | \"sibling\";\n}> = {\n name: \"presentWithout\",\n description: \"The field must be present if another field is missing\",\n sortOrder: -2,\n requiresValue: false,\n defaultErrorMessage: \"The :input field must be present\",\n async validate(value: any, context) {\n const fieldValue = getFieldValue(this, context);\n\n // Field must be present if the other field is missing\n if (value === undefined && fieldValue === undefined) {\n this.context.translatableParams.field = this.context.options.field;\n return invalidRule(this, context);\n }\n\n return VALID_RULE;\n },\n};\n\n/**\n * Present without all rule - field must be present if all specified fields are missing\n * Supports both global and sibling scope\n */\nexport const presentWithoutAllRule: SchemaRule<{\n fields: string[];\n scope?: \"global\" | \"sibling\";\n}> = {\n name: \"presentWithoutAll\",\n description: \"The field must be present if all specified fields are missing\",\n sortOrder: -2,\n requiresValue: false,\n defaultErrorMessage: \"The :input field must be present\",\n async validate(value: any, context) {\n const { fields, scope = \"global\" } = this.context.options;\n const source = scope === \"sibling\" ? context.parent : context.allValues;\n\n // Check if all fields are missing\n const allMissing = fields.every((field) => get(source, field) === undefined);\n\n // Field must be present if all other fields are missing\n if (value === undefined && allMissing) {\n fields.forEach((field) => {\n this.context.translatableParams.field = field;\n });\n\n return invalidRule(this, context);\n }\n\n return VALID_RULE;\n },\n};\n\n/**\n * Present without any rule - field must be present if any of the specified fields is missing\n * Supports both global and sibling scope\n */\nexport const presentWithoutAnyRule: SchemaRule<{\n fields: string[];\n scope?: \"global\" | \"sibling\";\n}> = {\n name: \"presentWithoutAny\",\n description: \"The field must be present if any of the specified fields is missing\",\n sortOrder: -2,\n requiresValue: false,\n defaultErrorMessage: \"The :input field must be present\",\n async validate(value: any, context) {\n const { fields, scope = \"global\" } = this.context.options;\n const source = scope === \"sibling\" ? context.parent : context.allValues;\n\n // Check if any field is missing\n const anyMissing = fields.some((field) => get(source, field) === undefined);\n\n // Field must be present if any other field is missing\n if (value === undefined && anyMissing) {\n fields.forEach((field) => {\n this.context.translatableParams.field = field;\n });\n\n return invalidRule(this, context);\n }\n\n return VALID_RULE;\n },\n};\n"],"mappings":";;;;;;;;;;AAQA,MAAa,qBAGR;CACH,MAAM;CACN,aAAa;CACb,WAAW;CACX,eAAe;CACf,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,MAAM,aAAa,cAAc,MAAM,OAAO;EAG9C,IAAI,UAAU,UAAa,eAAe,QAAW;GACnD,KAAK,QAAQ,mBAAmB,QAAQ,KAAK,QAAQ,QAAQ;GAC7D,OAAO,YAAY,MAAM,OAAO;EAClC;EAEA,OAAO;CACT;AACF;;;;;AAMA,MAAa,wBAGR;CACH,MAAM;CACN,aAAa;CACb,WAAW;CACX,eAAe;CACf,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,MAAM,EAAE,QAAQ,QAAQ,aAAa,KAAK,QAAQ;EAClD,MAAM,SAAS,UAAU,YAAY,QAAQ,SAAS,QAAQ;EAG9D,MAAM,aAAa,OAAO,OAAO,UAAU,IAAI,QAAQ,KAAK,MAAM,MAAS;EAG3E,IAAI,UAAU,UAAa,YAAY;GACrC,OAAO,SAAS,UAAU;IACxB,KAAK,QAAQ,mBAAmB,QAAQ;GAC1C,CAAC;GAED,OAAO,YAAY,MAAM,OAAO;EAClC;EAEA,OAAO;CACT;AACF;;;;;AAMA,MAAa,wBAGR;CACH,MAAM;CACN,aAAa;CACb,WAAW;CACX,eAAe;CACf,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,MAAM,EAAE,QAAQ,QAAQ,aAAa,KAAK,QAAQ;EAClD,MAAM,SAAS,UAAU,YAAY,QAAQ,SAAS,QAAQ;EAG9D,MAAM,aAAa,OAAO,MAAM,UAAU,IAAI,QAAQ,KAAK,MAAM,MAAS;EAG1E,IAAI,UAAU,UAAa,YAAY;GACrC,OAAO,SAAS,UAAU;IACxB,KAAK,QAAQ,mBAAmB,QAAQ;GAC1C,CAAC;GAED,OAAO,YAAY,MAAM,OAAO;EAClC;EAEA,OAAO;CACT;AACF"}
1
+ {"version":3,"file":"present-without-rules.mjs","names":[],"sources":["../../../../../../../../../packages/seal/src/rules/conditional/present-without-rules.ts"],"sourcesContent":["import { get } from \"@mongez/reinforcements\";\nimport { getFieldValue, invalidRule, VALID_RULE } from \"../../helpers\";\nimport type { SchemaRule } from \"../../types\";\n\n/**\n * Present without rule - field must be present if another field is missing\n * Supports both global and sibling scope\n */\nexport const presentWithoutRule: SchemaRule<{\n field: string;\n scope?: \"global\" | \"sibling\";\n}> = {\n name: \"presentWithout\",\n description: \"The field must be present if another field is missing\",\n sortOrder: -2,\n requiresValue: false,\n defaultErrorMessage: \"The :input field must be present\",\n async validate(value: any, context) {\n const fieldValue = getFieldValue(this, context);\n\n // Field must be present if the other field is missing\n if (value === undefined && fieldValue === undefined) {\n this.context.translatableParams.field = this.context.options.field;\n return invalidRule(this, context);\n }\n\n return VALID_RULE;\n },\n};\n\n/**\n * Present without all rule - field must be present if all specified fields are missing\n * Supports both global and sibling scope\n */\nexport const presentWithoutAllRule: SchemaRule<{\n fields: string[];\n scope?: \"global\" | \"sibling\";\n}> = {\n name: \"presentWithoutAll\",\n description: \"The field must be present if all specified fields are missing\",\n sortOrder: -2,\n requiresValue: false,\n defaultErrorMessage: \"The :input field must be present\",\n async validate(value: any, context) {\n const { fields, scope = \"global\" } = this.context.options;\n const source = scope === \"sibling\" ? context.parent : context.allValues;\n\n // Check if all fields are missing\n const allMissing = fields.every((field) => get(source, field) === undefined);\n\n // Field must be present if all other fields are missing\n if (value === undefined && allMissing) {\n fields.forEach((field) => {\n this.context.translatableParams.field = field;\n });\n\n return invalidRule(this, context);\n }\n\n return VALID_RULE;\n },\n};\n\n/**\n * Present without any rule - field must be present if any of the specified fields is missing\n * Supports both global and sibling scope\n */\nexport const presentWithoutAnyRule: SchemaRule<{\n fields: string[];\n scope?: \"global\" | \"sibling\";\n}> = {\n name: \"presentWithoutAny\",\n description: \"The field must be present if any of the specified fields is missing\",\n sortOrder: -2,\n requiresValue: false,\n defaultErrorMessage: \"The :input field must be present\",\n async validate(value: any, context) {\n const { fields, scope = \"global\" } = this.context.options;\n const source = scope === \"sibling\" ? context.parent : context.allValues;\n\n // Check if any field is missing\n const anyMissing = fields.some((field) => get(source, field) === undefined);\n\n // Field must be present if any other field is missing\n if (value === undefined && anyMissing) {\n fields.forEach((field) => {\n this.context.translatableParams.field = field;\n });\n\n return invalidRule(this, context);\n }\n\n return VALID_RULE;\n },\n};\n"],"mappings":";;;;;;;;;;AAQA,MAAa,qBAGR;CACH,MAAM;CACN,aAAa;CACb,WAAW;CACX,eAAe;CACf,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,MAAM,aAAa,cAAc,MAAM,OAAO;EAG9C,IAAI,UAAU,UAAa,eAAe,QAAW;GACnD,KAAK,QAAQ,mBAAmB,QAAQ,KAAK,QAAQ,QAAQ;GAC7D,OAAO,YAAY,MAAM,OAAO;EAClC;EAEA,OAAO;CACT;AACF;;;;;AAMA,MAAa,wBAGR;CACH,MAAM;CACN,aAAa;CACb,WAAW;CACX,eAAe;CACf,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,MAAM,EAAE,QAAQ,QAAQ,aAAa,KAAK,QAAQ;EAClD,MAAM,SAAS,UAAU,YAAY,QAAQ,SAAS,QAAQ;EAG9D,MAAM,aAAa,OAAO,OAAO,UAAU,IAAI,QAAQ,KAAK,MAAM,MAAS;EAG3E,IAAI,UAAU,UAAa,YAAY;GACrC,OAAO,SAAS,UAAU;IACxB,KAAK,QAAQ,mBAAmB,QAAQ;GAC1C,CAAC;GAED,OAAO,YAAY,MAAM,OAAO;EAClC;EAEA,OAAO;CACT;AACF;;;;;AAMA,MAAa,wBAGR;CACH,MAAM;CACN,aAAa;CACb,WAAW;CACX,eAAe;CACf,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,MAAM,EAAE,QAAQ,QAAQ,aAAa,KAAK,QAAQ;EAClD,MAAM,SAAS,UAAU,YAAY,QAAQ,SAAS,QAAQ;EAG9D,MAAM,aAAa,OAAO,MAAM,UAAU,IAAI,QAAQ,KAAK,MAAM,MAAS;EAG1E,IAAI,UAAU,UAAa,YAAY;GACrC,OAAO,SAAS,UAAU;IACxB,KAAK,QAAQ,mBAAmB,QAAQ;GAC1C,CAAC;GAED,OAAO,YAAY,MAAM,OAAO;EAClC;EAEA,OAAO;CACT;AACF"}
@@ -1,5 +1,6 @@
1
1
  import { SchemaRule } from "../../types/rule-types.mjs";
2
- //#region ../seal/src/rules/conditional/required-if-rules.d.ts
2
+
3
+ //#region ../../packages/seal/src/rules/conditional/required-if-rules.d.ts
3
4
  /**
4
5
  * Required if rule - field is required if another field equals a specific value
5
6
  * Supports both global and sibling scope
@@ -1 +1 @@
1
- {"version":3,"file":"required-if-rules.d.mts","names":[],"sources":["../../../../../../../../seal/src/rules/conditional/required-if-rules.ts"],"mappings":";;;;;AASA;cAAa,cAAA,EAAgB,UAAU;EACrC,KAAA;EACA,KAAA;EACA,KAAA;AAAA;;;;AAAK;cAyBM,mBAAA,EAAqB,UAAU;EAC1C,KAAA;EACA,KAAA;AAAA;;;;;cAwBW,sBAAA,EAAwB,UAAU;EAC7C,KAAA;EACA,KAAA;AAAA;;;;;cAwBW,gBAAA,EAAkB,UAAU;EACvC,KAAA;EACA,MAAA;EACA,KAAA;AAAA;;;;;cA0BW,mBAAA,EAAqB,UAAU;EAC1C,KAAA;EACA,MAAA;EACA,KAAA;AAAA;;;;;cAsCW,sBAAA,EAAwB,UAAU;EAC7C,MAAA;EACA,KAAA;AAAA;AAFF;;;;AAAA,cA6Ba,sBAAA,EAAwB,UAAU;EAC7C,MAAA;EACA,KAAA;AAAA;AA7BK;AA2BP;;;AA3BO,cAwDM,yBAAA,EAA2B,UAAU;EAChD,MAAA;EACA,KAAA;AAAA;;AA7BK;AA2BP;;cA6Ba,yBAAA,EAA2B,UAAU;EAChD,MAAA;EACA,KAAA;AAAA"}
1
+ {"version":3,"file":"required-if-rules.d.mts","names":[],"sources":["../../../../../../../../../packages/seal/src/rules/conditional/required-if-rules.ts"],"mappings":";;;;;AASA;;cAAa,cAAA,EAAgB,UAAU;EACrC,KAAA;EACA,KAAA;EACA,KAAA;AAAA;;;AAAK;AAyBP;cAAa,mBAAA,EAAqB,UAAU;EAC1C,KAAA;EACA,KAAA;AAAA;;;;AAAK;cAwBM,sBAAA,EAAwB,UAAU;EAC7C,KAAA;EACA,KAAA;AAAA;;;;;cAwBW,gBAAA,EAAkB,UAAU;EACvC,KAAA;EACA,MAAA;EACA,KAAA;AAAA;;;;;cA0BW,mBAAA,EAAqB,UAAU;EAC1C,KAAA;EACA,MAAA;EACA,KAAA;AAAA;;;;;cAsCW,sBAAA,EAAwB,UAAU;EAC7C,MAAA;EACA,KAAA;AAAA;;;;;cA2BW,sBAAA,EAAwB,UAAU;EAC7C,MAAA;EACA,KAAA;AAAA;AAFF;;;;AAAA,cA6Ba,yBAAA,EAA2B,UAAU;EAChD,MAAA;EACA,KAAA;AAAA;AA7BK;AA2BP;;;AA3BO,cAwDM,yBAAA,EAA2B,UAAU;EAChD,MAAA;EACA,KAAA;AAAA"}
@@ -4,7 +4,7 @@ import { getFieldValue } from "../../helpers/get-field-value.mjs";
4
4
  import "../../helpers/index.mjs";
5
5
  import { get } from "@mongez/reinforcements";
6
6
 
7
- //#region ../seal/src/rules/conditional/required-if-rules.ts
7
+ //#region ../../packages/seal/src/rules/conditional/required-if-rules.ts
8
8
  /**
9
9
  * Required if rule - field is required if another field equals a specific value
10
10
  * Supports both global and sibling scope
@@ -1 +1 @@
1
- {"version":3,"file":"required-if-rules.mjs","names":[],"sources":["../../../../../../../../seal/src/rules/conditional/required-if-rules.ts"],"sourcesContent":["import { get } from \"@mongez/reinforcements\";\nimport { getFieldValue, invalidRule, VALID_RULE } from \"../../helpers\";\nimport { isEmptyValue } from \"../../helpers/is-empty-value\";\nimport type { SchemaRule } from \"../../types\";\n\n/**\n * Required if rule - field is required if another field equals a specific value\n * Supports both global and sibling scope\n */\nexport const requiredIfRule: SchemaRule<{\n field: string;\n value: any;\n scope?: \"global\" | \"sibling\";\n}> = {\n name: \"requiredIf\",\n description: \"The field is required if another field equals a specific value\",\n sortOrder: -2,\n requiresValue: false,\n defaultErrorMessage: \"The :input is required\",\n async validate(value: any, context) {\n const { value: expectedValue } = this.context.options;\n const fieldValue = getFieldValue(this, context);\n\n // Field is required if the other field equals the expected value\n if (isEmptyValue(value) && fieldValue === expectedValue) {\n this.context.translatableParams.field = this.context.options.field;\n return invalidRule(this, context);\n }\n\n return VALID_RULE;\n },\n};\n\n/**\n * Required if empty rule - field is required if another field is empty\n * Supports both global and sibling scope\n */\nexport const requiredIfEmptyRule: SchemaRule<{\n field: string;\n scope?: \"global\" | \"sibling\";\n}> = {\n name: \"requiredIfEmpty\",\n description: \"The field is required if :field is empty\",\n sortOrder: -2,\n requiresValue: false,\n defaultErrorMessage: \"The :input is required\",\n async validate(value: any, context) {\n const fieldValue = getFieldValue(this, context);\n\n // Field is required if the other field is empty\n if (isEmptyValue(value) && isEmptyValue(fieldValue)) {\n this.context.translatableParams.field = this.context.options.field;\n return invalidRule(this, context);\n }\n\n return VALID_RULE;\n },\n};\n\n/**\n * Required if not empty rule - field is required if another field is not empty\n * Supports both global and sibling scope\n */\nexport const requiredIfNotEmptyRule: SchemaRule<{\n field: string;\n scope?: \"global\" | \"sibling\";\n}> = {\n name: \"requiredIfNotEmpty\",\n description: \"The field is required if :field is not empty\",\n sortOrder: -2,\n requiresValue: false,\n defaultErrorMessage: \"The :input is required\",\n async validate(value: any, context) {\n const fieldValue = getFieldValue(this, context);\n\n // Field is required if the other field is not empty\n if (isEmptyValue(value) && !isEmptyValue(fieldValue)) {\n this.context.translatableParams.field = this.context.options.field;\n return invalidRule(this, context);\n }\n\n return VALID_RULE;\n },\n};\n\n/**\n * Required if in rule - field is required if another field's value is in the given array\n * Supports both global and sibling scope\n */\nexport const requiredIfInRule: SchemaRule<{\n field: string;\n values: any[];\n scope?: \"global\" | \"sibling\";\n}> = {\n name: \"requiredIfIn\",\n description: \"The field is required if :field value is in the given array\",\n sortOrder: -2,\n requiresValue: false,\n defaultErrorMessage: \"The :input is required\",\n async validate(value: any, context) {\n const { values } = this.context.options;\n const fieldValue = getFieldValue(this, context);\n\n // Field is required if the other field's value is in the array\n if (isEmptyValue(value) && values.includes(fieldValue)) {\n this.context.translatableParams.field = this.context.options.field;\n this.context.translationParams.values = this.context.options.values.join(\", \");\n return invalidRule(this, context);\n }\n\n return VALID_RULE;\n },\n};\n\n/**\n * Required if not in rule - field is required if another field's value is NOT in the given array\n * Supports both global and sibling scope\n */\nexport const requiredIfNotInRule: SchemaRule<{\n field: string;\n values: any[];\n scope?: \"global\" | \"sibling\";\n}> = {\n name: \"requiredIfNotIn\",\n description: \"The field is required if another field's value is NOT in the given array\",\n sortOrder: -2,\n requiresValue: false,\n defaultErrorMessage: \"The :input is required\",\n async validate(value: any, context) {\n const { values } = this.context.options;\n const fieldValue = getFieldValue(this, context);\n\n // Field is required if the other field's value is NOT in the array\n if (isEmptyValue(value) && !values.includes(fieldValue)) {\n this.context.translatableParams.field = this.context.options.field;\n this.context.translationParams.values = this.context.options.values.join(\", \");\n return invalidRule(this, context);\n }\n\n return VALID_RULE;\n },\n};\n\n/**\n * Get multiple field values based on scope\n */\nfunction getFieldsValues(\n rule: SchemaRule<{ fields: string[]; scope?: \"global\" | \"sibling\" }>,\n context: any,\n): any[] {\n const { fields, scope = \"global\" } = (rule as any).context.options;\n const source = scope === \"sibling\" ? context.parent : context.allValues;\n return fields.map((field: string) => get(source, field));\n}\n\n/**\n * Required if all empty rule - field is required if ALL specified fields are empty\n * Supports both global and sibling scope\n */\nexport const requiredIfAllEmptyRule: SchemaRule<{\n fields: string[];\n scope?: \"global\" | \"sibling\";\n}> = {\n name: \"requiredIfAllEmpty\",\n description: \"The field is required if all :fields are empty\",\n sortOrder: -2,\n requiresValue: false,\n defaultErrorMessage: \"The :input is required\",\n async validate(value: any, context) {\n const fieldValues = getFieldsValues(this, context);\n\n // Field is required if ALL other fields are empty\n const allEmpty = fieldValues.every((v) => isEmptyValue(v));\n if (isEmptyValue(value) && allEmpty) {\n this.context.options.fields.forEach((field) => {\n this.context.translatableParams.field = field;\n });\n return invalidRule(this, context);\n }\n\n return VALID_RULE;\n },\n};\n\n/**\n * Required if any empty rule - field is required if ANY of the specified fields is empty\n * Supports both global and sibling scope\n */\nexport const requiredIfAnyEmptyRule: SchemaRule<{\n fields: string[];\n scope?: \"global\" | \"sibling\";\n}> = {\n name: \"requiredIfAnyEmpty\",\n description: \"The field is required if any of the :fields is empty\",\n sortOrder: -2,\n requiresValue: false,\n defaultErrorMessage: \"The :input is required\",\n async validate(value: any, context) {\n const fieldValues = getFieldsValues(this, context);\n\n // Field is required if ANY other field is empty\n const anyEmpty = fieldValues.some((v) => isEmptyValue(v));\n if (isEmptyValue(value) && anyEmpty) {\n this.context.options.fields.forEach((field) => {\n this.context.translatableParams.field = field;\n });\n return invalidRule(this, context);\n }\n\n return VALID_RULE;\n },\n};\n\n/**\n * Required if all not empty rule - field is required if ALL specified fields are NOT empty\n * Supports both global and sibling scope\n */\nexport const requiredIfAllNotEmptyRule: SchemaRule<{\n fields: string[];\n scope?: \"global\" | \"sibling\";\n}> = {\n name: \"requiredIfAllNotEmpty\",\n description: \"The field is required if all :fields are not empty\",\n sortOrder: -2,\n requiresValue: false,\n defaultErrorMessage: \"The :input is required\",\n async validate(value: any, context) {\n const fieldValues = getFieldsValues(this, context);\n\n // Field is required if ALL other fields are NOT empty\n const allNotEmpty = fieldValues.every((v) => !isEmptyValue(v));\n if (isEmptyValue(value) && allNotEmpty) {\n this.context.options.fields.forEach((field) => {\n this.context.translatableParams.field = field;\n });\n return invalidRule(this, context);\n }\n\n return VALID_RULE;\n },\n};\n\n/**\n * Required if any not empty rule - field is required if ANY of the specified fields is NOT empty\n * Supports both global and sibling scope\n */\nexport const requiredIfAnyNotEmptyRule: SchemaRule<{\n fields: string[];\n scope?: \"global\" | \"sibling\";\n}> = {\n name: \"requiredIfAnyNotEmpty\",\n description: \"The field is required if any of the :fields is not empty\",\n sortOrder: -2,\n requiresValue: false,\n defaultErrorMessage: \"The :input is required\",\n async validate(value: any, context) {\n const fieldValues = getFieldsValues(this, context);\n\n // Field is required if ANY other field is NOT empty\n const anyNotEmpty = fieldValues.some((v) => !isEmptyValue(v));\n if (isEmptyValue(value) && anyNotEmpty) {\n this.context.options.fields.forEach((field) => {\n this.context.translatableParams.field = field;\n });\n return invalidRule(this, context);\n }\n\n return VALID_RULE;\n },\n};\n"],"mappings":"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"}
1
+ {"version":3,"file":"required-if-rules.mjs","names":[],"sources":["../../../../../../../../../packages/seal/src/rules/conditional/required-if-rules.ts"],"sourcesContent":["import { get } from \"@mongez/reinforcements\";\nimport { getFieldValue, invalidRule, VALID_RULE } from \"../../helpers\";\nimport { isEmptyValue } from \"../../helpers/is-empty-value\";\nimport type { SchemaRule } from \"../../types\";\n\n/**\n * Required if rule - field is required if another field equals a specific value\n * Supports both global and sibling scope\n */\nexport const requiredIfRule: SchemaRule<{\n field: string;\n value: any;\n scope?: \"global\" | \"sibling\";\n}> = {\n name: \"requiredIf\",\n description: \"The field is required if another field equals a specific value\",\n sortOrder: -2,\n requiresValue: false,\n defaultErrorMessage: \"The :input is required\",\n async validate(value: any, context) {\n const { value: expectedValue } = this.context.options;\n const fieldValue = getFieldValue(this, context);\n\n // Field is required if the other field equals the expected value\n if (isEmptyValue(value) && fieldValue === expectedValue) {\n this.context.translatableParams.field = this.context.options.field;\n return invalidRule(this, context);\n }\n\n return VALID_RULE;\n },\n};\n\n/**\n * Required if empty rule - field is required if another field is empty\n * Supports both global and sibling scope\n */\nexport const requiredIfEmptyRule: SchemaRule<{\n field: string;\n scope?: \"global\" | \"sibling\";\n}> = {\n name: \"requiredIfEmpty\",\n description: \"The field is required if :field is empty\",\n sortOrder: -2,\n requiresValue: false,\n defaultErrorMessage: \"The :input is required\",\n async validate(value: any, context) {\n const fieldValue = getFieldValue(this, context);\n\n // Field is required if the other field is empty\n if (isEmptyValue(value) && isEmptyValue(fieldValue)) {\n this.context.translatableParams.field = this.context.options.field;\n return invalidRule(this, context);\n }\n\n return VALID_RULE;\n },\n};\n\n/**\n * Required if not empty rule - field is required if another field is not empty\n * Supports both global and sibling scope\n */\nexport const requiredIfNotEmptyRule: SchemaRule<{\n field: string;\n scope?: \"global\" | \"sibling\";\n}> = {\n name: \"requiredIfNotEmpty\",\n description: \"The field is required if :field is not empty\",\n sortOrder: -2,\n requiresValue: false,\n defaultErrorMessage: \"The :input is required\",\n async validate(value: any, context) {\n const fieldValue = getFieldValue(this, context);\n\n // Field is required if the other field is not empty\n if (isEmptyValue(value) && !isEmptyValue(fieldValue)) {\n this.context.translatableParams.field = this.context.options.field;\n return invalidRule(this, context);\n }\n\n return VALID_RULE;\n },\n};\n\n/**\n * Required if in rule - field is required if another field's value is in the given array\n * Supports both global and sibling scope\n */\nexport const requiredIfInRule: SchemaRule<{\n field: string;\n values: any[];\n scope?: \"global\" | \"sibling\";\n}> = {\n name: \"requiredIfIn\",\n description: \"The field is required if :field value is in the given array\",\n sortOrder: -2,\n requiresValue: false,\n defaultErrorMessage: \"The :input is required\",\n async validate(value: any, context) {\n const { values } = this.context.options;\n const fieldValue = getFieldValue(this, context);\n\n // Field is required if the other field's value is in the array\n if (isEmptyValue(value) && values.includes(fieldValue)) {\n this.context.translatableParams.field = this.context.options.field;\n this.context.translationParams.values = this.context.options.values.join(\", \");\n return invalidRule(this, context);\n }\n\n return VALID_RULE;\n },\n};\n\n/**\n * Required if not in rule - field is required if another field's value is NOT in the given array\n * Supports both global and sibling scope\n */\nexport const requiredIfNotInRule: SchemaRule<{\n field: string;\n values: any[];\n scope?: \"global\" | \"sibling\";\n}> = {\n name: \"requiredIfNotIn\",\n description: \"The field is required if another field's value is NOT in the given array\",\n sortOrder: -2,\n requiresValue: false,\n defaultErrorMessage: \"The :input is required\",\n async validate(value: any, context) {\n const { values } = this.context.options;\n const fieldValue = getFieldValue(this, context);\n\n // Field is required if the other field's value is NOT in the array\n if (isEmptyValue(value) && !values.includes(fieldValue)) {\n this.context.translatableParams.field = this.context.options.field;\n this.context.translationParams.values = this.context.options.values.join(\", \");\n return invalidRule(this, context);\n }\n\n return VALID_RULE;\n },\n};\n\n/**\n * Get multiple field values based on scope\n */\nfunction getFieldsValues(\n rule: SchemaRule<{ fields: string[]; scope?: \"global\" | \"sibling\" }>,\n context: any,\n): any[] {\n const { fields, scope = \"global\" } = (rule as any).context.options;\n const source = scope === \"sibling\" ? context.parent : context.allValues;\n return fields.map((field: string) => get(source, field));\n}\n\n/**\n * Required if all empty rule - field is required if ALL specified fields are empty\n * Supports both global and sibling scope\n */\nexport const requiredIfAllEmptyRule: SchemaRule<{\n fields: string[];\n scope?: \"global\" | \"sibling\";\n}> = {\n name: \"requiredIfAllEmpty\",\n description: \"The field is required if all :fields are empty\",\n sortOrder: -2,\n requiresValue: false,\n defaultErrorMessage: \"The :input is required\",\n async validate(value: any, context) {\n const fieldValues = getFieldsValues(this, context);\n\n // Field is required if ALL other fields are empty\n const allEmpty = fieldValues.every((v) => isEmptyValue(v));\n if (isEmptyValue(value) && allEmpty) {\n this.context.options.fields.forEach((field) => {\n this.context.translatableParams.field = field;\n });\n return invalidRule(this, context);\n }\n\n return VALID_RULE;\n },\n};\n\n/**\n * Required if any empty rule - field is required if ANY of the specified fields is empty\n * Supports both global and sibling scope\n */\nexport const requiredIfAnyEmptyRule: SchemaRule<{\n fields: string[];\n scope?: \"global\" | \"sibling\";\n}> = {\n name: \"requiredIfAnyEmpty\",\n description: \"The field is required if any of the :fields is empty\",\n sortOrder: -2,\n requiresValue: false,\n defaultErrorMessage: \"The :input is required\",\n async validate(value: any, context) {\n const fieldValues = getFieldsValues(this, context);\n\n // Field is required if ANY other field is empty\n const anyEmpty = fieldValues.some((v) => isEmptyValue(v));\n if (isEmptyValue(value) && anyEmpty) {\n this.context.options.fields.forEach((field) => {\n this.context.translatableParams.field = field;\n });\n return invalidRule(this, context);\n }\n\n return VALID_RULE;\n },\n};\n\n/**\n * Required if all not empty rule - field is required if ALL specified fields are NOT empty\n * Supports both global and sibling scope\n */\nexport const requiredIfAllNotEmptyRule: SchemaRule<{\n fields: string[];\n scope?: \"global\" | \"sibling\";\n}> = {\n name: \"requiredIfAllNotEmpty\",\n description: \"The field is required if all :fields are not empty\",\n sortOrder: -2,\n requiresValue: false,\n defaultErrorMessage: \"The :input is required\",\n async validate(value: any, context) {\n const fieldValues = getFieldsValues(this, context);\n\n // Field is required if ALL other fields are NOT empty\n const allNotEmpty = fieldValues.every((v) => !isEmptyValue(v));\n if (isEmptyValue(value) && allNotEmpty) {\n this.context.options.fields.forEach((field) => {\n this.context.translatableParams.field = field;\n });\n return invalidRule(this, context);\n }\n\n return VALID_RULE;\n },\n};\n\n/**\n * Required if any not empty rule - field is required if ANY of the specified fields is NOT empty\n * Supports both global and sibling scope\n */\nexport const requiredIfAnyNotEmptyRule: SchemaRule<{\n fields: string[];\n scope?: \"global\" | \"sibling\";\n}> = {\n name: \"requiredIfAnyNotEmpty\",\n description: \"The field is required if any of the :fields is not empty\",\n sortOrder: -2,\n requiresValue: false,\n defaultErrorMessage: \"The :input is required\",\n async validate(value: any, context) {\n const fieldValues = getFieldsValues(this, context);\n\n // Field is required if ANY other field is NOT empty\n const anyNotEmpty = fieldValues.some((v) => !isEmptyValue(v));\n if (isEmptyValue(value) && anyNotEmpty) {\n this.context.options.fields.forEach((field) => {\n this.context.translatableParams.field = field;\n });\n return invalidRule(this, context);\n }\n\n return VALID_RULE;\n },\n};\n"],"mappings":"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"}
@@ -1,5 +1,6 @@
1
1
  import { SchemaRule } from "../../types/rule-types.mjs";
2
- //#region ../seal/src/rules/conditional/required-unless-rules.d.ts
2
+
3
+ //#region ../../packages/seal/src/rules/conditional/required-unless-rules.d.ts
3
4
  /**
4
5
  * Required unless rule - field is required unless another field equals a specific value
5
6
  * Supports both global and sibling scope
@@ -1 +1 @@
1
- {"version":3,"file":"required-unless-rules.d.mts","names":[],"sources":["../../../../../../../../seal/src/rules/conditional/required-unless-rules.ts"],"mappings":";;;;;AAQA;cAAa,kBAAA,EAAoB,UAAU;EACzC,KAAA;EACA,KAAA;EACA,KAAA;AAAA"}
1
+ {"version":3,"file":"required-unless-rules.d.mts","names":[],"sources":["../../../../../../../../../packages/seal/src/rules/conditional/required-unless-rules.ts"],"mappings":";;;;;AAQA;;cAAa,kBAAA,EAAoB,UAAU;EACzC,KAAA;EACA,KAAA;EACA,KAAA;AAAA"}
@@ -3,7 +3,7 @@ import { isEmptyValue } from "../../helpers/is-empty-value.mjs";
3
3
  import { getFieldValue } from "../../helpers/get-field-value.mjs";
4
4
  import "../../helpers/index.mjs";
5
5
 
6
- //#region ../seal/src/rules/conditional/required-unless-rules.ts
6
+ //#region ../../packages/seal/src/rules/conditional/required-unless-rules.ts
7
7
  /**
8
8
  * Required unless rule - field is required unless another field equals a specific value
9
9
  * Supports both global and sibling scope
@@ -1 +1 @@
1
- {"version":3,"file":"required-unless-rules.mjs","names":[],"sources":["../../../../../../../../seal/src/rules/conditional/required-unless-rules.ts"],"sourcesContent":["import { getFieldValue, invalidRule, VALID_RULE } from \"../../helpers\";\nimport type { SchemaRule } from \"../../types\";\nimport { isEmptyValue } from \"./../../helpers/is-empty-value\";\n\n/**\n * Required unless rule - field is required unless another field equals a specific value\n * Supports both global and sibling scope\n */\nexport const requiredUnlessRule: SchemaRule<{\n field: string;\n value: any;\n scope?: \"global\" | \"sibling\";\n}> = {\n name: \"requiredUnless\",\n description: \"The field is required unless another field equals a specific value\",\n sortOrder: -2,\n requiresValue: false,\n defaultErrorMessage: \"The :input is required\",\n async validate(value: any, context) {\n const { value: expectedValue } = this.context.options;\n const fieldValue = getFieldValue(this, context);\n\n // Field is required unless the other field equals the expected value\n if (isEmptyValue(value) && fieldValue !== expectedValue) {\n this.context.translatableParams.field = this.context.options.field;\n this.context.translationParams.value = this.context.options.value;\n return invalidRule(this, context);\n }\n\n return VALID_RULE;\n },\n};\n"],"mappings":";;;;;;;;;;AAQA,MAAa,qBAIR;CACH,MAAM;CACN,aAAa;CACb,WAAW;CACX,eAAe;CACf,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,MAAM,EAAE,OAAO,kBAAkB,KAAK,QAAQ;EAC9C,MAAM,aAAa,cAAc,MAAM,OAAO;EAG9C,IAAI,aAAa,KAAK,KAAK,eAAe,eAAe;GACvD,KAAK,QAAQ,mBAAmB,QAAQ,KAAK,QAAQ,QAAQ;GAC7D,KAAK,QAAQ,kBAAkB,QAAQ,KAAK,QAAQ,QAAQ;GAC5D,OAAO,YAAY,MAAM,OAAO;EAClC;EAEA,OAAO;CACT;AACF"}
1
+ {"version":3,"file":"required-unless-rules.mjs","names":[],"sources":["../../../../../../../../../packages/seal/src/rules/conditional/required-unless-rules.ts"],"sourcesContent":["import { getFieldValue, invalidRule, VALID_RULE } from \"../../helpers\";\nimport type { SchemaRule } from \"../../types\";\nimport { isEmptyValue } from \"./../../helpers/is-empty-value\";\n\n/**\n * Required unless rule - field is required unless another field equals a specific value\n * Supports both global and sibling scope\n */\nexport const requiredUnlessRule: SchemaRule<{\n field: string;\n value: any;\n scope?: \"global\" | \"sibling\";\n}> = {\n name: \"requiredUnless\",\n description: \"The field is required unless another field equals a specific value\",\n sortOrder: -2,\n requiresValue: false,\n defaultErrorMessage: \"The :input is required\",\n async validate(value: any, context) {\n const { value: expectedValue } = this.context.options;\n const fieldValue = getFieldValue(this, context);\n\n // Field is required unless the other field equals the expected value\n if (isEmptyValue(value) && fieldValue !== expectedValue) {\n this.context.translatableParams.field = this.context.options.field;\n this.context.translationParams.value = this.context.options.value;\n return invalidRule(this, context);\n }\n\n return VALID_RULE;\n },\n};\n"],"mappings":";;;;;;;;;;AAQA,MAAa,qBAIR;CACH,MAAM;CACN,aAAa;CACb,WAAW;CACX,eAAe;CACf,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,MAAM,EAAE,OAAO,kBAAkB,KAAK,QAAQ;EAC9C,MAAM,aAAa,cAAc,MAAM,OAAO;EAG9C,IAAI,aAAa,KAAK,KAAK,eAAe,eAAe;GACvD,KAAK,QAAQ,mBAAmB,QAAQ,KAAK,QAAQ,QAAQ;GAC7D,KAAK,QAAQ,kBAAkB,QAAQ,KAAK,QAAQ,QAAQ;GAC5D,OAAO,YAAY,MAAM,OAAO;EAClC;EAEA,OAAO;CACT;AACF"}
@@ -1,6 +1,7 @@
1
1
  import { SchemaRule } from "../../types/rule-types.mjs";
2
2
  import { SchemaContext } from "../../types/context-types.mjs";
3
- //#region ../seal/src/rules/conditional/required-when-rule.d.ts
3
+
4
+ //#region ../../packages/seal/src/rules/conditional/required-when-rule.d.ts
4
5
  /**
5
6
  * Required when callback returns true.
6
7
  *
@@ -1 +1 @@
1
- {"version":3,"file":"required-when-rule.d.mts","names":[],"sources":["../../../../../../../../seal/src/rules/conditional/required-when-rule.ts"],"mappings":";;;;;;;AAiBA;;;;;;;;;cAAa,gBAAA,EAAkB,UAAA;EAC7B,QAAA,GAAW,OAAA,EAAS,aAAA,eAA4B,OAAA;AAAA"}
1
+ {"version":3,"file":"required-when-rule.d.mts","names":[],"sources":["../../../../../../../../../packages/seal/src/rules/conditional/required-when-rule.ts"],"mappings":";;;;;;;AAiBA;;;;;;;;;;cAAa,gBAAA,EAAkB,UAAA;EAC7B,QAAA,GAAW,OAAA,EAAS,aAAA,eAA4B,OAAA;AAAA"}
@@ -2,7 +2,7 @@ import { VALID_RULE, invalidRule } from "../../helpers/validation-helpers.mjs";
2
2
  import { isEmptyValue } from "../../helpers/is-empty-value.mjs";
3
3
  import "../../helpers/index.mjs";
4
4
 
5
- //#region ../seal/src/rules/conditional/required-when-rule.ts
5
+ //#region ../../packages/seal/src/rules/conditional/required-when-rule.ts
6
6
  /**
7
7
  * Required when callback returns true.
8
8
  *
@@ -1 +1 @@
1
- {"version":3,"file":"required-when-rule.mjs","names":[],"sources":["../../../../../../../../seal/src/rules/conditional/required-when-rule.ts"],"sourcesContent":["import { invalidRule, VALID_RULE } from \"../../helpers\";\nimport { isEmptyValue } from \"../../helpers/is-empty-value\";\nimport type { SchemaContext, SchemaRule } from \"../../types\";\n\n/**\n * Required when callback returns true.\n *\n * The callback receives only the SchemaContext (not the value),\n * because \"required\" is about surrounding conditions, not the field itself.\n *\n * @example\n * ```ts\n * v.string().requiredWhen((context) => {\n * return context.allData.notificationMethod === 'email';\n * })\n * ```\n */\nexport const requiredWhenRule: SchemaRule<{\n callback: (context: SchemaContext) => boolean | Promise<boolean>;\n}> = {\n name: \"requiredWhen\",\n defaultErrorMessage: \"The :input is required\",\n requiresValue: false,\n sortOrder: -2,\n async validate(value, context) {\n const shouldBeRequired = await this.context.options.callback?.(context);\n\n if (shouldBeRequired && isEmptyValue(value)) {\n return invalidRule(this, context);\n }\n\n return VALID_RULE;\n },\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAiBA,MAAa,mBAER;CACH,MAAM;CACN,qBAAqB;CACrB,eAAe;CACf,WAAW;CACX,MAAM,SAAS,OAAO,SAAS;EAG7B,IAAI,MAF2B,KAAK,QAAQ,QAAQ,WAAW,OAAO,KAE9C,aAAa,KAAK,GACxC,OAAO,YAAY,MAAM,OAAO;EAGlC,OAAO;CACT;AACF"}
1
+ {"version":3,"file":"required-when-rule.mjs","names":[],"sources":["../../../../../../../../../packages/seal/src/rules/conditional/required-when-rule.ts"],"sourcesContent":["import { invalidRule, VALID_RULE } from \"../../helpers\";\nimport { isEmptyValue } from \"../../helpers/is-empty-value\";\nimport type { SchemaContext, SchemaRule } from \"../../types\";\n\n/**\n * Required when callback returns true.\n *\n * The callback receives only the SchemaContext (not the value),\n * because \"required\" is about surrounding conditions, not the field itself.\n *\n * @example\n * ```ts\n * v.string().requiredWhen((context) => {\n * return context.allData.notificationMethod === 'email';\n * })\n * ```\n */\nexport const requiredWhenRule: SchemaRule<{\n callback: (context: SchemaContext) => boolean | Promise<boolean>;\n}> = {\n name: \"requiredWhen\",\n defaultErrorMessage: \"The :input is required\",\n requiresValue: false,\n sortOrder: -2,\n async validate(value, context) {\n const shouldBeRequired = await this.context.options.callback?.(context);\n\n if (shouldBeRequired && isEmptyValue(value)) {\n return invalidRule(this, context);\n }\n\n return VALID_RULE;\n },\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAiBA,MAAa,mBAER;CACH,MAAM;CACN,qBAAqB;CACrB,eAAe;CACf,WAAW;CACX,MAAM,SAAS,OAAO,SAAS;EAG7B,IAAI,MAF2B,KAAK,QAAQ,QAAQ,WAAW,OAAO,KAE9C,aAAa,KAAK,GACxC,OAAO,YAAY,MAAM,OAAO;EAGlC,OAAO;CACT;AACF"}
@@ -1,5 +1,6 @@
1
1
  import { SchemaRule } from "../../types/rule-types.mjs";
2
- //#region ../seal/src/rules/conditional/required-with-rules.d.ts
2
+
3
+ //#region ../../packages/seal/src/rules/conditional/required-with-rules.d.ts
3
4
  /**
4
5
  * Required with rule - field is required if another field is present
5
6
  * Supports both global and sibling scope
@@ -1 +1 @@
1
- {"version":3,"file":"required-with-rules.d.mts","names":[],"sources":["../../../../../../../../seal/src/rules/conditional/required-with-rules.ts"],"mappings":";;;;;AASA;cAAa,gBAAA,EAAkB,UAAU;EACvC,KAAA;EACA,KAAA;AAAA;;;;AAAK;cAwBM,mBAAA,EAAqB,UAAU;EAC1C,MAAA;EACA,KAAA;AAAA;;;;;cA2BW,mBAAA,EAAqB,UAAU;EAC1C,MAAA;EACA,KAAA;AAAA"}
1
+ {"version":3,"file":"required-with-rules.d.mts","names":[],"sources":["../../../../../../../../../packages/seal/src/rules/conditional/required-with-rules.ts"],"mappings":";;;;;AASA;;cAAa,gBAAA,EAAkB,UAAU;EACvC,KAAA;EACA,KAAA;AAAA;;;AAAK;AAwBP;cAAa,mBAAA,EAAqB,UAAU;EAC1C,MAAA;EACA,KAAA;AAAA;;;;AAAK;cA2BM,mBAAA,EAAqB,UAAU;EAC1C,MAAA;EACA,KAAA;AAAA"}
@@ -4,7 +4,7 @@ import { getFieldValue } from "../../helpers/get-field-value.mjs";
4
4
  import "../../helpers/index.mjs";
5
5
  import { get } from "@mongez/reinforcements";
6
6
 
7
- //#region ../seal/src/rules/conditional/required-with-rules.ts
7
+ //#region ../../packages/seal/src/rules/conditional/required-with-rules.ts
8
8
  /**
9
9
  * Required with rule - field is required if another field is present
10
10
  * Supports both global and sibling scope
@@ -1 +1 @@
1
- {"version":3,"file":"required-with-rules.mjs","names":[],"sources":["../../../../../../../../seal/src/rules/conditional/required-with-rules.ts"],"sourcesContent":["import { get } from \"@mongez/reinforcements\";\nimport { getFieldValue, invalidRule, VALID_RULE } from \"../../helpers\";\nimport { isEmptyValue } from \"../../helpers/is-empty-value\";\nimport type { SchemaRule } from \"../../types\";\n\n/**\n * Required with rule - field is required if another field is present\n * Supports both global and sibling scope\n */\nexport const requiredWithRule: SchemaRule<{\n field: string;\n scope?: \"global\" | \"sibling\";\n}> = {\n name: \"requiredWith\",\n description: \"The field is required if another field is present\",\n sortOrder: -2,\n requiresValue: false,\n defaultErrorMessage: \"The :input is required\",\n async validate(value: any, context) {\n const fieldValue = getFieldValue(this, context);\n\n // Field is required if the other field is present\n if (isEmptyValue(value) && fieldValue !== undefined) {\n this.context.translatableParams.field = this.context.options.field;\n return invalidRule(this, context);\n }\n\n return VALID_RULE;\n },\n};\n\n/**\n * Required with all rule - field is required if all specified fields are present\n * Supports both global and sibling scope\n */\nexport const requiredWithAllRule: SchemaRule<{\n fields: string[];\n scope?: \"global\" | \"sibling\";\n}> = {\n name: \"requiredWithAll\",\n description: \"The field is required if all specified fields are present\",\n sortOrder: -2,\n requiresValue: false,\n defaultErrorMessage: \"The :input is required\",\n async validate(value: any, context) {\n const { fields, scope = \"global\" } = this.context.options;\n const source = scope === \"sibling\" ? context.parent : context.allValues;\n\n // Check if all fields are present\n const allPresent = fields.every((field) => get(source, field) !== undefined);\n\n // Field is required if all other fields are present\n if (isEmptyValue(value) && allPresent) {\n return invalidRule(this, context);\n }\n\n return VALID_RULE;\n },\n};\n\n/**\n * Required with any rule - field is required if any of the specified fields is present\n * Supports both global and sibling scope\n */\nexport const requiredWithAnyRule: SchemaRule<{\n fields: string[];\n scope?: \"global\" | \"sibling\";\n}> = {\n name: \"requiredWithAny\",\n description: \"The field is required if any of the specified fields is present\",\n sortOrder: -2,\n requiresValue: false,\n defaultErrorMessage: \"The :input is required\",\n async validate(value: any, context) {\n const { fields, scope = \"global\" } = this.context.options;\n const source = scope === \"sibling\" ? context.parent : context.allValues;\n\n // Check if any field is present\n const anyPresent = fields.some((field) => get(source, field) !== undefined);\n\n // Field is required if any other field is present\n if (isEmptyValue(value) && anyPresent) {\n return invalidRule(this, context);\n }\n\n return VALID_RULE;\n },\n};\n"],"mappings":";;;;;;;;;;;AASA,MAAa,mBAGR;CACH,MAAM;CACN,aAAa;CACb,WAAW;CACX,eAAe;CACf,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,MAAM,aAAa,cAAc,MAAM,OAAO;EAG9C,IAAI,aAAa,KAAK,KAAK,eAAe,QAAW;GACnD,KAAK,QAAQ,mBAAmB,QAAQ,KAAK,QAAQ,QAAQ;GAC7D,OAAO,YAAY,MAAM,OAAO;EAClC;EAEA,OAAO;CACT;AACF;;;;;AAMA,MAAa,sBAGR;CACH,MAAM;CACN,aAAa;CACb,WAAW;CACX,eAAe;CACf,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,MAAM,EAAE,QAAQ,QAAQ,aAAa,KAAK,QAAQ;EAClD,MAAM,SAAS,UAAU,YAAY,QAAQ,SAAS,QAAQ;EAG9D,MAAM,aAAa,OAAO,OAAO,UAAU,IAAI,QAAQ,KAAK,MAAM,MAAS;EAG3E,IAAI,aAAa,KAAK,KAAK,YACzB,OAAO,YAAY,MAAM,OAAO;EAGlC,OAAO;CACT;AACF;;;;;AAMA,MAAa,sBAGR;CACH,MAAM;CACN,aAAa;CACb,WAAW;CACX,eAAe;CACf,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,MAAM,EAAE,QAAQ,QAAQ,aAAa,KAAK,QAAQ;EAClD,MAAM,SAAS,UAAU,YAAY,QAAQ,SAAS,QAAQ;EAG9D,MAAM,aAAa,OAAO,MAAM,UAAU,IAAI,QAAQ,KAAK,MAAM,MAAS;EAG1E,IAAI,aAAa,KAAK,KAAK,YACzB,OAAO,YAAY,MAAM,OAAO;EAGlC,OAAO;CACT;AACF"}
1
+ {"version":3,"file":"required-with-rules.mjs","names":[],"sources":["../../../../../../../../../packages/seal/src/rules/conditional/required-with-rules.ts"],"sourcesContent":["import { get } from \"@mongez/reinforcements\";\nimport { getFieldValue, invalidRule, VALID_RULE } from \"../../helpers\";\nimport { isEmptyValue } from \"../../helpers/is-empty-value\";\nimport type { SchemaRule } from \"../../types\";\n\n/**\n * Required with rule - field is required if another field is present\n * Supports both global and sibling scope\n */\nexport const requiredWithRule: SchemaRule<{\n field: string;\n scope?: \"global\" | \"sibling\";\n}> = {\n name: \"requiredWith\",\n description: \"The field is required if another field is present\",\n sortOrder: -2,\n requiresValue: false,\n defaultErrorMessage: \"The :input is required\",\n async validate(value: any, context) {\n const fieldValue = getFieldValue(this, context);\n\n // Field is required if the other field is present\n if (isEmptyValue(value) && fieldValue !== undefined) {\n this.context.translatableParams.field = this.context.options.field;\n return invalidRule(this, context);\n }\n\n return VALID_RULE;\n },\n};\n\n/**\n * Required with all rule - field is required if all specified fields are present\n * Supports both global and sibling scope\n */\nexport const requiredWithAllRule: SchemaRule<{\n fields: string[];\n scope?: \"global\" | \"sibling\";\n}> = {\n name: \"requiredWithAll\",\n description: \"The field is required if all specified fields are present\",\n sortOrder: -2,\n requiresValue: false,\n defaultErrorMessage: \"The :input is required\",\n async validate(value: any, context) {\n const { fields, scope = \"global\" } = this.context.options;\n const source = scope === \"sibling\" ? context.parent : context.allValues;\n\n // Check if all fields are present\n const allPresent = fields.every((field) => get(source, field) !== undefined);\n\n // Field is required if all other fields are present\n if (isEmptyValue(value) && allPresent) {\n return invalidRule(this, context);\n }\n\n return VALID_RULE;\n },\n};\n\n/**\n * Required with any rule - field is required if any of the specified fields is present\n * Supports both global and sibling scope\n */\nexport const requiredWithAnyRule: SchemaRule<{\n fields: string[];\n scope?: \"global\" | \"sibling\";\n}> = {\n name: \"requiredWithAny\",\n description: \"The field is required if any of the specified fields is present\",\n sortOrder: -2,\n requiresValue: false,\n defaultErrorMessage: \"The :input is required\",\n async validate(value: any, context) {\n const { fields, scope = \"global\" } = this.context.options;\n const source = scope === \"sibling\" ? context.parent : context.allValues;\n\n // Check if any field is present\n const anyPresent = fields.some((field) => get(source, field) !== undefined);\n\n // Field is required if any other field is present\n if (isEmptyValue(value) && anyPresent) {\n return invalidRule(this, context);\n }\n\n return VALID_RULE;\n },\n};\n"],"mappings":";;;;;;;;;;;AASA,MAAa,mBAGR;CACH,MAAM;CACN,aAAa;CACb,WAAW;CACX,eAAe;CACf,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,MAAM,aAAa,cAAc,MAAM,OAAO;EAG9C,IAAI,aAAa,KAAK,KAAK,eAAe,QAAW;GACnD,KAAK,QAAQ,mBAAmB,QAAQ,KAAK,QAAQ,QAAQ;GAC7D,OAAO,YAAY,MAAM,OAAO;EAClC;EAEA,OAAO;CACT;AACF;;;;;AAMA,MAAa,sBAGR;CACH,MAAM;CACN,aAAa;CACb,WAAW;CACX,eAAe;CACf,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,MAAM,EAAE,QAAQ,QAAQ,aAAa,KAAK,QAAQ;EAClD,MAAM,SAAS,UAAU,YAAY,QAAQ,SAAS,QAAQ;EAG9D,MAAM,aAAa,OAAO,OAAO,UAAU,IAAI,QAAQ,KAAK,MAAM,MAAS;EAG3E,IAAI,aAAa,KAAK,KAAK,YACzB,OAAO,YAAY,MAAM,OAAO;EAGlC,OAAO;CACT;AACF;;;;;AAMA,MAAa,sBAGR;CACH,MAAM;CACN,aAAa;CACb,WAAW;CACX,eAAe;CACf,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,MAAM,EAAE,QAAQ,QAAQ,aAAa,KAAK,QAAQ;EAClD,MAAM,SAAS,UAAU,YAAY,QAAQ,SAAS,QAAQ;EAG9D,MAAM,aAAa,OAAO,MAAM,UAAU,IAAI,QAAQ,KAAK,MAAM,MAAS;EAG1E,IAAI,aAAa,KAAK,KAAK,YACzB,OAAO,YAAY,MAAM,OAAO;EAGlC,OAAO;CACT;AACF"}
@@ -1,5 +1,6 @@
1
1
  import { SchemaRule } from "../../types/rule-types.mjs";
2
- //#region ../seal/src/rules/conditional/required-without-rules.d.ts
2
+
3
+ //#region ../../packages/seal/src/rules/conditional/required-without-rules.d.ts
3
4
  /**
4
5
  * Required without rule - field is required if another field is missing
5
6
  * Supports both global and sibling scope
@@ -1 +1 @@
1
- {"version":3,"file":"required-without-rules.d.mts","names":[],"sources":["../../../../../../../../seal/src/rules/conditional/required-without-rules.ts"],"mappings":";;;;;AASA;cAAa,mBAAA,EAAqB,UAAU;EAC1C,KAAA;EACA,KAAA;AAAA;;;;AAAK;cAwBM,sBAAA,EAAwB,UAAU;EAC7C,MAAA;EACA,KAAA;AAAA;;;;;cA2BW,sBAAA,EAAwB,UAAU;EAC7C,MAAA;EACA,KAAA;AAAA"}
1
+ {"version":3,"file":"required-without-rules.d.mts","names":[],"sources":["../../../../../../../../../packages/seal/src/rules/conditional/required-without-rules.ts"],"mappings":";;;;;AASA;;cAAa,mBAAA,EAAqB,UAAU;EAC1C,KAAA;EACA,KAAA;AAAA;;;AAAK;AAwBP;cAAa,sBAAA,EAAwB,UAAU;EAC7C,MAAA;EACA,KAAA;AAAA;;;;AAAK;cA2BM,sBAAA,EAAwB,UAAU;EAC7C,MAAA;EACA,KAAA;AAAA"}
@@ -4,7 +4,7 @@ import { getFieldValue } from "../../helpers/get-field-value.mjs";
4
4
  import "../../helpers/index.mjs";
5
5
  import { get } from "@mongez/reinforcements";
6
6
 
7
- //#region ../seal/src/rules/conditional/required-without-rules.ts
7
+ //#region ../../packages/seal/src/rules/conditional/required-without-rules.ts
8
8
  /**
9
9
  * Required without rule - field is required if another field is missing
10
10
  * Supports both global and sibling scope
@@ -1 +1 @@
1
- {"version":3,"file":"required-without-rules.mjs","names":[],"sources":["../../../../../../../../seal/src/rules/conditional/required-without-rules.ts"],"sourcesContent":["import { get } from \"@mongez/reinforcements\";\nimport { getFieldValue, invalidRule, VALID_RULE } from \"../../helpers\";\nimport type { SchemaRule } from \"../../types\";\nimport { isEmptyValue } from \"./../../helpers/is-empty-value\";\n\n/**\n * Required without rule - field is required if another field is missing\n * Supports both global and sibling scope\n */\nexport const requiredWithoutRule: SchemaRule<{\n field: string;\n scope?: \"global\" | \"sibling\";\n}> = {\n name: \"requiredWithout\",\n description: \"The field is required if another field is missing\",\n sortOrder: -2,\n requiresValue: false,\n defaultErrorMessage: \"The :input is required\",\n async validate(value: any, context) {\n const fieldValue = getFieldValue(this, context);\n\n // Field is required if the other field is missing\n if (isEmptyValue(value) && fieldValue === undefined) {\n this.context.translatableParams.field = this.context.options.field;\n return invalidRule(this, context);\n }\n\n return VALID_RULE;\n },\n};\n\n/**\n * Required without all rule - field is required if all specified fields are missing\n * Supports both global and sibling scope\n */\nexport const requiredWithoutAllRule: SchemaRule<{\n fields: string[];\n scope?: \"global\" | \"sibling\";\n}> = {\n name: \"requiredWithoutAll\",\n description: \"The field is required if all specified fields are missing\",\n sortOrder: -2,\n requiresValue: false,\n defaultErrorMessage: \"The :input is required\",\n async validate(value: any, context) {\n const { fields, scope = \"global\" } = this.context.options;\n const source = scope === \"sibling\" ? context.parent : context.allValues;\n\n // Check if all fields are missing\n const allMissing = fields.every((field) => get(source, field) === undefined);\n\n // Field is required if all other fields are missing\n if (isEmptyValue(value) && allMissing) {\n return invalidRule(this, context);\n }\n\n return VALID_RULE;\n },\n};\n\n/**\n * Required without any rule - field is required if any of the specified fields is missing\n * Supports both global and sibling scope\n */\nexport const requiredWithoutAnyRule: SchemaRule<{\n fields: string[];\n scope?: \"global\" | \"sibling\";\n}> = {\n name: \"requiredWithoutAny\",\n description: \"The field is required if any of the specified fields is missing\",\n sortOrder: -2,\n requiresValue: false,\n defaultErrorMessage: \"The :input is required\",\n async validate(value: any, context) {\n const { fields, scope = \"global\" } = this.context.options;\n const source = scope === \"sibling\" ? context.parent : context.allValues;\n\n // Check if any field is missing\n const anyMissing = fields.some((field) => get(source, field) === undefined);\n\n // Field is required if any other field is missing\n if (isEmptyValue(value) && anyMissing) {\n return invalidRule(this, context);\n }\n\n return VALID_RULE;\n },\n};\n"],"mappings":";;;;;;;;;;;AASA,MAAa,sBAGR;CACH,MAAM;CACN,aAAa;CACb,WAAW;CACX,eAAe;CACf,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,MAAM,aAAa,cAAc,MAAM,OAAO;EAG9C,IAAI,aAAa,KAAK,KAAK,eAAe,QAAW;GACnD,KAAK,QAAQ,mBAAmB,QAAQ,KAAK,QAAQ,QAAQ;GAC7D,OAAO,YAAY,MAAM,OAAO;EAClC;EAEA,OAAO;CACT;AACF;;;;;AAMA,MAAa,yBAGR;CACH,MAAM;CACN,aAAa;CACb,WAAW;CACX,eAAe;CACf,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,MAAM,EAAE,QAAQ,QAAQ,aAAa,KAAK,QAAQ;EAClD,MAAM,SAAS,UAAU,YAAY,QAAQ,SAAS,QAAQ;EAG9D,MAAM,aAAa,OAAO,OAAO,UAAU,IAAI,QAAQ,KAAK,MAAM,MAAS;EAG3E,IAAI,aAAa,KAAK,KAAK,YACzB,OAAO,YAAY,MAAM,OAAO;EAGlC,OAAO;CACT;AACF;;;;;AAMA,MAAa,yBAGR;CACH,MAAM;CACN,aAAa;CACb,WAAW;CACX,eAAe;CACf,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,MAAM,EAAE,QAAQ,QAAQ,aAAa,KAAK,QAAQ;EAClD,MAAM,SAAS,UAAU,YAAY,QAAQ,SAAS,QAAQ;EAG9D,MAAM,aAAa,OAAO,MAAM,UAAU,IAAI,QAAQ,KAAK,MAAM,MAAS;EAG1E,IAAI,aAAa,KAAK,KAAK,YACzB,OAAO,YAAY,MAAM,OAAO;EAGlC,OAAO;CACT;AACF"}
1
+ {"version":3,"file":"required-without-rules.mjs","names":[],"sources":["../../../../../../../../../packages/seal/src/rules/conditional/required-without-rules.ts"],"sourcesContent":["import { get } from \"@mongez/reinforcements\";\nimport { getFieldValue, invalidRule, VALID_RULE } from \"../../helpers\";\nimport type { SchemaRule } from \"../../types\";\nimport { isEmptyValue } from \"./../../helpers/is-empty-value\";\n\n/**\n * Required without rule - field is required if another field is missing\n * Supports both global and sibling scope\n */\nexport const requiredWithoutRule: SchemaRule<{\n field: string;\n scope?: \"global\" | \"sibling\";\n}> = {\n name: \"requiredWithout\",\n description: \"The field is required if another field is missing\",\n sortOrder: -2,\n requiresValue: false,\n defaultErrorMessage: \"The :input is required\",\n async validate(value: any, context) {\n const fieldValue = getFieldValue(this, context);\n\n // Field is required if the other field is missing\n if (isEmptyValue(value) && fieldValue === undefined) {\n this.context.translatableParams.field = this.context.options.field;\n return invalidRule(this, context);\n }\n\n return VALID_RULE;\n },\n};\n\n/**\n * Required without all rule - field is required if all specified fields are missing\n * Supports both global and sibling scope\n */\nexport const requiredWithoutAllRule: SchemaRule<{\n fields: string[];\n scope?: \"global\" | \"sibling\";\n}> = {\n name: \"requiredWithoutAll\",\n description: \"The field is required if all specified fields are missing\",\n sortOrder: -2,\n requiresValue: false,\n defaultErrorMessage: \"The :input is required\",\n async validate(value: any, context) {\n const { fields, scope = \"global\" } = this.context.options;\n const source = scope === \"sibling\" ? context.parent : context.allValues;\n\n // Check if all fields are missing\n const allMissing = fields.every((field) => get(source, field) === undefined);\n\n // Field is required if all other fields are missing\n if (isEmptyValue(value) && allMissing) {\n return invalidRule(this, context);\n }\n\n return VALID_RULE;\n },\n};\n\n/**\n * Required without any rule - field is required if any of the specified fields is missing\n * Supports both global and sibling scope\n */\nexport const requiredWithoutAnyRule: SchemaRule<{\n fields: string[];\n scope?: \"global\" | \"sibling\";\n}> = {\n name: \"requiredWithoutAny\",\n description: \"The field is required if any of the specified fields is missing\",\n sortOrder: -2,\n requiresValue: false,\n defaultErrorMessage: \"The :input is required\",\n async validate(value: any, context) {\n const { fields, scope = \"global\" } = this.context.options;\n const source = scope === \"sibling\" ? context.parent : context.allValues;\n\n // Check if any field is missing\n const anyMissing = fields.some((field) => get(source, field) === undefined);\n\n // Field is required if any other field is missing\n if (isEmptyValue(value) && anyMissing) {\n return invalidRule(this, context);\n }\n\n return VALID_RULE;\n },\n};\n"],"mappings":";;;;;;;;;;;AASA,MAAa,sBAGR;CACH,MAAM;CACN,aAAa;CACb,WAAW;CACX,eAAe;CACf,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,MAAM,aAAa,cAAc,MAAM,OAAO;EAG9C,IAAI,aAAa,KAAK,KAAK,eAAe,QAAW;GACnD,KAAK,QAAQ,mBAAmB,QAAQ,KAAK,QAAQ,QAAQ;GAC7D,OAAO,YAAY,MAAM,OAAO;EAClC;EAEA,OAAO;CACT;AACF;;;;;AAMA,MAAa,yBAGR;CACH,MAAM;CACN,aAAa;CACb,WAAW;CACX,eAAe;CACf,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,MAAM,EAAE,QAAQ,QAAQ,aAAa,KAAK,QAAQ;EAClD,MAAM,SAAS,UAAU,YAAY,QAAQ,SAAS,QAAQ;EAG9D,MAAM,aAAa,OAAO,OAAO,UAAU,IAAI,QAAQ,KAAK,MAAM,MAAS;EAG3E,IAAI,aAAa,KAAK,KAAK,YACzB,OAAO,YAAY,MAAM,OAAO;EAGlC,OAAO;CACT;AACF;;;;;AAMA,MAAa,yBAGR;CACH,MAAM;CACN,aAAa;CACb,WAAW;CACX,eAAe;CACf,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,MAAM,EAAE,QAAQ,QAAQ,aAAa,KAAK,QAAQ;EAClD,MAAM,SAAS,UAAU,YAAY,QAAQ,SAAS,QAAQ;EAG9D,MAAM,aAAa,OAAO,MAAM,UAAU,IAAI,QAAQ,KAAK,MAAM,MAAS;EAG1E,IAAI,aAAa,KAAK,KAAK,YACzB,OAAO,YAAY,MAAM,OAAO;EAGlC,OAAO;CACT;AACF"}
@@ -1,5 +1,6 @@
1
1
  import { SchemaRule } from "../../types/rule-types.mjs";
2
- //#region ../seal/src/rules/core/equal.d.ts
2
+
3
+ //#region ../../packages/seal/src/rules/core/equal.d.ts
3
4
  /**
4
5
  * Equal rule - value must be equal to a specific value
5
6
  */
@@ -1 +1 @@
1
- {"version":3,"file":"equal.d.mts","names":[],"sources":["../../../../../../../../seal/src/rules/core/equal.ts"],"mappings":";;;;;cAMa,SAAA,EAAW,UAAU;EAAG,KAAK;AAAA"}
1
+ {"version":3,"file":"equal.d.mts","names":[],"sources":["../../../../../../../../../packages/seal/src/rules/core/equal.ts"],"mappings":";;;;;AAMA;cAAa,SAAA,EAAW,UAAU;EAAG,KAAK;AAAA"}
@@ -1,7 +1,7 @@
1
1
  import { VALID_RULE, invalidRule } from "../../helpers/validation-helpers.mjs";
2
2
  import "../../helpers/index.mjs";
3
3
 
4
- //#region ../seal/src/rules/core/equal.ts
4
+ //#region ../../packages/seal/src/rules/core/equal.ts
5
5
  /**
6
6
  * Equal rule - value must be equal to a specific value
7
7
  */
@@ -1 +1 @@
1
- {"version":3,"file":"equal.mjs","names":[],"sources":["../../../../../../../../seal/src/rules/core/equal.ts"],"sourcesContent":["import { invalidRule, VALID_RULE } from \"../../helpers\";\nimport type { SchemaRule } from \"../../types\";\n\n/**\n * Equal rule - value must be equal to a specific value\n */\nexport const equalRule: SchemaRule<{ value: any }> = {\n name: \"equal\",\n defaultErrorMessage: \"The :input must be equal to :value\",\n async validate(value: any, context) {\n if (value !== this.context.options.value) {\n this.context.translatableParams.value = this.context.options.value;\n return invalidRule(this, context);\n }\n return VALID_RULE;\n },\n};\n"],"mappings":";;;;;;;AAMA,MAAa,YAAwC;CACnD,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,IAAI,UAAU,KAAK,QAAQ,QAAQ,OAAO;GACxC,KAAK,QAAQ,mBAAmB,QAAQ,KAAK,QAAQ,QAAQ;GAC7D,OAAO,YAAY,MAAM,OAAO;EAClC;EACA,OAAO;CACT;AACF"}
1
+ {"version":3,"file":"equal.mjs","names":[],"sources":["../../../../../../../../../packages/seal/src/rules/core/equal.ts"],"sourcesContent":["import { invalidRule, VALID_RULE } from \"../../helpers\";\nimport type { SchemaRule } from \"../../types\";\n\n/**\n * Equal rule - value must be equal to a specific value\n */\nexport const equalRule: SchemaRule<{ value: any }> = {\n name: \"equal\",\n defaultErrorMessage: \"The :input must be equal to :value\",\n async validate(value: any, context) {\n if (value !== this.context.options.value) {\n this.context.translatableParams.value = this.context.options.value;\n return invalidRule(this, context);\n }\n return VALID_RULE;\n },\n};\n"],"mappings":";;;;;;;AAMA,MAAa,YAAwC;CACnD,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,IAAI,UAAU,KAAK,QAAQ,QAAQ,OAAO;GACxC,KAAK,QAAQ,mBAAmB,QAAQ,KAAK,QAAQ,QAAQ;GAC7D,OAAO,YAAY,MAAM,OAAO;EAClC;EACA,OAAO;CACT;AACF"}
@@ -1,5 +1,6 @@
1
1
  import { SchemaRule } from "../../types/rule-types.mjs";
2
- //#region ../seal/src/rules/core/forbidden.d.ts
2
+
3
+ //#region ../../packages/seal/src/rules/core/forbidden.d.ts
3
4
  /**
4
5
  * Forbidden rule - value must not be present
5
6
  */
@@ -1 +1 @@
1
- {"version":3,"file":"forbidden.d.mts","names":[],"sources":["../../../../../../../../seal/src/rules/core/forbidden.ts"],"mappings":";;;;;cAOa,aAAA,EAAe,UAS3B"}
1
+ {"version":3,"file":"forbidden.d.mts","names":[],"sources":["../../../../../../../../../packages/seal/src/rules/core/forbidden.ts"],"mappings":";;;;;AAOA;cAAa,aAAA,EAAe,UAS3B"}
@@ -2,7 +2,7 @@ import { VALID_RULE, invalidRule } from "../../helpers/validation-helpers.mjs";
2
2
  import { isEmptyValue } from "../../helpers/is-empty-value.mjs";
3
3
  import "../../helpers/index.mjs";
4
4
 
5
- //#region ../seal/src/rules/core/forbidden.ts
5
+ //#region ../../packages/seal/src/rules/core/forbidden.ts
6
6
  /**
7
7
  * Forbidden rule - value must not be present
8
8
  */
@@ -1 +1 @@
1
- {"version":3,"file":"forbidden.mjs","names":[],"sources":["../../../../../../../../seal/src/rules/core/forbidden.ts"],"sourcesContent":["import { invalidRule, VALID_RULE } from \"../../helpers\";\nimport { isEmptyValue } from \"../../helpers/is-empty-value\";\nimport type { SchemaRule } from \"../../types\";\n\n/**\n * Forbidden rule - value must not be present\n */\nexport const forbiddenRule: SchemaRule = {\n name: \"forbidden\",\n defaultErrorMessage: \"The :input is forbidden\",\n async validate(value: any, context) {\n if (!isEmptyValue(value)) {\n return invalidRule(this, context);\n }\n return VALID_RULE;\n },\n};\n"],"mappings":";;;;;;;;AAOA,MAAa,gBAA4B;CACvC,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,IAAI,CAAC,aAAa,KAAK,GACrB,OAAO,YAAY,MAAM,OAAO;EAElC,OAAO;CACT;AACF"}
1
+ {"version":3,"file":"forbidden.mjs","names":[],"sources":["../../../../../../../../../packages/seal/src/rules/core/forbidden.ts"],"sourcesContent":["import { invalidRule, VALID_RULE } from \"../../helpers\";\nimport { isEmptyValue } from \"../../helpers/is-empty-value\";\nimport type { SchemaRule } from \"../../types\";\n\n/**\n * Forbidden rule - value must not be present\n */\nexport const forbiddenRule: SchemaRule = {\n name: \"forbidden\",\n defaultErrorMessage: \"The :input is forbidden\",\n async validate(value: any, context) {\n if (!isEmptyValue(value)) {\n return invalidRule(this, context);\n }\n return VALID_RULE;\n },\n};\n"],"mappings":";;;;;;;;AAOA,MAAa,gBAA4B;CACvC,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,IAAI,CAAC,aAAa,KAAK,GACrB,OAAO,YAAY,MAAM,OAAO;EAElC,OAAO;CACT;AACF"}
@@ -1,5 +1,6 @@
1
1
  import { SchemaRule } from "../../types/rule-types.mjs";
2
- //#region ../seal/src/rules/core/required.d.ts
2
+
3
+ //#region ../../packages/seal/src/rules/core/required.d.ts
3
4
  /**
4
5
  * Required rule - value must be present and not empty
5
6
  */
@@ -1 +1 @@
1
- {"version":3,"file":"required.d.mts","names":[],"sources":["../../../../../../../../seal/src/rules/core/required.ts"],"mappings":";;;;;cAOa,YAAA,EAAc,UAW1B;;;;AAAA;cAMY,WAAA,EAAa,UAYzB"}
1
+ {"version":3,"file":"required.d.mts","names":[],"sources":["../../../../../../../../../packages/seal/src/rules/core/required.ts"],"mappings":";;;;;AAOA;cAAa,YAAA,EAAc,UAW1B;;;AAAA;AAMD;cAAa,WAAA,EAAa,UAYzB"}
@@ -2,7 +2,7 @@ import { VALID_RULE, invalidRule } from "../../helpers/validation-helpers.mjs";
2
2
  import { isEmptyValue } from "../../helpers/is-empty-value.mjs";
3
3
  import "../../helpers/index.mjs";
4
4
 
5
- //#region ../seal/src/rules/core/required.ts
5
+ //#region ../../packages/seal/src/rules/core/required.ts
6
6
  /**
7
7
  * Required rule - value must be present and not empty
8
8
  */
@@ -1 +1 @@
1
- {"version":3,"file":"required.mjs","names":[],"sources":["../../../../../../../../seal/src/rules/core/required.ts"],"sourcesContent":["import { invalidRule, VALID_RULE } from \"../../helpers\";\nimport { isEmptyValue } from \"../../helpers/is-empty-value\";\nimport type { SchemaRule } from \"../../types\";\n\n/**\n * Required rule - value must be present and not empty\n */\nexport const requiredRule: SchemaRule = {\n name: \"required\",\n defaultErrorMessage: \"The :input is required\",\n requiresValue: false,\n sortOrder: -2,\n async validate(value: any, context) {\n if (isEmptyValue(value)) {\n return invalidRule(this, context);\n }\n return VALID_RULE;\n },\n};\n\n/**\n * Present rule - key must exist in the data, but value can be anything\n * (empty string, null are all valid as long as the key exists)\n */\nexport const presentRule: SchemaRule = {\n name: \"present\",\n defaultErrorMessage: \"The :input field is required\",\n requiresValue: false,\n sortOrder: -2,\n async validate(value: any, context) {\n if (value === undefined) {\n return invalidRule(this, context);\n }\n\n return VALID_RULE;\n },\n};\n"],"mappings":";;;;;;;;AAOA,MAAa,eAA2B;CACtC,MAAM;CACN,qBAAqB;CACrB,eAAe;CACf,WAAW;CACX,MAAM,SAAS,OAAY,SAAS;EAClC,IAAI,aAAa,KAAK,GACpB,OAAO,YAAY,MAAM,OAAO;EAElC,OAAO;CACT;AACF;;;;;AAMA,MAAa,cAA0B;CACrC,MAAM;CACN,qBAAqB;CACrB,eAAe;CACf,WAAW;CACX,MAAM,SAAS,OAAY,SAAS;EAClC,IAAI,UAAU,QACZ,OAAO,YAAY,MAAM,OAAO;EAGlC,OAAO;CACT;AACF"}
1
+ {"version":3,"file":"required.mjs","names":[],"sources":["../../../../../../../../../packages/seal/src/rules/core/required.ts"],"sourcesContent":["import { invalidRule, VALID_RULE } from \"../../helpers\";\nimport { isEmptyValue } from \"../../helpers/is-empty-value\";\nimport type { SchemaRule } from \"../../types\";\n\n/**\n * Required rule - value must be present and not empty\n */\nexport const requiredRule: SchemaRule = {\n name: \"required\",\n defaultErrorMessage: \"The :input is required\",\n requiresValue: false,\n sortOrder: -2,\n async validate(value: any, context) {\n if (isEmptyValue(value)) {\n return invalidRule(this, context);\n }\n return VALID_RULE;\n },\n};\n\n/**\n * Present rule - key must exist in the data, but value can be anything\n * (empty string, null are all valid as long as the key exists)\n */\nexport const presentRule: SchemaRule = {\n name: \"present\",\n defaultErrorMessage: \"The :input field is required\",\n requiresValue: false,\n sortOrder: -2,\n async validate(value: any, context) {\n if (value === undefined) {\n return invalidRule(this, context);\n }\n\n return VALID_RULE;\n },\n};\n"],"mappings":";;;;;;;;AAOA,MAAa,eAA2B;CACtC,MAAM;CACN,qBAAqB;CACrB,eAAe;CACf,WAAW;CACX,MAAM,SAAS,OAAY,SAAS;EAClC,IAAI,aAAa,KAAK,GACpB,OAAO,YAAY,MAAM,OAAO;EAElC,OAAO;CACT;AACF;;;;;AAMA,MAAa,cAA0B;CACrC,MAAM;CACN,qBAAqB;CACrB,eAAe;CACf,WAAW;CACX,MAAM,SAAS,OAAY,SAAS;EAClC,IAAI,UAAU,QACZ,OAAO,YAAY,MAAM,OAAO;EAGlC,OAAO;CACT;AACF"}
@@ -1,9 +1,16 @@
1
1
  import { SchemaRule } from "../../types/rule-types.mjs";
2
2
  import { BaseValidator } from "../../validators/base-validator.mjs";
3
3
 
4
- //#region ../seal/src/rules/core/union.d.ts
4
+ //#region ../../packages/seal/src/rules/core/union.d.ts
5
5
  /**
6
- * Union rule - value must match at least one of the provided validators
6
+ * Union rule - value must match at least one of the provided validators.
7
+ *
8
+ * Every member whose type matches the value is tried, in order, until one
9
+ * passes. When none passes, the errors of the closest failed member (see
10
+ * `isCloser`) are reported at their own paths with the `union` type: its
11
+ * first error under `firstErrorOnly` (the default), all of them otherwise.
12
+ * A custom union error message replaces them with a single error, as does the
13
+ * default message when no member matches the value's type.
7
14
  */
8
15
  declare const unionRule: SchemaRule<{
9
16
  validators: BaseValidator[];
@@ -1 +1 @@
1
- {"version":3,"file":"union.d.mts","names":[],"sources":["../../../../../../../../seal/src/rules/core/union.ts"],"mappings":";;;;;;;cAOa,SAAA,EAAW,UAAU;EAAG,UAAA,EAAY,aAAA;AAAA"}
1
+ {"version":3,"file":"union.d.mts","names":[],"sources":["../../../../../../../../../packages/seal/src/rules/core/union.ts"],"mappings":";;;;;;AAyDA;;;;;;;;cAAa,SAAA,EAAW,UAAU;EAAG,UAAA,EAAY,aAAA;AAAA"}
@@ -1,27 +1,75 @@
1
1
  import { VALID_RULE, invalidRule } from "../../helpers/validation-helpers.mjs";
2
2
  import "../../helpers/index.mjs";
3
3
 
4
- //#region ../seal/src/rules/core/union.ts
4
+ //#region ../../packages/seal/src/rules/core/union.ts
5
+ const describeFailure = (index, errors) => ({
6
+ index,
7
+ errors,
8
+ literalMismatches: errors.filter((error) => error.type === "literal").length,
9
+ depth: Math.max(0, ...errors.map((error) => error.input ? error.input.split(".").length : 0))
10
+ });
5
11
  /**
6
- * Union rule - value must match at least one of the provided validators
12
+ * Whether `candidate` is closer to the value than `best`:
13
+ *
14
+ * 1. Fewest mismatched literals. A literal that does not match (`kind: "owner"`
15
+ * given `"member"`) says the value is a different member, while any other
16
+ * error says it is this member with a bad field.
17
+ * 2. Fewest errors.
18
+ * 3. Deepest error: the member matched more of the value's structure.
19
+ * 4. Declaration order (an earlier member wins a tie).
20
+ */
21
+ const isCloser = (candidate, best) => {
22
+ if (candidate.literalMismatches !== best.literalMismatches) return candidate.literalMismatches < best.literalMismatches;
23
+ if (candidate.errors.length !== best.errors.length) return candidate.errors.length < best.errors.length;
24
+ if (candidate.depth !== best.depth) return candidate.depth > best.depth;
25
+ return candidate.index < best.index;
26
+ };
27
+ /**
28
+ * Union rule - value must match at least one of the provided validators.
29
+ *
30
+ * Every member whose type matches the value is tried, in order, until one
31
+ * passes. When none passes, the errors of the closest failed member (see
32
+ * `isCloser`) are reported at their own paths with the `union` type: its
33
+ * first error under `firstErrorOnly` (the default), all of them otherwise.
34
+ * A custom union error message replaces them with a single error, as does the
35
+ * default message when no member matches the value's type.
7
36
  */
8
37
  const unionRule = {
9
38
  name: "union",
39
+ requiresValue: false,
10
40
  defaultErrorMessage: "Value must match one of the allowed types",
11
41
  async validate(value, context) {
42
+ if (value === void 0) return VALID_RULE;
12
43
  const validators = this.context.options.validators;
13
44
  const firstErrorOnly = context.configurations?.firstErrorOnly ?? true;
14
- const allErrors = [];
15
- for (const validator of validators) {
45
+ let closest;
46
+ for (const [index, validator] of validators.entries()) {
16
47
  if (!validator.matchesType(value)) continue;
17
- const result = await validator.validate(value, context);
18
- if (result.isValid) return VALID_RULE;
19
- const errorMsg = result.errors?.[0]?.error || "Validation failed";
20
- allErrors.push(errorMsg);
21
- if (firstErrorOnly) break;
48
+ const result = await validator.validate(value, { ...context });
49
+ if (result.isValid) return {
50
+ isValid: true,
51
+ data: result.data
52
+ };
53
+ const failure = describeFailure(index, result.errors?.length ? result.errors : [{
54
+ type: "union",
55
+ error: "Validation failed",
56
+ input: context.path
57
+ }]);
58
+ if (!closest || isCloser(failure, closest)) closest = failure;
22
59
  }
23
- if (allErrors.length > 0) this.context.errorMessage = firstErrorOnly ? allErrors[0] : allErrors.join("; ");
24
- return invalidRule(this, context);
60
+ const failed = invalidRule(this, context);
61
+ if (!closest || this.context.errorMessage) return failed;
62
+ const errors = (firstErrorOnly ? closest.errors.slice(0, 1) : closest.errors).map((error) => ({
63
+ error: error.error,
64
+ path: error.input
65
+ }));
66
+ const first = errors[0];
67
+ return first ? {
68
+ ...failed,
69
+ error: first.error,
70
+ path: first.path,
71
+ errors
72
+ } : failed;
25
73
  }
26
74
  };
27
75
 
@@ -1 +1 @@
1
- {"version":3,"file":"union.mjs","names":[],"sources":["../../../../../../../../seal/src/rules/core/union.ts"],"sourcesContent":["import { invalidRule, VALID_RULE } from \"../../helpers\";\nimport type { SchemaRule } from \"../../types\";\nimport type { BaseValidator } from \"../../validators/base-validator\";\n\n/**\n * Union rule - value must match at least one of the provided validators\n */\nexport const unionRule: SchemaRule<{ validators: BaseValidator[] }> = {\n name: \"union\",\n defaultErrorMessage: \"Value must match one of the allowed types\",\n async validate(value: any, context) {\n const validators = this.context.options.validators;\n const firstErrorOnly = context.configurations?.firstErrorOnly ?? true;\n const allErrors: string[] = [];\n\n // Try each validator\n for (const validator of validators) {\n // Skip if type doesn't match (optimization)\n if (!validator.matchesType(value)) {\n continue;\n }\n\n // Type matches - validate\n const result = await validator.validate(value, context);\n\n if (result.isValid) {\n // Success! Validator matched and validated\n return VALID_RULE;\n }\n\n // Failed - collect error message\n const errorMsg = result.errors?.[0]?.error || \"Validation failed\";\n allErrors.push(errorMsg);\n\n // If firstErrorOnly, stop after first failed validator\n if (firstErrorOnly) {\n break;\n }\n }\n\n // All failed or no validator matched the type\n if (allErrors.length > 0) {\n // At least one validator matched type but failed validation\n this.context.errorMessage = firstErrorOnly\n ? allErrors[0]\n : allErrors.join(\"; \");\n }\n\n return invalidRule(this, context);\n },\n};\n"],"mappings":";;;;;;;AAOA,MAAa,YAAyD;CACpE,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,MAAM,aAAa,KAAK,QAAQ,QAAQ;EACxC,MAAM,iBAAiB,QAAQ,gBAAgB,kBAAkB;EACjE,MAAM,YAAsB,CAAC;EAG7B,KAAK,MAAM,aAAa,YAAY;GAElC,IAAI,CAAC,UAAU,YAAY,KAAK,GAC9B;GAIF,MAAM,SAAS,MAAM,UAAU,SAAS,OAAO,OAAO;GAEtD,IAAI,OAAO,SAET,OAAO;GAIT,MAAM,WAAW,OAAO,SAAS,EAAE,EAAE,SAAS;GAC9C,UAAU,KAAK,QAAQ;GAGvB,IAAI,gBACF;EAEJ;EAGA,IAAI,UAAU,SAAS,GAErB,KAAK,QAAQ,eAAe,iBACxB,UAAU,KACV,UAAU,KAAK,IAAI;EAGzB,OAAO,YAAY,MAAM,OAAO;CAClC;AACF"}
1
+ {"version":3,"file":"union.mjs","names":[],"sources":["../../../../../../../../../packages/seal/src/rules/core/union.ts"],"sourcesContent":["import { invalidRule, VALID_RULE } from \"../../helpers\";\nimport type { SchemaRule, ValidationResult } from \"../../types\";\nimport type { BaseValidator } from \"../../validators/base-validator\";\n\ntype MemberFailure = {\n /** Declaration order of the member, the last tie-breaker. */\n index: number;\n errors: ValidationResult[\"errors\"];\n /** Mismatched literals: each says the value is a different member. */\n literalMismatches: number;\n /** Segments in the deepest error path (`a.b.c` → 3). */\n depth: number;\n};\n\nconst describeFailure = (index: number, errors: ValidationResult[\"errors\"]): MemberFailure => ({\n index,\n errors,\n literalMismatches: errors.filter((error) => error.type === \"literal\").length,\n depth: Math.max(0, ...errors.map((error) => (error.input ? error.input.split(\".\").length : 0))),\n});\n\n/**\n * Whether `candidate` is closer to the value than `best`:\n *\n * 1. Fewest mismatched literals. A literal that does not match (`kind: \"owner\"`\n * given `\"member\"`) says the value is a different member, while any other\n * error says it is this member with a bad field.\n * 2. Fewest errors.\n * 3. Deepest error: the member matched more of the value's structure.\n * 4. Declaration order (an earlier member wins a tie).\n */\nconst isCloser = (candidate: MemberFailure, best: MemberFailure): boolean => {\n if (candidate.literalMismatches !== best.literalMismatches) {\n return candidate.literalMismatches < best.literalMismatches;\n }\n\n if (candidate.errors.length !== best.errors.length) {\n return candidate.errors.length < best.errors.length;\n }\n\n if (candidate.depth !== best.depth) {\n return candidate.depth > best.depth;\n }\n\n return candidate.index < best.index;\n};\n\n/**\n * Union rule - value must match at least one of the provided validators.\n *\n * Every member whose type matches the value is tried, in order, until one\n * passes. When none passes, the errors of the closest failed member (see\n * `isCloser`) are reported at their own paths with the `union` type: its\n * first error under `firstErrorOnly` (the default), all of them otherwise.\n * A custom union error message replaces them with a single error, as does the\n * default message when no member matches the value's type.\n */\nexport const unionRule: SchemaRule<{ validators: BaseValidator[] }> = {\n name: \"union\",\n // Runs on \"empty\" values too: `v.union([v.literal(\"\"), v.int()]).present()`\n // must still ask its members about `\"\"` instead of accepting it unchecked.\n requiresValue: false,\n defaultErrorMessage: \"Value must match one of the allowed types\",\n async validate(value: any, context) {\n // Absence is the required/present rule's question, as for `literalRule`;\n // answering it here would defeat `.optional()`.\n if (value === undefined) {\n return VALID_RULE;\n }\n\n const validators = this.context.options.validators;\n const firstErrorOnly = context.configurations?.firstErrorOnly ?? true;\n let closest: MemberFailure | undefined;\n\n // `firstErrorOnly` limits the errors reported, never the members tried:\n // several object members all match a plain object, and a later one may\n // be the member the value belongs to.\n for (const [index, validator] of validators.entries()) {\n // A member that cannot hold this type of value cannot pass.\n if (!validator.matchesType(value)) {\n continue;\n }\n\n // Each member gets its own context: a member must not see what an\n // earlier member wrote into it (an object member sets `schema`).\n const result = await validator.validate(value, { ...context });\n\n if (result.isValid) {\n // Preserve defaults, computed fields and transformations from the branch.\n return { isValid: true, data: result.data };\n }\n\n const failure = describeFailure(\n index,\n result.errors?.length\n ? result.errors\n : [{ type: \"union\", error: \"Validation failed\", input: context.path }],\n );\n\n if (!closest || isCloser(failure, closest)) {\n closest = failure;\n }\n }\n\n const failed = invalidRule(this, context);\n\n // No member matched the type, or the union has its own message.\n if (!closest || this.context.errorMessage) {\n return failed;\n }\n\n const reported = firstErrorOnly ? closest.errors.slice(0, 1) : closest.errors;\n const errors = reported.map((error) => ({ error: error.error, path: error.input }));\n const first = errors[0];\n\n return first ? { ...failed, error: first.error, path: first.path, errors } : failed;\n },\n};\n"],"mappings":";;;;AAcA,MAAM,mBAAmB,OAAe,YAAuD;CAC7F;CACA;CACA,mBAAmB,OAAO,QAAQ,UAAU,MAAM,SAAS,SAAS,CAAC,CAAC;CACtE,OAAO,KAAK,IAAI,GAAG,GAAG,OAAO,KAAK,UAAW,MAAM,QAAQ,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,SAAS,CAAE,CAAC;AAChG;;;;;;;;;;;AAYA,MAAM,YAAY,WAA0B,SAAiC;CAC3E,IAAI,UAAU,sBAAsB,KAAK,mBACvC,OAAO,UAAU,oBAAoB,KAAK;CAG5C,IAAI,UAAU,OAAO,WAAW,KAAK,OAAO,QAC1C,OAAO,UAAU,OAAO,SAAS,KAAK,OAAO;CAG/C,IAAI,UAAU,UAAU,KAAK,OAC3B,OAAO,UAAU,QAAQ,KAAK;CAGhC,OAAO,UAAU,QAAQ,KAAK;AAChC;;;;;;;;;;;AAYA,MAAa,YAAyD;CACpE,MAAM;CAGN,eAAe;CACf,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAGlC,IAAI,UAAU,QACZ,OAAO;EAGT,MAAM,aAAa,KAAK,QAAQ,QAAQ;EACxC,MAAM,iBAAiB,QAAQ,gBAAgB,kBAAkB;EACjE,IAAI;EAKJ,KAAK,MAAM,CAAC,OAAO,cAAc,WAAW,QAAQ,GAAG;GAErD,IAAI,CAAC,UAAU,YAAY,KAAK,GAC9B;GAKF,MAAM,SAAS,MAAM,UAAU,SAAS,OAAO,EAAE,GAAG,QAAQ,CAAC;GAE7D,IAAI,OAAO,SAET,OAAO;IAAE,SAAS;IAAM,MAAM,OAAO;GAAK;GAG5C,MAAM,UAAU,gBACd,OACA,OAAO,QAAQ,SACX,OAAO,SACP,CAAC;IAAE,MAAM;IAAS,OAAO;IAAqB,OAAO,QAAQ;GAAK,CAAC,CACzE;GAEA,IAAI,CAAC,WAAW,SAAS,SAAS,OAAO,GACvC,UAAU;EAEd;EAEA,MAAM,SAAS,YAAY,MAAM,OAAO;EAGxC,IAAI,CAAC,WAAW,KAAK,QAAQ,cAC3B,OAAO;EAIT,MAAM,UADW,iBAAiB,QAAQ,OAAO,MAAM,GAAG,CAAC,IAAI,QAAQ,OAChD,CAAC,KAAK,WAAW;GAAE,OAAO,MAAM;GAAO,MAAM,MAAM;EAAM,EAAE;EAClF,MAAM,QAAQ,OAAO;EAErB,OAAO,QAAQ;GAAE,GAAG;GAAQ,OAAO,MAAM;GAAO,MAAM,MAAM;GAAM;EAAO,IAAI;CAC/E;AACF"}
@@ -1,6 +1,7 @@
1
1
  import { SchemaRule } from "../../types/rule-types.mjs";
2
2
  import { WhenRuleOptions } from "../../types/conditional-types.mjs";
3
- //#region ../seal/src/rules/core/when.d.ts
3
+
4
+ //#region ../../packages/seal/src/rules/core/when.d.ts
4
5
  /**
5
6
  * When rule - conditional validation based on another field value
6
7
  */
@@ -1 +1 @@
1
- {"version":3,"file":"when.d.mts","names":[],"sources":["../../../../../../../../seal/src/rules/core/when.ts"],"mappings":";;;;;;cAOa,QAAA,EAAU,UAAU,CAAC,eAAA"}
1
+ {"version":3,"file":"when.d.mts","names":[],"sources":["../../../../../../../../../packages/seal/src/rules/core/when.ts"],"mappings":";;;;;;;cAOa,QAAA,EAAU,UAAU,CAAC,eAAA"}
@@ -2,7 +2,7 @@ import { VALID_RULE, invalidRule } from "../../helpers/validation-helpers.mjs";
2
2
  import "../../helpers/index.mjs";
3
3
  import { get } from "@mongez/reinforcements";
4
4
 
5
- //#region ../seal/src/rules/core/when.ts
5
+ //#region ../../packages/seal/src/rules/core/when.ts
6
6
  /**
7
7
  * When rule - conditional validation based on another field value
8
8
  */