@warlock.js/seal 5.2.0 → 5.2.3

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 (386) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/cjs/index.cjs +92 -92
  3. package/cjs/index.cjs.map +1 -1
  4. package/esm/config.d.mts +1 -1
  5. package/esm/config.d.mts.map +1 -1
  6. package/esm/config.mjs +1 -1
  7. package/esm/config.mjs.map +1 -1
  8. package/esm/factory/validate.d.mts +1 -1
  9. package/esm/factory/validate.d.mts.map +1 -1
  10. package/esm/factory/validate.mjs +1 -1
  11. package/esm/factory/validate.mjs.map +1 -1
  12. package/esm/factory/validators.d.mts +1 -1
  13. package/esm/factory/validators.d.mts.map +1 -1
  14. package/esm/factory/validators.mjs +1 -1
  15. package/esm/factory/validators.mjs.map +1 -1
  16. package/esm/helpers/date-helpers.d.mts +1 -1
  17. package/esm/helpers/date-helpers.d.mts.map +1 -1
  18. package/esm/helpers/date-helpers.mjs +1 -1
  19. package/esm/helpers/date-helpers.mjs.map +1 -1
  20. package/esm/helpers/file.utils.d.mts +1 -1
  21. package/esm/helpers/file.utils.d.mts.map +1 -1
  22. package/esm/helpers/file.utils.mjs +1 -1
  23. package/esm/helpers/file.utils.mjs.map +1 -1
  24. package/esm/helpers/get-field-value.d.mts +1 -1
  25. package/esm/helpers/get-field-value.d.mts.map +1 -1
  26. package/esm/helpers/get-field-value.mjs +1 -1
  27. package/esm/helpers/get-field-value.mjs.map +1 -1
  28. package/esm/helpers/is-empty-value.mjs +1 -1
  29. package/esm/helpers/is-empty-value.mjs.map +1 -1
  30. package/esm/helpers/path-helpers.d.mts +1 -1
  31. package/esm/helpers/path-helpers.d.mts.map +1 -1
  32. package/esm/helpers/path-helpers.mjs +1 -1
  33. package/esm/helpers/path-helpers.mjs.map +1 -1
  34. package/esm/helpers/validation-helpers.d.mts +1 -1
  35. package/esm/helpers/validation-helpers.d.mts.map +1 -1
  36. package/esm/helpers/validation-helpers.mjs +1 -1
  37. package/esm/helpers/validation-helpers.mjs.map +1 -1
  38. package/esm/mutators/array-mutators.d.mts +1 -1
  39. package/esm/mutators/array-mutators.d.mts.map +1 -1
  40. package/esm/mutators/array-mutators.mjs +1 -1
  41. package/esm/mutators/array-mutators.mjs.map +1 -1
  42. package/esm/mutators/date-mutators.d.mts +1 -1
  43. package/esm/mutators/date-mutators.d.mts.map +1 -1
  44. package/esm/mutators/date-mutators.mjs +1 -1
  45. package/esm/mutators/date-mutators.mjs.map +1 -1
  46. package/esm/mutators/number-mutators.d.mts +1 -1
  47. package/esm/mutators/number-mutators.d.mts.map +1 -1
  48. package/esm/mutators/number-mutators.mjs +1 -1
  49. package/esm/mutators/number-mutators.mjs.map +1 -1
  50. package/esm/mutators/object-mutators.d.mts +1 -1
  51. package/esm/mutators/object-mutators.d.mts.map +1 -1
  52. package/esm/mutators/object-mutators.mjs +1 -1
  53. package/esm/mutators/object-mutators.mjs.map +1 -1
  54. package/esm/mutators/scalar-mutators.d.mts +1 -1
  55. package/esm/mutators/scalar-mutators.d.mts.map +1 -1
  56. package/esm/mutators/scalar-mutators.mjs +1 -1
  57. package/esm/mutators/scalar-mutators.mjs.map +1 -1
  58. package/esm/mutators/string-mutators.d.mts +1 -1
  59. package/esm/mutators/string-mutators.d.mts.map +1 -1
  60. package/esm/mutators/string-mutators.mjs +1 -1
  61. package/esm/mutators/string-mutators.mjs.map +1 -1
  62. package/esm/plugins/plugin-system.d.mts +1 -1
  63. package/esm/plugins/plugin-system.d.mts.map +1 -1
  64. package/esm/plugins/plugin-system.mjs +1 -1
  65. package/esm/plugins/plugin-system.mjs.map +1 -1
  66. package/esm/rules/array/array-rules.d.mts +1 -1
  67. package/esm/rules/array/array-rules.d.mts.map +1 -1
  68. package/esm/rules/array/array-rules.mjs +1 -1
  69. package/esm/rules/array/array-rules.mjs.map +1 -1
  70. package/esm/rules/color/color-rules.d.mts +1 -1
  71. package/esm/rules/color/color-rules.d.mts.map +1 -1
  72. package/esm/rules/color/color-rules.mjs +1 -1
  73. package/esm/rules/color/color-rules.mjs.map +1 -1
  74. package/esm/rules/common/enum.d.mts +1 -1
  75. package/esm/rules/common/enum.d.mts.map +1 -1
  76. package/esm/rules/common/enum.mjs +1 -1
  77. package/esm/rules/common/enum.mjs.map +1 -1
  78. package/esm/rules/common/equals-field-rules.d.mts +1 -1
  79. package/esm/rules/common/equals-field-rules.d.mts.map +1 -1
  80. package/esm/rules/common/equals-field-rules.mjs +1 -1
  81. package/esm/rules/common/equals-field-rules.mjs.map +1 -1
  82. package/esm/rules/common/instanceof.d.mts +1 -1
  83. package/esm/rules/common/instanceof.d.mts.map +1 -1
  84. package/esm/rules/common/instanceof.mjs +1 -1
  85. package/esm/rules/common/instanceof.mjs.map +1 -1
  86. package/esm/rules/common/literal.d.mts +1 -1
  87. package/esm/rules/common/literal.d.mts.map +1 -1
  88. package/esm/rules/common/literal.mjs +1 -1
  89. package/esm/rules/common/literal.mjs.map +1 -1
  90. package/esm/rules/common/type-rules.d.mts +1 -1
  91. package/esm/rules/common/type-rules.d.mts.map +1 -1
  92. package/esm/rules/common/type-rules.mjs +1 -1
  93. package/esm/rules/common/type-rules.mjs.map +1 -1
  94. package/esm/rules/common/unknown-key.d.mts +1 -1
  95. package/esm/rules/common/unknown-key.d.mts.map +1 -1
  96. package/esm/rules/common/unknown-key.mjs +1 -1
  97. package/esm/rules/common/unknown-key.mjs.map +1 -1
  98. package/esm/rules/conditional/forbidden-if-rules.d.mts +1 -1
  99. package/esm/rules/conditional/forbidden-if-rules.d.mts.map +1 -1
  100. package/esm/rules/conditional/forbidden-if-rules.mjs +1 -1
  101. package/esm/rules/conditional/forbidden-if-rules.mjs.map +1 -1
  102. package/esm/rules/conditional/present-if-rules.d.mts +1 -1
  103. package/esm/rules/conditional/present-if-rules.d.mts.map +1 -1
  104. package/esm/rules/conditional/present-if-rules.mjs +1 -1
  105. package/esm/rules/conditional/present-if-rules.mjs.map +1 -1
  106. package/esm/rules/conditional/present-unless-rules.d.mts +1 -1
  107. package/esm/rules/conditional/present-unless-rules.d.mts.map +1 -1
  108. package/esm/rules/conditional/present-unless-rules.mjs +1 -1
  109. package/esm/rules/conditional/present-unless-rules.mjs.map +1 -1
  110. package/esm/rules/conditional/present-with-rules.d.mts +1 -1
  111. package/esm/rules/conditional/present-with-rules.d.mts.map +1 -1
  112. package/esm/rules/conditional/present-with-rules.mjs +1 -1
  113. package/esm/rules/conditional/present-with-rules.mjs.map +1 -1
  114. package/esm/rules/conditional/present-without-rules.d.mts +1 -1
  115. package/esm/rules/conditional/present-without-rules.d.mts.map +1 -1
  116. package/esm/rules/conditional/present-without-rules.mjs +1 -1
  117. package/esm/rules/conditional/present-without-rules.mjs.map +1 -1
  118. package/esm/rules/conditional/required-if-rules.d.mts +1 -1
  119. package/esm/rules/conditional/required-if-rules.d.mts.map +1 -1
  120. package/esm/rules/conditional/required-if-rules.mjs +1 -1
  121. package/esm/rules/conditional/required-if-rules.mjs.map +1 -1
  122. package/esm/rules/conditional/required-unless-rules.d.mts +1 -1
  123. package/esm/rules/conditional/required-unless-rules.d.mts.map +1 -1
  124. package/esm/rules/conditional/required-unless-rules.mjs +1 -1
  125. package/esm/rules/conditional/required-unless-rules.mjs.map +1 -1
  126. package/esm/rules/conditional/required-when-rule.d.mts +1 -1
  127. package/esm/rules/conditional/required-when-rule.d.mts.map +1 -1
  128. package/esm/rules/conditional/required-when-rule.mjs +1 -1
  129. package/esm/rules/conditional/required-when-rule.mjs.map +1 -1
  130. package/esm/rules/conditional/required-with-rules.d.mts +1 -1
  131. package/esm/rules/conditional/required-with-rules.d.mts.map +1 -1
  132. package/esm/rules/conditional/required-with-rules.mjs +1 -1
  133. package/esm/rules/conditional/required-with-rules.mjs.map +1 -1
  134. package/esm/rules/conditional/required-without-rules.d.mts +1 -1
  135. package/esm/rules/conditional/required-without-rules.d.mts.map +1 -1
  136. package/esm/rules/conditional/required-without-rules.mjs +1 -1
  137. package/esm/rules/conditional/required-without-rules.mjs.map +1 -1
  138. package/esm/rules/core/equal.d.mts +1 -1
  139. package/esm/rules/core/equal.d.mts.map +1 -1
  140. package/esm/rules/core/equal.mjs +1 -1
  141. package/esm/rules/core/equal.mjs.map +1 -1
  142. package/esm/rules/core/forbidden.d.mts +1 -1
  143. package/esm/rules/core/forbidden.d.mts.map +1 -1
  144. package/esm/rules/core/forbidden.mjs +1 -1
  145. package/esm/rules/core/forbidden.mjs.map +1 -1
  146. package/esm/rules/core/required.d.mts +1 -1
  147. package/esm/rules/core/required.d.mts.map +1 -1
  148. package/esm/rules/core/required.mjs +1 -1
  149. package/esm/rules/core/required.mjs.map +1 -1
  150. package/esm/rules/core/union.d.mts +1 -1
  151. package/esm/rules/core/union.d.mts.map +1 -1
  152. package/esm/rules/core/union.mjs +1 -1
  153. package/esm/rules/core/union.mjs.map +1 -1
  154. package/esm/rules/core/when.d.mts +1 -1
  155. package/esm/rules/core/when.d.mts.map +1 -1
  156. package/esm/rules/core/when.mjs +1 -1
  157. package/esm/rules/core/when.mjs.map +1 -1
  158. package/esm/rules/date/date-comparison-rules.d.mts +1 -1
  159. package/esm/rules/date/date-comparison-rules.d.mts.map +1 -1
  160. package/esm/rules/date/date-comparison-rules.mjs +1 -1
  161. package/esm/rules/date/date-comparison-rules.mjs.map +1 -1
  162. package/esm/rules/date/date-day-rules.d.mts +1 -1
  163. package/esm/rules/date/date-day-rules.d.mts.map +1 -1
  164. package/esm/rules/date/date-day-rules.mjs +1 -1
  165. package/esm/rules/date/date-day-rules.mjs.map +1 -1
  166. package/esm/rules/date/date-field-comparison-rules.d.mts +1 -1
  167. package/esm/rules/date/date-field-comparison-rules.d.mts.map +1 -1
  168. package/esm/rules/date/date-field-comparison-rules.mjs +1 -1
  169. package/esm/rules/date/date-field-comparison-rules.mjs.map +1 -1
  170. package/esm/rules/date/date-period-rules.d.mts +1 -1
  171. package/esm/rules/date/date-period-rules.d.mts.map +1 -1
  172. package/esm/rules/date/date-period-rules.mjs +1 -1
  173. package/esm/rules/date/date-period-rules.mjs.map +1 -1
  174. package/esm/rules/date/date-relative-rules.d.mts +1 -1
  175. package/esm/rules/date/date-relative-rules.d.mts.map +1 -1
  176. package/esm/rules/date/date-relative-rules.mjs +1 -1
  177. package/esm/rules/date/date-relative-rules.mjs.map +1 -1
  178. package/esm/rules/date/date-special-rules.d.mts +1 -1
  179. package/esm/rules/date/date-special-rules.d.mts.map +1 -1
  180. package/esm/rules/date/date-special-rules.mjs +1 -1
  181. package/esm/rules/date/date-special-rules.mjs.map +1 -1
  182. package/esm/rules/date/date.d.mts +1 -1
  183. package/esm/rules/date/date.d.mts.map +1 -1
  184. package/esm/rules/date/date.mjs +1 -1
  185. package/esm/rules/date/date.mjs.map +1 -1
  186. package/esm/rules/file/dimensions.d.mts +1 -1
  187. package/esm/rules/file/dimensions.d.mts.map +1 -1
  188. package/esm/rules/file/dimensions.mjs +1 -1
  189. package/esm/rules/file/dimensions.mjs.map +1 -1
  190. package/esm/rules/file/file-size.d.mts +1 -1
  191. package/esm/rules/file/file-size.d.mts.map +1 -1
  192. package/esm/rules/file/file-size.mjs +1 -1
  193. package/esm/rules/file/file-size.mjs.map +1 -1
  194. package/esm/rules/length/length-rules.d.mts +1 -1
  195. package/esm/rules/length/length-rules.d.mts.map +1 -1
  196. package/esm/rules/length/length-rules.mjs +1 -1
  197. package/esm/rules/length/length-rules.mjs.map +1 -1
  198. package/esm/rules/number/number-rules.d.mts +1 -1
  199. package/esm/rules/number/number-rules.d.mts.map +1 -1
  200. package/esm/rules/number/number-rules.mjs +1 -1
  201. package/esm/rules/number/number-rules.mjs.map +1 -1
  202. package/esm/rules/scalar/accepted-rule.mjs +1 -1
  203. package/esm/rules/scalar/accepted-rule.mjs.map +1 -1
  204. package/esm/rules/scalar/declined-rule.mjs +1 -1
  205. package/esm/rules/scalar/declined-rule.mjs.map +1 -1
  206. package/esm/rules/string/alpha.d.mts +1 -1
  207. package/esm/rules/string/alpha.d.mts.map +1 -1
  208. package/esm/rules/string/alpha.mjs +1 -1
  209. package/esm/rules/string/alpha.mjs.map +1 -1
  210. package/esm/rules/string/credit-card.d.mts +1 -1
  211. package/esm/rules/string/credit-card.d.mts.map +1 -1
  212. package/esm/rules/string/credit-card.mjs +1 -1
  213. package/esm/rules/string/credit-card.mjs.map +1 -1
  214. package/esm/rules/string/email.d.mts +1 -1
  215. package/esm/rules/string/email.d.mts.map +1 -1
  216. package/esm/rules/string/email.mjs +1 -1
  217. package/esm/rules/string/email.mjs.map +1 -1
  218. package/esm/rules/string/id-formats.d.mts +1 -1
  219. package/esm/rules/string/id-formats.d.mts.map +1 -1
  220. package/esm/rules/string/id-formats.mjs +1 -1
  221. package/esm/rules/string/id-formats.mjs.map +1 -1
  222. package/esm/rules/string/ip.d.mts +1 -1
  223. package/esm/rules/string/ip.d.mts.map +1 -1
  224. package/esm/rules/string/ip.mjs +1 -1
  225. package/esm/rules/string/ip.mjs.map +1 -1
  226. package/esm/rules/string/matches.d.mts +1 -1
  227. package/esm/rules/string/matches.d.mts.map +1 -1
  228. package/esm/rules/string/matches.mjs +1 -1
  229. package/esm/rules/string/matches.mjs.map +1 -1
  230. package/esm/rules/string/pattern.d.mts +1 -1
  231. package/esm/rules/string/pattern.d.mts.map +1 -1
  232. package/esm/rules/string/pattern.mjs +1 -1
  233. package/esm/rules/string/pattern.mjs.map +1 -1
  234. package/esm/rules/string/string-comparison.d.mts +1 -1
  235. package/esm/rules/string/string-comparison.d.mts.map +1 -1
  236. package/esm/rules/string/string-comparison.mjs +1 -1
  237. package/esm/rules/string/string-comparison.mjs.map +1 -1
  238. package/esm/rules/string/strong-password-rule.d.mts +1 -1
  239. package/esm/rules/string/strong-password-rule.d.mts.map +1 -1
  240. package/esm/rules/string/strong-password-rule.mjs +1 -1
  241. package/esm/rules/string/strong-password-rule.mjs.map +1 -1
  242. package/esm/rules/string/url.d.mts +1 -1
  243. package/esm/rules/string/url.d.mts.map +1 -1
  244. package/esm/rules/string/url.mjs +1 -1
  245. package/esm/rules/string/url.mjs.map +1 -1
  246. package/esm/rules/string/without-whitespace.d.mts +1 -1
  247. package/esm/rules/string/without-whitespace.d.mts.map +1 -1
  248. package/esm/rules/string/without-whitespace.mjs +1 -1
  249. package/esm/rules/string/without-whitespace.mjs.map +1 -1
  250. package/esm/standard-schema/json-schema.d.mts +1 -1
  251. package/esm/standard-schema/json-schema.d.mts.map +1 -1
  252. package/esm/standard-schema/json-schema.mjs +1 -1
  253. package/esm/standard-schema/json-schema.mjs.map +1 -1
  254. package/esm/standard-schema/map-result.d.mts +1 -1
  255. package/esm/standard-schema/map-result.d.mts.map +1 -1
  256. package/esm/standard-schema/map-result.mjs +1 -1
  257. package/esm/standard-schema/map-result.mjs.map +1 -1
  258. package/esm/standard-schema/types.d.mts +1 -1
  259. package/esm/standard-schema/types.d.mts.map +1 -1
  260. package/esm/types/conditional-types.d.mts +1 -1
  261. package/esm/types/conditional-types.d.mts.map +1 -1
  262. package/esm/types/context-types.d.mts +1 -1
  263. package/esm/types/context-types.d.mts.map +1 -1
  264. package/esm/types/data-transformer-types.d.mts +1 -1
  265. package/esm/types/data-transformer-types.d.mts.map +1 -1
  266. package/esm/types/date-types.d.mts +1 -1
  267. package/esm/types/date-types.d.mts.map +1 -1
  268. package/esm/types/date-types.mjs +1 -1
  269. package/esm/types/date-types.mjs.map +1 -1
  270. package/esm/types/file.types.d.mts +1 -1
  271. package/esm/types/file.types.d.mts.map +1 -1
  272. package/esm/types/inference-types.d.mts +1 -1
  273. package/esm/types/inference-types.d.mts.map +1 -1
  274. package/esm/types/mutator-types.d.mts +1 -1
  275. package/esm/types/mutator-types.d.mts.map +1 -1
  276. package/esm/types/result-types.d.mts +1 -1
  277. package/esm/types/result-types.d.mts.map +1 -1
  278. package/esm/types/rule-types.d.mts +1 -1
  279. package/esm/types/rule-types.d.mts.map +1 -1
  280. package/esm/types/schema-types.d.mts +1 -1
  281. package/esm/types/schema-types.d.mts.map +1 -1
  282. package/esm/validators/any-validator.d.mts +1 -1
  283. package/esm/validators/any-validator.d.mts.map +1 -1
  284. package/esm/validators/any-validator.mjs +1 -1
  285. package/esm/validators/any-validator.mjs.map +1 -1
  286. package/esm/validators/array-validator.d.mts +1 -1
  287. package/esm/validators/array-validator.d.mts.map +1 -1
  288. package/esm/validators/array-validator.mjs +1 -1
  289. package/esm/validators/array-validator.mjs.map +1 -1
  290. package/esm/validators/base-validator.d.mts +1 -1
  291. package/esm/validators/base-validator.d.mts.map +1 -1
  292. package/esm/validators/base-validator.mjs +1 -1
  293. package/esm/validators/base-validator.mjs.map +1 -1
  294. package/esm/validators/boolean-validator.d.mts +1 -1
  295. package/esm/validators/boolean-validator.d.mts.map +1 -1
  296. package/esm/validators/boolean-validator.mjs +1 -1
  297. package/esm/validators/boolean-validator.mjs.map +1 -1
  298. package/esm/validators/computed-validator.d.mts +1 -1
  299. package/esm/validators/computed-validator.d.mts.map +1 -1
  300. package/esm/validators/computed-validator.mjs +1 -1
  301. package/esm/validators/computed-validator.mjs.map +1 -1
  302. package/esm/validators/date-validator.d.mts +1 -1
  303. package/esm/validators/date-validator.d.mts.map +1 -1
  304. package/esm/validators/date-validator.mjs +1 -1
  305. package/esm/validators/date-validator.mjs.map +1 -1
  306. package/esm/validators/discriminated-union-validator.d.mts +1 -1
  307. package/esm/validators/discriminated-union-validator.d.mts.map +1 -1
  308. package/esm/validators/discriminated-union-validator.mjs +1 -1
  309. package/esm/validators/discriminated-union-validator.mjs.map +1 -1
  310. package/esm/validators/float-validator.d.mts +1 -1
  311. package/esm/validators/float-validator.d.mts.map +1 -1
  312. package/esm/validators/float-validator.mjs +1 -1
  313. package/esm/validators/float-validator.mjs.map +1 -1
  314. package/esm/validators/instanceof-validator.d.mts +1 -1
  315. package/esm/validators/instanceof-validator.d.mts.map +1 -1
  316. package/esm/validators/instanceof-validator.mjs +1 -1
  317. package/esm/validators/instanceof-validator.mjs.map +1 -1
  318. package/esm/validators/int-validator.d.mts +1 -1
  319. package/esm/validators/int-validator.d.mts.map +1 -1
  320. package/esm/validators/int-validator.mjs +1 -1
  321. package/esm/validators/int-validator.mjs.map +1 -1
  322. package/esm/validators/lazy-validator.d.mts +1 -1
  323. package/esm/validators/lazy-validator.d.mts.map +1 -1
  324. package/esm/validators/lazy-validator.mjs +1 -1
  325. package/esm/validators/lazy-validator.mjs.map +1 -1
  326. package/esm/validators/literal-validator.d.mts +1 -1
  327. package/esm/validators/literal-validator.d.mts.map +1 -1
  328. package/esm/validators/literal-validator.mjs +1 -1
  329. package/esm/validators/literal-validator.mjs.map +1 -1
  330. package/esm/validators/managed-validator.d.mts +1 -1
  331. package/esm/validators/managed-validator.d.mts.map +1 -1
  332. package/esm/validators/managed-validator.mjs +1 -1
  333. package/esm/validators/managed-validator.mjs.map +1 -1
  334. package/esm/validators/methods/equality-conditional-methods.d.mts +1 -1
  335. package/esm/validators/methods/equality-conditional-methods.d.mts.map +1 -1
  336. package/esm/validators/methods/equality-conditional-methods.mjs +1 -1
  337. package/esm/validators/methods/equality-conditional-methods.mjs.map +1 -1
  338. package/esm/validators/methods/forbidden-methods.d.mts +1 -1
  339. package/esm/validators/methods/forbidden-methods.d.mts.map +1 -1
  340. package/esm/validators/methods/forbidden-methods.mjs +1 -1
  341. package/esm/validators/methods/forbidden-methods.mjs.map +1 -1
  342. package/esm/validators/methods/present-methods.d.mts +1 -1
  343. package/esm/validators/methods/present-methods.d.mts.map +1 -1
  344. package/esm/validators/methods/present-methods.mjs +1 -1
  345. package/esm/validators/methods/present-methods.mjs.map +1 -1
  346. package/esm/validators/methods/required-methods.d.mts +1 -1
  347. package/esm/validators/methods/required-methods.d.mts.map +1 -1
  348. package/esm/validators/methods/required-methods.mjs +1 -1
  349. package/esm/validators/methods/required-methods.mjs.map +1 -1
  350. package/esm/validators/number-validator.d.mts +1 -1
  351. package/esm/validators/number-validator.d.mts.map +1 -1
  352. package/esm/validators/number-validator.mjs +1 -1
  353. package/esm/validators/number-validator.mjs.map +1 -1
  354. package/esm/validators/numeric-validator.d.mts +1 -1
  355. package/esm/validators/numeric-validator.d.mts.map +1 -1
  356. package/esm/validators/numeric-validator.mjs +1 -1
  357. package/esm/validators/numeric-validator.mjs.map +1 -1
  358. package/esm/validators/object-validator.d.mts +1 -1
  359. package/esm/validators/object-validator.d.mts.map +1 -1
  360. package/esm/validators/object-validator.mjs +1 -1
  361. package/esm/validators/object-validator.mjs.map +1 -1
  362. package/esm/validators/primitive-validator.d.mts +1 -1
  363. package/esm/validators/primitive-validator.d.mts.map +1 -1
  364. package/esm/validators/primitive-validator.mjs +1 -1
  365. package/esm/validators/primitive-validator.mjs.map +1 -1
  366. package/esm/validators/record-validator.d.mts +1 -1
  367. package/esm/validators/record-validator.d.mts.map +1 -1
  368. package/esm/validators/record-validator.mjs +1 -1
  369. package/esm/validators/record-validator.mjs.map +1 -1
  370. package/esm/validators/scalar-validator.d.mts +1 -1
  371. package/esm/validators/scalar-validator.d.mts.map +1 -1
  372. package/esm/validators/scalar-validator.mjs +1 -1
  373. package/esm/validators/scalar-validator.mjs.map +1 -1
  374. package/esm/validators/string-validator.d.mts +1 -1
  375. package/esm/validators/string-validator.d.mts.map +1 -1
  376. package/esm/validators/string-validator.mjs +1 -1
  377. package/esm/validators/string-validator.mjs.map +1 -1
  378. package/esm/validators/tuple-validator.d.mts +1 -1
  379. package/esm/validators/tuple-validator.d.mts.map +1 -1
  380. package/esm/validators/tuple-validator.mjs +1 -1
  381. package/esm/validators/tuple-validator.mjs.map +1 -1
  382. package/esm/validators/union-validator.d.mts +1 -1
  383. package/esm/validators/union-validator.d.mts.map +1 -1
  384. package/esm/validators/union-validator.mjs +1 -1
  385. package/esm/validators/union-validator.mjs.map +1 -1
  386. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"required-methods.d.mts","names":[],"sources":["C:/Work/Warlock.js/seal/src/validators/methods/required-methods.ts"],"mappings":";;;;;AAiCA;;;;cAAa,sBAAA;AAAA;EAAA,UAGD,aAAA;IAyNc;;;IArNtB,QAAA,CAAS,YAAA;IAAA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AAA,YAAkB,YAAA;;;;IAK7C,eAAA,CAAgB,MAAA,YAAkB,YAAA;;;;IAKlC,uBAAA,CAAwB,MAAA,YAAkB,YAAA;;;;IAK1C,kBAAA,CAAmB,MAAA,YAAkB,YAAA;;;;IAKrC,0BAAA,CAA2B,MAAA,YAAkB,YAAA;;;;;;;;;;;;;;;;;;;;;;;;;IA0B7C,YAAA,CACE,QAAA,GAAW,OAAA,EAAS,aAAA,eAA4B,OAAO,WACvD,YAAA;EAAA;AAAA"}
