@warlock.js/notifications 4.16.0 → 5.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (337) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/cjs/channel_api-CH3DxhRU.cjs +7463 -0
  3. package/cjs/channel_api-CH3DxhRU.cjs.map +1 -0
  4. package/cjs/chunk-fl3r8ClO.cjs +41 -0
  5. package/cjs/index.cjs +1 -1
  6. package/cjs/index.cjs.map +1 -1
  7. package/cjs/rabbitmq-driver-CJtyxjUQ.cjs +3 -0
  8. package/cjs/src-Cus6pYPC.cjs +10981 -0
  9. package/cjs/src-Cus6pYPC.cjs.map +1 -0
  10. package/esm/_virtual/_rolldown/runtime.mjs +32 -0
  11. package/esm/herald/src/communicators/broker-registry.mjs +204 -0
  12. package/esm/herald/src/communicators/broker-registry.mjs.map +1 -0
  13. package/esm/herald/src/communicators/broker.mjs +110 -0
  14. package/esm/herald/src/communicators/broker.mjs.map +1 -0
  15. package/esm/herald/src/communicators/index.mjs +4 -0
  16. package/esm/herald/src/decorators/consumable.mjs +36 -0
  17. package/esm/herald/src/decorators/consumable.mjs.map +1 -0
  18. package/esm/herald/src/decorators/index.mjs +3 -0
  19. package/esm/herald/src/drivers/index.mjs +5 -0
  20. package/esm/herald/src/drivers/rabbitmq/index.mjs +4 -0
  21. package/esm/herald/src/drivers/rabbitmq/rabbitmq-channel.mjs +403 -0
  22. package/esm/herald/src/drivers/rabbitmq/rabbitmq-channel.mjs.map +1 -0
  23. package/esm/herald/src/drivers/rabbitmq/rabbitmq-driver.mjs +303 -0
  24. package/esm/herald/src/drivers/rabbitmq/rabbitmq-driver.mjs.map +1 -0
  25. package/esm/herald/src/index.mjs +16 -0
  26. package/esm/herald/src/message-managers/event-consumer.mjs +76 -0
  27. package/esm/herald/src/message-managers/event-consumer.mjs.map +1 -0
  28. package/esm/herald/src/message-managers/event-message.mjs +85 -0
  29. package/esm/herald/src/message-managers/event-message.mjs.map +1 -0
  30. package/esm/herald/src/message-managers/index.mjs +4 -0
  31. package/esm/herald/src/message-managers/prepare-consumer-subscription.mjs +42 -0
  32. package/esm/herald/src/message-managers/prepare-consumer-subscription.mjs.map +1 -0
  33. package/esm/herald/src/use-case-broadcast.mjs +30 -0
  34. package/esm/herald/src/use-case-broadcast.mjs.map +1 -0
  35. package/esm/herald/src/utils/connect-to-broker.mjs +168 -0
  36. package/esm/herald/src/utils/connect-to-broker.mjs.map +1 -0
  37. package/esm/herald/src/utils/index.mjs +3 -0
  38. package/esm/in-app/in-app.d.mts +3 -3
  39. package/esm/in-app/in-app.d.mts.map +1 -1
  40. package/esm/node_modules/@mongez/reinforcements/esm/Random/_internal.mjs +6 -0
  41. package/esm/node_modules/@mongez/reinforcements/esm/Random/_internal.mjs.map +1 -0
  42. package/esm/node_modules/@mongez/reinforcements/esm/Random/bool.mjs +3 -0
  43. package/esm/node_modules/@mongez/reinforcements/esm/Random/color.mjs +3 -0
  44. package/esm/node_modules/@mongez/reinforcements/esm/Random/date.mjs +3 -0
  45. package/esm/node_modules/@mongez/reinforcements/esm/Random/float.mjs +3 -0
  46. package/esm/node_modules/@mongez/reinforcements/esm/Random/id.mjs +3 -0
  47. package/esm/node_modules/@mongez/reinforcements/esm/Random/int.mjs +3 -0
  48. package/esm/node_modules/@mongez/reinforcements/esm/Random/nanoid.mjs +3 -0
  49. package/esm/node_modules/@mongez/reinforcements/esm/Random/pick.mjs +3 -0
  50. package/esm/node_modules/@mongez/reinforcements/esm/Random/random.mjs +16 -0
  51. package/esm/node_modules/@mongez/reinforcements/esm/Random/sample.mjs +3 -0
  52. package/esm/node_modules/@mongez/reinforcements/esm/Random/string.mjs +3 -0
  53. package/esm/node_modules/@mongez/reinforcements/esm/Random/token.mjs +3 -0
  54. package/esm/node_modules/@mongez/reinforcements/esm/Random/uuid.mjs +3 -0
  55. package/esm/node_modules/@mongez/reinforcements/esm/Random/weighted.mjs +3 -0
  56. package/esm/node_modules/@mongez/reinforcements/esm/async/retry.mjs +3 -0
  57. package/esm/node_modules/@mongez/reinforcements/esm/index.mjs +24 -0
  58. package/esm/node_modules/@mongez/reinforcements/esm/mixed/clone/clone.mjs +82 -0
  59. package/esm/node_modules/@mongez/reinforcements/esm/mixed/clone/clone.mjs.map +1 -0
  60. package/esm/node_modules/@mongez/reinforcements/esm/number/round.mjs +17 -0
  61. package/esm/node_modules/@mongez/reinforcements/esm/number/round.mjs.map +1 -0
  62. package/esm/node_modules/@mongez/reinforcements/esm/object/except.mjs +13 -0
  63. package/esm/node_modules/@mongez/reinforcements/esm/object/except.mjs.map +1 -0
  64. package/esm/node_modules/@mongez/reinforcements/esm/object/get.mjs +18 -0
  65. package/esm/node_modules/@mongez/reinforcements/esm/object/get.mjs.map +1 -0
  66. package/esm/node_modules/@mongez/reinforcements/esm/object/omit.mjs +17 -0
  67. package/esm/node_modules/@mongez/reinforcements/esm/object/omit.mjs.map +1 -0
  68. package/esm/node_modules/@mongez/reinforcements/esm/object/unset.mjs +30 -0
  69. package/esm/node_modules/@mongez/reinforcements/esm/object/unset.mjs.map +1 -0
  70. package/esm/node_modules/@mongez/reinforcements/esm/string/capitalize.mjs +19 -0
  71. package/esm/node_modules/@mongez/reinforcements/esm/string/capitalize.mjs.map +1 -0
  72. package/esm/node_modules/@mongez/reinforcements/esm/string/ltrim.mjs +18 -0
  73. package/esm/node_modules/@mongez/reinforcements/esm/string/ltrim.mjs.map +1 -0
  74. package/esm/node_modules/@mongez/reinforcements/esm/string/readMoreChars.mjs +14 -0
  75. package/esm/node_modules/@mongez/reinforcements/esm/string/readMoreChars.mjs.map +1 -0
  76. package/esm/node_modules/@mongez/reinforcements/esm/string/rtrim.mjs +18 -0
  77. package/esm/node_modules/@mongez/reinforcements/esm/string/rtrim.mjs.map +1 -0
  78. package/esm/node_modules/@mongez/reinforcements/esm/string/toCamelCase.mjs +22 -0
  79. package/esm/node_modules/@mongez/reinforcements/esm/string/toCamelCase.mjs.map +1 -0
  80. package/esm/node_modules/@mongez/reinforcements/esm/string/toKebabCase.mjs +17 -0
  81. package/esm/node_modules/@mongez/reinforcements/esm/string/toKebabCase.mjs.map +1 -0
  82. package/esm/node_modules/@mongez/reinforcements/esm/string/toSnakeCase.mjs +21 -0
  83. package/esm/node_modules/@mongez/reinforcements/esm/string/toSnakeCase.mjs.map +1 -0
  84. package/esm/node_modules/@mongez/reinforcements/esm/string/toStudlyCase.mjs +21 -0
  85. package/esm/node_modules/@mongez/reinforcements/esm/string/toStudlyCase.mjs.map +1 -0
  86. package/esm/node_modules/@mongez/reinforcements/esm/string/trim.mjs +20 -0
  87. package/esm/node_modules/@mongez/reinforcements/esm/string/trim.mjs.map +1 -0
  88. package/esm/node_modules/@mongez/reinforcements/esm/string/ucfirst.mjs +15 -0
  89. package/esm/node_modules/@mongez/reinforcements/esm/string/ucfirst.mjs.map +1 -0
  90. package/esm/node_modules/@mongez/reinforcements/esm/string/words.mjs +25 -0
  91. package/esm/node_modules/@mongez/reinforcements/esm/string/words.mjs.map +1 -0
  92. package/esm/node_modules/@mongez/reinforcements/esm/utils/escapeRegex.mjs +11 -0
  93. package/esm/node_modules/@mongez/reinforcements/esm/utils/escapeRegex.mjs.map +1 -0
  94. package/esm/node_modules/@mongez/reinforcements/esm/utils/lazy.mjs +100 -0
  95. package/esm/node_modules/@mongez/reinforcements/esm/utils/lazy.mjs.map +1 -0
  96. package/esm/node_modules/@mongez/reinforcements/esm/utils/tap.mjs +27 -0
  97. package/esm/node_modules/@mongez/reinforcements/esm/utils/tap.mjs.map +1 -0
  98. package/esm/node_modules/@mongez/supportive-is/esm/index.mjs +353 -0
  99. package/esm/node_modules/@mongez/supportive-is/esm/index.mjs.map +1 -0
  100. package/esm/node_modules/amqplib/channel_api.mjs +28 -0
  101. package/esm/node_modules/amqplib/channel_api.mjs.map +1 -0
  102. package/esm/node_modules/amqplib/lib/api_args.mjs +241 -0
  103. package/esm/node_modules/amqplib/lib/api_args.mjs.map +1 -0
  104. package/esm/node_modules/amqplib/lib/bitset.mjs +130 -0
  105. package/esm/node_modules/amqplib/lib/bitset.mjs.map +1 -0
  106. package/esm/node_modules/amqplib/lib/channel.mjs +302 -0
  107. package/esm/node_modules/amqplib/lib/channel.mjs.map +1 -0
  108. package/esm/node_modules/amqplib/lib/channel_model.mjs +206 -0
  109. package/esm/node_modules/amqplib/lib/channel_model.mjs.map +1 -0
  110. package/esm/node_modules/amqplib/lib/codec.mjs +273 -0
  111. package/esm/node_modules/amqplib/lib/codec.mjs.map +1 -0
  112. package/esm/node_modules/amqplib/lib/connect.mjs +143 -0
  113. package/esm/node_modules/amqplib/lib/connect.mjs.map +1 -0
  114. package/esm/node_modules/amqplib/lib/connection.mjs +416 -0
  115. package/esm/node_modules/amqplib/lib/connection.mjs.map +1 -0
  116. package/esm/node_modules/amqplib/lib/credentials.mjs +50 -0
  117. package/esm/node_modules/amqplib/lib/credentials.mjs.map +1 -0
  118. package/esm/node_modules/amqplib/lib/defs.mjs +4600 -0
  119. package/esm/node_modules/amqplib/lib/defs.mjs.map +1 -0
  120. package/esm/node_modules/amqplib/lib/error.mjs +29 -0
  121. package/esm/node_modules/amqplib/lib/error.mjs.map +1 -0
  122. package/esm/node_modules/amqplib/lib/format.mjs +28 -0
  123. package/esm/node_modules/amqplib/lib/format.mjs.map +1 -0
  124. package/esm/node_modules/amqplib/lib/frame.mjs +130 -0
  125. package/esm/node_modules/amqplib/lib/frame.mjs.map +1 -0
  126. package/esm/node_modules/amqplib/lib/heartbeat.mjs +40 -0
  127. package/esm/node_modules/amqplib/lib/heartbeat.mjs.map +1 -0
  128. package/esm/node_modules/amqplib/lib/mux.mjs +86 -0
  129. package/esm/node_modules/amqplib/lib/mux.mjs.map +1 -0
  130. package/esm/node_modules/amqplib/package.mjs +41 -0
  131. package/esm/node_modules/amqplib/package.mjs.map +1 -0
  132. package/esm/node_modules/buffer-more-ints/buffer-more-ints.mjs +360 -0
  133. package/esm/node_modules/buffer-more-ints/buffer-more-ints.mjs.map +1 -0
  134. package/esm/node_modules/dayjs/dayjs.min.mjs +305 -0
  135. package/esm/node_modules/dayjs/dayjs.min.mjs.map +1 -0
  136. package/esm/node_modules/querystringify/index.mjs +80 -0
  137. package/esm/node_modules/querystringify/index.mjs.map +1 -0
  138. package/esm/node_modules/requires-port/index.mjs +35 -0
  139. package/esm/node_modules/requires-port/index.mjs.map +1 -0
  140. package/esm/node_modules/url-parse/index.mjs +388 -0
  141. package/esm/node_modules/url-parse/index.mjs.map +1 -0
  142. package/esm/queue/load-herald.mjs +1 -1
  143. package/esm/seal/src/config.mjs +15 -0
  144. package/esm/seal/src/config.mjs.map +1 -0
  145. package/esm/seal/src/factory/index.mjs +4 -0
  146. package/esm/seal/src/factory/validate.mjs +34 -0
  147. package/esm/seal/src/factory/validate.mjs.map +1 -0
  148. package/esm/seal/src/factory/validators.mjs +132 -0
  149. package/esm/seal/src/factory/validators.mjs.map +1 -0
  150. package/esm/seal/src/helpers/date-helpers.mjs +24 -0
  151. package/esm/seal/src/helpers/date-helpers.mjs.map +1 -0
  152. package/esm/seal/src/helpers/get-field-value.mjs +46 -0
  153. package/esm/seal/src/helpers/get-field-value.mjs.map +1 -0
  154. package/esm/seal/src/helpers/index.mjs +6 -0
  155. package/esm/seal/src/helpers/is-empty-value.mjs +10 -0
  156. package/esm/seal/src/helpers/is-empty-value.mjs.map +1 -0
  157. package/esm/seal/src/helpers/path-helpers.mjs +12 -0
  158. package/esm/seal/src/helpers/path-helpers.mjs.map +1 -0
  159. package/esm/seal/src/helpers/validation-helpers.mjs +72 -0
  160. package/esm/seal/src/helpers/validation-helpers.mjs.map +1 -0
  161. package/esm/seal/src/index.mjs +87 -0
  162. package/esm/seal/src/mutators/array-mutators.mjs +32 -0
  163. package/esm/seal/src/mutators/array-mutators.mjs.map +1 -0
  164. package/esm/seal/src/mutators/date-mutators.mjs +94 -0
  165. package/esm/seal/src/mutators/date-mutators.mjs.map +1 -0
  166. package/esm/seal/src/mutators/index.mjs +8 -0
  167. package/esm/seal/src/mutators/number-mutators.mjs +52 -0
  168. package/esm/seal/src/mutators/number-mutators.mjs.map +1 -0
  169. package/esm/seal/src/mutators/object-mutators.mjs +30 -0
  170. package/esm/seal/src/mutators/object-mutators.mjs.map +1 -0
  171. package/esm/seal/src/mutators/scalar-mutators.mjs +9 -0
  172. package/esm/seal/src/mutators/scalar-mutators.mjs.map +1 -0
  173. package/esm/seal/src/mutators/string-mutators.mjs +186 -0
  174. package/esm/seal/src/mutators/string-mutators.mjs.map +1 -0
  175. package/esm/seal/src/rules/array/array-rules.mjs +41 -0
  176. package/esm/seal/src/rules/array/array-rules.mjs.map +1 -0
  177. package/esm/seal/src/rules/array/index.mjs +3 -0
  178. package/esm/seal/src/rules/color/color-rules.mjs +104 -0
  179. package/esm/seal/src/rules/color/color-rules.mjs.map +1 -0
  180. package/esm/seal/src/rules/color/index.mjs +3 -0
  181. package/esm/seal/src/rules/common/enum.mjs +77 -0
  182. package/esm/seal/src/rules/common/enum.mjs.map +1 -0
  183. package/esm/seal/src/rules/common/equals-field-rules.mjs +42 -0
  184. package/esm/seal/src/rules/common/equals-field-rules.mjs.map +1 -0
  185. package/esm/seal/src/rules/common/index.mjs +8 -0
  186. package/esm/seal/src/rules/common/instanceof.mjs +23 -0
  187. package/esm/seal/src/rules/common/instanceof.mjs.map +1 -0
  188. package/esm/seal/src/rules/common/literal.mjs +31 -0
  189. package/esm/seal/src/rules/common/literal.mjs.map +1 -0
  190. package/esm/seal/src/rules/common/type-rules.mjs +97 -0
  191. package/esm/seal/src/rules/common/type-rules.mjs.map +1 -0
  192. package/esm/seal/src/rules/common/unknown-key.mjs +25 -0
  193. package/esm/seal/src/rules/common/unknown-key.mjs.map +1 -0
  194. package/esm/seal/src/rules/conditional/forbidden-if-rules.mjs +116 -0
  195. package/esm/seal/src/rules/conditional/forbidden-if-rules.mjs.map +1 -0
  196. package/esm/seal/src/rules/conditional/index.mjs +12 -0
  197. package/esm/seal/src/rules/conditional/present-if-rules.mjs +97 -0
  198. package/esm/seal/src/rules/conditional/present-if-rules.mjs.map +1 -0
  199. package/esm/seal/src/rules/conditional/present-unless-rules.mjs +30 -0
  200. package/esm/seal/src/rules/conditional/present-unless-rules.mjs.map +1 -0
  201. package/esm/seal/src/rules/conditional/present-with-rules.mjs +76 -0
  202. package/esm/seal/src/rules/conditional/present-with-rules.mjs.map +1 -0
  203. package/esm/seal/src/rules/conditional/present-without-rules.mjs +76 -0
  204. package/esm/seal/src/rules/conditional/present-without-rules.mjs.map +1 -0
  205. package/esm/seal/src/rules/conditional/required-if-rules.mjs +204 -0
  206. package/esm/seal/src/rules/conditional/required-if-rules.mjs.map +1 -0
  207. package/esm/seal/src/rules/conditional/required-unless-rules.mjs +31 -0
  208. package/esm/seal/src/rules/conditional/required-unless-rules.mjs.map +1 -0
  209. package/esm/seal/src/rules/conditional/required-when-rule.mjs +32 -0
  210. package/esm/seal/src/rules/conditional/required-when-rule.mjs.map +1 -0
  211. package/esm/seal/src/rules/conditional/required-with-rules.mjs +67 -0
  212. package/esm/seal/src/rules/conditional/required-with-rules.mjs.map +1 -0
  213. package/esm/seal/src/rules/conditional/required-without-rules.mjs +67 -0
  214. package/esm/seal/src/rules/conditional/required-without-rules.mjs.map +1 -0
  215. package/esm/seal/src/rules/core/equal.mjs +22 -0
  216. package/esm/seal/src/rules/core/equal.mjs.map +1 -0
  217. package/esm/seal/src/rules/core/forbidden.mjs +20 -0
  218. package/esm/seal/src/rules/core/forbidden.mjs.map +1 -0
  219. package/esm/seal/src/rules/core/index.mjs +7 -0
  220. package/esm/seal/src/rules/core/required.mjs +36 -0
  221. package/esm/seal/src/rules/core/required.mjs.map +1 -0
  222. package/esm/seal/src/rules/core/union.mjs +30 -0
  223. package/esm/seal/src/rules/core/union.mjs.map +1 -0
  224. package/esm/seal/src/rules/core/when.mjs +37 -0
  225. package/esm/seal/src/rules/core/when.mjs.map +1 -0
  226. package/esm/seal/src/rules/date/date-comparison-rules.mjs +78 -0
  227. package/esm/seal/src/rules/date/date-comparison-rules.mjs.map +1 -0
  228. package/esm/seal/src/rules/date/date-day-rules.mjs +49 -0
  229. package/esm/seal/src/rules/date/date-day-rules.mjs.map +1 -0
  230. package/esm/seal/src/rules/date/date-field-comparison-rules.mjs +82 -0
  231. package/esm/seal/src/rules/date/date-field-comparison-rules.mjs.map +1 -0
  232. package/esm/seal/src/rules/date/date-period-rules.mjs +399 -0
  233. package/esm/seal/src/rules/date/date-period-rules.mjs.map +1 -0
  234. package/esm/seal/src/rules/date/date-relative-rules.mjs +55 -0
  235. package/esm/seal/src/rules/date/date-relative-rules.mjs.map +1 -0
  236. package/esm/seal/src/rules/date/date-special-rules.mjs +58 -0
  237. package/esm/seal/src/rules/date/date-special-rules.mjs.map +1 -0
  238. package/esm/seal/src/rules/date/date.mjs +235 -0
  239. package/esm/seal/src/rules/date/date.mjs.map +1 -0
  240. package/esm/seal/src/rules/date/index.mjs +9 -0
  241. package/esm/seal/src/rules/file/dimensions.mjs +3 -0
  242. package/esm/seal/src/rules/file/file-size.mjs +3 -0
  243. package/esm/seal/src/rules/file/index.mjs +4 -0
  244. package/esm/seal/src/rules/index.mjs +54 -0
  245. package/esm/seal/src/rules/length/index.mjs +3 -0
  246. package/esm/seal/src/rules/length/length-rules.mjs +98 -0
  247. package/esm/seal/src/rules/length/length-rules.mjs.map +1 -0
  248. package/esm/seal/src/rules/number/index.mjs +3 -0
  249. package/esm/seal/src/rules/number/number-rules.mjs +197 -0
  250. package/esm/seal/src/rules/number/number-rules.mjs.map +1 -0
  251. package/esm/seal/src/rules/scalar/accepted-rule.mjs +116 -0
  252. package/esm/seal/src/rules/scalar/accepted-rule.mjs.map +1 -0
  253. package/esm/seal/src/rules/scalar/declined-rule.mjs +116 -0
  254. package/esm/seal/src/rules/scalar/declined-rule.mjs.map +1 -0
  255. package/esm/seal/src/rules/scalar/index.mjs +4 -0
  256. package/esm/seal/src/rules/string/alpha.mjs +41 -0
  257. package/esm/seal/src/rules/string/alpha.mjs.map +1 -0
  258. package/esm/seal/src/rules/string/credit-card.mjs +32 -0
  259. package/esm/seal/src/rules/string/credit-card.mjs.map +1 -0
  260. package/esm/seal/src/rules/string/email.mjs +20 -0
  261. package/esm/seal/src/rules/string/email.mjs.map +1 -0
  262. package/esm/seal/src/rules/string/id-formats.mjs +104 -0
  263. package/esm/seal/src/rules/string/id-formats.mjs.map +1 -0
  264. package/esm/seal/src/rules/string/index.mjs +13 -0
  265. package/esm/seal/src/rules/string/ip.mjs +66 -0
  266. package/esm/seal/src/rules/string/ip.mjs.map +1 -0
  267. package/esm/seal/src/rules/string/matches.mjs +4 -0
  268. package/esm/seal/src/rules/string/pattern.mjs +20 -0
  269. package/esm/seal/src/rules/string/pattern.mjs.map +1 -0
  270. package/esm/seal/src/rules/string/string-comparison.mjs +56 -0
  271. package/esm/seal/src/rules/string/string-comparison.mjs.map +1 -0
  272. package/esm/seal/src/rules/string/strong-password-rule.mjs +31 -0
  273. package/esm/seal/src/rules/string/strong-password-rule.mjs.map +1 -0
  274. package/esm/seal/src/rules/string/url.mjs +23 -0
  275. package/esm/seal/src/rules/string/url.mjs.map +1 -0
  276. package/esm/seal/src/rules/string/without-whitespace.mjs +19 -0
  277. package/esm/seal/src/rules/string/without-whitespace.mjs.map +1 -0
  278. package/esm/seal/src/standard-schema/json-schema.mjs +81 -0
  279. package/esm/seal/src/standard-schema/json-schema.mjs.map +1 -0
  280. package/esm/seal/src/standard-schema/map-result.mjs +26 -0
  281. package/esm/seal/src/standard-schema/map-result.mjs.map +1 -0
  282. package/esm/seal/src/types/date-types.mjs +17 -0
  283. package/esm/seal/src/types/date-types.mjs.map +1 -0
  284. package/esm/seal/src/validators/any-validator.mjs +38 -0
  285. package/esm/seal/src/validators/any-validator.mjs.map +1 -0
  286. package/esm/seal/src/validators/array-validator.mjs +177 -0
  287. package/esm/seal/src/validators/array-validator.mjs.map +1 -0
  288. package/esm/seal/src/validators/base-validator.mjs +691 -0
  289. package/esm/seal/src/validators/base-validator.mjs.map +1 -0
  290. package/esm/seal/src/validators/boolean-validator.mjs +126 -0
  291. package/esm/seal/src/validators/boolean-validator.mjs.map +1 -0
  292. package/esm/seal/src/validators/computed-validator.mjs +118 -0
  293. package/esm/seal/src/validators/computed-validator.mjs.map +1 -0
  294. package/esm/seal/src/validators/date-validator.mjs +639 -0
  295. package/esm/seal/src/validators/date-validator.mjs.map +1 -0
  296. package/esm/seal/src/validators/discriminated-union-validator.mjs +129 -0
  297. package/esm/seal/src/validators/discriminated-union-validator.mjs.map +1 -0
  298. package/esm/seal/src/validators/float-validator.mjs +18 -0
  299. package/esm/seal/src/validators/float-validator.mjs.map +1 -0
  300. package/esm/seal/src/validators/index.mjs +28 -0
  301. package/esm/seal/src/validators/instanceof-validator.mjs +64 -0
  302. package/esm/seal/src/validators/instanceof-validator.mjs.map +1 -0
  303. package/esm/seal/src/validators/int-validator.mjs +30 -0
  304. package/esm/seal/src/validators/int-validator.mjs.map +1 -0
  305. package/esm/seal/src/validators/lazy-validator.mjs +87 -0
  306. package/esm/seal/src/validators/lazy-validator.mjs.map +1 -0
  307. package/esm/seal/src/validators/literal-validator.mjs +71 -0
  308. package/esm/seal/src/validators/literal-validator.mjs.map +1 -0
  309. package/esm/seal/src/validators/managed-validator.mjs +39 -0
  310. package/esm/seal/src/validators/managed-validator.mjs.map +1 -0
  311. package/esm/seal/src/validators/methods/equality-conditional-methods.mjs +129 -0
  312. package/esm/seal/src/validators/methods/equality-conditional-methods.mjs.map +1 -0
  313. package/esm/seal/src/validators/methods/forbidden-methods.mjs +131 -0
  314. package/esm/seal/src/validators/methods/forbidden-methods.mjs.map +1 -0
  315. package/esm/seal/src/validators/methods/present-methods.mjs +235 -0
  316. package/esm/seal/src/validators/methods/present-methods.mjs.map +1 -0
  317. package/esm/seal/src/validators/methods/required-methods.mjs +347 -0
  318. package/esm/seal/src/validators/methods/required-methods.mjs.map +1 -0
  319. package/esm/seal/src/validators/number-validator.mjs +310 -0
  320. package/esm/seal/src/validators/number-validator.mjs.map +1 -0
  321. package/esm/seal/src/validators/numeric-validator.mjs +27 -0
  322. package/esm/seal/src/validators/numeric-validator.mjs.map +1 -0
  323. package/esm/seal/src/validators/object-validator.mjs +442 -0
  324. package/esm/seal/src/validators/object-validator.mjs.map +1 -0
  325. package/esm/seal/src/validators/primitive-validator.mjs +89 -0
  326. package/esm/seal/src/validators/primitive-validator.mjs.map +1 -0
  327. package/esm/seal/src/validators/record-validator.mjs +112 -0
  328. package/esm/seal/src/validators/record-validator.mjs.map +1 -0
  329. package/esm/seal/src/validators/scalar-validator.mjs +172 -0
  330. package/esm/seal/src/validators/scalar-validator.mjs.map +1 -0
  331. package/esm/seal/src/validators/string-validator.mjs +459 -0
  332. package/esm/seal/src/validators/string-validator.mjs.map +1 -0
  333. package/esm/seal/src/validators/tuple-validator.mjs +134 -0
  334. package/esm/seal/src/validators/tuple-validator.mjs.map +1 -0
  335. package/esm/seal/src/validators/union-validator.mjs +66 -0
  336. package/esm/seal/src/validators/union-validator.mjs.map +1 -0
  337. package/package.json +5 -5
