@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,204 @@
1
+ import { get } from "../../../../node_modules/@mongez/reinforcements/esm/object/get.mjs";
2
+ import "../../../../node_modules/@mongez/reinforcements/esm/index.mjs";
3
+ import { getFieldValue } from "../../helpers/get-field-value.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
+
8
+ //#region ../seal/src/rules/conditional/required-if-rules.ts
9
+ /**
10
+ * Required if rule - field is required if another field equals a specific value
11
+ * Supports both global and sibling scope
12
+ */
13
+ const requiredIfRule = {
14
+ name: "requiredIf",
15
+ description: "The field is required if another field equals a specific value",
16
+ sortOrder: -2,
17
+ requiresValue: false,
18
+ defaultErrorMessage: "The :input is required",
19
+ async validate(value, context) {
20
+ const { value: expectedValue } = this.context.options;
21
+ const fieldValue = getFieldValue(this, context);
22
+ if (isEmptyValue(value) && fieldValue === expectedValue) {
23
+ this.context.translatableParams.field = this.context.options.field;
24
+ return invalidRule(this, context);
25
+ }
26
+ return VALID_RULE;
27
+ }
28
+ };
29
+ /**
30
+ * Required if empty rule - field is required if another field is empty
31
+ * Supports both global and sibling scope
32
+ */
33
+ const requiredIfEmptyRule = {
34
+ name: "requiredIfEmpty",
35
+ description: "The field is required if :field is empty",
36
+ sortOrder: -2,
37
+ requiresValue: false,
38
+ defaultErrorMessage: "The :input is required",
39
+ async validate(value, context) {
40
+ const fieldValue = getFieldValue(this, context);
41
+ if (isEmptyValue(value) && isEmptyValue(fieldValue)) {
42
+ this.context.translatableParams.field = this.context.options.field;
43
+ return invalidRule(this, context);
44
+ }
45
+ return VALID_RULE;
46
+ }
47
+ };
48
+ /**
49
+ * Required if not empty rule - field is required if another field is not empty
50
+ * Supports both global and sibling scope
51
+ */
52
+ const requiredIfNotEmptyRule = {
53
+ name: "requiredIfNotEmpty",
54
+ description: "The field is required if :field is not empty",
55
+ sortOrder: -2,
56
+ requiresValue: false,
57
+ defaultErrorMessage: "The :input is required",
58
+ async validate(value, context) {
59
+ const fieldValue = getFieldValue(this, context);
60
+ if (isEmptyValue(value) && !isEmptyValue(fieldValue)) {
61
+ this.context.translatableParams.field = this.context.options.field;
62
+ return invalidRule(this, context);
63
+ }
64
+ return VALID_RULE;
65
+ }
66
+ };
67
+ /**
68
+ * Required if in rule - field is required if another field's value is in the given array
69
+ * Supports both global and sibling scope
70
+ */
71
+ const requiredIfInRule = {
72
+ name: "requiredIfIn",
73
+ description: "The field is required if :field value is in the given array",
74
+ sortOrder: -2,
75
+ requiresValue: false,
76
+ defaultErrorMessage: "The :input is required",
77
+ async validate(value, context) {
78
+ const { values } = this.context.options;
79
+ const fieldValue = getFieldValue(this, context);
80
+ if (isEmptyValue(value) && values.includes(fieldValue)) {
81
+ this.context.translatableParams.field = this.context.options.field;
82
+ this.context.translationParams.values = this.context.options.values.join(", ");
83
+ return invalidRule(this, context);
84
+ }
85
+ return VALID_RULE;
86
+ }
87
+ };
88
+ /**
89
+ * Required if not in rule - field is required if another field's value is NOT in the given array
90
+ * Supports both global and sibling scope
91
+ */
92
+ const requiredIfNotInRule = {
93
+ name: "requiredIfNotIn",
94
+ description: "The field is required if another field's value is NOT in the given array",
95
+ sortOrder: -2,
96
+ requiresValue: false,
97
+ defaultErrorMessage: "The :input is required",
98
+ async validate(value, context) {
99
+ const { values } = this.context.options;
100
+ const fieldValue = getFieldValue(this, context);
101
+ if (isEmptyValue(value) && !values.includes(fieldValue)) {
102
+ this.context.translatableParams.field = this.context.options.field;
103
+ this.context.translationParams.values = this.context.options.values.join(", ");
104
+ return invalidRule(this, context);
105
+ }
106
+ return VALID_RULE;
107
+ }
108
+ };
109
+ /**
110
+ * Get multiple field values based on scope
111
+ */
112
+ function getFieldsValues(rule, context) {
113
+ const { fields, scope = "global" } = rule.context.options;
114
+ const source = scope === "sibling" ? context.parent : context.allValues;
115
+ return fields.map((field) => get(source, field));
116
+ }
117
+ /**
118
+ * Required if all empty rule - field is required if ALL specified fields are empty
119
+ * Supports both global and sibling scope
120
+ */
121
+ const requiredIfAllEmptyRule = {
122
+ name: "requiredIfAllEmpty",
123
+ description: "The field is required if all :fields are empty",
124
+ sortOrder: -2,
125
+ requiresValue: false,
126
+ defaultErrorMessage: "The :input is required",
127
+ async validate(value, context) {
128
+ const allEmpty = getFieldsValues(this, context).every((v) => isEmptyValue(v));
129
+ if (isEmptyValue(value) && allEmpty) {
130
+ this.context.options.fields.forEach((field) => {
131
+ this.context.translatableParams.field = field;
132
+ });
133
+ return invalidRule(this, context);
134
+ }
135
+ return VALID_RULE;
136
+ }
137
+ };
138
+ /**
139
+ * Required if any empty rule - field is required if ANY of the specified fields is empty
140
+ * Supports both global and sibling scope
141
+ */
142
+ const requiredIfAnyEmptyRule = {
143
+ name: "requiredIfAnyEmpty",
144
+ description: "The field is required if any of the :fields is empty",
145
+ sortOrder: -2,
146
+ requiresValue: false,
147
+ defaultErrorMessage: "The :input is required",
148
+ async validate(value, context) {
149
+ const anyEmpty = getFieldsValues(this, context).some((v) => isEmptyValue(v));
150
+ if (isEmptyValue(value) && anyEmpty) {
151
+ this.context.options.fields.forEach((field) => {
152
+ this.context.translatableParams.field = field;
153
+ });
154
+ return invalidRule(this, context);
155
+ }
156
+ return VALID_RULE;
157
+ }
158
+ };
159
+ /**
160
+ * Required if all not empty rule - field is required if ALL specified fields are NOT empty
161
+ * Supports both global and sibling scope
162
+ */
163
+ const requiredIfAllNotEmptyRule = {
164
+ name: "requiredIfAllNotEmpty",
165
+ description: "The field is required if all :fields are not empty",
166
+ sortOrder: -2,
167
+ requiresValue: false,
168
+ defaultErrorMessage: "The :input is required",
169
+ async validate(value, context) {
170
+ const allNotEmpty = getFieldsValues(this, context).every((v) => !isEmptyValue(v));
171
+ if (isEmptyValue(value) && allNotEmpty) {
172
+ this.context.options.fields.forEach((field) => {
173
+ this.context.translatableParams.field = field;
174
+ });
175
+ return invalidRule(this, context);
176
+ }
177
+ return VALID_RULE;
178
+ }
179
+ };
180
+ /**
181
+ * Required if any not empty rule - field is required if ANY of the specified fields is NOT empty
182
+ * Supports both global and sibling scope
183
+ */
184
+ const requiredIfAnyNotEmptyRule = {
185
+ name: "requiredIfAnyNotEmpty",
186
+ description: "The field is required if any of the :fields is not empty",
187
+ sortOrder: -2,
188
+ requiresValue: false,
189
+ defaultErrorMessage: "The :input is required",
190
+ async validate(value, context) {
191
+ const anyNotEmpty = getFieldsValues(this, context).some((v) => !isEmptyValue(v));
192
+ if (isEmptyValue(value) && anyNotEmpty) {
193
+ this.context.options.fields.forEach((field) => {
194
+ this.context.translatableParams.field = field;
195
+ });
196
+ return invalidRule(this, context);
197
+ }
198
+ return VALID_RULE;
199
+ }
200
+ };
201
+
202
+ //#endregion
203
+ export { requiredIfAllEmptyRule, requiredIfAllNotEmptyRule, requiredIfAnyEmptyRule, requiredIfAnyNotEmptyRule, requiredIfEmptyRule, requiredIfInRule, requiredIfNotEmptyRule, requiredIfNotInRule, requiredIfRule };
204
+ //# sourceMappingURL=required-if-rules.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"required-if-rules.mjs","names":[],"sources":["../../../../../../../../../../seal/src/rules/conditional/required-if-rules.ts"],"sourcesContent":["import { get } from \"@mongez/reinforcements\";\r\nimport { getFieldValue, invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport { isEmptyValue } from \"../../helpers/is-empty-value\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\n/**\r\n * Required if rule - field is required if another field equals a specific value\r\n * Supports both global and sibling scope\r\n */\r\nexport const requiredIfRule: SchemaRule<{\r\n field: string;\r\n value: any;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"requiredIf\",\r\n description: \"The field is required if another field equals a specific value\",\r\n sortOrder: -2,\r\n requiresValue: false,\r\n defaultErrorMessage: \"The :input is required\",\r\n async validate(value: any, context) {\r\n const { value: expectedValue } = this.context.options;\r\n const fieldValue = getFieldValue(this, context);\r\n\r\n // Field is required if the other field equals the expected value\r\n if (isEmptyValue(value) && fieldValue === expectedValue) {\r\n this.context.translatableParams.field = this.context.options.field;\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Required if empty rule - field is required if another field is empty\r\n * Supports both global and sibling scope\r\n */\r\nexport const requiredIfEmptyRule: SchemaRule<{\r\n field: string;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"requiredIfEmpty\",\r\n description: \"The field is required if :field is empty\",\r\n sortOrder: -2,\r\n requiresValue: false,\r\n defaultErrorMessage: \"The :input is required\",\r\n async validate(value: any, context) {\r\n const fieldValue = getFieldValue(this, context);\r\n\r\n // Field is required if the other field is empty\r\n if (isEmptyValue(value) && isEmptyValue(fieldValue)) {\r\n this.context.translatableParams.field = this.context.options.field;\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Required if not empty rule - field is required if another field is not empty\r\n * Supports both global and sibling scope\r\n */\r\nexport const requiredIfNotEmptyRule: SchemaRule<{\r\n field: string;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"requiredIfNotEmpty\",\r\n description: \"The field is required if :field is not empty\",\r\n sortOrder: -2,\r\n requiresValue: false,\r\n defaultErrorMessage: \"The :input is required\",\r\n async validate(value: any, context) {\r\n const fieldValue = getFieldValue(this, context);\r\n\r\n // Field is required if the other field is not empty\r\n if (isEmptyValue(value) && !isEmptyValue(fieldValue)) {\r\n this.context.translatableParams.field = this.context.options.field;\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Required if in rule - field is required if another field's value is in the given array\r\n * Supports both global and sibling scope\r\n */\r\nexport const requiredIfInRule: SchemaRule<{\r\n field: string;\r\n values: any[];\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"requiredIfIn\",\r\n description: \"The field is required if :field value is in the given array\",\r\n sortOrder: -2,\r\n requiresValue: false,\r\n defaultErrorMessage: \"The :input is required\",\r\n async validate(value: any, context) {\r\n const { values } = this.context.options;\r\n const fieldValue = getFieldValue(this, context);\r\n\r\n // Field is required if the other field's value is in the array\r\n if (isEmptyValue(value) && values.includes(fieldValue)) {\r\n this.context.translatableParams.field = this.context.options.field;\r\n this.context.translationParams.values = this.context.options.values.join(\", \");\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Required if not in rule - field is required if another field's value is NOT in the given array\r\n * Supports both global and sibling scope\r\n */\r\nexport const requiredIfNotInRule: SchemaRule<{\r\n field: string;\r\n values: any[];\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"requiredIfNotIn\",\r\n description: \"The field is required if another field's value is NOT in the given array\",\r\n sortOrder: -2,\r\n requiresValue: false,\r\n defaultErrorMessage: \"The :input is required\",\r\n async validate(value: any, context) {\r\n const { values } = this.context.options;\r\n const fieldValue = getFieldValue(this, context);\r\n\r\n // Field is required if the other field's value is NOT in the array\r\n if (isEmptyValue(value) && !values.includes(fieldValue)) {\r\n this.context.translatableParams.field = this.context.options.field;\r\n this.context.translationParams.values = this.context.options.values.join(\", \");\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Get multiple field values based on scope\r\n */\r\nfunction getFieldsValues(\r\n rule: SchemaRule<{ fields: string[]; scope?: \"global\" | \"sibling\" }>,\r\n context: any,\r\n): any[] {\r\n const { fields, scope = \"global\" } = (rule as any).context.options;\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n return fields.map((field: string) => get(source, field));\r\n}\r\n\r\n/**\r\n * Required if all empty rule - field is required if ALL specified fields are empty\r\n * Supports both global and sibling scope\r\n */\r\nexport const requiredIfAllEmptyRule: SchemaRule<{\r\n fields: string[];\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"requiredIfAllEmpty\",\r\n description: \"The field is required if all :fields are empty\",\r\n sortOrder: -2,\r\n requiresValue: false,\r\n defaultErrorMessage: \"The :input is required\",\r\n async validate(value: any, context) {\r\n const fieldValues = getFieldsValues(this, context);\r\n\r\n // Field is required if ALL other fields are empty\r\n const allEmpty = fieldValues.every((v) => isEmptyValue(v));\r\n if (isEmptyValue(value) && allEmpty) {\r\n this.context.options.fields.forEach((field) => {\r\n this.context.translatableParams.field = field;\r\n });\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Required if any empty rule - field is required if ANY of the specified fields is empty\r\n * Supports both global and sibling scope\r\n */\r\nexport const requiredIfAnyEmptyRule: SchemaRule<{\r\n fields: string[];\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"requiredIfAnyEmpty\",\r\n description: \"The field is required if any of the :fields is empty\",\r\n sortOrder: -2,\r\n requiresValue: false,\r\n defaultErrorMessage: \"The :input is required\",\r\n async validate(value: any, context) {\r\n const fieldValues = getFieldsValues(this, context);\r\n\r\n // Field is required if ANY other field is empty\r\n const anyEmpty = fieldValues.some((v) => isEmptyValue(v));\r\n if (isEmptyValue(value) && anyEmpty) {\r\n this.context.options.fields.forEach((field) => {\r\n this.context.translatableParams.field = field;\r\n });\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Required if all not empty rule - field is required if ALL specified fields are NOT empty\r\n * Supports both global and sibling scope\r\n */\r\nexport const requiredIfAllNotEmptyRule: SchemaRule<{\r\n fields: string[];\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"requiredIfAllNotEmpty\",\r\n description: \"The field is required if all :fields are not empty\",\r\n sortOrder: -2,\r\n requiresValue: false,\r\n defaultErrorMessage: \"The :input is required\",\r\n async validate(value: any, context) {\r\n const fieldValues = getFieldsValues(this, context);\r\n\r\n // Field is required if ALL other fields are NOT empty\r\n const allNotEmpty = fieldValues.every((v) => !isEmptyValue(v));\r\n if (isEmptyValue(value) && allNotEmpty) {\r\n this.context.options.fields.forEach((field) => {\r\n this.context.translatableParams.field = field;\r\n });\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Required if any not empty rule - field is required if ANY of the specified fields is NOT empty\r\n * Supports both global and sibling scope\r\n */\r\nexport const requiredIfAnyNotEmptyRule: SchemaRule<{\r\n fields: string[];\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"requiredIfAnyNotEmpty\",\r\n description: \"The field is required if any of the :fields is not empty\",\r\n sortOrder: -2,\r\n requiresValue: false,\r\n defaultErrorMessage: \"The :input is required\",\r\n async validate(value: any, context) {\r\n const fieldValues = getFieldsValues(this, context);\r\n\r\n // Field is required if ANY other field is NOT empty\r\n const anyNotEmpty = fieldValues.some((v) => !isEmptyValue(v));\r\n if (isEmptyValue(value) && anyNotEmpty) {\r\n this.context.options.fields.forEach((field) => {\r\n this.context.translatableParams.field = field;\r\n });\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n"],"mappings":"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"}
@@ -0,0 +1,31 @@
1
+ import { getFieldValue } from "../../helpers/get-field-value.mjs";
2
+ import { VALID_RULE, invalidRule } from "../../helpers/validation-helpers.mjs";
3
+ import "../../helpers/index.mjs";
4
+ import { isEmptyValue } from "../../helpers/is-empty-value.mjs";
5
+
6
+ //#region ../seal/src/rules/conditional/required-unless-rules.ts
7
+ /**
8
+ * Required unless rule - field is required unless another field equals a specific value
9
+ * Supports both global and sibling scope
10
+ */
11
+ const requiredUnlessRule = {
12
+ name: "requiredUnless",
13
+ description: "The field is required unless another field equals a specific value",
14
+ sortOrder: -2,
15
+ requiresValue: false,
16
+ defaultErrorMessage: "The :input is required",
17
+ async validate(value, context) {
18
+ const { value: expectedValue } = this.context.options;
19
+ const fieldValue = getFieldValue(this, context);
20
+ if (isEmptyValue(value) && fieldValue !== expectedValue) {
21
+ this.context.translatableParams.field = this.context.options.field;
22
+ this.context.translationParams.value = this.context.options.value;
23
+ return invalidRule(this, context);
24
+ }
25
+ return VALID_RULE;
26
+ }
27
+ };
28
+
29
+ //#endregion
30
+ export { requiredUnlessRule };
31
+ //# sourceMappingURL=required-unless-rules.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"required-unless-rules.mjs","names":[],"sources":["../../../../../../../../../../seal/src/rules/conditional/required-unless-rules.ts"],"sourcesContent":["import { getFieldValue, invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\nimport { isEmptyValue } from \"./../../helpers/is-empty-value\";\r\n\r\n/**\r\n * Required unless rule - field is required unless another field equals a specific value\r\n * Supports both global and sibling scope\r\n */\r\nexport const requiredUnlessRule: SchemaRule<{\r\n field: string;\r\n value: any;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"requiredUnless\",\r\n description: \"The field is required unless another field equals a specific value\",\r\n sortOrder: -2,\r\n requiresValue: false,\r\n defaultErrorMessage: \"The :input is required\",\r\n async validate(value: any, context) {\r\n const { value: expectedValue } = this.context.options;\r\n const fieldValue = getFieldValue(this, context);\r\n\r\n // Field is required unless the other field equals the expected value\r\n if (isEmptyValue(value) && fieldValue !== expectedValue) {\r\n this.context.translatableParams.field = this.context.options.field;\r\n this.context.translationParams.value = this.context.options.value;\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n"],"mappings":";;;;;;;;;;AAQA,MAAa,qBAIR;CACH,MAAM;CACN,aAAa;CACb,WAAW;CACX,eAAe;CACf,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,MAAM,EAAE,OAAO,kBAAkB,KAAK,QAAQ;EAC9C,MAAM,aAAa,cAAc,MAAM,OAAO;EAG9C,IAAI,aAAa,KAAK,KAAK,eAAe,eAAe;GACvD,KAAK,QAAQ,mBAAmB,QAAQ,KAAK,QAAQ,QAAQ;GAC7D,KAAK,QAAQ,kBAAkB,QAAQ,KAAK,QAAQ,QAAQ;GAC5D,OAAO,YAAY,MAAM,OAAO;EAClC;EAEA,OAAO;CACT;AACF"}
@@ -0,0 +1,32 @@
1
+ import { VALID_RULE, invalidRule } from "../../helpers/validation-helpers.mjs";
2
+ import "../../helpers/index.mjs";
3
+ import { isEmptyValue } from "../../helpers/is-empty-value.mjs";
4
+
5
+ //#region ../seal/src/rules/conditional/required-when-rule.ts
6
+ /**
7
+ * Required when callback returns true.
8
+ *
9
+ * The callback receives only the SchemaContext (not the value),
10
+ * because "required" is about surrounding conditions, not the field itself.
11
+ *
12
+ * @example
13
+ * ```ts
14
+ * v.string().requiredWhen((context) => {
15
+ * return context.allData.notificationMethod === 'email';
16
+ * })
17
+ * ```
18
+ */
19
+ const requiredWhenRule = {
20
+ name: "requiredWhen",
21
+ defaultErrorMessage: "The :input is required",
22
+ requiresValue: false,
23
+ sortOrder: -2,
24
+ async validate(value, context) {
25
+ if (await this.context.options.callback?.(context) && isEmptyValue(value)) return invalidRule(this, context);
26
+ return VALID_RULE;
27
+ }
28
+ };
29
+
30
+ //#endregion
31
+ export { requiredWhenRule };
32
+ //# sourceMappingURL=required-when-rule.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"required-when-rule.mjs","names":[],"sources":["../../../../../../../../../../seal/src/rules/conditional/required-when-rule.ts"],"sourcesContent":["import { invalidRule, VALID_RULE } from \"../../helpers\";\nimport { isEmptyValue } from \"../../helpers/is-empty-value\";\nimport type { SchemaContext, SchemaRule } from \"../../types\";\n\n/**\n * Required when callback returns true.\n *\n * The callback receives only the SchemaContext (not the value),\n * because \"required\" is about surrounding conditions, not the field itself.\n *\n * @example\n * ```ts\n * v.string().requiredWhen((context) => {\n * return context.allData.notificationMethod === 'email';\n * })\n * ```\n */\nexport const requiredWhenRule: SchemaRule<{\n callback: (context: SchemaContext) => boolean | Promise<boolean>;\n}> = {\n name: \"requiredWhen\",\n defaultErrorMessage: \"The :input is required\",\n requiresValue: false,\n sortOrder: -2,\n async validate(value, context) {\n const shouldBeRequired = await this.context.options.callback?.(context);\n\n if (shouldBeRequired && isEmptyValue(value)) {\n return invalidRule(this, context);\n }\n\n return VALID_RULE;\n },\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAiBA,MAAa,mBAER;CACH,MAAM;CACN,qBAAqB;CACrB,eAAe;CACf,WAAW;CACX,MAAM,SAAS,OAAO,SAAS;EAG7B,IAAI,MAF2B,KAAK,QAAQ,QAAQ,WAAW,OAAO,KAE9C,aAAa,KAAK,GACxC,OAAO,YAAY,MAAM,OAAO;EAGlC,OAAO;CACT;AACF"}
@@ -0,0 +1,67 @@
1
+ import { get } from "../../../../node_modules/@mongez/reinforcements/esm/object/get.mjs";
2
+ import "../../../../node_modules/@mongez/reinforcements/esm/index.mjs";
3
+ import { getFieldValue } from "../../helpers/get-field-value.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
+
8
+ //#region ../seal/src/rules/conditional/required-with-rules.ts
9
+ /**
10
+ * Required with rule - field is required if another field is present
11
+ * Supports both global and sibling scope
12
+ */
13
+ const requiredWithRule = {
14
+ name: "requiredWith",
15
+ description: "The field is required if another field is present",
16
+ sortOrder: -2,
17
+ requiresValue: false,
18
+ defaultErrorMessage: "The :input is required",
19
+ async validate(value, context) {
20
+ const fieldValue = getFieldValue(this, context);
21
+ if (isEmptyValue(value) && fieldValue !== void 0) {
22
+ this.context.translatableParams.field = this.context.options.field;
23
+ return invalidRule(this, context);
24
+ }
25
+ return VALID_RULE;
26
+ }
27
+ };
28
+ /**
29
+ * Required with all rule - field is required if all specified fields are present
30
+ * Supports both global and sibling scope
31
+ */
32
+ const requiredWithAllRule = {
33
+ name: "requiredWithAll",
34
+ description: "The field is required if all specified fields are present",
35
+ sortOrder: -2,
36
+ requiresValue: false,
37
+ defaultErrorMessage: "The :input is required",
38
+ async validate(value, context) {
39
+ const { fields, scope = "global" } = this.context.options;
40
+ const source = scope === "sibling" ? context.parent : context.allValues;
41
+ const allPresent = fields.every((field) => get(source, field) !== void 0);
42
+ if (isEmptyValue(value) && allPresent) return invalidRule(this, context);
43
+ return VALID_RULE;
44
+ }
45
+ };
46
+ /**
47
+ * Required with any rule - field is required if any of the specified fields is present
48
+ * Supports both global and sibling scope
49
+ */
50
+ const requiredWithAnyRule = {
51
+ name: "requiredWithAny",
52
+ description: "The field is required if any of the specified fields is present",
53
+ sortOrder: -2,
54
+ requiresValue: false,
55
+ defaultErrorMessage: "The :input is required",
56
+ async validate(value, context) {
57
+ const { fields, scope = "global" } = this.context.options;
58
+ const source = scope === "sibling" ? context.parent : context.allValues;
59
+ const anyPresent = fields.some((field) => get(source, field) !== void 0);
60
+ if (isEmptyValue(value) && anyPresent) return invalidRule(this, context);
61
+ return VALID_RULE;
62
+ }
63
+ };
64
+
65
+ //#endregion
66
+ export { requiredWithAllRule, requiredWithAnyRule, requiredWithRule };
67
+ //# sourceMappingURL=required-with-rules.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"required-with-rules.mjs","names":[],"sources":["../../../../../../../../../../seal/src/rules/conditional/required-with-rules.ts"],"sourcesContent":["import { get } from \"@mongez/reinforcements\";\r\nimport { getFieldValue, invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport { isEmptyValue } from \"../../helpers/is-empty-value\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\n/**\r\n * Required with rule - field is required if another field is present\r\n * Supports both global and sibling scope\r\n */\r\nexport const requiredWithRule: SchemaRule<{\r\n field: string;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"requiredWith\",\r\n description: \"The field is required if another field is present\",\r\n sortOrder: -2,\r\n requiresValue: false,\r\n defaultErrorMessage: \"The :input is required\",\r\n async validate(value: any, context) {\r\n const fieldValue = getFieldValue(this, context);\r\n\r\n // Field is required if the other field is present\r\n if (isEmptyValue(value) && fieldValue !== undefined) {\r\n this.context.translatableParams.field = this.context.options.field;\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Required with all rule - field is required if all specified fields are present\r\n * Supports both global and sibling scope\r\n */\r\nexport const requiredWithAllRule: SchemaRule<{\r\n fields: string[];\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"requiredWithAll\",\r\n description: \"The field is required if all specified fields are present\",\r\n sortOrder: -2,\r\n requiresValue: false,\r\n defaultErrorMessage: \"The :input is required\",\r\n async validate(value: any, context) {\r\n const { fields, scope = \"global\" } = this.context.options;\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n\r\n // Check if all fields are present\r\n const allPresent = fields.every((field) => get(source, field) !== undefined);\r\n\r\n // Field is required if all other fields are present\r\n if (isEmptyValue(value) && allPresent) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Required with any rule - field is required if any of the specified fields is present\r\n * Supports both global and sibling scope\r\n */\r\nexport const requiredWithAnyRule: SchemaRule<{\r\n fields: string[];\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"requiredWithAny\",\r\n description: \"The field is required if any of the specified fields is present\",\r\n sortOrder: -2,\r\n requiresValue: false,\r\n defaultErrorMessage: \"The :input is required\",\r\n async validate(value: any, context) {\r\n const { fields, scope = \"global\" } = this.context.options;\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n\r\n // Check if any field is present\r\n const anyPresent = fields.some((field) => get(source, field) !== undefined);\r\n\r\n // Field is required if any other field is present\r\n if (isEmptyValue(value) && anyPresent) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n"],"mappings":";;;;;;;;;;;;AASA,MAAa,mBAGR;CACH,MAAM;CACN,aAAa;CACb,WAAW;CACX,eAAe;CACf,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,MAAM,aAAa,cAAc,MAAM,OAAO;EAG9C,IAAI,aAAa,KAAK,KAAK,eAAe,QAAW;GACnD,KAAK,QAAQ,mBAAmB,QAAQ,KAAK,QAAQ,QAAQ;GAC7D,OAAO,YAAY,MAAM,OAAO;EAClC;EAEA,OAAO;CACT;AACF;;;;;AAMA,MAAa,sBAGR;CACH,MAAM;CACN,aAAa;CACb,WAAW;CACX,eAAe;CACf,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,MAAM,EAAE,QAAQ,QAAQ,aAAa,KAAK,QAAQ;EAClD,MAAM,SAAS,UAAU,YAAY,QAAQ,SAAS,QAAQ;EAG9D,MAAM,aAAa,OAAO,OAAO,UAAU,IAAI,QAAQ,KAAK,MAAM,MAAS;EAG3E,IAAI,aAAa,KAAK,KAAK,YACzB,OAAO,YAAY,MAAM,OAAO;EAGlC,OAAO;CACT;AACF;;;;;AAMA,MAAa,sBAGR;CACH,MAAM;CACN,aAAa;CACb,WAAW;CACX,eAAe;CACf,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,MAAM,EAAE,QAAQ,QAAQ,aAAa,KAAK,QAAQ;EAClD,MAAM,SAAS,UAAU,YAAY,QAAQ,SAAS,QAAQ;EAG9D,MAAM,aAAa,OAAO,MAAM,UAAU,IAAI,QAAQ,KAAK,MAAM,MAAS;EAG1E,IAAI,aAAa,KAAK,KAAK,YACzB,OAAO,YAAY,MAAM,OAAO;EAGlC,OAAO;CACT;AACF"}
@@ -0,0 +1,67 @@
1
+ import { get } from "../../../../node_modules/@mongez/reinforcements/esm/object/get.mjs";
2
+ import "../../../../node_modules/@mongez/reinforcements/esm/index.mjs";
3
+ import { getFieldValue } from "../../helpers/get-field-value.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
+
8
+ //#region ../seal/src/rules/conditional/required-without-rules.ts
9
+ /**
10
+ * Required without rule - field is required if another field is missing
11
+ * Supports both global and sibling scope
12
+ */
13
+ const requiredWithoutRule = {
14
+ name: "requiredWithout",
15
+ description: "The field is required if another field is missing",
16
+ sortOrder: -2,
17
+ requiresValue: false,
18
+ defaultErrorMessage: "The :input is required",
19
+ async validate(value, context) {
20
+ const fieldValue = getFieldValue(this, context);
21
+ if (isEmptyValue(value) && fieldValue === void 0) {
22
+ this.context.translatableParams.field = this.context.options.field;
23
+ return invalidRule(this, context);
24
+ }
25
+ return VALID_RULE;
26
+ }
27
+ };
28
+ /**
29
+ * Required without all rule - field is required if all specified fields are missing
30
+ * Supports both global and sibling scope
31
+ */
32
+ const requiredWithoutAllRule = {
33
+ name: "requiredWithoutAll",
34
+ description: "The field is required if all specified fields are missing",
35
+ sortOrder: -2,
36
+ requiresValue: false,
37
+ defaultErrorMessage: "The :input is required",
38
+ async validate(value, context) {
39
+ const { fields, scope = "global" } = this.context.options;
40
+ const source = scope === "sibling" ? context.parent : context.allValues;
41
+ const allMissing = fields.every((field) => get(source, field) === void 0);
42
+ if (isEmptyValue(value) && allMissing) return invalidRule(this, context);
43
+ return VALID_RULE;
44
+ }
45
+ };
46
+ /**
47
+ * Required without any rule - field is required if any of the specified fields is missing
48
+ * Supports both global and sibling scope
49
+ */
50
+ const requiredWithoutAnyRule = {
51
+ name: "requiredWithoutAny",
52
+ description: "The field is required if any of the specified fields is missing",
53
+ sortOrder: -2,
54
+ requiresValue: false,
55
+ defaultErrorMessage: "The :input is required",
56
+ async validate(value, context) {
57
+ const { fields, scope = "global" } = this.context.options;
58
+ const source = scope === "sibling" ? context.parent : context.allValues;
59
+ const anyMissing = fields.some((field) => get(source, field) === void 0);
60
+ if (isEmptyValue(value) && anyMissing) return invalidRule(this, context);
61
+ return VALID_RULE;
62
+ }
63
+ };
64
+
65
+ //#endregion
66
+ export { requiredWithoutAllRule, requiredWithoutAnyRule, requiredWithoutRule };
67
+ //# sourceMappingURL=required-without-rules.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"required-without-rules.mjs","names":[],"sources":["../../../../../../../../../../seal/src/rules/conditional/required-without-rules.ts"],"sourcesContent":["import { get } from \"@mongez/reinforcements\";\r\nimport { getFieldValue, invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\nimport { isEmptyValue } from \"./../../helpers/is-empty-value\";\r\n\r\n/**\r\n * Required without rule - field is required if another field is missing\r\n * Supports both global and sibling scope\r\n */\r\nexport const requiredWithoutRule: SchemaRule<{\r\n field: string;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"requiredWithout\",\r\n description: \"The field is required if another field is missing\",\r\n sortOrder: -2,\r\n requiresValue: false,\r\n defaultErrorMessage: \"The :input is required\",\r\n async validate(value: any, context) {\r\n const fieldValue = getFieldValue(this, context);\r\n\r\n // Field is required if the other field is missing\r\n if (isEmptyValue(value) && fieldValue === undefined) {\r\n this.context.translatableParams.field = this.context.options.field;\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Required without all rule - field is required if all specified fields are missing\r\n * Supports both global and sibling scope\r\n */\r\nexport const requiredWithoutAllRule: SchemaRule<{\r\n fields: string[];\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"requiredWithoutAll\",\r\n description: \"The field is required if all specified fields are missing\",\r\n sortOrder: -2,\r\n requiresValue: false,\r\n defaultErrorMessage: \"The :input is required\",\r\n async validate(value: any, context) {\r\n const { fields, scope = \"global\" } = this.context.options;\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n\r\n // Check if all fields are missing\r\n const allMissing = fields.every((field) => get(source, field) === undefined);\r\n\r\n // Field is required if all other fields are missing\r\n if (isEmptyValue(value) && allMissing) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Required without any rule - field is required if any of the specified fields is missing\r\n * Supports both global and sibling scope\r\n */\r\nexport const requiredWithoutAnyRule: SchemaRule<{\r\n fields: string[];\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"requiredWithoutAny\",\r\n description: \"The field is required if any of the specified fields is missing\",\r\n sortOrder: -2,\r\n requiresValue: false,\r\n defaultErrorMessage: \"The :input is required\",\r\n async validate(value: any, context) {\r\n const { fields, scope = \"global\" } = this.context.options;\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n\r\n // Check if any field is missing\r\n const anyMissing = fields.some((field) => get(source, field) === undefined);\r\n\r\n // Field is required if any other field is missing\r\n if (isEmptyValue(value) && anyMissing) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n"],"mappings":";;;;;;;;;;;;AASA,MAAa,sBAGR;CACH,MAAM;CACN,aAAa;CACb,WAAW;CACX,eAAe;CACf,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,MAAM,aAAa,cAAc,MAAM,OAAO;EAG9C,IAAI,aAAa,KAAK,KAAK,eAAe,QAAW;GACnD,KAAK,QAAQ,mBAAmB,QAAQ,KAAK,QAAQ,QAAQ;GAC7D,OAAO,YAAY,MAAM,OAAO;EAClC;EAEA,OAAO;CACT;AACF;;;;;AAMA,MAAa,yBAGR;CACH,MAAM;CACN,aAAa;CACb,WAAW;CACX,eAAe;CACf,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,MAAM,EAAE,QAAQ,QAAQ,aAAa,KAAK,QAAQ;EAClD,MAAM,SAAS,UAAU,YAAY,QAAQ,SAAS,QAAQ;EAG9D,MAAM,aAAa,OAAO,OAAO,UAAU,IAAI,QAAQ,KAAK,MAAM,MAAS;EAG3E,IAAI,aAAa,KAAK,KAAK,YACzB,OAAO,YAAY,MAAM,OAAO;EAGlC,OAAO;CACT;AACF;;;;;AAMA,MAAa,yBAGR;CACH,MAAM;CACN,aAAa;CACb,WAAW;CACX,eAAe;CACf,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,MAAM,EAAE,QAAQ,QAAQ,aAAa,KAAK,QAAQ;EAClD,MAAM,SAAS,UAAU,YAAY,QAAQ,SAAS,QAAQ;EAG9D,MAAM,aAAa,OAAO,MAAM,UAAU,IAAI,QAAQ,KAAK,MAAM,MAAS;EAG1E,IAAI,aAAa,KAAK,KAAK,YACzB,OAAO,YAAY,MAAM,OAAO;EAGlC,OAAO;CACT;AACF"}
@@ -0,0 +1,22 @@
1
+ import { VALID_RULE, invalidRule } from "../../helpers/validation-helpers.mjs";
2
+ import "../../helpers/index.mjs";
3
+
4
+ //#region ../seal/src/rules/core/equal.ts
5
+ /**
6
+ * Equal rule - value must be equal to a specific value
7
+ */
8
+ const equalRule = {
9
+ name: "equal",
10
+ defaultErrorMessage: "The :input must be equal to :value",
11
+ async validate(value, context) {
12
+ if (value !== this.context.options.value) {
13
+ this.context.translatableParams.value = this.context.options.value;
14
+ return invalidRule(this, context);
15
+ }
16
+ return VALID_RULE;
17
+ }
18
+ };
19
+
20
+ //#endregion
21
+ export { equalRule };
22
+ //# sourceMappingURL=equal.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"equal.mjs","names":[],"sources":["../../../../../../../../../../seal/src/rules/core/equal.ts"],"sourcesContent":["import { invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\n/**\r\n * Equal rule - value must be equal to a specific value\r\n */\r\nexport const equalRule: SchemaRule<{ value: any }> = {\r\n name: \"equal\",\r\n defaultErrorMessage: \"The :input must be equal to :value\",\r\n async validate(value: any, context) {\r\n if (value !== this.context.options.value) {\r\n this.context.translatableParams.value = this.context.options.value;\r\n return invalidRule(this, context);\r\n }\r\n return VALID_RULE;\r\n },\r\n};\r\n"],"mappings":";;;;;;;AAMA,MAAa,YAAwC;CACnD,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,IAAI,UAAU,KAAK,QAAQ,QAAQ,OAAO;GACxC,KAAK,QAAQ,mBAAmB,QAAQ,KAAK,QAAQ,QAAQ;GAC7D,OAAO,YAAY,MAAM,OAAO;EAClC;EACA,OAAO;CACT;AACF"}
@@ -0,0 +1,20 @@
1
+ import { VALID_RULE, invalidRule } from "../../helpers/validation-helpers.mjs";
2
+ import "../../helpers/index.mjs";
3
+ import { isEmptyValue } from "../../helpers/is-empty-value.mjs";
4
+
5
+ //#region ../seal/src/rules/core/forbidden.ts
6
+ /**
7
+ * Forbidden rule - value must not be present
8
+ */
9
+ const forbiddenRule = {
10
+ name: "forbidden",
11
+ defaultErrorMessage: "The :input is forbidden",
12
+ async validate(value, context) {
13
+ if (!isEmptyValue(value)) return invalidRule(this, context);
14
+ return VALID_RULE;
15
+ }
16
+ };
17
+
18
+ //#endregion
19
+ export { forbiddenRule };
20
+ //# sourceMappingURL=forbidden.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"forbidden.mjs","names":[],"sources":["../../../../../../../../../../seal/src/rules/core/forbidden.ts"],"sourcesContent":["import { invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport { isEmptyValue } from \"../../helpers/is-empty-value\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\n/**\r\n * Forbidden rule - value must not be present\r\n */\r\nexport const forbiddenRule: SchemaRule = {\r\n name: \"forbidden\",\r\n defaultErrorMessage: \"The :input is forbidden\",\r\n async validate(value: any, context) {\r\n if (!isEmptyValue(value)) {\r\n return invalidRule(this, context);\r\n }\r\n return VALID_RULE;\r\n },\r\n};\r\n"],"mappings":";;;;;;;;AAOA,MAAa,gBAA4B;CACvC,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,IAAI,CAAC,aAAa,KAAK,GACrB,OAAO,YAAY,MAAM,OAAO;EAElC,OAAO;CACT;AACF"}
@@ -0,0 +1,7 @@
1
+ import { presentRule, requiredRule } from "./required.mjs";
2
+ import { equalRule } from "./equal.mjs";
3
+ import { forbiddenRule } from "./forbidden.mjs";
4
+ import { unionRule } from "./union.mjs";
5
+ import { whenRule } from "./when.mjs";
6
+
7
+ export { };
@@ -0,0 +1,36 @@
1
+ import { VALID_RULE, invalidRule } from "../../helpers/validation-helpers.mjs";
2
+ import "../../helpers/index.mjs";
3
+ import { isEmptyValue } from "../../helpers/is-empty-value.mjs";
4
+
5
+ //#region ../seal/src/rules/core/required.ts
6
+ /**
7
+ * Required rule - value must be present and not empty
8
+ */
9
+ const requiredRule = {
10
+ name: "required",
11
+ defaultErrorMessage: "The :input is required",
12
+ requiresValue: false,
13
+ sortOrder: -2,
14
+ async validate(value, context) {
15
+ if (isEmptyValue(value)) return invalidRule(this, context);
16
+ return VALID_RULE;
17
+ }
18
+ };
19
+ /**
20
+ * Present rule - key must exist in the data, but value can be anything
21
+ * (empty string, null are all valid as long as the key exists)
22
+ */
23
+ const presentRule = {
24
+ name: "present",
25
+ defaultErrorMessage: "The :input field is required",
26
+ requiresValue: false,
27
+ sortOrder: -2,
28
+ async validate(value, context) {
29
+ if (value === void 0) return invalidRule(this, context);
30
+ return VALID_RULE;
31
+ }
32
+ };
33
+
34
+ //#endregion
35
+ export { presentRule, requiredRule };
36
+ //# sourceMappingURL=required.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"required.mjs","names":[],"sources":["../../../../../../../../../../seal/src/rules/core/required.ts"],"sourcesContent":["import { invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport { isEmptyValue } from \"../../helpers/is-empty-value\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\n/**\r\n * Required rule - value must be present and not empty\r\n */\r\nexport const requiredRule: SchemaRule = {\r\n name: \"required\",\r\n defaultErrorMessage: \"The :input is required\",\r\n requiresValue: false,\r\n sortOrder: -2,\r\n async validate(value: any, context) {\r\n if (isEmptyValue(value)) {\r\n return invalidRule(this, context);\r\n }\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\n/**\r\n * Present rule - key must exist in the data, but value can be anything\r\n * (empty string, null are all valid as long as the key exists)\r\n */\r\nexport const presentRule: SchemaRule = {\r\n name: \"present\",\r\n defaultErrorMessage: \"The :input field is required\",\r\n requiresValue: false,\r\n sortOrder: -2,\r\n async validate(value: any, context) {\r\n if (value === undefined) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n"],"mappings":";;;;;;;;AAOA,MAAa,eAA2B;CACtC,MAAM;CACN,qBAAqB;CACrB,eAAe;CACf,WAAW;CACX,MAAM,SAAS,OAAY,SAAS;EAClC,IAAI,aAAa,KAAK,GACpB,OAAO,YAAY,MAAM,OAAO;EAElC,OAAO;CACT;AACF;;;;;AAMA,MAAa,cAA0B;CACrC,MAAM;CACN,qBAAqB;CACrB,eAAe;CACf,WAAW;CACX,MAAM,SAAS,OAAY,SAAS;EAClC,IAAI,UAAU,QACZ,OAAO,YAAY,MAAM,OAAO;EAGlC,OAAO;CACT;AACF"}
@@ -0,0 +1,30 @@
1
+ import { VALID_RULE, invalidRule } from "../../helpers/validation-helpers.mjs";
2
+ import "../../helpers/index.mjs";
3
+
4
+ //#region ../seal/src/rules/core/union.ts
5
+ /**
6
+ * Union rule - value must match at least one of the provided validators
7
+ */
8
+ const unionRule = {
9
+ name: "union",
10
+ defaultErrorMessage: "Value must match one of the allowed types",
11
+ async validate(value, context) {
12
+ const validators = this.context.options.validators;
13
+ const firstErrorOnly = context.configurations?.firstErrorOnly ?? true;
14
+ const allErrors = [];
15
+ for (const validator of validators) {
16
+ if (!validator.matchesType(value)) continue;
17
+ const result = await validator.validate(value, context);
18
+ if (result.isValid) return VALID_RULE;
19
+ const errorMsg = result.errors?.[0]?.error || "Validation failed";
20
+ allErrors.push(errorMsg);
21
+ if (firstErrorOnly) break;
22
+ }
23
+ if (allErrors.length > 0) this.context.errorMessage = firstErrorOnly ? allErrors[0] : allErrors.join("; ");
24
+ return invalidRule(this, context);
25
+ }
26
+ };
27
+
28
+ //#endregion
29
+ export { unionRule };
30
+ //# sourceMappingURL=union.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"union.mjs","names":[],"sources":["../../../../../../../../../../seal/src/rules/core/union.ts"],"sourcesContent":["import { invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\nimport type { BaseValidator } from \"../../validators/base-validator\";\r\n\r\n/**\r\n * Union rule - value must match at least one of the provided validators\r\n */\r\nexport const unionRule: SchemaRule<{ validators: BaseValidator[] }> = {\r\n name: \"union\",\r\n defaultErrorMessage: \"Value must match one of the allowed types\",\r\n async validate(value: any, context) {\r\n const validators = this.context.options.validators;\r\n const firstErrorOnly = context.configurations?.firstErrorOnly ?? true;\r\n const allErrors: string[] = [];\r\n\r\n // Try each validator\r\n for (const validator of validators) {\r\n // Skip if type doesn't match (optimization)\r\n if (!validator.matchesType(value)) {\r\n continue;\r\n }\r\n\r\n // Type matches - validate\r\n const result = await validator.validate(value, context);\r\n\r\n if (result.isValid) {\r\n // Success! Validator matched and validated\r\n return VALID_RULE;\r\n }\r\n\r\n // Failed - collect error message\r\n const errorMsg = result.errors?.[0]?.error || \"Validation failed\";\r\n allErrors.push(errorMsg);\r\n\r\n // If firstErrorOnly, stop after first failed validator\r\n if (firstErrorOnly) {\r\n break;\r\n }\r\n }\r\n\r\n // All failed or no validator matched the type\r\n if (allErrors.length > 0) {\r\n // At least one validator matched type but failed validation\r\n this.context.errorMessage = firstErrorOnly\r\n ? allErrors[0]\r\n : allErrors.join(\"; \");\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n"],"mappings":";;;;;;;AAOA,MAAa,YAAyD;CACpE,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,MAAM,aAAa,KAAK,QAAQ,QAAQ;EACxC,MAAM,iBAAiB,QAAQ,gBAAgB,kBAAkB;EACjE,MAAM,YAAsB,CAAC;EAG7B,KAAK,MAAM,aAAa,YAAY;GAElC,IAAI,CAAC,UAAU,YAAY,KAAK,GAC9B;GAIF,MAAM,SAAS,MAAM,UAAU,SAAS,OAAO,OAAO;GAEtD,IAAI,OAAO,SAET,OAAO;GAIT,MAAM,WAAW,OAAO,SAAS,EAAE,EAAE,SAAS;GAC9C,UAAU,KAAK,QAAQ;GAGvB,IAAI,gBACF;EAEJ;EAGA,IAAI,UAAU,SAAS,GAErB,KAAK,QAAQ,eAAe,iBACxB,UAAU,KACV,UAAU,KAAK,IAAI;EAGzB,OAAO,YAAY,MAAM,OAAO;CAClC;AACF"}