@@ -6,7 +6,7 @@ import { requiredWhenRule } from "../../rules/conditional/required-when-rule.mjs
6
6
  import { requiredWithAllRule, requiredWithAnyRule, requiredWithRule } from "../../rules/conditional/required-with-rules.mjs";
7
7
  import { requiredWithoutAllRule, requiredWithoutAnyRule, requiredWithoutRule } from "../../rules/conditional/required-without-rules.mjs";
8
8
 
9
- //#region seal/src/validators/methods/required-methods.ts
9
+ //#region ../seal/src/validators/methods/required-methods.ts
10
10
  /**
11
11
  * Marker re-exported by the validators barrel so the dts bundler keeps this
12
12
  * module (and its `declare module` augmentation) in the bundled `.d.ts`.
@@ -1 +1 @@
1
- {"version":3,"file":"required-methods.mjs","names":[],"sources":["C:/Work/Warlock.js/seal/src/validators/methods/required-methods.ts"],"sourcesContent":["import {\r\n requiredIfAllEmptyRule,\r\n requiredIfAllNotEmptyRule,\r\n requiredIfAnyEmptyRule,\r\n requiredIfAnyNotEmptyRule,\r\n requiredIfEmptyRule,\r\n requiredIfInRule,\r\n requiredIfNotEmptyRule,\r\n requiredIfNotInRule,\r\n requiredIfRule,\r\n} from \"../../rules/conditional/required-if-rules\";\r\nimport { requiredUnlessRule } from \"../../rules/conditional/required-unless-rules\";\r\nimport { requiredWhenRule } from \"../../rules/conditional/required-when-rule\";\r\nimport {\r\n requiredWithAllRule,\r\n requiredWithAnyRule,\r\n requiredWithRule,\r\n} from \"../../rules/conditional/required-with-rules\";\r\nimport {\r\n requiredWithoutAllRule,\r\n requiredWithoutAnyRule,\r\n requiredWithoutRule,\r\n} from \"../../rules/conditional/required-without-rules\";\r\nimport { presentRule, requiredRule } from \"../../rules/core/required\";\r\nimport type { SchemaContext } from \"../../types\";\r\nimport { BaseValidator } from \"../base-validator\";\r\n\r\n/**\r\n * Marker re-exported by the validators barrel so the dts bundler keeps this\r\n * module (and its `declare module` augmentation) in the bundled `.d.ts`.\r\n * Without a real export, side-effect-only augmentation modules get tree-shaken\r\n * out of the published types, dropping every chainable rule method.\r\n */\r\nexport const requiredMethodsApplied = true;\r\n\r\ndeclare module \"../base-validator\" {\r\n interface BaseValidator {\r\n /**\r\n * This value must be present and has a value\r\n */\r\n required(errorMessage?: string): this;\r\n\r\n /**\r\n * Value must be present but not necessarily has a value\r\n */\r\n present(errorMessage?: string): this;\r\n\r\n /**\r\n * Mark the field as optional, so pass it if it has no value or has a value\r\n * Because this is the default behavior, this method is just syntactic sugar\r\n */\r\n optional(): this & { isOptional: true };\r\n\r\n /**\r\n * Sugar for `.optional().nullable()` — the field may be absent OR null.\r\n *\r\n * Brands the return type with both `{ isOptional: true }` and `{ isNullable: true }`\r\n * so `Infer<>` produces `{ field?: T | null }`.\r\n *\r\n * @example\r\n * v.string().nullish()\r\n * // type: string | null | undefined\r\n * // absent → key omitted\r\n * // null → null\r\n * // \"x\" → \"x\"\r\n */\r\n nullish(): this & { isOptional: true; isNullable: true };\r\n\r\n /**\r\n * Value is required if another field exists\r\n */\r\n requiredWith(field: string, errorMessage?: string): this;\r\n\r\n /**\r\n * Value is required if another sibling field exists\r\n */\r\n requiredWithSibling(field: string, errorMessage?: string): this;\r\n\r\n /**\r\n * Value is required if another field is missing\r\n */\r\n requiredWithout(field: string, errorMessage?: string): this;\r\n\r\n /**\r\n * Value is required if another sibling field is missing\r\n */\r\n requiredWithoutSibling(field: string, errorMessage?: string): this;\r\n\r\n /**\r\n * Value is required if another field equals a specific value\r\n */\r\n requiredIf(field: string, value: any, errorMessage?: string): this;\r\n\r\n /**\r\n * Value is required if another sibling field equals a specific value\r\n */\r\n requiredIfSibling(field: string, value: any, errorMessage?: string): this;\r\n\r\n /**\r\n * Value is required unless another field equals a specific value\r\n */\r\n requiredUnless(field: string, value: any, errorMessage?: string): this;\r\n\r\n /**\r\n * Value is required unless another sibling field equals a specific value\r\n */\r\n requiredUnlessSibling(field: string, value: any, errorMessage?: string): this;\r\n\r\n /**\r\n * Value is required if another field is empty\r\n */\r\n requiredIfEmpty(field: string, errorMessage?: string): this;\r\n\r\n /**\r\n * Value is required if another sibling field is empty\r\n */\r\n requiredIfEmptySibling(field: string, errorMessage?: string): this;\r\n\r\n /**\r\n * Value is required if another field is not empty\r\n */\r\n requiredIfNotEmpty(field: string, errorMessage?: string): this;\r\n\r\n /**\r\n * Value is required if another sibling field is not empty\r\n */\r\n requiredIfNotEmptySibling(field: string, errorMessage?: string): this;\r\n\r\n /**\r\n * Value is required if ALL specified fields are empty\r\n */\r\n requiredIfAllEmpty(fields: string[], errorMessage?: string): this;\r\n\r\n /**\r\n * Value is required if ALL specified sibling fields are empty\r\n */\r\n requiredIfAllEmptySiblings(fields: string[], errorMessage?: string): this;\r\n\r\n /**\r\n * Value is required if ANY of the specified fields is empty\r\n */\r\n requiredIfAnyEmpty(fields: string[], errorMessage?: string): this;\r\n\r\n /**\r\n * Value is required if ANY of the specified sibling fields is empty\r\n */\r\n requiredIfAnyEmptySiblings(fields: string[], errorMessage?: string): this;\r\n\r\n /**\r\n * Value is required if ALL specified fields are NOT empty\r\n */\r\n requiredIfAllNotEmpty(fields: string[], errorMessage?: string): this;\r\n\r\n /**\r\n * Value is required if ALL specified sibling fields are NOT empty\r\n */\r\n requiredIfAllNotEmptySiblings(fields: string[], errorMessage?: string): this;\r\n\r\n /**\r\n * Value is required if ANY of the specified fields is NOT empty\r\n */\r\n requiredIfAnyNotEmpty(fields: string[], errorMessage?: string): this;\r\n\r\n /**\r\n * Value is required if ANY of the specified sibling fields is NOT empty\r\n */\r\n requiredIfAnyNotEmptySiblings(fields: string[], errorMessage?: string): this;\r\n\r\n /**\r\n * Value is required if another field's value is in the given array\r\n */\r\n requiredIfIn(field: string, values: any[], errorMessage?: string): this;\r\n\r\n /**\r\n * Value is required if another sibling field's value is in the given array\r\n */\r\n requiredIfInSibling(field: string, values: any[], errorMessage?: string): this;\r\n\r\n /**\r\n * Value is required if another field's value is NOT in the given array\r\n */\r\n requiredIfNotIn(field: string, values: any[], errorMessage?: string): this;\r\n\r\n /**\r\n * Value is required if another sibling field's value is NOT in the given array\r\n */\r\n requiredIfNotInSibling(field: string, values: any[], errorMessage?: string): this;\r\n\r\n /**\r\n * Value is required if all specified fields exist\r\n */\r\n requiredWithAll(fields: string[], errorMessage?: string): this;\r\n\r\n /**\r\n * Value is required if all specified sibling fields exist\r\n */\r\n requiredWithAllSiblings(fields: string[], errorMessage?: string): this;\r\n\r\n /**\r\n * Value is required if all specified fields are missing\r\n */\r\n requiredWithoutAll(fields: string[], errorMessage?: string): this;\r\n\r\n /**\r\n * Value is required if all specified sibling fields are missing\r\n */\r\n requiredWithoutAllSiblings(fields: string[], errorMessage?: string): this;\r\n\r\n /**\r\n * Value is required if any of the specified fields exists\r\n */\r\n requiredWithAny(fields: string[], errorMessage?: string): this;\r\n\r\n /**\r\n * Value is required if any of the specified sibling fields exists\r\n */\r\n requiredWithAnySiblings(fields: string[], errorMessage?: string): this;\r\n\r\n /**\r\n * Value is required if any of the specified fields is missing\r\n */\r\n requiredWithoutAny(fields: string[], errorMessage?: string): this;\r\n\r\n /**\r\n * Value is required if any of the specified sibling fields is missing\r\n */\r\n requiredWithoutAnySiblings(fields: string[], errorMessage?: string): this;\r\n\r\n /**\r\n * Make this field required based on a custom callback.\r\n *\r\n * The callback receives only the `SchemaContext` (not the value),\r\n * because \"required\" is about surrounding conditions, not the field itself.\r\n * Return `true` if the field should be required.\r\n *\r\n * @param callback - Receives SchemaContext, returns boolean\r\n * @param errorMessage - Optional custom error message\r\n *\r\n * @example\r\n * ```ts\r\n * // Required when email notification is enabled\r\n * v.string().requiredWhen((context) => {\r\n * return context.allData.notificationMethod === 'email';\r\n * })\r\n *\r\n * // Required based on multiple conditions\r\n * v.string().requiredWhen((context) => {\r\n * const { role, department } = context.allData;\r\n * return role === 'manager' && department === 'finance';\r\n * })\r\n * ```\r\n */\r\n requiredWhen(\r\n callback: (context: SchemaContext) => boolean | Promise<boolean>,\r\n errorMessage?: string,\r\n ): this;\r\n }\r\n}\r\n\r\n// ==================== UNCONDITIONAL STATES ====================\r\n\r\n/**\r\n * This value must be present and has a value\r\n */\r\nBaseValidator.prototype.required = function (errorMessage?: string) {\r\n return this.setRequiredRule(requiredRule, errorMessage);\r\n};\r\n\r\n/**\r\n * Value must be present but not necessarily has a value\r\n */\r\nBaseValidator.prototype.present = function (errorMessage?: string) {\r\n return this.setRequiredRule(presentRule, errorMessage);\r\n};\r\n\r\n/**\r\n * Mark the field as optional — it may be absent or empty without validation errors.\r\n * Clears any previously set required rule.\r\n *\r\n * The return type is branded with `{ isOptional: true }` so schema inference\r\n * can mark this key as optional in the inferred TypeScript type.\r\n */\r\nBaseValidator.prototype.optional = function (): BaseValidator & { isOptional: true } {\r\n const instance = this.instance;\r\n instance.isOptional = true;\r\n instance.requiredRule = null;\r\n return instance as BaseValidator & { isOptional: true };\r\n};\r\n\r\n/**\r\n * Sugar — equivalent to `.optional().nullable()`.\r\n */\r\nBaseValidator.prototype.nullish = function (): BaseValidator & {\r\n isOptional: true;\r\n isNullable: true;\r\n} {\r\n const instance = this.optional().nullable();\r\n return instance as BaseValidator & { isOptional: true; isNullable: true };\r\n};\r\n\r\n// ==================== REQUIRED: BASED ON FIELD PRESENCE ====================\r\n\r\n/**\r\n * Value is required if another field exists\r\n */\r\nBaseValidator.prototype.requiredWith = function (field: string, errorMessage?: string) {\r\n return this.setRequiredRule(requiredWithRule, errorMessage, { field, scope: \"global\" });\r\n};\r\n\r\n/**\r\n * Value is required if another sibling field exists\r\n */\r\nBaseValidator.prototype.requiredWithSibling = function (field: string, errorMessage?: string) {\r\n return this.setRequiredRule(requiredWithRule, errorMessage, { field, scope: \"sibling\" });\r\n};\r\n\r\n/**\r\n * Value is required if another field is missing\r\n */\r\nBaseValidator.prototype.requiredWithout = function (field: string, errorMessage?: string) {\r\n return this.setRequiredRule(requiredWithoutRule, errorMessage, { field, scope: \"global\" });\r\n};\r\n\r\n/**\r\n * Value is required if another sibling field is missing\r\n */\r\nBaseValidator.prototype.requiredWithoutSibling = function (field: string, errorMessage?: string) {\r\n return this.setRequiredRule(requiredWithoutRule, errorMessage, { field, scope: \"sibling\" });\r\n};\r\n\r\n// ==================== REQUIRED: BASED ON FIELD VALUE ====================\r\n\r\n/**\r\n * Value is required if another field equals a specific value\r\n */\r\nBaseValidator.prototype.requiredIf = function (field: string, value: any, errorMessage?: string) {\r\n return this.setRequiredRule(requiredIfRule, errorMessage, { field, value, scope: \"global\" });\r\n};\r\n\r\n/**\r\n * Value is required if another sibling field equals a specific value\r\n */\r\nBaseValidator.prototype.requiredIfSibling = function (\r\n field: string,\r\n value: any,\r\n errorMessage?: string,\r\n) {\r\n return this.setRequiredRule(requiredIfRule, errorMessage, { field, value, scope: \"sibling\" });\r\n};\r\n\r\n/**\r\n * Value is required unless another field equals a specific value\r\n */\r\nBaseValidator.prototype.requiredUnless = function (\r\n field: string,\r\n value: any,\r\n errorMessage?: string,\r\n) {\r\n return this.setRequiredRule(requiredUnlessRule, errorMessage, { field, value, scope: \"global\" });\r\n};\r\n\r\n/**\r\n * Value is required unless another sibling field equals a specific value\r\n */\r\nBaseValidator.prototype.requiredUnlessSibling = function (\r\n field: string,\r\n value: any,\r\n errorMessage?: string,\r\n) {\r\n return this.setRequiredRule(requiredUnlessRule, errorMessage, { field, value, scope: \"sibling\" });\r\n};\r\n\r\n// ==================== REQUIRED: BASED ON FIELD EMPTY STATE ====================\r\n\r\n/**\r\n * Value is required if another field is empty\r\n */\r\nBaseValidator.prototype.requiredIfEmpty = function (field: string, errorMessage?: string) {\r\n return this.setRequiredRule(requiredIfEmptyRule, errorMessage, { field, scope: \"global\" });\r\n};\r\n\r\n/**\r\n * Value is required if another sibling field is empty\r\n */\r\nBaseValidator.prototype.requiredIfEmptySibling = function (field: string, errorMessage?: string) {\r\n return this.setRequiredRule(requiredIfEmptyRule, errorMessage, { field, scope: \"sibling\" });\r\n};\r\n\r\n/**\r\n * Value is required if another field is not empty\r\n */\r\nBaseValidator.prototype.requiredIfNotEmpty = function (field: string, errorMessage?: string) {\r\n return this.setRequiredRule(requiredIfNotEmptyRule, errorMessage, { field, scope: \"global\" });\r\n};\r\n\r\n/**\r\n * Value is required if another sibling field is not empty\r\n */\r\nBaseValidator.prototype.requiredIfNotEmptySibling = function (\r\n field: string,\r\n errorMessage?: string,\r\n) {\r\n return this.setRequiredRule(requiredIfNotEmptyRule, errorMessage, { field, scope: \"sibling\" });\r\n};\r\n\r\n// ==================== REQUIRED: BASED ON MULTIPLE FIELDS EMPTY STATE ====================\r\n\r\n/**\r\n * Value is required if ALL specified fields are empty\r\n */\r\nBaseValidator.prototype.requiredIfAllEmpty = function (fields: string[], errorMessage?: string) {\r\n return this.setRequiredRule(requiredIfAllEmptyRule, errorMessage, { fields, scope: \"global\" });\r\n};\r\n\r\n/**\r\n * Value is required if ALL specified sibling fields are empty\r\n */\r\nBaseValidator.prototype.requiredIfAllEmptySiblings = function (\r\n fields: string[],\r\n errorMessage?: string,\r\n) {\r\n return this.setRequiredRule(requiredIfAllEmptyRule, errorMessage, { fields, scope: \"sibling\" });\r\n};\r\n\r\n/**\r\n * Value is required if ANY of the specified fields is empty\r\n */\r\nBaseValidator.prototype.requiredIfAnyEmpty = function (fields: string[], errorMessage?: string) {\r\n return this.setRequiredRule(requiredIfAnyEmptyRule, errorMessage, { fields, scope: \"global\" });\r\n};\r\n\r\n/**\r\n * Value is required if ANY of the specified sibling fields is empty\r\n */\r\nBaseValidator.prototype.requiredIfAnyEmptySiblings = function (\r\n fields: string[],\r\n errorMessage?: string,\r\n) {\r\n return this.setRequiredRule(requiredIfAnyEmptyRule, errorMessage, { fields, scope: \"sibling\" });\r\n};\r\n\r\n/**\r\n * Value is required if ALL specified fields are NOT empty\r\n */\r\nBaseValidator.prototype.requiredIfAllNotEmpty = function (fields: string[], errorMessage?: string) {\r\n return this.setRequiredRule(requiredIfAllNotEmptyRule, errorMessage, { fields, scope: \"global\" });\r\n};\r\n\r\n/**\r\n * Value is required if ALL specified sibling fields are NOT empty\r\n */\r\nBaseValidator.prototype.requiredIfAllNotEmptySiblings = function (\r\n fields: string[],\r\n errorMessage?: string,\r\n) {\r\n return this.setRequiredRule(requiredIfAllNotEmptyRule, errorMessage, {\r\n fields,\r\n scope: \"sibling\",\r\n });\r\n};\r\n\r\n/**\r\n * Value is required if ANY of the specified fields is NOT empty\r\n */\r\nBaseValidator.prototype.requiredIfAnyNotEmpty = function (fields: string[], errorMessage?: string) {\r\n return this.setRequiredRule(requiredIfAnyNotEmptyRule, errorMessage, { fields, scope: \"global\" });\r\n};\r\n\r\n/**\r\n * Value is required if ANY of the specified sibling fields is NOT empty\r\n */\r\nBaseValidator.prototype.requiredIfAnyNotEmptySiblings = function (\r\n fields: string[],\r\n errorMessage?: string,\r\n) {\r\n return this.setRequiredRule(requiredIfAnyNotEmptyRule, errorMessage, {\r\n fields,\r\n scope: \"sibling\",\r\n });\r\n};\r\n\r\n/**\r\n * Value is required if another field's value is in the given array\r\n */\r\nBaseValidator.prototype.requiredIfIn = function (\r\n field: string,\r\n values: any[],\r\n errorMessage?: string,\r\n) {\r\n return this.setRequiredRule(requiredIfInRule, errorMessage, { field, values, scope: \"global\" });\r\n};\r\n\r\n/**\r\n * Value is required if another sibling field's value is in the given array\r\n */\r\nBaseValidator.prototype.requiredIfInSibling = function (\r\n field: string,\r\n values: any[],\r\n errorMessage?: string,\r\n) {\r\n return this.setRequiredRule(requiredIfInRule, errorMessage, { field, values, scope: \"sibling\" });\r\n};\r\n\r\n/**\r\n * Value is required if another field's value is NOT in the given array\r\n */\r\nBaseValidator.prototype.requiredIfNotIn = function (\r\n field: string,\r\n values: any[],\r\n errorMessage?: string,\r\n) {\r\n return this.setRequiredRule(requiredIfNotInRule, errorMessage, {\r\n field,\r\n values,\r\n scope: \"global\",\r\n });\r\n};\r\n\r\n/**\r\n * Value is required if another sibling field's value is NOT in the given array\r\n */\r\nBaseValidator.prototype.requiredIfNotInSibling = function (\r\n field: string,\r\n values: any[],\r\n errorMessage?: string,\r\n) {\r\n return this.setRequiredRule(requiredIfNotInRule, errorMessage, {\r\n field,\r\n values,\r\n scope: \"sibling\",\r\n });\r\n};\r\n\r\n// ==================== REQUIRED: BASED ON MULTIPLE FIELDS (ALL) ====================\r\n\r\n/**\r\n * Value is required if all specified fields exist\r\n */\r\nBaseValidator.prototype.requiredWithAll = function (fields: string[], errorMessage?: string) {\r\n return this.setRequiredRule(requiredWithAllRule, errorMessage, { fields, scope: \"global\" });\r\n};\r\n\r\n/**\r\n * Value is required if all specified sibling fields exist\r\n */\r\nBaseValidator.prototype.requiredWithAllSiblings = function (\r\n fields: string[],\r\n errorMessage?: string,\r\n) {\r\n return this.setRequiredRule(requiredWithAllRule, errorMessage, { fields, scope: \"sibling\" });\r\n};\r\n\r\n/**\r\n * Value is required if all specified fields are missing\r\n */\r\nBaseValidator.prototype.requiredWithoutAll = function (fields: string[], errorMessage?: string) {\r\n return this.setRequiredRule(requiredWithoutAllRule, errorMessage, { fields, scope: \"global\" });\r\n};\r\n\r\n/**\r\n * Value is required if all specified sibling fields are missing\r\n */\r\nBaseValidator.prototype.requiredWithoutAllSiblings = function (\r\n fields: string[],\r\n errorMessage?: string,\r\n) {\r\n return this.setRequiredRule(requiredWithoutAllRule, errorMessage, { fields, scope: \"sibling\" });\r\n};\r\n\r\n// ==================== REQUIRED: BASED ON MULTIPLE FIELDS (ANY) ====================\r\n\r\n/**\r\n * Value is required if any of the specified fields exists\r\n */\r\nBaseValidator.prototype.requiredWithAny = function (fields: string[], errorMessage?: string) {\r\n return this.setRequiredRule(requiredWithAnyRule, errorMessage, { fields, scope: \"global\" });\r\n};\r\n\r\n/**\r\n * Value is required if any of the specified sibling fields exists\r\n */\r\nBaseValidator.prototype.requiredWithAnySiblings = function (\r\n fields: string[],\r\n errorMessage?: string,\r\n) {\r\n return this.setRequiredRule(requiredWithAnyRule, errorMessage, { fields, scope: \"sibling\" });\r\n};\r\n\r\n/**\r\n * Value is required if any of the specified fields is missing\r\n */\r\nBaseValidator.prototype.requiredWithoutAny = function (fields: string[], errorMessage?: string) {\r\n return this.setRequiredRule(requiredWithoutAnyRule, errorMessage, { fields, scope: \"global\" });\r\n};\r\n\r\n/**\r\n * Value is required if any of the specified sibling fields is missing\r\n */\r\nBaseValidator.prototype.requiredWithoutAnySiblings = function (\r\n fields: string[],\r\n errorMessage?: string,\r\n) {\r\n return this.setRequiredRule(requiredWithoutAnyRule, errorMessage, { fields, scope: \"sibling\" });\r\n};\r\n\r\n// ==================== REQUIRED: BASED ON CUSTOM CALLBACK ====================\r\n\r\n/**\r\n * Make this field required based on a custom callback.\r\n * Callback receives only SchemaContext — the framework handles empty-value checking.\r\n */\r\nBaseValidator.prototype.requiredWhen = function (\r\n callback: (context: SchemaContext) => boolean | Promise<boolean>,\r\n errorMessage?: string,\r\n) {\r\n return this.setRequiredRule(requiredWhenRule, errorMessage, { callback });\r\n};\r\n"],"mappings":";;;;;;;;;;;;;;;AAiCA,MAAa,yBAAyB;;;;AAuOtC,cAAc,UAAU,WAAW,SAAU,cAAuB;CAClE,OAAO,KAAK,gBAAgB,cAAc,YAAY;AACxD;;;;AAKA,cAAc,UAAU,UAAU,SAAU,cAAuB;CACjE,OAAO,KAAK,gBAAgB,aAAa,YAAY;AACvD;;;;;;;;AASA,cAAc,UAAU,WAAW,WAAkD;CACnF,MAAM,WAAW,KAAK;CACtB,SAAS,aAAa;CACtB,SAAS,eAAe;CACxB,OAAO;AACT;;;;AAKA,cAAc,UAAU,UAAU,WAGhC;CAEA,OADiB,KAAK,SAAS,EAAE,SACnB;AAChB;;;;AAOA,cAAc,UAAU,eAAe,SAAU,OAAe,cAA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U,0BAA0B,SAChD,QACA,cACA;CACA,OAAO,KAAK,gBAAgB,qBAAqB,cAAc;EAAE;EAAQ,OAAO;CAAU,CAAC;AAC7F;;;;AAKA,cAAc,UAAU,qBAAqB,SAAU,QAAkB,cAAuB;CAC9F,OAAO,KAAK,gBAAgB,wBAAwB,cAAc;EAAE;EAAQ,OAAO;CAAS,CAAC;AAC/F;;;;AAKA,cAAc,UAAU,6BAA6B,SACnD,QACA,cACA;CACA,OAAO,KAAK,gBAAgB,wBAAwB,cAAc;EAAE;EAAQ,OAAO;CAAU,CAAC;AAChG;;;;;AAQA,cAAc,UAAU,eAAe,SACrC,UACA,cACA;CACA,OAAO,KAAK,gBAAgB,kBAAkB,cAAc,EAAE,SAAS,CAAC;AAC1E"}
1
+ {"version":3,"file":"required-methods.mjs","names":[],"sources":["../../../../../../../../seal/src/validators/methods/required-methods.ts"],"sourcesContent":["import {\r\n requiredIfAllEmptyRule,\r\n requiredIfAllNotEmptyRule,\r\n requiredIfAnyEmptyRule,\r\n requiredIfAnyNotEmptyRule,\r\n requiredIfEmptyRule,\r\n requiredIfInRule,\r\n requiredIfNotEmptyRule,\r\n requiredIfNotInRule,\r\n requiredIfRule,\r\n} from \"../../rules/conditional/required-if-rules\";\r\nimport { requiredUnlessRule } from \"../../rules/conditional/required-unless-rules\";\r\nimport { requiredWhenRule } from \"../../rules/conditional/required-when-rule\";\r\nimport {\r\n requiredWithAllRule,\r\n requiredWithAnyRule,\r\n requiredWithRule,\r\n} from \"../../rules/conditional/required-with-rules\";\r\nimport {\r\n requiredWithoutAllRule,\r\n requiredWithoutAnyRule,\r\n requiredWithoutRule,\r\n} from \"../../rules/conditional/required-without-rules\";\r\nimport { presentRule, requiredRule } from \"../../rules/core/required\";\r\nimport type { SchemaContext } from \"../../types\";\r\nimport { BaseValidator } from \"../base-validator\";\r\n\r\n/**\r\n * Marker re-exported by the validators barrel so the dts bundler keeps this\r\n * module (and its `declare module` augmentation) in the bundled `.d.ts`.\r\n * Without a real export, side-effect-only augmentation modules get tree-shaken\r\n * out of the published types, dropping every chainable rule method.\r\n */\r\nexport const requiredMethodsApplied = true;\r\n\r\ndeclare module \"../base-validator\" {\r\n interface BaseValidator {\r\n /**\r\n * This value must be present and has a value\r\n */\r\n required(errorMessage?: string): this;\r\n\r\n /**\r\n * Value must be present but not necessarily has a value\r\n */\r\n present(errorMessage?: string): this;\r\n\r\n /**\r\n * Mark the field as optional, so pass it if it has no value or has a value\r\n * Because this is the default behavior, this method is just syntactic sugar\r\n */\r\n optional(): this & { isOptional: true };\r\n\r\n /**\r\n * Sugar for `.optional().nullable()` — the field may be absent OR null.\r\n *\r\n * Brands the return type with both `{ isOptional: true }` and `{ isNullable: true }`\r\n * so `Infer<>` produces `{ field?: T | null }`.\r\n *\r\n * @example\r\n * v.string().nullish()\r\n * // type: string | null | undefined\r\n * // absent → key omitted\r\n * // null → null\r\n * // \"x\" → \"x\"\r\n */\r\n nullish(): this & { isOptional: true; isNullable: true };\r\n\r\n /**\r\n * Value is required if another field exists\r\n */\r\n requiredWith(field: string, errorMessage?: string): this;\r\n\r\n /**\r\n * Value is required if another sibling field exists\r\n */\r\n requiredWithSibling(field: string, errorMessage?: string): this;\r\n\r\n /**\r\n * Value is required if another field is missing\r\n */\r\n requiredWithout(field: string, errorMessage?: string): this;\r\n\r\n /**\r\n * Value is required if another sibling field is missing\r\n */\r\n requiredWithoutSibling(field: string, errorMessage?: string): this;\r\n\r\n /**\r\n * Value is required if another field equals a specific value\r\n */\r\n requiredIf(field: string, value: any, errorMessage?: string): this;\r\n\r\n /**\r\n * Value is required if another sibling field equals a specific value\r\n */\r\n requiredIfSibling(field: string, value: any, errorMessage?: string): this;\r\n\r\n /**\r\n * Value is required unless another field equals a specific value\r\n */\r\n requiredUnless(field: string, value: any, errorMessage?: string): this;\r\n\r\n /**\r\n * Value is required unless another sibling field equals a specific value\r\n */\r\n requiredUnlessSibling(field: string, value: any, errorMessage?: string): this;\r\n\r\n /**\r\n * Value is required if another field is empty\r\n */\r\n requiredIfEmpty(field: string, errorMessage?: string): this;\r\n\r\n /**\r\n * Value is required if another sibling field is empty\r\n */\r\n requiredIfEmptySibling(field: string, errorMessage?: string): this;\r\n\r\n /**\r\n * Value is required if another field is not empty\r\n */\r\n requiredIfNotEmpty(field: string, errorMessage?: string): this;\r\n\r\n /**\r\n * Value is required if another sibling field is not empty\r\n */\r\n requiredIfNotEmptySibling(field: string, errorMessage?: string): this;\r\n\r\n /**\r\n * Value is required if ALL specified fields are empty\r\n */\r\n requiredIfAllEmpty(fields: string[], errorMessage?: string): this;\r\n\r\n /**\r\n * Value is required if ALL specified sibling fields are empty\r\n */\r\n requiredIfAllEmptySiblings(fields: string[], errorMessage?: string): this;\r\n\r\n /**\r\n * Value is required if ANY of the specified fields is empty\r\n */\r\n requiredIfAnyEmpty(fields: string[], errorMessage?: string): this;\r\n\r\n /**\r\n * Value is required if ANY of the specified sibling fields is empty\r\n */\r\n requiredIfAnyEmptySiblings(fields: string[], errorMessage?: string): this;\r\n\r\n /**\r\n * Value is required if ALL specified fields are NOT empty\r\n */\r\n requiredIfAllNotEmpty(fields: string[], errorMessage?: string): this;\r\n\r\n /**\r\n * Value is required if ALL specified sibling fields are NOT empty\r\n */\r\n requiredIfAllNotEmptySiblings(fields: string[], errorMessage?: string): this;\r\n\r\n /**\r\n * Value is required if ANY of the specified fields is NOT empty\r\n */\r\n requiredIfAnyNotEmpty(fields: string[], errorMessage?: string): this;\r\n\r\n /**\r\n * Value is required if ANY of the specified sibling fields is NOT empty\r\n */\r\n requiredIfAnyNotEmptySiblings(fields: string[], errorMessage?: string): this;\r\n\r\n /**\r\n * Value is required if another field's value is in the given array\r\n */\r\n requiredIfIn(field: string, values: any[], errorMessage?: string): this;\r\n\r\n /**\r\n * Value is required if another sibling field's value is in the given array\r\n */\r\n requiredIfInSibling(field: string, values: any[], errorMessage?: string): this;\r\n\r\n /**\r\n * Value is required if another field's value is NOT in the given array\r\n */\r\n requiredIfNotIn(field: string, values: any[], errorMessage?: string): this;\r\n\r\n /**\r\n * Value is required if another sibling field's value is NOT in the given array\r\n */\r\n requiredIfNotInSibling(field: string, values: any[], errorMessage?: string): this;\r\n\r\n /**\r\n * Value is required if all specified fields exist\r\n */\r\n requiredWithAll(fields: string[], errorMessage?: string): this;\r\n\r\n /**\r\n * Value is required if all specified sibling fields exist\r\n */\r\n requiredWithAllSiblings(fields: string[], errorMessage?: string): this;\r\n\r\n /**\r\n * Value is required if all specified fields are missing\r\n */\r\n requiredWithoutAll(fields: string[], errorMessage?: string): this;\r\n\r\n /**\r\n * Value is required if all specified sibling fields are missing\r\n */\r\n requiredWithoutAllSiblings(fields: string[], errorMessage?: string): this;\r\n\r\n /**\r\n * Value is required if any of the specified fields exists\r\n */\r\n requiredWithAny(fields: string[], errorMessage?: string): this;\r\n\r\n /**\r\n * Value is required if any of the specified sibling fields exists\r\n */\r\n requiredWithAnySiblings(fields: string[], errorMessage?: string): this;\r\n\r\n /**\r\n * Value is required if any of the specified fields is missing\r\n */\r\n requiredWithoutAny(fields: string[], errorMessage?: string): this;\r\n\r\n /**\r\n * Value is required if any of the specified sibling fields is missing\r\n */\r\n requiredWithoutAnySiblings(fields: string[], errorMessage?: string): this;\r\n\r\n /**\r\n * Make this field required based on a custom callback.\r\n *\r\n * The callback receives only the `SchemaContext` (not the value),\r\n * because \"required\" is about surrounding conditions, not the field itself.\r\n * Return `true` if the field should be required.\r\n *\r\n * @param callback - Receives SchemaContext, returns boolean\r\n * @param errorMessage - Optional custom error message\r\n *\r\n * @example\r\n * ```ts\r\n * // Required when email notification is enabled\r\n * v.string().requiredWhen((context) => {\r\n * return context.allData.notificationMethod === 'email';\r\n * })\r\n *\r\n * // Required based on multiple conditions\r\n * v.string().requiredWhen((context) => {\r\n * const { role, department } = context.allData;\r\n * return role === 'manager' && department === 'finance';\r\n * })\r\n * ```\r\n */\r\n requiredWhen(\r\n callback: (context: SchemaContext) => boolean | Promise<boolean>,\r\n errorMessage?: string,\r\n ): this;\r\n }\r\n}\r\n\r\n// ==================== UNCONDITIONAL STATES ====================\r\n\r\n/**\r\n * This value must be present and has a value\r\n */\r\nBaseValidator.prototype.required = function (errorMessage?: string) {\r\n return this.setRequiredRule(requiredRule, errorMessage);\r\n};\r\n\r\n/**\r\n * Value must be present but not necessarily has a value\r\n */\r\nBaseValidator.prototype.present = function (errorMessage?: string) {\r\n return this.setRequiredRule(presentRule, errorMessage);\r\n};\r\n\r\n/**\r\n * Mark the field as optional — it may be absent or empty without validation errors.\r\n * Clears any previously set required rule.\r\n *\r\n * The return type is branded with `{ isOptional: true }` so schema inference\r\n * can mark this key as optional in the inferred TypeScript type.\r\n */\r\nBaseValidator.prototype.optional = function (): BaseValidator & { isOptional: true } {\r\n const instance = this.instance;\r\n instance.isOptional = true;\r\n instance.requiredRule = null;\r\n return instance as BaseValidator & { isOptional: true };\r\n};\r\n\r\n/**\r\n * Sugar — equivalent to `.optional().nullable()`.\r\n */\r\nBaseValidator.prototype.nullish = function (): BaseValidator & {\r\n isOptional: true;\r\n isNullable: true;\r\n} {\r\n const instance = this.optional().nullable();\r\n return instance as BaseValidator & { isOptional: true; isNullable: true };\r\n};\r\n\r\n// ==================== REQUIRED: BASED ON FIELD PRESENCE ====================\r\n\r\n/**\r\n * Value is required if another field exists\r\n */\r\nBaseValidator.prototype.requiredWith = function (field: string, errorMessage?: string) {\r\n return this.setRequiredRule(requiredWithRule, errorMessage, { field, scope: \"global\" });\r\n};\r\n\r\n/**\r\n * Value is required if another sibling field exists\r\n */\r\nBaseValidator.prototype.requiredWithSibling = function (field: string, errorMessage?: string) {\r\n return this.setRequiredRule(requiredWithRule, errorMessage, { field, scope: \"sibling\" });\r\n};\r\n\r\n/**\r\n * Value is required if another field is missing\r\n */\r\nBaseValidator.prototype.requiredWithout = function (field: string, errorMessage?: string) {\r\n return this.setRequiredRule(requiredWithoutRule, errorMessage, { field, scope: \"global\" });\r\n};\r\n\r\n/**\r\n * Value is required if another sibling field is missing\r\n */\r\nBaseValidator.prototype.requiredWithoutSibling = function (field: string, errorMessage?: string) {\r\n return this.setRequiredRule(requiredWithoutRule, errorMessage, { field, scope: \"sibling\" });\r\n};\r\n\r\n// ==================== REQUIRED: BASED ON FIELD VALUE ====================\r\n\r\n/**\r\n * Value is required if another field equals a specific value\r\n */\r\nBaseValidator.prototype.requiredIf = function (field: string, value: any, errorMessage?: string) {\r\n return this.setRequiredRule(requiredIfRule, errorMessage, { field, value, scope: \"global\" });\r\n};\r\n\r\n/**\r\n * Value is required if another sibling field equals a specific value\r\n */\r\nBaseValidator.prototype.requiredIfSibling = function (\r\n field: string,\r\n value: any,\r\n errorMessage?: string,\r\n) {\r\n return this.setRequiredRule(requiredIfRule, errorMessage, { field, value, scope: \"sibling\" });\r\n};\r\n\r\n/**\r\n * Value is required unless another field equals a specific value\r\n */\r\nBaseValidator.prototype.requiredUnless = function (\r\n field: string,\r\n value: any,\r\n errorMessage?: string,\r\n) {\r\n return this.setRequiredRule(requiredUnlessRule, errorMessage, { field, value, scope: \"global\" });\r\n};\r\n\r\n/**\r\n * Value is required unless another sibling field equals a specific value\r\n */\r\nBaseValidator.prototype.requiredUnlessSibling = function (\r\n field: string,\r\n value: any,\r\n errorMessage?: string,\r\n) {\r\n return this.setRequiredRule(requiredUnlessRule, errorMessage, { field, value, scope: \"sibling\" });\r\n};\r\n\r\n// ==================== REQUIRED: BASED ON FIELD EMPTY STATE ====================\r\n\r\n/**\r\n * Value is required if another field is empty\r\n */\r\nBaseValidator.prototype.requiredIfEmpty = function (field: string, errorMessage?: string) {\r\n return this.setRequiredRule(requiredIfEmptyRule, errorMessage, { field, scope: \"global\" });\r\n};\r\n\r\n/**\r\n * Value is required if another sibling field is empty\r\n */\r\nBaseValidator.prototype.requiredIfEmptySibling = function (field: string, errorMessage?: string) {\r\n return this.setRequiredRule(requiredIfEmptyRule, errorMessage, { field, scope: \"sibling\" });\r\n};\r\n\r\n/**\r\n * Value is required if another field is not empty\r\n */\r\nBaseValidator.prototype.requiredIfNotEmpty = function (field: string, errorMessage?: string) {\r\n return this.setRequiredRule(requiredIfNotEmptyRule, errorMessage, { field, scope: \"global\" });\r\n};\r\n\r\n/**\r\n * Value is required if another sibling field is not empty\r\n */\r\nBaseValidator.prototype.requiredIfNotEmptySibling = function (\r\n field: string,\r\n errorMessage?: string,\r\n) {\r\n return this.setRequiredRule(requiredIfNotEmptyRule, errorMessage, { field, scope: \"sibling\" });\r\n};\r\n\r\n// ==================== REQUIRED: BASED ON MULTIPLE FIELDS EMPTY STATE ====================\r\n\r\n/**\r\n * Value is required if ALL specified fields are empty\r\n */\r\nBaseValidator.prototype.requiredIfAllEmpty = function (fields: string[], errorMessage?: string) {\r\n return this.setRequiredRule(requiredIfAllEmptyRule, errorMessage, { fields, scope: \"global\" });\r\n};\r\n\r\n/**\r\n * Value is required if ALL specified sibling fields are empty\r\n */\r\nBaseValidator.prototype.requiredIfAllEmptySiblings = function (\r\n fields: string[],\r\n errorMessage?: string,\r\n) {\r\n return this.setRequiredRule(requiredIfAllEmptyRule, errorMessage, { fields, scope: \"sibling\" });\r\n};\r\n\r\n/**\r\n * Value is required if ANY of the specified fields is empty\r\n */\r\nBaseValidator.prototype.requiredIfAnyEmpty = function (fields: string[], errorMessage?: string) {\r\n return this.setRequiredRule(requiredIfAnyEmptyRule, errorMessage, { fields, scope: \"global\" });\r\n};\r\n\r\n/**\r\n * Value is required if ANY of the specified sibling fields is empty\r\n */\r\nBaseValidator.prototype.requiredIfAnyEmptySiblings = function (\r\n fields: string[],\r\n errorMessage?: string,\r\n) {\r\n return this.setRequiredRule(requiredIfAnyEmptyRule, errorMessage, { fields, scope: \"sibling\" });\r\n};\r\n\r\n/**\r\n * Value is required if ALL specified fields are NOT empty\r\n */\r\nBaseValidator.prototype.requiredIfAllNotEmpty = function (fields: string[], errorMessage?: string) {\r\n return this.setRequiredRule(requiredIfAllNotEmptyRule, errorMessage, { fields, scope: \"global\" });\r\n};\r\n\r\n/**\r\n * Value is required if ALL specified sibling fields are NOT empty\r\n */\r\nBaseValidator.prototype.requiredIfAllNotEmptySiblings = function (\r\n fields: string[],\r\n errorMessage?: string,\r\n) {\r\n return this.setRequiredRule(requiredIfAllNotEmptyRule, errorMessage, {\r\n fields,\r\n scope: \"sibling\",\r\n });\r\n};\r\n\r\n/**\r\n * Value is required if ANY of the specified fields is NOT empty\r\n */\r\nBaseValidator.prototype.requiredIfAnyNotEmpty = function (fields: string[], errorMessage?: string) {\r\n return this.setRequiredRule(requiredIfAnyNotEmptyRule, errorMessage, { fields, scope: \"global\" });\r\n};\r\n\r\n/**\r\n * Value is required if ANY of the specified sibling fields is NOT empty\r\n */\r\nBaseValidator.prototype.requiredIfAnyNotEmptySiblings = function (\r\n fields: string[],\r\n errorMessage?: string,\r\n) {\r\n return this.setRequiredRule(requiredIfAnyNotEmptyRule, errorMessage, {\r\n fields,\r\n scope: \"sibling\",\r\n });\r\n};\r\n\r\n/**\r\n * Value is required if another field's value is in the given array\r\n */\r\nBaseValidator.prototype.requiredIfIn = function (\r\n field: string,\r\n values: any[],\r\n errorMessage?: string,\r\n) {\r\n return this.setRequiredRule(requiredIfInRule, errorMessage, { field, values, scope: \"global\" });\r\n};\r\n\r\n/**\r\n * Value is required if another sibling field's value is in the given array\r\n */\r\nBaseValidator.prototype.requiredIfInSibling = function (\r\n field: string,\r\n values: any[],\r\n errorMessage?: string,\r\n) {\r\n return this.setRequiredRule(requiredIfInRule, errorMessage, { field, values, scope: \"sibling\" });\r\n};\r\n\r\n/**\r\n * Value is required if another field's value is NOT in the given array\r\n */\r\nBaseValidator.prototype.requiredIfNotIn = function (\r\n field: string,\r\n values: any[],\r\n errorMessage?: string,\r\n) {\r\n return this.setRequiredRule(requiredIfNotInRule, errorMessage, {\r\n field,\r\n values,\r\n scope: \"global\",\r\n });\r\n};\r\n\r\n/**\r\n * Value is required if another sibling field's value is NOT in the given array\r\n */\r\nBaseValidator.prototype.requiredIfNotInSibling = function (\r\n field: string,\r\n values: any[],\r\n errorMessage?: string,\r\n) {\r\n return this.setRequiredRule(requiredIfNotInRule, errorMessage, {\r\n field,\r\n values,\r\n scope: \"sibling\",\r\n });\r\n};\r\n\r\n// ==================== REQUIRED: BASED ON MULTIPLE FIELDS (ALL) ====================\r\n\r\n/**\r\n * Value is required if all specified fields exist\r\n */\r\nBaseValidator.prototype.requiredWithAll = function (fields: string[], errorMessage?: string) {\r\n return this.setRequiredRule(requiredWithAllRule, errorMessage, { fields, scope: \"global\" });\r\n};\r\n\r\n/**\r\n * Value is required if all specified sibling fields exist\r\n */\r\nBaseValidator.prototype.requiredWithAllSiblings = function (\r\n fields: string[],\r\n errorMessage?: string,\r\n) {\r\n return this.setRequiredRule(requiredWithAllRule, errorMessage, { fields, scope: \"sibling\" });\r\n};\r\n\r\n/**\r\n * Value is required if all specified fields are missing\r\n */\r\nBaseValidator.prototype.requiredWithoutAll = function (fields: string[], errorMessage?: string) {\r\n return this.setRequiredRule(requiredWithoutAllRule, errorMessage, { fields, scope: \"global\" });\r\n};\r\n\r\n/**\r\n * Value is required if all specified sibling fields are missing\r\n */\r\nBaseValidator.prototype.requiredWithoutAllSiblings = function (\r\n fields: string[],\r\n errorMessage?: string,\r\n) {\r\n return this.setRequiredRule(requiredWithoutAllRule, errorMessage, { fields, scope: \"sibling\" });\r\n};\r\n\r\n// ==================== REQUIRED: BASED ON MULTIPLE FIELDS (ANY) ====================\r\n\r\n/**\r\n * Value is required if any of the specified fields exists\r\n */\r\nBaseValidator.prototype.requiredWithAny = function (fields: string[], errorMessage?: string) {\r\n return this.setRequiredRule(requiredWithAnyRule, errorMessage, { fields, scope: \"global\" });\r\n};\r\n\r\n/**\r\n * Value is required if any of the specified sibling fields exists\r\n */\r\nBaseValidator.prototype.requiredWithAnySiblings = function (\r\n fields: string[],\r\n errorMessage?: string,\r\n) {\r\n return this.setRequiredRule(requiredWithAnyRule, errorMessage, { fields, scope: \"sibling\" });\r\n};\r\n\r\n/**\r\n * Value is required if any of the specified fields is missing\r\n */\r\nBaseValidator.prototype.requiredWithoutAny = function (fields: string[], errorMessage?: string) {\r\n return this.setRequiredRule(requiredWithoutAnyRule, errorMessage, { fields, scope: \"global\" });\r\n};\r\n\r\n/**\r\n * Value is required if any of the specified sibling fields is missing\r\n */\r\nBaseValidator.prototype.requiredWithoutAnySiblings = function (\r\n fields: string[],\r\n errorMessage?: string,\r\n) {\r\n return this.setRequiredRule(requiredWithoutAnyRule, errorMessage, { fields, scope: \"sibling\" });\r\n};\r\n\r\n// ==================== REQUIRED: BASED ON CUSTOM CALLBACK ====================\r\n\r\n/**\r\n * Make this field required based on a custom callback.\r\n * Callback receives only SchemaContext — the framework handles empty-value checking.\r\n */\r\nBaseValidator.prototype.requiredWhen = function (\r\n callback: (context: SchemaContext) => boolean | Promise<boolean>,\r\n errorMessage?: string,\r\n) {\r\n return this.setRequiredRule(requiredWhenRule, errorMessage, { callback });\r\n};\r\n"],"mappings":";;;;;;;;;;;;;;;AAiCA,MAAa,yBAAyB;;;;AAuOtC,cAAc,UAAU,WAAW,SAAU,cAAuB;CAClE,OAAO,KAAK,gBAAgB,cAAc,YAAY;AACxD;;;;AAKA,cAAc,UAAU,UAAU,SAAU,cAAuB;CACjE,OAAO,KAAK,gBAAgB,aAAa,YAAY;AACvD;;;;;;;;AASA,cAAc,UAAU,WAAW,WAAkD;CACnF,MAAM,WAAW,KAAK;CACtB,SAAS,aAAa;CACtB,SAAS,eAAe;CACxB,OAAO;AACT;;;;AAKA,cAAc,UAAU,UAAU,WAGhC;CAEA,OADiB,KAAK,SAAS,EAAE,SACnB;AAChB;;;;AAOA,cAAc,UAAU,eAAe,SAAU,OAAe,cAAuB;CACrF,OAAO,KAAK,gBAAgB,kBAAkB,cAAc;EAAE;EAAO,OAAO;CAAS,CAAC;AACxF;;;;AAKA,cAAc,UAAU,sBAAsB,SAAU,OAAe,cAAuB;CAC5F,OAAO,KAAK,gBAAgB,kBAAkB,cAAc;EAAE;EAAO,OAAO;CAAU,CAAC;AACzF;;;;AAKA,cAAc,UAAU,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AC/F;;;;AAKA,cAAc,UAAU,6BAA6B,SACnD,QACA,cACA;CACA,OAAO,KAAK,gBAAgB,wBAAwB,cAAc;EAAE;EAAQ,OAAO;CAAU,CAAC;AAChG;;;;;AAQA,cAAc,UAAU,eAAe,SACrC,UACA,cACA;CACA,OAAO,KAAK,gBAAgB,kBAAkB,cAAc,EAAE,SAAS,CAAC;AAC1E"}
@@ -1,7 +1,7 @@
1
1
  import { JsonSchemaResult, JsonSchemaTarget } from "../standard-schema/json-schema.mjs";