@@ -0,0 +1,691 @@
1
+ import { clone } from "../../../node_modules/@mongez/reinforcements/esm/mixed/clone/clone.mjs";
2
+ import "../../../node_modules/@mongez/reinforcements/esm/index.mjs";
3
+ import { validate } from "../factory/validate.mjs";
4
+ import { VALID_RULE, invalidRule } from "../helpers/validation-helpers.mjs";
5
+ import "../helpers/index.mjs";
6
+ import { isEmptyValue } from "../helpers/is-empty-value.mjs";
7
+ import { requiredRule } from "../rules/core/required.mjs";
8
+ import { mapToStandardResult } from "../standard-schema/map-result.mjs";
9
+
10
+ //#region ../seal/src/validators/base-validator.ts
11
+ /**
12
+ * Base validator class - foundation for all validators
13
+ */
14
+ var BaseValidator = class {
15
+ rules = [];
16
+ mutators = [];
17
+ defaultValue;
18
+ description;
19
+ shouldOmit = false;
20
+ isNullable = false;
21
+ isMutable = false;
22
+ /**
23
+ * Catch state — when `hasCatch` is true and validation fails, `catchValue`
24
+ * (or its callback result) substitutes for the failed value, and the public
25
+ * result reports `isValid: true` with no errors.
26
+ *
27
+ * See `.catch()` for semantics and the v1 scope (leaf-only).
28
+ */
29
+ catchValue;
30
+ hasCatch = false;
31
+ /**
32
+ * Whether the field is optional.
33
+ * - false (default): field is required unless a requiredRule governs the condition.
34
+ * - true: field can be absent or empty — set by calling .optional().
35
+ *
36
+ * Also used as a TypeScript literal brand via the optional() return type.
37
+ */
38
+ isOptional = false;
39
+ /**
40
+ * The single required-condition rule for this field.
41
+ * - null: field uses strict default (always required when not optional).
42
+ * - set: the rule governs when the field is required (e.g., requiredIf).
43
+ *
44
+ * Stored separately from rules[] and prepended at validate() time.
45
+ */
46
+ requiredRule = this.createRule(requiredRule);
47
+ /**
48
+ * Pipeline to transform the mutated/original data before returning it
49
+ */
50
+ dataTransformers = [];
51
+ /**
52
+ * Attributes text to be replaced on translations
53
+ * If the value is an object, it will be used as the attributes list for the rule
54
+ * If the value is a string, it will be used as the attributes list for the rule
55
+ */
56
+ attributesText = {};
57
+ /**
58
+ * Attributed that will be always using the attribute translator
59
+ */
60
+ translatedAttributes = {};
61
+ /**
62
+ * Mark the validator as mutable
63
+ */
64
+ get mutable() {
65
+ this.isMutable = true;
66
+ return this;
67
+ }
68
+ /**
69
+ * Mark the validator as immutable
70
+ */
71
+ get immutable() {
72
+ this.isMutable = false;
73
+ return this;
74
+ }
75
+ /**
76
+ * Get the instance to apply changes to.
77
+ * By default (immutable), returns a clone so the original is unchanged.
78
+ * When `.mutable` is set, returns `this` to mutate in place.
79
+ */
80
+ get instance() {
81
+ return this.isMutable ? this : this.clone();
82
+ }
83
+ /**
84
+ * Get the default value
85
+ * Supports lazy evaluation via callbacks
86
+ */
87
+ getDefaultValue() {
88
+ return typeof this.defaultValue === "function" ? this.defaultValue() : this.defaultValue;
89
+ }
90
+ /**
91
+ * Allow null as a valid value.
92
+ *
93
+ * Brands the return type with `{ isNullable: true }` so `Infer<>` widens
94
+ * the inferred output to include `| null`.
95
+ */
96
+ nullable() {
97
+ const instance = this.instance;
98
+ instance.isNullable = true;
99
+ return instance;
100
+ }
101
+ /**
102
+ * Explicitly disallow null values after calling nullable.
103
+ *
104
+ * Brands the return type with `{ isNullable: false }` to cancel any prior
105
+ * `.nullable()` at the type level.
106
+ */
107
+ notNullable() {
108
+ const instance = this.instance;
109
+ instance.isNullable = false;
110
+ return instance;
111
+ }
112
+ /**
113
+ * Add transformer with optional options
114
+ *
115
+ * @param transform - The transformer callback function
116
+ * @param options - Optional options to pass to the transformer
117
+ *
118
+ * @example
119
+ * ```ts
120
+ * // Without options
121
+ * v.date().addTransformer(data => data.toISOString())
122
+ *
123
+ * // With options
124
+ * v.date().addTransformer(
125
+ * (data, { options }) => dayjs(data).format(options.format),
126
+ * { format: 'YYYY-MM-DD' }
127
+ * )
128
+ * ```
129
+ */
130
+ addTransformer(transform, options = {}) {
131
+ const instance = this.instance;
132
+ instance.addMutableTransformer(transform, options);
133
+ return instance;
134
+ }
135
+ /**
136
+ * Add transformer with optional options
137
+ *
138
+ * @param transform - The transformer callback function
139
+ * @param options - Optional options to pass to the transformer
140
+ *
141
+ * @example
142
+ * ```ts
143
+ * // Without options
144
+ * v.date().addTransformer(data => data.toISOString())
145
+ *
146
+ * // With options
147
+ * v.date().addTransformer(
148
+ * (data, { options }) => dayjs(data).format(options.format),
149
+ * { format: 'YYYY-MM-DD' }
150
+ * )
151
+ * ```
152
+ */
153
+ addMutableTransformer(transform, options = {}) {
154
+ this.dataTransformers.push({
155
+ transform,
156
+ options
157
+ });
158
+ }
159
+ /**
160
+ * Transform the output value - simple one-time transformation
161
+ *
162
+ * @param callback - Simple callback receiving data and context
163
+ *
164
+ * @example
165
+ * ```ts
166
+ * // Simple transformation
167
+ * v.string().outputAs(data => data.toUpperCase())
168
+ *
169
+ * // With context
170
+ * v.string().outputAs((data, context) => {
171
+ * console.log(`Transforming ${context.path}`);
172
+ * return data.toLowerCase();
173
+ * })
174
+ * ```
175
+ */
176
+ outputAs(callback) {
177
+ return this.addTransformer((data, { context }) => callback(data, context));
178
+ }
179
+ /**
180
+ * Transform output to JSON string
181
+ *
182
+ * Works with any validator type (string, number, date, object, array, etc.)
183
+ *
184
+ * @param indent - Optional indentation for pretty printing (default: 0 for compact)
185
+ *
186
+ * @example
187
+ * ```ts
188
+ * // Compact JSON
189
+ * v.object({ name: v.string() }).toJSON()
190
+ * // Output: '{"name":"John"}'
191
+ *
192
+ * // Pretty-printed JSON
193
+ * v.array(v.object({...})).toJSON(2)
194
+ * // Output:
195
+ * // [
196
+ * // {
197
+ * // "name": "John"
198
+ * // }
199
+ * // ]
200
+ *
201
+ * // Works with any type
202
+ * v.string().toJSON() // '"hello"'
203
+ * v.number().toJSON() // '42'
204
+ * v.date().toJSON() // '"2024-10-26T00:00:00.000Z"'
205
+ * ```
206
+ *
207
+ * @category Transformer
208
+ */
209
+ toJSON(indent) {
210
+ return this.addTransformer((data, { options }) => JSON.stringify(data, null, options.indent), { indent: indent ?? 0 });
211
+ }
212
+ /**
213
+ * Start data transformation pipeline
214
+ * Context is passed at runtime, not stored
215
+ */
216
+ async startTransformationPipeline(data, context) {
217
+ for (const transformer of this.dataTransformers) data = await transformer.transform(data, {
218
+ options: transformer.options,
219
+ context
220
+ });
221
+ return data;
222
+ }
223
+ /**
224
+ * Set attributes text to be replaced on translations
225
+ * If the value is an object, it will be used as the attributes list for the rule
226
+ * If the value is a string, it will be used as the attributes list for the rule
227
+ *
228
+ * @example
229
+ * v.string().attributes({
230
+ * name: "Name",
231
+ * email: "Email",
232
+ * });
233
+ * // Example 2: Add custom attributes for matches
234
+ * v.string().matches("confirmPassword").attributes({
235
+ * matches: {
236
+ * confirmPassword: "Confirm Password",
237
+ * },
238
+ * });
239
+ */
240
+ attributes(attributes) {
241
+ const instance = this.instance;
242
+ for (const key in attributes) instance.attributesText[key] = attributes[key];
243
+ return instance;
244
+ }
245
+ /**
246
+ * Define a lazy getter property for each attribute in the given object and use the config attribute translator
247
+ */
248
+ transAttributes(attributes) {
249
+ const instance = this.instance;
250
+ for (const key in attributes) instance.translatedAttributes[key] = attributes[key];
251
+ return instance;
252
+ }
253
+ /**
254
+ * Add description to the validator
255
+ */
256
+ describe(description) {
257
+ const instance = this.instance;
258
+ instance.description = description;
259
+ return instance;
260
+ }
261
+ /**
262
+ * Check if this validator can handle the given value's type
263
+ * Override this in specific validators to enable type-based routing in union validators
264
+ *
265
+ * Default: returns true (validator will attempt to validate any type)
266
+ *
267
+ * @param value - The value to check
268
+ * @returns True if this validator can handle this type
269
+ *
270
+ * @example
271
+ * ```ts
272
+ * // StringValidator
273
+ * public matchesType(value: any): boolean {
274
+ * return typeof value === 'string';
275
+ * }
276
+ *
277
+ * // Custom FileValidator
278
+ * public matchesType(value: any): boolean {
279
+ * return value instanceof UploadedFile;
280
+ * }
281
+ * ```
282
+ */
283
+ matchesType(_value) {
284
+ return true;
285
+ }
286
+ /**
287
+ * Create a copy of this validator with the same configuration
288
+ * Copies all rules, mutators, transformers, default values, and settings
289
+ *
290
+ * @returns A new validator instance with copied configuration
291
+ *
292
+ * @example
293
+ * ```ts
294
+ * // Create reusable validator templates
295
+ * const baseString = v.string().required().trim().min(3);
296
+ * const emailField = baseString.clone().email();
297
+ * const usernameField = baseString.clone().alphanumeric().max(20);
298
+ *
299
+ * // Works with all validators
300
+ * const positiveInt = v.int().positive().required();
301
+ * const ageField = positiveInt.clone().min(18).max(120);
302
+ * ```
303
+ */
304
+ clone() {
305
+ const Constructor = this.constructor;
306
+ const cloned = Object.create(Constructor.prototype);
307
+ cloned.rules = [...this.rules];
308
+ cloned.mutators = [...this.mutators];
309
+ cloned.dataTransformers = [...this.dataTransformers];
310
+ cloned.defaultValue = this.defaultValue;
311
+ cloned.shouldOmit = this.shouldOmit;
312
+ cloned.description = this.description;
313
+ cloned.attributesText = { ...this.attributesText };
314
+ cloned.isNullable = this.isNullable;
315
+ cloned.isOptional = this.isOptional;
316
+ cloned.requiredRule = this.requiredRule;
317
+ cloned.catchValue = this.catchValue;
318
+ cloned.hasCatch = this.hasCatch;
319
+ return cloned;
320
+ }
321
+ /**
322
+ * @deprecated This method is no longer needed and does nothing.
323
+ * Empty values are now automatically skipped for validation rules by default.
324
+ * Only presence validators (required, present, etc.) will check empty values.
325
+ * You can safely remove this call from your code.
326
+ */
327
+ ignoreEmptyValue(_ignoreEmptyValue = true) {
328
+ return this;
329
+ }
330
+ /**
331
+ * Omit this field from the validated data output
332
+ *
333
+ * Field will still be validated but not included in the final result.
334
+ * Useful for confirmation fields, captcha, terms acceptance, etc.
335
+ *
336
+ * @example
337
+ * ```ts
338
+ * v.object({
339
+ * password: v.string().required(),
340
+ * confirmPassword: v.string().required().sameAs("password").omit(),
341
+ * acceptTerms: v.boolean().required().omit(),
342
+ * });
343
+ * // Output: { password: "..." }
344
+ * // confirmPassword and acceptTerms validated but omitted
345
+ * ```
346
+ */
347
+ omit() {
348
+ const instance = this.instance;
349
+ instance.shouldOmit = true;
350
+ return instance;
351
+ }
352
+ /**
353
+ * @alias omit
354
+ */
355
+ exclude() {
356
+ return this.omit();
357
+ }
358
+ /**
359
+ * Check if this field should be omitted from the output
360
+ */
361
+ isOmitted() {
362
+ return this.shouldOmit;
363
+ }
364
+ /**
365
+ * Add rule to the validator
366
+ */
367
+ addRule(rule, errorMessage, options = {}) {
368
+ const instance = this.instance;
369
+ instance.addMutableRule(rule, errorMessage, options);
370
+ return instance;
371
+ }
372
+ /**
373
+ * Set the required-condition rule for this field.
374
+ *
375
+ * Unlike addRule(), this does NOT push to rules[]. The rule is stored in the
376
+ * dedicated `requiredRule` slot and is prepended to the validation pipeline
377
+ * at runtime. Only one required rule can be active per field — this replaces
378
+ * any previously set required rule.
379
+ *
380
+ * Also marks the field as not optional (isOptional = false).
381
+ *
382
+ * @example
383
+ * ```ts
384
+ * // Used internally by required(), requiredIf(), requiredWith(), etc.
385
+ * BaseValidator.prototype.required = function(msg) {
386
+ * return this.setRequiredRule(requiredRule, msg);
387
+ * };
388
+ * ```
389
+ */
390
+ setRequiredRule(rule, errorMessage, options = {}) {
391
+ const instance = this.instance;
392
+ instance.isOptional = false;
393
+ instance.requiredRule = instance.createRule(rule, errorMessage, options);
394
+ return instance;
395
+ }
396
+ /**
397
+ * Add mutable rule
398
+ */
399
+ addMutableRule(rule, errorMessage, options = {}) {
400
+ const newRule = this.createRule(rule, errorMessage, options);
401
+ this.rules.push(newRule);
402
+ return newRule;
403
+ }
404
+ /**
405
+ * Create new rule
406
+ */
407
+ createRule(rule, errorMessage, options = {}) {
408
+ const newRule = {
409
+ ...clone(rule),
410
+ context: {
411
+ errorMessage,
412
+ options,
413
+ attributesList: this.attributesText,
414
+ translatedAttributes: this.translatedAttributes,
415
+ translationParams: {},
416
+ translatableParams: {}
417
+ }
418
+ };
419
+ if (errorMessage) newRule.errorMessage = errorMessage;
420
+ if (rule.sortOrder === void 0) newRule.sortOrder = this.rules.length + 1;
421
+ return newRule;
422
+ }
423
+ /**
424
+ * Use a custom or pre-built validation rule
425
+ *
426
+ * @param rule - The validation rule to apply
427
+ * @param options - Rule options including errorMessage and any rule-specific options
428
+ *
429
+ * @example
430
+ * ```ts
431
+ * import { hexColorRule } from "@warlock.js/seal";
432
+ *
433
+ * v.string().useRule(hexColorRule, { errorMessage: "Invalid color" });
434
+ * ```
435
+ *
436
+ * @example
437
+ * ```ts
438
+ * // With rule options
439
+ * v.string().useRule(myCustomRule, {
440
+ * customOption: true,
441
+ * errorMessage: "Custom validation failed"
442
+ * });
443
+ * ```
444
+ */
445
+ useRule(rule, options) {
446
+ const { errorMessage, ...ruleOptions } = options || {};
447
+ return this.addRule(rule, errorMessage, ruleOptions);
448
+ }
449
+ /**
450
+ * Define custom rule
451
+ */
452
+ refine(callback) {
453
+ return this.addRule({
454
+ name: "custom",
455
+ async validate(value, context) {
456
+ const result = await callback(value, context);
457
+ if (result) {
458
+ this.context.errorMessage = result;
459
+ return invalidRule(this, context);
460
+ }
461
+ return VALID_RULE;
462
+ }
463
+ });
464
+ }
465
+ /**
466
+ * Add mutator to the validator
467
+ */
468
+ addMutator(mutator, options = {}) {
469
+ const instance = this.instance;
470
+ instance.addMutableMutator(mutator, options);
471
+ return instance;
472
+ }
473
+ /**
474
+ * Add mutable mutator
475
+ */
476
+ addMutableMutator(mutator, options = {}) {
477
+ this.mutators.push({
478
+ mutate: mutator,
479
+ context: {
480
+ options,
481
+ ctx: {}
482
+ }
483
+ });
484
+ }
485
+ /**
486
+ * Set default value for the field. The default is used when the input is
487
+ * absent (`undefined`); it then flows through the rule pipeline.
488
+ *
489
+ * Brands the return type with `{ hasDefault: true }` so `Infer<>` treats
490
+ * the field as guaranteed-present even when chained with `.optional()`.
491
+ */
492
+ default(value) {
493
+ const instance = this.instance;
494
+ instance.defaultValue = value;
495
+ return instance;
496
+ }
497
+ /**
498
+ * Fallback to a value when validation fails.
499
+ *
500
+ * Complementary to `.default()`: `.default(x)` fires when input is **absent**,
501
+ * `.catch(y)` fires when input is **present but invalid**. Combine them when
502
+ * you want both behaviours: `.optional().default(x).catch(y)`.
503
+ *
504
+ * The fallback can be a value or a callback `(errors, originalInput) => fallback`.
505
+ * The callback variant is the only side-channel for the swallowed errors —
506
+ * use it to log/alert before the fallback substitutes.
507
+ *
508
+ * Brands the return type with `{ hasCatch: true }` so `Infer<>` treats the
509
+ * field as guaranteed-present (the catch ensures a value will always exist).
510
+ *
511
+ * **Scope (v1).** Catch is honoured for **leaf validators** (string, number,
512
+ * boolean, date, …) and for fields inside containers. It is a **no-op on
513
+ * container validators themselves** (`v.object`, `v.array`, `v.record`,
514
+ * `v.tuple`, `v.discriminatedUnion`) — those use their own iteration logic
515
+ * that bypasses the catch hook in `BaseValidator.validate()`.
516
+ *
517
+ * @example
518
+ * ```ts
519
+ * v.int().min(0).catch(3) // bad number → 3
520
+ * v.string().in(["us", "eu"]).catch("us") // unknown enum → "us"
521
+ * v.string().catch((errors, input) => {
522
+ * console.warn(`bad user value: ${JSON.stringify(input)}`, errors);
523
+ * return "anonymous";
524
+ * })
525
+ * ```
526
+ */
527
+ catch(fallback) {
528
+ const instance = this.instance;
529
+ instance.catchValue = fallback;
530
+ instance.hasCatch = true;
531
+ return instance;
532
+ }
533
+ /**
534
+ * Mutate the data
535
+ */
536
+ async mutate(data, context) {
537
+ let mutatedData = data;
538
+ for (const mutator of this.mutators) {
539
+ mutator.context.ctx = context;
540
+ mutatedData = await mutator.mutate(mutatedData, mutator.context);
541
+ }
542
+ return mutatedData;
543
+ }
544
+ /**
545
+ * Set the label for the validator that will be matching the :input attribute
546
+ */
547
+ label(label) {
548
+ const instance = this.instance;
549
+ instance.attributesText.input = label;
550
+ return instance;
551
+ }
552
+ /**
553
+ * Validate the data
554
+ */
555
+ async validate(data, context) {
556
+ if (data === null && this.isNullable) return {
557
+ isValid: true,
558
+ errors: [],
559
+ data: null
560
+ };
561
+ const valueForRules = data ?? this.getDefaultValue();
562
+ const mutatedData = await this.mutate(valueForRules, context);
563
+ const errors = [];
564
+ let isValid = true;
565
+ const isFirstErrorOnly = context.configurations?.firstErrorOnly ?? true;
566
+ const isEmpty = isEmptyValue(valueForRules);
567
+ const skipEmptyRules = this.isOptional ? valueForRules === void 0 : isEmpty;
568
+ const rulesToRun = this.requiredRule ? [this.requiredRule, ...this.rules] : this.rules;
569
+ for (const rule of rulesToRun) {
570
+ if ((rule.requiresValue ?? true) && skipEmptyRules) continue;
571
+ this.setRuleAttributesList(rule);
572
+ const result = await rule.validate(mutatedData, context);
573
+ if (result.isValid === false) {
574
+ isValid = false;
575
+ errors.push({
576
+ type: rule.name,
577
+ error: result.error,
578
+ input: result.path ?? context.path
579
+ });
580
+ if (isFirstErrorOnly) break;
581
+ }
582
+ }
583
+ const result = {
584
+ isValid,
585
+ errors,
586
+ data: mutatedData !== void 0 ? await this.startTransformationPipeline(mutatedData, context) : void 0
587
+ };
588
+ if (result.isValid === false && this.hasCatch) return {
589
+ isValid: true,
590
+ errors: [],
591
+ data: typeof this.catchValue === "function" ? await this.catchValue(result.errors, data) : this.catchValue
592
+ };
593
+ return result;
594
+ }
595
+ /**
596
+ * Set rule attributes list
597
+ */
598
+ setRuleAttributesList(rule) {
599
+ rule.context.attributesList = typeof this.attributesText[rule.name] === "object" ? this.attributesText[rule.name] : this.attributesText;
600
+ }
601
+ /**
602
+ * Standard Schema V1 compliance.
603
+ *
604
+ * Allows this validator to be used with any Standard Schema-aware library
605
+ * (OpenAI structured outputs, LangGraph, TanStack Form, Conform, Valibot adapters, etc.)
606
+ * without extra adapters.
607
+ *
608
+ * Delegates to the `validate()` factory so all `configureSeal()` options
609
+ * (translations, firstErrorOnly) are picked up automatically at call time.
610
+ *
611
+ * Includes Standard JSON Schema support via `jsonSchema.input()` / `jsonSchema.output()`.
612
+ *
613
+ * ## How Standard Schema libraries consume this
614
+ *
615
+ * You pass the **schema object itself** to the library — they internally read
616
+ * `schema["~standard"]`. Do NOT pass `schema["~standard"]` directly.
617
+ *
618
+ * @example
619
+ * ```ts
620
+ * const schema = v.object({ name: v.string().required() });
621
+ *
622
+ * // TanStack Form — pass schema, library reads ["~standard"] internally
623
+ * const form = useForm({ validators: { onChange: schema } });
624
+ *
625
+ * // Conform (Remix) — same pattern
626
+ * const [form] = useForm({ onValidate({ formData }) {
627
+ * return parseWithStandardSchema(formData, { schema });
628
+ * }});
629
+ *
630
+ * // Direct validation (lower level — most apps don't need this)
631
+ * const result = await schema["~standard"].validate({ name: "Hasan" });
632
+ * // → { value: { name: "Hasan" } } on success
633
+ * // → { issues: [{ message: "...", path: [{ key: "name" }] }] } on failure
634
+ *
635
+ * // JSON Schema for OpenAI / LangChain tool calling
636
+ * const parameters = schema["~standard"].jsonSchema.input({ target: "openai-strict" });
637
+ * // → { type: "object", properties: {...}, required: [...], additionalProperties: false }
638
+ * ```
639
+ *
640
+ * @note Cross-field rules (sameAs, requiredIf, requiredWith) rely on sibling values
641
+ * available in the full validation context. When called on a standalone scalar validator,
642
+ * sibling data is absent and those rules will not evaluate correctly.
643
+ * Always call on the parent ObjectValidator for full-payload validation.
644
+ */
645
+ get ["~standard"]() {
646
+ return {
647
+ version: 1,
648
+ vendor: "seal",
649
+ types: void 0,
650
+ validate: async (value) => {
651
+ return mapToStandardResult(await validate(this, value));
652
+ },
653
+ jsonSchema: {
654
+ input: (options) => this.toJsonSchema(options.target),
655
+ output: (options) => this.toJsonSchema(options.target)
656
+ }
657
+ };
658
+ }
659
+ /**
660
+ * Generate a JSON Schema representation of this validator.
661
+ *
662
+ * Supports targets: `"draft-2020-12"` (default), `"draft-07"`, `"openapi-3.0"`.
663
+ *
664
+ * Subclasses override this to describe their specific constraints.
665
+ * The base implementation returns `{}` (permissive — accepts anything),
666
+ * which is correct for validators with no representable JSON Schema constraints.
667
+ *
668
+ * @note Rules that cannot be expressed in JSON Schema are silently omitted:
669
+ * - Cross-field rules: sameAs, requiredIf, requiredWith, requiredWithout
670
+ * - Custom callbacks: refine()
671
+ * - Framework-specific runtime rules (core/cascade plugins)
672
+ * These rules still run normally at validation time — only absent from JSON Schema.
673
+ *
674
+ * @example
675
+ * ```ts
676
+ * v.string().min(3).max(50).toJsonSchema("draft-2020-12")
677
+ * // → { type: "string", minLength: 3, maxLength: 50 }
678
+ *
679
+ * v.object({ name: v.string().required(), age: v.int().optional() })
680
+ * .toJsonSchema("draft-07")
681
+ * // → { type: "object", properties: { name: { type: "string" }, age: { type: "integer" } }, required: ["name"] }
682
+ * ```
683
+ */
684
+ toJsonSchema(_target = "draft-2020-12") {
685
+ return {};
686
+ }
687
+ };
688
+
689
+ //#endregion
690
+ export { BaseValidator };
691
+ //# sourceMappingURL=base-validator.mjs.map