@warlock.js/notifications 5.1.0 → 5.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (243) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/README.md +8 -0
  3. package/cjs/{channel_api-CH3DxhRU.cjs → channel_api-ChOeNKM1.cjs} +42 -42
  4. package/cjs/channel_api-ChOeNKM1.cjs.map +1 -0
  5. package/cjs/index.cjs +1 -1
  6. package/cjs/index.cjs.map +1 -1
  7. package/cjs/rabbitmq-driver-Drn1T40o.cjs +3 -0
  8. package/cjs/{src-Cus6pYPC.cjs → src-Dy5nwVcs.cjs} +57 -29
  9. package/cjs/src-Dy5nwVcs.cjs.map +1 -0
  10. package/esm/channels/database-channel.d.mts.map +1 -1
  11. package/esm/config.d.mts.map +1 -1
  12. package/esm/dispatch/define-channel.d.mts.map +1 -1
  13. package/esm/dispatch/define-notification.d.mts.map +1 -1
  14. package/esm/dispatch/define-notification.mjs.map +1 -1
  15. package/esm/dispatch/notifications-event-bus.mjs.map +1 -1
  16. package/esm/dispatch/notify.mjs.map +1 -1
  17. package/esm/errors.d.mts.map +1 -1
  18. package/esm/herald/src/communicators/broker.mjs.map +1 -1
  19. package/esm/herald/src/drivers/rabbitmq/rabbitmq-channel.mjs.map +1 -1
  20. package/esm/herald/src/drivers/rabbitmq/rabbitmq-driver.mjs +1 -1
  21. package/esm/herald/src/drivers/rabbitmq/rabbitmq-driver.mjs.map +1 -1
  22. package/esm/herald/src/message-managers/event-consumer.mjs.map +1 -1
  23. package/esm/herald/src/message-managers/event-message.mjs.map +1 -1
  24. package/esm/herald/src/message-managers/prepare-consumer-subscription.mjs.map +1 -1
  25. package/esm/herald/src/use-case-broadcast.mjs.map +1 -1
  26. package/esm/herald/src/utils/connect-to-broker.mjs.map +1 -1
  27. package/esm/in-app/base-notifications-repository.d.mts.map +1 -1
  28. package/esm/in-app/database-notification.d.mts.map +1 -1
  29. package/esm/in-app/in-app.d.mts.map +1 -1
  30. package/esm/migration/notification-columns.mjs.map +1 -1
  31. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez/reinforcements/esm/Random/_internal.mjs +6 -0
  32. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez/reinforcements/esm/Random/_internal.mjs.map +1 -0
  33. package/esm/node_modules/{@mongez → .pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez}/reinforcements/esm/mixed/clone/clone.mjs +1 -1
  34. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez/reinforcements/esm/mixed/clone/clone.mjs.map +1 -0
  35. package/esm/node_modules/{@mongez → .pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez}/reinforcements/esm/number/round.mjs +1 -1
  36. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez/reinforcements/esm/number/round.mjs.map +1 -0
  37. package/esm/node_modules/{@mongez → .pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez}/reinforcements/esm/object/except.mjs +1 -1
  38. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez/reinforcements/esm/object/except.mjs.map +1 -0
  39. package/esm/node_modules/{@mongez → .pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez}/reinforcements/esm/object/get.mjs +1 -1
  40. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez/reinforcements/esm/object/get.mjs.map +1 -0
  41. package/esm/node_modules/{@mongez → .pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez}/reinforcements/esm/object/omit.mjs +1 -1
  42. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez/reinforcements/esm/object/omit.mjs.map +1 -0
  43. package/esm/node_modules/{@mongez → .pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez}/reinforcements/esm/object/unset.mjs +1 -1
  44. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez/reinforcements/esm/object/unset.mjs.map +1 -0
  45. package/esm/node_modules/{@mongez → .pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez}/reinforcements/esm/string/capitalize.mjs +1 -1
  46. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez/reinforcements/esm/string/capitalize.mjs.map +1 -0
  47. package/esm/node_modules/{@mongez → .pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez}/reinforcements/esm/string/ltrim.mjs +1 -1
  48. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez/reinforcements/esm/string/ltrim.mjs.map +1 -0
  49. package/esm/node_modules/{@mongez → .pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez}/reinforcements/esm/string/readMoreChars.mjs +1 -1
  50. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez/reinforcements/esm/string/readMoreChars.mjs.map +1 -0
  51. package/esm/node_modules/{@mongez → .pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez}/reinforcements/esm/string/rtrim.mjs +1 -1
  52. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez/reinforcements/esm/string/rtrim.mjs.map +1 -0
  53. package/esm/node_modules/{@mongez → .pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez}/reinforcements/esm/string/toCamelCase.mjs +1 -1
  54. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez/reinforcements/esm/string/toCamelCase.mjs.map +1 -0
  55. package/esm/node_modules/{@mongez → .pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez}/reinforcements/esm/string/toKebabCase.mjs +1 -1
  56. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez/reinforcements/esm/string/toKebabCase.mjs.map +1 -0
  57. package/esm/node_modules/{@mongez → .pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez}/reinforcements/esm/string/toSnakeCase.mjs +1 -1
  58. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez/reinforcements/esm/string/toSnakeCase.mjs.map +1 -0
  59. package/esm/node_modules/{@mongez → .pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez}/reinforcements/esm/string/toStudlyCase.mjs +1 -1
  60. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez/reinforcements/esm/string/toStudlyCase.mjs.map +1 -0
  61. package/esm/node_modules/{@mongez → .pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez}/reinforcements/esm/string/trim.mjs +1 -1
  62. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez/reinforcements/esm/string/trim.mjs.map +1 -0
  63. package/esm/node_modules/{@mongez → .pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez}/reinforcements/esm/string/ucfirst.mjs +1 -1
  64. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez/reinforcements/esm/string/ucfirst.mjs.map +1 -0
  65. package/esm/node_modules/{@mongez → .pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez}/reinforcements/esm/string/words.mjs +1 -1
  66. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez/reinforcements/esm/string/words.mjs.map +1 -0
  67. package/esm/node_modules/{@mongez → .pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez}/reinforcements/esm/utils/escapeRegex.mjs +1 -1
  68. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez/reinforcements/esm/utils/escapeRegex.mjs.map +1 -0
  69. package/esm/node_modules/{@mongez → .pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez}/reinforcements/esm/utils/lazy.mjs +1 -1
  70. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez/reinforcements/esm/utils/lazy.mjs.map +1 -0
  71. package/esm/node_modules/{@mongez → .pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez}/reinforcements/esm/utils/tap.mjs +1 -1
  72. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez/reinforcements/esm/utils/tap.mjs.map +1 -0
  73. package/esm/node_modules/{@mongez → .pnpm/@mongez_supportive-is@2.1.4/node_modules/@mongez}/supportive-is/esm/index.mjs +1 -1
  74. package/esm/node_modules/.pnpm/@mongez_supportive-is@2.1.4/node_modules/@mongez/supportive-is/esm/index.mjs.map +1 -0
  75. package/esm/node_modules/{amqplib → .pnpm/amqplib@0.10.9/node_modules/amqplib}/channel_api.mjs +2 -2
  76. package/esm/node_modules/.pnpm/amqplib@0.10.9/node_modules/amqplib/channel_api.mjs.map +1 -0
  77. package/esm/node_modules/{amqplib → .pnpm/amqplib@0.10.9/node_modules/amqplib}/lib/api_args.mjs +2 -2
  78. package/esm/node_modules/.pnpm/amqplib@0.10.9/node_modules/amqplib/lib/api_args.mjs.map +1 -0
  79. package/esm/node_modules/{amqplib → .pnpm/amqplib@0.10.9/node_modules/amqplib}/lib/bitset.mjs +2 -2
  80. package/esm/node_modules/.pnpm/amqplib@0.10.9/node_modules/amqplib/lib/bitset.mjs.map +1 -0
  81. package/esm/node_modules/{amqplib → .pnpm/amqplib@0.10.9/node_modules/amqplib}/lib/channel.mjs +2 -2
  82. package/esm/node_modules/.pnpm/amqplib@0.10.9/node_modules/amqplib/lib/channel.mjs.map +1 -0
  83. package/esm/node_modules/{amqplib → .pnpm/amqplib@0.10.9/node_modules/amqplib}/lib/channel_model.mjs +2 -2
  84. package/esm/node_modules/.pnpm/amqplib@0.10.9/node_modules/amqplib/lib/channel_model.mjs.map +1 -0
  85. package/esm/node_modules/{amqplib → .pnpm/amqplib@0.10.9/node_modules/amqplib}/lib/codec.mjs +3 -3
  86. package/esm/node_modules/.pnpm/amqplib@0.10.9/node_modules/amqplib/lib/codec.mjs.map +1 -0
  87. package/esm/node_modules/{amqplib → .pnpm/amqplib@0.10.9/node_modules/amqplib}/lib/connect.mjs +3 -3
  88. package/esm/node_modules/.pnpm/amqplib@0.10.9/node_modules/amqplib/lib/connect.mjs.map +1 -0
  89. package/esm/node_modules/{amqplib → .pnpm/amqplib@0.10.9/node_modules/amqplib}/lib/connection.mjs +2 -2
  90. package/esm/node_modules/.pnpm/amqplib@0.10.9/node_modules/amqplib/lib/connection.mjs.map +1 -0
  91. package/esm/node_modules/{amqplib → .pnpm/amqplib@0.10.9/node_modules/amqplib}/lib/credentials.mjs +2 -2
  92. package/esm/node_modules/.pnpm/amqplib@0.10.9/node_modules/amqplib/lib/credentials.mjs.map +1 -0
  93. package/esm/node_modules/{amqplib → .pnpm/amqplib@0.10.9/node_modules/amqplib}/lib/defs.mjs +3 -3
  94. package/esm/node_modules/.pnpm/amqplib@0.10.9/node_modules/amqplib/lib/defs.mjs.map +1 -0
  95. package/esm/node_modules/{amqplib → .pnpm/amqplib@0.10.9/node_modules/amqplib}/lib/error.mjs +2 -2
  96. package/esm/node_modules/.pnpm/amqplib@0.10.9/node_modules/amqplib/lib/error.mjs.map +1 -0
  97. package/esm/node_modules/{amqplib → .pnpm/amqplib@0.10.9/node_modules/amqplib}/lib/format.mjs +2 -2
  98. package/esm/node_modules/.pnpm/amqplib@0.10.9/node_modules/amqplib/lib/format.mjs.map +1 -0
  99. package/esm/node_modules/{amqplib → .pnpm/amqplib@0.10.9/node_modules/amqplib}/lib/frame.mjs +3 -3
  100. package/esm/node_modules/.pnpm/amqplib@0.10.9/node_modules/amqplib/lib/frame.mjs.map +1 -0
  101. package/esm/node_modules/{amqplib → .pnpm/amqplib@0.10.9/node_modules/amqplib}/lib/heartbeat.mjs +2 -2
  102. package/esm/node_modules/.pnpm/amqplib@0.10.9/node_modules/amqplib/lib/heartbeat.mjs.map +1 -0
  103. package/esm/node_modules/{amqplib → .pnpm/amqplib@0.10.9/node_modules/amqplib}/lib/mux.mjs +2 -2
  104. package/esm/node_modules/.pnpm/amqplib@0.10.9/node_modules/amqplib/lib/mux.mjs.map +1 -0
  105. package/esm/node_modules/{amqplib → .pnpm/amqplib@0.10.9/node_modules/amqplib}/package.mjs +2 -2
  106. package/esm/node_modules/.pnpm/amqplib@0.10.9/node_modules/amqplib/package.mjs.map +1 -0
  107. package/esm/node_modules/{buffer-more-ints → .pnpm/buffer-more-ints@1.0.0/node_modules/buffer-more-ints}/buffer-more-ints.mjs +2 -2
  108. package/esm/node_modules/.pnpm/buffer-more-ints@1.0.0/node_modules/buffer-more-ints/buffer-more-ints.mjs.map +1 -0
  109. package/esm/node_modules/{dayjs → .pnpm/dayjs@1.11.23/node_modules/dayjs}/dayjs.min.mjs +2 -2
  110. package/esm/node_modules/.pnpm/dayjs@1.11.23/node_modules/dayjs/dayjs.min.mjs.map +1 -0
  111. package/esm/node_modules/{querystringify → .pnpm/querystringify@2.2.0/node_modules/querystringify}/index.mjs +2 -2
  112. package/esm/node_modules/.pnpm/querystringify@2.2.0/node_modules/querystringify/index.mjs.map +1 -0
  113. package/esm/node_modules/{requires-port → .pnpm/requires-port@1.0.0/node_modules/requires-port}/index.mjs +2 -2
  114. package/esm/node_modules/.pnpm/requires-port@1.0.0/node_modules/requires-port/index.mjs.map +1 -0
  115. package/esm/node_modules/{url-parse → .pnpm/url-parse@1.5.10/node_modules/url-parse}/index.mjs +4 -4
  116. package/esm/node_modules/.pnpm/url-parse@1.5.10/node_modules/url-parse/index.mjs.map +1 -0
  117. package/esm/queue/herald-queue.mjs.map +1 -1
  118. package/esm/queue/notifications-worker.mjs.map +1 -1
  119. package/esm/seal/src/factory/validators.mjs.map +1 -1
  120. package/esm/seal/src/helpers/get-field-value.mjs +2 -2
  121. package/esm/seal/src/helpers/is-empty-value.mjs +1 -1
  122. package/esm/seal/src/helpers/validation-helpers.mjs.map +1 -1
  123. package/esm/seal/src/mutators/array-mutators.mjs +2 -2
  124. package/esm/seal/src/mutators/date-mutators.mjs +1 -1
  125. package/esm/seal/src/mutators/number-mutators.mjs +3 -3
  126. package/esm/seal/src/mutators/number-mutators.mjs.map +1 -1
  127. package/esm/seal/src/mutators/object-mutators.mjs +3 -3
  128. package/esm/seal/src/mutators/scalar-mutators.mjs.map +1 -1
  129. package/esm/seal/src/mutators/string-mutators.mjs +10 -10
  130. package/esm/seal/src/mutators/string-mutators.mjs.map +1 -1
  131. package/esm/seal/src/rules/array/array-rules.mjs.map +1 -1
  132. package/esm/seal/src/rules/common/enum.mjs.map +1 -1
  133. package/esm/seal/src/rules/common/literal.mjs.map +1 -1
  134. package/esm/seal/src/rules/common/type-rules.mjs +1 -1
  135. package/esm/seal/src/rules/common/unknown-key.mjs.map +1 -1
  136. package/esm/seal/src/rules/conditional/present-with-rules.mjs +2 -2
  137. package/esm/seal/src/rules/conditional/present-without-rules.mjs +2 -2
  138. package/esm/seal/src/rules/conditional/required-if-rules.mjs +2 -2
  139. package/esm/seal/src/rules/conditional/required-if-rules.mjs.map +1 -1
  140. package/esm/seal/src/rules/conditional/required-with-rules.mjs +2 -2
  141. package/esm/seal/src/rules/conditional/required-without-rules.mjs +2 -2
  142. package/esm/seal/src/rules/core/union.mjs.map +1 -1
  143. package/esm/seal/src/rules/core/when.mjs +2 -2
  144. package/esm/seal/src/rules/core/when.mjs.map +1 -1
  145. package/esm/seal/src/rules/date/date-day-rules.mjs.map +1 -1
  146. package/esm/seal/src/rules/date/date-field-comparison-rules.mjs +2 -2
  147. package/esm/seal/src/rules/date/date-period-rules.mjs +2 -2
  148. package/esm/seal/src/rules/date/date-period-rules.mjs.map +1 -1
  149. package/esm/seal/src/rules/date/date-special-rules.mjs.map +1 -1
  150. package/esm/seal/src/rules/date/date.mjs +2 -2
  151. package/esm/seal/src/rules/date/date.mjs.map +1 -1
  152. package/esm/seal/src/rules/length/length-rules.mjs.map +1 -1
  153. package/esm/seal/src/rules/number/number-rules.mjs +2 -2
  154. package/esm/seal/src/rules/scalar/accepted-rule.mjs.map +1 -1
  155. package/esm/seal/src/rules/scalar/declined-rule.mjs.map +1 -1
  156. package/esm/seal/src/rules/string/credit-card.mjs.map +1 -1
  157. package/esm/seal/src/rules/string/email.mjs +1 -1
  158. package/esm/seal/src/rules/string/id-formats.mjs.map +1 -1
  159. package/esm/seal/src/rules/string/matches.mjs +1 -1
  160. package/esm/seal/src/rules/string/string-comparison.mjs.map +1 -1
  161. package/esm/seal/src/standard-schema/json-schema.mjs.map +1 -1
  162. package/esm/seal/src/standard-schema/map-result.mjs.map +1 -1
  163. package/esm/seal/src/validators/base-validator.mjs +2 -2
  164. package/esm/seal/src/validators/date-validator.mjs +1 -1
  165. package/esm/seal/src/validators/date-validator.mjs.map +1 -1
  166. package/esm/seal/src/validators/discriminated-union-validator.mjs +1 -1
  167. package/esm/seal/src/validators/discriminated-union-validator.mjs.map +1 -1
  168. package/esm/seal/src/validators/lazy-validator.mjs.map +1 -1
  169. package/esm/seal/src/validators/methods/required-methods.mjs.map +1 -1
  170. package/esm/seal/src/validators/numeric-validator.mjs +1 -1
  171. package/esm/seal/src/validators/object-validator.mjs +3 -3
  172. package/esm/seal/src/validators/object-validator.mjs.map +1 -1
  173. package/esm/seal/src/validators/record-validator.mjs +1 -1
  174. package/esm/seal/src/validators/record-validator.mjs.map +1 -1
  175. package/esm/seal/src/validators/scalar-validator.mjs.map +1 -1
  176. package/esm/seal/src/validators/union-validator.mjs.map +1 -1
  177. package/llms-full.txt +4 -0
  178. package/package.json +9 -6
  179. package/skills/notifications-basics/SKILL.md +4 -0
  180. package/cjs/channel_api-CH3DxhRU.cjs.map +0 -1
  181. package/cjs/chunk-fl3r8ClO.cjs +0 -41
  182. package/cjs/rabbitmq-driver-CJtyxjUQ.cjs +0 -3
  183. package/cjs/src-Cus6pYPC.cjs.map +0 -1
  184. package/esm/node_modules/@mongez/reinforcements/esm/Random/_internal.mjs +0 -6
  185. package/esm/node_modules/@mongez/reinforcements/esm/Random/_internal.mjs.map +0 -1
  186. package/esm/node_modules/@mongez/reinforcements/esm/mixed/clone/clone.mjs.map +0 -1
  187. package/esm/node_modules/@mongez/reinforcements/esm/number/round.mjs.map +0 -1
  188. package/esm/node_modules/@mongez/reinforcements/esm/object/except.mjs.map +0 -1
  189. package/esm/node_modules/@mongez/reinforcements/esm/object/get.mjs.map +0 -1
  190. package/esm/node_modules/@mongez/reinforcements/esm/object/omit.mjs.map +0 -1
  191. package/esm/node_modules/@mongez/reinforcements/esm/object/unset.mjs.map +0 -1
  192. package/esm/node_modules/@mongez/reinforcements/esm/string/capitalize.mjs.map +0 -1
  193. package/esm/node_modules/@mongez/reinforcements/esm/string/ltrim.mjs.map +0 -1
  194. package/esm/node_modules/@mongez/reinforcements/esm/string/readMoreChars.mjs.map +0 -1
  195. package/esm/node_modules/@mongez/reinforcements/esm/string/rtrim.mjs.map +0 -1
  196. package/esm/node_modules/@mongez/reinforcements/esm/string/toCamelCase.mjs.map +0 -1
  197. package/esm/node_modules/@mongez/reinforcements/esm/string/toKebabCase.mjs.map +0 -1
  198. package/esm/node_modules/@mongez/reinforcements/esm/string/toSnakeCase.mjs.map +0 -1
  199. package/esm/node_modules/@mongez/reinforcements/esm/string/toStudlyCase.mjs.map +0 -1
  200. package/esm/node_modules/@mongez/reinforcements/esm/string/trim.mjs.map +0 -1
  201. package/esm/node_modules/@mongez/reinforcements/esm/string/ucfirst.mjs.map +0 -1
  202. package/esm/node_modules/@mongez/reinforcements/esm/string/words.mjs.map +0 -1
  203. package/esm/node_modules/@mongez/reinforcements/esm/utils/escapeRegex.mjs.map +0 -1
  204. package/esm/node_modules/@mongez/reinforcements/esm/utils/lazy.mjs.map +0 -1
  205. package/esm/node_modules/@mongez/reinforcements/esm/utils/tap.mjs.map +0 -1
  206. package/esm/node_modules/@mongez/supportive-is/esm/index.mjs.map +0 -1
  207. package/esm/node_modules/amqplib/channel_api.mjs.map +0 -1
  208. package/esm/node_modules/amqplib/lib/api_args.mjs.map +0 -1
  209. package/esm/node_modules/amqplib/lib/bitset.mjs.map +0 -1
  210. package/esm/node_modules/amqplib/lib/channel.mjs.map +0 -1
  211. package/esm/node_modules/amqplib/lib/channel_model.mjs.map +0 -1
  212. package/esm/node_modules/amqplib/lib/codec.mjs.map +0 -1
  213. package/esm/node_modules/amqplib/lib/connect.mjs.map +0 -1
  214. package/esm/node_modules/amqplib/lib/connection.mjs.map +0 -1
  215. package/esm/node_modules/amqplib/lib/credentials.mjs.map +0 -1
  216. package/esm/node_modules/amqplib/lib/defs.mjs.map +0 -1
  217. package/esm/node_modules/amqplib/lib/error.mjs.map +0 -1
  218. package/esm/node_modules/amqplib/lib/format.mjs.map +0 -1
  219. package/esm/node_modules/amqplib/lib/frame.mjs.map +0 -1
  220. package/esm/node_modules/amqplib/lib/heartbeat.mjs.map +0 -1
  221. package/esm/node_modules/amqplib/lib/mux.mjs.map +0 -1
  222. package/esm/node_modules/amqplib/package.mjs.map +0 -1
  223. package/esm/node_modules/buffer-more-ints/buffer-more-ints.mjs.map +0 -1
  224. package/esm/node_modules/dayjs/dayjs.min.mjs.map +0 -1
  225. package/esm/node_modules/querystringify/index.mjs.map +0 -1
  226. package/esm/node_modules/requires-port/index.mjs.map +0 -1
  227. package/esm/node_modules/url-parse/index.mjs.map +0 -1
  228. /package/esm/node_modules/{@mongez → .pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez}/reinforcements/esm/Random/bool.mjs +0 -0
  229. /package/esm/node_modules/{@mongez → .pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez}/reinforcements/esm/Random/color.mjs +0 -0
  230. /package/esm/node_modules/{@mongez → .pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez}/reinforcements/esm/Random/date.mjs +0 -0
  231. /package/esm/node_modules/{@mongez → .pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez}/reinforcements/esm/Random/float.mjs +0 -0
  232. /package/esm/node_modules/{@mongez → .pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez}/reinforcements/esm/Random/id.mjs +0 -0
  233. /package/esm/node_modules/{@mongez → .pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez}/reinforcements/esm/Random/int.mjs +0 -0
  234. /package/esm/node_modules/{@mongez → .pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez}/reinforcements/esm/Random/nanoid.mjs +0 -0
  235. /package/esm/node_modules/{@mongez → .pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez}/reinforcements/esm/Random/pick.mjs +0 -0
  236. /package/esm/node_modules/{@mongez → .pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez}/reinforcements/esm/Random/random.mjs +0 -0
  237. /package/esm/node_modules/{@mongez → .pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez}/reinforcements/esm/Random/sample.mjs +0 -0
  238. /package/esm/node_modules/{@mongez → .pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez}/reinforcements/esm/Random/string.mjs +0 -0
  239. /package/esm/node_modules/{@mongez → .pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez}/reinforcements/esm/Random/token.mjs +0 -0
  240. /package/esm/node_modules/{@mongez → .pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez}/reinforcements/esm/Random/uuid.mjs +0 -0
  241. /package/esm/node_modules/{@mongez → .pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez}/reinforcements/esm/Random/weighted.mjs +0 -0
  242. /package/esm/node_modules/{@mongez → .pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez}/reinforcements/esm/async/retry.mjs +0 -0
  243. /package/esm/node_modules/{@mongez → .pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez}/reinforcements/esm/index.mjs +0 -0