2
2
  import { PrimitiveValidator } from "./primitive-validator.mjs";
3
3
 
4
- //#region seal/src/validators/number-validator.d.ts
4
+ //#region ../seal/src/validators/number-validator.d.ts
5
5
  /**
6
6
  * Number validator class - base for Int and Float validators
7
7
  */
@@ -1 +1 @@
1
- {"version":3,"file":"number-validator.d.mts","names":[],"sources":["C:/Work/Warlock.js/seal/src/validators/number-validator.ts"],"mappings":";;;;;;AAwBA;cAAa,eAAA,SAAwB,kBAAA;cAChB,YAAA;EAuRkB;;;EA/Q9B,WAAA,CAAY,KAAA;EATgB;;;;;;EAmB5B,GAAA,CAAI,GAAA,mBAAsB,YAAA;EAVd;;;;;;EAoBZ,GAAA,CAAI,GAAA,mBAAsB,YAAA;EAQ1B;;;;EAAA,UAAA,CAAW,KAAA,UAAe,YAAA;EAQA;;;;EAA1B,UAAA,CAAW,KAAA,UAAe,YAAA;EAuBjB;;;;;;EAbT,WAAA,CAAY,KAAA,mBAAwB,YAAA;EAgCT;;;;;;EAnB3B,QAAA,CAAS,KAAA,mBAAwB,YAAA;EA8CjC;;;;EAnCA,EAAA,CAAG,KAAA,mBAAwB,YAAA;EA8CF;;;;EAtCzB,EAAA,CAAG,KAAA,mBAAwB,YAAA;EAkDf;;;;EA1CZ,kBAAA,CAAmB,KAAA,UAAe,YAAA;EAwDlC;;;;EA7CA,SAAA,CAAU,KAAA,UAAe,YAAA;EAuDzB;;;;EA/CA,eAAA,CAAgB,KAAA,UAAe,YAAA;EAyD1B;;;;EA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AAA;;;;;;YAShE,qBAAA,CACR,IAAA,wBACA,MAAA,EAAQ,gBAAA,GACP,gBAAA;AAAA"}
@@ -7,7 +7,7 @@ import { numberRule } from "../rules/common/type-rules.mjs";
7
7
  import "../rules/index.mjs";
