@warlock.js/notifications 5.30.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 (421) hide show
  1. package/CHANGELOG.md +22 -1
  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/config.mjs.map +1 -1
  13. package/esm/contracts/channel.contract.d.mts +1 -3
  14. package/esm/contracts/channel.contract.d.mts.map +1 -1
  15. package/esm/contracts/index.d.mts +2 -1
  16. package/esm/contracts/notification.contract.d.mts +1 -3
  17. package/esm/contracts/notification.contract.d.mts.map +1 -1
  18. package/esm/contracts/preference-provider.contract.d.mts +1 -3
  19. package/esm/contracts/preference-provider.contract.d.mts.map +1 -1
  20. package/esm/contracts/queue-dispatcher.contract.d.mts +1 -3
  21. package/esm/contracts/queue-dispatcher.contract.d.mts.map +1 -1
  22. package/esm/contracts/rate-limiter.contract.d.mts +1 -3
  23. package/esm/contracts/rate-limiter.contract.d.mts.map +1 -1
  24. package/esm/dispatch/define-channel.d.mts +2 -2
  25. package/esm/dispatch/define-channel.d.mts.map +1 -1
  26. package/esm/dispatch/define-notification.d.mts +5 -6
  27. package/esm/dispatch/define-notification.d.mts.map +1 -1
  28. package/esm/dispatch/define-notification.mjs.map +1 -1
  29. package/esm/dispatch/index.d.mts +2 -1
  30. package/esm/dispatch/index.mjs +1 -1
  31. package/esm/dispatch/notifications-event-bus.d.mts +2 -3
  32. package/esm/dispatch/notifications-event-bus.d.mts.map +1 -1
  33. package/esm/dispatch/notify.d.mts +3 -5
  34. package/esm/dispatch/notify.d.mts.map +1 -1
  35. package/esm/dispatch/notify.mjs.map +1 -1
  36. package/esm/errors.d.mts +5 -6
  37. package/esm/errors.d.mts.map +1 -1
  38. package/esm/in-app/base-notifications-repository.d.mts +6 -6
  39. package/esm/in-app/base-notifications-repository.d.mts.map +1 -1
  40. package/esm/in-app/base-notifications-repository.mjs +1 -1
  41. package/esm/in-app/base-notifications-repository.mjs.map +1 -1
  42. package/esm/in-app/column-map.d.mts +11 -8
  43. package/esm/in-app/column-map.d.mts.map +1 -1
  44. package/esm/in-app/database-notification.d.mts +2 -3
  45. package/esm/in-app/database-notification.d.mts.map +1 -1
  46. package/esm/in-app/in-app.d.mts +6 -5
  47. package/esm/in-app/in-app.d.mts.map +1 -1
  48. package/esm/in-app/index.d.mts +2 -1
  49. package/esm/in-app/index.mjs +1 -1
  50. package/esm/index.d.mts +6 -0
  51. package/esm/migration/index.d.mts +2 -1
  52. package/esm/migration/index.mjs +1 -1
  53. package/esm/migration/notification-columns.d.mts +6 -7
  54. package/esm/migration/notification-columns.d.mts.map +1 -1
  55. package/esm/migration/notification-columns.mjs.map +1 -1
  56. package/esm/queue/bullmq-queue.d.mts +9 -7
  57. package/esm/queue/bullmq-queue.d.mts.map +1 -1
  58. package/esm/queue/bullmq-queue.mjs.map +1 -1
  59. package/esm/queue/herald-queue.d.mts +6 -4
  60. package/esm/queue/herald-queue.d.mts.map +1 -1
  61. package/esm/queue/index.d.mts +2 -1
  62. package/esm/queue/index.mjs +1 -1
  63. package/esm/queue/load-herald.d.mts +1 -2
  64. package/esm/queue/load-herald.d.mts.map +1 -1
  65. package/esm/queue/load-herald.mjs +1 -1
  66. package/esm/queue/load-queue.d.mts +2 -3
  67. package/esm/queue/load-queue.d.mts.map +1 -1
  68. package/esm/queue/notifications-worker.d.mts +5 -4
  69. package/esm/queue/notifications-worker.d.mts.map +1 -1
  70. package/esm/queue/notifications-worker.mjs.map +1 -1
  71. package/esm/queue/queue-package-not-installed.error.d.mts +1 -2
  72. package/esm/queue/queue-package-not-installed.error.d.mts.map +1 -1
  73. package/esm/types.d.mts +22 -18
  74. package/esm/types.d.mts.map +1 -1
  75. package/llms-full.txt +89 -81
  76. package/package.json +10 -9
  77. package/skills/configure-notifications/SKILL.md +7 -7
  78. package/skills/define-channel/SKILL.md +9 -7
  79. package/skills/define-notification/SKILL.md +22 -25
  80. package/skills/index.md +4 -1
  81. package/skills/notifications-basics/SKILL.md +12 -12
  82. package/skills/observe-notifications/SKILL.md +14 -10
  83. package/skills/send-ad-hoc/SKILL.md +9 -9
  84. package/skills/use-in-app/SKILL.md +6 -4
  85. package/skills/write-notification-migration/SKILL.md +10 -7
  86. package/cjs/channel_api-C5ZZDkgQ.cjs +0 -7463
  87. package/cjs/channel_api-C5ZZDkgQ.cjs.map +0 -1
  88. package/cjs/chunk-fl3r8ClO.cjs +0 -41
  89. package/cjs/rabbitmq-driver-BFoWr21L.cjs +0 -3
  90. package/cjs/src-eu2jxS21.cjs +0 -11190
  91. package/cjs/src-eu2jxS21.cjs.map +0 -1
  92. package/esm/_virtual/_rolldown/runtime.mjs +0 -32
  93. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.2/node_modules/@mongez/reinforcements/esm/Random/_internal.mjs +0 -6
  94. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.2/node_modules/@mongez/reinforcements/esm/Random/_internal.mjs.map +0 -1
  95. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.2/node_modules/@mongez/reinforcements/esm/Random/bool.mjs +0 -3
  96. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.2/node_modules/@mongez/reinforcements/esm/Random/color.mjs +0 -3
  97. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.2/node_modules/@mongez/reinforcements/esm/Random/date.mjs +0 -3
  98. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.2/node_modules/@mongez/reinforcements/esm/Random/float.mjs +0 -3
  99. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.2/node_modules/@mongez/reinforcements/esm/Random/id.mjs +0 -3
  100. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.2/node_modules/@mongez/reinforcements/esm/Random/int.mjs +0 -3
  101. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.2/node_modules/@mongez/reinforcements/esm/Random/nanoid.mjs +0 -3
  102. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.2/node_modules/@mongez/reinforcements/esm/Random/pick.mjs +0 -3
  103. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.2/node_modules/@mongez/reinforcements/esm/Random/random.mjs +0 -16
  104. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.2/node_modules/@mongez/reinforcements/esm/Random/sample.mjs +0 -3
  105. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.2/node_modules/@mongez/reinforcements/esm/Random/string.mjs +0 -3
  106. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.2/node_modules/@mongez/reinforcements/esm/Random/token.mjs +0 -3
  107. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.2/node_modules/@mongez/reinforcements/esm/Random/uuid.mjs +0 -3
  108. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.2/node_modules/@mongez/reinforcements/esm/Random/weighted.mjs +0 -3
  109. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.2/node_modules/@mongez/reinforcements/esm/async/retry.mjs +0 -3
  110. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.2/node_modules/@mongez/reinforcements/esm/index.mjs +0 -24
  111. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.2/node_modules/@mongez/reinforcements/esm/mixed/clone/clone.mjs +0 -82
  112. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.2/node_modules/@mongez/reinforcements/esm/mixed/clone/clone.mjs.map +0 -1
  113. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.2/node_modules/@mongez/reinforcements/esm/number/round.mjs +0 -17
  114. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.2/node_modules/@mongez/reinforcements/esm/number/round.mjs.map +0 -1
  115. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.2/node_modules/@mongez/reinforcements/esm/object/except.mjs +0 -13
  116. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.2/node_modules/@mongez/reinforcements/esm/object/except.mjs.map +0 -1
  117. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.2/node_modules/@mongez/reinforcements/esm/object/get.mjs +0 -18
  118. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.2/node_modules/@mongez/reinforcements/esm/object/get.mjs.map +0 -1
  119. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.2/node_modules/@mongez/reinforcements/esm/object/omit.mjs +0 -17
  120. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.2/node_modules/@mongez/reinforcements/esm/object/omit.mjs.map +0 -1
  121. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.2/node_modules/@mongez/reinforcements/esm/object/unset.mjs +0 -30
  122. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.2/node_modules/@mongez/reinforcements/esm/object/unset.mjs.map +0 -1
  123. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.2/node_modules/@mongez/reinforcements/esm/string/capitalize.mjs +0 -19
  124. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.2/node_modules/@mongez/reinforcements/esm/string/capitalize.mjs.map +0 -1
  125. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.2/node_modules/@mongez/reinforcements/esm/string/ltrim.mjs +0 -18
  126. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.2/node_modules/@mongez/reinforcements/esm/string/ltrim.mjs.map +0 -1
  127. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.2/node_modules/@mongez/reinforcements/esm/string/readMoreChars.mjs +0 -14
  128. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.2/node_modules/@mongez/reinforcements/esm/string/readMoreChars.mjs.map +0 -1
  129. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.2/node_modules/@mongez/reinforcements/esm/string/rtrim.mjs +0 -18
  130. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.2/node_modules/@mongez/reinforcements/esm/string/rtrim.mjs.map +0 -1
  131. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.2/node_modules/@mongez/reinforcements/esm/string/toCamelCase.mjs +0 -22
  132. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.2/node_modules/@mongez/reinforcements/esm/string/toCamelCase.mjs.map +0 -1
  133. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.2/node_modules/@mongez/reinforcements/esm/string/toKebabCase.mjs +0 -17
  134. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.2/node_modules/@mongez/reinforcements/esm/string/toKebabCase.mjs.map +0 -1
  135. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.2/node_modules/@mongez/reinforcements/esm/string/toSnakeCase.mjs +0 -21
  136. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.2/node_modules/@mongez/reinforcements/esm/string/toSnakeCase.mjs.map +0 -1
  137. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.2/node_modules/@mongez/reinforcements/esm/string/toStudlyCase.mjs +0 -21
  138. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.2/node_modules/@mongez/reinforcements/esm/string/toStudlyCase.mjs.map +0 -1
  139. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.2/node_modules/@mongez/reinforcements/esm/string/trim.mjs +0 -20
  140. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.2/node_modules/@mongez/reinforcements/esm/string/trim.mjs.map +0 -1
  141. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.2/node_modules/@mongez/reinforcements/esm/string/ucfirst.mjs +0 -15
  142. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.2/node_modules/@mongez/reinforcements/esm/string/ucfirst.mjs.map +0 -1
  143. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.2/node_modules/@mongez/reinforcements/esm/string/words.mjs +0 -25
  144. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.2/node_modules/@mongez/reinforcements/esm/string/words.mjs.map +0 -1
  145. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.2/node_modules/@mongez/reinforcements/esm/utils/escapeRegex.mjs +0 -11
  146. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.2/node_modules/@mongez/reinforcements/esm/utils/escapeRegex.mjs.map +0 -1
  147. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.2/node_modules/@mongez/reinforcements/esm/utils/lazy.mjs +0 -100
  148. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.2/node_modules/@mongez/reinforcements/esm/utils/lazy.mjs.map +0 -1
  149. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.2/node_modules/@mongez/reinforcements/esm/utils/tap.mjs +0 -27
  150. package/esm/node_modules/.pnpm/@mongez_reinforcements@4.0.2/node_modules/@mongez/reinforcements/esm/utils/tap.mjs.map +0 -1
  151. package/esm/node_modules/.pnpm/@mongez_supportive-is@3.0.0/node_modules/@mongez/supportive-is/esm/index.mjs +0 -358
  152. package/esm/node_modules/.pnpm/@mongez_supportive-is@3.0.0/node_modules/@mongez/supportive-is/esm/index.mjs.map +0 -1
  153. package/esm/node_modules/.pnpm/amqplib@0.10.9/node_modules/amqplib/channel_api.mjs +0 -28
  154. package/esm/node_modules/.pnpm/amqplib@0.10.9/node_modules/amqplib/channel_api.mjs.map +0 -1
  155. package/esm/node_modules/.pnpm/amqplib@0.10.9/node_modules/amqplib/lib/api_args.mjs +0 -241
  156. package/esm/node_modules/.pnpm/amqplib@0.10.9/node_modules/amqplib/lib/api_args.mjs.map +0 -1
  157. package/esm/node_modules/.pnpm/amqplib@0.10.9/node_modules/amqplib/lib/bitset.mjs +0 -130
  158. package/esm/node_modules/.pnpm/amqplib@0.10.9/node_modules/amqplib/lib/bitset.mjs.map +0 -1
  159. package/esm/node_modules/.pnpm/amqplib@0.10.9/node_modules/amqplib/lib/channel.mjs +0 -302
  160. package/esm/node_modules/.pnpm/amqplib@0.10.9/node_modules/amqplib/lib/channel.mjs.map +0 -1
  161. package/esm/node_modules/.pnpm/amqplib@0.10.9/node_modules/amqplib/lib/channel_model.mjs +0 -206
  162. package/esm/node_modules/.pnpm/amqplib@0.10.9/node_modules/amqplib/lib/channel_model.mjs.map +0 -1
  163. package/esm/node_modules/.pnpm/amqplib@0.10.9/node_modules/amqplib/lib/codec.mjs +0 -273
  164. package/esm/node_modules/.pnpm/amqplib@0.10.9/node_modules/amqplib/lib/codec.mjs.map +0 -1
  165. package/esm/node_modules/.pnpm/amqplib@0.10.9/node_modules/amqplib/lib/connect.mjs +0 -143
  166. package/esm/node_modules/.pnpm/amqplib@0.10.9/node_modules/amqplib/lib/connect.mjs.map +0 -1
  167. package/esm/node_modules/.pnpm/amqplib@0.10.9/node_modules/amqplib/lib/connection.mjs +0 -416
  168. package/esm/node_modules/.pnpm/amqplib@0.10.9/node_modules/amqplib/lib/connection.mjs.map +0 -1
  169. package/esm/node_modules/.pnpm/amqplib@0.10.9/node_modules/amqplib/lib/credentials.mjs +0 -50
  170. package/esm/node_modules/.pnpm/amqplib@0.10.9/node_modules/amqplib/lib/credentials.mjs.map +0 -1
  171. package/esm/node_modules/.pnpm/amqplib@0.10.9/node_modules/amqplib/lib/defs.mjs +0 -4600
  172. package/esm/node_modules/.pnpm/amqplib@0.10.9/node_modules/amqplib/lib/defs.mjs.map +0 -1
  173. package/esm/node_modules/.pnpm/amqplib@0.10.9/node_modules/amqplib/lib/error.mjs +0 -29
  174. package/esm/node_modules/.pnpm/amqplib@0.10.9/node_modules/amqplib/lib/error.mjs.map +0 -1
  175. package/esm/node_modules/.pnpm/amqplib@0.10.9/node_modules/amqplib/lib/format.mjs +0 -28
  176. package/esm/node_modules/.pnpm/amqplib@0.10.9/node_modules/amqplib/lib/format.mjs.map +0 -1
  177. package/esm/node_modules/.pnpm/amqplib@0.10.9/node_modules/amqplib/lib/frame.mjs +0 -130
  178. package/esm/node_modules/.pnpm/amqplib@0.10.9/node_modules/amqplib/lib/frame.mjs.map +0 -1
  179. package/esm/node_modules/.pnpm/amqplib@0.10.9/node_modules/amqplib/lib/heartbeat.mjs +0 -40
  180. package/esm/node_modules/.pnpm/amqplib@0.10.9/node_modules/amqplib/lib/heartbeat.mjs.map +0 -1
  181. package/esm/node_modules/.pnpm/amqplib@0.10.9/node_modules/amqplib/lib/mux.mjs +0 -86
  182. package/esm/node_modules/.pnpm/amqplib@0.10.9/node_modules/amqplib/lib/mux.mjs.map +0 -1
  183. package/esm/node_modules/.pnpm/amqplib@0.10.9/node_modules/amqplib/package.mjs +0 -41
  184. package/esm/node_modules/.pnpm/amqplib@0.10.9/node_modules/amqplib/package.mjs.map +0 -1
  185. package/esm/node_modules/.pnpm/buffer-more-ints@1.0.0/node_modules/buffer-more-ints/buffer-more-ints.mjs +0 -360
  186. package/esm/node_modules/.pnpm/buffer-more-ints@1.0.0/node_modules/buffer-more-ints/buffer-more-ints.mjs.map +0 -1
  187. package/esm/node_modules/.pnpm/dayjs@1.11.23/node_modules/dayjs/dayjs.min.mjs +0 -305
  188. package/esm/node_modules/.pnpm/dayjs@1.11.23/node_modules/dayjs/dayjs.min.mjs.map +0 -1
  189. package/esm/node_modules/.pnpm/querystringify@2.2.0/node_modules/querystringify/index.mjs +0 -80
  190. package/esm/node_modules/.pnpm/querystringify@2.2.0/node_modules/querystringify/index.mjs.map +0 -1
  191. package/esm/node_modules/.pnpm/requires-port@1.0.0/node_modules/requires-port/index.mjs +0 -35
  192. package/esm/node_modules/.pnpm/requires-port@1.0.0/node_modules/requires-port/index.mjs.map +0 -1
  193. package/esm/node_modules/.pnpm/url-parse@1.5.10/node_modules/url-parse/index.mjs +0 -388
  194. package/esm/node_modules/.pnpm/url-parse@1.5.10/node_modules/url-parse/index.mjs.map +0 -1
  195. package/esm/packages/herald/src/communicators/broker-registry.mjs +0 -204
  196. package/esm/packages/herald/src/communicators/broker-registry.mjs.map +0 -1
  197. package/esm/packages/herald/src/communicators/broker.mjs +0 -110
  198. package/esm/packages/herald/src/communicators/broker.mjs.map +0 -1
  199. package/esm/packages/herald/src/communicators/index.mjs +0 -4
  200. package/esm/packages/herald/src/decorators/consumable.mjs +0 -36
  201. package/esm/packages/herald/src/decorators/consumable.mjs.map +0 -1
  202. package/esm/packages/herald/src/decorators/index.mjs +0 -3
  203. package/esm/packages/herald/src/drivers/index.mjs +0 -5
  204. package/esm/packages/herald/src/drivers/rabbitmq/index.mjs +0 -4
  205. package/esm/packages/herald/src/drivers/rabbitmq/rabbitmq-channel.mjs +0 -403
  206. package/esm/packages/herald/src/drivers/rabbitmq/rabbitmq-channel.mjs.map +0 -1
  207. package/esm/packages/herald/src/drivers/rabbitmq/rabbitmq-driver.mjs +0 -303
  208. package/esm/packages/herald/src/drivers/rabbitmq/rabbitmq-driver.mjs.map +0 -1
  209. package/esm/packages/herald/src/index.mjs +0 -16
  210. package/esm/packages/herald/src/message-managers/event-consumer.mjs +0 -76
  211. package/esm/packages/herald/src/message-managers/event-consumer.mjs.map +0 -1
  212. package/esm/packages/herald/src/message-managers/event-message.mjs +0 -85
  213. package/esm/packages/herald/src/message-managers/event-message.mjs.map +0 -1
  214. package/esm/packages/herald/src/message-managers/index.mjs +0 -4
  215. package/esm/packages/herald/src/message-managers/prepare-consumer-subscription.mjs +0 -42
  216. package/esm/packages/herald/src/message-managers/prepare-consumer-subscription.mjs.map +0 -1
  217. package/esm/packages/herald/src/use-case-broadcast.mjs +0 -30
  218. package/esm/packages/herald/src/use-case-broadcast.mjs.map +0 -1
  219. package/esm/packages/herald/src/utils/connect-to-broker.mjs +0 -168
  220. package/esm/packages/herald/src/utils/connect-to-broker.mjs.map +0 -1
  221. package/esm/packages/herald/src/utils/index.mjs +0 -3
  222. package/esm/packages/seal/src/config.mjs +0 -15
  223. package/esm/packages/seal/src/config.mjs.map +0 -1
  224. package/esm/packages/seal/src/factory/index.mjs +0 -4
  225. package/esm/packages/seal/src/factory/validate.mjs +0 -42
  226. package/esm/packages/seal/src/factory/validate.mjs.map +0 -1
  227. package/esm/packages/seal/src/factory/validators.mjs +0 -133
  228. package/esm/packages/seal/src/factory/validators.mjs.map +0 -1
  229. package/esm/packages/seal/src/helpers/date-helpers.mjs +0 -24
  230. package/esm/packages/seal/src/helpers/date-helpers.mjs.map +0 -1
  231. package/esm/packages/seal/src/helpers/get-field-value.mjs +0 -46
  232. package/esm/packages/seal/src/helpers/get-field-value.mjs.map +0 -1
  233. package/esm/packages/seal/src/helpers/index.mjs +0 -6
  234. package/esm/packages/seal/src/helpers/is-empty-value.mjs +0 -10
  235. package/esm/packages/seal/src/helpers/is-empty-value.mjs.map +0 -1
  236. package/esm/packages/seal/src/helpers/path-helpers.mjs +0 -12
  237. package/esm/packages/seal/src/helpers/path-helpers.mjs.map +0 -1
  238. package/esm/packages/seal/src/helpers/validation-helpers.mjs +0 -78
  239. package/esm/packages/seal/src/helpers/validation-helpers.mjs.map +0 -1
  240. package/esm/packages/seal/src/index.mjs +0 -88
  241. package/esm/packages/seal/src/mutators/array-mutators.mjs +0 -32
  242. package/esm/packages/seal/src/mutators/array-mutators.mjs.map +0 -1
  243. package/esm/packages/seal/src/mutators/boolean-mutators.mjs +0 -40
  244. package/esm/packages/seal/src/mutators/boolean-mutators.mjs.map +0 -1
  245. package/esm/packages/seal/src/mutators/date-mutators.mjs +0 -94
  246. package/esm/packages/seal/src/mutators/date-mutators.mjs.map +0 -1
  247. package/esm/packages/seal/src/mutators/index.mjs +0 -9
  248. package/esm/packages/seal/src/mutators/number-mutators.mjs +0 -52
  249. package/esm/packages/seal/src/mutators/number-mutators.mjs.map +0 -1
  250. package/esm/packages/seal/src/mutators/object-mutators.mjs +0 -30
  251. package/esm/packages/seal/src/mutators/object-mutators.mjs.map +0 -1
  252. package/esm/packages/seal/src/mutators/scalar-mutators.mjs +0 -9
  253. package/esm/packages/seal/src/mutators/scalar-mutators.mjs.map +0 -1
  254. package/esm/packages/seal/src/mutators/string-mutators.mjs +0 -186
  255. package/esm/packages/seal/src/mutators/string-mutators.mjs.map +0 -1
  256. package/esm/packages/seal/src/object.mjs +0 -13
  257. package/esm/packages/seal/src/object.mjs.map +0 -1
  258. package/esm/packages/seal/src/rules/array/array-rules.mjs +0 -41
  259. package/esm/packages/seal/src/rules/array/array-rules.mjs.map +0 -1
  260. package/esm/packages/seal/src/rules/array/index.mjs +0 -3
  261. package/esm/packages/seal/src/rules/color/color-rules.mjs +0 -104
  262. package/esm/packages/seal/src/rules/color/color-rules.mjs.map +0 -1
  263. package/esm/packages/seal/src/rules/color/index.mjs +0 -3
  264. package/esm/packages/seal/src/rules/common/enum.mjs +0 -77
  265. package/esm/packages/seal/src/rules/common/enum.mjs.map +0 -1
  266. package/esm/packages/seal/src/rules/common/equals-field-rules.mjs +0 -42
  267. package/esm/packages/seal/src/rules/common/equals-field-rules.mjs.map +0 -1
  268. package/esm/packages/seal/src/rules/common/index.mjs +0 -8
  269. package/esm/packages/seal/src/rules/common/instanceof.mjs +0 -23
  270. package/esm/packages/seal/src/rules/common/instanceof.mjs.map +0 -1
  271. package/esm/packages/seal/src/rules/common/literal.mjs +0 -31
  272. package/esm/packages/seal/src/rules/common/literal.mjs.map +0 -1
  273. package/esm/packages/seal/src/rules/common/type-rules.mjs +0 -97
  274. package/esm/packages/seal/src/rules/common/type-rules.mjs.map +0 -1
  275. package/esm/packages/seal/src/rules/common/unknown-key.mjs +0 -25
  276. package/esm/packages/seal/src/rules/common/unknown-key.mjs.map +0 -1
  277. package/esm/packages/seal/src/rules/conditional/forbidden-if-rules.mjs +0 -116
  278. package/esm/packages/seal/src/rules/conditional/forbidden-if-rules.mjs.map +0 -1
  279. package/esm/packages/seal/src/rules/conditional/index.mjs +0 -12
  280. package/esm/packages/seal/src/rules/conditional/present-if-rules.mjs +0 -97
  281. package/esm/packages/seal/src/rules/conditional/present-if-rules.mjs.map +0 -1
  282. package/esm/packages/seal/src/rules/conditional/present-unless-rules.mjs +0 -30
  283. package/esm/packages/seal/src/rules/conditional/present-unless-rules.mjs.map +0 -1
  284. package/esm/packages/seal/src/rules/conditional/present-with-rules.mjs +0 -76
  285. package/esm/packages/seal/src/rules/conditional/present-with-rules.mjs.map +0 -1
  286. package/esm/packages/seal/src/rules/conditional/present-without-rules.mjs +0 -76
  287. package/esm/packages/seal/src/rules/conditional/present-without-rules.mjs.map +0 -1
  288. package/esm/packages/seal/src/rules/conditional/required-if-rules.mjs +0 -204
  289. package/esm/packages/seal/src/rules/conditional/required-if-rules.mjs.map +0 -1
  290. package/esm/packages/seal/src/rules/conditional/required-unless-rules.mjs +0 -31
  291. package/esm/packages/seal/src/rules/conditional/required-unless-rules.mjs.map +0 -1
  292. package/esm/packages/seal/src/rules/conditional/required-when-rule.mjs +0 -32
  293. package/esm/packages/seal/src/rules/conditional/required-when-rule.mjs.map +0 -1
  294. package/esm/packages/seal/src/rules/conditional/required-with-rules.mjs +0 -67
  295. package/esm/packages/seal/src/rules/conditional/required-with-rules.mjs.map +0 -1
  296. package/esm/packages/seal/src/rules/conditional/required-without-rules.mjs +0 -67
  297. package/esm/packages/seal/src/rules/conditional/required-without-rules.mjs.map +0 -1
  298. package/esm/packages/seal/src/rules/core/equal.mjs +0 -22
  299. package/esm/packages/seal/src/rules/core/equal.mjs.map +0 -1
  300. package/esm/packages/seal/src/rules/core/forbidden.mjs +0 -20
  301. package/esm/packages/seal/src/rules/core/forbidden.mjs.map +0 -1
  302. package/esm/packages/seal/src/rules/core/index.mjs +0 -7
  303. package/esm/packages/seal/src/rules/core/required.mjs +0 -36
  304. package/esm/packages/seal/src/rules/core/required.mjs.map +0 -1
  305. package/esm/packages/seal/src/rules/core/union.mjs +0 -32
  306. package/esm/packages/seal/src/rules/core/union.mjs.map +0 -1
  307. package/esm/packages/seal/src/rules/core/when.mjs +0 -37
  308. package/esm/packages/seal/src/rules/core/when.mjs.map +0 -1
  309. package/esm/packages/seal/src/rules/date/date-comparison-rules.mjs +0 -78
  310. package/esm/packages/seal/src/rules/date/date-comparison-rules.mjs.map +0 -1
  311. package/esm/packages/seal/src/rules/date/date-day-rules.mjs +0 -49
  312. package/esm/packages/seal/src/rules/date/date-day-rules.mjs.map +0 -1
  313. package/esm/packages/seal/src/rules/date/date-field-comparison-rules.mjs +0 -82
  314. package/esm/packages/seal/src/rules/date/date-field-comparison-rules.mjs.map +0 -1
  315. package/esm/packages/seal/src/rules/date/date-period-rules.mjs +0 -401
  316. package/esm/packages/seal/src/rules/date/date-period-rules.mjs.map +0 -1
  317. package/esm/packages/seal/src/rules/date/date-relative-rules.mjs +0 -55
  318. package/esm/packages/seal/src/rules/date/date-relative-rules.mjs.map +0 -1
  319. package/esm/packages/seal/src/rules/date/date-special-rules.mjs +0 -58
  320. package/esm/packages/seal/src/rules/date/date-special-rules.mjs.map +0 -1
  321. package/esm/packages/seal/src/rules/date/date.mjs +0 -235
  322. package/esm/packages/seal/src/rules/date/date.mjs.map +0 -1
  323. package/esm/packages/seal/src/rules/date/index.mjs +0 -9
  324. package/esm/packages/seal/src/rules/file/dimensions.mjs +0 -3
  325. package/esm/packages/seal/src/rules/file/file-size.mjs +0 -3
  326. package/esm/packages/seal/src/rules/file/index.mjs +0 -4
  327. package/esm/packages/seal/src/rules/index.mjs +0 -54
  328. package/esm/packages/seal/src/rules/length/index.mjs +0 -3
  329. package/esm/packages/seal/src/rules/length/length-rules.mjs +0 -98
  330. package/esm/packages/seal/src/rules/length/length-rules.mjs.map +0 -1
  331. package/esm/packages/seal/src/rules/number/index.mjs +0 -3
  332. package/esm/packages/seal/src/rules/number/number-rules.mjs +0 -197
  333. package/esm/packages/seal/src/rules/number/number-rules.mjs.map +0 -1
  334. package/esm/packages/seal/src/rules/scalar/accepted-rule.mjs +0 -123
  335. package/esm/packages/seal/src/rules/scalar/accepted-rule.mjs.map +0 -1
  336. package/esm/packages/seal/src/rules/scalar/declined-rule.mjs +0 -123
  337. package/esm/packages/seal/src/rules/scalar/declined-rule.mjs.map +0 -1
  338. package/esm/packages/seal/src/rules/scalar/index.mjs +0 -4
  339. package/esm/packages/seal/src/rules/string/alpha.mjs +0 -41
  340. package/esm/packages/seal/src/rules/string/alpha.mjs.map +0 -1
  341. package/esm/packages/seal/src/rules/string/credit-card.mjs +0 -32
  342. package/esm/packages/seal/src/rules/string/credit-card.mjs.map +0 -1
  343. package/esm/packages/seal/src/rules/string/email.mjs +0 -20
  344. package/esm/packages/seal/src/rules/string/email.mjs.map +0 -1
  345. package/esm/packages/seal/src/rules/string/id-formats.mjs +0 -104
  346. package/esm/packages/seal/src/rules/string/id-formats.mjs.map +0 -1
  347. package/esm/packages/seal/src/rules/string/index.mjs +0 -13
  348. package/esm/packages/seal/src/rules/string/ip.mjs +0 -66
  349. package/esm/packages/seal/src/rules/string/ip.mjs.map +0 -1
  350. package/esm/packages/seal/src/rules/string/matches.mjs +0 -4
  351. package/esm/packages/seal/src/rules/string/pattern.mjs +0 -20
  352. package/esm/packages/seal/src/rules/string/pattern.mjs.map +0 -1
  353. package/esm/packages/seal/src/rules/string/string-comparison.mjs +0 -56
  354. package/esm/packages/seal/src/rules/string/string-comparison.mjs.map +0 -1
  355. package/esm/packages/seal/src/rules/string/strong-password-rule.mjs +0 -31
  356. package/esm/packages/seal/src/rules/string/strong-password-rule.mjs.map +0 -1
  357. package/esm/packages/seal/src/rules/string/url.mjs +0 -23
  358. package/esm/packages/seal/src/rules/string/url.mjs.map +0 -1
  359. package/esm/packages/seal/src/rules/string/without-whitespace.mjs +0 -19
  360. package/esm/packages/seal/src/rules/string/without-whitespace.mjs.map +0 -1
  361. package/esm/packages/seal/src/standard-schema/json-schema.mjs +0 -81
  362. package/esm/packages/seal/src/standard-schema/json-schema.mjs.map +0 -1
  363. package/esm/packages/seal/src/standard-schema/map-result.mjs +0 -26
  364. package/esm/packages/seal/src/standard-schema/map-result.mjs.map +0 -1
  365. package/esm/packages/seal/src/string.mjs +0 -13
  366. package/esm/packages/seal/src/string.mjs.map +0 -1
  367. package/esm/packages/seal/src/types/date-types.mjs +0 -17
  368. package/esm/packages/seal/src/types/date-types.mjs.map +0 -1
  369. package/esm/packages/seal/src/validators/any-validator.mjs +0 -38
  370. package/esm/packages/seal/src/validators/any-validator.mjs.map +0 -1
  371. package/esm/packages/seal/src/validators/array-validator.mjs +0 -186
  372. package/esm/packages/seal/src/validators/array-validator.mjs.map +0 -1
  373. package/esm/packages/seal/src/validators/base-validator.mjs +0 -720
  374. package/esm/packages/seal/src/validators/base-validator.mjs.map +0 -1
  375. package/esm/packages/seal/src/validators/boolean-validator.mjs +0 -175
  376. package/esm/packages/seal/src/validators/boolean-validator.mjs.map +0 -1
  377. package/esm/packages/seal/src/validators/computed-validator.mjs +0 -118
  378. package/esm/packages/seal/src/validators/computed-validator.mjs.map +0 -1
  379. package/esm/packages/seal/src/validators/date-validator.mjs +0 -640
  380. package/esm/packages/seal/src/validators/date-validator.mjs.map +0 -1
  381. package/esm/packages/seal/src/validators/discriminated-union-validator.mjs +0 -138
  382. package/esm/packages/seal/src/validators/discriminated-union-validator.mjs.map +0 -1
  383. package/esm/packages/seal/src/validators/float-validator.mjs +0 -18
  384. package/esm/packages/seal/src/validators/float-validator.mjs.map +0 -1
  385. package/esm/packages/seal/src/validators/index.mjs +0 -28
  386. package/esm/packages/seal/src/validators/instanceof-validator.mjs +0 -64
  387. package/esm/packages/seal/src/validators/instanceof-validator.mjs.map +0 -1
  388. package/esm/packages/seal/src/validators/int-validator.mjs +0 -30
  389. package/esm/packages/seal/src/validators/int-validator.mjs.map +0 -1
  390. package/esm/packages/seal/src/validators/lazy-validator.mjs +0 -87
  391. package/esm/packages/seal/src/validators/lazy-validator.mjs.map +0 -1
  392. package/esm/packages/seal/src/validators/literal-validator.mjs +0 -72
  393. package/esm/packages/seal/src/validators/literal-validator.mjs.map +0 -1
  394. package/esm/packages/seal/src/validators/managed-validator.mjs +0 -39
  395. package/esm/packages/seal/src/validators/managed-validator.mjs.map +0 -1
  396. package/esm/packages/seal/src/validators/methods/equality-conditional-methods.mjs +0 -129
  397. package/esm/packages/seal/src/validators/methods/equality-conditional-methods.mjs.map +0 -1
  398. package/esm/packages/seal/src/validators/methods/forbidden-methods.mjs +0 -131
  399. package/esm/packages/seal/src/validators/methods/forbidden-methods.mjs.map +0 -1
  400. package/esm/packages/seal/src/validators/methods/present-methods.mjs +0 -235
  401. package/esm/packages/seal/src/validators/methods/present-methods.mjs.map +0 -1
  402. package/esm/packages/seal/src/validators/methods/required-methods.mjs +0 -347
  403. package/esm/packages/seal/src/validators/methods/required-methods.mjs.map +0 -1
  404. package/esm/packages/seal/src/validators/number-validator.mjs +0 -331
  405. package/esm/packages/seal/src/validators/number-validator.mjs.map +0 -1
  406. package/esm/packages/seal/src/validators/numeric-validator.mjs +0 -27
  407. package/esm/packages/seal/src/validators/numeric-validator.mjs.map +0 -1
  408. package/esm/packages/seal/src/validators/object-validator.mjs +0 -445
  409. package/esm/packages/seal/src/validators/object-validator.mjs.map +0 -1
  410. package/esm/packages/seal/src/validators/primitive-validator.mjs +0 -88
  411. package/esm/packages/seal/src/validators/primitive-validator.mjs.map +0 -1
  412. package/esm/packages/seal/src/validators/record-validator.mjs +0 -112
  413. package/esm/packages/seal/src/validators/record-validator.mjs.map +0 -1
  414. package/esm/packages/seal/src/validators/scalar-validator.mjs +0 -173
  415. package/esm/packages/seal/src/validators/scalar-validator.mjs.map +0 -1
  416. package/esm/packages/seal/src/validators/string-validator.mjs +0 -459
  417. package/esm/packages/seal/src/validators/string-validator.mjs.map +0 -1
  418. package/esm/packages/seal/src/validators/tuple-validator.mjs +0 -134
  419. package/esm/packages/seal/src/validators/tuple-validator.mjs.map +0 -1
  420. package/esm/packages/seal/src/validators/union-validator.mjs +0 -66
  421. package/esm/packages/seal/src/validators/union-validator.mjs.map +0 -1