@@ -1,13 +1,13 @@
1
- import { capitalize } from "../../../node_modules/@mongez/reinforcements/esm/string/capitalize.mjs";
2
- import { trim } from "../../../node_modules/@mongez/reinforcements/esm/string/trim.mjs";
3
- import { ltrim } from "../../../node_modules/@mongez/reinforcements/esm/string/ltrim.mjs";
4
- import { readMoreChars } from "../../../node_modules/@mongez/reinforcements/esm/string/readMoreChars.mjs";
5
- import { rtrim } from "../../../node_modules/@mongez/reinforcements/esm/string/rtrim.mjs";
6
- import { toCamelCase } from "../../../node_modules/@mongez/reinforcements/esm/string/toCamelCase.mjs";
7
- import { toSnakeCase } from "../../../node_modules/@mongez/reinforcements/esm/string/toSnakeCase.mjs";
8
- import { toKebabCase } from "../../../node_modules/@mongez/reinforcements/esm/string/toKebabCase.mjs";
9
- import { toStudlyCase } from "../../../node_modules/@mongez/reinforcements/esm/string/toStudlyCase.mjs";
10
- import "../../../node_modules/@mongez/reinforcements/esm/index.mjs";
1
+ import { capitalize } from "../../../node_modules/.pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez/reinforcements/esm/string/capitalize.mjs";
2
+ import { trim } from "../../../node_modules/.pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez/reinforcements/esm/string/trim.mjs";
3
+ import { ltrim } from "../../../node_modules/.pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez/reinforcements/esm/string/ltrim.mjs";
4
+ import { readMoreChars } from "../../../node_modules/.pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez/reinforcements/esm/string/readMoreChars.mjs";
5
+ import { rtrim } from "../../../node_modules/.pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez/reinforcements/esm/string/rtrim.mjs";
6
+ import { toCamelCase } from "../../../node_modules/.pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez/reinforcements/esm/string/toCamelCase.mjs";
7
+ import { toSnakeCase } from "../../../node_modules/.pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez/reinforcements/esm/string/toSnakeCase.mjs";
8
+ import { toKebabCase } from "../../../node_modules/.pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez/reinforcements/esm/string/toKebabCase.mjs";
9
+ import { toStudlyCase } from "../../../node_modules/.pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez/reinforcements/esm/string/toStudlyCase.mjs";
10
+ import "../../../node_modules/.pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez/reinforcements/esm/index.mjs";
11
11
 
12
12
  //#region ../seal/src/mutators/string-mutators.ts
13
13
  /** Convert string to lowercase */