8
8
  import { PrimitiveValidator } from "./primitive-validator.mjs";
9
9
 
10
- //#region seal/src/validators/number-validator.ts
10
+ //#region ../seal/src/validators/number-validator.ts
11
11
  /**
12
12
  * Number validator class - base for Int and Float validators
13
13
  */
@@ -1 +1 @@
1
- {"version":3,"file":"number-validator.mjs","names":[],"sources":["C:/Work/Warlock.js/seal/src/validators/number-validator.ts"],"sourcesContent":["import { absMutator, ceilMutator, floorMutator, roundMutator, toFixedMutator } from \"../mutators\";\r\nimport {\r\n betweenNumbersRule,\r\n evenRule,\r\n greaterThanRule,\r\n lengthRule,\r\n lessThanRule,\r\n maxLengthRule,\r\n maxRule,\r\n minLengthRule,\r\n minRule,\r\n moduloRule,\r\n negativeRule,\r\n numberRule,\r\n oddRule,\r\n positiveRule,\r\n} from \"../rules\";\r\nimport { PrimitiveValidator } from \"./primitive-validator\";\r\nimport { applyNullable, getRuleOptions } from \"../standard-schema/json-schema\";\r\nimport type { JsonSchemaResult, JsonSchemaTarget } from \"../standard-schema/json-schema\";\r\n\r\n/**\r\n * Number validator class - base for Int and Float validators\r\n */\r\nexport class NumberValidator extends PrimitiveValidator {\r\n public constructor(errorMessage?: string) {\r\n super();\r\n this.addMutableRule(numberRule, errorMessage);\r\n }\r\n\r\n /**\r\n * Check if value is a number type\r\n */\r\n public matchesType(value: any): boolean {\r\n return typeof value === \"number\" && !isNaN(value);\r\n }\r\n\r\n /**\r\n * Value must be equal or higher than the given number or field\r\n * Smart detection: number or field name\r\n *\r\n * @category Validation Rule\r\n */\r\n public min(min: number | string, errorMessage?: string) {\r\n return this.addRule(minRule, errorMessage, { min, scope: \"global\" });\r\n }\r\n\r\n /**\r\n * Value must be equal or less than the given number or field\r\n * Smart detection: number or field name\r\n *\r\n * @category Validation Rule\r\n */\r\n public max(max: number | string, errorMessage?: string) {\r\n return this.addRule(maxRule, errorMessage, { max, scope: \"global\" });\r\n }\r\n\r\n /**\r\n * Value must be >= sibling field value\r\n * @category Validation Rule\r\n */\r\n public minSibling(field: string, errorMessage?: string) {\r\n return this.addRule(minRule, errorMessage, { min: field, scope: \"sibling\" });\r\n }\r\n\r\n /**\r\n * Value must be <= sibling field value\r\n * @category Validation Rule\r\n */\r\n public maxSibling(field: string, errorMessage?: string) {\r\n return this.addRule(maxRule, errorMessage, { max: field, scope: \"sibling\" });\r\n }\r\n\r\n /**\r\n * Value must be strictly greater than the given number or field (>)\r\n * Smart detection: number or field name\r\n *\r\n * @category Validation Rule\r\n */\r\n public greaterThan(value: number | string, errorMessage?: string) {\r\n return this.addRule(greaterThanRule, errorMessage, {\r\n value,\r\n scope: \"global\",\r\n });\r\n }\r\n\r\n /**\r\n * Value must be strictly less than the given number or field (<)\r\n * Smart detection: number or field name\r\n *\r\n * @category Validation Rule\r\n */\r\n public lessThan(value: number | string, errorMessage?: string) {\r\n return this.addRule(lessThanRule, errorMessage, {\r\n value,\r\n scope: \"global\",\r\n });\r\n }\r\n\r\n /**\r\n * Alias for greaterThan() - shorter syntax\r\n * @category Validation Rule\r\n */\r\n public gt(value: number | string, errorMessage?: string) {\r\n return this.greaterThan(value, errorMessage);\r\n }\r\n\r\n /**\r\n * Alias for lessThan() - shorter syntax\r\n * @category Validation Rule\r\n */\r\n public lt(value: number | string, errorMessage?: string) {\r\n return this.lessThan(value, errorMessage);\r\n }\r\n\r\n /**\r\n * Value must be > sibling field value\r\n * @category Validation Rule\r\n */\r\n public greaterThanSibling(field: string, errorMessage?: string) {\r\n return this.addRule(greaterThanRule, errorMessage, {\r\n value: field,\r\n scope: \"sibling\",\r\n });\r\n }\r\n\r\n /**\r\n * Alias for greaterThanSibling() - shorter syntax\r\n * @category Validation Rule\r\n */\r\n public gtSibling(field: string, errorMessage?: string) {\r\n return this.greaterThanSibling(field, errorMessage);\r\n }\r\n\r\n /**\r\n * Value must be < sibling field value\r\n * @category Validation Rule\r\n */\r\n public lessThanSibling(field: string, errorMessage?: string) {\r\n return this.addRule(lessThanRule, errorMessage, {\r\n value: field,\r\n scope: \"sibling\",\r\n });\r\n }\r\n\r\n /**\r\n * Alias for lessThanSibling() - shorter syntax\r\n * @category Validation Rule\r\n */\r\n public ltSibling(field: string, errorMessage?: string) {\r\n return this.lessThanSibling(field, errorMessage);\r\n }\r\n\r\n /** Value must be a modulo of the given number */\r\n public modulo(value: number, errorMessage?: string) {\r\n return this.addRule(moduloRule, errorMessage, { value });\r\n }\r\n\r\n /**\r\n * Alias for modulo() - Value must be divisible by the given number\r\n */\r\n public divisibleBy(value: number, errorMessage?: string) {\r\n return this.modulo(value, errorMessage);\r\n }\r\n\r\n /**\r\n * Alias for modulo() - Value must be a multiple of the given number\r\n */\r\n public multipleOf(value: number, errorMessage?: string) {\r\n return this.modulo(value, errorMessage);\r\n }\r\n\r\n /**\r\n * Alias for modulo() - Value must be a multiple of the given number\r\n */\r\n public modulusOf(value: number, errorMessage?: string) {\r\n return this.modulo(value, errorMessage);\r\n }\r\n\r\n /** Accept only numbers higher than 0 */\r\n public positive(errorMessage?: string) {\r\n return this.addRule(positiveRule, errorMessage);\r\n }\r\n\r\n /** Accept only negative numbers */\r\n public negative(errorMessage?: string) {\r\n return this.addRule(negativeRule, errorMessage);\r\n }\r\n\r\n /** Accept only odd numbers */\r\n public odd(errorMessage?: string) {\r\n return this.addRule(oddRule, errorMessage);\r\n }\r\n\r\n /** Accept only even numbers */\r\n public even(errorMessage?: string) {\r\n return this.addRule(evenRule, errorMessage);\r\n }\r\n\r\n /**\r\n * Accept only numbers between the given two numbers or fields (Inclusive)\r\n * Smart detection: number or field name\r\n *\r\n * @category Validation Rule\r\n */\r\n public between(min: number | string, max: number | string, errorMessage?: string) {\r\n return this.addRule(betweenNumbersRule, errorMessage, {\r\n min,\r\n max,\r\n scope: \"global\",\r\n });\r\n }\r\n\r\n /**\r\n * Value must be between sibling field values\r\n * @category Validation Rule\r\n */\r\n public betweenSibling(minField: string, maxField: string, errorMessage?: string) {\r\n return this.addRule(betweenNumbersRule, errorMessage, {\r\n min: minField,\r\n max: maxField,\r\n scope: \"sibling\",\r\n });\r\n }\r\n\r\n // Enum and value membership methods are inherited from PrimitiveValidator.\r\n\r\n /**\r\n * Value (as a string) must be exactly this many characters.\r\n * Useful for fixed-format numeric codes (e.g. 4-digit PIN).\r\n */\r\n public length(length: number, errorMessage?: string) {\r\n return this.addRule(lengthRule, errorMessage, { length });\r\n }\r\n\r\n /** Value (as string representation) length must be ≥ min */\r\n public minLength(length: number, errorMessage?: string) {\r\n return this.addRule(minLengthRule, errorMessage, { minLength: length });\r\n }\r\n\r\n /** Value (as string representation) length must be ≤ max */\r\n public maxLength(length: number, errorMessage?: string) {\r\n return this.addRule(maxLengthRule, errorMessage, { maxLength: length });\r\n }\r\n\r\n // Mutators\r\n\r\n /**\r\n * Convert value to its absolute value\r\n */\r\n public abs() {\r\n return this.addMutator(absMutator);\r\n }\r\n\r\n /**\r\n * Round value up to the nearest integer\r\n */\r\n public ceil() {\r\n return this.addMutator(ceilMutator);\r\n }\r\n\r\n /**\r\n * Round value down to the nearest integer\r\n */\r\n public floor() {\r\n return this.addMutator(floorMutator);\r\n }\r\n\r\n /**\r\n * Round value to the nearest integer or specified decimals\r\n */\r\n public round(decimals = 0) {\r\n return this.addMutator(roundMutator, { decimals });\r\n }\r\n\r\n /**\r\n * Round to a fixed number of decimal places, keeping the value a **number**.\r\n *\r\n * `v.number().toFixed(2)` on `3.14159` yields `3.14`, not `\"3.14\"` — a number\r\n * schema has to output a number, or its own type rule rejects the result.\r\n * Format to a fixed-point *string* at the presentation edge instead.\r\n *\r\n * @example\r\n * v.number().toFixed(2) // 3.14159 → 3.14\r\n */\r\n public toFixed(decimals = 2) {\r\n return this.addMutator(toFixedMutator, { decimals });\r\n }\r\n\r\n /**\r\n * @inheritdoc\r\n *\r\n * Returns `{ type: \"number\" }` with numeric constraint keywords.\r\n * IntValidator overrides `type` to `\"integer\"`.\r\n *\r\n * @note Sibling-scoped rules (minSibling, maxSibling, etc.) are not representable\r\n * in JSON Schema and are silently omitted.\r\n *\r\n * @example\r\n * ```ts\r\n * v.number().min(0).max(100).toJsonSchema(\"draft-2020-12\")\r\n * // → { type: \"number\", minimum: 0, maximum: 100 }\r\n * ```\r\n */\r\n public override toJsonSchema(target: JsonSchemaTarget = \"draft-2020-12\"): JsonSchemaResult {\r\n return this.buildNumberJsonSchema(\"number\", target);\r\n }\r\n\r\n /**\r\n * Shared logic for number/integer JSON Schema generation.\r\n * Called by NumberValidator.toJsonSchema() (→ type: \"number\")\r\n * and IntValidator.toJsonSchema() (→ type: \"integer\").\r\n */\r\n protected buildNumberJsonSchema(\r\n type: \"number\" | \"integer\",\r\n target: JsonSchemaTarget,\r\n ): JsonSchemaResult {\r\n const schema: JsonSchemaResult = { type };\r\n\r\n // minimum (inclusive)\r\n const minOpts = getRuleOptions(this.rules, \"min\");\r\n if (minOpts?.min !== undefined && typeof minOpts.min === \"number\") {\r\n schema.minimum = minOpts.min;\r\n }\r\n\r\n // maximum (inclusive)\r\n const maxOpts = getRuleOptions(this.rules, \"max\");\r\n if (maxOpts?.max !== undefined && typeof maxOpts.max === \"number\") {\r\n schema.maximum = maxOpts.max;\r\n }\r\n\r\n // between (inclusive range)\r\n const betweenOpts = getRuleOptions(this.rules, \"betweenNumbers\");\r\n if (betweenOpts) {\r\n if (typeof betweenOpts.min === \"number\") schema.minimum = betweenOpts.min;\r\n if (typeof betweenOpts.max === \"number\") schema.maximum = betweenOpts.max;\r\n }\r\n\r\n // greaterThan (>) → exclusiveMinimum\r\n const gtOpts = getRuleOptions(this.rules, \"greaterThan\");\r\n if (gtOpts?.value !== undefined && typeof gtOpts.value === \"number\") {\r\n if (target === \"draft-07\") {\r\n schema.minimum = gtOpts.value;\r\n schema.exclusiveMinimum = true;\r\n } else {\r\n schema.exclusiveMinimum = gtOpts.value;\r\n }\r\n }\r\n\r\n // lessThan (<) → exclusiveMaximum\r\n const ltOpts = getRuleOptions(this.rules, \"lessThan\");\r\n if (ltOpts?.value !== undefined && typeof ltOpts.value === \"number\") {\r\n if (target === \"draft-07\") {\r\n schema.maximum = ltOpts.value;\r\n schema.exclusiveMaximum = true;\r\n } else {\r\n schema.exclusiveMaximum = ltOpts.value;\r\n }\r\n }\r\n\r\n // multipleOf / modulo\r\n const moduloOpts = getRuleOptions(this.rules, \"modulo\");\r\n if (moduloOpts?.value !== undefined && typeof moduloOpts.value === \"number\") {\r\n schema.multipleOf = moduloOpts.value;\r\n }\r\n\r\n // enum (from PrimitiveValidator.in / .enum)\r\n const inOpts = getRuleOptions(this.rules, \"in\");\r\n if (inOpts?.values && Array.isArray(inOpts.values)) {\r\n schema.enum = inOpts.values;\r\n }\r\n\r\n if (this.isNullable) applyNullable(schema, target);\r\n\r\n return schema;\r\n }\r\n}\r\n"],"mappings":";;;;;;;;;;;;;AAwBA,IAAa,kBAAb,cAAqC,mBAAmB;CACtD,AAAO,YAAY,cAAuB;EACxC,MAAM;EACN,KAAK,eAAe,YAAY,YAAY;CAC9C;;;;CAKA,AAAO,YAAY,OAAqB;EACtC,OAAO,OAAO,UAAU,YAAY,CAAC,MAAM,KAAK;CAClD;;;;;;;CAQA,AAAO,IAAI,KAAsB,cAAuB;EACtD,OAAO,KAAK,QAAQ,SAAS,cAAc;GAAE;GAAK,OAAO;EAAS,CAAC;CACrE;;;;;;;CAQA,AAAO,IAAI,KAAsB,cAAuB;EACtD,OAAO,KAAK,QAAQ,SAAS,cAAc;GAAE;GAAK,OAAO;EAAS,CAAC;CACrE;;;;;CAMA,AAAO,WAAW,OAAe,cAAuB;EACtD,OAAO,KAAK,QAAQ,SAAS,cAAc;GAAE,KAAK;GAAO,OAAO;EAAU,CAAC;CAC7E;;;;;CAMA,AAAO,WAAW,OAAe,cAAuB;EACtD,OAAO,KAAK,QAAQ,SAAS,cAAc;GAAE,KAAK;GAAO,O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utator, ceilMutator, floorMutator, roundMutator, toFixedMutator } from \"../mutators\";\r\nimport {\r\n betweenNumbersRule,\r\n evenRule,\r\n greaterThanRule,\r\n lengthRule,\r\n lessThanRule,\r\n maxLengthRule,\r\n maxRule,\r\n minLengthRule,\r\n minRule,\r\n moduloRule,\r\n negativeRule,\r\n numberRule,\r\n oddRule,\r\n positiveRule,\r\n} from \"../rules\";\r\nimport { PrimitiveValidator } from \"./primitive-validator\";\r\nimport { applyNullable, getRuleOptions } from \"../standard-schema/json-schema\";\r\nimport type { JsonSchemaResult, JsonSchemaTarget } from \"../standard-schema/json-schema\";\r\n\r\n/**\r\n * Number validator class - base for Int and Float validators\r\n */\r\nexport class NumberValidator extends PrimitiveValidator {\r\n public constructor(errorMessage?: string) {\r\n super();\r\n this.addMutableRule(numberRule, errorMessage);\r\n }\r\n\r\n /**\r\n * Check if value is a number type\r\n */\r\n public matchesType(value: any): boolean {\r\n return typeof value === \"number\" && !isNaN(value);\r\n }\r\n\r\n /**\r\n * Value must be equal or higher than the given number or field\r\n * Smart detection: number or field name\r\n *\r\n * @category Validation Rule\r\n */\r\n public min(min: number | string, errorMessage?: string) {\r\n return this.addRule(minRule, errorMessage, { min, scope: \"global\" });\r\n }\r\n\r\n /**\r\n * Value must be equal or less than the given number or field\r\n * Smart detection: number or field name\r\n *\r\n * @category Validation Rule\r\n */\r\n public max(max: number | string, errorMessage?: string) {\r\n return this.addRule(maxRule, errorMessage, { max, scope: \"global\" });\r\n }\r\n\r\n /**\r\n * Value must be >= sibling field value\r\n * @category Validation Rule\r\n */\r\n public minSibling(field: string, errorMessage?: string) {\r\n return this.addRule(minRule, errorMessage, { min: field, scope: \"sibling\" });\r\n }\r\n\r\n /**\r\n * Value must be <= sibling field value\r\n * @category Validation Rule\r\n */\r\n public maxSibling(field: string, errorMessage?: string) {\r\n return this.addRule(maxRule, errorMessage, { max: field, scope: \"sibling\" });\r\n }\r\n\r\n /**\r\n * Value must be strictly greater than the given number or field (>)\r\n * Smart detection: number or field name\r\n *\r\n * @category Validation Rule\r\n */\r\n public greaterThan(value: number | string, errorMessage?: string) {\r\n return this.addRule(greaterThanRule, errorMessage, {\r\n value,\r\n scope: \"global\",\r\n });\r\n }\r\n\r\n /**\r\n * Value must be strictly less than the given number or field (<)\r\n * Smart detection: number or field name\r\n *\r\n * @category Validation Rule\r\n */\r\n public lessThan(value: number | string, errorMessage?: string) {\r\n return this.addRule(lessThanRule, errorMessage, {\r\n value,\r\n scope: \"global\",\r\n });\r\n }\r\n\r\n /**\r\n * Alias for greaterThan() - shorter syntax\r\n * @category Validation Rule\r\n */\r\n public gt(value: number | string, errorMessage?: string) {\r\n return this.greaterThan(value, errorMessage);\r\n }\r\n\r\n /**\r\n * Alias for lessThan() - shorter syntax\r\n * @category Validation Rule\r\n */\r\n public lt(value: number | string, errorMessage?: string) {\r\n return this.lessThan(value, errorMessage);\r\n }\r\n\r\n /**\r\n * Value must be > sibling field value\r\n * @category Validation Rule\r\n */\r\n public greaterThanSibling(field: string, errorMessage?: string) {\r\n return this.addRule(greaterThanRule, errorMessage, {\r\n value: field,\r\n scope: \"sibling\",\r\n });\r\n }\r\n\r\n /**\r\n * Alias for greaterThanSibling() - shorter syntax\r\n * @category Validation Rule\r\n */\r\n public gtSibling(field: string, errorMessage?: string) {\r\n return this.greaterThanSibling(field, errorMessage);\r\n }\r\n\r\n /**\r\n * Value must be < sibling field value\r\n * @category Validation Rule\r\n */\r\n public lessThanSibling(field: string, errorMessage?: string) {\r\n return this.addRule(lessThanRule, errorMessage, {\r\n value: field,\r\n scope: \"sibling\",\r\n });\r\n }\r\n\r\n /**\r\n * Alias for lessThanSibling() - shorter syntax\r\n * @category Validation Rule\r\n */\r\n public ltSibling(field: string, errorMessage?: string) {\r\n return this.lessThanSibling(field, errorMessage);\r\n }\r\n\r\n /** Value must be a modulo of the given number */\r\n public modulo(value: number, errorMessage?: string) {\r\n return this.addRule(moduloRule, errorMessage, { value });\r\n }\r\n\r\n /**\r\n * Alias for modulo() - Value must be divisible by the given number\r\n */\r\n public divisibleBy(value: number, errorMessage?: string) {\r\n return this.modulo(value, errorMessage);\r\n }\r\n\r\n /**\r\n * Alias for modulo() - Value must be a multiple of the given number\r\n */\r\n public multipleOf(value: number, errorMessage?: string) {\r\n return this.modulo(value, errorMessage);\r\n }\r\n\r\n /**\r\n * Alias for modulo() - Value must be a multiple of the given number\r\n */\r\n public modulusOf(value: number, errorMessage?: string) {\r\n return this.modulo(value, errorMessage);\r\n }\r\n\r\n /** Accept only numbers higher than 0 */\r\n public positive(errorMessage?: string) {\r\n return this.addRule(positiveRule, errorMessage);\r\n }\r\n\r\n /** Accept only negative numbers */\r\n public negative(errorMessage?: string) {\r\n return this.addRule(negativeRule, errorMessage);\r\n }\r\n\r\n /** Accept only odd numbers */\r\n public odd(errorMessage?: string) {\r\n return this.addRule(oddRule, errorMessage);\r\n }\r\n\r\n /** Accept only even numbers */\r\n public even(errorMessage?: string) {\r\n return this.addRule(evenRule, errorMessage);\r\n }\r\n\r\n /**\r\n * Accept only numbers between the given two numbers or fields (Inclusive)\r\n * Smart detection: number or field name\r\n *\r\n * @category Validation Rule\r\n */\r\n public between(min: number | string, max: number | string, errorMessage?: string) {\r\n return this.addRule(betweenNumbersRule, errorMessage, {\r\n min,\r\n max,\r\n scope: \"global\",\r\n });\r\n }\r\n\r\n /**\r\n * Value must be between sibling field values\r\n * @category Validation Rule\r\n */\r\n public betweenSibling(minField: string, maxField: string, errorMessage?: string) {\r\n return this.addRule(betweenNumbersRule, errorMessage, {\r\n min: minField,\r\n max: maxField,\r\n scope: \"sibling\",\r\n });\r\n }\r\n\r\n // Enum and value membership methods are inherited from PrimitiveValidator.\r\n\r\n /**\r\n * Value (as a string) must be exactly this many characters.\r\n * Useful for fixed-format numeric codes (e.g. 4-digit PIN).\r\n */\r\n public length(length: number, errorMessage?: string) {\r\n return this.addRule(lengthRule, errorMessage, { length });\r\n }\r\n\r\n /** Value (as string representation) length must be ≥ min */\r\n public minLength(length: number, errorMessage?: string) {\r\n return this.addRule(minLengthRule, errorMessage, { minLength: length });\r\n }\r\n\r\n /** Value (as string representation) length must be ≤ max */\r\n public maxLength(length: number, errorMessage?: string) {\r\n return this.addRule(maxLengthRule, errorMessage, { maxLength: length });\r\n }\r\n\r\n // Mutators\r\n\r\n /**\r\n * Convert value to its absolute value\r\n */\r\n public abs() {\r\n return this.addMutator(absMutator);\r\n }\r\n\r\n /**\r\n * Round value up to the nearest integer\r\n */\r\n public ceil() {\r\n return this.addMutator(ceilMutator);\r\n }\r\n\r\n /**\r\n * Round value down to the nearest integer\r\n */\r\n public floor() {\r\n return this.addMutator(floorMutator);\r\n }\r\n\r\n /**\r\n * Round value to the nearest integer or specified decimals\r\n */\r\n public round(decimals = 0) {\r\n return this.addMutator(roundMutator, { decimals });\r\n }\r\n\r\n /**\r\n * Round to a fixed number of decimal places, keeping the value a **number**.\r\n *\r\n * `v.number().toFixed(2)` on `3.14159` yields `3.14`, not `\"3.14\"` — a number\r\n * schema has to output a number, or its own type rule rejects the result.\r\n * Format to a fixed-point *string* at the presentation edge instead.\r\n *\r\n * @example\r\n * v.number().toFixed(2) // 3.14159 → 3.14\r\n */\r\n public toFixed(decimals = 2) {\r\n return this.addMutator(toFixedMutator, { decimals });\r\n }\r\n\r\n /**\r\n * @inheritdoc\r\n *\r\n * Returns `{ type: \"number\" }` with numeric constraint keywords.\r\n * IntValidator overrides `type` to `\"integer\"`.\r\n *\r\n * @note Sibling-scoped rules (minSibling, maxSibling, etc.) are not representable\r\n * in JSON Schema and are silently omitted.\r\n *\r\n * @example\r\n * ```ts\r\n * v.number().min(0).max(100).toJsonSchema(\"draft-2020-12\")\r\n * // → { type: \"number\", minimum: 0, maximum: 100 }\r\n * ```\r\n */\r\n public override toJsonSchema(target: JsonSchemaTarget = \"draft-2020-12\"): JsonSchemaResult {\r\n return this.buildNumberJsonSchema(\"number\", target);\r\n }\r\n\r\n /**\r\n * Shared logic for number/integer JSON Schema generation.\r\n * Called by NumberValidator.toJsonSchema() (→ type: \"number\")\r\n * and IntValidator.toJsonSchema() (→ type: \"integer\").\r\n */\r\n protected buildNumberJsonSchema(\r\n type: \"number\" | \"integer\",\r\n target: JsonSchemaTarget,\r\n ): JsonSchemaResult {\r\n const schema: JsonSchemaResult = { type };\r\n\r\n // minimum (inclusive)\r\n const minOpts = getRuleOptions(this.rules, \"min\");\r\n if (minOpts?.min !== undefined && typeof minOpts.min === \"number\") {\r\n schema.minimum = minOpts.min;\r\n }\r\n\r\n // maximum (inclusive)\r\n const maxOpts = getRuleOptions(this.rules, \"max\");\r\n if (maxOpts?.max !== undefined && typeof maxOpts.max === \"number\") {\r\n schema.maximum = maxOpts.max;\r\n }\r\n\r\n // between (inclusive range)\r\n const betweenOpts = getRuleOptions(this.rules, \"betweenNumbers\");\r\n if (betweenOpts) {\r\n if (typeof betweenOpts.min === \"number\") schema.minimum = betweenOpts.min;\r\n if (typeof betweenOpts.max === \"number\") schema.maximum = betweenOpts.max;\r\n }\r\n\r\n // greaterThan (>) → exclusiveMinimum\r\n const gtOpts = getRuleOptions(this.rules, \"greaterThan\");\r\n if (gtOpts?.value !== undefined && typeof gtOpts.value === \"number\") {\r\n if (target === \"draft-07\") {\r\n schema.minimum = gtOpts.value;\r\n schema.exclusiveMinimum = true;\r\n } else {\r\n schema.exclusiveMinimum = gtOpts.value;\r\n }\r\n }\r\n\r\n // lessThan (<) → exclusiveMaximum\r\n const ltOpts = getRuleOptions(this.rules, \"lessThan\");\r\n if (ltOpts?.value !== undefined && typeof ltOpts.value === \"number\") {\r\n if (target === \"draft-07\") {\r\n schema.maximum = ltOpts.value;\r\n schema.exclusiveMaximum = true;\r\n } else {\r\n schema.exclusiveMaximum = ltOpts.value;\r\n }\r\n }\r\n\r\n // multipleOf / modulo\r\n const moduloOpts = getRuleOptions(this.rules, \"modulo\");\r\n if (moduloOpts?.value !== undefined && typeof moduloOpts.value === \"number\") {\r\n schema.multipleOf = moduloOpts.value;\r\n }\r\n\r\n // enum (from PrimitiveValidator.in / .enum)\r\n const inOpts = getRuleOptions(this.rules, \"in\");\r\n if (inOpts?.values && Array.isArray(inOpts.values)) {\r\n schema.enum = inOpts.values;\r\n }\r\n\r\n if (this.isNullable) applyNullable(schema, target);\r\n\r\n return schema;\r\n }\r\n}\r\n"],"mappings":";;;;;;;;;;;;;AAwBA,IAAa,kBAAb,cAAqC,mBAAmB;CACtD,AAAO,YAAY,cAAuB;EACxC,MAAM;EACN,KAAK,eAAe,YAAY,YAAY;CAC9C;;;;CAKA,AAAO,YAAY,OAAqB;EACtC,OAAO,OAAO,UAAU,YAAY,CAAC,MAAM,KAAK;CAClD;;;;;;;CAQA,AAAO,IAAI,KAAsB,cAAuB;EACtD,OAAO,KAAK,QAAQ,SAAS,cAAc;GAAE;GAAK,OAAO;EAAS,CAAC;CACrE;;;;;;;CAQA,AAAO,IAAI,KAAsB,cAAuB;EACtD,OAAO,KAAK,QAAQ,SAAS,cAAc;GAAE;GAAK,OAAO;EAAS,CAAC;CACrE;;;;;CAMA,AAAO,WAAW,OAAe,cAAuB;EACtD,OAAO,KAAK,QAAQ,SAAS,cAAc;GAAE,KAAK;GAAO,OAAO;EAAU,CAAC;CAC7E;;;;;CAMA,AAAO,WAAW,OAAe,cAAuB;EACtD,OAAO,KAAK,QAAQ,SAAS,cAAc;GAAE,KAAK;GAAO,OAAO;EAAU,CAAC;CAC7E;;;;;;;CAQA,AAAO,YAAY,OAAwB,cAAuB;EAChE,OAAO,KAAK,QAAQ,iBAAiB,cAAc;GACjD;GACA,OAAO;EACT,CAAC;CACH;;;;;;;CAQA,AAAO,SAAS,OAAwB,cAAuB;EAC7D,OAAO,KAAK,QAAQ,cAAc,cAAc;GAC9C;GACA,OAAO;EACT,CAAC;CACH;;;;;CAMA,AAAO,GAAG,OAAwB,cAAuB;EACvD,OAAO,KAAK,YAAY,OAAO,YAAY;CAC7C;;;;;CAMA,AAAO,GAAG,OAAwB,cAAuB;EACvD,OAAO,KAAK,SAAS,OAAO,YAAY;C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AI,OAAO,YAAY,QAAQ,UAAU,OAAO,UAAU,YAAY;EACxE;EAGA,MAAM,SAAS,eAAe,KAAK,OAAO,aAAa;EACvD,IAAI,QAAQ,UAAU,UAAa,OAAO,OAAO,UAAU,UACzD,IAAI,WAAW,YAAY;GACzB,OAAO,UAAU,OAAO;GACxB,OAAO,mBAAmB;EAC5B,OACE,OAAO,mBAAmB,OAAO;EAKrC,MAAM,SAAS,eAAe,KAAK,OAAO,UAAU;EACpD,IAAI,QAAQ,UAAU,UAAa,OAAO,OAAO,UAAU,UACzD,IAAI,WAAW,YAAY;GACzB,OAAO,UAAU,OAAO;GACxB,OAAO,mBAAmB;EAC5B,OACE,OAAO,mBAAmB,OAAO;EAKrC,MAAM,aAAa,eAAe,KAAK,OAAO,QAAQ;EACtD,IAAI,YAAY,UAAU,UAAa,OAAO,WAAW,UAAU,UACjE,OAAO,aAAa,WAAW;EAIjC,MAAM,SAAS,eAAe,KAAK,OAAO,IAAI;EAC9C,IAAI,QAAQ,UAAU,MAAM,QAAQ,OAAO,MAAM,GAC/C,OAAO,OAAO,OAAO;EAGvB,IAAI,KAAK,YAAY,cAAc,QAAQ,MAAM;EAEjD,OAAO;CACT;AACF"}
@@ -1,6 +1,6 @@
1
1
  import { NumberValidator } from "./number-validator.mjs";
