@warlock.js/notifications 5.31.0 → 5.32.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (405) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/cjs/index.cjs +2 -2
  3. package/cjs/index.cjs.map +1 -1
  4. package/esm/channels/database-channel.d.mts +2 -3
  5. package/esm/channels/database-channel.d.mts.map +1 -1
  6. package/esm/channels/index.d.mts +2 -1
  7. package/esm/channels/index.mjs +1 -1
  8. package/esm/channels/mail-channel.d.mts +6 -4
  9. package/esm/channels/mail-channel.d.mts.map +1 -1
  10. package/esm/config.d.mts +13 -9
  11. package/esm/config.d.mts.map +1 -1
  12. package/esm/contracts/channel.contract.d.mts +1 -3
  13. package/esm/contracts/channel.contract.d.mts.map +1 -1
  14. package/esm/contracts/index.d.mts +2 -1
  15. package/esm/contracts/notification.contract.d.mts +1 -3
  16. package/esm/contracts/notification.contract.d.mts.map +1 -1
  17. package/esm/contracts/preference-provider.contract.d.mts +1 -3
  18. package/esm/contracts/preference-provider.contract.d.mts.map +1 -1
  19. package/esm/contracts/queue-dispatcher.contract.d.mts +1 -3
  20. package/esm/contracts/queue-dispatcher.contract.d.mts.map +1 -1
  21. package/esm/contracts/rate-limiter.contract.d.mts +1 -3
  22. package/esm/contracts/rate-limiter.contract.d.mts.map +1 -1
  23. package/esm/dispatch/define-channel.d.mts +2 -2
  24. package/esm/dispatch/define-channel.d.mts.map +1 -1
  25. package/esm/dispatch/define-notification.d.mts +5 -6
  26. package/esm/dispatch/define-notification.d.mts.map +1 -1
  27. package/esm/dispatch/index.d.mts +2 -1
  28. package/esm/dispatch/index.mjs +1 -1
  29. package/esm/dispatch/notifications-event-bus.d.mts +2 -3
  30. package/esm/dispatch/notifications-event-bus.d.mts.map +1 -1
  31. package/esm/dispatch/notify.d.mts +3 -5
  32. package/esm/dispatch/notify.d.mts.map +1 -1
  33. package/esm/errors.d.mts +5 -6
  34. package/esm/errors.d.mts.map +1 -1
  35. package/esm/in-app/base-notifications-repository.d.mts +6 -6
  36. package/esm/in-app/base-notifications-repository.d.mts.map +1 -1
  37. package/esm/in-app/base-notifications-repository.mjs +1 -1
  38. package/esm/in-app/base-notifications-repository.mjs.map +1 -1
  39. package/esm/in-app/column-map.d.mts +11 -8
  40. package/esm/in-app/column-map.d.mts.map +1 -1
  41. package/esm/in-app/database-notification.d.mts +2 -3
  42. package/esm/in-app/database-notification.d.mts.map +1 -1
  43. package/esm/in-app/in-app.d.mts +6 -5
  44. package/esm/in-app/in-app.d.mts.map +1 -1
  45. package/esm/in-app/index.d.mts +2 -1
  46. package/esm/in-app/index.mjs +1 -1
  47. package/esm/index.d.mts +6 -0
  48. package/esm/migration/index.d.mts +2 -1
  49. package/esm/migration/index.mjs +1 -1
  50. package/esm/migration/notification-columns.d.mts +6 -7
  51. package/esm/migration/notification-columns.d.mts.map +1 -1
  52. package/esm/queue/bullmq-queue.d.mts +9 -7
  53. package/esm/queue/bullmq-queue.d.mts.map +1 -1
  54. package/esm/queue/herald-queue.d.mts +6 -4
  55. package/esm/queue/herald-queue.d.mts.map +1 -1
  56. package/esm/queue/index.d.mts +2 -1
  57. package/esm/queue/index.mjs +1 -1
  58. package/esm/queue/load-herald.d.mts +1 -2
  59. package/esm/queue/load-herald.d.mts.map +1 -1
  60. package/esm/queue/load-herald.mjs +1 -1
  61. package/esm/queue/load-queue.d.mts +2 -3
  62. package/esm/queue/load-queue.d.mts.map +1 -1
  63. package/esm/queue/notifications-worker.d.mts +5 -4
  64. package/esm/queue/notifications-worker.d.mts.map +1 -1
  65. package/esm/queue/queue-package-not-installed.error.d.mts +1 -2
  66. package/esm/queue/queue-package-not-installed.error.d.mts.map +1 -1
  67. package/esm/types.d.mts +22 -18
  68. package/esm/types.d.mts.map +1 -1
  69. package/package.json +10 -9
  70. package/cjs/channel_api-C5ZZDkgQ.cjs +0 -7463
  71. package/cjs/channel_api-C5ZZDkgQ.cjs.map +0 -1
  72. package/cjs/chunk-fl3r8ClO.cjs +0 -41
  73. package/cjs/rabbitmq-driver-CkPaCswV.cjs +0 -3
  74. package/cjs/src-CcbF8Hr1.cjs +0 -11276
  75. package/cjs/src-CcbF8Hr1.cjs.map +0 -1
  76. package/esm/_virtual/_rolldown/runtime.mjs +0 -32
  77. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.2/node_modules/@mongez/reinforcements/esm/Random/_internal.mjs +0 -6
  78. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.2/node_modules/@mongez/reinforcements/esm/Random/_internal.mjs.map +0 -1
  79. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.2/node_modules/@mongez/reinforcements/esm/Random/bool.mjs +0 -3
  80. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.2/node_modules/@mongez/reinforcements/esm/Random/color.mjs +0 -3
  81. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.2/node_modules/@mongez/reinforcements/esm/Random/date.mjs +0 -3
  82. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.2/node_modules/@mongez/reinforcements/esm/Random/float.mjs +0 -3
  83. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.2/node_modules/@mongez/reinforcements/esm/Random/id.mjs +0 -3
  84. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.2/node_modules/@mongez/reinforcements/esm/Random/int.mjs +0 -3
  85. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.2/node_modules/@mongez/reinforcements/esm/Random/nanoid.mjs +0 -3
  86. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.2/node_modules/@mongez/reinforcements/esm/Random/pick.mjs +0 -3
  87. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.2/node_modules/@mongez/reinforcements/esm/Random/random.mjs +0 -16
  88. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.2/node_modules/@mongez/reinforcements/esm/Random/sample.mjs +0 -3
  89. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.2/node_modules/@mongez/reinforcements/esm/Random/string.mjs +0 -3
  90. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.2/node_modules/@mongez/reinforcements/esm/Random/token.mjs +0 -3
  91. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.2/node_modules/@mongez/reinforcements/esm/Random/uuid.mjs +0 -3
  92. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.2/node_modules/@mongez/reinforcements/esm/Random/weighted.mjs +0 -3
  93. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.2/node_modules/@mongez/reinforcements/esm/async/retry.mjs +0 -3
  94. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.2/node_modules/@mongez/reinforcements/esm/index.mjs +0 -24
  95. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.2/node_modules/@mongez/reinforcements/esm/mixed/clone/clone.mjs +0 -82
  96. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.2/node_modules/@mongez/reinforcements/esm/mixed/clone/clone.mjs.map +0 -1
  97. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.2/node_modules/@mongez/reinforcements/esm/number/round.mjs +0 -17
  98. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.2/node_modules/@mongez/reinforcements/esm/number/round.mjs.map +0 -1
  99. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.2/node_modules/@mongez/reinforcements/esm/object/except.mjs +0 -13
  100. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.2/node_modules/@mongez/reinforcements/esm/object/except.mjs.map +0 -1
  101. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.2/node_modules/@mongez/reinforcements/esm/object/get.mjs +0 -18
  102. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.2/node_modules/@mongez/reinforcements/esm/object/get.mjs.map +0 -1
  103. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.2/node_modules/@mongez/reinforcements/esm/object/omit.mjs +0 -17
  104. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.2/node_modules/@mongez/reinforcements/esm/object/omit.mjs.map +0 -1
  105. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.2/node_modules/@mongez/reinforcements/esm/object/unset.mjs +0 -30
  106. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.2/node_modules/@mongez/reinforcements/esm/object/unset.mjs.map +0 -1
  107. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.2/node_modules/@mongez/reinforcements/esm/string/capitalize.mjs +0 -19
  108. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.2/node_modules/@mongez/reinforcements/esm/string/capitalize.mjs.map +0 -1
  109. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.2/node_modules/@mongez/reinforcements/esm/string/ltrim.mjs +0 -18
  110. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.2/node_modules/@mongez/reinforcements/esm/string/ltrim.mjs.map +0 -1
  111. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.2/node_modules/@mongez/reinforcements/esm/string/readMoreChars.mjs +0 -14
  112. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.2/node_modules/@mongez/reinforcements/esm/string/readMoreChars.mjs.map +0 -1
  113. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.2/node_modules/@mongez/reinforcements/esm/string/rtrim.mjs +0 -18
  114. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.2/node_modules/@mongez/reinforcements/esm/string/rtrim.mjs.map +0 -1
  115. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.2/node_modules/@mongez/reinforcements/esm/string/toCamelCase.mjs +0 -22
  116. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.2/node_modules/@mongez/reinforcements/esm/string/toCamelCase.mjs.map +0 -1
  117. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.2/node_modules/@mongez/reinforcements/esm/string/toKebabCase.mjs +0 -17
  118. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.2/node_modules/@mongez/reinforcements/esm/string/toKebabCase.mjs.map +0 -1
  119. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.2/node_modules/@mongez/reinforcements/esm/string/toSnakeCase.mjs +0 -21
  120. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.2/node_modules/@mongez/reinforcements/esm/string/toSnakeCase.mjs.map +0 -1
  121. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.2/node_modules/@mongez/reinforcements/esm/string/toStudlyCase.mjs +0 -21
  122. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.2/node_modules/@mongez/reinforcements/esm/string/toStudlyCase.mjs.map +0 -1
  123. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.2/node_modules/@mongez/reinforcements/esm/string/trim.mjs +0 -20
  124. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.2/node_modules/@mongez/reinforcements/esm/string/trim.mjs.map +0 -1
  125. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.2/node_modules/@mongez/reinforcements/esm/string/ucfirst.mjs +0 -15
  126. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.2/node_modules/@mongez/reinforcements/esm/string/ucfirst.mjs.map +0 -1
  127. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.2/node_modules/@mongez/reinforcements/esm/string/words.mjs +0 -25
  128. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.2/node_modules/@mongez/reinforcements/esm/string/words.mjs.map +0 -1
  129. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.2/node_modules/@mongez/reinforcements/esm/utils/escapeRegex.mjs +0 -11
  130. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.2/node_modules/@mongez/reinforcements/esm/utils/escapeRegex.mjs.map +0 -1
  131. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.2/node_modules/@mongez/reinforcements/esm/utils/lazy.mjs +0 -100
  132. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.2/node_modules/@mongez/reinforcements/esm/utils/lazy.mjs.map +0 -1
  133. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.2/node_modules/@mongez/reinforcements/esm/utils/tap.mjs +0 -27
  134. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.2/node_modules/@mongez/reinforcements/esm/utils/tap.mjs.map +0 -1
  135. package/esm/node_modules/.pnpm/@mongez_supportive-is@3.0.0/node_modules/@mongez/supportive-is/esm/index.mjs +0 -358
  136. package/esm/node_modules/.pnpm/@mongez_supportive-is@3.0.0/node_modules/@mongez/supportive-is/esm/index.mjs.map +0 -1
  137. package/esm/node_modules/.pnpm/amqplib@0.10.9/node_modules/amqplib/channel_api.mjs +0 -28
  138. package/esm/node_modules/.pnpm/amqplib@0.10.9/node_modules/amqplib/channel_api.mjs.map +0 -1
  139. package/esm/node_modules/.pnpm/amqplib@0.10.9/node_modules/amqplib/lib/api_args.mjs +0 -241
  140. package/esm/node_modules/.pnpm/amqplib@0.10.9/node_modules/amqplib/lib/api_args.mjs.map +0 -1
  141. package/esm/node_modules/.pnpm/amqplib@0.10.9/node_modules/amqplib/lib/bitset.mjs +0 -130
  142. package/esm/node_modules/.pnpm/amqplib@0.10.9/node_modules/amqplib/lib/bitset.mjs.map +0 -1
  143. package/esm/node_modules/.pnpm/amqplib@0.10.9/node_modules/amqplib/lib/channel.mjs +0 -302
  144. package/esm/node_modules/.pnpm/amqplib@0.10.9/node_modules/amqplib/lib/channel.mjs.map +0 -1
  145. package/esm/node_modules/.pnpm/amqplib@0.10.9/node_modules/amqplib/lib/channel_model.mjs +0 -206
  146. package/esm/node_modules/.pnpm/amqplib@0.10.9/node_modules/amqplib/lib/channel_model.mjs.map +0 -1
  147. package/esm/node_modules/.pnpm/amqplib@0.10.9/node_modules/amqplib/lib/codec.mjs +0 -273
  148. package/esm/node_modules/.pnpm/amqplib@0.10.9/node_modules/amqplib/lib/codec.mjs.map +0 -1
  149. package/esm/node_modules/.pnpm/amqplib@0.10.9/node_modules/amqplib/lib/connect.mjs +0 -143
  150. package/esm/node_modules/.pnpm/amqplib@0.10.9/node_modules/amqplib/lib/connect.mjs.map +0 -1
  151. package/esm/node_modules/.pnpm/amqplib@0.10.9/node_modules/amqplib/lib/connection.mjs +0 -416
  152. package/esm/node_modules/.pnpm/amqplib@0.10.9/node_modules/amqplib/lib/connection.mjs.map +0 -1
  153. package/esm/node_modules/.pnpm/amqplib@0.10.9/node_modules/amqplib/lib/credentials.mjs +0 -50
  154. package/esm/node_modules/.pnpm/amqplib@0.10.9/node_modules/amqplib/lib/credentials.mjs.map +0 -1
  155. package/esm/node_modules/.pnpm/amqplib@0.10.9/node_modules/amqplib/lib/defs.mjs +0 -4600
  156. package/esm/node_modules/.pnpm/amqplib@0.10.9/node_modules/amqplib/lib/defs.mjs.map +0 -1
  157. package/esm/node_modules/.pnpm/amqplib@0.10.9/node_modules/amqplib/lib/error.mjs +0 -29
  158. package/esm/node_modules/.pnpm/amqplib@0.10.9/node_modules/amqplib/lib/error.mjs.map +0 -1
  159. package/esm/node_modules/.pnpm/amqplib@0.10.9/node_modules/amqplib/lib/format.mjs +0 -28
  160. package/esm/node_modules/.pnpm/amqplib@0.10.9/node_modules/amqplib/lib/format.mjs.map +0 -1
  161. package/esm/node_modules/.pnpm/amqplib@0.10.9/node_modules/amqplib/lib/frame.mjs +0 -130
  162. package/esm/node_modules/.pnpm/amqplib@0.10.9/node_modules/amqplib/lib/frame.mjs.map +0 -1
  163. package/esm/node_modules/.pnpm/amqplib@0.10.9/node_modules/amqplib/lib/heartbeat.mjs +0 -40
  164. package/esm/node_modules/.pnpm/amqplib@0.10.9/node_modules/amqplib/lib/heartbeat.mjs.map +0 -1
  165. package/esm/node_modules/.pnpm/amqplib@0.10.9/node_modules/amqplib/lib/mux.mjs +0 -86
  166. package/esm/node_modules/.pnpm/amqplib@0.10.9/node_modules/amqplib/lib/mux.mjs.map +0 -1
  167. package/esm/node_modules/.pnpm/amqplib@0.10.9/node_modules/amqplib/package.mjs +0 -41
  168. package/esm/node_modules/.pnpm/amqplib@0.10.9/node_modules/amqplib/package.mjs.map +0 -1
  169. package/esm/node_modules/.pnpm/buffer-more-ints@1.0.0/node_modules/buffer-more-ints/buffer-more-ints.mjs +0 -360
  170. package/esm/node_modules/.pnpm/buffer-more-ints@1.0.0/node_modules/buffer-more-ints/buffer-more-ints.mjs.map +0 -1
  171. package/esm/node_modules/.pnpm/dayjs@1.11.23/node_modules/dayjs/dayjs.min.mjs +0 -305
  172. package/esm/node_modules/.pnpm/dayjs@1.11.23/node_modules/dayjs/dayjs.min.mjs.map +0 -1
  173. package/esm/node_modules/.pnpm/querystringify@2.2.0/node_modules/querystringify/index.mjs +0 -80
  174. package/esm/node_modules/.pnpm/querystringify@2.2.0/node_modules/querystringify/index.mjs.map +0 -1
  175. package/esm/node_modules/.pnpm/requires-port@1.0.0/node_modules/requires-port/index.mjs +0 -35
  176. package/esm/node_modules/.pnpm/requires-port@1.0.0/node_modules/requires-port/index.mjs.map +0 -1
  177. package/esm/node_modules/.pnpm/url-parse@1.5.10/node_modules/url-parse/index.mjs +0 -388
  178. package/esm/node_modules/.pnpm/url-parse@1.5.10/node_modules/url-parse/index.mjs.map +0 -1
  179. package/esm/packages/herald/src/communicators/broker-registry.mjs +0 -204
  180. package/esm/packages/herald/src/communicators/broker-registry.mjs.map +0 -1
  181. package/esm/packages/herald/src/communicators/broker.mjs +0 -110
  182. package/esm/packages/herald/src/communicators/broker.mjs.map +0 -1
  183. package/esm/packages/herald/src/communicators/index.mjs +0 -4
  184. package/esm/packages/herald/src/decorators/consumable.mjs +0 -36
  185. package/esm/packages/herald/src/decorators/consumable.mjs.map +0 -1
  186. package/esm/packages/herald/src/decorators/index.mjs +0 -3
  187. package/esm/packages/herald/src/drivers/index.mjs +0 -5
  188. package/esm/packages/herald/src/drivers/rabbitmq/index.mjs +0 -4
  189. package/esm/packages/herald/src/drivers/rabbitmq/rabbitmq-channel.mjs +0 -403
  190. package/esm/packages/herald/src/drivers/rabbitmq/rabbitmq-channel.mjs.map +0 -1
  191. package/esm/packages/herald/src/drivers/rabbitmq/rabbitmq-driver.mjs +0 -303
  192. package/esm/packages/herald/src/drivers/rabbitmq/rabbitmq-driver.mjs.map +0 -1
  193. package/esm/packages/herald/src/index.mjs +0 -16
  194. package/esm/packages/herald/src/message-managers/event-consumer.mjs +0 -76
  195. package/esm/packages/herald/src/message-managers/event-consumer.mjs.map +0 -1
  196. package/esm/packages/herald/src/message-managers/event-message.mjs +0 -85
  197. package/esm/packages/herald/src/message-managers/event-message.mjs.map +0 -1
  198. package/esm/packages/herald/src/message-managers/index.mjs +0 -4
  199. package/esm/packages/herald/src/message-managers/prepare-consumer-subscription.mjs +0 -42
  200. package/esm/packages/herald/src/message-managers/prepare-consumer-subscription.mjs.map +0 -1
  201. package/esm/packages/herald/src/use-case-broadcast.mjs +0 -30
  202. package/esm/packages/herald/src/use-case-broadcast.mjs.map +0 -1
  203. package/esm/packages/herald/src/utils/connect-to-broker.mjs +0 -168
  204. package/esm/packages/herald/src/utils/connect-to-broker.mjs.map +0 -1
  205. package/esm/packages/herald/src/utils/index.mjs +0 -3
  206. package/esm/packages/seal/src/config.mjs +0 -15
  207. package/esm/packages/seal/src/config.mjs.map +0 -1
  208. package/esm/packages/seal/src/factory/index.mjs +0 -4
  209. package/esm/packages/seal/src/factory/validate.mjs +0 -42
  210. package/esm/packages/seal/src/factory/validate.mjs.map +0 -1
  211. package/esm/packages/seal/src/factory/validators.mjs +0 -139
  212. package/esm/packages/seal/src/factory/validators.mjs.map +0 -1
  213. package/esm/packages/seal/src/helpers/date-helpers.mjs +0 -24
  214. package/esm/packages/seal/src/helpers/date-helpers.mjs.map +0 -1
  215. package/esm/packages/seal/src/helpers/get-field-value.mjs +0 -46
  216. package/esm/packages/seal/src/helpers/get-field-value.mjs.map +0 -1
  217. package/esm/packages/seal/src/helpers/index.mjs +0 -6
  218. package/esm/packages/seal/src/helpers/is-empty-value.mjs +0 -10
  219. package/esm/packages/seal/src/helpers/is-empty-value.mjs.map +0 -1
  220. package/esm/packages/seal/src/helpers/path-helpers.mjs +0 -12
  221. package/esm/packages/seal/src/helpers/path-helpers.mjs.map +0 -1
  222. package/esm/packages/seal/src/helpers/validation-helpers.mjs +0 -78
  223. package/esm/packages/seal/src/helpers/validation-helpers.mjs.map +0 -1
  224. package/esm/packages/seal/src/index.mjs +0 -88
  225. package/esm/packages/seal/src/mutators/array-mutators.mjs +0 -32
  226. package/esm/packages/seal/src/mutators/array-mutators.mjs.map +0 -1
  227. package/esm/packages/seal/src/mutators/boolean-mutators.mjs +0 -40
  228. package/esm/packages/seal/src/mutators/boolean-mutators.mjs.map +0 -1
  229. package/esm/packages/seal/src/mutators/date-mutators.mjs +0 -94
  230. package/esm/packages/seal/src/mutators/date-mutators.mjs.map +0 -1
  231. package/esm/packages/seal/src/mutators/index.mjs +0 -9
  232. package/esm/packages/seal/src/mutators/number-mutators.mjs +0 -52
  233. package/esm/packages/seal/src/mutators/number-mutators.mjs.map +0 -1
  234. package/esm/packages/seal/src/mutators/object-mutators.mjs +0 -30
  235. package/esm/packages/seal/src/mutators/object-mutators.mjs.map +0 -1
  236. package/esm/packages/seal/src/mutators/scalar-mutators.mjs +0 -9
  237. package/esm/packages/seal/src/mutators/scalar-mutators.mjs.map +0 -1
  238. package/esm/packages/seal/src/mutators/string-mutators.mjs +0 -186
  239. package/esm/packages/seal/src/mutators/string-mutators.mjs.map +0 -1
  240. package/esm/packages/seal/src/object.mjs +0 -13
  241. package/esm/packages/seal/src/object.mjs.map +0 -1
  242. package/esm/packages/seal/src/rules/array/array-rules.mjs +0 -41
  243. package/esm/packages/seal/src/rules/array/array-rules.mjs.map +0 -1
  244. package/esm/packages/seal/src/rules/array/index.mjs +0 -3
  245. package/esm/packages/seal/src/rules/color/color-rules.mjs +0 -104
  246. package/esm/packages/seal/src/rules/color/color-rules.mjs.map +0 -1
  247. package/esm/packages/seal/src/rules/color/index.mjs +0 -3
  248. package/esm/packages/seal/src/rules/common/enum.mjs +0 -77
  249. package/esm/packages/seal/src/rules/common/enum.mjs.map +0 -1
  250. package/esm/packages/seal/src/rules/common/equals-field-rules.mjs +0 -42
  251. package/esm/packages/seal/src/rules/common/equals-field-rules.mjs.map +0 -1
  252. package/esm/packages/seal/src/rules/common/index.mjs +0 -8
  253. package/esm/packages/seal/src/rules/common/instanceof.mjs +0 -23
  254. package/esm/packages/seal/src/rules/common/instanceof.mjs.map +0 -1
  255. package/esm/packages/seal/src/rules/common/literal.mjs +0 -31
  256. package/esm/packages/seal/src/rules/common/literal.mjs.map +0 -1
  257. package/esm/packages/seal/src/rules/common/type-rules.mjs +0 -97
  258. package/esm/packages/seal/src/rules/common/type-rules.mjs.map +0 -1
  259. package/esm/packages/seal/src/rules/common/unknown-key.mjs +0 -25
  260. package/esm/packages/seal/src/rules/common/unknown-key.mjs.map +0 -1
  261. package/esm/packages/seal/src/rules/conditional/forbidden-if-rules.mjs +0 -116
  262. package/esm/packages/seal/src/rules/conditional/forbidden-if-rules.mjs.map +0 -1
  263. package/esm/packages/seal/src/rules/conditional/index.mjs +0 -12
  264. package/esm/packages/seal/src/rules/conditional/present-if-rules.mjs +0 -97
  265. package/esm/packages/seal/src/rules/conditional/present-if-rules.mjs.map +0 -1
  266. package/esm/packages/seal/src/rules/conditional/present-unless-rules.mjs +0 -30
  267. package/esm/packages/seal/src/rules/conditional/present-unless-rules.mjs.map +0 -1
  268. package/esm/packages/seal/src/rules/conditional/present-with-rules.mjs +0 -76
  269. package/esm/packages/seal/src/rules/conditional/present-with-rules.mjs.map +0 -1
  270. package/esm/packages/seal/src/rules/conditional/present-without-rules.mjs +0 -76
  271. package/esm/packages/seal/src/rules/conditional/present-without-rules.mjs.map +0 -1
  272. package/esm/packages/seal/src/rules/conditional/required-if-rules.mjs +0 -204
  273. package/esm/packages/seal/src/rules/conditional/required-if-rules.mjs.map +0 -1
  274. package/esm/packages/seal/src/rules/conditional/required-unless-rules.mjs +0 -31
  275. package/esm/packages/seal/src/rules/conditional/required-unless-rules.mjs.map +0 -1
  276. package/esm/packages/seal/src/rules/conditional/required-when-rule.mjs +0 -32
  277. package/esm/packages/seal/src/rules/conditional/required-when-rule.mjs.map +0 -1
  278. package/esm/packages/seal/src/rules/conditional/required-with-rules.mjs +0 -67
  279. package/esm/packages/seal/src/rules/conditional/required-with-rules.mjs.map +0 -1
  280. package/esm/packages/seal/src/rules/conditional/required-without-rules.mjs +0 -67
  281. package/esm/packages/seal/src/rules/conditional/required-without-rules.mjs.map +0 -1
  282. package/esm/packages/seal/src/rules/core/equal.mjs +0 -22
  283. package/esm/packages/seal/src/rules/core/equal.mjs.map +0 -1
  284. package/esm/packages/seal/src/rules/core/forbidden.mjs +0 -20
  285. package/esm/packages/seal/src/rules/core/forbidden.mjs.map +0 -1
  286. package/esm/packages/seal/src/rules/core/index.mjs +0 -7
  287. package/esm/packages/seal/src/rules/core/required.mjs +0 -36
  288. package/esm/packages/seal/src/rules/core/required.mjs.map +0 -1
  289. package/esm/packages/seal/src/rules/core/union.mjs +0 -78
  290. package/esm/packages/seal/src/rules/core/union.mjs.map +0 -1
  291. package/esm/packages/seal/src/rules/core/when.mjs +0 -37
  292. package/esm/packages/seal/src/rules/core/when.mjs.map +0 -1
  293. package/esm/packages/seal/src/rules/date/date-comparison-rules.mjs +0 -78
  294. package/esm/packages/seal/src/rules/date/date-comparison-rules.mjs.map +0 -1
  295. package/esm/packages/seal/src/rules/date/date-day-rules.mjs +0 -49
  296. package/esm/packages/seal/src/rules/date/date-day-rules.mjs.map +0 -1
  297. package/esm/packages/seal/src/rules/date/date-field-comparison-rules.mjs +0 -82
  298. package/esm/packages/seal/src/rules/date/date-field-comparison-rules.mjs.map +0 -1
  299. package/esm/packages/seal/src/rules/date/date-period-rules.mjs +0 -401
  300. package/esm/packages/seal/src/rules/date/date-period-rules.mjs.map +0 -1
  301. package/esm/packages/seal/src/rules/date/date-relative-rules.mjs +0 -55
  302. package/esm/packages/seal/src/rules/date/date-relative-rules.mjs.map +0 -1
  303. package/esm/packages/seal/src/rules/date/date-special-rules.mjs +0 -58
  304. package/esm/packages/seal/src/rules/date/date-special-rules.mjs.map +0 -1
  305. package/esm/packages/seal/src/rules/date/date.mjs +0 -235
  306. package/esm/packages/seal/src/rules/date/date.mjs.map +0 -1
  307. package/esm/packages/seal/src/rules/date/index.mjs +0 -9
  308. package/esm/packages/seal/src/rules/file/dimensions.mjs +0 -3
  309. package/esm/packages/seal/src/rules/file/file-size.mjs +0 -3
  310. package/esm/packages/seal/src/rules/file/index.mjs +0 -4
  311. package/esm/packages/seal/src/rules/index.mjs +0 -54
  312. package/esm/packages/seal/src/rules/length/index.mjs +0 -3
  313. package/esm/packages/seal/src/rules/length/length-rules.mjs +0 -98
  314. package/esm/packages/seal/src/rules/length/length-rules.mjs.map +0 -1
  315. package/esm/packages/seal/src/rules/number/index.mjs +0 -3
  316. package/esm/packages/seal/src/rules/number/number-rules.mjs +0 -197
  317. package/esm/packages/seal/src/rules/number/number-rules.mjs.map +0 -1
  318. package/esm/packages/seal/src/rules/scalar/accepted-rule.mjs +0 -123
  319. package/esm/packages/seal/src/rules/scalar/accepted-rule.mjs.map +0 -1
  320. package/esm/packages/seal/src/rules/scalar/declined-rule.mjs +0 -123
  321. package/esm/packages/seal/src/rules/scalar/declined-rule.mjs.map +0 -1
  322. package/esm/packages/seal/src/rules/scalar/index.mjs +0 -4
  323. package/esm/packages/seal/src/rules/string/alpha.mjs +0 -41
  324. package/esm/packages/seal/src/rules/string/alpha.mjs.map +0 -1
  325. package/esm/packages/seal/src/rules/string/credit-card.mjs +0 -32
  326. package/esm/packages/seal/src/rules/string/credit-card.mjs.map +0 -1
  327. package/esm/packages/seal/src/rules/string/email.mjs +0 -20
  328. package/esm/packages/seal/src/rules/string/email.mjs.map +0 -1
  329. package/esm/packages/seal/src/rules/string/id-formats.mjs +0 -104
  330. package/esm/packages/seal/src/rules/string/id-formats.mjs.map +0 -1
  331. package/esm/packages/seal/src/rules/string/index.mjs +0 -13
  332. package/esm/packages/seal/src/rules/string/ip.mjs +0 -66
  333. package/esm/packages/seal/src/rules/string/ip.mjs.map +0 -1
  334. package/esm/packages/seal/src/rules/string/matches.mjs +0 -4
  335. package/esm/packages/seal/src/rules/string/pattern.mjs +0 -20
  336. package/esm/packages/seal/src/rules/string/pattern.mjs.map +0 -1
  337. package/esm/packages/seal/src/rules/string/string-comparison.mjs +0 -56
  338. package/esm/packages/seal/src/rules/string/string-comparison.mjs.map +0 -1
  339. package/esm/packages/seal/src/rules/string/strong-password-rule.mjs +0 -31
  340. package/esm/packages/seal/src/rules/string/strong-password-rule.mjs.map +0 -1
  341. package/esm/packages/seal/src/rules/string/url.mjs +0 -23
  342. package/esm/packages/seal/src/rules/string/url.mjs.map +0 -1
  343. package/esm/packages/seal/src/rules/string/without-whitespace.mjs +0 -19
  344. package/esm/packages/seal/src/rules/string/without-whitespace.mjs.map +0 -1
  345. package/esm/packages/seal/src/standard-schema/json-schema.mjs +0 -81
  346. package/esm/packages/seal/src/standard-schema/json-schema.mjs.map +0 -1
  347. package/esm/packages/seal/src/standard-schema/map-result.mjs +0 -26
  348. package/esm/packages/seal/src/standard-schema/map-result.mjs.map +0 -1
  349. package/esm/packages/seal/src/string.mjs +0 -13
  350. package/esm/packages/seal/src/string.mjs.map +0 -1
  351. package/esm/packages/seal/src/types/date-types.mjs +0 -17
  352. package/esm/packages/seal/src/types/date-types.mjs.map +0 -1
  353. package/esm/packages/seal/src/validators/any-validator.mjs +0 -38
  354. package/esm/packages/seal/src/validators/any-validator.mjs.map +0 -1
  355. package/esm/packages/seal/src/validators/array-validator.mjs +0 -186
  356. package/esm/packages/seal/src/validators/array-validator.mjs.map +0 -1
  357. package/esm/packages/seal/src/validators/base-validator.mjs +0 -750
  358. package/esm/packages/seal/src/validators/base-validator.mjs.map +0 -1
  359. package/esm/packages/seal/src/validators/boolean-validator.mjs +0 -175
  360. package/esm/packages/seal/src/validators/boolean-validator.mjs.map +0 -1
  361. package/esm/packages/seal/src/validators/computed-validator.mjs +0 -118
  362. package/esm/packages/seal/src/validators/computed-validator.mjs.map +0 -1
  363. package/esm/packages/seal/src/validators/date-validator.mjs +0 -640
  364. package/esm/packages/seal/src/validators/date-validator.mjs.map +0 -1
  365. package/esm/packages/seal/src/validators/discriminated-union-validator.mjs +0 -138
  366. package/esm/packages/seal/src/validators/discriminated-union-validator.mjs.map +0 -1
  367. package/esm/packages/seal/src/validators/float-validator.mjs +0 -18
  368. package/esm/packages/seal/src/validators/float-validator.mjs.map +0 -1
  369. package/esm/packages/seal/src/validators/index.mjs +0 -28
  370. package/esm/packages/seal/src/validators/instanceof-validator.mjs +0 -64
  371. package/esm/packages/seal/src/validators/instanceof-validator.mjs.map +0 -1
  372. package/esm/packages/seal/src/validators/int-validator.mjs +0 -30
  373. package/esm/packages/seal/src/validators/int-validator.mjs.map +0 -1
  374. package/esm/packages/seal/src/validators/lazy-validator.mjs +0 -87
  375. package/esm/packages/seal/src/validators/lazy-validator.mjs.map +0 -1
  376. package/esm/packages/seal/src/validators/literal-validator.mjs +0 -72
  377. package/esm/packages/seal/src/validators/literal-validator.mjs.map +0 -1
  378. package/esm/packages/seal/src/validators/managed-validator.mjs +0 -39
  379. package/esm/packages/seal/src/validators/managed-validator.mjs.map +0 -1
  380. package/esm/packages/seal/src/validators/methods/equality-conditional-methods.mjs +0 -129
  381. package/esm/packages/seal/src/validators/methods/equality-conditional-methods.mjs.map +0 -1
  382. package/esm/packages/seal/src/validators/methods/forbidden-methods.mjs +0 -131
  383. package/esm/packages/seal/src/validators/methods/forbidden-methods.mjs.map +0 -1
  384. package/esm/packages/seal/src/validators/methods/present-methods.mjs +0 -235
  385. package/esm/packages/seal/src/validators/methods/present-methods.mjs.map +0 -1
  386. package/esm/packages/seal/src/validators/methods/required-methods.mjs +0 -347
  387. package/esm/packages/seal/src/validators/methods/required-methods.mjs.map +0 -1
  388. package/esm/packages/seal/src/validators/number-validator.mjs +0 -331
  389. package/esm/packages/seal/src/validators/number-validator.mjs.map +0 -1
  390. package/esm/packages/seal/src/validators/numeric-validator.mjs +0 -27
  391. package/esm/packages/seal/src/validators/numeric-validator.mjs.map +0 -1
  392. package/esm/packages/seal/src/validators/object-validator.mjs +0 -447
  393. package/esm/packages/seal/src/validators/object-validator.mjs.map +0 -1
  394. package/esm/packages/seal/src/validators/primitive-validator.mjs +0 -88
  395. package/esm/packages/seal/src/validators/primitive-validator.mjs.map +0 -1
  396. package/esm/packages/seal/src/validators/record-validator.mjs +0 -112
  397. package/esm/packages/seal/src/validators/record-validator.mjs.map +0 -1
  398. package/esm/packages/seal/src/validators/scalar-validator.mjs +0 -173
  399. package/esm/packages/seal/src/validators/scalar-validator.mjs.map +0 -1
  400. package/esm/packages/seal/src/validators/string-validator.mjs +0 -459
  401. package/esm/packages/seal/src/validators/string-validator.mjs.map +0 -1
  402. package/esm/packages/seal/src/validators/tuple-validator.mjs +0 -134
  403. package/esm/packages/seal/src/validators/tuple-validator.mjs.map +0 -1
  404. package/esm/packages/seal/src/validators/union-validator.mjs +0 -68
  405. package/esm/packages/seal/src/validators/union-validator.mjs.map +0 -1