@@ -1,640 +0,0 @@
1
- import { __toESM } from "../../../../_virtual/_rolldown/runtime.mjs";
2
- import { applyNullable, getRuleOptions } from "../standard-schema/json-schema.mjs";
3
- import { isDateValue } from "../helpers/date-helpers.mjs";
4
- import { BaseValidator } from "./base-validator.mjs";
5
- import { require_dayjs_min } from "../../../../node_modules/.pnpm/dayjs@1.11.23/node_modules/dayjs/dayjs.min.mjs";
6
- import { addDaysMutator, addHoursMutator, addMonthsMutator, addYearsMutator, dateMutator, toEndOfDayMutator, toEndOfMonthMutator, toEndOfYearMutator, toStartOfDayMutator, toStartOfMonthMutator, toStartOfYearMutator, toUTCMutator } from "../mutators/date-mutators.mjs";
7
- import "../mutators/index.mjs";
8
- import { ageRule, beforeHourRule, beforeMinuteRule, beforeTodayRule, betweenHoursRule, betweenMinutesRule, dateRule, fromHourRule, fromMinuteRule, fromTodayRule, maxAgeRule, maxDateRule, minAgeRule, minDateRule, weekDayRule } from "../rules/date/date.mjs";
9
- import { afterTodayRule, betweenDatesRule, futureRule, pastRule, todayRule } from "../rules/date/date-comparison-rules.mjs";
10
- import { businessDayRule, weekdaysRule, weekendRule } from "../rules/date/date-day-rules.mjs";
11
- import { afterFieldRule, beforeFieldRule, sameAsFieldDateRule } from "../rules/date/date-field-comparison-rules.mjs";
12
- import { betweenDaysRule, betweenMonthsRule, betweenTimesRule, betweenYearsRule, maxDayRule, maxMonthRule, maxYearRule, minDayRule, minMonthRule, minYearRule, monthRule, quarterRule, yearRule } from "../rules/date/date-period-rules.mjs";
13
- import { withinDaysRule, withinFutureDaysRule, withinPastDaysRule } from "../rules/date/date-relative-rules.mjs";
14
- import { betweenAgeRule, birthdayRule, leapYearRule } from "../rules/date/date-special-rules.mjs";
15
- import "../rules/index.mjs";
16
-
17
- //#region ../../packages/seal/src/validators/date-validator.ts
18
- var import_dayjs_min = /* @__PURE__ */ __toESM(require_dayjs_min(), 1);
19
- /**
20
- * Date validator class
21
- */
22
- var DateValidator = class extends BaseValidator {
23
- constructor(errorMessage) {
24
- super();
25
- this.blankIsMissing = true;
26
- this.addMutableMutator(dateMutator);
27
- this.addMutableRule(dateRule, errorMessage);
28
- }
29
- /**
30
- * Check if value is a Date type
31
- */
32
- matchesType(value) {
33
- return isDateValue(value);
34
- }
35
- /**
36
- * Convert date to ISO string format
37
- * @category transformer
38
- */
39
- toISOString() {
40
- return this.addTransformer((data) => data instanceof Date ? data.toISOString() : data);
41
- }
42
- /** Convert date to Unix timestamp (milliseconds) */
43
- toTimestamp() {
44
- return this.addTransformer((data) => data instanceof Date ? data.getTime() : data);
45
- }
46
- /** Convert date to specific format using dayjs */
47
- toFormat(format) {
48
- return this.addTransformer((data, { options }) => data instanceof Date ? (0, import_dayjs_min.default)(data).format(options.format) : data, { format });
49
- }
50
- /** Convert to date only (remove time, returns YYYY-MM-DD) */
51
- toDateOnly() {
52
- return this.addTransformer((data) => data instanceof Date ? (0, import_dayjs_min.default)(data).format("YYYY-MM-DD") : data, { __jsonSchemaFormat: "date" });
53
- }
54
- /** Convert to time only (returns HH:MM:SS) */
55
- toTimeOnly() {
56
- return this.addTransformer((data) => data instanceof Date ? (0, import_dayjs_min.default)(data).format("HH:mm:ss") : data, { __jsonSchemaFormat: "time" });
57
- }
58
- /**
59
- * Convert date to start of day (00:00:00)
60
- * @category mutator
61
- */
62
- toStartOfDay() {
63
- return this.addMutator(toStartOfDayMutator);
64
- }
65
- /** Convert date to end of day (23:59:59.999) */
66
- toEndOfDay() {
67
- return this.addMutator(toEndOfDayMutator);
68
- }
69
- /** Add or subtract days from date */
70
- addDays(days) {
71
- return this.addMutator(addDaysMutator, { days });
72
- }
73
- /** Add or subtract months from date */
74
- addMonths(months) {
75
- return this.addMutator(addMonthsMutator, { months });
76
- }
77
- /** Add or subtract years from date */
78
- addYears(years) {
79
- return this.addMutator(addYearsMutator, { years });
80
- }
81
- /** Add or subtract hours from date */
82
- addHours(hours) {
83
- return this.addMutator(addHoursMutator, { hours });
84
- }
85
- /** Convert date to UTC */
86
- toUTC() {
87
- return this.addMutator(toUTCMutator);
88
- }
89
- /** Set to start of month */
90
- toStartOfMonth() {
91
- return this.addMutator(toStartOfMonthMutator);
92
- }
93
- /** Set to end of month */
94
- toEndOfMonth() {
95
- return this.addMutator(toEndOfMonthMutator);
96
- }
97
- /** Set to start of year */
98
- toStartOfYear() {
99
- return this.addMutator(toStartOfYearMutator);
100
- }
101
- /** Set to end of year */
102
- toEndOfYear() {
103
- return this.addMutator(toEndOfYearMutator);
104
- }
105
- /**
106
- * Date must be greater than or equal to the given date or field (inclusive)
107
- *
108
- * Smart detection:
109
- * - Date instance, timestamp, or date string (with - or /) → value comparison
110
- * - Plain string → field comparison
111
- *
112
- * @param dateOrField - Date, timestamp, date string, or field name
113
- *
114
- * @example
115
- * ```ts
116
- * // Value comparison
117
- * v.date().min('2024-01-01')
118
- * v.date().min(new Date())
119
- * v.date().min(1698278400000)
120
- *
121
- * // Field comparison
122
- * v.date().min('startsAt')
123
- * ```
124
- *
125
- * @category Validation Rule
126
- */
127
- min(dateOrField, errorMessage) {
128
- return this.addRule(minDateRule, errorMessage, {
129
- dateOrField,
130
- scope: "global"
131
- });
132
- }
133
- /**
134
- * Date must be less than or equal to the given date or field (inclusive)
135
- *
136
- * Smart detection:
137
- * - Date instance, timestamp, or date string (with - or /) → value comparison
138
- * - Plain string → field comparison
139
- *
140
- * @category Validation Rule
141
- */
142
- max(dateOrField, errorMessage) {
143
- return this.addRule(maxDateRule, errorMessage, {
144
- dateOrField,
145
- scope: "global"
146
- });
147
- }
148
- /**
149
- * Date must be strictly less than the given date or field (exclusive)
150
- *
151
- * Smart detection:
152
- * - Date instance, timestamp, or date string (with - or /) → value comparison
153
- * - Plain string → field comparison
154
- *
155
- * @category Validation Rule
156
- */
157
- before(dateOrField, errorMessage) {
158
- return this.addRule(beforeFieldRule, errorMessage, {
159
- dateOrField,
160
- scope: "global"
161
- });
162
- }
163
- /**
164
- * Date must be strictly greater than the given date or field (exclusive)
165
- *
166
- * Smart detection:
167
- * - Date instance, timestamp, or date string (with - or /) → value comparison
168
- * - Plain string → field comparison
169
- *
170
- * @category Validation Rule
171
- */
172
- after(dateOrField, errorMessage) {
173
- return this.addRule(afterFieldRule, errorMessage, {
174
- dateOrField,
175
- scope: "global"
176
- });
177
- }
178
- /** Date must be between start and end dates */
179
- between(startDate, endDate, errorMessage) {
180
- return this.addRule(betweenDatesRule, errorMessage, {
181
- startDate,
182
- endDate
183
- });
184
- }
185
- /** Date must be exactly today */
186
- today(errorMessage) {
187
- return this.addRule(todayRule, errorMessage);
188
- }
189
- /** Date must be today or in the future */
190
- fromToday(errorMessage) {
191
- return this.addRule(fromTodayRule, errorMessage);
192
- }
193
- /** Date must be before today */
194
- beforeToday(errorMessage) {
195
- return this.addRule(beforeTodayRule, errorMessage);
196
- }
197
- /** Date must be after today (not including today) */
198
- afterToday(errorMessage) {
199
- return this.addRule(afterTodayRule, errorMessage);
200
- }
201
- /** Date must be in the past */
202
- past(errorMessage) {
203
- return this.addRule(pastRule, errorMessage);
204
- }
205
- /** Date must be in the future */
206
- future(errorMessage) {
207
- return this.addRule(futureRule, errorMessage);
208
- }
209
- /**
210
- * Date must be >= sibling field value (inclusive)
211
- * @category Validation Rule
212
- */
213
- minSibling(field, errorMessage) {
214
- return this.addRule(minDateRule, errorMessage, {
215
- dateOrField: field,
216
- scope: "sibling"
217
- });
218
- }
219
- /**
220
- * Date must be <= sibling field value (inclusive)
221
- * @category Validation Rule
222
- */
223
- maxSibling(field, errorMessage) {
224
- return this.addRule(maxDateRule, errorMessage, {
225
- dateOrField: field,
226
- scope: "sibling"
227
- });
228
- }
229
- /**
230
- * Date must be < sibling field value (exclusive)
231
- * @category Validation Rule
232
- */
233
- beforeSibling(field, errorMessage) {
234
- return this.addRule(beforeFieldRule, errorMessage, {
235
- dateOrField: field,
236
- scope: "sibling"
237
- });
238
- }
239
- /**
240
- * Date must be > sibling field value (exclusive)
241
- * @category Validation Rule
242
- */
243
- afterSibling(field, errorMessage) {
244
- return this.addRule(afterFieldRule, errorMessage, {
245
- dateOrField: field,
246
- scope: "sibling"
247
- });
248
- }
249
- /** Date must be the same as another field's date */
250
- sameAsField(field, errorMessage) {
251
- return this.addRule(sameAsFieldDateRule, errorMessage, {
252
- field,
253
- scope: "global"
254
- });
255
- }
256
- /** Date must be the same as another sibling field's date */
257
- sameAsFieldSibling(field, errorMessage) {
258
- return this.addRule(sameAsFieldDateRule, errorMessage, {
259
- field,
260
- scope: "sibling"
261
- });
262
- }
263
- /** Time must be from specific hour onwards (0-23) */
264
- fromHour(hour, errorMessage) {
265
- return this.addRule(fromHourRule, errorMessage, { hour });
266
- }
267
- /** Time must be before specific hour (0-23) */
268
- beforeHour(hour, errorMessage) {
269
- return this.addRule(beforeHourRule, errorMessage, { hour });
270
- }
271
- /** Time must be between start and end hours (0-23) */
272
- betweenHours(startHour, endHour, errorMessage) {
273
- return this.addRule(betweenHoursRule, errorMessage, {
274
- startHour,
275
- endHour
276
- });
277
- }
278
- /** Time must be from specific minute onwards (0-59) */
279
- fromMinute(minute, errorMessage) {
280
- return this.addRule(fromMinuteRule, errorMessage, { minute });
281
- }
282
- /** Time must be before specific minute (0-59) */
283
- beforeMinute(minute, errorMessage) {
284
- return this.addRule(beforeMinuteRule, errorMessage, { minute });
285
- }
286
- /** Time must be between start and end minutes (0-59) */
287
- betweenMinutes(startMinute, endMinute, errorMessage) {
288
- return this.addRule(betweenMinutesRule, errorMessage, {
289
- startMinute,
290
- endMinute
291
- });
292
- }
293
- /** Time must be between start and end times (HH:MM format) */
294
- betweenTimes(startTime, endTime, errorMessage) {
295
- return this.addRule(betweenTimesRule, errorMessage, {
296
- startTime,
297
- endTime
298
- });
299
- }
300
- /** Age must be exactly the given years */
301
- age(years, errorMessage) {
302
- return this.addRule(ageRule, errorMessage, { years });
303
- }
304
- /** Minimum age requirement */
305
- minAge(years, errorMessage) {
306
- return this.addRule(minAgeRule, errorMessage, { years });
307
- }
308
- /** Maximum age requirement */
309
- maxAge(years, errorMessage) {
310
- return this.addRule(maxAgeRule, errorMessage, { years });
311
- }
312
- /** Age must be between min and max years */
313
- betweenAge(minAge, maxAge, errorMessage) {
314
- return this.addRule(betweenAgeRule, errorMessage, {
315
- minAge,
316
- maxAge
317
- });
318
- }
319
- /** Date must be specific weekday */
320
- weekDay(day, errorMessage) {
321
- return this.addRule(weekDayRule, errorMessage, { day });
322
- }
323
- /** Date must be one of specified weekdays */
324
- weekdays(days, errorMessage) {
325
- return this.addRule(weekdaysRule, errorMessage, { days });
326
- }
327
- /** Date must be a weekend (Saturday or Sunday) */
328
- weekend(errorMessage) {
329
- return this.addRule(weekendRule, errorMessage);
330
- }
331
- /** Date must be a business day (Monday-Friday) */
332
- businessDay(errorMessage) {
333
- return this.addRule(businessDayRule, errorMessage);
334
- }
335
- /** Date must match specific format */
336
- format(format, errorMessage) {
337
- return this.addRule(dateRule, errorMessage, { format });
338
- }
339
- /** Date must be within X days from now (past or future) */
340
- withinDays(days, errorMessage) {
341
- return this.addRule(withinDaysRule, errorMessage, { days });
342
- }
343
- /** Date must be within X days in the past */
344
- withinPastDays(days, errorMessage) {
345
- return this.addRule(withinPastDaysRule, errorMessage, { days });
346
- }
347
- /** Date must be within X days in the future */
348
- withinFutureDays(days, errorMessage) {
349
- return this.addRule(withinFutureDaysRule, errorMessage, { days });
350
- }
351
- /** Date must be in specific month (1-12) */
352
- month(month, errorMessage) {
353
- return this.addRule(monthRule, errorMessage, { month });
354
- }
355
- /** Date must be in specific year */
356
- year(year, errorMessage) {
357
- return this.addRule(yearRule, errorMessage, { year });
358
- }
359
- /**
360
- * Date must be between start and end years
361
- * Smart detection: number or field name
362
- *
363
- * @category Validation Rule
364
- */
365
- betweenYears(startYear, endYear, errorMessage) {
366
- return this.addRule(betweenYearsRule, errorMessage, {
367
- startYear,
368
- endYear,
369
- scope: "global"
370
- });
371
- }
372
- /**
373
- * Date must be between start and end months (1-12)
374
- * Smart detection: number or field name
375
- *
376
- * @category Validation Rule
377
- */
378
- betweenMonths(startMonth, endMonth, errorMessage) {
379
- return this.addRule(betweenMonthsRule, errorMessage, {
380
- startMonth,
381
- endMonth,
382
- scope: "global"
383
- });
384
- }
385
- /**
386
- * Date must be between start and end days (1-31)
387
- * Smart detection: number or field name
388
- *
389
- * @category Validation Rule
390
- */
391
- betweenDays(startDay, endDay, errorMessage) {
392
- return this.addRule(betweenDaysRule, errorMessage, {
393
- startDay,
394
- endDay,
395
- scope: "global"
396
- });
397
- }
398
- /**
399
- * Date must be between sibling field years
400
- * @category Validation Rule
401
- */
402
- betweenYearsSibling(startYearField, endYearField, errorMessage) {
403
- return this.addRule(betweenYearsRule, errorMessage, {
404
- startYear: startYearField,
405
- endYear: endYearField,
406
- scope: "sibling"
407
- });
408
- }
409
- /**
410
- * Date must be between sibling field months
411
- * @category Validation Rule
412
- */
413
- betweenMonthsSibling(startMonthField, endMonthField, errorMessage) {
414
- return this.addRule(betweenMonthsRule, errorMessage, {
415
- startMonth: startMonthField,
416
- endMonth: endMonthField,
417
- scope: "sibling"
418
- });
419
- }
420
- /**
421
- * Date must be between sibling field days
422
- * @category Validation Rule
423
- */
424
- betweenDaysSibling(startDayField, endDayField, errorMessage) {
425
- return this.addRule(betweenDaysRule, errorMessage, {
426
- startDay: startDayField,
427
- endDay: endDayField,
428
- scope: "sibling"
429
- });
430
- }
431
- /**
432
- * Year must be >= given year or field
433
- * Smart detection: number or field name
434
- *
435
- * @example
436
- * ```ts
437
- * // Value comparison
438
- * v.date().minYear(2024)
439
- *
440
- * // Field comparison
441
- * v.date().minYear('startYear')
442
- * ```
443
- *
444
- * @category Validation Rule
445
- */
446
- minYear(yearOrField, errorMessage) {
447
- return this.addRule(minYearRule, errorMessage, {
448
- yearOrField,
449
- scope: "global"
450
- });
451
- }
452
- /**
453
- * Year must be <= given year or field
454
- * Smart detection: number or field name
455
- *
456
- * @category Validation Rule
457
- */
458
- maxYear(yearOrField, errorMessage) {
459
- return this.addRule(maxYearRule, errorMessage, {
460
- yearOrField,
461
- scope: "global"
462
- });
463
- }
464
- /**
465
- * Month must be >= given month or field (1-12)
466
- * Smart detection: number or field name
467
- *
468
- * @category Validation Rule
469
- */
470
- minMonth(monthOrField, errorMessage) {
471
- return this.addRule(minMonthRule, errorMessage, {
472
- monthOrField,
473
- scope: "global"
474
- });
475
- }
476
- /**
477
- * Month must be <= given month or field (1-12)
478
- * Smart detection: number or field name
479
- *
480
- * @category Validation Rule
481
- */
482
- maxMonth(monthOrField, errorMessage) {
483
- return this.addRule(maxMonthRule, errorMessage, {
484
- monthOrField,
485
- scope: "global"
486
- });
487
- }
488
- /**
489
- * Day must be >= given day or field (1-31)
490
- * Smart detection: number or field name
491
- *
492
- * @category Validation Rule
493
- */
494
- minDay(dayOrField, errorMessage) {
495
- return this.addRule(minDayRule, errorMessage, {
496
- dayOrField,
497
- scope: "global"
498
- });
499
- }
500
- /**
501
- * Day must be <= given day or field (1-31)
502
- * Smart detection: number or field name
503
- *
504
- * @category Validation Rule
505
- */
506
- maxDay(dayOrField, errorMessage) {
507
- return this.addRule(maxDayRule, errorMessage, {
508
- dayOrField,
509
- scope: "global"
510
- });
511
- }
512
- /**
513
- * Year must be >= sibling field year
514
- * @category Validation Rule
515
- */
516
- minYearSibling(field, errorMessage) {
517
- return this.addRule(minYearRule, errorMessage, {
518
- yearOrField: field,
519
- scope: "sibling"
520
- });
521
- }
522
- /**
523
- * Year must be <= sibling field year
524
- * @category Validation Rule
525
- */
526
- maxYearSibling(field, errorMessage) {
527
- return this.addRule(maxYearRule, errorMessage, {
528
- yearOrField: field,
529
- scope: "sibling"
530
- });
531
- }
532
- /**
533
- * Month must be >= sibling field month
534
- * @category Validation Rule
535
- */
536
- minMonthSibling(field, errorMessage) {
537
- return this.addRule(minMonthRule, errorMessage, {
538
- monthOrField: field,
539
- scope: "sibling"
540
- });
541
- }
542
- /**
543
- * Month must be <= sibling field month
544
- * @category Validation Rule
545
- */
546
- maxMonthSibling(field, errorMessage) {
547
- return this.addRule(maxMonthRule, errorMessage, {
548
- monthOrField: field,
549
- scope: "sibling"
550
- });
551
- }
552
- /**
553
- * Day must be >= sibling field day
554
- * @category Validation Rule
555
- */
556
- minDaySibling(field, errorMessage) {
557
- return this.addRule(minDayRule, errorMessage, {
558
- dayOrField: field,
559
- scope: "sibling"
560
- });
561
- }
562
- /**
563
- * Day must be <= sibling field day
564
- * @category Validation Rule
565
- */
566
- maxDaySibling(field, errorMessage) {
567
- return this.addRule(maxDayRule, errorMessage, {
568
- dayOrField: field,
569
- scope: "sibling"
570
- });
571
- }
572
- /** Date must be in specific quarter (1-4) */
573
- quarter(quarter, errorMessage) {
574
- return this.addRule(quarterRule, errorMessage, { quarter });
575
- }
576
- /** Valid birthday (not in future, reasonable age) */
577
- birthday(minAge, maxAge, errorMessage) {
578
- return this.addRule(birthdayRule, errorMessage, {
579
- minAge,
580
- maxAge
581
- });
582
- }
583
- /** Date must be in a leap year */
584
- leapYear(errorMessage) {
585
- return this.addRule(leapYearRule, errorMessage);
586
- }
587
- /**
588
- * Set default value as current time of exeuction
589
- */
590
- defaultNow() {
591
- return this.default(() => /* @__PURE__ */ new Date());
592
- }
593
- /**
594
- * @inheritdoc
595
- *
596
- * Maps DateValidator to JSON Schema format keywords.
597
- * Default is `date-time`. If `.toDateOnly()` or `.toTimeOnly()` are used,
598
- * falls back to `date` or `time` formats respectively.
599
- *
600
- * @example
601
- * ```ts
602
- * v.date().toJsonSchema("draft-2020-12")
603
- * // → { type: "string", format: "date-time" }
604
- *
605
- * v.date().toDateOnly().toJsonSchema("draft-2020-12")
606
- * // → { type: "string", format: "date" }
607
- * ```
608
- */
609
- toJsonSchema(target = "draft-2020-12") {
610
- const schema = {
611
- type: "string",
612
- format: "date-time"
613
- };
614
- const dateOpts = getRuleOptions(this.rules, "date");
615
- if (dateOpts?.format === "YYYY-MM-DD") schema.format = "date";
616
- else if (dateOpts?.format === "HH:mm:ss") schema.format = "time";
617
- if (schema.format === "date-time") for (const t of this.dataTransformers) {
618
- const hint = t.options?.__jsonSchemaFormat;
619
- if (hint === "date" || hint === "time") {
620
- schema.format = hint;
621
- break;
622
- }
623
- const userFormat = t.options?.format;
624
- if (userFormat === "YYYY-MM-DD") {
625
- schema.format = "date";
626
- break;
627
- }
628
- if (userFormat === "HH:mm:ss") {
629
- schema.format = "time";
630
- break;
631
- }
632
- }
633
- if (this.isNullable) applyNullable(schema, target);
634
- return schema;
635
- }
636
- };
637
-
638
- //#endregion
639
- export { DateValidator };
640
- //# sourceMappingURL=date-validator.mjs.map