2
2
 
3
- //#region seal/src/validators/numeric-validator.d.ts
3
+ //#region ../seal/src/validators/numeric-validator.d.ts
4
4
  /**
5
5
  * Numeric validator class - base for Int and Float validators either as number or string
6
6
  */
@@ -1 +1 @@
1
- {"version":3,"file":"numeric-validator.d.mts","names":[],"sources":["C:/Work/Warlock.js/seal/src/validators/numeric-validator.ts"],"mappings":";;;;;AAOA;cAAa,gBAAA,SAAyB,eAAe;;;;cAIhC,YAAA;EAAA;;;EAQZ,WAAA,CAAY,KAAA;AAAA"}
1
+ {"version":3,"file":"numeric-validator.d.mts","names":[],"sources":["../../../../../../../seal/src/validators/numeric-validator.ts"],"mappings":";;;;;AAOA;cAAa,gBAAA,SAAyB,eAAe;;;;cAIhC,YAAA;EAAA;;;EAQZ,WAAA,CAAY,KAAA;AAAA"}
@@ -2,7 +2,7 @@ import { numericMutator } from "../mutators/number-mutators.mjs";
2
2
  import { NumberValidator } from "./number-validator.mjs";
3
3
  import { isNumeric } from "@mongez/supportive-is";
4
4
 
5
- //#region seal/src/validators/numeric-validator.ts
5
+ //#region ../seal/src/validators/numeric-validator.ts
6
6
  /**
7
7
  * Numeric validator class - base for Int and Float validators either as number or string
8
8
  */
@@ -1 +1 @@
1
- {"version":3,"file":"numeric-validator.mjs","names":[],"sources":["C:/Work/Warlock.js/seal/src/validators/numeric-validator.ts"],"sourcesContent":["import { isNumeric } from \"@mongez/supportive-is\";\r\nimport { numericMutator } from \"../mutators/number-mutators\";\r\nimport { NumberValidator } from \"./number-validator\";\r\n\r\n/**\r\n * Numeric validator class - base for Int and Float validators either as number or string\r\n */\r\nexport class NumericValidator extends NumberValidator {\r\n /**\r\n * Constructor\r\n */\r\n public constructor(errorMessage?: string) {\r\n super(errorMessage);\r\n this.addMutableMutator(numericMutator);\r\n }\r\n\r\n /**\r\n * Check if value is a numeric type\r\n */\r\n public matchesType(value: any): boolean {\r\n return isNumeric(value);\r\n }\r\n}\r\n"],"mappings":";;;;;;;;AAOA,IAAa,mBAAb,cAAsC,gBAAgB;;;;CAIpD,AAAO,YAAY,cAAuB;EACxC,MAAM,YAAY;EAClB,KAAK,kBAAkB,cAAc;CACvC;;;;CAKA,AAAO,YAAY,OAAqB;EACtC,OAAO,UAAU,KAAK;CACxB;AACF"}
1
+ {"version":3,"file":"numeric-validator.mjs","names":[],"sources":["../../../../../../../seal/src/validators/numeric-validator.ts"],"sourcesContent":["import { isNumeric } from \"@mongez/supportive-is\";\r\nimport { numericMutator } from \"../mutators/number-mutators\";\r\nimport { NumberValidator } from \"./number-validator\";\r\n\r\n/**\r\n * Numeric validator class - base for Int and Float validators either as number or string\r\n */\r\nexport class NumericValidator extends NumberValidator {\r\n /**\r\n * Constructor\r\n */\r\n public constructor(errorMessage?: string) {\r\n super(errorMessage);\r\n this.addMutableMutator(numericMutator);\r\n }\r\n\r\n /**\r\n * Check if value is a numeric type\r\n */\r\n public matchesType(value: any): boolean {\r\n return isNumeric(value);\r\n }\r\n}\r\n"],"mappings":";;;;;;;;AAOA,IAAa,mBAAb,cAAsC,gBAAgB;;;;CAIpD,AAAO,YAAY,cAAuB;EACxC,MAAM,YAAY;EAClB,KAAK,kBAAkB,cAAc;CACvC;;;;CAKA,AAAO,YAAY,OAAqB;EACtC,OAAO,UAAU,KAAK;CACxB;AACF"}
@@ -5,7 +5,7 @@ import { ValidationResult } from "../types/result-types.mjs";
5
5
  import { InferInputObjectShape, InferOutputObjectShape } from "../types/inference-types.mjs";
6
6
  import { BaseValidator } from "./base-validator.mjs";
7
7
 