@@ -1,197 +0,0 @@
1
- import { get } from "../../../../../node_modules/.pnpm/@mongez_reinforcements@4.0.2/node_modules/@mongez/reinforcements/esm/object/get.mjs";
2
- import "../../../../../node_modules/.pnpm/@mongez_reinforcements@4.0.2/node_modules/@mongez/reinforcements/esm/index.mjs";
3
- import { VALID_RULE, invalidRule } from "../../helpers/validation-helpers.mjs";
4
- import "../../helpers/index.mjs";
5
-
6
- //#region ../../packages/seal/src/rules/number/number-rules.ts
7
- /**
8
- * Min rule - value must be equal or greater than minimum
9
- * Supports field names with sibling scope
10
- */
11
- const minRule = {
12
- name: "min",
13
- defaultErrorMessage: "The :input must be at least :min",
14
- async validate(value, context) {
15
- const { min, scope = "global" } = this.context.options;
16
- let compareMin;
17
- if (typeof min === "number") {
18
- compareMin = min;
19
- this.context.translationParams.min = min;
20
- } else {
21
- const fieldValue = get(scope === "sibling" ? context.parent : context.allValues, min);
22
- if (fieldValue === void 0) return VALID_RULE;
23
- this.context.translatableParams.min = min;
24
- compareMin = Number(fieldValue);
25
- if (isNaN(compareMin)) return VALID_RULE;
26
- }
27
- if (value >= compareMin) return VALID_RULE;
28
- return invalidRule(this, context);
29
- }
30
- };
31
- /**
32
- * Max rule - value must be equal or less than maximum
33
- * Supports field names with sibling scope
34
- */
35
- const maxRule = {
36
- name: "max",
37
- defaultErrorMessage: "The :input must equal to or less than :max",
38
- async validate(value, context) {
39
- const { max, scope = "global" } = this.context.options;
40
- let compareMax;
41
- if (typeof max === "number") {
42
- compareMax = max;
43
- this.context.translationParams.max = max;
44
- } else {
45
- const fieldValue = get(scope === "sibling" ? context.parent : context.allValues, max);
46
- if (fieldValue === void 0) return VALID_RULE;
47
- this.context.translatableParams.max = max;
48
- compareMax = Number(fieldValue);
49
- if (isNaN(compareMax)) return VALID_RULE;
50
- }
51
- if (value <= compareMax) return VALID_RULE;
52
- return invalidRule(this, context);
53
- }
54
- };
55
- /**
56
- * Greater than rule - value must be strictly greater than minimum
57
- * Supports field names with sibling scope
58
- */
59
- const greaterThanRule = {
60
- name: "greaterThan",
61
- defaultErrorMessage: "The :input must be greater than :value",
62
- async validate(value, context) {
63
- const { value: compareValue, scope = "global" } = this.context.options;
64
- let compareNumber;
65
- if (typeof compareValue === "number") {
66
- compareNumber = compareValue;
67
- this.context.translationParams.value = compareValue;
68
- } else {
69
- const fieldValue = get(scope === "sibling" ? context.parent : context.allValues, compareValue);
70
- if (fieldValue === void 0) return VALID_RULE;
71
- this.context.translatableParams.value = compareValue;
72
- compareNumber = Number(fieldValue);
73
- if (isNaN(compareNumber)) return VALID_RULE;
74
- }
75
- if (value > compareNumber) return VALID_RULE;
76
- return invalidRule(this, context);
77
- }
78
- };
79
- /**
80
- * Less than rule - value must be strictly less than maximum
81
- * Supports field names with sibling scope
82
- */
83
- const lessThanRule = {
84
- name: "lessThan",
85
- defaultErrorMessage: "The :input must be less than :value",
86
- async validate(value, context) {
87
- const { value: compareValue, scope = "global" } = this.context.options;
88
- let compareNumber;
89
- if (typeof compareValue === "number") {
90
- compareNumber = compareValue;
91
- this.context.translationParams.value = compareValue;
92
- } else {
93
- const fieldValue = get(scope === "sibling" ? context.parent : context.allValues, compareValue);
94
- if (fieldValue === void 0) return VALID_RULE;
95
- this.context.translatableParams.value = compareValue;
96
- compareNumber = Number(fieldValue);
97
- if (isNaN(compareNumber)) return VALID_RULE;
98
- }
99
- if (value < compareNumber) return VALID_RULE;
100
- return invalidRule(this, context);
101
- }
102
- };
103
- /**
104
- * Positive rule - value must be greater than 0
105
- */
106
- const positiveRule = {
107
- name: "positive",
108
- defaultErrorMessage: "The :input must be a positive number",
109
- async validate(value, context) {
110
- if (value > 0) return VALID_RULE;
111
- return invalidRule(this, context);
112
- }
113
- };
114
- /**
115
- * Negative rule - value must be less than 0
116
- */
117
- const negativeRule = {
118
- name: "negative",
119
- defaultErrorMessage: "The :input must be a negative number",
120
- async validate(value, context) {
121
- if (value < 0) return VALID_RULE;
122
- return invalidRule(this, context);
123
- }
124
- };
125
- /**
126
- * Odd rule - value must be an odd number
127
- */
128
- const oddRule = {
129
- name: "odd",
130
- defaultErrorMessage: "The :input must be an odd number",
131
- async validate(value, context) {
132
- if (value % 2 !== 0) return VALID_RULE;
133
- return invalidRule(this, context);
134
- }
135
- };
136
- /**
137
- * Even rule - value must be an even number
138
- */
139
- const evenRule = {
140
- name: "even",
141
- defaultErrorMessage: "The :input must be an even number",
142
- async validate(value, context) {
143
- if (value % 2 === 0) return VALID_RULE;
144
- return invalidRule(this, context);
145
- }
146
- };
147
- /**
148
- * Modulo rule - value must be divisible by given number
149
- */
150
- const moduloRule = {
151
- name: "modulo",
152
- defaultErrorMessage: "The :input must be divisible by :value",
153
- async validate(value, context) {
154
- if (value % this.context.options.value === 0) return VALID_RULE;
155
- this.context.translationParams.value = this.context.options.value;
156
- return invalidRule(this, context);
157
- }
158
- };
159
- /**
160
- * Between rule - value must be between the given two numbers (Inclusive)
161
- * Supports field names with sibling scope
162
- */
163
- const betweenNumbersRule = {
164
- name: "betweenNumbers",
165
- defaultErrorMessage: "The :input must be between :min and :max",
166
- async validate(value, context) {
167
- const { min, max, scope = "global" } = this.context.options;
168
- let compareMin;
169
- if (typeof min === "number") {
170
- compareMin = min;
171
- this.context.translationParams.min = min;
172
- } else {
173
- const fieldValue = get(scope === "sibling" ? context.parent : context.allValues, min);
174
- if (fieldValue === void 0) return VALID_RULE;
175
- this.context.translatableParams.min = min;
176
- compareMin = Number(fieldValue);
177
- if (isNaN(compareMin)) return VALID_RULE;
178
- }
179
- let compareMax;
180
- if (typeof max === "number") {
181
- compareMax = max;
182
- this.context.translationParams.max = max;
183
- } else {
184
- const fieldValue = get(scope === "sibling" ? context.parent : context.allValues, max);
185
- if (fieldValue === void 0) return VALID_RULE;
186
- this.context.translatableParams.max = max;
187
- compareMax = Number(fieldValue);
188
- if (isNaN(compareMax)) return VALID_RULE;
189
- }
190
- if (value >= compareMin && value <= compareMax) return VALID_RULE;
191
- return invalidRule(this, context);
192
- }
193
- };
194
-
195
- //#endregion
196
- export { betweenNumbersRule, evenRule, greaterThanRule, lessThanRule, maxRule, minRule, moduloRule, negativeRule, oddRule, positiveRule };
197
- //# sourceMappingURL=number-rules.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"number-rules.mjs","names":[],"sources":["../../../../../../../../../../../../packages/seal/src/rules/number/number-rules.ts"],"sourcesContent":["import { get } from \"@mongez/reinforcements\";\nimport { invalidRule, VALID_RULE } from \"../../helpers\";\nimport type { SchemaRule } from \"../../types\";\n\n/**\n * Min rule - value must be equal or greater than minimum\n * Supports field names with sibling scope\n */\nexport const minRule: SchemaRule<{\n min: number | string;\n scope?: \"global\" | \"sibling\";\n}> = {\n name: \"min\",\n defaultErrorMessage: \"The :input must be at least :min\",\n async validate(value: any, context) {\n const { min, scope = \"global\" } = this.context.options;\n let compareMin: number;\n\n if (typeof min === \"number\") {\n compareMin = min;\n this.context.translationParams.min = min;\n } else {\n const source = scope === \"sibling\" ? context.parent : context.allValues;\n const fieldValue = get(source, min);\n\n if (fieldValue === undefined) {\n return VALID_RULE;\n }\n\n this.context.translatableParams.min = min;\n\n compareMin = Number(fieldValue);\n\n if (isNaN(compareMin)) {\n return VALID_RULE;\n }\n }\n\n if (value >= compareMin) {\n return VALID_RULE;\n }\n\n return invalidRule(this, context);\n },\n};\n\n/**\n * Max rule - value must be equal or less than maximum\n * Supports field names with sibling scope\n */\nexport const maxRule: SchemaRule<{\n max: number | string;\n scope?: \"global\" | \"sibling\";\n}> = {\n name: \"max\",\n defaultErrorMessage: \"The :input must equal to or less than :max\",\n async validate(value: any, context) {\n const { max, scope = \"global\" } = this.context.options;\n let compareMax: number;\n\n if (typeof max === \"number\") {\n compareMax = max;\n this.context.translationParams.max = max;\n } else {\n const source = scope === \"sibling\" ? context.parent : context.allValues;\n const fieldValue = get(source, max);\n\n if (fieldValue === undefined) {\n return VALID_RULE;\n }\n\n this.context.translatableParams.max = max;\n\n compareMax = Number(fieldValue);\n\n if (isNaN(compareMax)) {\n return VALID_RULE;\n }\n }\n\n if (value <= compareMax) {\n return VALID_RULE;\n }\n\n return invalidRule(this, context);\n },\n};\n\n/**\n * Greater than rule - value must be strictly greater than minimum\n * Supports field names with sibling scope\n */\nexport const greaterThanRule: SchemaRule<{\n value: number | string;\n scope?: \"global\" | \"sibling\";\n}> = {\n name: \"greaterThan\",\n defaultErrorMessage: \"The :input must be greater than :value\",\n async validate(value: any, context) {\n const { value: compareValue, scope = \"global\" } = this.context.options;\n let compareNumber: number;\n\n if (typeof compareValue === \"number\") {\n compareNumber = compareValue;\n this.context.translationParams.value = compareValue;\n } else {\n const source = scope === \"sibling\" ? context.parent : context.allValues;\n const fieldValue = get(source, compareValue);\n\n if (fieldValue === undefined) {\n return VALID_RULE;\n }\n\n this.context.translatableParams.value = compareValue;\n\n compareNumber = Number(fieldValue);\n\n if (isNaN(compareNumber)) {\n return VALID_RULE;\n }\n }\n\n if (value > compareNumber) {\n return VALID_RULE;\n }\n\n return invalidRule(this, context);\n },\n};\n\n/**\n * Less than rule - value must be strictly less than maximum\n * Supports field names with sibling scope\n */\nexport const lessThanRule: SchemaRule<{\n value: number | string;\n scope?: \"global\" | \"sibling\";\n}> = {\n name: \"lessThan\",\n defaultErrorMessage: \"The :input must be less than :value\",\n async validate(value: any, context) {\n const { value: compareValue, scope = \"global\" } = this.context.options;\n let compareNumber: number;\n\n if (typeof compareValue === \"number\") {\n compareNumber = compareValue;\n this.context.translationParams.value = compareValue;\n } else {\n const source = scope === \"sibling\" ? context.parent : context.allValues;\n const fieldValue = get(source, compareValue);\n\n if (fieldValue === undefined) {\n return VALID_RULE;\n }\n\n this.context.translatableParams.value = compareValue;\n\n compareNumber = Number(fieldValue);\n\n if (isNaN(compareNumber)) {\n return VALID_RULE;\n }\n }\n\n if (value < compareNumber) {\n return VALID_RULE;\n }\n\n return invalidRule(this, context);\n },\n};\n\n/**\n * Positive rule - value must be greater than 0\n */\nexport const positiveRule: SchemaRule = {\n name: \"positive\",\n defaultErrorMessage: \"The :input must be a positive number\",\n async validate(value: any, context) {\n if (value > 0) {\n return VALID_RULE;\n }\n\n return invalidRule(this, context);\n },\n};\n\n/**\n * Negative rule - value must be less than 0\n */\nexport const negativeRule: SchemaRule = {\n name: \"negative\",\n defaultErrorMessage: \"The :input must be a negative number\",\n async validate(value: any, context) {\n if (value < 0) {\n return VALID_RULE;\n }\n\n return invalidRule(this, context);\n },\n};\n\n/**\n * Odd rule - value must be an odd number\n */\nexport const oddRule: SchemaRule = {\n name: \"odd\",\n defaultErrorMessage: \"The :input must be an odd number\",\n async validate(value: any, context) {\n if (value % 2 !== 0) {\n return VALID_RULE;\n }\n\n return invalidRule(this, context);\n },\n};\n\n/**\n * Even rule - value must be an even number\n */\nexport const evenRule: SchemaRule = {\n name: \"even\",\n defaultErrorMessage: \"The :input must be an even number\",\n async validate(value: any, context) {\n if (value % 2 === 0) {\n return VALID_RULE;\n }\n\n return invalidRule(this, context);\n },\n};\n\n/**\n * Modulo rule - value must be divisible by given number\n */\nexport const moduloRule: SchemaRule<{ value: number }> = {\n name: \"modulo\",\n defaultErrorMessage: \"The :input must be divisible by :value\",\n async validate(value: any, context) {\n if (value % this.context.options.value === 0) {\n return VALID_RULE;\n }\n\n this.context.translationParams.value = this.context.options.value;\n\n return invalidRule(this, context);\n },\n};\n\n/**\n * Between rule - value must be between the given two numbers (Inclusive)\n * Supports field names with sibling scope\n */\nexport const betweenNumbersRule: SchemaRule<{\n min: number | string;\n max: number | string;\n scope?: \"global\" | \"sibling\";\n}> = {\n name: \"betweenNumbers\",\n defaultErrorMessage: \"The :input must be between :min and :max\",\n async validate(value: any, context) {\n const { min, max, scope = \"global\" } = this.context.options;\n\n // Extract min value\n let compareMin: number;\n if (typeof min === \"number\") {\n compareMin = min;\n this.context.translationParams.min = min;\n } else {\n const source = scope === \"sibling\" ? context.parent : context.allValues;\n const fieldValue = get(source, min);\n\n if (fieldValue === undefined) {\n return VALID_RULE;\n }\n\n this.context.translatableParams.min = min;\n\n compareMin = Number(fieldValue);\n if (isNaN(compareMin)) {\n return VALID_RULE;\n }\n }\n\n // Extract max value\n let compareMax: number;\n if (typeof max === \"number\") {\n compareMax = max;\n this.context.translationParams.max = max;\n } else {\n const source = scope === \"sibling\" ? context.parent : context.allValues;\n const fieldValue = get(source, max);\n\n if (fieldValue === undefined) {\n return VALID_RULE;\n }\n\n this.context.translatableParams.max = max;\n\n compareMax = Number(fieldValue);\n if (isNaN(compareMax)) {\n return VALID_RULE;\n }\n }\n\n if (value >= compareMin && value <= compareMax) {\n return VALID_RULE;\n }\n\n return invalidRule(this, context);\n },\n};\n"],"mappings":";;;;;;;;;;AAQA,MAAa,UAGR;CACH,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,MAAM,EAAE,KAAK,QAAQ,aAAa,KAAK,QAAQ;EAC/C,IAAI;EAEJ,IAAI,OAAO,QAAQ,UAAU;GAC3B,aAAa;GACb,KAAK,QAAQ,kBAAkB,MAAM;EACvC,OAAO;GAEL,MAAM,aAAa,IADJ,UAAU,YAAY,QAAQ,SAAS,QAAQ,WAC/B,GAAG;GAElC,IAAI,eAAe,QACjB,OAAO;GAGT,KAAK,QAAQ,mBAAmB,MAAM;GAEtC,aAAa,OAAO,UAAU;GAE9B,IAAI,MAAM,UAAU,GAClB,OAAO;EAEX;EAEA,IAAI,SAAS,YACX,OAAO;EAGT,OAAO,YAAY,MAAM,OAAO;CAClC;AACF;;;;;AAMA,MAAa,UAGR;CACH,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,MAAM,EAAE,KAAK,QAAQ,aAAa,KAAK,QAAQ;EAC/C,IAAI;EAEJ,IAAI,OAAO,QAAQ,UAAU;GAC3B,aAAa;GACb,KAAK,QAAQ,kBAAkB,MAAM;EACvC,OAAO;GAEL,MAAM,aAAa,IADJ,UAAU,YAAY,QAAQ,SAAS,QAAQ,WAC/B,GAAG;GAElC,IAAI,eAAe,QACjB,OAAO;GAGT,KAAK,QAAQ,mBAAmB,MAAM;GAEtC,aAAa,OAAO,UAAU;GAE9B,IAAI,MAAM,UAAU,GAClB,OAAO;EAEX;EAEA,IAAI,SAAS,YACX,OAAO;EAGT,OAAO,YAAY,MAAM,OAAO;CAClC;AACF;;;;;AAMA,MAAa,kBAGR;CACH,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,MAAM,EAAE,OAAO,cAAc,QAAQ,aAAa,KAAK,QAAQ;EAC/D,IAAI;EAEJ,IAAI,OAAO,iBAAiB,UAAU;GACpC,gBAAgB;GAChB,KAAK,QAAQ,kBAAkB,QAAQ;EACzC,OAAO;GAEL,MAAM,aAAa,IADJ,UAAU,YAAY,QAAQ,SAAS,QAAQ,WAC/B,YAAY;GAE3C,IAAI,eAAe,QACjB,OAAO;GAGT,KAAK,QAAQ,mBAAmB,QAAQ;GAExC,gBAAgB,OAAO,UAAU;GAEjC,IAAI,MAAM,aAAa,GACrB,OAAO;EAEX;EAEA,IAAI,QAAQ,eACV,OAAO;EAGT,OAAO,YAAY,MAAM,OAAO;CAClC;AACF;;;;;AAMA,MAAa,eAGR;CACH,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,MAAM,EAAE,OAAO,cAAc,QAAQ,aAAa,KAAK,QAAQ;EAC/D,IAAI;EAEJ,IAAI,OAAO,iBAAiB,UAAU;GACpC,gBAAgB;GAChB,KAAK,QAAQ,kBAAkB,QAAQ;EACzC,OAAO;GAEL,MAAM,aAAa,IADJ,UAAU,YAAY,QAAQ,SAAS,QAAQ,WAC/B,YAAY;GAE3C,IAAI,eAAe,QACjB,OAAO;GAGT,KAAK,QAAQ,mBAAmB,QAAQ;GAExC,gBAAgB,OAAO,UAAU;GAEjC,IAAI,MAAM,aAAa,GACrB,OAAO;EAEX;EAEA,IAAI,QAAQ,eACV,OAAO;EAGT,OAAO,YAAY,MAAM,OAAO;CAClC;AACF;;;;AAKA,MAAa,eAA2B;CACtC,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,IAAI,QAAQ,GACV,OAAO;EAGT,OAAO,YAAY,MAAM,OAAO;CAClC;AACF;;;;AAKA,MAAa,eAA2B;CACtC,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,IAAI,QAAQ,GACV,OAAO;EAGT,OAAO,YAAY,MAAM,OAAO;CAClC;AACF;;;;AAKA,MAAa,UAAsB;CACjC,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,IAAI,QAAQ,MAAM,GAChB,OAAO;EAGT,OAAO,YAAY,MAAM,OAAO;CAClC;AACF;;;;AAKA,MAAa,WAAuB;CAClC,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,IAAI,QAAQ,MAAM,GAChB,OAAO;EAGT,OAAO,YAAY,MAAM,OAAO;CAClC;AACF;;;;AAKA,MAAa,aAA4C;CACvD,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,IAAI,QAAQ,KAAK,QAAQ,QAAQ,UAAU,GACzC,OAAO;EAGT,KAAK,QAAQ,kBAAkB,QAAQ,KAAK,QAAQ,QAAQ;EAE5D,OAAO,YAAY,MAAM,OAAO;CAClC;AACF;;;;;AAMA,MAAa,qBAIR;CACH,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,MAAM,EAAE,KAAK,KAAK,QAAQ,aAAa,KAAK,QAAQ;EAGpD,IAAI;EACJ,IAAI,OAAO,QAAQ,UAAU;GAC3B,aAAa;GACb,KAAK,QAAQ,kBAAkB,MAAM;EACvC,OAAO;GAEL,MAAM,aAAa,IADJ,UAAU,YAAY,QAAQ,SAAS,QAAQ,WAC/B,GAAG;GAElC,IAAI,eAAe,QACjB,OAAO;GAGT,KAAK,QAAQ,mBAAmB,MAAM;GAEtC,aAAa,OAAO,UAAU;GAC9B,IAAI,MAAM,UAAU,GAClB,OAAO;EAEX;EAGA,IAAI;EACJ,IAAI,OAAO,QAAQ,UAAU;GAC3B,aAAa;GACb,KAAK,QAAQ,kBAAkB,MAAM;EACvC,OAAO;GAEL,MAAM,aAAa,IADJ,UAAU,YAAY,QAAQ,SAAS,QAAQ,WAC/B,GAAG;GAElC,IAAI,eAAe,QACjB,OAAO;GAGT,KAAK,QAAQ,mBAAmB,MAAM;GAEtC,aAAa,OAAO,UAAU;GAC9B,IAAI,MAAM,UAAU,GAClB,OAAO;EAEX;EAEA,IAAI,SAAS,cAAc,SAAS,YAClC,OAAO;EAGT,OAAO,YAAY,MAAM,OAAO;CAClC;AACF"}
@@ -1,123 +0,0 @@
1
- import { VALID_RULE, invalidRule } from "../../helpers/validation-helpers.mjs";
2
- import { isEmptyValue } from "../../helpers/is-empty-value.mjs";
3
- import { getFieldValue } from "../../helpers/get-field-value.mjs";
4
- import "../../helpers/index.mjs";
5
-
6
- //#region ../../packages/seal/src/rules/scalar/accepted-rule.ts
7
- /**
8
- * The full set of values treated as "accepted" by `acceptedRule` and its
9
- * conditional variants. Shared with `formBooleanMutator` (see
10
- * `../../mutators/boolean-mutators`) so `v.boolean().accepted()` recognizes
11
- * exactly this list — single source of truth, no duplicated literals.
12
- */
13
- const ACCEPTED_VALUES = [
14
- "1",
15
- "true",
16
- "yes",
17
- "y",
18
- "on",
19
- 1,
20
- true,
21
- "Yes",
22
- "Y",
23
- "On"
24
- ];
25
- const isAcceptedValue = (value) => {
26
- return ACCEPTED_VALUES.includes(value);
27
- };
28
- /**
29
- * Validate value as accepted if it equals:
30
- * 1 | "1" | true | "true" | "yes" | "y" | "on"
31
- */
32
- const acceptedRule = {
33
- name: "accepted",
34
- defaultErrorMessage: "The :input must be accepted",
35
- description: "The value must be accepted if it equals: 1 | '1' | true | 'true' | 'yes' | 'y' | 'on' | 1 | true | 'Yes' | 'Y' | 'On'",
36
- async validate(value, context) {
37
- if (isAcceptedValue(value)) return VALID_RULE;
38
- return invalidRule(this, context);
39
- }
40
- };
41
- /**
42
- * Accepted value if another field's value equals to a specific value
43
- */
44
- const acceptedIfRule = {
45
- name: "acceptedIf",
46
- description: "The field must be accepted if :field's value equals to :value",
47
- defaultErrorMessage: "The :input must be accepted",
48
- async validate(value, context) {
49
- const fieldValue = getFieldValue(this, context);
50
- const { value: expectedValue } = this.context.options;
51
- this.context.translatableParams.field = this.context.options.field;
52
- this.context.translatableParams.value = this.context.options.value;
53
- if (fieldValue !== expectedValue) return invalidRule(this, context);
54
- if (!isAcceptedValue(value)) return invalidRule(this, context);
55
- return VALID_RULE;
56
- }
57
- };
58
- /**
59
- * Accepted if another field is not equal to the given value
60
- */
61
- const acceptedUnlessRule = {
62
- name: "acceptedUnless",
63
- description: "The field must be accepted if :field's value is not equal to :value",
64
- defaultErrorMessage: "The :input must be accepted",
65
- async validate(value, context) {
66
- const fieldValue = getFieldValue(this, context);
67
- const { value: expectedValue } = this.context.options;
68
- this.context.translatableParams.field = this.context.options.field;
69
- this.context.translatableParams.value = this.context.options.value;
70
- if (fieldValue === expectedValue) return invalidRule(this, context);
71
- if (!isAcceptedValue(value)) return invalidRule(this, context);
72
- return VALID_RULE;
73
- }
74
- };
75
- /**
76
- * Accepted if another field is required
77
- */
78
- const acceptedIfRequiredRule = {
79
- name: "acceptedIfRequired",
80
- description: "The field must be accepted if :field is required",
81
- defaultErrorMessage: "The :input must be accepted",
82
- async validate(value, context) {
83
- const fieldValue = getFieldValue(this, context);
84
- this.context.translatableParams.field = this.context.options.field;
85
- if (isEmptyValue(fieldValue)) return invalidRule(this, context);
86
- if (!isAcceptedValue(value)) return invalidRule(this, context);
87
- return VALID_RULE;
88
- }
89
- };
90
- /**
91
- * Accepted if another field is present
92
- */
93
- const acceptedIfPresentRule = {
94
- name: "acceptedIfPresent",
95
- description: "The field must be accepted if :field is present",
96
- defaultErrorMessage: "The :input must be accepted",
97
- async validate(value, context) {
98
- const fieldValue = getFieldValue(this, context);
99
- this.context.translatableParams.field = this.context.options.field;
100
- if (fieldValue === void 0) return invalidRule(this, context);
101
- if (!isAcceptedValue(value)) return invalidRule(this, context);
102
- return VALID_RULE;
103
- }
104
- };
105
- /**
106
- * Accepted if another field is missing
107
- */
108
- const acceptedWithoutRule = {
109
- name: "acceptedWithout",
110
- description: "The field must be accepted if :field is missing",
111
- defaultErrorMessage: "The :input must be accepted",
112
- async validate(value, context) {
113
- const fieldValue = getFieldValue(this, context);
114
- this.context.translatableParams.field = this.context.options.field;
115
- if (fieldValue !== void 0) return invalidRule(this, context);
116
- if (!isAcceptedValue(value)) return invalidRule(this, context);
117
- return VALID_RULE;
118
- }
119
- };
120
-
121
- //#endregion
122
- export { ACCEPTED_VALUES, acceptedIfPresentRule, acceptedIfRequiredRule, acceptedIfRule, acceptedRule, acceptedUnlessRule, acceptedWithoutRule };
123
- //# sourceMappingURL=accepted-rule.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"accepted-rule.mjs","names":[],"sources":["../../../../../../../../../../../../packages/seal/src/rules/scalar/accepted-rule.ts"],"sourcesContent":["import { getFieldValue, invalidRule, VALID_RULE } from \"../../helpers\";\nimport { isEmptyValue } from \"../../helpers/is-empty-value\";\nimport type { SchemaRule } from \"../../types\";\n\n/**\n * The full set of values treated as \"accepted\" by `acceptedRule` and its\n * conditional variants. Shared with `formBooleanMutator` (see\n * `../../mutators/boolean-mutators`) so `v.boolean().accepted()` recognizes\n * exactly this list — single source of truth, no duplicated literals.\n */\nexport const ACCEPTED_VALUES: readonly unknown[] = [\n \"1\",\n \"true\",\n \"yes\",\n \"y\",\n \"on\",\n 1,\n true,\n \"Yes\",\n \"Y\",\n \"On\",\n];\n\nconst isAcceptedValue = (value: any) => {\n return ACCEPTED_VALUES.includes(value);\n};\n\n/**\n * Validate value as accepted if it equals:\n * 1 | \"1\" | true | \"true\" | \"yes\" | \"y\" | \"on\"\n */\nexport const acceptedRule: SchemaRule = {\n name: \"accepted\",\n defaultErrorMessage: \"The :input must be accepted\",\n description:\n \"The value must be accepted if it equals: 1 | '1' | true | 'true' | 'yes' | 'y' | 'on' | 1 | true | 'Yes' | 'Y' | 'On'\",\n async validate(value: any, context) {\n if (isAcceptedValue(value)) {\n return VALID_RULE;\n }\n\n return invalidRule(this, context);\n },\n};\n\n/**\n * Accepted value if another field's value equals to a specific value\n */\nexport const acceptedIfRule: SchemaRule<{ field: string; value: any }> = {\n name: \"acceptedIf\",\n description: \"The field must be accepted if :field's value equals to :value\",\n defaultErrorMessage: \"The :input must be accepted\",\n async validate(value: any, context) {\n const fieldValue = getFieldValue(this, context);\n const { value: expectedValue } = this.context.options;\n\n this.context.translatableParams.field = this.context.options.field;\n this.context.translatableParams.value = this.context.options.value;\n if (fieldValue !== expectedValue) {\n return invalidRule(this, context);\n }\n\n if (!isAcceptedValue(value)) {\n return invalidRule(this, context);\n }\n\n return VALID_RULE;\n },\n};\n\n/**\n * Accepted if another field is not equal to the given value\n */\nexport const acceptedUnlessRule: SchemaRule<{ field: string; value: any }> = {\n name: \"acceptedUnless\",\n description: \"The field must be accepted if :field's value is not equal to :value\",\n defaultErrorMessage: \"The :input must be accepted\",\n async validate(value: any, context) {\n const fieldValue = getFieldValue(this, context);\n const { value: expectedValue } = this.context.options;\n\n this.context.translatableParams.field = this.context.options.field;\n this.context.translatableParams.value = this.context.options.value;\n\n if (fieldValue === expectedValue) {\n return invalidRule(this, context);\n }\n\n if (!isAcceptedValue(value)) {\n return invalidRule(this, context);\n }\n\n return VALID_RULE;\n },\n};\n\n/**\n * Accepted if another field is required\n */\nexport const acceptedIfRequiredRule: SchemaRule<{ field: string }> = {\n name: \"acceptedIfRequired\",\n description: \"The field must be accepted if :field is required\",\n defaultErrorMessage: \"The :input must be accepted\",\n async validate(value: any, context) {\n const fieldValue = getFieldValue(this, context);\n this.context.translatableParams.field = this.context.options.field;\n\n if (isEmptyValue(fieldValue)) {\n return invalidRule(this, context);\n }\n\n if (!isAcceptedValue(value)) {\n return invalidRule(this, context);\n }\n\n return VALID_RULE;\n },\n};\n\n/**\n * Accepted if another field is present\n */\nexport const acceptedIfPresentRule: SchemaRule<{ field: string }> = {\n name: \"acceptedIfPresent\",\n description: \"The field must be accepted if :field is present\",\n defaultErrorMessage: \"The :input must be accepted\",\n async validate(value: any, context) {\n const fieldValue = getFieldValue(this, context);\n this.context.translatableParams.field = this.context.options.field;\n\n if (fieldValue === undefined) {\n return invalidRule(this, context);\n }\n\n if (!isAcceptedValue(value)) {\n return invalidRule(this, context);\n }\n\n return VALID_RULE;\n },\n};\n\n/**\n * Accepted if another field is missing\n */\nexport const acceptedWithoutRule: SchemaRule<{ field: string }> = {\n name: \"acceptedWithout\",\n description: \"The field must be accepted if :field is missing\",\n defaultErrorMessage: \"The :input must be accepted\",\n async validate(value: any, context) {\n const fieldValue = getFieldValue(this, context);\n this.context.translatableParams.field = this.context.options.field;\n\n if (fieldValue !== undefined) {\n return invalidRule(this, context);\n }\n\n if (!isAcceptedValue(value)) {\n return invalidRule(this, context);\n }\n\n return VALID_RULE;\n },\n};\n"],"mappings":";;;;;;;;;;;;AAUA,MAAa,kBAAsC;CACjD;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAEA,MAAM,mBAAmB,UAAe;CACtC,OAAO,gBAAgB,SAAS,KAAK;AACvC;;;;;AAMA,MAAa,eAA2B;CACtC,MAAM;CACN,qBAAqB;CACrB,aACE;CACF,MAAM,SAAS,OAAY,SAAS;EAClC,IAAI,gBAAgB,KAAK,GACvB,OAAO;EAGT,OAAO,YAAY,MAAM,OAAO;CAClC;AACF;;;;AAKA,MAAa,iBAA4D;CACvE,MAAM;CACN,aAAa;CACb,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,MAAM,aAAa,cAAc,MAAM,OAAO;EAC9C,MAAM,EAAE,OAAO,kBAAkB,KAAK,QAAQ;EAE9C,KAAK,QAAQ,mBAAmB,QAAQ,KAAK,QAAQ,QAAQ;EAC7D,KAAK,QAAQ,mBAAmB,QAAQ,KAAK,QAAQ,QAAQ;EAC7D,IAAI,eAAe,eACjB,OAAO,YAAY,MAAM,OAAO;EAGlC,IAAI,CAAC,gBAAgB,KAAK,GACxB,OAAO,YAAY,MAAM,OAAO;EAGlC,OAAO;CACT;AACF;;;;AAKA,MAAa,qBAAgE;CAC3E,MAAM;CACN,aAAa;CACb,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,MAAM,aAAa,cAAc,MAAM,OAAO;EAC9C,MAAM,EAAE,OAAO,kBAAkB,KAAK,QAAQ;EAE9C,KAAK,QAAQ,mBAAmB,QAAQ,KAAK,QAAQ,QAAQ;EAC7D,KAAK,QAAQ,mBAAmB,QAAQ,KAAK,QAAQ,QAAQ;EAE7D,IAAI,eAAe,eACjB,OAAO,YAAY,MAAM,OAAO;EAGlC,IAAI,CAAC,gBAAgB,KAAK,GACxB,OAAO,YAAY,MAAM,OAAO;EAGlC,OAAO;CACT;AACF;;;;AAKA,MAAa,yBAAwD;CACnE,MAAM;CACN,aAAa;CACb,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,MAAM,aAAa,cAAc,MAAM,OAAO;EAC9C,KAAK,QAAQ,mBAAmB,QAAQ,KAAK,QAAQ,QAAQ;EAE7D,IAAI,aAAa,UAAU,GACzB,OAAO,YAAY,MAAM,OAAO;EAGlC,IAAI,CAAC,gBAAgB,KAAK,GACxB,OAAO,YAAY,MAAM,OAAO;EAGlC,OAAO;CACT;AACF;;;;AAKA,MAAa,wBAAuD;CAClE,MAAM;CACN,aAAa;CACb,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,MAAM,aAAa,cAAc,MAAM,OAAO;EAC9C,KAAK,QAAQ,mBAAmB,QAAQ,KAAK,QAAQ,QAAQ;EAE7D,IAAI,eAAe,QACjB,OAAO,YAAY,MAAM,OAAO;EAGlC,IAAI,CAAC,gBAAgB,KAAK,GACxB,OAAO,YAAY,MAAM,OAAO;EAGlC,OAAO;CACT;AACF;;;;AAKA,MAAa,sBAAqD;CAChE,MAAM;CACN,aAAa;CACb,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,MAAM,aAAa,cAAc,MAAM,OAAO;EAC9C,KAAK,QAAQ,mBAAmB,QAAQ,KAAK,QAAQ,QAAQ;EAE7D,IAAI,eAAe,QACjB,OAAO,YAAY,MAAM,OAAO;EAGlC,IAAI,CAAC,gBAAgB,KAAK,GACxB,OAAO,YAAY,MAAM,OAAO;EAGlC,OAAO;CACT;AACF"}
@@ -1,123 +0,0 @@
1
- import { VALID_RULE, invalidRule } from "../../helpers/validation-helpers.mjs";
2
- import { isEmptyValue } from "../../helpers/is-empty-value.mjs";
3
- import { getFieldValue } from "../../helpers/get-field-value.mjs";
4
- import "../../helpers/index.mjs";
5
-
6
- //#region ../../packages/seal/src/rules/scalar/declined-rule.ts
7
- /**
8
- * The full set of values treated as "declined" by `declinedRule` and its
9
- * conditional variants. Shared with `formBooleanMutator` (see
10
- * `../../mutators/boolean-mutators`) so `v.boolean().declined()` recognizes
11
- * exactly this list — single source of truth, no duplicated literals.
12
- */
13
- const DECLINED_VALUES = [
14
- "0",
15
- "false",
16
- "no",
17
- "n",
18
- "off",
19
- 0,
20
- false,
21
- "No",
22
- "N",
23
- "Off"
24
- ];
25
- const isDeclinedValue = (value) => {
26
- return DECLINED_VALUES.includes(value);
27
- };
28
- /**
29
- * Validate value as declined if it equals:
30
- * 0 | "0" | false | "false" | "no" | "n" | "off" | 0 | false | "No" | "N" | "Off"
31
- */
32
- const declinedRule = {
33
- name: "declined",
34
- defaultErrorMessage: "The :input must be declined",
35
- description: "The value must be declined if it equals: 0 | '0' | false | 'false' | 'no' | 'n' | 'off' | 0 | false | 'No' | 'N' | 'Off'",
36
- async validate(value, context) {
37
- if (isDeclinedValue(value)) return VALID_RULE;
38
- return invalidRule(this, context);
39
- }
40
- };
41
- /**
42
- * Declined value if another field's value equals to a specific value
43
- */
44
- const declinedIfRule = {
45
- name: "declinedIf",
46
- description: "The field must be declined if :field's value equals to :value",
47
- defaultErrorMessage: "The :input must be declined",
48
- async validate(value, context) {
49
- const fieldValue = getFieldValue(this, context);
50
- const { value: expectedValue } = this.context.options;
51
- this.context.translatableParams.field = this.context.options.field;
52
- this.context.translatableParams.value = this.context.options.value;
53
- if (fieldValue !== expectedValue) return invalidRule(this, context);
54
- if (!isDeclinedValue(value)) return invalidRule(this, context);
55
- return VALID_RULE;
56
- }
57
- };
58
- /**
59
- * Declined if another field is not equal to the given value
60
- */
61
- const declinedUnlessRule = {
62
- name: "declinedUnless",
63
- description: "The field must be declined if :field's value is not equal to :value",
64
- defaultErrorMessage: "The :input must be declined",
65
- async validate(value, context) {
66
- const fieldValue = getFieldValue(this, context);
67
- const { value: expectedValue } = this.context.options;
68
- this.context.translatableParams.field = this.context.options.field;
69
- this.context.translatableParams.value = this.context.options.value;
70
- if (fieldValue === expectedValue) return invalidRule(this, context);
71
- if (!isDeclinedValue(value)) return invalidRule(this, context);
72
- return VALID_RULE;
73
- }
74
- };
75
- /**
76
- * Declined if another field is required
77
- */
78
- const declinedIfRequiredRule = {
79
- name: "declinedIfRequired",
80
- description: "The field must be declined if :field is required",
81
- defaultErrorMessage: "The :input must be declined",
82
- async validate(value, context) {
83
- const fieldValue = getFieldValue(this, context);
84
- this.context.translatableParams.field = this.context.options.field;
85
- if (isEmptyValue(fieldValue)) return invalidRule(this, context);
86
- if (!isDeclinedValue(value)) return invalidRule(this, context);
87
- return VALID_RULE;
88
- }
89
- };
90
- /**
91
- * Declined if another field is present
92
- */
93
- const declinedIfPresentRule = {
94
- name: "declinedIfPresent",
95
- description: "The field must be declined if :field is present",
96
- defaultErrorMessage: "The :input must be declined",
97
- async validate(value, context) {
98
- const fieldValue = getFieldValue(this, context);
99
- this.context.translatableParams.field = this.context.options.field;
100
- if (fieldValue === void 0) return invalidRule(this, context);
101
- if (!isDeclinedValue(value)) return invalidRule(this, context);
102
- return VALID_RULE;
103
- }
104
- };
105
- /**
106
- * Declined if another field is missing
107
- */
108
- const declinedWithoutRule = {
109
- name: "declinedWithout",
110
- description: "The field must be declined if :field is missing",
111
- defaultErrorMessage: "The :input must be declined",
112
- async validate(value, context) {
113
- const fieldValue = getFieldValue(this, context);
114
- this.context.translatableParams.field = this.context.options.field;
115
- if (fieldValue !== void 0) return invalidRule(this, context);
116
- if (!isDeclinedValue(value)) return invalidRule(this, context);
117
- return VALID_RULE;
118
- }
119
- };
120
-
121
- //#endregion
122
- export { DECLINED_VALUES, declinedIfPresentRule, declinedIfRequiredRule, declinedIfRule, declinedRule, declinedUnlessRule, declinedWithoutRule };
123
- //# sourceMappingURL=declined-rule.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"declined-rule.mjs","names":[],"sources":["../../../../../../../../../../../../packages/seal/src/rules/scalar/declined-rule.ts"],"sourcesContent":["import { getFieldValue, invalidRule, VALID_RULE } from \"../../helpers\";\nimport { isEmptyValue } from \"../../helpers/is-empty-value\";\nimport type { SchemaRule } from \"../../types\";\n\n/**\n * The full set of values treated as \"declined\" by `declinedRule` and its\n * conditional variants. Shared with `formBooleanMutator` (see\n * `../../mutators/boolean-mutators`) so `v.boolean().declined()` recognizes\n * exactly this list — single source of truth, no duplicated literals.\n */\nexport const DECLINED_VALUES: readonly unknown[] = [\n \"0\",\n \"false\",\n \"no\",\n \"n\",\n \"off\",\n 0,\n false,\n \"No\",\n \"N\",\n \"Off\",\n];\n\nconst isDeclinedValue = (value: any) => {\n return DECLINED_VALUES.includes(value);\n};\n\n/**\n * Validate value as declined if it equals:\n * 0 | \"0\" | false | \"false\" | \"no\" | \"n\" | \"off\" | 0 | false | \"No\" | \"N\" | \"Off\"\n */\nexport const declinedRule: SchemaRule = {\n name: \"declined\",\n defaultErrorMessage: \"The :input must be declined\",\n description:\n \"The value must be declined if it equals: 0 | '0' | false | 'false' | 'no' | 'n' | 'off' | 0 | false | 'No' | 'N' | 'Off'\",\n async validate(value: any, context) {\n if (isDeclinedValue(value)) {\n return VALID_RULE;\n }\n\n return invalidRule(this, context);\n },\n};\n\n/**\n * Declined value if another field's value equals to a specific value\n */\nexport const declinedIfRule: SchemaRule<{ field: string; value: any }> = {\n name: \"declinedIf\",\n description: \"The field must be declined if :field's value equals to :value\",\n defaultErrorMessage: \"The :input must be declined\",\n async validate(value: any, context) {\n const fieldValue = getFieldValue(this, context);\n const { value: expectedValue } = this.context.options;\n\n this.context.translatableParams.field = this.context.options.field;\n this.context.translatableParams.value = this.context.options.value;\n\n if (fieldValue !== expectedValue) {\n return invalidRule(this, context);\n }\n\n if (!isDeclinedValue(value)) {\n return invalidRule(this, context);\n }\n\n return VALID_RULE;\n },\n};\n\n/**\n * Declined if another field is not equal to the given value\n */\nexport const declinedUnlessRule: SchemaRule<{ field: string; value: any }> = {\n name: \"declinedUnless\",\n description: \"The field must be declined if :field's value is not equal to :value\",\n defaultErrorMessage: \"The :input must be declined\",\n async validate(value: any, context) {\n const fieldValue = getFieldValue(this, context);\n const { value: expectedValue } = this.context.options;\n\n this.context.translatableParams.field = this.context.options.field;\n this.context.translatableParams.value = this.context.options.value;\n if (fieldValue === expectedValue) {\n return invalidRule(this, context);\n }\n\n if (!isDeclinedValue(value)) {\n return invalidRule(this, context);\n }\n\n return VALID_RULE;\n },\n};\n\n/**\n * Declined if another field is required\n */\nexport const declinedIfRequiredRule: SchemaRule<{ field: string }> = {\n name: \"declinedIfRequired\",\n description: \"The field must be declined if :field is required\",\n defaultErrorMessage: \"The :input must be declined\",\n async validate(value: any, context) {\n const fieldValue = getFieldValue(this, context);\n this.context.translatableParams.field = this.context.options.field;\n\n if (isEmptyValue(fieldValue)) {\n return invalidRule(this, context);\n }\n\n if (!isDeclinedValue(value)) {\n return invalidRule(this, context);\n }\n\n return VALID_RULE;\n },\n};\n\n/**\n * Declined if another field is present\n */\nexport const declinedIfPresentRule: SchemaRule<{ field: string }> = {\n name: \"declinedIfPresent\",\n description: \"The field must be declined if :field is present\",\n defaultErrorMessage: \"The :input must be declined\",\n async validate(value: any, context) {\n const fieldValue = getFieldValue(this, context);\n this.context.translatableParams.field = this.context.options.field;\n\n if (fieldValue === undefined) {\n return invalidRule(this, context);\n }\n\n if (!isDeclinedValue(value)) {\n return invalidRule(this, context);\n }\n\n return VALID_RULE;\n },\n};\n\n/**\n * Declined if another field is missing\n */\nexport const declinedWithoutRule: SchemaRule<{ field: string }> = {\n name: \"declinedWithout\",\n description: \"The field must be declined if :field is missing\",\n defaultErrorMessage: \"The :input must be declined\",\n async validate(value: any, context) {\n const fieldValue = getFieldValue(this, context);\n this.context.translatableParams.field = this.context.options.field;\n\n if (fieldValue !== undefined) {\n return invalidRule(this, context);\n }\n\n if (!isDeclinedValue(value)) {\n return invalidRule(this, context);\n }\n\n return VALID_RULE;\n },\n};\n"],"mappings":";;;;;;;;;;;;AAUA,MAAa,kBAAsC;CACjD;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAEA,MAAM,mBAAmB,UAAe;CACtC,OAAO,gBAAgB,SAAS,KAAK;AACvC;;;;;AAMA,MAAa,eAA2B;CACtC,MAAM;CACN,qBAAqB;CACrB,aACE;CACF,MAAM,SAAS,OAAY,SAAS;EAClC,IAAI,gBAAgB,KAAK,GACvB,OAAO;EAGT,OAAO,YAAY,MAAM,OAAO;CAClC;AACF;;;;AAKA,MAAa,iBAA4D;CACvE,MAAM;CACN,aAAa;CACb,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,MAAM,aAAa,cAAc,MAAM,OAAO;EAC9C,MAAM,EAAE,OAAO,kBAAkB,KAAK,QAAQ;EAE9C,KAAK,QAAQ,mBAAmB,QAAQ,KAAK,QAAQ,QAAQ;EAC7D,KAAK,QAAQ,mBAAmB,QAAQ,KAAK,QAAQ,QAAQ;EAE7D,IAAI,eAAe,eACjB,OAAO,YAAY,MAAM,OAAO;EAGlC,IAAI,CAAC,gBAAgB,KAAK,GACxB,OAAO,YAAY,MAAM,OAAO;EAGlC,OAAO;CACT;AACF;;;;AAKA,MAAa,qBAAgE;CAC3E,MAAM;CACN,aAAa;CACb,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,MAAM,aAAa,cAAc,MAAM,OAAO;EAC9C,MAAM,EAAE,OAAO,kBAAkB,KAAK,QAAQ;EAE9C,KAAK,QAAQ,mBAAmB,QAAQ,KAAK,QAAQ,QAAQ;EAC7D,KAAK,QAAQ,mBAAmB,QAAQ,KAAK,QAAQ,QAAQ;EAC7D,IAAI,eAAe,eACjB,OAAO,YAAY,MAAM,OAAO;EAGlC,IAAI,CAAC,gBAAgB,KAAK,GACxB,OAAO,YAAY,MAAM,OAAO;EAGlC,OAAO;CACT;AACF;;;;AAKA,MAAa,yBAAwD;CACnE,MAAM;CACN,aAAa;CACb,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,MAAM,aAAa,cAAc,MAAM,OAAO;EAC9C,KAAK,QAAQ,mBAAmB,QAAQ,KAAK,QAAQ,QAAQ;EAE7D,IAAI,aAAa,UAAU,GACzB,OAAO,YAAY,MAAM,OAAO;EAGlC,IAAI,CAAC,gBAAgB,KAAK,GACxB,OAAO,YAAY,MAAM,OAAO;EAGlC,OAAO;CACT;AACF;;;;AAKA,MAAa,wBAAuD;CAClE,MAAM;CACN,aAAa;CACb,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,MAAM,aAAa,cAAc,MAAM,OAAO;EAC9C,KAAK,QAAQ,mBAAmB,QAAQ,KAAK,QAAQ,QAAQ;EAE7D,IAAI,eAAe,QACjB,OAAO,YAAY,MAAM,OAAO;EAGlC,IAAI,CAAC,gBAAgB,KAAK,GACxB,OAAO,YAAY,MAAM,OAAO;EAGlC,OAAO;CACT;AACF;;;;AAKA,MAAa,sBAAqD;CAChE,MAAM;CACN,aAAa;CACb,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,MAAM,aAAa,cAAc,MAAM,OAAO;EAC9C,KAAK,QAAQ,mBAAmB,QAAQ,KAAK,QAAQ,QAAQ;EAE7D,IAAI,eAAe,QACjB,OAAO,YAAY,MAAM,OAAO;EAGlC,IAAI,CAAC,gBAAgB,KAAK,GACxB,OAAO,YAAY,MAAM,OAAO;EAGlC,OAAO;CACT;AACF"}
@@ -1,4 +0,0 @@
1
- import { ACCEPTED_VALUES, acceptedIfPresentRule, acceptedIfRequiredRule, acceptedIfRule, acceptedRule, acceptedUnlessRule, acceptedWithoutRule } from "./accepted-rule.mjs";
2
- import { DECLINED_VALUES, declinedIfPresentRule, declinedIfRequiredRule, declinedIfRule, declinedRule, declinedUnlessRule, declinedWithoutRule } from "./declined-rule.mjs";
3
-
4
- export { };
@@ -1,41 +0,0 @@
1
- import { VALID_RULE, invalidRule } from "../../helpers/validation-helpers.mjs";
2
- import "../../helpers/index.mjs";
3
-
4
- //#region ../../packages/seal/src/rules/string/alpha.ts
5
- /**
6
- * Alpha rule - allows only alphabetic characters
7
- */
8
- const alphaRule = {
9
- name: "alpha",
10
- defaultErrorMessage: "The :input must contain only alphabetic characters",
11
- async validate(value, context) {
12
- if (/^[a-zA-Z]+$/.test(value)) return VALID_RULE;
13
- return invalidRule(this, context);
14
- }
15
- };
16
- /**
17
- * AlphaNumeric rule - allows only alphanumeric characters
18
- */
19
- const alphaNumericRule = {
20
- name: "alphaNumeric",
21
- defaultErrorMessage: "The :input must contain only alphanumeric characters",
22
- async validate(value, context) {
23
- if (/^[a-zA-Z0-9]+$/.test(value)) return VALID_RULE;
24
- return invalidRule(this, context);
25
- }
26
- };
27
- /**
28
- * Numeric string rule - allows only numeric characters
29
- */
30
- const isNumericRule = {
31
- name: "numeric",
32
- defaultErrorMessage: "The :input must contain only numeric characters",
33
- async validate(value, context) {
34
- if (/^[0-9]+$/.test(String(value))) return VALID_RULE;
35
- return invalidRule(this, context);
36
- }
37
- };
38
-
39
- //#endregion
40
- export { alphaNumericRule, alphaRule, isNumericRule };
41
- //# sourceMappingURL=alpha.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"alpha.mjs","names":[],"sources":["../../../../../../../../../../../../packages/seal/src/rules/string/alpha.ts"],"sourcesContent":["import { invalidRule, VALID_RULE } from \"../../helpers\";\nimport type { SchemaRule } from \"../../types\";\n\n/**\n * Alpha rule - allows only alphabetic characters\n */\nexport const alphaRule: SchemaRule = {\n name: \"alpha\",\n defaultErrorMessage: \"The :input must contain only alphabetic characters\",\n async validate(value: any, context) {\n if (/^[a-zA-Z]+$/.test(value)) {\n return VALID_RULE;\n }\n return invalidRule(this, context);\n },\n};\n\n/**\n * AlphaNumeric rule - allows only alphanumeric characters\n */\nexport const alphaNumericRule: SchemaRule = {\n name: \"alphaNumeric\",\n defaultErrorMessage: \"The :input must contain only alphanumeric characters\",\n async validate(value: any, context) {\n if (/^[a-zA-Z0-9]+$/.test(value)) {\n return VALID_RULE;\n }\n return invalidRule(this, context);\n },\n};\n\n/**\n * Numeric string rule - allows only numeric characters\n */\nexport const isNumericRule: SchemaRule = {\n name: \"numeric\",\n defaultErrorMessage: \"The :input must contain only numeric characters\",\n async validate(value: any, context) {\n if (/^[0-9]+$/.test(String(value))) {\n return VALID_RULE;\n }\n return invalidRule(this, context);\n },\n};\n"],"mappings":";;;;;;;AAMA,MAAa,YAAwB;CACnC,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,IAAI,cAAc,KAAK,KAAK,GAC1B,OAAO;EAET,OAAO,YAAY,MAAM,OAAO;CAClC;AACF;;;;AAKA,MAAa,mBAA+B;CAC1C,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,IAAI,iBAAiB,KAAK,KAAK,GAC7B,OAAO;EAET,OAAO,YAAY,MAAM,OAAO;CAClC;AACF;;;;AAKA,MAAa,gBAA4B;CACvC,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,IAAI,WAAW,KAAK,OAAO,KAAK,CAAC,GAC/B,OAAO;EAET,OAAO,YAAY,MAAM,OAAO;CAClC;AACF"}
@@ -1,32 +0,0 @@
1
- import { VALID_RULE, invalidRule } from "../../helpers/validation-helpers.mjs";
2
- import "../../helpers/index.mjs";
3
-
4
- //#region ../../packages/seal/src/rules/string/credit-card.ts
5
- /**
6
- * Credit card rule - validates credit card number
7
- */
8
- const isCreditCardRule = {
9
- name: "creditCard",
10
- defaultErrorMessage: "The :input must be a valid credit card number",
11
- async validate(value, context) {
12
- const cardNumber = String(value).replace(/\s/g, "");
13
- if (!/^\d+$/.test(cardNumber)) return invalidRule(this, context);
14
- let sum = 0;
15
- let isEven = false;
16
- for (let i = cardNumber.length - 1; i >= 0; i--) {
17
- let digit = parseInt(cardNumber.charAt(i), 10);
18
- if (isEven) {
19
- digit *= 2;
20
- if (digit > 9) digit -= 9;
21
- }
22
- sum += digit;
23
- isEven = !isEven;
24
- }
25
- if (sum % 10 === 0) return VALID_RULE;
26
- return invalidRule(this, context);
27
- }
28
- };
29
-
30
- //#endregion
31
- export { isCreditCardRule };
32
- //# sourceMappingURL=credit-card.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"credit-card.mjs","names":[],"sources":["../../../../../../../../../../../../packages/seal/src/rules/string/credit-card.ts"],"sourcesContent":["import { invalidRule, VALID_RULE } from \"../../helpers\";\nimport type { SchemaRule } from \"../../types\";\n\n/**\n * Credit card rule - validates credit card number\n */\nexport const isCreditCardRule: SchemaRule = {\n name: \"creditCard\",\n defaultErrorMessage: \"The :input must be a valid credit card number\",\n async validate(value: any, context) {\n // Luhn algorithm for credit card validation\n const cardNumber = String(value).replace(/\\s/g, \"\");\n\n if (!/^\\d+$/.test(cardNumber)) {\n return invalidRule(this, context);\n }\n\n let sum = 0;\n let isEven = false;\n\n for (let i = cardNumber.length - 1; i >= 0; i--) {\n let digit = parseInt(cardNumber.charAt(i), 10);\n\n if (isEven) {\n digit *= 2;\n if (digit > 9) {\n digit -= 9;\n }\n }\n\n sum += digit;\n isEven = !isEven;\n }\n\n if (sum % 10 === 0) {\n return VALID_RULE;\n }\n\n return invalidRule(this, context);\n },\n};\n"],"mappings":";;;;;;;AAMA,MAAa,mBAA+B;CAC1C,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAElC,MAAM,aAAa,OAAO,KAAK,CAAC,CAAC,QAAQ,OAAO,EAAE;EAElD,IAAI,CAAC,QAAQ,KAAK,UAAU,GAC1B,OAAO,YAAY,MAAM,OAAO;EAGlC,IAAI,MAAM;EACV,IAAI,SAAS;EAEb,KAAK,IAAI,IAAI,WAAW,SAAS,GAAG,KAAK,GAAG,KAAK;GAC/C,IAAI,QAAQ,SAAS,WAAW,OAAO,CAAC,GAAG,EAAE;GAE7C,IAAI,QAAQ;IACV,SAAS;IACT,IAAI,QAAQ,GACV,SAAS;GAEb;GAEA,OAAO;GACP,SAAS,CAAC;EACZ;EAEA,IAAI,MAAM,OAAO,GACf,OAAO;EAGT,OAAO,YAAY,MAAM,OAAO;CAClC;AACF"}
@@ -1,20 +0,0 @@
1
- import { VALID_RULE, invalidRule } from "../../helpers/validation-helpers.mjs";
2
- import { isEmail } from "../../../../../node_modules/.pnpm/@mongez_supportive-is@3.0.0/node_modules/@mongez/supportive-is/esm/index.mjs";
3
- import "../../helpers/index.mjs";
4
-
5
- //#region ../../packages/seal/src/rules/string/email.ts
6
- /**
7
- * Email rule - validates email format
8
- */
9
- const emailRule = {
10
- name: "email",
11
- defaultErrorMessage: "The :input must be a valid email address",
12
- async validate(value, context) {
13
- if (isEmail(value)) return VALID_RULE;
14
- return invalidRule(this, context);
15
- }
16
- };
17
-
18
- //#endregion
19
- export { emailRule };
20
- //# sourceMappingURL=email.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"email.mjs","names":[],"sources":["../../../../../../../../../../../../packages/seal/src/rules/string/email.ts"],"sourcesContent":["import { isEmail } from \"@mongez/supportive-is\";\nimport { invalidRule, VALID_RULE } from \"../../helpers\";\nimport type { SchemaRule } from \"../../types\";\n\n/**\n * Email rule - validates email format\n */\nexport const emailRule: SchemaRule = {\n name: \"email\",\n defaultErrorMessage: \"The :input must be a valid email address\",\n async validate(value: any, context) {\n if (isEmail(value)) {\n return VALID_RULE;\n }\n return invalidRule(this, context);\n },\n};\n"],"mappings":";;;;;;;;AAOA,MAAa,YAAwB;CACnC,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,IAAI,QAAQ,KAAK,GACf,OAAO;EAET,OAAO,YAAY,MAAM,OAAO;CAClC;AACF"}