@@ -1 +1 @@
1
- {"version":3,"file":"string-mutators.mjs","names":[],"sources":["../../../../../../../../../seal/src/mutators/string-mutators.ts"],"sourcesContent":["import {\r\n capitalize,\r\n ltrim,\r\n readMoreChars,\r\n rtrim,\r\n toCamelCase,\r\n toKebabCase,\r\n toSnakeCase,\r\n toStudlyCase,\r\n trim,\r\n} from \"@mongez/reinforcements\";\r\nimport type { Mutator } from \"../types\";\r\n\r\n/** Convert string to lowercase */\r\nexport const lowercaseMutator: Mutator = async (value) => {\r\n return value?.toString().toLowerCase();\r\n};\r\n\r\n/** Convert string to uppercase */\r\nexport const uppercaseMutator: Mutator = async (value) => {\r\n return value?.toString().toUpperCase();\r\n};\r\n\r\n/** Capitalize only the first letter of the string */\r\nexport const capitalizeMutator: Mutator = async (value) => {\r\n const str = value?.toString();\r\n return str.charAt(0).toUpperCase() + str.slice(1).toLowerCase();\r\n};\r\n\r\n/** Capitalize the first letter of each word (Title Case) */\r\nexport const titleCaseMutator: Mutator = async (value) => {\r\n return capitalize(value?.toString());\r\n};\r\n\r\n/** Convert value to string */\r\nexport const stringifyMutator: Mutator = async (value) => {\r\n if (!value && value !== 0) return \"\";\r\n // only convert numbers, boolean and strings\r\n\r\n // Handle strings (pass through)\r\n if (typeof value === \"string\") return value;\r\n\r\n // Handle scalar types (number, boolean)\r\n if (typeof value === \"number\" || typeof value === \"boolean\") {\r\n return String(value);\r\n }\r\n};\r\n\r\n/** Trim whitespace */\r\nexport const trimMutator: Mutator = async (value, context) => {\r\n return trim(value?.toString(), context?.options?.needle ?? \" \");\r\n};\r\n\r\n/**\r\n * Strip HTML tags with a naive `<...>` regex.\r\n *\r\n * This is a **tag stripper, not an XSS sanitizer**: it is not a parser, so\r\n * malformed/nested markup, attribute payloads, or content re-introduced\r\n * later in a pipeline can defeat it. Do not rely on this alone to make\r\n * untrusted rich text safe to render — use a real parser-based sanitizer\r\n * (e.g. DOMPurify / sanitize-html) for that.\r\n */\r\nexport const stripTagsMutator: Mutator = async (value) => {\r\n return value?.toString().replace(/<[^>]*>?/gm, \"\");\r\n};\r\n\r\n/**\r\n * @deprecated Renamed to {@link stripTagsMutator} — the old name implied\r\n * XSS safety this tag-stripping regex does not provide. Kept as an alias\r\n * for backward compatibility; switch to `stripTagsMutator`.\r\n */\r\nexport const safeHtmlMutator: Mutator = stripTagsMutator;\r\n\r\n/** HTML escape */\r\nexport const htmlEscapeMutator: Mutator = async (value) => {\r\n return value\r\n ?.toString()\r\n .replace(/&/g, \"&amp;\")\r\n .replace(/</g, \"&lt;\")\r\n .replace(/>/g, \"&gt;\")\r\n .replace(/\"/g, \"&quot;\")\r\n .replace(/'/g, \"&#039;\");\r\n};\r\n\r\n/** Remove special characters */\r\nexport const removeSpecialCharactersMutator: Mutator = async (value) => {\r\n return value?.toString().replace(/[^a-zA-Z0-9]/g, \"\");\r\n};\r\n\r\n/** URL decode */\r\nexport const urlDecodeMutator: Mutator = async (value) => {\r\n return decodeURIComponent(value);\r\n};\r\n\r\n/** URL encode */\r\nexport const urlEncodeMutator: Mutator = async (value) => {\r\n return encodeURIComponent(value);\r\n};\r\n\r\n/** Convert to camelCase */\r\nexport const camelCaseMutator: Mutator = async (value) => {\r\n return toCamelCase(value?.toString());\r\n};\r\n\r\n/** Convert to PascalCase */\r\nexport const pascalCaseMutator: Mutator = async (value) => {\r\n return toStudlyCase(value?.toString());\r\n};\r\n\r\n/** Convert to snake_case */\r\nexport const snakeCaseMutator: Mutator = async (value) => {\r\n return toSnakeCase(value?.toString());\r\n};\r\n\r\n/** Convert to kebab-case */\r\nexport const kebabCaseMutator: Mutator = async (value) => {\r\n return toKebabCase(value?.toString());\r\n};\r\n\r\n/** Convert to URL-friendly slug */\r\nexport const slugMutator: Mutator = async (value) => {\r\n return value\r\n ?.toString()\r\n .toLowerCase()\r\n .trim()\r\n .replace(/[^\\w\\s-]/g, \"\")\r\n .replace(/[\\s_]+/g, \"-\")\r\n .replace(/--+/g, \"-\")\r\n .replace(/^-+|-+$/g, \"\");\r\n};\r\n\r\n/** Trim from the left/start */\r\nexport const ltrimMutator: Mutator = async (value, context) => {\r\n return ltrim(value?.toString(), context?.options?.needle ?? \" \");\r\n};\r\n\r\n/** Trim from the right/end */\r\nexport const rtrimMutator: Mutator = async (value, context) => {\r\n return rtrim(value?.toString(), context?.options?.needle ?? \" \");\r\n};\r\n\r\n/** Base64 encode */\r\nexport const base64EncodeMutator: Mutator = async (value) => {\r\n return Buffer.from(value?.toString()).toString(\"base64\");\r\n};\r\n\r\n/** Base64 decode */\r\nexport const base64DecodeMutator: Mutator = async (value) => {\r\n return Buffer.from(value?.toString(), \"base64\").toString(\"utf-8\");\r\n};\r\n\r\n/** Replace substring or pattern */\r\nexport const replaceMutator: Mutator = async (value, context) => {\r\n const { search, replace } = context?.options;\r\n if (!search) return value?.toString();\r\n return value?.toString().replace(search, replace ?? \"\");\r\n};\r\n\r\n/** Replace all occurrences of substring or pattern */\r\nexport const replaceAllMutator: Mutator = async (value, context) => {\r\n const { search, replace } = context?.options;\r\n if (!search) return value?.toString();\r\n const searchValue = typeof search === \"string\" ? new RegExp(search, \"g\") : search;\r\n return value?.toString().replace(searchValue, replace ?? \"\");\r\n};\r\n\r\n/** Append/suffix text to the end */\r\nexport const appendMutator: Mutator = async (value, context) => {\r\n const suffix = context?.options?.suffix ?? \"\";\r\n return value?.toString() + suffix;\r\n};\r\n\r\n/** Prepend/prefix text to the beginning */\r\nexport const prependMutator: Mutator = async (value, context) => {\r\n const prefix = context?.options?.prefix ?? \"\";\r\n return prefix + value?.toString();\r\n};\r\n\r\n/** Reverse the string */\r\nexport const reverseMutator: Mutator = async (value) => {\r\n return value?.toString().split(\"\").reverse().join(\"\");\r\n};\r\n\r\n/** Truncate to a maximum length */\r\nexport const truncateMutator: Mutator = async (value, context) => {\r\n const str = value?.toString();\r\n const maxLength = context?.options?.maxLength ?? 100;\r\n const suffix = context?.options?.suffix ?? \"...\";\r\n return readMoreChars(str, maxLength, suffix);\r\n};\r\n\r\n/** Trim multiple whitespace into single space */\r\nexport const trimMultipleWhitespaceMutator: Mutator = async (value) => {\r\n return value?.toString().replace(/\\s+/g, \" \");\r\n};\r\n\r\n/** Pad string from the start to reach target length */\r\nexport const padStartMutator: Mutator = async (value, context) => {\r\n const length = context?.options?.length ?? 0;\r\n const char = context?.options?.char ?? \" \";\r\n return value?.toString().padStart(length, char);\r\n};\r\n\r\n/** Pad string from the end to reach target length */\r\nexport const padEndMutator: Mutator = async (value, context) => {\r\n const length = context?.options?.length ?? 0;\r\n const char = context?.options?.char ?? \" \";\r\n return value?.toString().padEnd(length, char);\r\n};\r\n\r\n/** Repeat string N times */\r\nexport const repeatMutator: Mutator = async (value, context) => {\r\n const count = context?.options?.count ?? 1;\r\n return value?.toString()?.repeat(count);\r\n};\r\n\r\n/** Mask part of string */\r\nexport const maskMutator: Mutator = async (value, context) => {\r\n const str = value?.toString();\r\n const maskChar = context?.options?.char ?? \"*\";\r\n const start = context?.options?.start ?? 0;\r\n const end = context?.options?.end ?? str?.length;\r\n const visibleStart = str?.substring(0, start);\r\n const visibleEnd = str?.substring(end);\r\n const maskedLength = end - start;\r\n return visibleStart + maskChar.repeat(maskedLength) + visibleEnd;\r\n};\r\n\r\n/** Unescape HTML entities */\r\nexport const unescapeHtmlMutator: Mutator = async (value) => {\r\n return value\r\n ?.toString()\r\n .replace(/&amp;/g, \"&\")\r\n .replace(/&lt;/g, \"<\")\r\n .replace(/&gt;/g, \">\")\r\n .replace(/&quot;/g, '\"')\r\n .replace(/&#039;/g, \"'\");\r\n};\r\n\r\n/** Keep only alphabetic characters */\r\nexport const alphaOnlyMutator: Mutator = async (value) => {\r\n return value.toString().replace(/[^a-zA-Z]/g, \"\");\r\n};\r\n\r\n/** Keep only alphanumeric characters */\r\nexport const alphanumericOnlyMutator: Mutator = async (value) => {\r\n return value.toString().replace(/[^a-zA-Z0-9]/g, \"\");\r\n};\r\n\r\n/** Remove all numeric characters */\r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AAGA,MAAa,gBAAyB,OAAO,OAAO,YAAY;CAC9D,MAAM,QAAQ,SAAS,SAAS,SAAS;CACzC,OAAO,OAAO,SAAS,CAAC,EAAE,OAAO,KAAK;AACxC;;AAGA,MAAa,cAAuB,OAAO,OAAO,YAAY;CAC5D,MAAM,MAAM,OAAO,SAAS;CAC5B,MAAM,WAAW,SAAS,SAAS,QAAQ;CAC3C,MAAM,QAAQ,SAAS,SAAS,SAAS;CACzC,MAAM,MAAM,SAAS,SAAS,OAAO,KAAK;CAC1C,MAAM,eAAe,KAAK,UAAU,GAAG,KAAK;CAC5C,MAAM,aAAa,KAAK,UAAU,GAAG;CACrC,MAAM,eAAe,MAAM;CAC3B,OAAO,eAAe,SAAS,OAAO,YAAY,IAAI;AACxD;;AAGA,MAAa,sBAA+B,OAAO,UAAU;CAC3D,OAAO,OACH,SAAS,CAAC,CACX,QAAQ,UAAU,GAAG,CAAC,CACtB,QAAQ,SAAS,GAAG,CAAC,CACrB,QAAQ,SAAS,GAAG,CAAC,CACrB,QAAQ,WAAW,IAAG,CAAC,CACvB,QAAQ,WAAW,GAAG;AAC3B;;AAGA,MAAa,mBAA4B,OAAO,UAAU;CACxD,OAAO,MAAM,SAAS,CAAC,CAAC,QAAQ,cAAc,EAAE;AAClD;;AAGA,MAAa,0BAAmC,OAAO,UAAU;CAC/D,OAAO,MAAM,SAAS,CAAC,CAAC,QAAQ,iBAAiB,EAAE;AACrD;;AAGA,MAAa,uBAAgC,OAAO,UAAU;CAC5D,OAAO,MAAM,SAAS,CAAC,CAAC,QAAQ,UAAU,EAAE;AAC9C"}
1
+ {"version":3,"file":"string-mutators.mjs","names":[],"sources":["../../../../../../../../../seal/src/mutators/string-mutators.ts"],"sourcesContent":["import {\r\n capitalize,\r\n ltrim,\r\n readMoreChars,\r\n rtrim,\r\n toCamelCase,\r\n toKebabCase,\r\n toSnakeCase,\r\n toStudlyCase,\r\n trim,\r\n} from \"@mongez/reinforcements\";\r\nimport type { Mutator } from \"../types\";\r\n\r\n/** Convert string to lowercase */\r\nexport const lowercaseMutator: Mutator = async (value) => {\r\n return value?.toString().toLowerCase();\r\n};\r\n\r\n/** Convert string to uppercase */\r\nexport const uppercaseMutator: Mutator = async (value) => {\r\n return value?.toString().toUpperCase();\r\n};\r\n\r\n/** Capitalize only the first letter of the string */\r\nexport const capitalizeMutator: Mutator = async (value) => {\r\n const str = value?.toString();\r\n return str.charAt(0).toUpperCase() + str.slice(1).toLowerCase();\r\n};\r\n\r\n/** Capitalize the first letter of each word (Title Case) */\r\nexport const titleCaseMutator: Mutator = async (value) => {\r\n return capitalize(value?.toString());\r\n};\r\n\r\n/** Convert value to string */\r\nexport const stringifyMutator: Mutator = async (value) => {\r\n if (!value && value !== 0) return \"\";\r\n // only convert numbers, boolean and strings\r\n\r\n // Handle strings (pass through)\r\n if (typeof value === \"string\") return value;\r\n\r\n // Handle scalar types (number, boolean)\r\n if (typeof value === \"number\" || typeof value === \"boolean\") {\r\n return String(value);\r\n }\r\n};\r\n\r\n/** Trim whitespace */\r\nexport const trimMutator: Mutator = async (value, context) => {\r\n return trim(value?.toString(), context?.options?.needle ?? \" \");\r\n};\r\n\r\n/**\r\n * Strip HTML tags with a naive `<...>` regex.\r\n *\r\n * This is a **tag stripper, not an XSS sanitizer**: it is not a parser, so\r\n * malformed/nested markup, attribute payloads, or content re-introduced\r\n * later in a pipeline can defeat it. Do not rely on this alone to make\r\n * untrusted rich text safe to render — use a real parser-based sanitizer\r\n * (e.g. DOMPurify / sanitize-html) for that.\r\n */\r\nexport const stripTagsMutator: Mutator = async (value) => {\r\n return value?.toString().replace(/<[^>]*>?/gm, \"\");\r\n};\r\n\r\n/**\r\n * @deprecated Renamed to {@link stripTagsMutator} — the old name implied\r\n * XSS safety this tag-stripping regex does not provide. Kept as an alias\r\n * for backward compatibility; switch to `stripTagsMutator`.\r\n */\r\nexport const safeHtmlMutator: Mutator = stripTagsMutator;\r\n\r\n/** HTML escape */\r\nexport const htmlEscapeMutator: Mutator = async (value) => {\r\n return value\r\n ?.toString()\r\n .replace(/&/g, \"&amp;\")\r\n .replace(/</g, \"&lt;\")\r\n .replace(/>/g, \"&gt;\")\r\n .replace(/\"/g, \"&quot;\")\r\n .replace(/'/g, \"&#039;\");\r\n};\r\n\r\n/** Remove special characters */\r\nexport const removeSpecialCharactersMutator: Mutator = async (value) => {\r\n return value?.toString().replace(/[^a-zA-Z0-9]/g, \"\");\r\n};\r\n\r\n/** URL decode */\r\nexport const urlDecodeMutator: Mutator = async (value) => {\r\n return decodeURIComponent(value);\r\n};\r\n\r\n/** URL encode */\r\nexport const urlEncodeMutator: Mutator = async (value) => {\r\n return encodeURIComponent(value);\r\n};\r\n\r\n/** Convert to camelCase */\r\nexport const camelCaseMutator: Mutator = async (value) => {\r\n return toCamelCase(value?.toString());\r\n};\r\n\r\n/** Convert to PascalCase */\r\nexport const pascalCaseMutator: Mutator = async (value) => {\r\n return toStudlyCase(value?.toString());\r\n};\r\n\r\n/** Convert to snake_case */\r\nexport const snakeCaseMutator: Mutator = async (value) => {\r\n return toSnakeCase(value?.toString());\r\n};\r\n\r\n/** Convert to kebab-case */\r\nexport const kebabCaseMutator: Mutator = async (value) => {\r\n return toKebabCase(value?.toString());\r\n};\r\n\r\n/** Convert to URL-friendly slug */\r\nexport const slugMutator: Mutator = async (value) => {\r\n return value\r\n ?.toString()\r\n .toLowerCase()\r\n .trim()\r\n .replace(/[^\\w\\s-]/g, \"\")\r\n .replace(/[\\s_]+/g, \"-\")\r\n .replace(/--+/g, \"-\")\r\n .replace(/^-+|-+$/g, \"\");\r\n};\r\n\r\n/** Trim from the left/start */\r\nexport const ltrimMutator: Mutator = async (value, context) => {\r\n return ltrim(value?.toString(), context?.options?.needle ?? \" \");\r\n};\r\n\r\n/** Trim from the right/end */\r\nexport const rtrimMutator: Mutator = async (value, context) => {\r\n return rtrim(value?.toString(), context?.options?.needle ?? \" \");\r\n};\r\n\r\n/** Base64 encode */\r\nexport const base64EncodeMutator: Mutator = async (value) => {\r\n return Buffer.from(value?.toString()).toString(\"base64\");\r\n};\r\n\r\n/** Base64 decode */\r\nexport const base64DecodeMutator: Mutator = async (value) => {\r\n return Buffer.from(value?.toString(), \"base64\").toString(\"utf-8\");\r\n};\r\n\r\n/** Replace substring or pattern */\r\nexport const replaceMutator: Mutator = async (value, context) => {\r\n const { search, replace } = context?.options;\r\n if (!search) return value?.toString();\r\n return value?.toString().replace(search, replace ?? \"\");\r\n};\r\n\r\n/** Replace all occurrences of substring or pattern */\r\nexport const replaceAllMutator: Mutator = async (value, context) => {\r\n const { search, replace } = context?.options;\r\n if (!search) return value?.toString();\r\n const searchValue = typeof search === \"string\" ? new RegExp(search, \"g\") : search;\r\n return value?.toString().replace(searchValue, replace ?? \"\");\r\n};\r\n\r\n/** Append/suffix text to the end */\r\nexport const appendMutator: Mutator = async (value, context) => {\r\n const suffix = context?.options?.suffix ?? \"\";\r\n return value?.toString() + suffix;\r\n};\r\n\r\n/** Prepend/prefix text to the beginning */\r\nexport const prependMutator: Mutator = async (value, context) => {\r\n const prefix = context?.options?.prefix ?? \"\";\r\n return prefix + value?.toString();\r\n};\r\n\r\n/** Reverse the string */\r\nexport const reverseMutator: Mutator = async (value) => {\r\n return value?.toString().split(\"\").reverse().join(\"\");\r\n};\r\n\r\n/** Truncate to a maximum length */\r\nexport const truncateMutator: Mutator = async (value, context) => {\r\n const str = value?.toString();\r\n const maxLength = context?.options?.maxLength ?? 100;\r\n const suffix = context?.options?.suffix ?? \"...\";\r\n return readMoreChars(str, maxLength, suffix);\r\n};\r\n\r\n/** Trim multiple whitespace into single space */\r\nexport const trimMultipleWhitespaceMutator: Mutator = async (value) => {\r\n return value?.toString().replace(/\\s+/g, \" \");\r\n};\r\n\r\n/** Pad string from the start to reach target length */\r\nexport const padStartMutator: Mutator = async (value, context) => {\r\n const length = context?.options?.length ?? 0;\r\n const char = context?.options?.char ?? \" \";\r\n return value?.toString().padStart(length, char);\r\n};\r\n\r\n/** Pad string from the end to reach target length */\r\nexport const padEndMutator: Mutator = async (value, context) => {\r\n const length = context?.options?.length ?? 0;\r\n const char = context?.options?.char ?? \" \";\r\n return value?.toString().padEnd(length, char);\r\n};\r\n\r\n/** Repeat string N times */\r\nexport const repeatMutator: Mutator = async (value, context) => {\r\n const count = context?.options?.count ?? 1;\r\n return value?.toString()?.repeat(count);\r\n};\r\n\r\n/** Mask part of string */\r\nexport const maskMutator: Mutator = async (value, context) => {\r\n const str = value?.toString();\r\n const maskChar = context?.options?.char ?? \"*\";\r\n const start = context?.options?.start ?? 0;\r\n const end = context?.options?.end ?? str?.length;\r\n const visibleStart = str?.substring(0, start);\r\n const visibleEnd = str?.substring(end);\r\n const maskedLength = end - start;\r\n return visibleStart + maskChar.repeat(maskedLength) + visibleEnd;\r\n};\r\n\r\n/** Unescape HTML entities */\r\nexport const unescapeHtmlMutator: Mutator = async (value) => {\r\n return value\r\n ?.toString()\r\n .replace(/&amp;/g, \"&\")\r\n .replace(/&lt;/g, \"<\")\r\n .replace(/&gt;/g, \">\")\r\n .replace(/&quot;/g, '\"')\r\n .replace(/&#039;/g, \"'\");\r\n};\r\n\r\n/** Keep only alphabetic characters */\r\nexport const alphaOnlyMutator: Mutator = async (value) => {\r\n return value.toString().replace(/[^a-zA-Z]/g, \"\");\r\n};\r\n\r\n/** Keep only alphanumeric characters */\r\nexport const alphanumericOnlyMutator: Mutator = async (value) => {\r\n return value.toString().replace(/[^a-zA-Z0-9]/g, \"\");\r\n};\r\n\r\n/** Remove all numeric characters */\r\nexport const removeNumbersMutator: Mutator = async (value) => {\r\n return value.toString().replace(/[0-9]/g, \"\");\r\n};\r\n"],"mappings":";;;;;;;;;;;;;AAcA,MAAa,mBAA4B,OAAO,UAAU;CACxD,OAAO,OAAO,SAAS,EAAE,YAAY;AACvC;;AAGA,MAAa,mBAA4B,OAAO,UAAU;CACxD,OAAO,OAAO,SAAS,EAAE,YAAY;AACvC;;AAGA,MAAa,oBAA6B,OAAO,UAAU;CACzD,MAAM,MAAM,OAAO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D;;AAGA,MAAa,sBAA+B,OAAO,UAAU;CAC3D,OAAO,OACH,SAAS,EACV,QAAQ,UAAU,GAAG,EACrB,QAAQ,SAAS,GAAG,EACpB,QAAQ,SAAS,GAAG,EACpB,QAAQ,WAAW,IAAG,EACtB,QAAQ,WAAW,GAAG;AAC3B;;AAGA,MAAa,mBAA4B,OAAO,UAAU;CACxD,OAAO,MAAM,SAAS,EAAE,QAAQ,cAAc,EAAE;AAClD;;AAGA,MAAa,0BAAmC,OAAO,UAAU;CAC/D,OAAO,MAAM,SAAS,EAAE,QAAQ,iBAAiB,EAAE;AACrD;;AAGA,MAAa,uBAAgC,OAAO,UAAU;CAC5D,OAAO,MAAM,SAAS,EAAE,QAAQ,UAAU,EAAE;AAC9C"}
@@ -1 +1 @@
1
- {"version":3,"file":"array-rules.mjs","names":[],"sources":["../../../../../../../../../../seal/src/rules/array/array-rules.ts"],"sourcesContent":["import { invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\n/**\r\n * Unique array rule - array must contain unique values\r\n */\r\nexport const uniqueArrayRule: SchemaRule = {\r\n name: \"uniqueArray\",\r\n description: \"The array must contain unique values\",\r\n defaultErrorMessage: \"The :input must contain unique values\",\r\n async validate(value: any, context) {\r\n const uniqueValues = new Set(value);\r\n\r\n if (uniqueValues.size === value.length) {\r\n return VALID_RULE;\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Sorted array rule - array must be sorted\r\n */\r\nexport const sortedArrayRule: SchemaRule<{\r\n direction?: \"asc\" | \"desc\";\r\n}> = {\r\n name: \"sortedArray\",\r\n description: \"The array must be sorted\",\r\n defaultErrorMessage: \"The :input must be sorted\",\r\n async validate(value: any[], context) {\r\n if (!Array.isArray(value) || value.length <= 1) {\r\n return VALID_RULE;\r\n }\r\n\r\n const direction = this.context.options.direction ?? \"asc\";\r\n this.context.translatableParams.direction = direction;\r\n\r\n for (let i = 0; i < value.length - 1; i++) {\r\n const current = value[i];\r\n const next = value[i + 1];\r\n\r\n if (direction === \"asc\") {\r\n if (current > next) {\r\n return invalidRule(this, context);\r\n }\r\n } else {\r\n if (current < next) {\r\n return invalidRule(this, context);\r\n }\r\n }\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n"],"mappings":";;;;;;;AAMA,MAAa,kBAA8B;CACzC,MAAM;CACN,aAAa;CACb,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAGlC,IAAI,IAFqB,IAAI,KAEd,CAAC,CAAC,SAAS,MAAM,QAC9B,OAAO;EAGT,OAAO,YAAY,MAAM,OAAO;CAClC;AACF;;;;AAKA,MAAa,kBAER;CACH,MAAM;CACN,aAAa;CACb,qBAAqB;CACrB,MAAM,SAAS,OAAc,SAAS;EACpC,IAAI,CAAC,MAAM,QAAQ,KAAK,KAAK,MAAM,UAAU,GAC3C,OAAO;EAGT,MAAM,YAAY,KAAK,QAAQ,QAAQ,aAAa;EACpD,KAAK,QAAQ,mBAAmB,YAAY;EAE5C,KAAK,IAAI,IAAI,GAAG,IAAI,MAAM,SAAS,GAAG,KAAK;GACzC,MAAM,UAAU,MAAM;GACtB,MAAM,OAAO,MAAM,IAAI;GAEvB,IAAI,cAAc,OAChB;QAAI,UAAU,MACZ,OAAO,YAAY,MAAM,OAAO;GAClC,OAEA,IAAI,UAAU,MACZ,OAAO,YAAY,MAAM,OAAO;EAGtC;EAEA,OAAO;CACT;AACF"}
1
+ {"version":3,"file":"array-rules.mjs","names":[],"sources":["../../../../../../../../../../seal/src/rules/array/array-rules.ts"],"sourcesContent":["import { invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\n/**\r\n * Unique array rule - array must contain unique values\r\n */\r\nexport const uniqueArrayRule: SchemaRule = {\r\n name: \"uniqueArray\",\r\n description: \"The array must contain unique values\",\r\n defaultErrorMessage: \"The :input must contain unique values\",\r\n async validate(value: any, context) {\r\n const uniqueValues = new Set(value);\r\n\r\n if (uniqueValues.size === value.length) {\r\n return VALID_RULE;\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Sorted array rule - array must be sorted\r\n */\r\nexport const sortedArrayRule: SchemaRule<{\r\n direction?: \"asc\" | \"desc\";\r\n}> = {\r\n name: \"sortedArray\",\r\n description: \"The array must be sorted\",\r\n defaultErrorMessage: \"The :input must be sorted\",\r\n async validate(value: any[], context) {\r\n if (!Array.isArray(value) || value.length <= 1) {\r\n return VALID_RULE;\r\n }\r\n\r\n const direction = this.context.options.direction ?? \"asc\";\r\n this.context.translatableParams.direction = direction;\r\n\r\n for (let i = 0; i < value.length - 1; i++) {\r\n const current = value[i];\r\n const next = value[i + 1];\r\n\r\n if (direction === \"asc\") {\r\n if (current > next) {\r\n return invalidRule(this, context);\r\n }\r\n } else {\r\n if (current < next) {\r\n return invalidRule(this, context);\r\n }\r\n }\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n"],"mappings":";;;;;;;AAMA,MAAa,kBAA8B;CACzC,MAAM;CACN,aAAa;CACb,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAGlC,IAAI,IAFqB,IAAI,KAEd,EAAE,SAAS,MAAM,QAC9B,OAAO;EAGT,OAAO,YAAY,MAAM,OAAO;CAClC;AACF;;;;AAKA,MAAa,kBAER;CACH,MAAM;CACN,aAAa;CACb,qBAAqB;CACrB,MAAM,SAAS,OAAc,SAAS;EACpC,IAAI,CAAC,MAAM,QAAQ,KAAK,KAAK,MAAM,UAAU,GAC3C,OAAO;EAGT,MAAM,YAAY,KAAK,QAAQ,QAAQ,aAAa;EACpD,KAAK,QAAQ,mBAAmB,YAAY;EAE5C,KAAK,IAAI,IAAI,GAAG,IAAI,MAAM,SAAS,GAAG,KAAK;GACzC,MAAM,UAAU,MAAM;GACtB,MAAM,OAAO,MAAM,IAAI;GAEvB,IAAI,cAAc,OAChB;QAAI,UAAU,MACZ,OAAO,YAAY,MAAM,OAAO;GAClC,OAEA,IAAI,UAAU,MACZ,OAAO,YAAY,MAAM,OAAO;EAGtC;EAEA,OAAO;CACT;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"enum.mjs","names":[],"sources":["../../../../../../../../../../seal/src/rules/common/enum.ts"],"sourcesContent":["import { invalidRule, resolveTranslation, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\n/**\r\n * Enum rule - value must be one of the enum values\r\n */\r\nexport const enumRule: SchemaRule<{ enum: any }> = {\r\n name: \"enum\",\r\n defaultErrorMessage: \"The :input must be one of the following values: :enum\",\r\n async validate(value: any, context) {\r\n const enumValues = this.context.options.enum;\r\n\r\n if (enumValues.includes(value)) {\r\n return VALID_RULE;\r\n }\r\n\r\n // Translate each enum value individually, then join into a display string\r\n this.context.translationParams.enum = enumValues\r\n .map((v: any) =>\r\n resolveTranslation({ key: String(v), rawValue: String(v), rule: this, context }),\r\n )\r\n .join(\", \");\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * In rule - value must be in the given array\r\n */\r\nexport const inRule: SchemaRule<{ values: any[] }> = {\r\n name: \"in\",\r\n defaultErrorMessage: \"The :input must be one of the following values: :values\",\r\n async validate(value: any, context) {\r\n if (this.context.options.values.includes(value)) {\r\n return VALID_RULE;\r\n }\r\n\r\n // Translate each value individually, then join\r\n this.context.translationParams.values = this.context.options.values\r\n .map((v: any) =>\r\n resolveTranslation({ key: String(v), rawValue: String(v), rule: this, context }),\r\n )\r\n .join(\", \");\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Allowed values rule - value must be one of allowed values\r\n */\r\nexport const allowedValuesRule: SchemaRule<{ allowedValues: any[] }> = {\r\n name: \"allowedValues\",\r\n defaultErrorMessage: \"The :input must be one of the allowed values\",\r\n async validate(value: any, context) {\r\n if (this.context.options.allowedValues.includes(value)) {\r\n return VALID_RULE;\r\n }\r\n\r\n // Translate each value individually, then join\r\n this.context.translationParams.allowedValues = this.context.options.allowedValues\r\n .map((v: any) =>\r\n resolveTranslation({ key: String(v), rawValue: String(v), rule: this, context }),\r\n )\r\n .join(\", \");\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Not allowed values rule - value must not be in forbidden list\r\n */\r\nexport const notAllowedValuesRule: SchemaRule<{ notAllowedValues: any[] }> = {\r\n name: \"notAllowedValues\",\r\n defaultErrorMessage: \"The :input contains a forbidden value\",\r\n async validate(value: any, context) {\r\n if (!this.context.options.notAllowedValues.includes(value)) {\r\n return VALID_RULE;\r\n }\r\n\r\n // Translate each value individually, then join\r\n this.context.translationParams.notAllowedValues = this.context.options.notAllowedValues\r\n .map((v: any) =>\r\n resolveTranslation({ key: String(v), rawValue: String(v), rule: this, context }),\r\n )\r\n .join(\", \");\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n"],"mappings":";;;;;;;AAMA,MAAa,WAAsC;CACjD,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,MAAM,aAAa,KAAK,QAAQ,QAAQ;EAExC,IAAI,WAAW,SAAS,KAAK,GAC3B,OAAO;EAIT,KAAK,QAAQ,kBAAkB,OAAO,WACnC,KAAK,MACJ,mBAAmB;GAAE,KAAK,OAAO,CAAC;GAAG,UAAU,OAAO,CAAC;GAAG,MAAM;GAAM;EAAQ,CAAC,CACjF,CAAC,CACA,KAAK,IAAI;EAEZ,OAAO,YAAY,MAAM,OAAO;CAClC;AACF;;;;AAKA,MAAa,SAAwC;CACnD,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,IAAI,KAAK,QAAQ,QAAQ,OAAO,SAAS,KAAK,GAC5C,OAAO;EAIT,KAAK,QAAQ,kBAAkB,SAAS,KAAK,QAAQ,QAAQ,OAC1D,KAAK,MACJ,mBAAmB;GAAE,KAAK,OAAO,CAAC;GAAG,UAAU,OAAO,CAAC;GAAG,MAAM;GAAM;EAAQ,CAAC,CACjF,CAAC,CACA,KAAK,IAAI;EAEZ,OAAO,YAAY,MAAM,OAAO;CAClC;AACF;;;;AAKA,MAAa,oBAA0D;CACrE,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,IAAI,KAAK,QAAQ,QAAQ,cAAc,SAAS,KAAK,GACnD,OAAO;EAIT,KAAK,QAAQ,kBAAkB,gBAAgB,KAAK,QAAQ,QAAQ,cACjE,KAAK,MACJ,mBAAmB;GAAE,KAAK,OAAO,CAAC;GAAG,UAAU,OAAO,CAAC;GAAG,MAAM;GAAM;EAAQ,CAAC,CACjF,CAAC,CACA,KAAK,IAAI;EAEZ,OAAO,YAAY,MAAM,OAAO;CAClC;AACF;;;;AAKA,MAAa,uBAAgE;CAC3E,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,IAAI,CAAC,KAAK,QAAQ,QAAQ,iBAAiB,SAAS,KAAK,GACvD,OAAO;EAIT,KAAK,QAAQ,kBAAkB,mBAAmB,KAAK,QAAQ,QAAQ,iBACpE,KAAK,MACJ,mBAAmB;GAAE,KAAK,OAAO,CAAC;GAAG,UAAU,OAAO,CAAC;GAAG,MAAM;GAAM;EAAQ,CAAC,CACjF,CAAC,CACA,KAAK,IAAI;EAEZ,OAAO,YAAY,MAAM,OAAO;CAClC;AACF"}
1
+ {"version":3,"file":"enum.mjs","names":[],"sources":["../../../../../../../../../../seal/src/rules/common/enum.ts"],"sourcesContent":["import { invalidRule, resolveTranslation, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\n/**\r\n * Enum rule - value must be one of the enum values\r\n */\r\nexport const enumRule: SchemaRule<{ enum: any }> = {\r\n name: \"enum\",\r\n defaultErrorMessage: \"The :input must be one of the following values: :enum\",\r\n async validate(value: any, context) {\r\n const enumValues = this.context.options.enum;\r\n\r\n if (enumValues.includes(value)) {\r\n return VALID_RULE;\r\n }\r\n\r\n // Translate each enum value individually, then join into a display string\r\n this.context.translationParams.enum = enumValues\r\n .map((v: any) =>\r\n resolveTranslation({ key: String(v), rawValue: String(v), rule: this, context }),\r\n )\r\n .join(\", \");\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * In rule - value must be in the given array\r\n */\r\nexport const inRule: SchemaRule<{ values: any[] }> = {\r\n name: \"in\",\r\n defaultErrorMessage: \"The :input must be one of the following values: :values\",\r\n async validate(value: any, context) {\r\n if (this.context.options.values.includes(value)) {\r\n return VALID_RULE;\r\n }\r\n\r\n // Translate each value individually, then join\r\n this.context.translationParams.values = this.context.options.values\r\n .map((v: any) =>\r\n resolveTranslation({ key: String(v), rawValue: String(v), rule: this, context }),\r\n )\r\n .join(\", \");\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Allowed values rule - value must be one of allowed values\r\n */\r\nexport const allowedValuesRule: SchemaRule<{ allowedValues: any[] }> = {\r\n name: \"allowedValues\",\r\n defaultErrorMessage: \"The :input must be one of the allowed values\",\r\n async validate(value: any, context) {\r\n if (this.context.options.allowedValues.includes(value)) {\r\n return VALID_RULE;\r\n }\r\n\r\n // Translate each value individually, then join\r\n this.context.translationParams.allowedValues = this.context.options.allowedValues\r\n .map((v: any) =>\r\n resolveTranslation({ key: String(v), rawValue: String(v), rule: this, context }),\r\n )\r\n .join(\", \");\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Not allowed values rule - value must not be in forbidden list\r\n */\r\nexport const notAllowedValuesRule: SchemaRule<{ notAllowedValues: any[] }> = {\r\n name: \"notAllowedValues\",\r\n defaultErrorMessage: \"The :input contains a forbidden value\",\r\n async validate(value: any, context) {\r\n if (!this.context.options.notAllowedValues.includes(value)) {\r\n return VALID_RULE;\r\n }\r\n\r\n // Translate each value individually, then join\r\n this.context.translationParams.notAllowedValues = this.context.options.notAllowedValues\r\n .map((v: any) =>\r\n resolveTranslation({ key: String(v), rawValue: String(v), rule: this, context }),\r\n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SAAS,OAAY,SAAS;EAClC,IAAI,CAAC,KAAK,QAAQ,QAAQ,iBAAiB,SAAS,KAAK,GACvD,OAAO;EAIT,KAAK,QAAQ,kBAAkB,mBAAmB,KAAK,QAAQ,QAAQ,iBACpE,KAAK,MACJ,mBAAmB;GAAE,KAAK,OAAO,CAAC;GAAG,UAAU,OAAO,CAAC;GAAG,MAAM;GAAM;EAAQ,CAAC,CACjF,EACC,KAAK,IAAI;EAEZ,OAAO,YAAY,MAAM,OAAO;CAClC;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"literal.mjs","names":[],"sources":["../../../../../../../../../../seal/src/rules/common/literal.ts"],"sourcesContent":["import { invalidRule, resolveTranslation, VALID_RULE } from \"../../helpers\";\nimport type { SchemaRule } from \"../../types\";\n\n/**\n * Literal rule - value must be strictly equal to one of the literal values.\n *\n * Uses === (referential / strict equality), so distinguishes 1 from \"1\",\n * true from \"true\", etc. Mirrors `v.string().oneOf([...])` but at the\n * literal type level (TypeScript narrows to the union of literals).\n */\nexport const literalRule: SchemaRule<{ values: readonly (string | number | boolean)[] }> = {\n name: \"literal\",\n // Runs even on \"empty\" values. A literal set is an exact-match whitelist, so\n // there is no value it cannot safely be asked about — and `\"\"` is one of the\n // values callers most want to pin (`alt=\"\"` for a decorative image). Left at\n // the default, the empty string would skip this check entirely, which made\n // `v.literal(\"\").optional()` accept `\"\"`, `null` AND a missing key alike.\n requiresValue: false,\n defaultErrorMessage: \"The :input must be one of the following values: :values\",\n async validate(value: any, context) {\n // Absence is the required/present rule's question, not this one. Without\n // this, `requiresValue: false` above would make the literal check fire on a\n // missing key and defeat `.optional()`, which works by removing that rule.\n if (value === undefined) {\n return VALID_RULE;\n }\n\n if (this.context.options.values.includes(value)) {\n return VALID_RULE;\n }\n\n this.context.translationParams.values = this.context.options.values\n .map(v =>\n resolveTranslation({ key: String(v), rawValue: String(v), rule: this, context }),\n )\n .join(\", \");\n\n return invalidRule(this, context);\n },\n};\n"],"mappings":";;;;;;;;;;;AAUA,MAAa,cAA8E;CACzF,MAAM;CAMN,eAAe;CACf,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAIlC,IAAI,UAAU,QACZ,OAAO;EAGT,IAAI,KAAK,QAAQ,QAAQ,OAAO,SAAS,KAAK,GAC5C,OAAO;EAGT,KAAK,QAAQ,kBAAkB,SAAS,KAAK,QAAQ,QAAQ,OAC1D,KAAI,MACH,mBAAmB;GAAE,KAAK,OAAO,CAAC;GAAG,UAAU,OAAO,CAAC;GAAG,MAAM;GAAM;EAAQ,CAAC,CACjF,CAAC,CACA,KAAK,IAAI;EAEZ,OAAO,YAAY,MAAM,OAAO;CAClC;AACF"}
1
+ {"version":3,"file":"literal.mjs","names":[],"sources":["../../../../../../../../../../seal/src/rules/common/literal.ts"],"sourcesContent":["import { invalidRule, resolveTranslation, VALID_RULE } from \"../../helpers\";\nimport type { SchemaRule } from \"../../types\";\n\n/**\n * Literal rule - value must be strictly equal to one of the literal values.\n *\n * Uses === (referential / strict equality), so distinguishes 1 from \"1\",\n * true from \"true\", etc. Mirrors `v.string().oneOf([...])` but at the\n * literal type level (TypeScript narrows to the union of literals).\n */\nexport const literalRule: SchemaRule<{ values: readonly (string | number | boolean)[] }> = {\n name: \"literal\",\n // Runs even on \"empty\" values. A literal set is an exact-match whitelist, so\n // there is no value it cannot safely be asked about — and `\"\"` is one of the\n // values callers most want to pin (`alt=\"\"` for a decorative image). Left at\n // the default, the empty string would skip this check entirely, which made\n // `v.literal(\"\").optional()` accept `\"\"`, `null` AND a missing key alike.\n requiresValue: false,\n defaultErrorMessage: \"The :input must be one of the following values: :values\",\n async validate(value: any, context) {\n // Absence is the required/present rule's question, not this one. Without\n // this, `requiresValue: false` above would make the literal check fire on a\n // missing key and defeat `.optional()`, which works by removing that rule.\n if (value === undefined) {\n return VALID_RULE;\n }\n\n if (this.context.options.values.includes(value)) {\n return VALID_RULE;\n }\n\n this.context.translationParams.values = this.context.options.values\n .map(v =>\n resolveTranslation({ key: String(v), rawValue: String(v), rule: this, context }),\n )\n .join(\", \");\n\n return invalidRule(this, context);\n },\n};\n"],"mappings":";;;;;;;;;;;AAUA,MAAa,cAA8E;CACzF,MAAM;CAMN,eAAe;CACf,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAIlC,IAAI,UAAU,QACZ,OAAO;EAGT,IAAI,KAAK,QAAQ,QAAQ,OAAO,SAAS,KAAK,GAC5C,OAAO;EAGT,KAAK,QAAQ,kBAAkB,SAAS,KAAK,QAAQ,QAAQ,OAC1D,KAAI,MACH,mBAAmB;GAAE,KAAK,OAAO,CAAC;GAAG,UAAU,OAAO,CAAC;GAAG,MAAM;GAAM;EAAQ,CAAC,CACjF,EACC,KAAK,IAAI;EAEZ,OAAO,YAAY,MAAM,OAAO;CAClC;AACF"}
@@ -1,6 +1,6 @@
1
1
  import { VALID_RULE, invalidRule } from "../../helpers/validation-helpers.mjs";
2
2
  import "../../helpers/index.mjs";
3
- import { isObject, isPlainObject } from "../../../../node_modules/@mongez/supportive-is/esm/index.mjs";
3
+ import { isObject, isPlainObject } from "../../../../node_modules/.pnpm/@mongez_supportive-is@2.1.4/node_modules/@mongez/supportive-is/esm/index.mjs";
4
4
 
5
5
  //#region ../seal/src/rules/common/type-rules.ts
6
6
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"unknown-key.mjs","names":[],"sources":["../../../../../../../../../../seal/src/rules/common/unknown-key.ts"],"sourcesContent":["import { invalidRule, VALID_RULE } from \"../../helpers\";\nimport type { Schema, SchemaRule } from \"../../types\";\n\n/**\n * Unknown key rule - validates that object doesn't have unknown keys\n */\nexport const unknownKeyRule: SchemaRule<{\n schema: Schema;\n allowedKeys: string[];\n}> = {\n name: \"unknownKeys\",\n defaultErrorMessage: \"The :input contains unknown keys: :unknownKeys\",\n async validate(value: any, context) {\n const schema = this.context.options.schema;\n const allowedKeys = [...Object.keys(schema), ...(this.context.options.allowedKeys || [])];\n\n const unknownKeys = Object.keys(value).filter((key) => !allowedKeys.includes(key));\n\n if (unknownKeys.length > 0) {\n this.context.translationParams.unknownKeys = unknownKeys.join(\", \");\n\n return invalidRule(this, context);\n }\n\n return VALID_RULE;\n },\n};\n"],"mappings":";;;;;;;AAMA,MAAa,iBAGR;CACH,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,MAAM,SAAS,KAAK,QAAQ,QAAQ;EACpC,MAAM,cAAc,CAAC,GAAG,OAAO,KAAK,MAAM,GAAG,GAAI,KAAK,QAAQ,QAAQ,eAAe,CAAC,CAAE;EAExF,MAAM,cAAc,OAAO,KAAK,KAAK,CAAC,CAAC,QAAQ,QAAQ,CAAC,YAAY,SAAS,GAAG,CAAC;EAEjF,IAAI,YAAY,SAAS,GAAG;GAC1B,KAAK,QAAQ,kBAAkB,cAAc,YAAY,KAAK,IAAI;GAElE,OAAO,YAAY,MAAM,OAAO;EAClC;EAEA,OAAO;CACT;AACF"}
1
+ {"version":3,"file":"unknown-key.mjs","names":[],"sources":["../../../../../../../../../../seal/src/rules/common/unknown-key.ts"],"sourcesContent":["import { invalidRule, VALID_RULE } from \"../../helpers\";\nimport type { Schema, SchemaRule } from \"../../types\";\n\n/**\n * Unknown key rule - validates that object doesn't have unknown keys\n */\nexport const unknownKeyRule: SchemaRule<{\n schema: Schema;\n allowedKeys: string[];\n}> = {\n name: \"unknownKeys\",\n defaultErrorMessage: \"The :input contains unknown keys: :unknownKeys\",\n async validate(value: any, context) {\n const schema = this.context.options.schema;\n const allowedKeys = [...Object.keys(schema), ...(this.context.options.allowedKeys || [])];\n\n const unknownKeys = Object.keys(value).filter((key) => !allowedKeys.includes(key));\n\n if (unknownKeys.length > 0) {\n this.context.translationParams.unknownKeys = unknownKeys.join(\", \");\n\n return invalidRule(this, context);\n }\n\n return VALID_RULE;\n },\n};\n"],"mappings":";;;;;;;AAMA,MAAa,iBAGR;CACH,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,MAAM,SAAS,KAAK,QAAQ,QAAQ;EACpC,MAAM,cAAc,CAAC,GAAG,OAAO,KAAK,MAAM,GAAG,GAAI,KAAK,QAAQ,QAAQ,eAAe,CAAC,CAAE;EAExF,MAAM,cAAc,OAAO,KAAK,KAAK,EAAE,QAAQ,QAAQ,CAAC,YAAY,SAAS,GAAG,CAAC;EAEjF,IAAI,YAAY,SAAS,GAAG;GAC1B,KAAK,QAAQ,kBAAkB,cAAc,YAAY,KAAK,IAAI;GAElE,OAAO,YAAY,MAAM,OAAO;EAClC;EAEA,OAAO;CACT;AACF"}
@@ -1,5 +1,5 @@
1
- import { get } from "../../../../node_modules/@mongez/reinforcements/esm/object/get.mjs";
2
- import "../../../../node_modules/@mongez/reinforcements/esm/index.mjs";
1
+ import { get } from "../../../../node_modules/.pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez/reinforcements/esm/object/get.mjs";
2
+ import "../../../../node_modules/.pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez/reinforcements/esm/index.mjs";
3
3
  import { getFieldValue } from "../../helpers/get-field-value.mjs";
4
4
  import { VALID_RULE, invalidRule } from "../../helpers/validation-helpers.mjs";
5
5
  import "../../helpers/index.mjs";
@@ -1,5 +1,5 @@
1
- import { get } from "../../../../node_modules/@mongez/reinforcements/esm/object/get.mjs";
2
- import "../../../../node_modules/@mongez/reinforcements/esm/index.mjs";
1
+ import { get } from "../../../../node_modules/.pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez/reinforcements/esm/object/get.mjs";
2
+ import "../../../../node_modules/.pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez/reinforcements/esm/index.mjs";
3
3
  import { getFieldValue } from "../../helpers/get-field-value.mjs";
4
4
  import { VALID_RULE, invalidRule } from "../../helpers/validation-helpers.mjs";
5
5
  import "../../helpers/index.mjs";
@@ -1,5 +1,5 @@
1
- import { get } from "../../../../node_modules/@mongez/reinforcements/esm/object/get.mjs";
2
- import "../../../../node_modules/@mongez/reinforcements/esm/index.mjs";
1
+ import { get } from "../../../../node_modules/.pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez/reinforcements/esm/object/get.mjs";
2
+ import "../../../../node_modules/.pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez/reinforcements/esm/index.mjs";
3
3
  import { getFieldValue } from "../../helpers/get-field-value.mjs";
4
4
  import { VALID_RULE, invalidRule } from "../../helpers/validation-helpers.mjs";
5
5
  import "../../helpers/index.mjs";
@@ -1 +1 @@
1
- {"version":3,"file":"required-if-rules.mjs","names":[],"sources":["../../../../../../../../../../seal/src/rules/conditional/required-if-rules.ts"],"sourcesContent":["import { get } from \"@mongez/reinforcements\";\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":";;;;;;;;;;;;AASA,MAAa,iBAIR;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,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,aAAa,cAAc,MAAM,OAAO;EAG9C,IAAI,aAAa,KAAK,KAAK,aAAa,UAAU,GAAG;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,aAAa,cAAc,MAAM,OAAO;EAG9C,IAAI,aAAa,KAAK,KAAK,CAAC,aAAa,UAAU,GAAG;GACpD,KAAK,QAAQ,mBAAmB,QAAQ,KAAK,QAAQ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CAAC;EAC5D,IAAI,aAAa,KAAK,KAAK,aAAa;GACtC,KAAK,QAAQ,QAAQ,OAAO,SAAS,UAAU;IAC7C,KAAK,QAAQ,mBAAmB,QAAQ;GAC1C,CAAC;GACD,OAAO,YAAY,MAAM,OAAO;EAClC;EAEA,OAAO;CACT;AACF"}
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":";;;;;;;;;;;;AASA,MAAa,iBAIR;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,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,aAAa,cAAc,MAAM,OAAO;EAG9C,IAAI,aAAa,KAAK,KAAK,aAAa,UAAU,GAAG;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,aAAa,cAAc,MAAM,OAAO;EAG9C,IAAI,aAAa,KAAK,KAAK,CAAC,aAAa,UAAU,GAAG;GACpD,KAAK,QAAQ,mBAAmB,QAAQ,KAAK,QAAQ,QAAQ;GAC7D,OAAO,YAAY,MAAM,OAAO;EAClC;EAEA,OAAO;CACT;AACF;;;;;AAMA,MAA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,mBAAmB,QAAQ;GAC1C,CAAC;GACD,OAAO,YAAY,MAAM,OAAO;EAClC;EAEA,OAAO;CACT;AACF"}
@@ -1,5 +1,5 @@
1
- import { get } from "../../../../node_modules/@mongez/reinforcements/esm/object/get.mjs";
2
- import "../../../../node_modules/@mongez/reinforcements/esm/index.mjs";
1
+ import { get } from "../../../../node_modules/.pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez/reinforcements/esm/object/get.mjs";
2
+ import "../../../../node_modules/.pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez/reinforcements/esm/index.mjs";
3
3
  import { getFieldValue } from "../../helpers/get-field-value.mjs";
4
4
  import { VALID_RULE, invalidRule } from "../../helpers/validation-helpers.mjs";
5
5
  import "../../helpers/index.mjs";
@@ -1,5 +1,5 @@
1
- import { get } from "../../../../node_modules/@mongez/reinforcements/esm/object/get.mjs";
2
- import "../../../../node_modules/@mongez/reinforcements/esm/index.mjs";
1
+ import { get } from "../../../../node_modules/.pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez/reinforcements/esm/object/get.mjs";
2
+ import "../../../../node_modules/.pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez/reinforcements/esm/index.mjs";
3
3
  import { getFieldValue } from "../../helpers/get-field-value.mjs";
4
4
  import { VALID_RULE, invalidRule } from "../../helpers/validation-helpers.mjs";
5
5
  import "../../helpers/index.mjs";
@@ -1 +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"}
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,IAAI,SAAS;GAC9C,UAAU,KAAK,QAAQ;GAGvB,IAAI,gBACF;EAEJ;EAGA,IAAI,UAAU,SAAS,GAErB,KAAK,QAAQ,eAAe,iBACxB,UAAU,KACV,UAAU,KAAK,IAAI;EAGzB,OAAO,YAAY,MAAM,OAAO;CAClC;AACF"}
@@ -1,5 +1,5 @@
1
- import { get } from "../../../../node_modules/@mongez/reinforcements/esm/object/get.mjs";
2
- import "../../../../node_modules/@mongez/reinforcements/esm/index.mjs";
1
+ import { get } from "../../../../node_modules/.pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez/reinforcements/esm/object/get.mjs";
2
+ import "../../../../node_modules/.pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez/reinforcements/esm/index.mjs";
3
3
  import { VALID_RULE, invalidRule } from "../../helpers/validation-helpers.mjs";
4
4
  import "../../helpers/index.mjs";
5
5
 
@@ -1 +1 @@
1
- {"version":3,"file":"when.mjs","names":[],"sources":["../../../../../../../../../../seal/src/rules/core/when.ts"],"sourcesContent":["import { get } from \"@mongez/reinforcements\";\r\nimport { invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule, WhenRuleOptions } from \"../../types\";\r\n\r\n/**\r\n * When rule - conditional validation based on another field value\r\n */\r\nexport const whenRule: SchemaRule<WhenRuleOptions> = {\r\n name: \"when\",\r\n description: \"Apply conditional validation based on another field value\",\r\n async validate(value: any, context) {\r\n const fieldToCheck = this.context.options.field;\r\n const conditions = this.context.options.is;\r\n const otherwise = this.context.options.otherwise;\r\n const scope = this.context.options.scope || \"global\";\r\n\r\n const fieldValue =\r\n scope === \"global\"\r\n ? get(context.allValues, fieldToCheck)\r\n : get(context.parent, fieldToCheck);\r\n\r\n // Convert field value to string for key lookup\r\n // This handles boolean, number, and string field values\r\n const fieldValueKey = String(fieldValue);\r\n\r\n if (conditions[fieldValueKey]) {\r\n const result = await conditions[fieldValueKey].validate(value, context);\r\n if (result.isValid) {\r\n return VALID_RULE;\r\n }\r\n\r\n // Safe error access\r\n this.context.errorMessage =\r\n result.errors?.[0]?.error || \"Validation failed\";\r\n return invalidRule(this, context);\r\n }\r\n\r\n if (otherwise) {\r\n const result = await otherwise.validate(value, context);\r\n\r\n if (result.isValid) {\r\n return VALID_RULE;\r\n }\r\n\r\n // Safe error access\r\n this.context.errorMessage =\r\n result.errors?.[0]?.error || \"Validation failed\";\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n"],"mappings":";;;;;;;;;AAOA,MAAa,WAAwC;CACnD,MAAM;CACN,aAAa;CACb,MAAM,SAAS,OAAY,SAAS;EAClC,MAAM,eAAe,KAAK,QAAQ,QAAQ;EAC1C,MAAM,aAAa,KAAK,QAAQ,QAAQ;EACxC,MAAM,YAAY,KAAK,QAAQ,QAAQ;EAGvC,MAAM,cAFQ,KAAK,QAAQ,QAAQ,SAAS,cAGhC,WACN,IAAI,QAAQ,WAAW,YAAY,IACnC,IAAI,QAAQ,QAAQ,YAAY;EAItC,MAAM,gBAAgB,OAAO,UAAU;EAEvC,IAAI,WAAW,gBAAgB;GAC7B,MAAM,SAAS,MAAM,WAAW,cAAc,CAAC,SAAS,OAAO,OAAO;GACtE,IAAI,OAAO,SACT,OAAO;GAIT,KAAK,QAAQ,eACX,OAAO,SAAS,EAAE,EAAE,SAAS;GAC/B,OAAO,YAAY,MAAM,OAAO;EAClC;EAEA,IAAI,WAAW;GACb,MAAM,SAAS,MAAM,UAAU,SAAS,OAAO,OAAO;GAEtD,IAAI,OAAO,SACT,OAAO;GAIT,KAAK,QAAQ,eACX,OAAO,SAAS,EAAE,EAAE,SAAS;GAC/B,OAAO,YAAY,MAAM,OAAO;EAClC;EAEA,OAAO;CACT;AACF"}
1
+ {"version":3,"file":"when.mjs","names":[],"sources":["../../../../../../../../../../seal/src/rules/core/when.ts"],"sourcesContent":["import { get } from \"@mongez/reinforcements\";\r\nimport { invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule, WhenRuleOptions } from \"../../types\";\r\n\r\n/**\r\n * When rule - conditional validation based on another field value\r\n */\r\nexport const whenRule: SchemaRule<WhenRuleOptions> = {\r\n name: \"when\",\r\n description: \"Apply conditional validation based on another field value\",\r\n async validate(value: any, context) {\r\n const fieldToCheck = this.context.options.field;\r\n const conditions = this.context.options.is;\r\n const otherwise = this.context.options.otherwise;\r\n const scope = this.context.options.scope || \"global\";\r\n\r\n const fieldValue =\r\n scope === \"global\"\r\n ? get(context.allValues, fieldToCheck)\r\n : get(context.parent, fieldToCheck);\r\n\r\n // Convert field value to string for key lookup\r\n // This handles boolean, number, and string field values\r\n const fieldValueKey = String(fieldValue);\r\n\r\n if (conditions[fieldValueKey]) {\r\n const result = await conditions[fieldValueKey].validate(value, context);\r\n if (result.isValid) {\r\n return VALID_RULE;\r\n }\r\n\r\n // Safe error access\r\n this.context.errorMessage =\r\n result.errors?.[0]?.error || \"Validation failed\";\r\n return invalidRule(this, context);\r\n }\r\n\r\n if (otherwise) {\r\n const result = await otherwise.validate(value, context);\r\n\r\n if (result.isValid) {\r\n return VALID_RULE;\r\n }\r\n\r\n // Safe error access\r\n this.context.errorMessage =\r\n result.errors?.[0]?.error || \"Validation failed\";\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n"],"mappings":";;;;;;;;;AAOA,MAAa,WAAwC;CACnD,MAAM;CACN,aAAa;CACb,MAAM,SAAS,OAAY,SAAS;EAClC,MAAM,eAAe,KAAK,QAAQ,QAAQ;EAC1C,MAAM,aAAa,KAAK,QAAQ,QAAQ;EACxC,MAAM,YAAY,KAAK,QAAQ,QAAQ;EAGvC,MAAM,cAFQ,KAAK,QAAQ,QAAQ,SAAS,cAGhC,WACN,IAAI,QAAQ,WAAW,YAAY,IACnC,IAAI,QAAQ,QAAQ,YAAY;EAItC,MAAM,gBAAgB,OAAO,UAAU;EAEvC,IAAI,WAAW,gBAAgB;GAC7B,MAAM,SAAS,MAAM,WAAW,eAAe,SAAS,OAAO,OAAO;GACtE,IAAI,OAAO,SACT,OAAO;GAIT,KAAK,QAAQ,eACX,OAAO,SAAS,IAAI,SAAS;GAC/B,OAAO,YAAY,MAAM,OAAO;EAClC;EAEA,IAAI,WAAW;GACb,MAAM,SAAS,MAAM,UAAU,SAAS,OAAO,OAAO;GAEtD,IAAI,OAAO,SACT,OAAO;GAIT,KAAK,QAAQ,eACX,OAAO,SAAS,IAAI,SAAS;GAC/B,OAAO,YAAY,MAAM,OAAO;EAClC;EAEA,OAAO;CACT;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"date-day-rules.mjs","names":[],"sources":["../../../../../../../../../../seal/src/rules/date/date-day-rules.ts"],"sourcesContent":["import { invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\nimport type { WeekDay } from \"../../types/date-types\";\r\nimport { WEEK_DAYS } from \"../../types/date-types\";\r\n\r\n/**\r\n * Weekend rule - date must be Saturday or Sunday\r\n */\r\nexport const weekendRule: SchemaRule = {\r\n name: \"weekend\",\r\n defaultErrorMessage: \"The :input must be a weekend (Saturday or Sunday)\",\r\n async validate(value: Date, context) {\r\n const inputDate = new Date(value);\r\n const dayOfWeek = inputDate.getDay();\r\n\r\n // 0 = Sunday, 6 = Saturday\r\n if (dayOfWeek === 0 || dayOfWeek === 6) {\r\n return VALID_RULE;\r\n }\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Weekday rule - date must be Monday through Friday\r\n */\r\nexport const weekdayRule: SchemaRule = {\r\n name: \"weekday\",\r\n defaultErrorMessage: \"The :input must be a weekday (Monday-Friday)\",\r\n async validate(value: Date, context) {\r\n const inputDate = new Date(value);\r\n const dayOfWeek = inputDate.getDay();\r\n\r\n // 1-5 = Monday-Friday\r\n if (dayOfWeek >= 1 && dayOfWeek <= 5) {\r\n return VALID_RULE;\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Weekdays rule - date must be one of specified weekdays\r\n */\r\nexport const weekdaysRule: SchemaRule<{ days: WeekDay[] }> = {\r\n name: \"weekdays\",\r\n defaultErrorMessage: \"The :input must be one of: :days\",\r\n async validate(value: Date, context) {\r\n const inputDate = new Date(value);\r\n const dayOfWeek = inputDate.getDay();\r\n const { days } = this.context.options;\r\n\r\n const allowedDays = days.map((day) => WEEK_DAYS[day]);\r\n\r\n if (allowedDays.includes(dayOfWeek)) {\r\n return VALID_RULE;\r\n }\r\n\r\n days.forEach((day) => {\r\n this.context.translatableParams[day] = day;\r\n });\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Business day rule - date must be Monday-Friday (no weekends)\r\n */\r\nexport const businessDayRule: SchemaRule = {\r\n name: \"businessDay\",\r\n defaultErrorMessage: \"The :input must be a business day\",\r\n async validate(value: Date, context) {\r\n const inputDate = new Date(value);\r\n const dayOfWeek = inputDate.getDay();\r\n\r\n // 1-5 = Monday-Friday\r\n if (dayOfWeek >= 1 && dayOfWeek <= 5) {\r\n return VALID_RULE;\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n"],"mappings":";;;;;;;;AAQA,MAAa,cAA0B;CACrC,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAa,SAAS;EAEnC,MAAM,YAAY,IADI,KAAK,KACD,CAAC,CAAC,OAAO;EAGnC,IAAI,cAAc,KAAK,cAAc,GACnC,OAAO;EAET,OAAO,YAAY,MAAM,OAAO;CAClC;AACF;;;;AAwBA,MAAa,eAAgD;CAC3D,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAa,SAAS;EAEnC,MAAM,YAAY,IADI,KAAK,KACD,CAAC,CAAC,OAAO;EACnC,MAAM,EAAE,SAAS,KAAK,QAAQ;EAI9B,IAFoB,KAAK,KAAK,QAAQ,UAAU,IAElC,CAAC,CAAC,SAAS,SAAS,GAChC,OAAO;EAGT,KAAK,SAAS,QAAQ;GACpB,KAAK,QAAQ,mBAAmB,OAAO;EACzC,CAAC;EAED,OAAO,YAAY,MAAM,OAAO;CAClC;AACF;;;;AAKA,MAAa,kBAA8B;CACzC,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAa,SAAS;EAEnC,MAAM,YAAY,IADI,KAAK,KACD,CAAC,CAAC,OAAO;EAGnC,IAAI,aAAa,KAAK,aAAa,GACjC,OAAO;EAGT,OAAO,YAAY,MAAM,OAAO;CAClC;AACF"}
1
+ {"version":3,"file":"date-day-rules.mjs","names":[],"sources":["../../../../../../../../../../seal/src/rules/date/date-day-rules.ts"],"sourcesContent":["import { invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\nimport type { WeekDay } from \"../../types/date-types\";\r\nimport { WEEK_DAYS } from \"../../types/date-types\";\r\n\r\n/**\r\n * Weekend rule - date must be Saturday or Sunday\r\n */\r\nexport const weekendRule: SchemaRule = {\r\n name: \"weekend\",\r\n defaultErrorMessage: \"The :input must be a weekend (Saturday or Sunday)\",\r\n async validate(value: Date, context) {\r\n const inputDate = new Date(value);\r\n const dayOfWeek = inputDate.getDay();\r\n\r\n // 0 = Sunday, 6 = Saturday\r\n if (dayOfWeek === 0 || dayOfWeek === 6) {\r\n return VALID_RULE;\r\n }\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Weekday rule - date must be Monday through Friday\r\n */\r\nexport const weekdayRule: SchemaRule = {\r\n name: \"weekday\",\r\n defaultErrorMessage: \"The :input must be a weekday (Monday-Friday)\",\r\n async validate(value: Date, context) {\r\n const inputDate = new Date(value);\r\n const dayOfWeek = inputDate.getDay();\r\n\r\n // 1-5 = Monday-Friday\r\n if (dayOfWeek >= 1 && dayOfWeek <= 5) {\r\n return VALID_RULE;\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Weekdays rule - date must be one of specified weekdays\r\n */\r\nexport const weekdaysRule: SchemaRule<{ days: WeekDay[] }> = {\r\n name: \"weekdays\",\r\n defaultErrorMessage: \"The :input must be one of: :days\",\r\n async validate(value: Date, context) {\r\n const inputDate = new Date(value);\r\n const dayOfWeek = inputDate.getDay();\r\n const { days } = this.context.options;\r\n\r\n const allowedDays = days.map((day) => WEEK_DAYS[day]);\r\n\r\n if (allowedDays.includes(dayOfWeek)) {\r\n return VALID_RULE;\r\n }\r\n\r\n days.forEach((day) => {\r\n this.context.translatableParams[day] = day;\r\n });\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Business day rule - date must be Monday-Friday (no weekends)\r\n */\r\nexport const businessDayRule: SchemaRule = {\r\n name: \"businessDay\",\r\n defaultErrorMessage: \"The :input must be a business day\",\r\n async validate(value: Date, context) {\r\n const inputDate = new Date(value);\r\n const dayOfWeek = inputDate.getDay();\r\n\r\n // 1-5 = Monday-Friday\r\n if (dayOfWeek >= 1 && dayOfWeek <= 5) {\r\n return VALID_RULE;\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n"],"mappings":";;;;;;;;AAQA,MAAa,cAA0B;CACrC,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAa,SAAS;EAEnC,MAAM,YAAY,IADI,KAAK,KACD,EAAE,OAAO;EAGnC,IAAI,cAAc,KAAK,cAAc,GACnC,OAAO;EAET,OAAO,YAAY,MAAM,OAAO;CAClC;AACF;;;;AAwBA,MAAa,eAAgD;CAC3D,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAa,SAAS;EAEnC,MAAM,YAAY,IADI,KAAK,KACD,EAAE,OAAO;EACnC,MAAM,EAAE,SAAS,KAAK,QAAQ;EAI9B,IAFoB,KAAK,KAAK,QAAQ,UAAU,IAElC,EAAE,SAAS,SAAS,GAChC,OAAO;EAGT,KAAK,SAAS,QAAQ;GACpB,KAAK,QAAQ,mBAAmB,OAAO;EACzC,CAAC;EAED,OAAO,YAAY,MAAM,OAAO;CAClC;AACF;;;;AAKA,MAAa,kBAA8B;CACzC,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAa,SAAS;EAEnC,MAAM,YAAY,IADI,KAAK,KACD,EAAE,OAAO;EAGnC,IAAI,aAAa,KAAK,aAAa,GACjC,OAAO;EAGT,OAAO,YAAY,MAAM,OAAO;CAClC;AACF"}
@@ -1,5 +1,5 @@
1
- import { get } from "../../../../node_modules/@mongez/reinforcements/esm/object/get.mjs";
2
- import "../../../../node_modules/@mongez/reinforcements/esm/index.mjs";
1
+ import { get } from "../../../../node_modules/.pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez/reinforcements/esm/object/get.mjs";
2
+ import "../../../../node_modules/.pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez/reinforcements/esm/index.mjs";
3
3
  import { isDateValue } from "../../helpers/date-helpers.mjs";
4
4
  import { VALID_RULE, invalidRule } from "../../helpers/validation-helpers.mjs";
5
5
  import "../../helpers/index.mjs";
@@ -1,5 +1,5 @@
1
- import { get } from "../../../../node_modules/@mongez/reinforcements/esm/object/get.mjs";
2
- import "../../../../node_modules/@mongez/reinforcements/esm/index.mjs";
1
+ import { get } from "../../../../node_modules/.pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez/reinforcements/esm/object/get.mjs";
2
+ import "../../../../node_modules/.pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez/reinforcements/esm/index.mjs";
3
3
  import { VALID_RULE, invalidRule } from "../../helpers/validation-helpers.mjs";
4
4
  import "../../helpers/index.mjs";
5
5
 
@@ -1 +1 @@
1
- {"version":3,"file":"date-period-rules.mjs","names":[],"sources":["../../../../../../../../../../seal/src/rules/date/date-period-rules.ts"],"sourcesContent":["import { get } from \"@mongez/reinforcements\";\r\nimport { invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\nconst MONTHS = {\r\n 1: \"january\",\r\n 2: \"february\",\r\n 3: \"march\",\r\n 4: \"april\",\r\n 5: \"may\",\r\n 6: \"june\",\r\n 7: \"july\",\r\n 8: \"august\",\r\n 9: \"september\",\r\n 10: \"october\",\r\n 11: \"november\",\r\n 12: \"december\",\r\n};\r\n\r\nexport type Month = keyof typeof MONTHS;\r\n\r\n/**\r\n * Month rule - date must be in specific month (1-12)\r\n */\r\nexport const monthRule: SchemaRule<{ month: Month }> = {\r\n name: \"month\",\r\n defaultErrorMessage: \"The :input must be in month :month\",\r\n async validate(value: Date, context) {\r\n const inputDate = new Date(value);\r\n const month = inputDate.getMonth() + 1; // getMonth() returns 0-11\r\n\r\n if (month === this.context.options.month) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translatableParams.month =\r\n MONTHS[this.context.options.month as keyof typeof MONTHS];\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Year rule - date must be in specific year\r\n */\r\nexport const yearRule: SchemaRule<{ year: number }> = {\r\n name: \"year\",\r\n defaultErrorMessage: \"The :input must be in year :year\",\r\n async validate(value: Date, context) {\r\n const inputDate = new Date(value);\r\n const year = inputDate.getFullYear();\r\n\r\n if (year === this.context.options.year) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.year = this.context.options.year;\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Between years rule - date must be between start and end years\r\n * Supports field names with sibling scope\r\n */\r\nexport const betweenYearsRule: SchemaRule<{\r\n startYear: number | string;\r\n endYear: number | string;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"betweenYears\",\r\n defaultErrorMessage: \"The :input must be between :startYear and :endYear\",\r\n async validate(value: Date, context) {\r\n const { startYear, endYear, scope = \"global\" } = this.context.options;\r\n const inputDate = new Date(value);\r\n const inputYear = inputDate.getFullYear();\r\n\r\n // Extract start year\r\n let compareStartYear: number;\r\n if (typeof startYear === \"number\") {\r\n compareStartYear = startYear;\r\n } else {\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n const fieldValue = get(source, startYear);\r\n\r\n if (fieldValue === undefined) {\r\n return VALID_RULE;\r\n }\r\n\r\n if (fieldValue instanceof Date) {\r\n compareStartYear = fieldValue.getFullYear();\r\n } else if (typeof fieldValue === \"number\") {\r\n compareStartYear = fieldValue;\r\n } else {\r\n const date = new Date(fieldValue);\r\n if (!isNaN(date.getTime())) {\r\n compareStartYear = date.getFullYear();\r\n } else {\r\n return VALID_RULE;\r\n }\r\n }\r\n }\r\n\r\n // Extract end year\r\n let compareEndYear: number;\r\n if (typeof endYear === \"number\") {\r\n compareEndYear = endYear;\r\n } else {\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n const fieldValue = get(source, endYear);\r\n\r\n if (fieldValue === undefined) {\r\n return VALID_RULE;\r\n }\r\n\r\n if (fieldValue instanceof Date) {\r\n compareEndYear = fieldValue.getFullYear();\r\n } else if (typeof fieldValue === \"number\") {\r\n compareEndYear = fieldValue;\r\n } else {\r\n const date = new Date(fieldValue);\r\n if (!isNaN(date.getTime())) {\r\n compareEndYear = date.getFullYear();\r\n } else {\r\n return VALID_RULE;\r\n }\r\n }\r\n }\r\n\r\n if (inputYear >= compareStartYear && inputYear <= compareEndYear) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.startYear = compareStartYear;\r\n this.context.translationParams.endYear = compareEndYear;\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Between months rule - date must be between start and end months (1-12)\r\n * Supports field names with sibling scope\r\n */\r\nexport const betweenMonthsRule: SchemaRule<{\r\n startMonth: Month | string;\r\n endMonth: Month | string;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"betweenMonths\",\r\n defaultErrorMessage: \"The :input must be between month :startMonth and :endMonth\",\r\n async validate(value: Date, context) {\r\n const { startMonth, endMonth, scope = \"global\" } = this.context.options;\r\n const inputDate = new Date(value);\r\n const inputMonth = inputDate.getMonth() + 1; // getMonth() returns 0-11\r\n\r\n // Extract start month\r\n let compareStartMonth: number;\r\n if (typeof startMonth === \"number\") {\r\n compareStartMonth = startMonth;\r\n this.context.translatableParams.startMonth = MONTHS[compareStartMonth as keyof typeof MONTHS];\r\n } else {\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n const fieldValue = get(source, startMonth);\r\n\r\n if (fieldValue === undefined) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translatableParams.startMonth = startMonth;\r\n\r\n if (fieldValue instanceof Date) {\r\n compareStartMonth = fieldValue.getMonth() + 1;\r\n } else if (typeof fieldValue === \"number\") {\r\n compareStartMonth = fieldValue;\r\n } else {\r\n const date = new Date(fieldValue);\r\n if (!isNaN(date.getTime())) {\r\n compareStartMonth = date.getMonth() + 1;\r\n } else {\r\n return VALID_RULE;\r\n }\r\n }\r\n }\r\n\r\n // Extract end month\r\n let compareEndMonth: number;\r\n if (typeof endMonth === \"number\") {\r\n compareEndMonth = endMonth;\r\n this.context.translatableParams.endMonth = MONTHS[compareEndMonth as keyof typeof MONTHS];\r\n } else {\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n const fieldValue = get(source, endMonth);\r\n\r\n if (fieldValue === undefined) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translatableParams.endMonth = endMonth;\r\n\r\n if (fieldValue instanceof Date) {\r\n compareEndMonth = fieldValue.getMonth() + 1;\r\n } else if (typeof fieldValue === \"number\") {\r\n compareEndMonth = fieldValue;\r\n } else {\r\n const date = new Date(fieldValue);\r\n if (!isNaN(date.getTime())) {\r\n compareEndMonth = date.getMonth() + 1;\r\n } else {\r\n return VALID_RULE;\r\n }\r\n }\r\n }\r\n\r\n if (inputMonth >= compareStartMonth && inputMonth <= compareEndMonth) {\r\n return VALID_RULE;\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Between days rule - date must be between start and end days (1-31)\r\n * Supports field names with sibling scope\r\n */\r\nexport const betweenDaysRule: SchemaRule<{\r\n startDay: number | string;\r\n endDay: number | string;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"betweenDays\",\r\n defaultErrorMessage: \"The :input must be between day :startDay and :endDay\",\r\n async validate(value: Date, context) {\r\n const { startDay, endDay, scope = \"global\" } = this.context.options;\r\n const inputDate = new Date(value);\r\n const inputDay = inputDate.getDate();\r\n\r\n // Extract start day\r\n let compareStartDay: number;\r\n if (typeof startDay === \"number\") {\r\n compareStartDay = startDay;\r\n } else {\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n const fieldValue = get(source, startDay);\r\n\r\n if (fieldValue === undefined) {\r\n return VALID_RULE;\r\n }\r\n\r\n if (fieldValue instanceof Date) {\r\n compareStartDay = fieldValue.getDate();\r\n } else if (typeof fieldValue === \"number\") {\r\n compareStartDay = fieldValue;\r\n } else {\r\n const date = new Date(fieldValue);\r\n if (!isNaN(date.getTime())) {\r\n compareStartDay = date.getDate();\r\n } else {\r\n return VALID_RULE;\r\n }\r\n }\r\n }\r\n\r\n // Extract end day\r\n let compareEndDay: number;\r\n if (typeof endDay === \"number\") {\r\n compareEndDay = endDay;\r\n } else {\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n const fieldValue = get(source, endDay);\r\n\r\n if (fieldValue === undefined) {\r\n return VALID_RULE;\r\n }\r\n\r\n if (fieldValue instanceof Date) {\r\n compareEndDay = fieldValue.getDate();\r\n } else if (typeof fieldValue === \"number\") {\r\n compareEndDay = fieldValue;\r\n } else {\r\n const date = new Date(fieldValue);\r\n if (!isNaN(date.getTime())) {\r\n compareEndDay = date.getDate();\r\n } else {\r\n return VALID_RULE;\r\n }\r\n }\r\n }\r\n\r\n if (inputDay >= compareStartDay && inputDay <= compareEndDay) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.startDay = compareStartDay;\r\n this.context.translationParams.endDay = compareEndDay;\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Quarter rule - date must be in specific quarter (1-4)\r\n */\r\nexport const quarterRule: SchemaRule<{ quarter: 1 | 2 | 3 | 4 }> = {\r\n name: \"quarter\",\r\n defaultErrorMessage: \"The :input must be in quarter :quarter\",\r\n async validate(value: Date, context) {\r\n const inputDate = new Date(value);\r\n const month = inputDate.getMonth() + 1;\r\n const quarter = Math.ceil(month / 3);\r\n\r\n if (quarter === this.context.options.quarter) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.quarter = this.context.options.quarter;\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Between times rule - time must be between start and end times (HH:MM format)\r\n */\r\nexport const betweenTimesRule: SchemaRule<{\r\n startTime: string;\r\n endTime: string;\r\n}> = {\r\n name: \"betweenTimes\",\r\n defaultErrorMessage: \"The :input must be between :startTime and :endTime\",\r\n async validate(value: Date, context) {\r\n const inputDate = new Date(value);\r\n const inputHour = inputDate.getHours();\r\n const inputMinute = inputDate.getMinutes();\r\n const inputTimeInMinutes = inputHour * 60 + inputMinute;\r\n\r\n const { startTime, endTime } = this.context.options;\r\n\r\n // Parse start time\r\n const [startHour, startMinute] = startTime.split(\":\").map(Number);\r\n const startTimeInMinutes = startHour * 60 + startMinute;\r\n\r\n // Parse end time\r\n const [endHour, endMinute] = endTime.split(\":\").map(Number);\r\n const endTimeInMinutes = endHour * 60 + endMinute;\r\n\r\n if (inputTimeInMinutes >= startTimeInMinutes && inputTimeInMinutes <= endTimeInMinutes) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.startTime = startTime;\r\n this.context.translationParams.endTime = endTime;\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Min year rule - year must be >= given year or field\r\n * Smart detection: number or field name\r\n * Supports both global and sibling scope\r\n */\r\nexport const minYearRule: SchemaRule<{\r\n yearOrField: number | string;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"minYear\",\r\n description: \"The date year must be at least the given year or field\",\r\n defaultErrorMessage: \"The :input year must be higher than :yearOrField\",\r\n async validate(value: Date, context) {\r\n const { yearOrField, scope = \"global\" } = this.context.options;\r\n let compareYear: number;\r\n\r\n if (typeof yearOrField === \"number\") {\r\n compareYear = yearOrField;\r\n this.context.translationParams.yearOrField = yearOrField;\r\n } else {\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n const fieldValue = get(source, yearOrField);\r\n\r\n if (fieldValue === undefined) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translatableParams.yearOrField = yearOrField;\r\n\r\n // If field contains a date, extract the year\r\n if (fieldValue instanceof Date) {\r\n compareYear = fieldValue.getFullYear();\r\n } else if (typeof fieldValue === \"number\") {\r\n compareYear = fieldValue;\r\n } else {\r\n // Try to parse as date and extract year\r\n const date = new Date(fieldValue);\r\n if (!isNaN(date.getTime())) {\r\n compareYear = date.getFullYear();\r\n } else {\r\n return VALID_RULE;\r\n }\r\n }\r\n }\r\n\r\n const inputDate = new Date(value);\r\n const inputYear = inputDate.getFullYear();\r\n\r\n if (inputYear >= compareYear) {\r\n return VALID_RULE;\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Max year rule - year must be <= given year or field\r\n * Smart detection: number or field name\r\n * Supports both global and sibling scope\r\n */\r\nexport const maxYearRule: SchemaRule<{\r\n yearOrField: number | string;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"maxYear\",\r\n description: \"The date year must be at most the given year or field\",\r\n defaultErrorMessage: \"The :input year must be at most :yearOrField\",\r\n async validate(value: Date, context) {\r\n const { yearOrField, scope = \"global\" } = this.context.options;\r\n let compareYear: number;\r\n\r\n if (typeof yearOrField === \"number\") {\r\n compareYear = yearOrField;\r\n this.context.translationParams.yearOrField = compareYear;\r\n } else {\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n const fieldValue = get(source, yearOrField);\r\n\r\n if (fieldValue === undefined) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translatableParams.yearOrField = yearOrField;\r\n\r\n // If field contains a date, extract the year\r\n if (fieldValue instanceof Date) {\r\n compareYear = fieldValue.getFullYear();\r\n } else if (typeof fieldValue === \"number\") {\r\n compareYear = fieldValue;\r\n } else {\r\n // Try to parse as date and extract year\r\n const date = new Date(fieldValue);\r\n if (!isNaN(date.getTime())) {\r\n compareYear = date.getFullYear();\r\n } else {\r\n return VALID_RULE;\r\n }\r\n }\r\n }\r\n\r\n const inputDate = new Date(value);\r\n const inputYear = inputDate.getFullYear();\r\n\r\n if (inputYear <= compareYear) {\r\n return VALID_RULE;\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Min month rule - month must be >= given month or field (1-12)\r\n * Smart detection: number or field name\r\n * Supports both global and sibling scope\r\n */\r\nexport const minMonthRule: SchemaRule<{\r\n monthOrField: number | string;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"minMonth\",\r\n description: \"The date month must be at least the given month or field\",\r\n defaultErrorMessage: \"The :input month must be at least :monthOrField\",\r\n async validate(value: Date, context) {\r\n const { monthOrField, scope = \"global\" } = this.context.options;\r\n let compareMonth: number;\r\n\r\n if (typeof monthOrField === \"number\") {\r\n compareMonth = monthOrField;\r\n this.context.translationParams.monthOrField = compareMonth;\r\n } else {\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n const fieldValue = get(source, monthOrField);\r\n\r\n if (fieldValue === undefined) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translatableParams.monthOrField = monthOrField;\r\n\r\n // If field contains a date, extract the month\r\n if (fieldValue instanceof Date) {\r\n compareMonth = fieldValue.getMonth() + 1; // getMonth() returns 0-11\r\n } else if (typeof fieldValue === \"number\") {\r\n compareMonth = fieldValue;\r\n } else {\r\n // Try to parse as date and extract month\r\n const date = new Date(fieldValue);\r\n if (!isNaN(date.getTime())) {\r\n compareMonth = date.getMonth() + 1;\r\n } else {\r\n return VALID_RULE;\r\n }\r\n }\r\n }\r\n\r\n const inputDate = new Date(value);\r\n const inputMonth = inputDate.getMonth() + 1; // getMonth() returns 0-11\r\n\r\n if (inputMonth >= compareMonth) {\r\n return VALID_RULE;\r\n }\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Max month rule - month must be <= given month or field (1-12)\r\n * Smart detection: number or field name\r\n * Supports both global and sibling scope\r\n */\r\nexport const maxMonthRule: SchemaRule<{\r\n monthOrField: Month | string;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"maxMonth\",\r\n description: \"The date month must be at most the given month or field\",\r\n defaultErrorMessage: \"The :input month must be at most :monthOrField\",\r\n async validate(value: Date, context) {\r\n const { monthOrField, scope = \"global\" } = this.context.options;\r\n let compareMonth: number;\r\n\r\n if (typeof monthOrField === \"number\") {\r\n compareMonth = monthOrField;\r\n this.context.translatableParams.monthOrField = MONTHS[monthOrField];\r\n } else {\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n const fieldValue = get(source, monthOrField);\r\n\r\n if (fieldValue === undefined) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translatableParams.monthOrField = monthOrField;\r\n\r\n // If field contains a date, extract the month\r\n if (fieldValue instanceof Date) {\r\n compareMonth = fieldValue.getMonth() + 1; // getMonth() returns 0-11\r\n } else if (typeof fieldValue === \"number\") {\r\n compareMonth = fieldValue;\r\n } else {\r\n // Try to parse as date and extract month\r\n const date = new Date(fieldValue);\r\n if (!isNaN(date.getTime())) {\r\n compareMonth = date.getMonth() + 1;\r\n } else {\r\n return VALID_RULE;\r\n }\r\n }\r\n }\r\n\r\n const inputDate = new Date(value);\r\n const inputMonth = inputDate.getMonth() + 1; // getMonth() returns 0-11\r\n\r\n if (inputMonth <= compareMonth) {\r\n return VALID_RULE;\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Min day rule - day must be >= given day or field (1-31)\r\n * Smart detection: number or field name\r\n * Supports both global and sibling scope\r\n */\r\nexport const minDayRule: SchemaRule<{\r\n dayOrField: number | string;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"minDay\",\r\n description: \"The date day must be at least the given day or field\",\r\n defaultErrorMessage: \"The :input day must be higher than :dayOrField\",\r\n async validate(value: Date, context) {\r\n const { dayOrField, scope = \"global\" } = this.context.options;\r\n let compareDay: number;\r\n\r\n if (typeof dayOrField === \"number\") {\r\n compareDay = dayOrField;\r\n this.context.translationParams.dayOrField = dayOrField;\r\n } else {\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n const fieldValue = get(source, dayOrField);\r\n\r\n if (fieldValue === undefined) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translatableParams.dayOrField = dayOrField;\r\n\r\n // If field contains a date, extract the day\r\n if (fieldValue instanceof Date) {\r\n compareDay = fieldValue.getDate();\r\n } else if (typeof fieldValue === \"number\") {\r\n compareDay = fieldValue;\r\n } else {\r\n // Try to parse as date and extract day\r\n const date = new Date(fieldValue);\r\n if (!isNaN(date.getTime())) {\r\n compareDay = date.getDate();\r\n } else {\r\n return VALID_RULE;\r\n }\r\n }\r\n }\r\n\r\n const inputDate = new Date(value);\r\n const inputDay = inputDate.getDate();\r\n\r\n if (inputDay >= compareDay) {\r\n return VALID_RULE;\r\n }\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Max day rule - day must be <= given day or field (1-31)\r\n * Smart detection: number or field name\r\n * Supports both global and sibling scope\r\n */\r\nexport const maxDayRule: SchemaRule<{\r\n dayOrField: number | string;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"maxDay\",\r\n description: \"The date day must be at most the given day or field\",\r\n defaultErrorMessage: \"The :input day must be at most :dayOrField\",\r\n async validate(value: Date, context) {\r\n const { dayOrField, scope = \"global\" } = this.context.options;\r\n let compareDay: number;\r\n\r\n if (typeof dayOrField === \"number\") {\r\n compareDay = dayOrField;\r\n this.context.translationParams.dayOrField = dayOrField;\r\n } else {\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n const fieldValue = get(source, dayOrField);\r\n\r\n if (fieldValue === undefined) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translatableParams.dayOrField = dayOrField;\r\n\r\n // If field contains a date, extract the day\r\n if (fieldValue instanceof Date) {\r\n compareDay = fieldValue.getDate();\r\n } else if (typeof fieldValue === \"number\") {\r\n compareDay = fieldValue;\r\n } else {\r\n // Try to parse as date and extract day\r\n const date = new Date(fieldValue);\r\n if (!isNaN(date.getTime())) {\r\n compareDay = date.getDate();\r\n } else {\r\n return VALID_RULE;\r\n }\r\n }\r\n }\r\n\r\n const inputDate = new Date(value);\r\n const inputDay = inputDate.getDate();\r\n\r\n if (inputDay <= compareDay) {\r\n return VALID_RULE;\r\n }\r\n return invalidRule(this, context);\r\n },\r\n};\r\n"],"mappings":";;;;;;AAIA,MAAM,SAAS;CACb,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,IAAI;CACJ,IAAI;CACJ,IAAI;AACN;;;;AAOA,MAAa,YAA0C;CACrD,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAa,SAAS;EAInC,IAFc,IADQ,KAAK,KACL,CAAC,CAAC,SAAS,IAAI,MAEvB,KAAK,QAAQ,QAAQ,OACjC,OAAO;EAGT,KAAK,QAAQ,mBAAmB,QAC9B,OAAO,KAAK,QAAQ,QAAQ;EAC9B,OAAO,YAAY,MAAM,OAAO;CAClC;AACF;;;;AAKA,MAAa,WAAyC;CACpD,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAa,SAAS;EAInC,IAFa,IADS,KAAK,KACN,CAAC,CAAC,YAEhB,MAAM,KAAK,QAAQ,QAAQ,MAChC,OAAO;EAGT,KAAK,QAAQ,kBAAkB,OAAO,KAAK,QAAQ,QAAQ;EAC3D,OAAO,YAAY,MAAM,OAAO;CAClC;AACF;;;;;AAMA,MAAa,mBAIR;CACH,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAa,SAAS;EACnC,MAAM,EAAE,WAAW,SAAS,QAAQ,aAAa,KAAK,QAAQ;EAE9D,MAAM,YAAY,I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OAAO;GAGT,KAAK,QAAQ,mBAAmB,aAAa;GAG7C,IAAI,sBAAsB,MACxB,aAAa,WAAW,QAAQ;QAC3B,IAAI,OAAO,eAAe,UAC/B,aAAa;QACR;IAEL,MAAM,OAAO,IAAI,KAAK,UAAU;IAChC,IAAI,CAAC,MAAM,KAAK,QAAQ,CAAC,GACvB,aAAa,KAAK,QAAQ;SAE1B,OAAO;GAEX;EACF;EAKA,IAFiB,IADK,KAAK,KACF,CAAC,CAAC,QAEhB,KAAK,YACd,OAAO;EAET,OAAO,YAAY,MAAM,OAAO;CAClC;AACF;;;;;;AAOA,MAAa,aAGR;CACH,MAAM;CACN,aAAa;CACb,qBAAqB;CACrB,MAAM,SAAS,OAAa,SAAS;EACnC,MAAM,EAAE,YAAY,QAAQ,aAAa,KAAK,QAAQ;EACtD,IAAI;EAEJ,IAAI,OAAO,eAAe,UAAU;GAClC,aAAa;GACb,KAAK,QAAQ,kBAAkB,aAAa;EAC9C,OAAO;GAEL,MAAM,aAAa,IADJ,UAAU,YAAY,QAAQ,SAAS,QAAQ,WAC/B,UAAU;GAEzC,IAAI,eAAe,QACjB,OAAO;GAGT,KAAK,QAAQ,mBAAmB,aAAa;GAG7C,IAAI,sBAAsB,MACxB,aAAa,WAAW,QAAQ;QAC3B,IAAI,OAAO,eAAe,UAC/B,aAAa;QACR;IAEL,MAAM,OAAO,IAAI,KAAK,UAAU;IAChC,IAAI,CAAC,MAAM,KAAK,QAAQ,CAAC,GACvB,aAAa,KAAK,QAAQ;SAE1B,OAAO;GAEX;EACF;EAKA,IAFiB,IADK,KAAK,KACF,CAAC,CAAC,QAEhB,KAAK,YACd,OAAO;EAET,OAAO,YAAY,MAAM,OAAO;CAClC;AACF"}
1
+ {"version":3,"file":"date-period-rules.mjs","names":[],"sources":["../../../../../../../../../../seal/src/rules/date/date-period-rules.ts"],"sourcesContent":["import { get } from \"@mongez/reinforcements\";\r\nimport { invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\nconst MONTHS = {\r\n 1: \"january\",\r\n 2: \"february\",\r\n 3: \"march\",\r\n 4: \"april\",\r\n 5: \"may\",\r\n 6: \"june\",\r\n 7: \"july\",\r\n 8: \"august\",\r\n 9: \"september\",\r\n 10: \"october\",\r\n 11: \"november\",\r\n 12: \"december\",\r\n};\r\n\r\nexport type Month = keyof typeof MONTHS;\r\n\r\n/**\r\n * Month rule - date must be in specific month (1-12)\r\n */\r\nexport const monthRule: SchemaRule<{ month: Month }> = {\r\n name: \"month\",\r\n defaultErrorMessage: \"The :input must be in month :month\",\r\n async validate(value: Date, context) {\r\n const inputDate = new Date(value);\r\n const month = inputDate.getMonth() + 1; // getMonth() returns 0-11\r\n\r\n if (month === this.context.options.month) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translatableParams.month =\r\n MONTHS[this.context.options.month as keyof typeof MONTHS];\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Year rule - date must be in specific year\r\n */\r\nexport const yearRule: SchemaRule<{ year: number }> = {\r\n name: \"year\",\r\n defaultErrorMessage: \"The :input must be in year :year\",\r\n async validate(value: Date, context) {\r\n const inputDate = new Date(value);\r\n const year = inputDate.getFullYear();\r\n\r\n if (year === this.context.options.year) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.year = this.context.options.year;\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Between years rule - date must be between start and end years\r\n * Supports field names with sibling scope\r\n */\r\nexport const betweenYearsRule: SchemaRule<{\r\n startYear: number | string;\r\n endYear: number | string;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"betweenYears\",\r\n defaultErrorMessage: \"The :input must be between :startYear and :endYear\",\r\n async validate(value: Date, context) {\r\n const { startYear, endYear, scope = \"global\" } = this.context.options;\r\n const inputDate = new Date(value);\r\n const inputYear = inputDate.getFullYear();\r\n\r\n // Extract start year\r\n let compareStartYear: number;\r\n if (typeof startYear === \"number\") {\r\n compareStartYear = startYear;\r\n } else {\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n const fieldValue = get(source, startYear);\r\n\r\n if (fieldValue === undefined) {\r\n return VALID_RULE;\r\n }\r\n\r\n if (fieldValue instanceof Date) {\r\n compareStartYear = fieldValue.getFullYear();\r\n } else if (typeof fieldValue === \"number\") {\r\n compareStartYear = fieldValue;\r\n } else {\r\n const date = new Date(fieldValue);\r\n if (!isNaN(date.getTime())) {\r\n compareStartYear = date.getFullYear();\r\n } else {\r\n return VALID_RULE;\r\n }\r\n }\r\n }\r\n\r\n // Extract end year\r\n let compareEndYear: number;\r\n if (typeof endYear === \"number\") {\r\n compareEndYear = endYear;\r\n } else {\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n const fieldValue = get(source, endYear);\r\n\r\n if (fieldValue === undefined) {\r\n return VALID_RULE;\r\n }\r\n\r\n if (fieldValue instanceof Date) {\r\n compareEndYear = fieldValue.getFullYear();\r\n } else if (typeof fieldValue === \"number\") {\r\n compareEndYear = fieldValue;\r\n } else {\r\n const date = new Date(fieldValue);\r\n if (!isNaN(date.getTime())) {\r\n compareEndYear = date.getFullYear();\r\n } else {\r\n return VALID_RULE;\r\n }\r\n }\r\n }\r\n\r\n if (inputYear >= compareStartYear && inputYear <= compareEndYear) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.startYear = compareStartYear;\r\n this.context.translationParams.endYear = compareEndYear;\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Between months rule - date must be between start and end months (1-12)\r\n * Supports field names with sibling scope\r\n */\r\nexport const betweenMonthsRule: SchemaRule<{\r\n startMonth: Month | string;\r\n endMonth: Month | string;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"betweenMonths\",\r\n defaultErrorMessage: \"The :input must be between month :startMonth and :endMonth\",\r\n async validate(value: Date, context) {\r\n const { startMonth, endMonth, scope = \"global\" } = this.context.options;\r\n const inputDate = new Date(value);\r\n const inputMonth = inputDate.getMonth() + 1; // getMonth() returns 0-11\r\n\r\n // Extract start month\r\n let compareStartMonth: number;\r\n if (typeof startMonth === \"number\") {\r\n compareStartMonth = startMonth;\r\n this.context.translatableParams.startMonth = MONTHS[compareStartMonth as keyof typeof MONTHS];\r\n } else {\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n const fieldValue = get(source, startMonth);\r\n\r\n if (fieldValue === undefined) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translatableParams.startMonth = startMonth;\r\n\r\n if (fieldValue instanceof Date) {\r\n compareStartMonth = fieldValue.getMonth() + 1;\r\n } else if (typeof fieldValue === \"number\") {\r\n compareStartMonth = fieldValue;\r\n } else {\r\n const date = new Date(fieldValue);\r\n if (!isNaN(date.getTime())) {\r\n compareStartMonth = date.getMonth() + 1;\r\n } else {\r\n return VALID_RULE;\r\n }\r\n }\r\n }\r\n\r\n // Extract end month\r\n let compareEndMonth: number;\r\n if (typeof endMonth === \"number\") {\r\n compareEndMonth = endMonth;\r\n this.context.translatableParams.endMonth = MONTHS[compareEndMonth as keyof typeof MONTHS];\r\n } else {\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n const fieldValue = get(source, endMonth);\r\n\r\n if (fieldValue === undefined) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translatableParams.endMonth = endMonth;\r\n\r\n if (fieldValue instanceof Date) {\r\n compareEndMonth = fieldValue.getMonth() + 1;\r\n } else if (typeof fieldValue === \"number\") {\r\n compareEndMonth = fieldValue;\r\n } else {\r\n const date = new Date(fieldValue);\r\n if (!isNaN(date.getTime())) {\r\n compareEndMonth = date.getMonth() + 1;\r\n } else {\r\n return VALID_RULE;\r\n }\r\n }\r\n }\r\n\r\n if (inputMonth >= compareStartMonth && inputMonth <= compareEndMonth) {\r\n return VALID_RULE;\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Between days rule - date must be between start and end days (1-31)\r\n * Supports field names with sibling scope\r\n */\r\nexport const betweenDaysRule: SchemaRule<{\r\n startDay: number | string;\r\n endDay: number | string;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"betweenDays\",\r\n defaultErrorMessage: \"The :input must be between day :startDay and :endDay\",\r\n async validate(value: Date, context) {\r\n const { startDay, endDay, scope = \"global\" } = this.context.options;\r\n const inputDate = new Date(value);\r\n const inputDay = inputDate.getDate();\r\n\r\n // Extract start day\r\n let compareStartDay: number;\r\n if (typeof startDay === \"number\") {\r\n compareStartDay = startDay;\r\n } else {\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n const fieldValue = get(source, startDay);\r\n\r\n if (fieldValue === undefined) {\r\n return VALID_RULE;\r\n }\r\n\r\n if (fieldValue instanceof Date) {\r\n compareStartDay = fieldValue.getDate();\r\n } else if (typeof fieldValue === \"number\") {\r\n compareStartDay = fieldValue;\r\n } else {\r\n const date = new Date(fieldValue);\r\n if (!isNaN(date.getTime())) {\r\n compareStartDay = date.getDate();\r\n } else {\r\n return VALID_RULE;\r\n }\r\n }\r\n }\r\n\r\n // Extract end day\r\n let compareEndDay: number;\r\n if (typeof endDay === \"number\") {\r\n compareEndDay = endDay;\r\n } else {\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n const fieldValue = get(source, endDay);\r\n\r\n if (fieldValue === undefined) {\r\n return VALID_RULE;\r\n }\r\n\r\n if (fieldValue instanceof Date) {\r\n compareEndDay = fieldValue.getDate();\r\n } else if (typeof fieldValue === \"number\") {\r\n compareEndDay = fieldValue;\r\n } else {\r\n const date = new Date(fieldValue);\r\n if (!isNaN(date.getTime())) {\r\n compareEndDay = date.getDate();\r\n } else {\r\n return VALID_RULE;\r\n }\r\n }\r\n }\r\n\r\n if (inputDay >= compareStartDay && inputDay <= compareEndDay) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.startDay = compareStartDay;\r\n this.context.translationParams.endDay = compareEndDay;\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Quarter rule - date must be in specific quarter (1-4)\r\n */\r\nexport const quarterRule: SchemaRule<{ quarter: 1 | 2 | 3 | 4 }> = {\r\n name: \"quarter\",\r\n defaultErrorMessage: \"The :input must be in quarter :quarter\",\r\n async validate(value: Date, context) {\r\n const inputDate = new Date(value);\r\n const month = inputDate.getMonth() + 1;\r\n const quarter = Math.ceil(month / 3);\r\n\r\n if (quarter === this.context.options.quarter) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.quarter = this.context.options.quarter;\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Between times rule - time must be between start and end times (HH:MM format)\r\n */\r\nexport const betweenTimesRule: SchemaRule<{\r\n startTime: string;\r\n endTime: string;\r\n}> = {\r\n name: \"betweenTimes\",\r\n defaultErrorMessage: \"The :input must be between :startTime and :endTime\",\r\n async validate(value: Date, context) {\r\n const inputDate = new Date(value);\r\n const inputHour = inputDate.getHours();\r\n const inputMinute = inputDate.getMinutes();\r\n const inputTimeInMinutes = inputHour * 60 + inputMinute;\r\n\r\n const { startTime, endTime } = this.context.options;\r\n\r\n // Parse start time\r\n const [startHour, startMinute] = startTime.split(\":\").map(Number);\r\n const startTimeInMinutes = startHour * 60 + startMinute;\r\n\r\n // Parse end time\r\n const [endHour, endMinute] = endTime.split(\":\").map(Number);\r\n const endTimeInMinutes = endHour * 60 + endMinute;\r\n\r\n if (inputTimeInMinutes >= startTimeInMinutes && inputTimeInMinutes <= endTimeInMinutes) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.startTime = startTime;\r\n this.context.translationParams.endTime = endTime;\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Min year rule - year must be >= given year or field\r\n * Smart detection: number or field name\r\n * Supports both global and sibling scope\r\n */\r\nexport const minYearRule: SchemaRule<{\r\n yearOrField: number | string;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"minYear\",\r\n description: \"The date year must be at least the given year or field\",\r\n defaultErrorMessage: \"The :input year must be higher than :yearOrField\",\r\n async validate(value: Date, context) {\r\n const { yearOrField, scope = \"global\" } = this.context.options;\r\n let compareYear: number;\r\n\r\n if (typeof yearOrField === \"number\") {\r\n compareYear = yearOrField;\r\n this.context.translationParams.yearOrField = yearOrField;\r\n } else {\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n const fieldValue = get(source, yearOrField);\r\n\r\n if (fieldValue === undefined) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translatableParams.yearOrField = yearOrField;\r\n\r\n // If field contains a date, extract the year\r\n if (fieldValue instanceof Date) {\r\n compareYear = fieldValue.getFullYear();\r\n } else if (typeof fieldValue === \"number\") {\r\n compareYear = fieldValue;\r\n } else {\r\n // Try to parse as date and extract year\r\n const date = new Date(fieldValue);\r\n if (!isNaN(date.getTime())) {\r\n compareYear = date.getFullYear();\r\n } else {\r\n return VALID_RULE;\r\n }\r\n }\r\n }\r\n\r\n const inputDate = new Date(value);\r\n const inputYear = inputDate.getFullYear();\r\n\r\n if (inputYear >= compareYear) {\r\n return VALID_RULE;\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Max year rule - year must be <= given year or field\r\n * Smart detection: number or field name\r\n * Supports both global and sibling scope\r\n */\r\nexport const maxYearRule: SchemaRule<{\r\n yearOrField: number | string;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"maxYear\",\r\n description: \"The date year must be at most the given year or field\",\r\n defaultErrorMessage: \"The :input year must be at most :yearOrField\",\r\n async validate(value: Date, context) {\r\n const { yearOrField, scope = \"global\" } = this.context.options;\r\n let compareYear: number;\r\n\r\n if (typeof yearOrField === \"number\") {\r\n compareYear = yearOrField;\r\n this.context.translationParams.yearOrField = compareYear;\r\n } else {\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n const fieldValue = get(source, yearOrField);\r\n\r\n if (fieldValue === undefined) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translatableParams.yearOrField = yearOrField;\r\n\r\n // If field contains a date, extract the year\r\n if (fieldValue instanceof Date) {\r\n compareYear = fieldValue.getFullYear();\r\n } else if (typeof fieldValue === \"number\") {\r\n compareYear = fieldValue;\r\n } else {\r\n // Try to parse as date and extract year\r\n const date = new Date(fieldValue);\r\n if (!isNaN(date.getTime())) {\r\n compareYear = date.getFullYear();\r\n } else {\r\n return VALID_RULE;\r\n }\r\n }\r\n }\r\n\r\n const inputDate = new Date(value);\r\n const inputYear = inputDate.getFullYear();\r\n\r\n if (inputYear <= compareYear) {\r\n return VALID_RULE;\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Min month rule - month must be >= given month or field (1-12)\r\n * Smart detection: number or field name\r\n * Supports both global and sibling scope\r\n */\r\nexport const minMonthRule: SchemaRule<{\r\n monthOrField: number | string;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"minMonth\",\r\n description: \"The date month must be at least the given month or field\",\r\n defaultErrorMessage: \"The :input month must be at least :monthOrField\",\r\n async validate(value: Date, context) {\r\n const { monthOrField, scope = \"global\" } = this.context.options;\r\n let compareMonth: number;\r\n\r\n if (typeof monthOrField === \"number\") {\r\n compareMonth = monthOrField;\r\n this.context.translationParams.monthOrField = compareMonth;\r\n } else {\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n const fieldValue = get(source, monthOrField);\r\n\r\n if (fieldValue === undefined) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translatableParams.monthOrField = monthOrField;\r\n\r\n // If field contains a date, extract the month\r\n if (fieldValue instanceof Date) {\r\n compareMonth = fieldValue.getMonth() + 1; // getMonth() returns 0-11\r\n } else if (typeof fieldValue === \"number\") {\r\n compareMonth = fieldValue;\r\n } else {\r\n // Try to parse as date and extract month\r\n const date = new Date(fieldValue);\r\n if (!isNaN(date.getTime())) {\r\n compareMonth = date.getMonth() + 1;\r\n } else {\r\n return VALID_RULE;\r\n }\r\n }\r\n }\r\n\r\n const inputDate = new Date(value);\r\n const inputMonth = inputDate.getMonth() + 1; // getMonth() returns 0-11\r\n\r\n if (inputMonth >= compareMonth) {\r\n return VALID_RULE;\r\n }\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Max month rule - month must be <= given month or field (1-12)\r\n * Smart detection: number or field name\r\n * Supports both global and sibling scope\r\n */\r\nexport const maxMonthRule: SchemaRule<{\r\n monthOrField: Month | string;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"maxMonth\",\r\n description: \"The date month must be at most the given month or field\",\r\n defaultErrorMessage: \"The :input month must be at most :monthOrField\",\r\n async validate(value: Date, context) {\r\n const { monthOrField, scope = \"global\" } = this.context.options;\r\n let compareMonth: number;\r\n\r\n if (typeof monthOrField === \"number\") {\r\n compareMonth = monthOrField;\r\n this.context.translatableParams.monthOrField = MONTHS[monthOrField];\r\n } else {\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n const fieldValue = get(source, monthOrField);\r\n\r\n if (fieldValue === undefined) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translatableParams.monthOrField = monthOrField;\r\n\r\n // If field contains a date, extract the month\r\n if (fieldValue instanceof Date) {\r\n compareMonth = fieldValue.getMonth() + 1; // getMonth() returns 0-11\r\n } else if (typeof fieldValue === \"number\") {\r\n compareMonth = fieldValue;\r\n } else {\r\n // Try to parse as date and extract month\r\n const date = new Date(fieldValue);\r\n if (!isNaN(date.getTime())) {\r\n compareMonth = date.getMonth() + 1;\r\n } else {\r\n return VALID_RULE;\r\n }\r\n }\r\n }\r\n\r\n const inputDate = new Date(value);\r\n const inputMonth = inputDate.getMonth() + 1; // getMonth() returns 0-11\r\n\r\n if (inputMonth <= compareMonth) {\r\n return VALID_RULE;\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Min day rule - day must be >= given day or field (1-31)\r\n * Smart detection: number or field name\r\n * Supports both global and sibling scope\r\n */\r\nexport const minDayRule: SchemaRule<{\r\n dayOrField: number | string;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"minDay\",\r\n description: \"The date day must be at least the given day or field\",\r\n defaultErrorMessage: \"The :input day must be higher than :dayOrField\",\r\n async validate(value: Date, context) {\r\n const { dayOrField, scope = \"global\" } = this.context.options;\r\n let compareDay: number;\r\n\r\n if (typeof dayOrField === \"number\") {\r\n compareDay = dayOrField;\r\n this.context.translationParams.dayOrField = dayOrField;\r\n } else {\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n const fieldValue = get(source, dayOrField);\r\n\r\n if (fieldValue === undefined) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translatableParams.dayOrField = dayOrField;\r\n\r\n // If field contains a date, extract the day\r\n if (fieldValue instanceof Date) {\r\n compareDay = fieldValue.getDate();\r\n } else if (typeof fieldValue === \"number\") {\r\n compareDay = fieldValue;\r\n } else {\r\n // Try to parse as date and extract day\r\n const date = new Date(fieldValue);\r\n if (!isNaN(date.getTime())) {\r\n compareDay = date.getDate();\r\n } else {\r\n return VALID_RULE;\r\n }\r\n }\r\n }\r\n\r\n const inputDate = new Date(value);\r\n const inputDay = inputDate.getDate();\r\n\r\n if (inputDay >= compareDay) {\r\n return VALID_RULE;\r\n }\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Max day rule - day must be <= given day or field (1-31)\r\n * Smart detection: number or field name\r\n * Supports both global and sibling scope\r\n */\r\nexport const maxDayRule: SchemaRule<{\r\n dayOrField: number | string;\r\n scope?: \"global\" | \"sibling\";\r\n}> = {\r\n name: \"maxDay\",\r\n description: \"The date day must be at most the given day or field\",\r\n defaultErrorMessage: \"The :input day must be at most :dayOrField\",\r\n async validate(value: Date, context) {\r\n const { dayOrField, scope = \"global\" } = this.context.options;\r\n let compareDay: number;\r\n\r\n if (typeof dayOrField === \"number\") {\r\n compareDay = dayOrField;\r\n this.context.translationParams.dayOrField = dayOrField;\r\n } else {\r\n const source = scope === \"sibling\" ? context.parent : context.allValues;\r\n const fieldValue = get(source, dayOrField);\r\n\r\n if (fieldValue === undefined) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translatableParams.dayOrField = dayOrField;\r\n\r\n // If field contains a date, extract the day\r\n if (fieldValue instanceof Date) {\r\n compareDay = fieldValue.getDate();\r\n } else if (typeof fieldValue === \"number\") {\r\n compareDay = fieldValue;\r\n } else {\r\n // Try to parse as date and extract day\r\n const date = new Date(fieldValue);\r\n if (!isNaN(date.getTime())) {\r\n compareDay = date.getDate();\r\n } else {\r\n return VALID_RULE;\r\n }\r\n }\r\n }\r\n\r\n const inputDate = new Date(value);\r\n const inputDay = inputDate.getDate();\r\n\r\n if (inputDay <= compareDay) {\r\n return VALID_RULE;\r\n }\r\n return invalidRule(this, context);\r\n },\r\n};\r\n"],"mappings":";;;;;;AAIA,MAAM,SAAS;CACb,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,IAAI;CACJ,IAAI;CACJ,IAAI;AACN;;;;AAOA,MAAa,YAA0C;CACrD,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAa,SAAS;EAInC,IAFc,IADQ,KAAK,KACL,EAAE,SAAS,IAAI,MAEvB,KAAK,QAAQ,QAAQ,OACjC,OAAO;EAGT,KAAK,QAAQ,mBAAmB,QAC9B,OAAO,KAAK,QAAQ,QAAQ;EAC9B,OAAO,YAAY,MAAM,OAAO;CAClC;AACF;;;;AAKA,MAAa,WAAyC;CACpD,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAa,SAAS;EAInC,IAFa,IADS,KAAK,KACN,EAAE,YAEhB,MAAM,KAAK,QAAQ,QAAQ,MAChC,OAAO;EAGT,KAAK,QAAQ,kBAAkB,OAAO,KAAK,QAAQ,QAAQ;EAC3D,OAAO,YAAY,MAAM,OAAO;CAClC;AACF;;;;;AAMA,MAA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Aa,IADJ,UAAU,YAAY,QAAQ,SAAS,QAAQ,WAC/B,UAAU;GAEzC,IAAI,eAAe,QACjB,OAAO;GAGT,KAAK,QAAQ,mBAAmB,aAAa;GAG7C,IAAI,sBAAsB,MACxB,aAAa,WAAW,QAAQ;QAC3B,IAAI,OAAO,eAAe,UAC/B,aAAa;QACR;IAEL,MAAM,OAAO,IAAI,KAAK,UAAU;IAChC,IAAI,CAAC,MAAM,KAAK,QAAQ,CAAC,GACvB,aAAa,KAAK,QAAQ;SAE1B,OAAO;GAEX;EACF;EAKA,IAFiB,IADK,KAAK,KACF,EAAE,QAEhB,KAAK,YACd,OAAO;EAET,OAAO,YAAY,MAAM,OAAO;CAClC;AACF;;;;;;AAOA,MAAa,aAGR;CACH,MAAM;CACN,aAAa;CACb,qBAAqB;CACrB,MAAM,SAAS,OAAa,SAAS;EACnC,MAAM,EAAE,YAAY,QAAQ,aAAa,KAAK,QAAQ;EACtD,IAAI;EAEJ,IAAI,OAAO,eAAe,UAAU;GAClC,aAAa;GACb,KAAK,QAAQ,kBAAkB,aAAa;EAC9C,OAAO;GAEL,MAAM,aAAa,IADJ,UAAU,YAAY,QAAQ,SAAS,QAAQ,WAC/B,UAAU;GAEzC,IAAI,eAAe,QACjB,OAAO;GAGT,KAAK,QAAQ,mBAAmB,aAAa;GAG7C,IAAI,sBAAsB,MACxB,aAAa,WAAW,QAAQ;QAC3B,IAAI,OAAO,eAAe,UAC/B,aAAa;QACR;IAEL,MAAM,OAAO,IAAI,KAAK,UAAU;IAChC,IAAI,CAAC,MAAM,KAAK,QAAQ,CAAC,GACvB,aAAa,KAAK,QAAQ;SAE1B,OAAO;GAEX;EACF;EAKA,IAFiB,IADK,KAAK,KACF,EAAE,QAEhB,KAAK,YACd,OAAO;EAET,OAAO,YAAY,MAAM,OAAO;CAClC;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"date-special-rules.mjs","names":[],"sources":["../../../../../../../../../../seal/src/rules/date/date-special-rules.ts"],"sourcesContent":["import { invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\n/**\r\n * Birthday rule - valid birthday (not in future, reasonable age)\r\n */\r\nexport const birthdayRule: SchemaRule<{ minAge?: number; maxAge?: number }> = {\r\n name: \"birthday\",\r\n defaultErrorMessage: \"The :input must be a valid birthday\",\r\n async validate(birthDate: Date, context) {\r\n const today = new Date();\r\n\r\n // Must not be in the future\r\n if (birthDate > today) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n // Calculate age\r\n let age = today.getFullYear() - birthDate.getFullYear();\r\n const monthDiff = today.getMonth() - birthDate.getMonth();\r\n\r\n if (monthDiff < 0 || (monthDiff === 0 && today.getDate() < birthDate.getDate())) {\r\n age--;\r\n }\r\n\r\n // Check minimum age (default: 0)\r\n const minAge = this.context.options.minAge ?? 0;\r\n if (age < minAge) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n // Check maximum age (default: 150)\r\n const maxAge = this.context.options.maxAge ?? 150;\r\n if (age > maxAge) {\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 * Between age rule - age must be between min and max years\r\n */\r\nexport const betweenAgeRule: SchemaRule<{ minAge: number; maxAge: number }> = {\r\n name: \"betweenAge\",\r\n defaultErrorMessage: \"Age must be between :minAge and :maxAge years\",\r\n async validate(value: Date, context) {\r\n const birthDate = new Date(value);\r\n const today = new Date();\r\n let age = today.getFullYear() - birthDate.getFullYear();\r\n const monthDiff = today.getMonth() - birthDate.getMonth();\r\n\r\n if (monthDiff < 0 || (monthDiff === 0 && today.getDate() < birthDate.getDate())) {\r\n age--;\r\n }\r\n\r\n const { minAge, maxAge } = this.context.options;\r\n\r\n if (age >= minAge && age <= maxAge) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.minAge = minAge;\r\n this.context.translationParams.maxAge = maxAge;\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Leap year rule - date must be in a leap year\r\n */\r\nexport const leapYearRule: SchemaRule = {\r\n name: \"leapYear\",\r\n defaultErrorMessage: \"The :input must be in a leap year\",\r\n async validate(value: Date, context) {\r\n const inputDate = new Date(value);\r\n const year = inputDate.getFullYear();\r\n\r\n // Leap year logic: divisible by 4, except century years unless divisible by 400\r\n const isLeapYear = (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;\r\n\r\n if (isLeapYear) {\r\n return VALID_RULE;\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n"],"mappings":";;;;;;;AAMA,MAAa,eAAiE;CAC5E,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,WAAiB,SAAS;EACvC,MAAM,wBAAQ,IAAI,KAAK;EAGvB,IAAI,YAAY,OACd,OAAO,YAAY,MAAM,OAAO;EAIlC,IAAI,MAAM,MAAM,YAAY,IAAI,UAAU,YAAY;EACtD,MAAM,YAAY,MAAM,SAAS,IAAI,UAAU,SAAS;EAExD,IAAI,YAAY,KAAM,cAAc,KAAK,MAAM,QAAQ,IAAI,UAAU,QAAQ,GAC3E;EAIF,MAAM,SAAS,KAAK,QAAQ,QAAQ,UAAU;EAC9C,IAAI,MAAM,QACR,OAAO,YAAY,MAAM,OAAO;EAIlC,MAAM,SAAS,KAAK,QAAQ,QAAQ,UAAU;EAC9C,IAAI,MAAM,QACR,OAAO,YAAY,MAAM,OAAO;EAGlC,OAAO;CACT;AACF;;;;AAKA,MAAa,iBAAiE;CAC5E,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAa,SAAS;EACnC,MAAM,YAAY,IAAI,KAAK,KAAK;EAChC,MAAM,wBAAQ,IAAI,KAAK;EACvB,IAAI,MAAM,MAAM,YAAY,IAAI,UAAU,YAAY;EACtD,MAAM,YAAY,MAAM,SAAS,IAAI,UAAU,SAAS;EAExD,IAAI,YAAY,KAAM,cAAc,KAAK,MAAM,QAAQ,IAAI,UAAU,QAAQ,GAC3E;EAGF,MAAM,EAAE,QAAQ,WAAW,KAAK,QAAQ;EAExC,IAAI,OAAO,UAAU,OAAO,QAC1B,OAAO;EAGT,KAAK,QAAQ,kBAAkB,SAAS;EACxC,KAAK,QAAQ,kBAAkB,SAAS;EAExC,OAAO,YAAY,MAAM,OAAO;CAClC;AACF;;;;AAKA,MAAa,eAA2B;CACtC,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAa,SAAS;EAEnC,MAAM,OAAO,IADS,KAAK,KACN,CAAC,CAAC,YAAY;EAKnC,IAFoB,OAAO,MAAM,KAAK,OAAO,QAAQ,KAAM,OAAO,QAAQ,GAGxE,OAAO;EAGT,OAAO,YAAY,MAAM,OAAO;CAClC;AACF"}
1
+ {"version":3,"file":"date-special-rules.mjs","names":[],"sources":["../../../../../../../../../../seal/src/rules/date/date-special-rules.ts"],"sourcesContent":["import { invalidRule, VALID_RULE } from \"../../helpers\";\r\nimport type { SchemaRule } from \"../../types\";\r\n\r\n/**\r\n * Birthday rule - valid birthday (not in future, reasonable age)\r\n */\r\nexport const birthdayRule: SchemaRule<{ minAge?: number; maxAge?: number }> = {\r\n name: \"birthday\",\r\n defaultErrorMessage: \"The :input must be a valid birthday\",\r\n async validate(birthDate: Date, context) {\r\n const today = new Date();\r\n\r\n // Must not be in the future\r\n if (birthDate > today) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n // Calculate age\r\n let age = today.getFullYear() - birthDate.getFullYear();\r\n const monthDiff = today.getMonth() - birthDate.getMonth();\r\n\r\n if (monthDiff < 0 || (monthDiff === 0 && today.getDate() < birthDate.getDate())) {\r\n age--;\r\n }\r\n\r\n // Check minimum age (default: 0)\r\n const minAge = this.context.options.minAge ?? 0;\r\n if (age < minAge) {\r\n return invalidRule(this, context);\r\n }\r\n\r\n // Check maximum age (default: 150)\r\n const maxAge = this.context.options.maxAge ?? 150;\r\n if (age > maxAge) {\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 * Between age rule - age must be between min and max years\r\n */\r\nexport const betweenAgeRule: SchemaRule<{ minAge: number; maxAge: number }> = {\r\n name: \"betweenAge\",\r\n defaultErrorMessage: \"Age must be between :minAge and :maxAge years\",\r\n async validate(value: Date, context) {\r\n const birthDate = new Date(value);\r\n const today = new Date();\r\n let age = today.getFullYear() - birthDate.getFullYear();\r\n const monthDiff = today.getMonth() - birthDate.getMonth();\r\n\r\n if (monthDiff < 0 || (monthDiff === 0 && today.getDate() < birthDate.getDate())) {\r\n age--;\r\n }\r\n\r\n const { minAge, maxAge } = this.context.options;\r\n\r\n if (age >= minAge && age <= maxAge) {\r\n return VALID_RULE;\r\n }\r\n\r\n this.context.translationParams.minAge = minAge;\r\n this.context.translationParams.maxAge = maxAge;\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n\r\n/**\r\n * Leap year rule - date must be in a leap year\r\n */\r\nexport const leapYearRule: SchemaRule = {\r\n name: \"leapYear\",\r\n defaultErrorMessage: \"The :input must be in a leap year\",\r\n async validate(value: Date, context) {\r\n const inputDate = new Date(value);\r\n const year = inputDate.getFullYear();\r\n\r\n // Leap year logic: divisible by 4, except century years unless divisible by 400\r\n const isLeapYear = (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;\r\n\r\n if (isLeapYear) {\r\n return VALID_RULE;\r\n }\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n"],"mappings":";;;;;;;AAMA,MAAa,eAAiE;CAC5E,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,WAAiB,SAAS;EACvC,MAAM,wBAAQ,IAAI,KAAK;EAGvB,IAAI,YAAY,OACd,OAAO,YAAY,MAAM,OAAO;EAIlC,IAAI,MAAM,MAAM,YAAY,IAAI,UAAU,YAAY;EACtD,MAAM,YAAY,MAAM,SAAS,IAAI,UAAU,SAAS;EAExD,IAAI,YAAY,KAAM,cAAc,KAAK,MAAM,QAAQ,IAAI,UAAU,QAAQ,GAC3E;EAIF,MAAM,SAAS,KAAK,QAAQ,QAAQ,UAAU;EAC9C,IAAI,MAAM,QACR,OAAO,YAAY,MAAM,OAAO;EAIlC,MAAM,SAAS,KAAK,QAAQ,QAAQ,UAAU;EAC9C,IAAI,MAAM,QACR,OAAO,YAAY,MAAM,OAAO;EAGlC,OAAO;CACT;AACF;;;;AAKA,MAAa,iBAAiE;CAC5E,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAa,SAAS;EACnC,MAAM,YAAY,IAAI,KAAK,KAAK;EAChC,MAAM,wBAAQ,IAAI,KAAK;EACvB,IAAI,MAAM,MAAM,YAAY,IAAI,UAAU,YAAY;EACtD,MAAM,YAAY,MAAM,SAAS,IAAI,UAAU,SAAS;EAExD,IAAI,YAAY,KAAM,cAAc,KAAK,MAAM,QAAQ,IAAI,UAAU,QAAQ,GAC3E;EAGF,MAAM,EAAE,QAAQ,WAAW,KAAK,QAAQ;EAExC,IAAI,OAAO,UAAU,OAAO,QAC1B,OAAO;EAGT,KAAK,QAAQ,kBAAkB,SAAS;EACxC,KAAK,QAAQ,kBAAkB,SAAS;EAExC,OAAO,YAAY,MAAM,OAAO;CAClC;AACF;;;;AAKA,MAAa,eAA2B;CACtC,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAa,SAAS;EAEnC,MAAM,OAAO,IADS,KAAK,KACN,EAAE,YAAY;EAKnC,IAFoB,OAAO,MAAM,KAAK,OAAO,QAAQ,KAAM,OAAO,QAAQ,GAGxE,OAAO;EAGT,OAAO,YAAY,MAAM,OAAO;CAClC;AACF"}
@@ -1,5 +1,5 @@
1
- import { get } from "../../../../node_modules/@mongez/reinforcements/esm/object/get.mjs";
2
- import "../../../../node_modules/@mongez/reinforcements/esm/index.mjs";
1
+ import { get } from "../../../../node_modules/.pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez/reinforcements/esm/object/get.mjs";
2
+ import "../../../../node_modules/.pnpm/@mongez_reinforcements@4.0.1/node_modules/@mongez/reinforcements/esm/index.mjs";
3
3
  import { isDateValue } from "../../helpers/date-helpers.mjs";
4
4
  import { VALID_RULE, invalidRule } from "../../helpers/validation-helpers.mjs";
5
5
  import "../../helpers/index.mjs";