8
- //#region seal/src/validators/object-validator.d.ts
8
+ //#region ../seal/src/validators/object-validator.d.ts
9
9
  /**
10
10
  * Object validator class with generic schema type for proper type inference.
11
11
  *
@@ -1 +1 @@
1
- {"version":3,"file":"object-validator.d.mts","names":[],"sources":["C:/Work/Warlock.js/seal/src/validators/object-validator.ts"],"mappings":";;;;;;;;;;;;AA+BA;;;;;;;;;;;;cAAa,eAAA,iBAAgC,MAAA,GAAS,MAAA,UAAgB,aAAA,CACpE,qBAAA,CAAsB,OAAA,GACtB,sBAAA,CAAuB,OAAA;EAOd,MAAA,EAAQ,OAAA;EAAA,UALP,kBAAA;EAAA,UACA,WAAA;EAAA,UACA,iBAAA;cAGD,MAAA,EAAQ,OAAA,EACf,YAAA;EAyK0B;;;EAhKrB,WAAA,CAAY,KAAA;EAkKU;EA7JtB,YAAA,CAAA;EAyNqB;EA/MrB,KAAA,CAAA,GAAS,IAAA;EA+MyD;EAxMlE,IAAA,CAAK,SAAA;EAwMwD;;;EAhM7D,YAAA,CAAa,KAAA;EAqOkB;;;;;;;;;;;;;EAlNtB,KAAA,CAAM,IAAA;EApE8C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;UAgIH,mBAAA;;;;UAOA,iBAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA+CQ,YAAA,CAAa,MAAA,GAAQ,gBAAA,GAAqC,gBAAA;AAAA"}
@@ -11,7 +11,7 @@ import { ComputedValidator } from "./computed-validator.mjs";
11
11
  import { except } from "@mongez/reinforcements";
12
12
  import { isPlainObject } from "@mongez/supportive-is";
13
13
 
14
- //#region seal/src/validators/object-validator.ts
14
+ //#region ../seal/src/validators/object-validator.ts
15
15
  /**
16
16
  * Object validator class with generic schema type for proper type inference.
17
17
  *
@@ -1 +1 @@
1
- {"version":3,"file":"object-validator.mjs","names":[],"sources":["C:/Work/Warlock.js/seal/src/validators/object-validator.ts"],"sourcesContent":["import { except } from \"@mongez/reinforcements\";\nimport { isPlainObject } from \"@mongez/supportive-is\";\nimport { setKeyPath } from \"../helpers\";\nimport { objectTrimMutator, stripUnknownMutator } from \"../mutators\";\nimport { objectRule, unknownKeyRule } from \"../rules\";\nimport type { JsonSchemaResult, JsonSchemaTarget } from \"../standard-schema/json-schema\";\nimport { applyNullable, wrapNullableStrict } from \"../standard-schema/json-schema\";\nimport type { Schema, SchemaContext, ValidationResult } from \"../types\";\nimport type {\n InferInputObjectShape,\n InferOutputObjectShape,\n} from \"../types/inference-types\";\nimport { BaseValidator } from \"./base-validator\";\nimport { ComputedValidator } from \"./computed-validator\";\n\n/**\n * Object validator class with generic schema type for proper type inference.\n *\n * Threads two distinct inferred shapes into `BaseValidator`'s `TInput`/`TOutput`:\n *\n * - `TInput` = `InferInputObjectShape<TSchema>` — what `~standard.validate()`\n * accepts (caller's pre-validation payload; defaults/catches make\n * keys optional)\n * - `TOutput` = `InferOutputObjectShape<TSchema>` — what `~standard.validate()`\n * returns on success (post-default, post-catch shape; guaranteed\n * keys are required)\n *\n * Both helpers are used directly (not the full `Infer.*` walker) to avoid a\n * recursive class-base evaluation that would otherwise occur when the\n * brand-aware widening tries to inspect the class type.\n */\nexport class ObjectValidator<TSchema extends Schema = Schema> extends BaseValidator<\n InferInputObjectShape<TSchema>,\n InferOutputObjectShape<TSchema>\n> {\n protected shouldAllowUnknown = false;\n protected allowedKeys: string[] = [];\n protected hasUnknownKeyRule = false;\n\n public constructor(\n public schema: TSchema,\n errorMessage?: string,\n ) {\n super();\n this.addMutableRule(objectRule, errorMessage);\n }\n\n /**\n * Check if value is an object type (plain object, not array or date)\n */\n public matchesType(value: any): boolean {\n return isPlainObject(value);\n }\n\n /** Strip unknown keys from the data */\n public stripUnknown() {\n const validator = this.instance;\n return validator.addMutator(stripUnknownMutator, {\n get allowedKeys() {\n return validator.allowedKeys;\n },\n });\n }\n\n /** Add list of allowed keys that could be in the data but not necessarily validated */\n public allow(...keys: string[]) {\n const validator = this.instance;\n validator.allowedKeys.push(...keys);\n return validator;\n }\n\n /** Trim values of the object properties */\n public trim(recursive = true) {\n const validator = this.instance;\n return validator.addMutator(objectTrimMutator, { recursive });\n }\n\n /** Whether to allow unknown properties\n * Please note it will allow only unknown direct children keys, not nested children keys\n */\n public allowUnknown(allow = true) {\n const validator = this.instance;\n validator.shouldAllowUnknown = allow;\n return validator;\n }\n\n /**\n * Create a copy of this object validator with the same configuration\n * Copies schema, rules, mutators, transformers, and object-specific settings\n *\n * @returns A new ObjectValidator instance with copied configuration\n *\n * @example\n * ```ts\n * const baseUser = v.object({ name: v.string() }).allowUnknown();\n * const userCopy = baseUser.clone();\n * // userCopy has the same schema and allowUnknown setting\n * ```\n */\n public override clone(keys?: string[]): this {\n // Get cloned instance with all BaseValidator properties\n const cloned = super.clone();\n\n // Clone schema with deep copy of validators\n const newSchema = {} as TSchema;\n for (const key in this.schema) {\n if (keys && !keys.includes(key)) continue;\n (newSchema as any)[key] = this.schema[key].clone();\n }\n\n cloned.schema = newSchema;\n\n // Add ObjectValidator-specific properties\n cloned.shouldAllowUnknown = this.shouldAllowUnknown;\n cloned.allowedKeys = [...this.allowedKeys];\n // NOTE: hasUnknownKeyRule is intentionally NOT copied.\n // Each clone must add its own unknownKeyRule on first validate()\n // so it holds references to its own schema/allowedKeys, not the original's.\n\n return cloned;\n }\n\n /**\n * Extend this schema with additional fields\n * Clones the current validator and adds new fields to the schema\n * **Keeps original configuration** (allowUnknown, stripUnknown, etc.)\n *\n * If an ObjectValidator is provided, only its schema is used - its configuration is ignored.\n * This is useful for creating reusable field collections that can be added to different schemas.\n *\n * @param schemaOrValidator - Plain schema object or ObjectValidator to extend with\n * @returns A new ObjectValidator with merged schema and original configuration\n *\n * @example\n * ```ts\n * // Extend with plain schema\n * const baseUser = v.object({\n * name: v.string().required(),\n * email: v.string().email().required()\n * }).allowUnknown();\n *\n * const adminUser = baseUser.extend({\n * role: v.string().in(['admin', 'superadmin']).required()\n * });\n * // adminUser has: name, email, role\n * // adminUser keeps: allowUnknown() from base ✅\n *\n * // Extend with ObjectValidator (only schema is used)\n * const auditFields = v.object({\n * createdAt: v.date().required(),\n * updatedAt: v.date().required()\n * }).stripUnknown(); // This config is ignored!\n *\n * const fullUser = baseUser.extend(auditFields);\n * // fullUser has: name, email, createdAt, updatedAt\n * // fullUser keeps: allowUnknown() from base (NOT stripUnknown from auditFields) ✅\n *\n * // Chain multiple extends\n * const complexSchema = baseUser\n * .extend(auditFields)\n * .extend({ metadata: v.object({}) });\n * ```\n */\n public extend<TExtension extends Schema>(\n schemaOrValidator: TExtension | ObjectValidator<TExtension>,\n ): ObjectValidator<TSchema & TExtension> {\n // Clone current validator to preserve original\n const extended = this.clone() as any;\n\n // Extract schema from parameter\n const schemaToAdd =\n schemaOrValidator instanceof ObjectValidator ? schemaOrValidator.schema : schemaOrValidator;\n\n // Merge schemas with cloned validators (later fields override earlier ones)\n for (const key in schemaToAdd) {\n extended.schema[key] = schemaToAdd[key].clone();\n }\n\n return extended as ObjectValidator<TSchema & TExtension>;\n }\n\n /**\n * Merge with another ObjectValidator\n * Clones current validator, merges schemas, and **overrides configuration** with other validator's config\n *\n * Unlike extend(), merge() combines both schemas AND configurations.\n * The other validator's configuration (allowUnknown, stripUnknown, etc.) takes precedence.\n *\n * @param validator - Another ObjectValidator to merge with\n * @returns A new ObjectValidator with merged schema and configuration\n *\n * @example\n * ```ts\n * const baseUser = v.object({\n * name: v.string().required()\n * }).allowUnknown();\n *\n * const timestamps = v.object({\n * createdAt: v.date().required(),\n * updatedAt: v.date().required()\n * }).stripUnknown();\n *\n * const merged = baseUser.merge(timestamps);\n * // merged has: name, createdAt, updatedAt\n * // merged config: stripUnknown() from timestamps (overrides allowUnknown) ✅\n *\n * // Chain multiple merges\n * const full = baseUser.merge(timestamps).merge(softDeleteSchema);\n * ```\n */\n public merge<TMerge extends Schema>(\n validator: ObjectValidator<TMerge>,\n ): ObjectValidator<TSchema & TMerge> {\n // Clone current validator\n const merged = this.clone() as any;\n\n // Merge schemas with cloned validators (later fields override earlier ones)\n for (const key in validator.schema) {\n merged.schema[key] = validator.schema[key].clone();\n }\n\n // Override configuration with other validator's config\n merged.shouldAllowUnknown = validator.shouldAllowUnknown;\n merged.allowedKeys = [...merged.allowedKeys, ...validator.allowedKeys];\n\n // Append rules, mutators, transformers from other validator\n merged.rules.push(...validator.rules);\n merged.mutators.push(...validator.mutators);\n merged.dataTransformers.push(...validator.dataTransformers);\n\n // Merge attributes text (later wins)\n merged.attributesText = {\n ...merged.attributesText,\n ...validator.attributesText,\n };\n\n merged.translatedAttributes = {\n ...merged.translatedAttributes,\n ...validator.translatedAttributes,\n };\n\n return merged as ObjectValidator<TSchema & TMerge>;\n }\n\n /**\n * Create a new schema with only the specified fields\n * Clones the current validator and keeps only the selected fields\n * **Preserves all configuration** (allowUnknown, stripUnknown, etc.)\n *\n * @param keys - Field names to keep in the schema\n * @returns A new ObjectValidator with only the picked fields\n *\n * @example\n * ```ts\n * const fullUser = v.object({\n * id: v.int().required(),\n * name: v.string().required(),\n * email: v.string().email().required(),\n * password: v.string().required(),\n * role: v.string()\n * }).allowUnknown();\n *\n * // For login - only need email and password\n * const loginSchema = fullUser.pick('email', 'password');\n * // loginSchema has: { email, password }\n * // loginSchema keeps: allowUnknown() ✅\n *\n * // For public profile\n * const publicSchema = fullUser.pick('id', 'name', 'role');\n * // publicSchema has: { id, name, role }\n * ```\n */\n public pick<K extends keyof TSchema>(...keys: K[]): ObjectValidator<Pick<TSchema, K>> {\n // Clone current validator\n const picked = this.clone() as any;\n\n // Create new schema with only picked keys\n const newSchema = {} as Pick<TSchema, K>;\n for (const key of keys) {\n if (key in picked.schema) {\n (newSchema as any)[key] = picked.schema[key];\n }\n }\n\n picked.schema = newSchema;\n\n return picked as ObjectValidator<Pick<TSchema, K>>;\n }\n\n /**\n * Mark all or the given schema fields as optional\n */\n public partial<K extends keyof TSchema>(...keys: K[]) {\n const validationSchema = this.clone();\n\n if (keys.length === 0) {\n keys = Object.keys(validationSchema.schema) as K[];\n }\n\n for (const key of keys) {\n validationSchema.schema[key] = validationSchema.schema[key].optional();\n }\n\n return validationSchema;\n }\n\n /**\n * Make the all or the given fields as required\n */\n public requiredFields<K extends keyof TSchema>(...keys: K[]) {\n const validationSchema = this.clone();\n\n if (keys.length === 0) {\n keys = Object.keys(validationSchema.schema) as K[];\n }\n\n for (const key of keys) {\n validationSchema.schema[key] = validationSchema.schema[key].required();\n }\n\n return validationSchema;\n }\n\n /**\n * Create a new schema excluding the specified fields\n * Clones the current validator and removes the specified fields\n * **Preserves all configuration** (allowUnknown, stripUnknown, etc.)\n *\n * @param keys - Field names to exclude from the schema\n * @returns A new ObjectValidator without the excluded fields\n *\n * @example\n * ```ts\n * const fullUser = v.object({\n * id: v.int().required(),\n * name: v.string().required(),\n * email: v.string().email().required(),\n * password: v.string().required(),\n * role: v.string()\n * }).allowUnknown();\n *\n * // For updates - exclude id\n * const updateSchema = fullUser.without('id');\n * // updateSchema has: { name, email, password, role }\n * // updateSchema keeps: allowUnknown() ✅\n *\n * // For public API - exclude sensitive fields\n * const publicSchema = fullUser.without('password', 'role');\n * // publicSchema has: { id, name, email }\n *\n * // Combine with other methods\n * const patchSchema = fullUser.without('id', 'password');\n * // patchSchema has: { name, email, role }\n * ```\n */\n public without<K extends keyof TSchema>(...keys: K[]): ObjectValidator<Omit<TSchema, K>> {\n // Clone current validator\n const filtered = this.clone() as any;\n\n // Create new schema excluding specified keys\n const newSchema = {} as Omit<TSchema, K>;\n for (const key in filtered.schema) {\n if (!keys.includes(key as any)) {\n (newSchema as any)[key] = filtered.schema[key];\n }\n }\n\n filtered.schema = newSchema;\n\n return filtered as ObjectValidator<Omit<TSchema, K>>;\n }\n\n /** Mutate the data */\n public mutate(data: any, context: SchemaContext) {\n if (!isPlainObject(data)) return data;\n return super.mutate({ ...data }, context);\n }\n\n /** Validate the data */\n public async validate(\n data: any,\n context: SchemaContext = { path: \"\" } as SchemaContext,\n ): Promise<ValidationResult> {\n context.schema = this.schema;\n const mutatedData = await this.mutate(data, context);\n\n // Check for unknown properties\n if (this.shouldAllowUnknown === false && !this.hasUnknownKeyRule) {\n this.hasUnknownKeyRule = true;\n const rule = this.addMutableRule(unknownKeyRule, undefined, {\n allowedKeys: this.allowedKeys,\n schema: this.schema,\n });\n\n this.setRuleAttributesList(rule);\n }\n\n const result = await super.validate(mutatedData, context);\n\n if (result.isValid === false) return result;\n if (data === undefined) return result;\n\n // ═══════════════════════════════════════════════════════════\n // PHASE 1: Validate user input fields (skip computed/managed)\n // ═══════════════════════════════════════════════════════════\n const errors: ValidationResult[\"errors\"] = [];\n const validatedData: any = {};\n\n const userInputKeys = Object.keys(this.schema).filter(\n (key) => !this.isComputedValidator(this.schema[key]),\n );\n\n const validationPromises = userInputKeys.map(async (key) => {\n const validator = this.schema[key];\n const value =\n mutatedData?.[key] !== undefined ? mutatedData[key] : validator.getDefaultValue();\n\n const childContext: SchemaContext = {\n ...context,\n parent: mutatedData,\n value,\n key,\n path: setKeyPath(context.path, key),\n };\n\n const childResult = await validator.validate(value, childContext);\n\n // Only include in validated data if not omitted\n if (childResult.data !== undefined && !validator.isOmitted()) {\n validatedData[key] = childResult.data;\n }\n\n if (childResult.isValid === false) {\n errors.push(...childResult.errors);\n }\n });\n\n await Promise.all(validationPromises);\n\n // If Phase 1 failed, return early\n if (errors.length > 0) {\n return {\n isValid: false,\n errors,\n data: undefined,\n };\n }\n\n // ═══════════════════════════════════════════════════════════\n // PHASE 2: Execute computed/managed fields with validated data\n // ═══════════════════════════════════════════════════════════\n const computedFields = this.getComputedFields();\n\n const computedPromises = Object.keys(computedFields).map(async (key) => {\n const validator = computedFields[key];\n\n const childContext: SchemaContext = {\n ...context,\n parent: validatedData,\n value: undefined, // Computed fields don't have input value\n };\n\n // Execute computed callback with validated data\n const childResult = await validator.validate(validatedData, childContext);\n\n // Only include in final data if not omitted\n if (childResult.data !== undefined && !validator.isOmitted()) {\n validatedData[key] = childResult.data;\n }\n\n if (childResult.isValid === false) {\n errors.push(...childResult.errors);\n }\n });\n\n await Promise.all(computedPromises);\n\n // If Phase 2 failed, return early\n if (errors.length > 0) {\n return {\n isValid: false,\n errors,\n data: undefined,\n };\n }\n\n // Remove undefined values\n const cleanedData = removeUndefinedValues(validatedData);\n\n const transformedData = await this.startTransformationPipeline(cleanedData, context);\n\n const output =\n this.shouldAllowUnknown === false\n ? transformedData\n : {\n ...transformedData,\n ...except(mutatedData, Object.keys(this.schema)),\n };\n\n return {\n isValid: true,\n errors: [],\n data: output,\n };\n }\n\n /**\n * Check if a validator is a computed or managed field\n * ManagedValidator extends ComputedValidator, so instanceof catches both\n */\n private isComputedValidator(validator: BaseValidator): boolean {\n return validator instanceof ComputedValidator;\n }\n\n /**\n * Get all computed/managed fields from the schema\n */\n private getComputedFields(): Record<string, ComputedValidator> {\n const computed: Record<string, any> = {};\n\n for (const [key, validator] of Object.entries(this.schema)) {\n if (validator instanceof ComputedValidator) {\n computed[key] = validator;\n }\n }\n\n return computed;\n }\n\n /**\n * @inheritdoc\n *\n * Recursively generates JSON Schema for all input fields in the schema.\n * Computed/managed fields are skipped — they have no input representation.\n *\n * **Standard targets** (`draft-2020-12`, `draft-07`, `openapi-3.0`):\n * - Fields marked `.optional()` are excluded from `required`.\n *\n * **`openai-strict` target** (OpenAI Structured Outputs):\n * - ALL fields appear in `required` — OpenAI rejects schemas with optional fields.\n * - Optional fields are instead expressed as nullable types:\n * `{ type: [\"string\", \"null\"] }` so the model can output `null` for them.\n * - Recursively applies `openai-strict` to all nested objects.\n *\n * @example\n * ```ts\n * v.object({\n * name: v.string().required(),\n * age: v.int().optional(),\n * }).toJsonSchema(\"draft-2020-12\")\n * // → { type: \"object\",\n * // properties: { name: { type: \"string\" }, age: { type: \"integer\" } },\n * // required: [\"name\"], additionalProperties: false }\n *\n * v.object({\n * name: v.string().required(),\n * age: v.int().optional(),\n * }).toJsonSchema(\"openai-strict\")\n * // → { type: \"object\",\n * // properties: { name: { type: \"string\" }, age: { type: [\"integer\", \"null\"] } },\n * // required: [\"name\", \"age\"], ← all fields\n * // additionalProperties: false }\n * ```\n */\n public override toJsonSchema(target: JsonSchemaTarget = \"draft-2020-12\"): JsonSchemaResult {\n const properties: Record<string, JsonSchemaResult> = {};\n const required: string[] = [];\n const isOpenAIStrict = target === \"openai-strict\";\n\n for (const [key, validator] of Object.entries(this.schema)) {\n // Skip computed/managed — runtime-only, no input schema\n if (validator instanceof ComputedValidator) continue;\n\n let fieldSchema = validator.toJsonSchema(target);\n\n if (isOpenAIStrict) {\n // OpenAI strict: every field must be in required.\n // Optional fields are expressed as nullable rather than absent.\n if (validator.isOptional) {\n fieldSchema = wrapNullableStrict(fieldSchema);\n }\n required.push(key);\n } else {\n // Standard JSON Schema: only non-optional fields go in required\n if (!validator.isOptional) {\n required.push(key);\n }\n }\n\n properties[key] = fieldSchema;\n }\n\n const schema: JsonSchemaResult = { type: \"object\", properties };\n\n if (required.length > 0) schema.required = required;\n if (!this.shouldAllowUnknown) schema.additionalProperties = false;\n if (this.isNullable) applyNullable(schema, target);\n\n return schema;\n }\n}\n\n/** Recursively remove undefined values from an object */\nfunction removeUndefinedValues(obj: any, visited = new WeakMap<object, any>()): any {\n // Handle primitives and null\n if (obj === null) {\n return obj;\n }\n\n // Handle arrays\n if (Array.isArray(obj)) {\n return obj.map((item) => removeUndefinedValues(item, visited));\n }\n\n // Skip non-plain objects (class instances, Dates, Buffers, etc.)\n if (!isPlainObject(obj)) {\n return obj;\n }\n\n // Handle circular references - return already processed result\n if (visited.has(obj)) {\n return visited.get(obj);\n }\n\n // Process plain objects\n const result: any = {};\n visited.set(obj, result); // Mark as processing BEFORE recursion\n\n for (const [key, value] of Object.entries(obj)) {\n if (value !== undefined) {\n result[key] = removeUndefinedValues(value, visited);\n }\n }\n\n return result;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BA,IAAa,kBAAb,MAAa,wBAAyD,cAGpE;CAKA,AAAO,YACL,AAAO,QACP,cACA;EACA,MAAM;EAHC;4BALsB;qBACG,CAAC;2BACL;EAO5B,KAAK,eAAe,YAAY,YAAY;CAC9C;;;;CAKA,AAAO,YAAY,OAAqB;EACtC,OAAO,cAAc,KAAK;CAC5B;;CAGA,AAAO,eAAe;EACpB,MAAM,YAAY,KAAK;EACvB,OAAO,UAAU,WAAW,qBAAqB,EAC/C,IAAI,cAAc;GAChB,OAAO,UAAU;EACnB,EACF,CAAC;CACH;;CAGA,AAAO,MAAM,GAAG,MAAgB;EAC9B,MAAM,YAAY,KAAK;EACvB,UAAU,YAAY,KAAK,GAAG,IAAI;EAClC,OAAO;CACT;;CAGA,AAAO,KAAK,YAAY,MAAM;EAE5B,OADkB,KAAK,SACN,WAAW,mBAAmB,EAAE,UAAU,CAAC;CAC9D;;;;CAKA,AAAO,aAAa,QAAQ,MAAM;EAChC,MAAM,YAAY,KAAK;EACvB,UAAU,qBAAqB;EAC/B,OAAO;CACT;;;;;;;;;;;;;;CAeA,AAAgB,MAAM,MAAuB;EAE3C,MAAM,SAAS,MAAM,MAAM;EAG3B,MAAM,YAAY,CAAC;EACnB,KAAK,MAAM,OAAO,KAAK,QAAQ;GAC7B,IAAI,QAAQ,CAAC,KAAK,SAAS,GAAG,GAA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AAK,SAAS,sBAAsB,MAAM,OAAO,CAAC;CAI/D,IAAI,CAAC,cAAc,GAAG,GACpB,OAAO;CAIT,IAAI,QAAQ,IAAI,GAAG,GACjB,OAAO,QAAQ,IAAI,GAAG;CAIxB,MAAM,SAAc,CAAC;CACrB,QAAQ,IAAI,KAAK,MAAM;CAEvB,KAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,GAAG,GAC3C,IAAI,UAAU,QACZ,OAAO,OAAO,sBAAsB,OAAO,OAAO;CAItD,OAAO;AACT"}
1
+ {"version":3,"file":"object-validator.mjs","names":[],"sources":["../../../../../../../seal/src/validators/object-validator.ts"],"sourcesContent":["import { except } from \"@mongez/reinforcements\";\nimport { isPlainObject } from \"@mongez/supportive-is\";\nimport { setKeyPath } from \"../helpers\";\nimport { objectTrimMutator, stripUnknownMutator } from \"../mutators\";\nimport { objectRule, unknownKeyRule } from \"../rules\";\nimport type { JsonSchemaResult, JsonSchemaTarget } from \"../standard-schema/json-schema\";\nimport { applyNullable, wrapNullableStrict } from \"../standard-schema/json-schema\";\nimport type { Schema, SchemaContext, ValidationResult } from \"../types\";\nimport type {\n InferInputObjectShape,\n InferOutputObjectShape,\n} from \"../types/inference-types\";\nimport { BaseValidator } from \"./base-validator\";\nimport { ComputedValidator } from \"./computed-validator\";\n\n/**\n * Object validator class with generic schema type for proper type inference.\n *\n * Threads two distinct inferred shapes into `BaseValidator`'s `TInput`/`TOutput`:\n *\n * - `TInput` = `InferInputObjectShape<TSchema>` — what `~standard.validate()`\n * accepts (caller's pre-validation payload; defaults/catches make\n * keys optional)\n * - `TOutput` = `InferOutputObjectShape<TSchema>` — what `~standard.validate()`\n * returns on success (post-default, post-catch shape; guaranteed\n * keys are required)\n *\n * Both helpers are used directly (not the full `Infer.*` walker) to avoid a\n * recursive class-base evaluation that would otherwise occur when the\n * brand-aware widening tries to inspect the class type.\n */\nexport class ObjectValidator<TSchema extends Schema = Schema> extends BaseValidator<\n InferInputObjectShape<TSchema>,\n InferOutputObjectShape<TSchema>\n> {\n protected shouldAllowUnknown = false;\n protected allowedKeys: string[] = [];\n protected hasUnknownKeyRule = false;\n\n public constructor(\n public schema: TSchema,\n errorMessage?: string,\n ) {\n super();\n this.addMutableRule(objectRule, errorMessage);\n }\n\n /**\n * Check if value is an object type (plain object, not array or date)\n */\n public matchesType(value: any): boolean {\n return isPlainObject(value);\n }\n\n /** Strip unknown keys from the data */\n public stripUnknown() {\n const validator = this.instance;\n return validator.addMutator(stripUnknownMutator, {\n get allowedKeys() {\n return validator.allowedKeys;\n },\n });\n }\n\n /** Add list of allowed keys that could be in the data but not necessarily validated */\n public allow(...keys: string[]) {\n const validator = this.instance;\n validator.allowedKeys.push(...keys);\n return validator;\n }\n\n /** Trim values of the object properties */\n public trim(recursive = true) {\n const validator = this.instance;\n return validator.addMutator(objectTrimMutator, { recursive });\n }\n\n /** Whether to allow unknown properties\n * Please note it will allow only unknown direct children keys, not nested children keys\n */\n public allowUnknown(allow = true) {\n const validator = this.instance;\n validator.shouldAllowUnknown = allow;\n return validator;\n }\n\n /**\n * Create a copy of this object validator with the same configuration\n * Copies schema, rules, mutators, transformers, and object-specific settings\n *\n * @returns A new ObjectValidator instance with copied configuration\n *\n * @example\n * ```ts\n * const baseUser = v.object({ name: v.string() }).allowUnknown();\n * const userCopy = baseUser.clone();\n * // userCopy has the same schema and allowUnknown setting\n * ```\n */\n public override clone(keys?: string[]): this {\n // Get cloned instance with all BaseValidator properties\n const cloned = super.clone();\n\n // Clone schema with deep copy of validators\n const newSchema = {} as TSchema;\n for (const key in this.schema) {\n if (keys && !keys.includes(key)) continue;\n (newSchema as any)[key] = this.schema[key].clone();\n }\n\n cloned.schema = newSchema;\n\n // Add ObjectValidator-specific properties\n cloned.shouldAllowUnknown = this.shouldAllowUnknown;\n cloned.allowedKeys = [...this.allowedKeys];\n // NOTE: hasUnknownKeyRule is intentionally NOT copied.\n // Each clone must add its own unknownKeyRule on first validate()\n // so it holds references to its own schema/allowedKeys, not the original's.\n\n return cloned;\n }\n\n /**\n * Extend this schema with additional fields\n * Clones the current validator and adds new fields to the schema\n * **Keeps original configuration** (allowUnknown, stripUnknown, etc.)\n *\n * If an ObjectValidator is provided, only its schema is used - its configuration is ignored.\n * This is useful for creating reusable field collections that can be added to different schemas.\n *\n * @param schemaOrValidator - Plain schema object or ObjectValidator to extend with\n * @returns A new ObjectValidator with merged schema and original configuration\n *\n * @example\n * ```ts\n * // Extend with plain schema\n * const baseUser = v.object({\n * name: v.string().required(),\n * email: v.string().email().required()\n * }).allowUnknown();\n *\n * const adminUser = baseUser.extend({\n * role: v.string().in(['admin', 'superadmin']).required()\n * });\n * // adminUser has: name, email, role\n * // adminUser keeps: allowUnknown() from base ✅\n *\n * // Extend with ObjectValidator (only schema is used)\n * const auditFields = v.object({\n * createdAt: v.date().required(),\n * updatedAt: v.date().required()\n * }).stripUnknown(); // This config is ignored!\n *\n * const fullUser = baseUser.extend(auditFields);\n * // fullUser has: name, email, createdAt, updatedAt\n * // fullUser keeps: allowUnknown() from base (NOT stripUnknown from auditFields) ✅\n *\n * // Chain multiple extends\n * const complexSchema = baseUser\n * .extend(auditFields)\n * .extend({ metadata: v.object({}) });\n * ```\n */\n public extend<TExtension extends Schema>(\n schemaOrValidator: TExtension | ObjectValidator<TExtension>,\n ): ObjectValidator<TSchema & TExtension> {\n // Clone current validator to preserve original\n const extended = this.clone() as any;\n\n // Extract schema from parameter\n const schemaToAdd =\n schemaOrValidator instanceof ObjectValidator ? schemaOrValidator.schema : schemaOrValidator;\n\n // Merge schemas with cloned validators (later fields override earlier ones)\n for (const key in schemaToAdd) {\n extended.schema[key] = schemaToAdd[key].clone();\n }\n\n return extended as ObjectValidator<TSchema & TExtension>;\n }\n\n /**\n * Merge with another ObjectValidator\n * Clones current validator, merges schemas, and **overrides configuration** with other validator's config\n *\n * Unlike extend(), merge() combines both schemas AND configurations.\n * The other validator's configuration (allowUnknown, stripUnknown, etc.) takes precedence.\n *\n * @param validator - Another ObjectValidator to merge with\n * @returns A new ObjectValidator with merged schema and configuration\n *\n * @example\n * ```ts\n * const baseUser = v.object({\n * name: v.string().required()\n * }).allowUnknown();\n *\n * const timestamps = v.object({\n * createdAt: v.date().required(),\n * updatedAt: v.date().required()\n * }).stripUnknown();\n *\n * const merged = baseUser.merge(timestamps);\n * // merged has: name, createdAt, updatedAt\n * // merged config: stripUnknown() from timestamps (overrides allowUnknown) ✅\n *\n * // Chain multiple merges\n * const full = baseUser.merge(timestamps).merge(softDeleteSchema);\n * ```\n */\n public merge<TMerge extends Schema>(\n validator: ObjectValidator<TMerge>,\n ): ObjectValidator<TSchema & TMerge> {\n // Clone current validator\n const merged = this.clone() as any;\n\n // Merge schemas with cloned validators (later fields override earlier ones)\n for (const key in validator.schema) {\n merged.schema[key] = validator.schema[key].clone();\n }\n\n // Override configuration with other validator's config\n merged.shouldAllowUnknown = validator.shouldAllowUnknown;\n merged.allowedKeys = [...merged.allowedKeys, ...validator.allowedKeys];\n\n // Append rules, mutators, transformers from other validator\n merged.rules.push(...validator.rules);\n merged.mutators.push(...validator.mutators);\n merged.dataTransformers.push(...validator.dataTransformers);\n\n // Merge attributes text (later wins)\n merged.attributesText = {\n ...merged.attributesText,\n ...validator.attributesText,\n };\n\n merged.translatedAttributes = {\n ...merged.translatedAttributes,\n ...validator.translatedAttributes,\n };\n\n return merged as ObjectValidator<TSchema & TMerge>;\n }\n\n /**\n * Create a new schema with only the specified fields\n * Clones the current validator and keeps only the selected fields\n * **Preserves all configuration** (allowUnknown, stripUnknown, etc.)\n *\n * @param keys - Field names to keep in the schema\n * @returns A new ObjectValidator with only the picked fields\n *\n * @example\n * ```ts\n * const fullUser = v.object({\n * id: v.int().required(),\n * name: v.string().required(),\n * email: v.string().email().required(),\n * password: v.string().required(),\n * role: v.string()\n * }).allowUnknown();\n *\n * // For login - only need email and password\n * const loginSchema = fullUser.pick('email', 'password');\n * // loginSchema has: { email, password }\n * // loginSchema keeps: allowUnknown() ✅\n *\n * // For public profile\n * const publicSchema = fullUser.pick('id', 'name', 'role');\n * // publicSchema has: { id, name, role }\n * ```\n */\n public pick<K extends keyof TSchema>(...keys: K[]): ObjectValidator<Pick<TSchema, K>> {\n // Clone current validator\n const picked = this.clone() as any;\n\n // Create new schema with only picked keys\n const newSchema = {} as Pick<TSchema, K>;\n for (const key of keys) {\n if (key in picked.schema) {\n (newSchema as any)[key] = picked.schema[key];\n }\n }\n\n picked.schema = newSchema;\n\n return picked as ObjectValidator<Pick<TSchema, K>>;\n }\n\n /**\n * Mark all or the given schema fields as optional\n */\n public partial<K extends keyof TSchema>(...keys: K[]) {\n const validationSchema = this.clone();\n\n if (keys.length === 0) {\n keys = Object.keys(validationSchema.schema) as K[];\n }\n\n for (const key of keys) {\n validationSchema.schema[key] = validationSchema.schema[key].optional();\n }\n\n return validationSchema;\n }\n\n /**\n * Make the all or the given fields as required\n */\n public requiredFields<K extends keyof TSchema>(...keys: K[]) {\n const validationSchema = this.clone();\n\n if (keys.length === 0) {\n keys = Object.keys(validationSchema.schema) as K[];\n }\n\n for (const key of keys) {\n validationSchema.schema[key] = validationSchema.schema[key].required();\n }\n\n return validationSchema;\n }\n\n /**\n * Create a new schema excluding the specified fields\n * Clones the current validator and removes the specified fields\n * **Preserves all configuration** (allowUnknown, stripUnknown, etc.)\n *\n * @param keys - Field names to exclude from the schema\n * @returns A new ObjectValidator without the excluded fields\n *\n * @example\n * ```ts\n * const fullUser = v.object({\n * id: v.int().required(),\n * name: v.string().required(),\n * email: v.string().email().required(),\n * password: v.string().required(),\n * role: v.string()\n * }).allowUnknown();\n *\n * // For updates - exclude id\n * const updateSchema = fullUser.without('id');\n * // updateSchema has: { name, email, password, role }\n * // updateSchema keeps: allowUnknown() ✅\n *\n * // For public API - exclude sensitive fields\n * const publicSchema = fullUser.without('password', 'role');\n * // publicSchema has: { id, name, email }\n *\n * // Combine with other methods\n * const patchSchema = fullUser.without('id', 'password');\n * // patchSchema has: { name, email, role }\n * ```\n */\n public without<K extends keyof TSchema>(...keys: K[]): ObjectValidator<Omit<TSchema, K>> {\n // Clone current validator\n const filtered = this.clone() as any;\n\n // Create new schema excluding specified keys\n const newSchema = {} as Omit<TSchema, K>;\n for (const key in filtered.schema) {\n if (!keys.includes(key as any)) {\n (newSchema as any)[key] = filtered.schema[key];\n }\n }\n\n filtered.schema = newSchema;\n\n return filtered as ObjectValidator<Omit<TSchema, K>>;\n }\n\n /** Mutate the data */\n public mutate(data: any, context: SchemaContext) {\n if (!isPlainObject(data)) return data;\n return super.mutate({ ...data }, context);\n }\n\n /** Validate the data */\n public async validate(\n data: any,\n context: SchemaContext = { path: \"\" } as SchemaContext,\n ): Promise<ValidationResult> {\n context.schema = this.schema;\n const mutatedData = await this.mutate(data, context);\n\n // Check for unknown properties\n if (this.shouldAllowUnknown === false && !this.hasUnknownKeyRule) {\n this.hasUnknownKeyRule = true;\n const rule = this.addMutableRule(unknownKeyRule, undefined, {\n allowedKeys: this.allowedKeys,\n schema: this.schema,\n });\n\n this.setRuleAttributesList(rule);\n }\n\n const result = await super.validate(mutatedData, context);\n\n if (result.isValid === false) return result;\n if (data === undefined) return result;\n\n // ═══════════════════════════════════════════════════════════\n // PHASE 1: Validate user input fields (skip computed/managed)\n // ═══════════════════════════════════════════════════════════\n const errors: ValidationResult[\"errors\"] = [];\n const validatedData: any = {};\n\n const userInputKeys = Object.keys(this.schema).filter(\n (key) => !this.isComputedValidator(this.schema[key]),\n );\n\n const validationPromises = userInputKeys.map(async (key) => {\n const validator = this.schema[key];\n const value =\n mutatedData?.[key] !== undefined ? mutatedData[key] : validator.getDefaultValue();\n\n const childContext: SchemaContext = {\n ...context,\n parent: mutatedData,\n value,\n key,\n path: setKeyPath(context.path, key),\n };\n\n const childResult = await validator.validate(value, childContext);\n\n // Only include in validated data if not omitted\n if (childResult.data !== undefined && !validator.isOmitted()) {\n validatedData[key] = childResult.data;\n }\n\n if (childResult.isValid === false) {\n errors.push(...childResult.errors);\n }\n });\n\n await Promise.all(validationPromises);\n\n // If Phase 1 failed, return early\n if (errors.length > 0) {\n return {\n isValid: false,\n errors,\n data: undefined,\n };\n }\n\n // ═══════════════════════════════════════════════════════════\n // PHASE 2: Execute computed/managed fields with validated data\n // ═══════════════════════════════════════════════════════════\n const computedFields = this.getComputedFields();\n\n const computedPromises = Object.keys(computedFields).map(async (key) => {\n const validator = computedFields[key];\n\n const childContext: SchemaContext = {\n ...context,\n parent: validatedData,\n value: undefined, // Computed fields don't have input value\n };\n\n // Execute computed callback with validated data\n const childResult = await validator.validate(validatedData, childContext);\n\n // Only include in final data if not omitted\n if (childResult.data !== undefined && !validator.isOmitted()) {\n validatedData[key] = childResult.data;\n }\n\n if (childResult.isValid === false) {\n errors.push(...childResult.errors);\n }\n });\n\n await Promise.all(computedPromises);\n\n // If Phase 2 failed, return early\n if (errors.length > 0) {\n return {\n isValid: false,\n errors,\n data: undefined,\n };\n }\n\n // Remove undefined values\n const cleanedData = removeUndefinedValues(validatedData);\n\n const transformedData = await this.startTransformationPipeline(cleanedData, context);\n\n const output =\n this.shouldAllowUnknown === false\n ? transformedData\n : {\n ...transformedData,\n ...except(mutatedData, Object.keys(this.schema)),\n };\n\n return {\n isValid: true,\n errors: [],\n data: output,\n };\n }\n\n /**\n * Check if a validator is a computed or managed field\n * ManagedValidator extends ComputedValidator, so instanceof catches both\n */\n private isComputedValidator(validator: BaseValidator): boolean {\n return validator instanceof ComputedValidator;\n }\n\n /**\n * Get all computed/managed fields from the schema\n */\n private getComputedFields(): Record<string, ComputedValidator> {\n const computed: Record<string, any> = {};\n\n for (const [key, validator] of Object.entries(this.schema)) {\n if (validator instanceof ComputedValidator) {\n computed[key] = validator;\n }\n }\n\n return computed;\n }\n\n /**\n * @inheritdoc\n *\n * Recursively generates JSON Schema for all input fields in the schema.\n * Computed/managed fields are skipped — they have no input representation.\n *\n * **Standard targets** (`draft-2020-12`, `draft-07`, `openapi-3.0`):\n * - Fields marked `.optional()` are excluded from `required`.\n *\n * **`openai-strict` target** (OpenAI Structured Outputs):\n * - ALL fields appear in `required` — OpenAI rejects schemas with optional fields.\n * - Optional fields are instead expressed as nullable types:\n * `{ type: [\"string\", \"null\"] }` so the model can output `null` for them.\n * - Recursively applies `openai-strict` to all nested objects.\n *\n * @example\n * ```ts\n * v.object({\n * name: v.string().required(),\n * age: v.int().optional(),\n * }).toJsonSchema(\"draft-2020-12\")\n * // → { type: \"object\",\n * // properties: { name: { type: \"string\" }, age: { type: \"integer\" } },\n * // required: [\"name\"], additionalProperties: false }\n *\n * v.object({\n * name: v.string().required(),\n * age: v.int().optional(),\n * }).toJsonSchema(\"openai-strict\")\n * // → { type: \"object\",\n * // properties: { name: { type: \"string\" }, age: { type: [\"integer\", \"null\"] } },\n * // required: [\"name\", \"age\"], ← all fields\n * // additionalProperties: false }\n * ```\n */\n public override toJsonSchema(target: JsonSchemaTarget = \"draft-2020-12\"): JsonSchemaResult {\n const properties: Record<string, JsonSchemaResult> = {};\n const required: string[] = [];\n const isOpenAIStrict = target === \"openai-strict\";\n\n for (const [key, validator] of Object.entries(this.schema)) {\n // Skip computed/managed — runtime-only, no input schema\n if (validator instanceof ComputedValidator) continue;\n\n let fieldSchema = validator.toJsonSchema(target);\n\n if (isOpenAIStrict) {\n // OpenAI strict: every field must be in required.\n // Optional fields are expressed as nullable rather than absent.\n if (validator.isOptional) {\n fieldSchema = wrapNullableStrict(fieldSchema);\n }\n required.push(key);\n } else {\n // Standard JSON Schema: only non-optional fields go in required\n if (!validator.isOptional) {\n required.push(key);\n }\n }\n\n properties[key] = fieldSchema;\n }\n\n const schema: JsonSchemaResult = { type: \"object\", properties };\n\n if (required.length > 0) schema.required = required;\n if (!this.shouldAllowUnknown) schema.additionalProperties = false;\n if (this.isNullable) applyNullable(schema, target);\n\n return schema;\n }\n}\n\n/** Recursively remove undefined values from an object */\nfunction removeUndefinedValues(obj: any, visited = new WeakMap<object, any>()): any {\n // Handle primitives and null\n if (obj === null) {\n return obj;\n }\n\n // Handle arrays\n if (Array.isArray(obj)) {\n return obj.map((item) => removeUndefinedValues(item, visited));\n }\n\n // Skip non-plain objects (class instances, Dates, Buffers, etc.)\n if (!isPlainObject(obj)) {\n return obj;\n }\n\n // Handle circular references - return already processed result\n if (visited.has(obj)) {\n return visited.get(obj);\n }\n\n // Process plain objects\n const result: any = {};\n visited.set(obj, result); // Mark as processing BEFORE recursion\n\n for (const [key, value] of Object.entries(obj)) {\n if (value !== undefined) {\n result[key] = removeUndefinedValues(value, visited);\n }\n }\n\n return result;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BA,IAAa,kBAAb,MAAa,wBAAyD,cAGpE;CAKA,AAAO,YACL,AAAO,QACP,cACA;EACA,MAAM;EAHC;4BALsB;qBACG,CAAC;2BACL;EAO5B,KAAK,eAAe,YAAY,YAAY;CAC9C;;;;CAKA,AAAO,YAAY,OAAqB;EACtC,OAAO,cAAc,KAAK;CAC5B;;CAGA,AAAO,eAAe;EACpB,MAAM,YAAY,KAAK;EACvB,OAAO,UAAU,WAAW,qBAAqB,EAC/C,IAAI,cAAc;GAChB,OAAO,UAAU;EACnB,EACF,CAAC;CACH;;CAGA,AAAO,MAAM,GAAG,MAAgB;EAC9B,MAAM,YAAY,KAAK;EACvB,UAAU,YAAY,KAAK,GAAG,IAAI;EAClC,OAAO;CACT;;CAGA,AAAO,KAAK,YAAY,MAAM;EAE5B,OADkB,KAAK,SACN,WAAW,mBAAmB,EAAE,UAAU,CAAC;CAC9D;;;;CAKA,AAAO,aAAa,QAAQ,MAAM;EAChC,MAAM,YAAY,KAAK;EACvB,UAAU,qBAAqB;EAC/B,OAAO;CACT;;;;;;;;;;;;;;CAeA,AAAgB,MAAM,MAAuB;EAE3C,MAAM,SAAS,MAAM,MAAM;EAG3B,MAAM,YAAY,CAAC;EACnB,KAAK,MAAM,OAAO,KAAK,QAAQ;GAC7B,IAAI,QAAQ,CAAC,KAAK,SAAS,GAAG,GAAG;GACjC,AAAC,UAAkB,OAAO,KAAK,OAAO,KAAK,MAAM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CAAC,cAAc,GAAG,GACpB,OAAO;CAIT,IAAI,QAAQ,IAAI,GAAG,GACjB,OAAO,QAAQ,IAAI,GAAG;CAIxB,MAAM,SAAc,CAAC;CACrB,QAAQ,IAAI,KAAK,MAAM;CAEvB,KAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,GAAG,GAC3C,IAAI,UAAU,QACZ,OAAO,OAAO,sBAAsB,OAAO,OAAO;CAItD,OAAO;AACT"}
@@ -1,6 +1,6 @@
1
1
  import { BaseValidator } from "./base-validator.mjs";
2
2
 
3
- //#region seal/src/validators/primitive-validator.d.ts
3
+ //#region ../seal/src/validators/primitive-validator.d.ts
4
4
  /**
5
5
  * Abstract base validator for primitive-typed fields (string, number, boolean).
6
6
  *
@@ -1 +1 @@
1
- {"version":3,"file":"primitive-validator.d.mts","names":[],"sources":["C:/Work/Warlock.js/seal/src/validators/primitive-validator.ts"],"mappings":";;;;;AAyBA;;;;;;;;;;;;;;;;;;;;uBAAsB,kBAAA,SAA2B,aAAa;EA2D/C;;;AAAoC;;;EApD1C,IAAA,CAAK,MAAA,OAAa,YAAA;;;;;;;;EAWlB,EAAA,CAAG,MAAA,SAAe,YAAA;;;;;;;EAUlB,KAAA,CAAM,MAAA,SAAe,YAAA;;;;;;;EAUrB,UAAA,CAAW,MAAA,SAAe,YAAA;;;;;;;;EAW1B,OAAA,CAAQ,MAAA,SAAe,YAAA;;;;;;;EAUvB,KAAA,CAAM,MAAA,SAAe,YAAA;AAAA"}
1
+ {"version":3,"file":"primitive-validator.d.mts","names":[],"sources":["../../../../../../../seal/src/validators/primitive-validator.ts"],"mappings":";;;;;AAyBA;;;;;;;;;;;;;;;;;;;;uBAAsB,kBAAA,SAA2B,aAAa;EA2D/C;;;AAAoC;;;EApD1C,IAAA,CAAK,MAAA,OAAa,YAAA;;;;;;;;EAWlB,EAAA,CAAG,MAAA,SAAe,YAAA;;;;;;;EAUlB,KAAA,CAAM,MAAA,SAAe,YAAA;;;;;;;EAUrB,UAAA,CAAW,MAAA,SAAe,YAAA;;;;;;;;EAW1B,OAAA,CAAQ,MAAA,SAAe,YAAA;;;;;;;EAUvB,KAAA,CAAM,MAAA,SAAe,YAAA;AAAA"}
@@ -2,7 +2,7 @@ import { BaseValidator } from "./base-validator.mjs";
2
2
  import { allowedValuesRule, enumRule, inRule, notAllowedValuesRule } from "../rules/common/enum.mjs";
3
3
  import "../rules/index.mjs";
4
4
 
5
- //#region seal/src/validators/primitive-validator.ts
5
+ //#region ../seal/src/validators/primitive-validator.ts
6
6
  /**
7
7
  * Abstract base validator for primitive-typed fields (string, number, boolean).
8
8
  *
@@ -1 +1 @@
1
- {"version":3,"file":"primitive-validator.mjs","names":[],"sources":["C:/Work/Warlock.js/seal/src/validators/primitive-validator.ts"],"sourcesContent":["import { allowedValuesRule, enumRule, inRule, notAllowedValuesRule } from \"../rules\";\nimport { BaseValidator } from \"./base-validator\";\n\n/**\n * Abstract base validator for primitive-typed fields (string, number, boolean).\n *\n * Provides value-membership rules that are meaningful for any single primitive value\n * but not for complex structures (object, array).\n *\n * Do NOT expose this on the `v` factory — it is an inheritance-only base class.\n *\n * Hierarchy:\n * BaseValidator\n * └── PrimitiveValidator ← enum, in, oneOf, allowsOnly, forbids, notIn\n * ├── StringValidator\n * ├── NumberValidator\n * │ └── FloatValidator\n * ├── BooleanValidator\n * └── ScalarValidator (extends PrimitiveValidator, adds asNumber/asString/accepted/declined)\n *\n * @example\n * class MyValidator extends PrimitiveValidator {\n * // inherits: in(), forbids(), enum(), oneOf(), allowsOnly(), notIn()\n * }\n */\nexport abstract class PrimitiveValidator extends BaseValidator {\n /**\n * Value must be one of the enum's values\n *\n * @example\n * v.string().enum(Direction) // Direction is a TS enum\n */\n public enum(values: any, errorMessage?: string) {\n return this.addRule(enumRule, errorMessage, { enum: Object.values(values) });\n }\n\n /**\n * Value must be one of the given values\n *\n * @example\n * v.string().in([\"admin\", \"user\", \"guest\"])\n * v.number().in([1, 2, 3])\n */\n public in(values: any[], errorMessage?: string) {\n return this.addRule(inRule, errorMessage, { values });\n }\n\n /**\n * Alias for `in()`\n *\n * @example\n * v.string().oneOf([\"active\", \"inactive\"])\n */\n public oneOf(values: any[], errorMessage?: string) {\n return this.in(values, errorMessage);\n }\n\n /**\n * Value must be one of the allowed values (stricter variant)\n *\n * @example\n * v.string().allowsOnly([\"yes\", \"no\"])\n */\n public allowsOnly(values: any[], errorMessage?: string) {\n return this.addRule(allowedValuesRule, errorMessage, { allowedValues: values });\n }\n\n /**\n * Value must NOT be one of the given values\n *\n * @example\n * v.string().forbids([\"banned\", \"blacklisted\"])\n * v.number().forbids([0, -1])\n */\n public forbids(values: any[], errorMessage?: string) {\n return this.addRule(notAllowedValuesRule, errorMessage, { notAllowedValues: values });\n }\n\n /**\n * Alias for `forbids()`\n *\n * @example\n * v.string().notIn([\"OK\", \"NOT OK\"])\n */\n public notIn(values: any[], errorMessage?: string) {\n return this.forbids(values, errorMessage);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAyBA,IAAsB,qBAAtB,cAAiD,cAAc;;;;;;;CAO7D,AAAO,KAAK,QAAa,cAAuB;EAC9C,OAAO,KAAK,QAAQ,UAAU,cAAc,EAAE,MAAM,OAAO,OAAO,MAAM,EAAE,CAAC;CAC7E;;;;;;;;CASA,AAAO,GAAG,QAAe,cAAuB;EAC9C,OAAO,KAAK,QAAQ,QAAQ,cAAc,EAAE,OAAO,CAAC;CACtD;;;;;;;CAQA,AAAO,MAAM,QAAe,cAAuB;EACjD,OAAO,KAAK,GAAG,QAAQ,YAAY;CACrC;;;;;;;CAQA,AAAO,WAAW,QAAe,cAAuB;EACtD,OAAO,KAAK,QAAQ,mBAAmB,cAAc,EAAE,eAAe,OAAO,CAAC;CAChF;;;;;;;;CASA,AAAO,QAAQ,QAAe,cAAuB;EACnD,OAAO,KAAK,QAAQ,sBAAsB,cAAc,EAAE,kBAAkB,OAAO,CAAC;CACtF;;;;;;;CAQA,AAAO,MAAM,QAAe,cAAuB;EACjD,OAAO,KAAK,QAAQ,QAAQ,YAAY;CAC1C;AACF"}
1
+ {"version":3,"file":"primitive-validator.mjs","names":[],"sources":["../../../../../../../seal/src/validators/primitive-validator.ts"],"sourcesContent":["import { allowedValuesRule, enumRule, inRule, notAllowedValuesRule } from \"../rules\";\nimport { BaseValidator } from \"./base-validator\";\n\n/**\n * Abstract base validator for primitive-typed fields (string, number, boolean).\n *\n * Provides value-membership rules that are meaningful for any single primitive value\n * but not for complex structures (object, array).\n *\n * Do NOT expose this on the `v` factory — it is an inheritance-only base class.\n *\n * Hierarchy:\n * BaseValidator\n * └── PrimitiveValidator ← enum, in, oneOf, allowsOnly, forbids, notIn\n * ├── StringValidator\n * ├── NumberValidator\n * │ └── FloatValidator\n * ├── BooleanValidator\n * └── ScalarValidator (extends PrimitiveValidator, adds asNumber/asString/accepted/declined)\n *\n * @example\n * class MyValidator extends PrimitiveValidator {\n * // inherits: in(), forbids(), enum(), oneOf(), allowsOnly(), notIn()\n * }\n */\nexport abstract class PrimitiveValidator extends BaseValidator {\n /**\n * Value must be one of the enum's values\n *\n * @example\n * v.string().enum(Direction) // Direction is a TS enum\n */\n public enum(values: any, errorMessage?: string) {\n return this.addRule(enumRule, errorMessage, { enum: Object.values(values) });\n }\n\n /**\n * Value must be one of the given values\n *\n * @example\n * v.string().in([\"admin\", \"user\", \"guest\"])\n * v.number().in([1, 2, 3])\n */\n public in(values: any[], errorMessage?: string) {\n return this.addRule(inRule, errorMessage, { values });\n }\n\n /**\n * Alias for `in()`\n *\n * @example\n * v.string().oneOf([\"active\", \"inactive\"])\n */\n public oneOf(values: any[], errorMessage?: string) {\n return this.in(values, errorMessage);\n }\n\n /**\n * Value must be one of the allowed values (stricter variant)\n *\n * @example\n * v.string().allowsOnly([\"yes\", \"no\"])\n */\n public allowsOnly(values: any[], errorMessage?: string) {\n return this.addRule(allowedValuesRule, errorMessage, { allowedValues: values });\n }\n\n /**\n * Value must NOT be one of the given values\n *\n * @example\n * v.string().forbids([\"banned\", \"blacklisted\"])\n * v.number().forbids([0, -1])\n */\n public forbids(values: any[], errorMessage?: string) {\n return this.addRule(notAllowedValuesRule, errorMessage, { notAllowedValues: values });\n }\n\n /**\n * Alias for `forbids()`\n *\n * @example\n * v.string().notIn([\"OK\", \"NOT OK\"])\n */\n public notIn(values: any[], errorMessage?: string) {\n return this.forbids(values, errorMessage);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAyBA,IAAsB,qBAAtB,cAAiD,cAAc;;;;;;;CAO7D,AAAO,KAAK,QAAa,cAAuB;EAC9C,OAAO,KAAK,QAAQ,UAAU,cAAc,EAAE,MAAM,OAAO,OAAO,MAAM,EAAE,CAAC;CAC7E;;;;;;;;CASA,AAAO,GAAG,QAAe,cAAuB;EAC9C,OAAO,KAAK,QAAQ,QAAQ,cAAc,EAAE,OAAO,CAAC;CACtD;;;;;;;CAQA,AAAO,MAAM,QAAe,cAAuB;EACjD,OAAO,KAAK,GAAG,QAAQ,YAAY;CACrC;;;;;;;CAQA,AAAO,WAAW,QAAe,cAAuB;EACtD,OAAO,KAAK,QAAQ,mBAAmB,cAAc,EAAE,eAAe,OAAO,CAAC;CAChF;;;;;;;;CASA,AAAO,QAAQ,QAAe,cAAuB;EACnD,OAAO,KAAK,QAAQ,sBAAsB,cAAc,EAAE,kBAAkB,OAAO,CAAC;CACtF;;;;;;;CAQA,AAAO,MAAM,QAAe,cAAuB;EACjD,OAAO,KAAK,QAAQ,QAAQ,YAAY;CAC1C;AACF"}
@@ -3,7 +3,7 @@ import { SchemaContext } from "../types/context-types.mjs";
3
3
  import { ValidationResult } from "../types/result-types.mjs";
4
4
  import { BaseValidator } from "./base-validator.mjs";
5
5
 
6
- //#region seal/src/validators/record-validator.d.ts
6
+ //#region ../seal/src/validators/record-validator.d.ts
7
7
  /**
8
8
  * Record validator class - validates objects with dynamic keys and consistent value types
9
9
  *
@@ -1 +1 @@
1
- {"version":3,"file":"record-validator.d.mts","names":[],"sources":["C:/Work/Warlock.js/seal/src/validators/record-validator.ts"],"mappings":";;;;;;;;;AAsBA;;;;;;;;;;;cAAa,eAAA,SAAwB,aAAA;EAE1B,cAAA,EAAgB,aAAA;cAAhB,cAAA,EAAgB,aAAA,EACvB,YAAA;EADO;;;EAUF,WAAA,CAAY,YAAA;EAVV;;;EAiBF,WAAA,CAAY,KAAA;EAAZ;;;EAOS,KAAA,CAAA;EAaM;;;;;;;EAAT,QAAA,CAAS,IAAA,OAAW,OAAA,EAAS,aAAA,GAAgB,OAAA,CAAQ,gBAAA;EAkEQ;;AAAgB;;;;;;;;;;;;;EAA1E,YAAA,CAAa,MAAA,GAAQ,gBAAA,GAAqC,gBAAA;AAAA"}
1
+ {"version":3,"file":"record-validator.d.mts","names":[],"sources":["../../../../../../../seal/src/validators/record-validator.ts"],"mappings":";;;;;;;;;AAsBA;;;;;;;;;;;cAAa,eAAA,SAAwB,aAAA;EAE1B,cAAA,EAAgB,aAAA;cAAhB,cAAA,EAAgB,aAAA,EACvB,YAAA;EADO;;;EAUF,WAAA,CAAY,YAAA;EAVV;;;EAiBF,WAAA,CAAY,KAAA;EAAZ;;;EAOS,KAAA,CAAA;EAaM;;;;;;;EAAT,QAAA,CAAS,IAAA,OAAW,OAAA,EAAS,aAAA,GAAgB,OAAA,CAAQ,gBAAA;EAkEQ;;AAAgB;;;;;;;;;;;;;EAA1E,YAAA,CAAa,MAAA,GAAQ,gBAAA,GAAqC,gBAAA;AAAA"}
@@ -6,7 +6,7 @@ import { objectRule, plainObjectRule } from "../rules/common/type-rules.mjs";
6
6
  import "../rules/index.mjs";
7
7
  import { isPlainObject } from "@mongez/supportive-is";
8
8
 
9
- //#region seal/src/validators/record-validator.ts
9
+ //#region ../seal/src/validators/record-validator.ts
10
10
  /**
11
11
  * Record validator class - validates objects with dynamic keys and consistent value types
12
12
  *
@@ -1 +1 @@
1
- {"version":3,"file":"record-validator.mjs","names":[],"sources":["C:/Work/Warlock.js/seal/src/validators/record-validator.ts"],"sourcesContent":["import { isPlainObject } from \"@mongez/supportive-is\";\r\nimport { setKeyPath } from \"../helpers\";\r\nimport { objectRule, plainObjectRule } from \"../rules\";\r\nimport type { SchemaContext, ValidationResult } from \"../types\";\r\nimport { BaseValidator } from \"./base-validator\";\r\nimport { applyNullable } from \"../standard-schema/json-schema\";\r\nimport type { JsonSchemaResult, JsonSchemaTarget } from \"../standard-schema/json-schema\";\r\n\r\n/**\r\n * Record validator class - validates objects with dynamic keys and consistent value types\r\n *\r\n * @example\r\n * ```ts\r\n * // Translations object\r\n * v.record(v.string())\r\n * // Valid: { en: \"Hello\", ar: \"مرحبا\", fr: \"Bonjour\" }\r\n *\r\n * // User preferences\r\n * v.record(v.union([v.string(), v.number(), v.boolean()]))\r\n * // Valid: { theme: \"dark\", fontSize: 16, notifications: true }\r\n * ```\r\n */\r\nexport class RecordValidator extends BaseValidator {\r\n public constructor(\r\n public valueValidator: BaseValidator,\r\n errorMessage?: string,\r\n ) {\r\n super();\r\n this.addMutableRule(objectRule, errorMessage);\r\n }\r\n\r\n /**\r\n * Validate it as plain object\r\n */\r\n public plainObject(errorMessage?: string) {\r\n return this.addRule(plainObjectRule, errorMessage);\r\n }\r\n\r\n /**\r\n * Check if value is a plain object type\r\n */\r\n public matchesType(value: any): boolean {\r\n return isPlainObject(value);\r\n }\r\n\r\n /**\r\n * Clone the validator\r\n */\r\n public override clone(): this {\r\n const cloned = super.clone();\r\n cloned.valueValidator = this.valueValidator.clone();\r\n return cloned;\r\n }\r\n\r\n /**\r\n * Validate record - iterate all keys and validate each value\r\n *\r\n * Absent input (and absent without `.default()`) propagates as `data: undefined`\r\n * so the parent ObjectValidator can omit the key. Without this, optional record\r\n * fields would silently materialise as `{}` in the validated output.\r\n */\r\n public async validate(data: any, context: SchemaContext): Promise<ValidationResult> {\r\n // Apply default when absent, then mutate. Mirrors BaseValidator's\r\n // `valueForRules = data ?? this.getDefaultValue()` so `.default({...})`\r\n // works on records too.\r\n const valueForRules = data ?? this.getDefaultValue();\r\n const mutatedData = await this.mutate(valueForRules, context);\r\n\r\n const result = await super.validate(data, context);\r\n\r\n if (result.isValid === false) return result;\r\n\r\n // Nothing to iterate for absent (no default) or null (nullable) inputs —\r\n // propagate so the parent ObjectValidator can omit the key.\r\n if (mutatedData === undefined || mutatedData === null) return result;\r\n\r\n // Defensive: type rule (objectRule) should have failed for non-objects.\r\n if (!isPlainObject(mutatedData)) return result;\r\n\r\n const errors: ValidationResult[\"errors\"] = [];\r\n const keys = Object.keys(mutatedData);\r\n\r\n // Validate all values in parallel\r\n const validationPromises = keys.map(async (key) => {\r\n const childContext: SchemaContext = {\r\n ...context,\r\n parent: mutatedData,\r\n value: mutatedData[key],\r\n key,\r\n path: setKeyPath(context.path, key),\r\n };\r\n\r\n const childResult = await this.valueValidator.validate(mutatedData[key], childContext);\r\n\r\n // Update mutated data with validated result\r\n mutatedData[key] = childResult.data;\r\n\r\n // Collect errors from this value\r\n if (childResult.isValid === false) {\r\n errors.push(...childResult.errors);\r\n }\r\n });\r\n\r\n await Promise.all(validationPromises);\r\n\r\n return {\r\n isValid: errors.length === 0,\r\n errors,\r\n data: await this.startTransformationPipeline(mutatedData, context),\r\n };\r\n }\r\n\r\n /**\r\n * @inheritdoc\r\n *\r\n * Generates `{ type: \"object\", additionalProperties: <valueSchema> }` —\r\n * the standard JSON Schema for a dictionary/map with homogeneous values.\r\n *\r\n * @example\r\n * ```ts\r\n * v.record(v.string()).toJsonSchema(\"draft-2020-12\")\r\n * // → { type: \"object\", additionalProperties: { type: \"string\" } }\r\n *\r\n * v.record(v.union([v.string(), v.number()])).toJsonSchema(\"draft-2020-12\")\r\n * // → { type: \"object\", additionalProperties: { oneOf: [{ type: \"string\" }, { type: \"number\" }] } }\r\n * ```\r\n */\r\n public override toJsonSchema(target: JsonSchemaTarget = \"draft-2020-12\"): JsonSchemaResult {\r\n const schema: JsonSchemaResult = {\r\n type: \"object\",\r\n additionalProperties: this.valueValidator.toJsonSchema(target),\r\n };\r\n\r\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aAAa,OAAO;EACnE;CACF;;;;;;;;;;;;;;;;CAiBA,AAAgB,aAAa,SAA2B,iBAAmC;EACzF,MAAM,SAA2B;GAC/B,MAAM;GACN,sBAAsB,KAAK,eAAe,aAAa,MAAM;EAC/D;EAEA,IAAI,KAAK,YAAY,cAAc,QAAQ,MAAM;EAEjD,OAAO;CACT;AACF"}
1
+ {"version":3,"file":"record-validator.mjs","names":[],"sources":["../../../../../../../seal/src/validators/record-validator.ts"],"sourcesContent":["import { isPlainObject } from \"@mongez/supportive-is\";\r\nimport { setKeyPath } from \"../helpers\";\r\nimport { objectRule, plainObjectRule } from \"../rules\";\r\nimport type { SchemaContext, ValidationResult } from \"../types\";\r\nimport { BaseValidator } from \"./base-validator\";\r\nimport { applyNullable } from \"../standard-schema/json-schema\";\r\nimport type { JsonSchemaResult, JsonSchemaTarget } from \"../standard-schema/json-schema\";\r\n\r\n/**\r\n * Record validator class - validates objects with dynamic keys and consistent value types\r\n *\r\n * @example\r\n * ```ts\r\n * // Translations object\r\n * v.record(v.string())\r\n * // Valid: { en: \"Hello\", ar: \"مرحبا\", fr: \"Bonjour\" }\r\n *\r\n * // User preferences\r\n * v.record(v.union([v.string(), v.number(), v.boolean()]))\r\n * // Valid: { theme: \"dark\", fontSize: 16, notifications: true }\r\n * ```\r\n */\r\nexport class RecordValidator extends BaseValidator {\r\n public constructor(\r\n public valueValidator: BaseValidator,\r\n errorMessage?: string,\r\n ) {\r\n super();\r\n this.addMutableRule(objectRule, errorMessage);\r\n }\r\n\r\n /**\r\n * Validate it as plain object\r\n */\r\n public plainObject(errorMessage?: string) {\r\n return this.addRule(plainObjectRule, errorMessage);\r\n }\r\n\r\n /**\r\n * Check if value is a plain object type\r\n */\r\n public matchesType(value: any): boolean {\r\n return isPlainObject(value);\r\n }\r\n\r\n /**\r\n * Clone the validator\r\n */\r\n public override clone(): this {\r\n const cloned = super.clone();\r\n cloned.valueValidator = this.valueValidator.clone();\r\n return cloned;\r\n }\r\n\r\n /**\r\n * Validate record - iterate all keys and validate each value\r\n *\r\n * Absent input (and absent without `.default()`) propagates as `data: undefined`\r\n * so the parent ObjectValidator can omit the key. Without this, optional record\r\n * fields would silently materialise as `{}` in the validated output.\r\n */\r\n public async validate(data: any, context: SchemaContext): Promise<ValidationResult> {\r\n // Apply default when absent, then mutate. Mirrors BaseValidator's\r\n // `valueForRules = data ?? this.getDefaultValue()` so `.default({...})`\r\n // works on records too.\r\n const valueForRules = data ?? this.getDefaultValue();\r\n const mutatedData = await this.mutate(valueForRules, context);\r\n\r\n const result = await super.validate(data, context);\r\n\r\n if (result.isValid === false) return result;\r\n\r\n // Nothing to iterate for absent (no default) or null (nullable) inputs —\r\n // propagate so the parent ObjectValidator can omit the key.\r\n if (mutatedData === undefined || mutatedData === null) return result;\r\n\r\n // Defensive: type rule (objectRule) should have failed for non-objects.\r\n if (!isPlainObject(mutatedData)) return result;\r\n\r\n const errors: ValidationResult[\"errors\"] = [];\r\n const keys = Object.keys(mutatedData);\r\n\r\n // Validate all values in parallel\r\n const validationPromises = keys.map(async (key) => {\r\n const childContext: SchemaContext = {\r\n ...context,\r\n parent: mutatedData,\r\n value: mutatedData[key],\r\n key,\r\n path: setKeyPath(context.path, key),\r\n };\r\n\r\n const childResult = await this.valueValidator.validate(mutatedData[key], childContext);\r\n\r\n // Update mutated data with validated result\r\n mutatedData[key] = childResult.data;\r\n\r\n // Collect errors from this value\r\n if (childResult.isValid === false) {\r\n errors.push(...childResult.errors);\r\n }\r\n });\r\n\r\n await Promise.all(validationPromises);\r\n\r\n return {\r\n isValid: errors.length === 0,\r\n errors,\r\n data: await this.startTransformationPipeline(mutatedData, context),\r\n };\r\n }\r\n\r\n /**\r\n * @inheritdoc\r\n *\r\n * Generates `{ type: \"object\", additionalProperties: <valueSchema> }` —\r\n * the standard JSON Schema for a dictionary/map with homogeneous values.\r\n *\r\n * @example\r\n * ```ts\r\n * v.record(v.string()).toJsonSchema(\"draft-2020-12\")\r\n * // → { type: \"object\", additionalProperties: { type: \"string\" } }\r\n *\r\n * v.record(v.union([v.string(), v.number()])).toJsonSchema(\"draft-2020-12\")\r\n * // → { type: \"object\", additionalProperties: { oneOf: [{ type: \"string\" }, { type: \"number\" }] } }\r\n * ```\r\n */\r\n public override toJsonSchema(target: JsonSchemaTarget = \"draft-2020-12\"): JsonSchemaResult {\r\n const schema: JsonSchemaResult = {\r\n type: \"object\",\r\n additionalProperties: this.valueValidator.toJsonSchema(target),\r\n };\r\n\r\n if (this.isNullable) applyNullable(schema, target);\r\n\r\n return schema;\r\n }\r\n}\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAsBA,IAAa,kBAAb,cAAqC,cAAc;CACjD,AAAO,YACL,AAAO,gBACP,cACA;EACA,MAAM;EAHC;EAIP,KAAK,eAAe,YAAY,YAAY;CAC9C;;;;CAKA,AAAO,YAAY,cAAuB;EACxC,OAAO,KAAK,QAAQ,iBAAiB,YAAY;CACnD;;;;CAKA,AAAO,YAAY,OAAqB;EACtC,OAAO,cAAc,KAAK;CAC5B;;;;CAKA,AAAgB,QAAc;EAC5B,MAAM,SAAS,MAAM,MAAM;EAC3B,OAAO,iBAAiB,KAAK,eAAe,MAAM;EAClD,OAAO;CACT;;;;;;;;CASA,MAAa,SAAS,MAAW,SAAmD;EAIlF,MAAM,gBAAgB,QAAQ,KAAK,gBAAgB;EACnD,MAAM,cAAc,MAAM,KAAK,OAAO,eAAe,OAAO;EAE5D,MAAM,SAAS,MAAM,MAAM,SAAS,MAAM,OAAO;EAEjD,IAAI,OAAO,YAAY,OAAO,OAAO;EAIrC,IAAI,gBAAgB,UAAa,gBAAgB,MAAM,OAAO;EAG9D,IAAI,CAAC,cAAc,WAAW,GAAG,OAAO;EAExC,MAAM,SAAqC,CAAC;EAI5C,MAAM,qBAHO,OAAO,KAAK,WAGK,EAAE,IAAI,OAAO,QAAQ;GACjD,MAAM,eAA8B;IAClC,GAAG;IACH,QAAQ;IACR,OAAO,YAAY;IACnB;IACA,MAAM,WAAW,QAAQ,MAAM,GAAG;GACpC;GAEA,MAAM,cAAc,MAAM,KAAK,eAAe,SAAS,YAAY,MAAM,YAAY;GAGrF,YAAY,OAAO,YAAY;GAG/B,IAAI,YAAY,YAAY,OAC1B,OAAO,KAAK,GAAG,YAAY,MAAM;EAErC,CAAC;EAED,MAAM,QAAQ,IAAI,kBAAkB;EAEpC,OAAO;GACL,SAAS,OAAO,WAAW;GAC3B;GACA,MAAM,MAAM,KAAK,4BAA4B,aAAa,OAAO;EACnE;CACF;;;;;;;;;;;;;;;;CAiBA,AAAgB,aAAa,SAA2B,iBAAmC;EACzF,MAAM,SAA2B;GAC/B,MAAM;GACN,sBAAsB,KAAK,eAAe,aAAa,MAAM;EAC/D;EAEA,IAAI,KAAK,YAAY,cAAc,QAAQ,MAAM;EAEjD,OAAO;CACT;AACF"}
@@ -1,7 +1,7 @@
1
1
  import { JsonSchemaResult, JsonSchemaTarget } from "../standard-schema/json-schema.mjs";
2
2
  import { PrimitiveValidator } from "./primitive-validator.mjs";
3
3
 
4
- //#region seal/src/validators/scalar-validator.d.ts
4
+ //#region ../seal/src/validators/scalar-validator.d.ts
5
5
  /**
6
6
  * Scalar validator class
7
7
  *
@@ -1 +1 @@
1
- {"version":3,"file":"scalar-validator.d.mts","names":[],"sources":["C:/Work/Warlock.js/seal/src/validators/scalar-validator.ts"],"mappings":";;;;;;AA6BA;;;;;;;cAAa,eAAA,SAAwB,kBAAA;cAChB,YAAA;;;;EAoBZ,WAAA,CAAY,KAAA,QAAU,KAAA;EAAA;;;EAOtB,QAAA,CAAA;EAeS;;;EART,QAAA,CAAA;EAesC;;;;EAPtC,QAAA,CAAS,YAAA;EAqBT;;;EAdA,UAAA,CAAW,KAAA,UAAe,KAAA,OAAY,YAAA;EAqBpB;;;EAdlB,cAAA,CAAe,KAAA,UAAe,KAAA,OAAY,YAAA;EAqBX;;;EAd/B,kBAAA,CAAmB,KAAA,UAAe,YAAA;EA6BvB;;;EAtBX,iBAAA,CAAkB,KAAA,U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