@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
@@ -32,10 +32,14 @@
32
32
  * Every key is optional; `resolveColumnMap` fills the defaults. Values are the
33
33
  * app's real column names (rename-friendly: `readAt: "seen_at"`).
34
34
  */
35
- type NotificationColumnMap = {
36
- /** Recipient FK column. Default: `"user_id"`. */recipient?: string; /** Multi-tenant scope column, written from the recipient. Omit → single-tenant. */
37
- tenant?: string; /** Read-timestamp column. Present → read-state records "when". */
38
- readAt?: string; /** Read-flag column (indexed → fast unread filter). Present → read-state is a boolean. */
35
+ export type NotificationColumnMap = {
36
+ /** Recipient FK column. Default: `"user_id"`. */
37
+ recipient?: string;
38
+ /** Multi-tenant scope column, written from the recipient. Omit → single-tenant. */
39
+ tenant?: string;
40
+ /** Read-timestamp column. Present → read-state records "when". */
41
+ readAt?: string;
42
+ /** Read-flag column (indexed → fast unread filter). Present → read-state is a boolean. */
39
43
  isRead?: string;
40
44
  };
41
45
  /**
@@ -43,14 +47,14 @@ type NotificationColumnMap = {
43
47
  * set, and at least one of `readAt` / `isRead` is always present (the resolver
44
48
  * falls back to `readAt`), so consumers never face a "no read-state" map.
45
49
  */
46
- type ResolvedNotificationColumnMap = {
50
+ export type ResolvedNotificationColumnMap = {
47
51
  recipient: string;
48
52
  tenant?: string;
49
53
  readAt?: string;
50
54
  isRead?: string;
51
55
  };
52
56
  /** A model class that may carry the `columnMap` static. */
53
- type NotificationColumnMapHost = {
57
+ export type NotificationColumnMapHost = {
54
58
  columnMap?: NotificationColumnMap;
55
59
  };
56
60
  /**
@@ -59,7 +63,6 @@ type NotificationColumnMapHost = {
59
63
  * declares no read-state column. The fallback guarantees the result always
60
64
  * has a usable read-state representation, so no boot-time validation is needed.
61
65
  */
62
- declare function resolveColumnMap(map: NotificationColumnMap | undefined): ResolvedNotificationColumnMap;
66
+ export declare function resolveColumnMap(map: NotificationColumnMap | undefined): ResolvedNotificationColumnMap;
63
67
  //#endregion
64
- export { NotificationColumnMap, NotificationColumnMapHost, ResolvedNotificationColumnMap, resolveColumnMap };
65
68
  //# sourceMappingURL=column-map.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"column-map.d.mts","names":[],"sources":["../../../../../../../../packages/notifications/src/in-app/column-map.ts"],"mappings":";;AAkCA;;;;;;;;;AAQQ;AAQR;;;;;;;;;AAIQ;AAIR;;;;AACmC;AAYnC;;;;;;;KArCY,qBAAA;EAuCoB,iDArC9B,SAAA;EAEA,MAAA;EAEA,MAAA;EAEA,MAAA;AAAA;;;;;;KAQU,6BAAA;EACV,SAAA;EACA,MAAA;EACA,MAAA;EACA,MAAA;AAAA;;KAIU,yBAAA;EACV,SAAA,GAAY,qBAAqB;AAAA;;;;;;;iBAYnB,gBAAA,CACd,GAAA,EAAK,qBAAA,eACJ,6BAA6B"}
1
+ {"version":3,"file":"column-map.d.mts","names":[],"sources":["../../../../../../../../packages/notifications/src/in-app/column-map.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAkCY;;EAEV;;EAEA;;EAEA;;EAEA;;;;;;;YAQU;EACV;EACA;EACA;EACA;;;YAIU;EACV,YAAY;;;;;;;;wBAYE,iBACd,KAAK,oCACJ"}
@@ -1,10 +1,10 @@
1
1
  import { Id } from "../types.mjs";
2
2
  import { NotificationContract } from "../contracts/notification.contract.mjs";
3
+ import "../contracts/index.mjs";
3
4
  import { NotificationColumnMap, ResolvedNotificationColumnMap } from "./column-map.mjs";
4
5
  import { Model } from "@warlock.js/cascade";
5
-
6
6
  //#region ../../packages/notifications/src/in-app/database-notification.d.ts
7
- declare abstract class DatabaseNotification extends Model implements NotificationContract {
7
+ export declare abstract class DatabaseNotification extends Model implements NotificationContract {
8
8
  /**
9
9
  * Physical column bindings for THIS model's table. Override in the subclass;
10
10
  * the empty default resolves to `{ recipient: "user_id", readAt: "read_at" }`.
@@ -26,5 +26,4 @@ declare abstract class DatabaseNotification extends Model implements Notificatio
26
26
  markRead(): Promise<void>;
27
27
  }
28
28
  //#endregion
29
- export { DatabaseNotification };
30
29
  //# sourceMappingURL=database-notification.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"database-notification.d.mts","names":[],"sources":["../../../../../../../../packages/notifications/src/in-app/database-notification.ts"],"mappings":";;;;;;uBA6BsB,oBAAA,SAA6B,KAAA,YAAiB,oBAAA;EAQzC;;;;EAAA,OAHX,SAAA,EAAW,qBAAA;EAiBd;EAAA,cAdG,OAAA,IAAW,6BAAA;EAAA,IAId,WAAA,IAAe,EAAA;EAwBL;EAAA,IAnBV,QAAA,IAAY,EAAA;EAAA,IAKZ,IAAA;EAAA,IAIA,MAAA;EAAA,IAUA,MAAA,IAAU,IAAA;;;;;;EAUR,QAAA,IAAY,OAAA;AAAA"}
1
+ {"version":3,"file":"database-notification.d.mts","names":[],"sources":["../../../../../../../../packages/notifications/src/in-app/database-notification.ts"],"mappings":";;;;;;8BA6BsB,6BAA6B,iBAAiB;;;;;SAKpD,WAAW;;gBAGX,WAAW;MAId,eAAe;;MAKf,YAAY;MAKZ;MAIA;MAUA,UAAU;;;;;;EAUR,YAAY"}
@@ -1,22 +1,23 @@
1
1
  import { DatabasePayload, Id, Notifiable } from "../types.mjs";
2
2
  import { Channel } from "../contracts/channel.contract.mjs";
3
3
  import { NotificationContract } from "../contracts/notification.contract.mjs";
4
+ import "../contracts/index.mjs";
4
5
  import { BaseNotificationsRepository, NotificationModelClass, NotificationsFilter } from "./base-notifications-repository.mjs";
6
+ import "../index.mjs";
5
7
  import { TypedRepositoryOptionsWithPages } from "@warlock.js/core";
6
-
7
8
  //#region ../../packages/notifications/src/in-app/in-app.d.ts
8
9
  /**
9
10
  * List options for the read methods — the repository's paginated options
10
11
  * (`page` / `limit` / `orderBy` / filter keys). `recipientId` is always forced
11
12
  * from the recipient argument, so passing it here has no effect.
12
13
  */
13
- type NotificationsListOptions = TypedRepositoryOptionsWithPages<NotificationsFilter>;
14
+ export type NotificationsListOptions = TypedRepositoryOptionsWithPages<NotificationsFilter>;
14
15
  /**
15
16
  * Configure options — discriminated so `model` and `repository` are mutually
16
17
  * exclusive at the type level. Future knobs (cache / realtime / naming) slot
17
18
  * in here without breaking the signature.
18
19
  */
19
- type ConfigureOptions = {
20
+ export type ConfigureOptions = {
20
21
  model: NotificationModelClass;
21
22
  repository?: never;
22
23
  } | {
@@ -50,7 +51,7 @@ declare class InApp {
50
51
  dismiss(recipient: Notifiable | Id, id?: Id): Promise<number>;
51
52
  }
52
53
  /** Single in-app facade — bound at boot via `inApp.configure(...)`. */
53
- declare const inApp: InApp;
54
+ export declare const inApp: InApp;
54
55
  //#endregion
55
- export { ConfigureOptions, NotificationsListOptions, inApp };
56
+ export {};
56
57
  //# sourceMappingURL=in-app.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"in-app.d.mts","names":[],"sources":["../../../../../../../../packages/notifications/src/in-app/in-app.ts"],"mappings":";;;;;;;;;;;;KA4CY,wBAAA,GAA2B,+BAA+B,CAAC,mBAAA;;;;;;KAO3D,gBAAA;EACN,KAAA,EAAO,sBAAA;EAAwB,UAAA;AAAA;EAC/B,UAAA,EAAY,2BAA2B;EAAE,KAAA;AAAA;AAAA,cAKzC,KAAA;EAAA,QACI,IAAA;EAqDuB;;;;EA/CxB,SAAA,CAAU,OAAA,EAAS,gBAAA,GAAmB,OAAA,CAAQ,eAAA;EAAA,YAQzC,UAAA;EA4CoC;EAjCzC,IAAA,CAAK,SAAA,EAAW,UAAA,GAAa,EAAA,EAAI,OAAA,GAAU,wBAAA,GAAwB,OAAA,4BAAA,gBAAA,CAAA,oBAAA;EAiCxB;EA5B3C,UAAA,CAAW,SAAA,EAAW,UAAA,GAAa,EAAA,EAAI,OAAA,GAAU,wBAAA,GAAwB,OAAA,4BAAA,gBAAA,CAAA,oBAAA;EA9BxE;;;;EAsCD,WAAA,CAAY,SAAA,EAAW,UAAA,GAAa,EAAA,GAAE,OAAA;EAhCQ;EAqC9C,IAAA,CAAK,SAAA,EAAW,UAAA,GAAa,EAAA,EAAI,EAAA,EAAI,EAAA,GAAE,OAAA,CAAA,oBAAA;EAlBvC;EAuBA,UAAA,CAAW,SAAA,EAAW,UAAA,GAAa,EAAA,EAAI,EAAA,GAAK,EAAA,GAAE,OAAA;EAvBjB;EA4B7B,YAAA,CAAa,SAAA,EAAW,UAAA,GAAa,EAAA,EAAI,EAAA,GAAK,EAAA,GAAE,OAAA;EA5BL;EAiC3C,OAAA,CAAQ,SAAA,EAAW,UAAA,GAAa,EAAA,EAAI,EAAA,GAAK,EAAA,GAAE,OAAA;AAAA;;cAMvC,KAAA,EAAK,KAAc"}
1
+ {"version":3,"file":"in-app.d.mts","names":["_$__0.NotificationContract"],"sources":["../../../../../../../../packages/notifications/src/in-app/in-app.ts"],"mappings":";;;;;;;;;;;;;YA4CY,2BAA2B,gCAAgC;;;;;;YAO3D;EACN,OAAO;EAAwB;;EAC/B,YAAY;EAA6B;;cAKzC;UACI;;;;;EAMD,UAAU,SAAS,mBAAmB,QAAQ;cAQzC;;EAWL,KAAK,WAAW,aAAa,IAAI,UAAU,2BAAwB,mCAAA,iBAAxBA;;EAK3C,WAAW,WAAW,aAAa,IAAI,UAAU,2BAAwB,mCAAA,iBAAxBA;;;;;EAQjD,YAAY,WAAW,aAAa,KAAE;;EAKtC,KAAK,WAAW,aAAa,IAAI,IAAI,KAAE,QAAFA;;EAKrC,WAAW,WAAW,aAAa,IAAI,KAAK,KAAE;;EAK9C,aAAa,WAAW,aAAa,IAAI,KAAK,KAAE;;EAKhD,QAAQ,WAAW,aAAa,IAAI,KAAK,KAAE;;;qBAMvC,OAAK"}
@@ -1,4 +1,5 @@
1
1
  import { NotificationColumnMap, NotificationColumnMapHost, ResolvedNotificationColumnMap, resolveColumnMap } from "./column-map.mjs";
2
2
  import { DatabaseNotification } from "./database-notification.mjs";
3
3
  import { BaseNotificationsRepository, NotificationModelClass, NotificationsFilter } from "./base-notifications-repository.mjs";
4
- import { ConfigureOptions, NotificationsListOptions, inApp } from "./in-app.mjs";
4
+ import { ConfigureOptions, NotificationsListOptions, inApp } from "./in-app.mjs";
5
+ export { BaseNotificationsRepository, ConfigureOptions, DatabaseNotification, NotificationColumnMap, NotificationColumnMapHost, NotificationModelClass, NotificationsFilter, NotificationsListOptions, ResolvedNotificationColumnMap, inApp, resolveColumnMap };
@@ -3,4 +3,4 @@ import { BaseNotificationsRepository } from "./base-notifications-repository.mjs
3
3
  import { DatabaseNotification } from "./database-notification.mjs";
4
4
  import { inApp } from "./in-app.mjs";
5
5
 
6
- export { };
6
+ export { BaseNotificationsRepository, DatabaseNotification, inApp, resolveColumnMap };
package/esm/index.d.mts CHANGED
@@ -4,25 +4,31 @@ import { NotificationContract } from "./contracts/notification.contract.mjs";
4
4
  import { PreferenceProvider } from "./contracts/preference-provider.contract.mjs";
5
5
  import { QueueDispatcher } from "./contracts/queue-dispatcher.contract.mjs";
6
6
  import { RateLimiter } from "./contracts/rate-limiter.contract.mjs";
7
+ import "./contracts/index.mjs";
7
8
  import { ChannelNotFoundError, MissingRendererError, NoQueueDispatcherError, NotificationsNotConfiguredError, UnresolvableRouteError } from "./errors.mjs";
8
9
  import { ChannelMap, NotificationConfig, getNotificationConfig, resetNotificationConfig, setNotificationConfig } from "./config.mjs";
9
10
  import { defineChannel } from "./dispatch/define-channel.mjs";
10
11
  import { DefinedNotification, NotificationDef, defineNotification } from "./dispatch/define-notification.mjs";
11
12
  import { Notify, notify } from "./dispatch/notify.mjs";
12
13
  import { notifications } from "./dispatch/notifications-event-bus.mjs";
14
+ import "./dispatch/index.mjs";
13
15
  import { NotificationColumnMap, NotificationColumnMapHost, ResolvedNotificationColumnMap, resolveColumnMap } from "./in-app/column-map.mjs";
14
16
  import { DatabaseNotification } from "./in-app/database-notification.mjs";
15
17
  import { BaseNotificationsRepository, NotificationModelClass, NotificationsFilter } from "./in-app/base-notifications-repository.mjs";
16
18
  import { databaseChannel } from "./channels/database-channel.mjs";
17
19
  import { MailChannelConfig, mailChannel } from "./channels/mail-channel.mjs";
20
+ import "./channels/index.mjs";
18
21
  import { ConfigureOptions, NotificationsListOptions, inApp } from "./in-app/in-app.mjs";
22
+ import "./in-app/index.mjs";
19
23
  import { NotificationColumnsOptions, NotificationIdType, notificationColumns } from "./migration/notification-columns.mjs";
24
+ import "./migration/index.mjs";
20
25
  import { HeraldQueueOptions, heraldQueue } from "./queue/herald-queue.mjs";
21
26
  import { WorkerOptions, startNotificationsWorker } from "./queue/notifications-worker.mjs";
22
27
  import { DEFAULT_QUEUE_CHANNEL } from "./queue/load-herald.mjs";
23
28
  import { BullmqQueueOptions, NOTIFICATION_JOB_NAME, bullmqQueue } from "./queue/bullmq-queue.mjs";
24
29
  import { QueuePackageLoader, loadQueuePackage } from "./queue/load-queue.mjs";
25
30
  import { QueuePackageNotInstalledError } from "./queue/queue-package-not-installed.error.mjs";
31
+ import "./queue/index.mjs";
26
32
  export { BaseNotificationsRepository, BullmqQueueOptions, Channel, ChannelMap, ChannelName, ChannelNotFoundError, ConfigureOptions, DEFAULT_QUEUE_CHANNEL, DatabaseNotification, DatabasePayload, DefinedNotification, HeraldQueueOptions, Id, MailChannelConfig, MailPayload, MissingRendererError, NOTIFICATION_JOB_NAME, NoQueueDispatcherError, Notifiable, NotificationChannels, NotificationColumnMap, NotificationColumnMapHost, NotificationColumnsOptions, NotificationConfig, NotificationContract, NotificationDef, NotificationEvents, NotificationIdType, NotificationInput, NotificationModelClass, NotificationsFilter, NotificationsListOptions, NotificationsNotConfiguredError, Notify, PreferenceProvider, QueueDispatcher, type QueuePackageLoader, QueuePackageNotInstalledError, RateLimiter, RenderContext, ResolvedNotificationColumnMap, SendOptions, UnresolvableRouteError, WorkerOptions, bullmqQueue, databaseChannel, defineChannel, defineNotification, getNotificationConfig, heraldQueue, inApp, loadQueuePackage, mailChannel, notificationColumns, notifications, notify, resetNotificationConfig, resolveColumnMap, setNotificationConfig, startNotificationsWorker };
27
33
  import "./dispatch/define-channel.mjs";
28
34
  import "./types.mjs";
@@ -1 +1,2 @@
1
- import { NotificationColumnsOptions, NotificationIdType, notificationColumns } from "./notification-columns.mjs";
1
+ import { NotificationColumnsOptions, NotificationIdType, notificationColumns } from "./notification-columns.mjs";
2
+ export { NotificationColumnsOptions, NotificationIdType, notificationColumns };
@@ -1,3 +1,3 @@
1
1
  import { notificationColumns } from "./notification-columns.mjs";
2
2
 
3
- export { };
3
+ export { notificationColumns };
@@ -1,18 +1,17 @@
1
1
  import { NotificationColumnMapHost } from "../in-app/column-map.mjs";
2
2
  import { ColumnMap } from "@warlock.js/cascade";
3
-
4
3
  //#region ../../packages/notifications/src/migration/notification-columns.d.ts
5
- type NotificationIdType = "uuid" | "bigint" | "integer" | "string";
6
- type NotificationColumnsOptions = {
7
- /** The type used for recipient and tenant identifiers. Defaults to UUID. */idType?: NotificationIdType;
4
+ export type NotificationIdType = "uuid" | "bigint" | "integer" | "string";
5
+ export type NotificationColumnsOptions = {
6
+ /** The type used for recipient and tenant identifiers. Defaults to UUID. */
7
+ idType?: NotificationIdType;
8
8
  };
9
9
  /**
10
10
  * Returns the column map for a notification table, named from the model's
11
11
  * `columnMap`. Without a model, falls back to the resolved defaults
12
12
  * (`user_id` recipient + `read_at` read-state).
13
13
  */
14
- declare function notificationColumns(options?: NotificationColumnsOptions): ColumnMap;
15
- declare function notificationColumns(model?: NotificationColumnMapHost, options?: NotificationColumnsOptions): ColumnMap;
14
+ export declare function notificationColumns(options?: NotificationColumnsOptions): ColumnMap;
15
+ export declare function notificationColumns(model?: NotificationColumnMapHost, options?: NotificationColumnsOptions): ColumnMap;
16
16
  //#endregion
17
- export { NotificationColumnsOptions, NotificationIdType, notificationColumns };
18
17
  //# sourceMappingURL=notification-columns.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"notification-columns.d.mts","names":[],"sources":["../../../../../../../../packages/notifications/src/migration/notification-columns.ts"],"mappings":";;;;KA4BY,kBAAA;AAAA,KAEA,0BAAA;EAW2G,4EATrH,MAAA,GAAS,kBAAkB;AAAA;;;;;;iBAQb,mBAAA,CAAoB,OAAA,GAAU,0BAAA,GAA6B,SAAS;AAAA,iBACpE,mBAAA,CAAoB,KAAA,GAAQ,yBAAA,EAA2B,OAAA,GAAU,0BAAA,GAA6B,SAAA"}
1
+ {"version":3,"file":"notification-columns.d.mts","names":[],"sources":["../../../../../../../../packages/notifications/src/migration/notification-columns.ts"],"mappings":";;;YAsCY;YAEA;;EAEV,SAAS;;;;;;;wBAQK,oBAAoB,UAAU,6BAA6B;wBAC3D,oBACd,QAAQ,2BACR,UAAU,6BACT"}
@@ -1 +1 @@
1
- {"version":3,"file":"notification-columns.mjs","names":[],"sources":["../../../../../../../../packages/notifications/src/migration/notification-columns.ts"],"sourcesContent":["/**\n * Column factory for the notifications table, driven by the model's\n * `columnMap`. The recipient / read-state / tenant columns take the NAMES the\n * model declares, so the table, the repository, and the model accessors all\n * agree by construction. The stable lexical columns (`type`, `title`, `body`,\n * `payload`, `idempotency_key`) keep fixed names.\n *\n * Read-state follows the map's presence rules (see `NotificationColumnMap`):\n * `readAt` → a nullable timestamp, `isRead` → an indexed boolean, both → both.\n *\n * Spread + extend for app-specific extras (FK references, composite indexes).\n *\n * @example\n * import { Migration } from \"@warlock.js/cascade\";\n * import { notificationColumns } from \"@warlock.js/notifications\";\n * import { Notification } from \"../notification.model\";\n *\n * export default Migration.create(Notification, notificationColumns(Notification));\n *\n * @example // with extras (multi-tenant FK)\n * export default Migration.create(Notification, {\n * ...notificationColumns(Notification),\n * organization_id: uuid().references(Organization.table).notNullable(),\n * });\n */\nimport { bigInteger, boolCol, type ColumnMap, integer, json, string, text, timestamp, uuid } from \"@warlock.js/cascade\";\nimport { type NotificationColumnMapHost, resolveColumnMap } from \"../in-app/column-map\";\n\nexport type NotificationIdType = \"uuid\" | \"bigint\" | \"integer\" | \"string\";\n\nexport type NotificationColumnsOptions = {\n /** The type used for recipient and tenant identifiers. Defaults to UUID. */\n idType?: NotificationIdType;\n};\n\n/**\n * Returns the column map for a notification table, named from the model's\n * `columnMap`. Without a model, falls back to the resolved defaults\n * (`user_id` recipient + `read_at` read-state).\n */\nexport function notificationColumns(options?: NotificationColumnsOptions): ColumnMap;\nexport function notificationColumns(model?: NotificationColumnMapHost, options?: NotificationColumnsOptions): ColumnMap;\nexport function notificationColumns(\n modelOrOptions?: NotificationColumnMapHost | NotificationColumnsOptions,\n options?: NotificationColumnsOptions,\n): ColumnMap {\n const model = isNotificationColumnsOptions(modelOrOptions) ? undefined : modelOrOptions;\n const idType = (isNotificationColumnsOptions(modelOrOptions) ? modelOrOptions : options)?.idType ?? \"uuid\";\n const { recipient, tenant, readAt, isRead } = resolveColumnMap(model?.columnMap);\n const idColumn = getIdColumn(idType);\n\n const columns: ColumnMap = {\n [recipient]: idColumn().index().notNullable(),\n type: string().index().notNullable(),\n title: string().notNullable(),\n body: text().nullable(),\n payload: json().nullable(),\n };\n\n if (readAt) {\n columns[readAt] = timestamp().nullable();\n }\n\n if (isRead) {\n columns[isRead] = boolCol().default(false).index();\n }\n\n if (tenant) {\n columns[tenant] = idColumn().index().notNullable();\n }\n\n // Unique so a retried send can't insert a duplicate. Nullable: most rows\n // have no key (NULLs are distinct in a unique index). `createFor` does\n // find-or-create; this constraint is the race backstop.\n columns.idempotency_key = string().nullable().unique();\n\n return columns;\n}\n\nfunction isNotificationColumnsOptions(\n value: NotificationColumnMapHost | NotificationColumnsOptions | undefined,\n): value is NotificationColumnsOptions {\n return \"idType\" in (value ?? {});\n}\n\nfunction getIdColumn(idType: NotificationIdType) {\n switch (idType) {\n case \"bigint\":\n return bigInteger;\n case \"integer\":\n return integer;\n case \"string\":\n return string;\n default:\n return uuid;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0CA,SAAgB,oBACd,gBACA,SACW;CACX,MAAM,QAAQ,6BAA6B,cAAc,IAAI,SAAY;CACzE,MAAM,UAAU,6BAA6B,cAAc,IAAI,iBAAiB,QAAO,EAAG,UAAU;CACpG,MAAM,EAAE,WAAW,QAAQ,QAAQ,WAAW,iBAAiB,OAAO,SAAS;CAC/E,MAAM,WAAW,YAAY,MAAM;CAEnC,MAAM,UAAqB;GACxB,YAAY,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC,YAAY;EAC5C,MAAM,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,YAAY;EACnC,OAAO,OAAO,CAAC,CAAC,YAAY;EAC5B,MAAM,KAAK,CAAC,CAAC,SAAS;EACtB,SAAS,KAAK,CAAC,CAAC,SAAS;CAC3B;CAEA,IAAI,QACF,QAAQ,UAAU,UAAU,CAAC,CAAC,SAAS;CAGzC,IAAI,QACF,QAAQ,UAAU,QAAQ,CAAC,CAAC,QAAQ,KAAK,CAAC,CAAC,MAAM;CAGnD,IAAI,QACF,QAAQ,UAAU,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC,YAAY;CAMnD,QAAQ,kBAAkB,OAAO,CAAC,CAAC,SAAS,CAAC,CAAC,OAAO;CAErD,OAAO;AACT;AAEA,SAAS,6BACP,OACqC;CACrC,OAAO,aAAa,SAAS,CAAC;AAChC;AAEA,SAAS,YAAY,QAA4B;CAC/C,QAAQ,QAAR;EACE,KAAK,UACH,OAAO;EACT,KAAK,WACH,OAAO;EACT,KAAK,UACH,OAAO;EACT,SACE,OAAO;CACX;AACF"}
1
+ {"version":3,"file":"notification-columns.mjs","names":[],"sources":["../../../../../../../../packages/notifications/src/migration/notification-columns.ts"],"sourcesContent":["/**\n * Column factory for the notifications table, driven by the model's\n * `columnMap`. The recipient / read-state / tenant columns take the NAMES the\n * model declares, so the table, the repository, and the model accessors all\n * agree by construction. The stable lexical columns (`type`, `title`, `body`,\n * `payload`, `idempotency_key`) keep fixed names.\n *\n * Read-state follows the map's presence rules (see `NotificationColumnMap`):\n * `readAt` → a nullable timestamp, `isRead` → an indexed boolean, both → both.\n *\n * Spread + extend for app-specific extras (FK references, composite indexes).\n *\n * @example\n * import { Migration } from \"@warlock.js/cascade\";\n * import { notificationColumns } from \"@warlock.js/notifications\";\n * import { Notification } from \"../notification.model\";\n *\n * export default Migration.create(Notification, notificationColumns(Notification));\n *\n * @example // with extras (multi-tenant FK)\n * export default Migration.create(Notification, {\n * ...notificationColumns(Notification),\n * organization_id: uuid().references(Organization.table).notNullable(),\n * });\n */\nimport {\n bigInteger,\n boolCol,\n type ColumnMap,\n integer,\n json,\n string,\n text,\n timestamp,\n uuid,\n} from \"@warlock.js/cascade\";\nimport { type NotificationColumnMapHost, resolveColumnMap } from \"../in-app/column-map\";\n\nexport type NotificationIdType = \"uuid\" | \"bigint\" | \"integer\" | \"string\";\n\nexport type NotificationColumnsOptions = {\n /** The type used for recipient and tenant identifiers. Defaults to UUID. */\n idType?: NotificationIdType;\n};\n\n/**\n * Returns the column map for a notification table, named from the model's\n * `columnMap`. Without a model, falls back to the resolved defaults\n * (`user_id` recipient + `read_at` read-state).\n */\nexport function notificationColumns(options?: NotificationColumnsOptions): ColumnMap;\nexport function notificationColumns(\n model?: NotificationColumnMapHost,\n options?: NotificationColumnsOptions,\n): ColumnMap;\nexport function notificationColumns(\n modelOrOptions?: NotificationColumnMapHost | NotificationColumnsOptions,\n options?: NotificationColumnsOptions,\n): ColumnMap {\n const model = isNotificationColumnsOptions(modelOrOptions) ? undefined : modelOrOptions;\n const idType =\n (isNotificationColumnsOptions(modelOrOptions) ? modelOrOptions : options)?.idType ?? \"uuid\";\n const { recipient, tenant, readAt, isRead } = resolveColumnMap(model?.columnMap);\n const idColumn = getIdColumn(idType);\n\n const columns: ColumnMap = {\n [recipient]: idColumn().index().notNullable(),\n type: string().index().notNullable(),\n title: string().notNullable(),\n body: text().nullable(),\n payload: json().nullable(),\n };\n\n if (readAt) {\n columns[readAt] = timestamp().nullable();\n }\n\n if (isRead) {\n columns[isRead] = boolCol().default(false).index();\n }\n\n if (tenant) {\n columns[tenant] = idColumn().index().notNullable();\n }\n\n // Unique so a retried send can't insert a duplicate. Nullable: most rows\n // have no key (NULLs are distinct in a unique index). `createFor` does\n // find-or-create; this constraint is the race backstop.\n columns.idempotency_key = string().nullable().unique();\n\n return columns;\n}\n\nfunction isNotificationColumnsOptions(\n value: NotificationColumnMapHost | NotificationColumnsOptions | undefined,\n): value is NotificationColumnsOptions {\n return \"idType\" in (value ?? {});\n}\n\nfunction getIdColumn(idType: NotificationIdType) {\n switch (idType) {\n case \"bigint\":\n return bigInteger;\n case \"integer\":\n return integer;\n case \"string\":\n return string;\n default:\n return uuid;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuDA,SAAgB,oBACd,gBACA,SACW;CACX,MAAM,QAAQ,6BAA6B,cAAc,IAAI,SAAY;CACzE,MAAM,UACH,6BAA6B,cAAc,IAAI,iBAAiB,QAAO,EAAG,UAAU;CACvF,MAAM,EAAE,WAAW,QAAQ,QAAQ,WAAW,iBAAiB,OAAO,SAAS;CAC/E,MAAM,WAAW,YAAY,MAAM;CAEnC,MAAM,UAAqB;GACxB,YAAY,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC,YAAY;EAC5C,MAAM,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,YAAY;EACnC,OAAO,OAAO,CAAC,CAAC,YAAY;EAC5B,MAAM,KAAK,CAAC,CAAC,SAAS;EACtB,SAAS,KAAK,CAAC,CAAC,SAAS;CAC3B;CAEA,IAAI,QACF,QAAQ,UAAU,UAAU,CAAC,CAAC,SAAS;CAGzC,IAAI,QACF,QAAQ,UAAU,QAAQ,CAAC,CAAC,QAAQ,KAAK,CAAC,CAAC,MAAM;CAGnD,IAAI,QACF,QAAQ,UAAU,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC,YAAY;CAMnD,QAAQ,kBAAkB,OAAO,CAAC,CAAC,SAAS,CAAC,CAAC,OAAO;CAErD,OAAO;AACT;AAEA,SAAS,6BACP,OACqC;CACrC,OAAO,aAAa,SAAS,CAAC;AAChC;AAEA,SAAS,YAAY,QAA4B;CAC/C,QAAQ,QAAR;EACE,KAAK,UACH,OAAO;EACT,KAAK,WACH,OAAO;EACT,KAAK,UACH,OAAO;EACT,SACE,OAAO;CACX;AACF"}
@@ -1,12 +1,15 @@
1
1
  import { QueueDispatcher } from "../contracts/queue-dispatcher.contract.mjs";
2
+ import "../contracts/index.mjs";
2
3
  import { JobBackoff } from "@warlock.js/queue";
3
-
4
4
  //#region ../../packages/notifications/src/queue/bullmq-queue.d.ts
5
5
  /** The job name notification deliveries run under. */
6
- declare const NOTIFICATION_JOB_NAME = "warlock.notifications.deliver";
7
- type BullmqQueueOptions = {
8
- /** Queue to deliver on. Default: `@warlock.js/queue`'s default queue. */queue?: string; /** Attempts per delivery. Default: `queue.defaultJobOptions.attempts`, else `1`. */
9
- attempts?: number; /** Backoff between attempts. */
6
+ export declare const NOTIFICATION_JOB_NAME = "warlock.notifications.deliver";
7
+ export type BullmqQueueOptions = {
8
+ /** Queue to deliver on. Default: `@warlock.js/queue`'s default queue. */
9
+ queue?: string;
10
+ /** Attempts per delivery. Default: `queue.defaultJobOptions.attempts`, else `1`. */
11
+ attempts?: number;
12
+ /** Backoff between attempts. */
10
13
  backoff?: JobBackoff;
11
14
  };
12
15
  /**
@@ -19,7 +22,6 @@ type BullmqQueueOptions = {
19
22
  * - A channel missing from the worker's notifications config throws — the
20
23
  * delivery is retried per `attempts` / `backoff` like any other failure.
21
24
  */
22
- declare function bullmqQueue(options: BullmqQueueOptions): QueueDispatcher;
25
+ export declare function bullmqQueue(options: BullmqQueueOptions): QueueDispatcher;
23
26
  //#endregion
24
- export { BullmqQueueOptions, NOTIFICATION_JOB_NAME, bullmqQueue };
25
27
  //# sourceMappingURL=bullmq-queue.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"bullmq-queue.d.mts","names":[],"sources":["../../../../../../../../packages/notifications/src/queue/bullmq-queue.ts"],"mappings":";;;;;cA8Ba,qBAAA;AAAA,KAED,kBAAA;EA0B6D,yEAxBvE,KAAA;EAEA,QAAA;EAEA,OAAA,GAAU,UAAU;AAAA;;;;;;;;;;;iBAoBN,WAAA,CAAY,OAAA,EAAS,kBAAA,GAAqB,eAAe"}
1
+ {"version":3,"file":"bullmq-queue.d.mts","names":[],"sources":["../../../../../../../../packages/notifications/src/queue/bullmq-queue.ts"],"mappings":";;;;;qBA8Ba;YAED;;EAEV;;EAEA;;EAEA,UAAU;;;;;;;;;;;;wBAoBI,YAAY,SAAS,qBAAqB"}
@@ -1 +1 @@
1
- {"version":3,"file":"bullmq-queue.mjs","names":[],"sources":["../../../../../../../../packages/notifications/src/queue/bullmq-queue.ts"],"sourcesContent":["/**\n * BullMQ-backed `QueueDispatcher` — an alternative to `heraldQueue()` for apps\n * that already run `@warlock.js/queue` and would rather deliver notifications\n * through it than stand up a herald broker.\n *\n * `defineNotification` renders the payload + resolves the route BEFORE\n * handing a job to the dispatcher, so the job (`{ channel, route, payload,\n * options }`) is plain JSON — the same contract `heraldQueue` relies on.\n *\n * `@warlock.js/queue` is an OPTIONAL peer, lazy-loaded via `loadQueuePackage`\n * on first `.dispatch()` — never at import time — so notifications never pays\n * for `@warlock.js/queue` unless `bullmqQueue()` is actually configured.\n *\n * @example src/config/notifications.ts — declarative; the connector registers it\n * import { type NotificationConfig, bullmqQueue, mailChannel } from \"@warlock.js/notifications\";\n *\n * const config: NotificationConfig = {\n * channels: { mail: mailChannel() },\n * queue: bullmqQueue({ attempts: 3, backoff: { type: \"exponential\", delay: 5000 } }),\n * };\n *\n * export default config;\n */\nimport type { JobBackoff } from \"@warlock.js/queue\";\nimport type { QueueDispatcher } from \"../contracts\";\nimport { getNotificationConfig } from \"../config\";\nimport type { ChannelName, SendOptions } from \"../types\";\nimport { loadQueuePackage } from \"./load-queue\";\n\n/** The job name notification deliveries run under. */\nexport const NOTIFICATION_JOB_NAME = \"warlock.notifications.deliver\";\n\nexport type BullmqQueueOptions = {\n /** Queue to deliver on. Default: `@warlock.js/queue`'s default queue. */\n queue?: string;\n /** Attempts per delivery. Default: `queue.defaultJobOptions.attempts`, else `1`. */\n attempts?: number;\n /** Backoff between attempts. */\n backoff?: JobBackoff;\n};\n\ntype NotificationJobPayload = {\n channel: string;\n route: unknown;\n payload: unknown;\n options: SendOptions;\n};\n\n/**\n * Create the `QueueDispatcher` for `NotificationConfig.queue` backed by\n * `@warlock.js/queue`.\n *\n * - `SendOptions.delay` is honoured: a number is SECONDS (notifications'\n * convention), a string is a duration such as `\"10m\"` (`@warlock.js/queue`'s\n * convention).\n * - A channel missing from the worker's notifications config throws — the\n * delivery is retried per `attempts` / `backoff` like any other failure.\n */\nexport function bullmqQueue(options: BullmqQueueOptions): QueueDispatcher {\n let jobPromise: ReturnType<typeof defineNotificationJob> | undefined;\n\n return {\n async dispatch(job) {\n if (!jobPromise) {\n jobPromise = defineNotificationJob(options);\n }\n\n const notificationJob = await jobPromise;\n\n await notificationJob.dispatch(\n { channel: job.channel, route: job.route, payload: job.payload, options: job.options },\n { delay: job.options.delay === undefined ? undefined : notificationDelay(job.options.delay) },\n );\n },\n };\n}\n\nasync function defineNotificationJob(options: BullmqQueueOptions) {\n const { defineJob } = await loadQueuePackage();\n\n return defineJob<NotificationJobPayload, void>({\n name: NOTIFICATION_JOB_NAME,\n queue: options.queue,\n attempts: options.attempts,\n backoff: options.backoff,\n async handle(job) {\n const channel = getNotificationConfig().channels[job.channel as ChannelName];\n\n if (!channel) {\n throw new Error(\n `Notification channel \"${job.channel}\" is not configured in this worker's notifications config.`,\n );\n }\n\n await channel.send({ payload: job.payload, route: job.route, options: job.options } as never);\n },\n });\n}\n\nfunction notificationDelay(delay: number | string): number {\n return typeof delay === \"number\" ? delay * 1_000 : toMilliseconds(delay);\n}\n\n// `toMilliseconds` mirrors `@warlock.js/queue`'s duration parser but is\n// inlined here so this file doesn't need a non-lazy import from the optional\n// peer just to convert a string like \"10m\".\nfunction toMilliseconds(value: string): number {\n const units: Record<string, number> = { ms: 1, s: 1_000, m: 60_000, h: 3_600_000, d: 86_400_000 };\n const match = /^(\\d+(?:\\.\\d+)?)(ms|s|m|h|d)$/.exec(value.trim());\n\n if (!match) {\n throw new Error(\n `Invalid duration \"${value}\": expected a number of milliseconds or a string like ` +\n `\"500ms\", \"30s\", \"10m\", \"2h\", \"1d\".`,\n );\n }\n\n return Math.round(Number(match[1]) * units[match[2]!]!);\n}\n"],"mappings":";;;;;AA8BA,MAAa,wBAAwB;;;;;;;;;;;AA4BrC,SAAgB,YAAY,SAA8C;CACxE,IAAI;CAEJ,OAAO,EACL,MAAM,SAAS,KAAK;EAClB,IAAI,CAAC,YACH,aAAa,sBAAsB,OAAO;EAK5C,OAAM,MAFwB,WAET,CAAC,SACpB;GAAE,SAAS,IAAI;GAAS,OAAO,IAAI;GAAO,SAAS,IAAI;GAAS,SAAS,IAAI;EAAQ,GACrF,EAAE,OAAO,IAAI,QAAQ,UAAU,SAAY,SAAY,kBAAkB,IAAI,QAAQ,KAAK,EAAE,CAC9F;CACF,EACF;AACF;AAEA,eAAe,sBAAsB,SAA6B;CAChE,MAAM,EAAE,cAAc,MAAM,iBAAiB;CAE7C,OAAO,UAAwC;EAC7C,MAAM;EACN,OAAO,QAAQ;EACf,UAAU,QAAQ;EAClB,SAAS,QAAQ;EACjB,MAAM,OAAO,KAAK;GAChB,MAAM,UAAU,sBAAsB,CAAC,CAAC,SAAS,IAAI;GAErD,IAAI,CAAC,SACH,MAAM,IAAI,MACR,yBAAyB,IAAI,QAAQ,2DACvC;GAGF,MAAM,QAAQ,KAAK;IAAE,SAAS,IAAI;IAAS,OAAO,IAAI;IAAO,SAAS,IAAI;GAAQ,CAAU;EAC9F;CACF,CAAC;AACH;AAEA,SAAS,kBAAkB,OAAgC;CACzD,OAAO,OAAO,UAAU,WAAW,QAAQ,MAAQ,eAAe,KAAK;AACzE;AAKA,SAAS,eAAe,OAAuB;CAC7C,MAAM,QAAgC;EAAE,IAAI;EAAG,GAAG;EAAO,GAAG;EAAQ,GAAG;EAAW,GAAG;CAAW;CAChG,MAAM,QAAQ,gCAAgC,KAAK,MAAM,KAAK,CAAC;CAE/D,IAAI,CAAC,OACH,MAAM,IAAI,MACR,qBAAqB,MAAM,yFAE7B;CAGF,OAAO,KAAK,MAAM,OAAO,MAAM,EAAE,IAAI,MAAM,MAAM,GAAK;AACxD"}
1
+ {"version":3,"file":"bullmq-queue.mjs","names":[],"sources":["../../../../../../../../packages/notifications/src/queue/bullmq-queue.ts"],"sourcesContent":["/**\n * BullMQ-backed `QueueDispatcher` — an alternative to `heraldQueue()` for apps\n * that already run `@warlock.js/queue` and would rather deliver notifications\n * through it than stand up a herald broker.\n *\n * `defineNotification` renders the payload + resolves the route BEFORE\n * handing a job to the dispatcher, so the job (`{ channel, route, payload,\n * options }`) is plain JSON — the same contract `heraldQueue` relies on.\n *\n * `@warlock.js/queue` is an OPTIONAL peer, lazy-loaded via `loadQueuePackage`\n * on first `.dispatch()` — never at import time — so notifications never pays\n * for `@warlock.js/queue` unless `bullmqQueue()` is actually configured.\n *\n * @example src/config/notifications.ts — declarative; the connector registers it\n * import { type NotificationConfig, bullmqQueue, mailChannel } from \"@warlock.js/notifications\";\n *\n * const config: NotificationConfig = {\n * channels: { mail: mailChannel() },\n * queue: bullmqQueue({ attempts: 3, backoff: { type: \"exponential\", delay: 5000 } }),\n * };\n *\n * export default config;\n */\nimport type { JobBackoff } from \"@warlock.js/queue\";\nimport type { QueueDispatcher } from \"../contracts\";\nimport { getNotificationConfig } from \"../config\";\nimport type { ChannelName, SendOptions } from \"../types\";\nimport { loadQueuePackage } from \"./load-queue\";\n\n/** The job name notification deliveries run under. */\nexport const NOTIFICATION_JOB_NAME = \"warlock.notifications.deliver\";\n\nexport type BullmqQueueOptions = {\n /** Queue to deliver on. Default: `@warlock.js/queue`'s default queue. */\n queue?: string;\n /** Attempts per delivery. Default: `queue.defaultJobOptions.attempts`, else `1`. */\n attempts?: number;\n /** Backoff between attempts. */\n backoff?: JobBackoff;\n};\n\ntype NotificationJobPayload = {\n channel: string;\n route: unknown;\n payload: unknown;\n options: SendOptions;\n};\n\n/**\n * Create the `QueueDispatcher` for `NotificationConfig.queue` backed by\n * `@warlock.js/queue`.\n *\n * - `SendOptions.delay` is honoured: a number is SECONDS (notifications'\n * convention), a string is a duration such as `\"10m\"` (`@warlock.js/queue`'s\n * convention).\n * - A channel missing from the worker's notifications config throws — the\n * delivery is retried per `attempts` / `backoff` like any other failure.\n */\nexport function bullmqQueue(options: BullmqQueueOptions): QueueDispatcher {\n let jobPromise: ReturnType<typeof defineNotificationJob> | undefined;\n\n return {\n async dispatch(job) {\n if (!jobPromise) {\n jobPromise = defineNotificationJob(options);\n }\n\n const notificationJob = await jobPromise;\n\n await notificationJob.dispatch(\n { channel: job.channel, route: job.route, payload: job.payload, options: job.options },\n {\n delay: job.options.delay === undefined ? undefined : notificationDelay(job.options.delay),\n },\n );\n },\n };\n}\n\nasync function defineNotificationJob(options: BullmqQueueOptions) {\n const { defineJob } = await loadQueuePackage();\n\n return defineJob<NotificationJobPayload, void>({\n name: NOTIFICATION_JOB_NAME,\n queue: options.queue,\n attempts: options.attempts,\n backoff: options.backoff,\n async handle(job) {\n const channel = getNotificationConfig().channels[job.channel as ChannelName];\n\n if (!channel) {\n throw new Error(\n `Notification channel \"${job.channel}\" is not configured in this worker's notifications config.`,\n );\n }\n\n await channel.send({ payload: job.payload, route: job.route, options: job.options } as never);\n },\n });\n}\n\nfunction notificationDelay(delay: number | string): number {\n return typeof delay === \"number\" ? delay * 1_000 : toMilliseconds(delay);\n}\n\n// `toMilliseconds` mirrors `@warlock.js/queue`'s duration parser but is\n// inlined here so this file doesn't need a non-lazy import from the optional\n// peer just to convert a string like \"10m\".\nfunction toMilliseconds(value: string): number {\n const units: Record<string, number> = { ms: 1, s: 1_000, m: 60_000, h: 3_600_000, d: 86_400_000 };\n const match = /^(\\d+(?:\\.\\d+)?)(ms|s|m|h|d)$/.exec(value.trim());\n\n if (!match) {\n throw new Error(\n `Invalid duration \"${value}\": expected a number of milliseconds or a string like ` +\n `\"500ms\", \"30s\", \"10m\", \"2h\", \"1d\".`,\n );\n }\n\n return Math.round(Number(match[1]) * units[match[2]!]!);\n}\n"],"mappings":";;;;;AA8BA,MAAa,wBAAwB;;;;;;;;;;;AA4BrC,SAAgB,YAAY,SAA8C;CACxE,IAAI;CAEJ,OAAO,EACL,MAAM,SAAS,KAAK;EAClB,IAAI,CAAC,YACH,aAAa,sBAAsB,OAAO;EAK5C,OAAM,MAFwB,WAET,CAAC,SACpB;GAAE,SAAS,IAAI;GAAS,OAAO,IAAI;GAAO,SAAS,IAAI;GAAS,SAAS,IAAI;EAAQ,GACrF,EACE,OAAO,IAAI,QAAQ,UAAU,SAAY,SAAY,kBAAkB,IAAI,QAAQ,KAAK,EAC1F,CACF;CACF,EACF;AACF;AAEA,eAAe,sBAAsB,SAA6B;CAChE,MAAM,EAAE,cAAc,MAAM,iBAAiB;CAE7C,OAAO,UAAwC;EAC7C,MAAM;EACN,OAAO,QAAQ;EACf,UAAU,QAAQ;EAClB,SAAS,QAAQ;EACjB,MAAM,OAAO,KAAK;GAChB,MAAM,UAAU,sBAAsB,CAAC,CAAC,SAAS,IAAI;GAErD,IAAI,CAAC,SACH,MAAM,IAAI,MACR,yBAAyB,IAAI,QAAQ,2DACvC;GAGF,MAAM,QAAQ,KAAK;IAAE,SAAS,IAAI;IAAS,OAAO,IAAI;IAAO,SAAS,IAAI;GAAQ,CAAU;EAC9F;CACF,CAAC;AACH;AAEA,SAAS,kBAAkB,OAAgC;CACzD,OAAO,OAAO,UAAU,WAAW,QAAQ,MAAQ,eAAe,KAAK;AACzE;AAKA,SAAS,eAAe,OAAuB;CAC7C,MAAM,QAAgC;EAAE,IAAI;EAAG,GAAG;EAAO,GAAG;EAAQ,GAAG;EAAW,GAAG;CAAW;CAChG,MAAM,QAAQ,gCAAgC,KAAK,MAAM,KAAK,CAAC;CAE/D,IAAI,CAAC,OACH,MAAM,IAAI,MACR,qBAAqB,MAAM,yFAE7B;CAGF,OAAO,KAAK,MAAM,OAAO,MAAM,EAAE,IAAI,MAAM,MAAM,GAAK;AACxD"}
@@ -1,10 +1,12 @@
1
1
  import { QueueDispatcher } from "../contracts/queue-dispatcher.contract.mjs";
2
+ import "../contracts/index.mjs";
2
3
  //#region ../../packages/notifications/src/queue/herald-queue.d.ts
3
- type HeraldQueueOptions = {
4
- /** Herald channel to publish jobs to. Default `"notifications.dispatch"`. */channel?: string; /** Herald broker name (multi-broker setups). Default broker if omitted. */
4
+ export type HeraldQueueOptions = {
5
+ /** Herald channel to publish jobs to. Default `"notifications.dispatch"`. */
6
+ channel?: string;
7
+ /** Herald broker name (multi-broker setups). Default broker if omitted. */
5
8
  broker?: string;
6
9
  };
7
- declare function heraldQueue(options?: HeraldQueueOptions): QueueDispatcher;
10
+ export declare function heraldQueue(options?: HeraldQueueOptions): QueueDispatcher;
8
11
  //#endregion
9
- export { HeraldQueueOptions, heraldQueue };
10
12
  //# sourceMappingURL=herald-queue.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"herald-queue.d.mts","names":[],"sources":["../../../../../../../../packages/notifications/src/queue/herald-queue.ts"],"mappings":";;KAyBY,kBAAA;+EAEV,OAAA;EAEA,MAAM;AAAA;AAAA,iBAGQ,WAAA,CAAY,OAAA,GAAS,kBAAA,GAA0B,eAAe"}
1
+ {"version":3,"file":"herald-queue.d.mts","names":[],"sources":["../../../../../../../../packages/notifications/src/queue/herald-queue.ts"],"mappings":";;;YAyBY;;EAEV;;EAEA;;wBAGc,YAAY,UAAS,qBAA0B"}
@@ -3,4 +3,5 @@ import { WorkerOptions, startNotificationsWorker } from "./notifications-worker.
3
3
  import { DEFAULT_QUEUE_CHANNEL } from "./load-herald.mjs";
4
4
  import { BullmqQueueOptions, NOTIFICATION_JOB_NAME, bullmqQueue } from "./bullmq-queue.mjs";
5
5
  import { QueuePackageLoader, loadQueuePackage } from "./load-queue.mjs";
6
- import { QueuePackageNotInstalledError } from "./queue-package-not-installed.error.mjs";
6
+ import { QueuePackageNotInstalledError } from "./queue-package-not-installed.error.mjs";
7
+ export { BullmqQueueOptions, DEFAULT_QUEUE_CHANNEL, HeraldQueueOptions, NOTIFICATION_JOB_NAME, type QueuePackageLoader, QueuePackageNotInstalledError, WorkerOptions, bullmqQueue, heraldQueue, loadQueuePackage, startNotificationsWorker };
@@ -5,4 +5,4 @@ import { QueuePackageNotInstalledError } from "./queue-package-not-installed.err
5
5
  import { loadQueuePackage } from "./load-queue.mjs";
6
6
  import { NOTIFICATION_JOB_NAME, bullmqQueue } from "./bullmq-queue.mjs";
7
7
 
8
- export { };
8
+ export { DEFAULT_QUEUE_CHANNEL, NOTIFICATION_JOB_NAME, QueuePackageNotInstalledError, bullmqQueue, heraldQueue, loadQueuePackage, startNotificationsWorker };
@@ -1,6 +1,5 @@
1
1
  //#region ../../packages/notifications/src/queue/load-herald.d.ts
2
2
  /** The herald channel notification jobs are published to / consumed from. */
3
- declare const DEFAULT_QUEUE_CHANNEL = "notifications.dispatch";
3
+ export declare const DEFAULT_QUEUE_CHANNEL = "notifications.dispatch";
4
4
  //#endregion
5
- export { DEFAULT_QUEUE_CHANNEL };
6
5
  //# sourceMappingURL=load-herald.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"load-herald.d.mts","names":[],"sources":["../../../../../../../../packages/notifications/src/queue/load-herald.ts"],"mappings":";AAmCA;AAAA,cAAa,qBAAA"}
1
+ {"version":3,"file":"load-herald.d.mts","names":[],"sources":["../../../../../../../../packages/notifications/src/queue/load-herald.ts"],"mappings":";;qBAmCa"}
@@ -21,7 +21,7 @@ Or with your preferred package manager:
21
21
  async function loadHerald() {
22
22
  if (heraldModule) return heraldModule;
23
23
  try {
24
- heraldModule = await import("../packages/herald/src/index.mjs");
24
+ heraldModule = await import("@warlock.js/herald");
25
25
  return heraldModule;
26
26
  } catch {
27
27
  throw new Error(INSTALL_INSTRUCTIONS);
@@ -1,11 +1,10 @@
1
1
  //#region ../../packages/notifications/src/queue/load-queue.d.ts
2
2
  /** A function that performs the dynamic import of `@warlock.js/queue`. */
3
- type QueuePackageLoader = () => Promise<typeof import("@warlock.js/queue")>;
3
+ export type QueuePackageLoader = () => Promise<typeof import("@warlock.js/queue")>;
4
4
  /**
5
5
  * Resolve `@warlock.js/queue`, memoized after the first successful load.
6
6
  * Throws {@link QueuePackageNotInstalledError} when the import fails.
7
7
  */
8
- declare function loadQueuePackage(loader?: QueuePackageLoader): Promise<typeof import("@warlock.js/queue")>;
8
+ export declare function loadQueuePackage(loader?: QueuePackageLoader): Promise<typeof import("@warlock.js/queue")>;
9
9
  //#endregion
10
- export { QueuePackageLoader, loadQueuePackage };
11
10
  //# sourceMappingURL=load-queue.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"load-queue.d.mts","names":[],"sources":["../../../../../../../../packages/notifications/src/queue/load-queue.ts"],"mappings":";;KAaY,kBAAA,SAA2B,OAAO;;;;AAAA;iBAUxB,gBAAA,CACpB,MAAA,GAAQ,kBAAA,GACP,OAAO"}
1
+ {"version":3,"file":"load-queue.d.mts","names":[],"sources":["../../../../../../../../packages/notifications/src/queue/load-queue.ts"],"mappings":";;YAaY,2BAA2B;;;;;wBAUjB,iBACpB,SAAQ,qBACP"}
@@ -1,9 +1,10 @@
1
1
  //#region ../../packages/notifications/src/queue/notifications-worker.d.ts
2
- type WorkerOptions = {
3
- /** Herald channel to consume from. Must match the dispatcher. Default `"notifications.dispatch"`. */channel?: string; /** Herald broker name. Default broker if omitted. */
2
+ export type WorkerOptions = {
3
+ /** Herald channel to consume from. Must match the dispatcher. Default `"notifications.dispatch"`. */
4
+ channel?: string;
5
+ /** Herald broker name. Default broker if omitted. */
4
6
  broker?: string;
5
7
  };
6
- declare function startNotificationsWorker(options?: WorkerOptions): Promise<void>;
8
+ export declare function startNotificationsWorker(options?: WorkerOptions): Promise<void>;
7
9
  //#endregion
8
- export { WorkerOptions, startNotificationsWorker };
9
10
  //# sourceMappingURL=notifications-worker.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"notifications-worker.d.mts","names":[],"sources":["../../../../../../../../packages/notifications/src/queue/notifications-worker.ts"],"mappings":";KAyBY,aAAA;EAAA,qGAEV,OAAA;EAEA,MAAM;AAAA;AAAA,iBAGc,wBAAA,CAAyB,OAAA,GAAS,aAAA,GAAqB,OAAO"}
1
+ {"version":3,"file":"notifications-worker.d.mts","names":[],"sources":["../../../../../../../../packages/notifications/src/queue/notifications-worker.ts"],"mappings":";YAyBY;;EAEV;;EAEA;;wBAGoB,yBAAyB,UAAS,gBAAqB"}
@@ -1 +1 @@
1
- {"version":3,"file":"notifications-worker.mjs","names":[],"sources":["../../../../../../../../packages/notifications/src/queue/notifications-worker.ts"],"sourcesContent":["/**\n * Notification queue worker — consumes the jobs `heraldQueue` publishes and\n * runs the actual `channel.send`. Call this once in a worker process (or the\n * web process) after the notifications config + herald broker are up.\n *\n * The job carries an ALREADY-RENDERED payload + resolved route, so the worker\n * only looks the channel up by name and dispatches — no notifiable needed.\n *\n * @example\n * // in a worker entrypoint, after the notifications config + broker are up\n * import { startNotificationsWorker } from \"@warlock.js/notifications\";\n * await startNotificationsWorker();\n */\nimport { log } from \"@warlock.js/logger\";\nimport { getNotificationConfig } from \"../config\";\nimport type { ChannelName, SendOptions } from \"../types\";\nimport { DEFAULT_QUEUE_CHANNEL, loadHerald } from \"./load-herald\";\n\ntype NotificationJob = {\n channel: string;\n route: unknown;\n payload: unknown;\n options: SendOptions;\n};\n\nexport type WorkerOptions = {\n /** Herald channel to consume from. Must match the dispatcher. Default `\"notifications.dispatch\"`. */\n channel?: string;\n /** Herald broker name. Default broker if omitted. */\n broker?: string;\n};\n\nexport async function startNotificationsWorker(options: WorkerOptions = {}): Promise<void> {\n const channelName = options.channel ?? DEFAULT_QUEUE_CHANNEL;\n const { herald } = await loadHerald();\n\n await herald(options.broker)\n .channel(channelName)\n .subscribe(async (message: { payload: unknown }, ctx: { ack(): Promise<void> }) => {\n const job = message.payload as NotificationJob;\n\n try {\n const channel = getNotificationConfig().channels[job.channel as ChannelName];\n\n if (!channel) {\n // Unknown channel — log and ack to avoid a poison-message loop.\n log.error(\"notifications\", \"queue.worker\", `Unknown channel \"${job.channel}\" — dropping job`);\n await ctx.ack();\n return;\n }\n\n await channel.send({\n payload: job.payload as never,\n route: job.route as never,\n options: job.options,\n });\n\n await ctx.ack();\n } catch (error) {\n // Phase 2: log + ack (no retry/DLQ yet — that lands with the\n // delay-aware worker). A dead-letter strategy is a follow-up.\n log.error(\"notifications\", \"queue.worker\", error as Error);\n await ctx.ack();\n }\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAgCA,eAAsB,yBAAyB,UAAyB,CAAC,GAAkB;CACzF,MAAM,cAAc,QAAQ;CAC5B,MAAM,EAAE,WAAW,MAAM,WAAW;CAEpC,MAAM,OAAO,QAAQ,MAAM,CAAC,CACzB,QAAQ,WAAW,CAAC,CACpB,UAAU,OAAO,SAA+B,QAAkC;EACjF,MAAM,MAAM,QAAQ;EAEpB,IAAI;GACF,MAAM,UAAU,sBAAsB,CAAC,CAAC,SAAS,IAAI;GAErD,IAAI,CAAC,SAAS;IAEZ,IAAI,MAAM,iBAAiB,gBAAgB,oBAAoB,IAAI,QAAQ,iBAAiB;IAC5F,MAAM,IAAI,IAAI;IACd;GACF;GAEA,MAAM,QAAQ,KAAK;IACjB,SAAS,IAAI;IACb,OAAO,IAAI;IACX,SAAS,IAAI;GACf,CAAC;GAED,MAAM,IAAI,IAAI;EAChB,SAAS,OAAO;GAGd,IAAI,MAAM,iBAAiB,gBAAgB,KAAc;GACzD,MAAM,IAAI,IAAI;EAChB;CACF,CAAC;AACL"}
1
+ {"version":3,"file":"notifications-worker.mjs","names":[],"sources":["../../../../../../../../packages/notifications/src/queue/notifications-worker.ts"],"sourcesContent":["/**\n * Notification queue worker — consumes the jobs `heraldQueue` publishes and\n * runs the actual `channel.send`. Call this once in a worker process (or the\n * web process) after the notifications config + herald broker are up.\n *\n * The job carries an ALREADY-RENDERED payload + resolved route, so the worker\n * only looks the channel up by name and dispatches — no notifiable needed.\n *\n * @example\n * // in a worker entrypoint, after the notifications config + broker are up\n * import { startNotificationsWorker } from \"@warlock.js/notifications\";\n * await startNotificationsWorker();\n */\nimport { log } from \"@warlock.js/logger\";\nimport { getNotificationConfig } from \"../config\";\nimport type { ChannelName, SendOptions } from \"../types\";\nimport { DEFAULT_QUEUE_CHANNEL, loadHerald } from \"./load-herald\";\n\ntype NotificationJob = {\n channel: string;\n route: unknown;\n payload: unknown;\n options: SendOptions;\n};\n\nexport type WorkerOptions = {\n /** Herald channel to consume from. Must match the dispatcher. Default `\"notifications.dispatch\"`. */\n channel?: string;\n /** Herald broker name. Default broker if omitted. */\n broker?: string;\n};\n\nexport async function startNotificationsWorker(options: WorkerOptions = {}): Promise<void> {\n const channelName = options.channel ?? DEFAULT_QUEUE_CHANNEL;\n const { herald } = await loadHerald();\n\n await herald(options.broker)\n .channel(channelName)\n .subscribe(async (message: { payload: unknown }, ctx: { ack(): Promise<void> }) => {\n const job = message.payload as NotificationJob;\n\n try {\n const channel = getNotificationConfig().channels[job.channel as ChannelName];\n\n if (!channel) {\n // Unknown channel — log and ack to avoid a poison-message loop.\n log.error(\n \"notifications\",\n \"queue.worker\",\n `Unknown channel \"${job.channel}\" — dropping job`,\n );\n await ctx.ack();\n return;\n }\n\n await channel.send({\n payload: job.payload as never,\n route: job.route as never,\n options: job.options,\n });\n\n await ctx.ack();\n } catch (error) {\n // Phase 2: log + ack (no retry/DLQ yet — that lands with the\n // delay-aware worker). A dead-letter strategy is a follow-up.\n log.error(\"notifications\", \"queue.worker\", error as Error);\n await ctx.ack();\n }\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAgCA,eAAsB,yBAAyB,UAAyB,CAAC,GAAkB;CACzF,MAAM,cAAc,QAAQ;CAC5B,MAAM,EAAE,WAAW,MAAM,WAAW;CAEpC,MAAM,OAAO,QAAQ,MAAM,CAAC,CACzB,QAAQ,WAAW,CAAC,CACpB,UAAU,OAAO,SAA+B,QAAkC;EACjF,MAAM,MAAM,QAAQ;EAEpB,IAAI;GACF,MAAM,UAAU,sBAAsB,CAAC,CAAC,SAAS,IAAI;GAErD,IAAI,CAAC,SAAS;IAEZ,IAAI,MACF,iBACA,gBACA,oBAAoB,IAAI,QAAQ,iBAClC;IACA,MAAM,IAAI,IAAI;IACd;GACF;GAEA,MAAM,QAAQ,KAAK;IACjB,SAAS,IAAI;IACb,OAAO,IAAI;IACX,SAAS,IAAI;GACf,CAAC;GAED,MAAM,IAAI,IAAI;EAChB,SAAS,OAAO;GAGd,IAAI,MAAM,iBAAiB,gBAAgB,KAAc;GACzD,MAAM,IAAI,IAAI;EAChB;CACF,CAAC;AACL"}
@@ -5,9 +5,8 @@
5
5
  * time (first `.queue()` call), not at boot, matching the lazy-optional-peer
6
6
  * pattern `loadHerald` already uses for `@warlock.js/herald`.
7
7
  */
8
- declare class QueuePackageNotInstalledError extends Error {
8
+ export declare class QueuePackageNotInstalledError extends Error {
9
9
  constructor();
10
10
  }
11
11
  //#endregion
12
- export { QueuePackageNotInstalledError };
13
12
  //# sourceMappingURL=queue-package-not-installed.error.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"queue-package-not-installed.error.d.mts","names":[],"sources":["../../../../../../../../packages/notifications/src/queue/queue-package-not-installed.error.ts"],"mappings":";;AAeA;;;;;cAAa,6BAAA,SAAsC,KAAK;EAAL,WAAA;AAAA"}
1
+ {"version":3,"file":"queue-package-not-installed.error.d.mts","names":[],"sources":["../../../../../../../../packages/notifications/src/queue/queue-package-not-installed.error.ts"],"mappings":";;;;;;;qBAea,sCAAsC;EACjD"}
package/esm/types.d.mts CHANGED
@@ -1,5 +1,4 @@
1
1
  import { Model } from "@warlock.js/cascade";
2
-
3
2
  //#region ../../packages/notifications/src/types.d.ts
4
3
  /**
5
4
  * A recipient you send TO (a User, etc.) — NOT the stored record.
@@ -8,30 +7,31 @@ import { Model } from "@warlock.js/cascade";
8
7
  * `route` override in config), not a model concern — there is intentionally
9
8
  * NO `routeNotificationFor` on the model.
10
9
  */
11
- type Notifiable = Model;
10
+ export type Notifiable = Model;
12
11
  /** An identifier — string (uuid / objectId) or number (auto-increment). */
13
- type Id = string | number;
12
+ export type Id = string | number;
14
13
  /** What the `mail` channel renders to and `core.sendMail` consumes. */
15
- type MailPayload = {
14
+ export type MailPayload = {
16
15
  subject: string;
17
16
  html?: string;
18
17
  text?: string;
19
18
  cc?: string | string[];
20
19
  };
21
20
  /** Normalized in-app record shape written through the database channel. */
22
- type NotificationInput = {
21
+ export type NotificationInput = {
23
22
  recipientId: Id;
24
23
  type: string;
25
24
  title: string;
26
25
  body?: string;
27
- payload?: Record<string, unknown>; /** Unique-per-recipient dedupe key — see `SendOptions.idempotencyKey`. */
26
+ payload?: Record<string, unknown>;
27
+ /** Unique-per-recipient dedupe key — see `SendOptions.idempotencyKey`. */
28
28
  idempotencyKey?: string;
29
29
  };
30
30
  /**
31
31
  * Database payload as seen by RENDERERS — `recipientId` is set by the channel
32
32
  * from the resolved route, not by the render closure.
33
33
  */
34
- type DatabasePayload = Omit<NotificationInput, "recipientId">;
34
+ export type DatabasePayload = Omit<NotificationInput, "recipientId">;
35
35
  /**
36
36
  * Channel REGISTRY — the single declaration-merge target mapping channel NAME
37
37
  * → payload type. Drives `notify.<channel>` proxy typing and
@@ -45,11 +45,11 @@ type DatabasePayload = Omit<NotificationInput, "recipientId">;
45
45
  * (`whatsapp`, `telegram`, `push`, `slack`) ship in Phase 2 as the same
46
46
  * declaration-merge pattern.
47
47
  */
48
- interface NotificationChannels {
48
+ export interface NotificationChannels {
49
49
  mail: MailPayload;
50
50
  database: DatabasePayload;
51
51
  }
52
- type ChannelName = keyof NotificationChannels;
52
+ export type ChannelName = keyof NotificationChannels;
53
53
  /**
54
54
  * Per-send options — the optional 3rd arg of `notify.<channel>` / `send` /
55
55
  * `queue`. Lean by design: `queue` and `only` are METHODS on a defined
@@ -62,7 +62,7 @@ type ChannelName = keyof NotificationChannels;
62
62
  * - `type` opts ad-hoc `notify.<channel>` sends into preference/rate-limit
63
63
  * gating. `defineNotification` reads its own `def.type` and ignores this.
64
64
  */
65
- type SendOptions = {
65
+ export type SendOptions = {
66
66
  /**
67
67
  * Delay the dispatch, e.g. `"10m"` / `"3d"` / `600` (seconds). RESERVED —
68
68
  * NOT honored yet: `.send()` always dispatches immediately, and the current
@@ -70,15 +70,20 @@ type SendOptions = {
70
70
  * lands with the delay-aware worker (Phase 2); until then this field is a
71
71
  * no-op on both paths.
72
72
  */
73
- delay?: number | string; /** Locale for rendering — passed to renderers via `RenderContext`. */
74
- locale?: string; /** Passthrough to channels + every observability event (via `options`). */
75
- meta?: Record<string, unknown>; /** Dedupe key for retry-safe sends. */
76
- idempotencyKey?: string; /** Bypass `PreferenceProvider`. Does NOT bypass `RateLimiter`. */
77
- force?: boolean; /** Notification type for ad-hoc gating (unused by `defineNotification`). */
73
+ delay?: number | string;
74
+ /** Locale for rendering — passed to renderers via `RenderContext`. */
75
+ locale?: string;
76
+ /** Passthrough to channels + every observability event (via `options`). */
77
+ meta?: Record<string, unknown>;
78
+ /** Dedupe key for retry-safe sends. */
79
+ idempotencyKey?: string;
80
+ /** Bypass `PreferenceProvider`. Does NOT bypass `RateLimiter`. */
81
+ force?: boolean;
82
+ /** Notification type for ad-hoc gating (unused by `defineNotification`). */
78
83
  type?: string;
79
84
  };
80
85
  /** What a renderer receives as its 3rd arg — i18n + meta passthrough only. */
81
- type RenderContext = Pick<SendOptions, "locale" | "meta">;
86
+ export type RenderContext = Pick<SendOptions, "locale" | "meta">;
82
87
  /**
83
88
  * Event surface for metrics, logging, audits. Fires per (channel, recipient)
84
89
  * — fan-out emits N events.
@@ -92,7 +97,7 @@ type RenderContext = Pick<SendOptions, "locale" | "meta">;
92
97
  * send; on a queued send it is the enqueue time (real delivery timing is
93
98
  * worker-side).
94
99
  */
95
- type NotificationEvents = {
100
+ export type NotificationEvents = {
96
101
  sending: {
97
102
  dispatchId: string;
98
103
  channel: string;
@@ -126,5 +131,4 @@ type NotificationEvents = {
126
131
  };
127
132
  };
128
133
  //#endregion
129
- export { ChannelName, DatabasePayload, Id, MailPayload, Notifiable, NotificationChannels, NotificationEvents, NotificationInput, RenderContext, SendOptions };
130
134
  //# sourceMappingURL=types.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.mts","names":[],"sources":["../../../../../../../packages/notifications/src/types.ts"],"mappings":";;;AAqBA;;;;AAAc;AAKd;;AALA,KAHY,UAAA,GAAa,KAAK;;KAGlB,EAAA;;KAKA,WAAA;EACV,OAAA;EACA,IAAA;EACA,IAAA;EACA,EAAA;AAAA;;KAIU,iBAAA;EACV,WAAA,EAAa,EAAA;EACb,IAAA;EACA,KAAA;EACA,IAAA;EACA,OAAA,GAAU,MAAM,mBAAhB;EAEA,cAAA;AAAA;;AAAc;AAOhB;;KAAY,eAAA,GAAkB,IAAI,CAAC,iBAAA;;AAAiB;AAiBpD;;;;;;;;;AAE2B;AAG3B;UALiB,oBAAA;EACf,IAAA,EAAM,WAAA;EACN,QAAA,EAAU,eAAe;AAAA;AAAA,KAGf,WAAA,SAAoB,oBAAoB;;;;;;;;;;;;AAkC9C;KAlBM,WAAA;EAsBa;;;AAAmB;AAiB5C;;;EA/BE,KAAA,oBAqCW;EAnCX,MAAA,WA0CW;EAxCX,IAAA,GAAO,MAAM,mBAgDJ;EA9CT,cAAA,WAqDe;EAnDf,KAAA,YAqDsB;EAnDtB,IAAA;AAAA;;KAIU,aAAA,GAAgB,IAAI,CAAC,WAAA;;;;;;;;;;;;;;KAiBrB,kBAAA;EACV,OAAA;IACE,UAAA;IACA,OAAA;IACA,UAAA,GAAa,UAAA;IACb,OAAA;IACA,OAAA,EAAS,WAAA;EAAA;EAEX,IAAA;IACE,UAAA;IACA,OAAA;IACA,UAAA,GAAa,UAAA;IACb,OAAA;IACA,OAAA,EAAS,WAAA;IACT,UAAA;EAAA;EAEF,MAAA;IACE,UAAA;IACA,OAAA;IACA,UAAA,GAAa,UAAA;IACb,OAAA;IACA,KAAA,EAAO,KAAA;IACP,OAAA,EAAS,WAAA;IACT,UAAA;EAAA;EAEF,OAAA;IACE,UAAA;IACA,OAAA;IACA,UAAA,GAAa,UAAA;IACb,MAAA;IACA,OAAA,EAAS,WAAA;EAAA;AAAA"}
1
+ {"version":3,"file":"types.d.mts","names":[],"sources":["../../../../../../../packages/notifications/src/types.ts"],"mappings":";;;;;;;;;YAkBY,aAAa;;YAGb;;YAKA;EACV;EACA;EACA;EACA;;;YAIU;EACV,aAAa;EACb;EACA;EACA;EACA,UAAU;;EAEV;;;;;;YAOU,kBAAkB,KAAK;;;;;;;;;;;;;;iBAiBlB;EACf,MAAM;EACN,UAAU;;YAGA,oBAAoB;;;;;;;;;;;;;YAgBpB;;;;;;;;EAQV;;EAEA;;EAEA,OAAO;;EAEP;;EAEA;;EAEA;;;YAIU,gBAAgB,KAAK;;;;;;;;;;;;;;YAiBrB;EACV;IACE;IACA;IACA,aAAa;IACb;IACA,SAAS;;EAEX;IACE;IACA;IACA,aAAa;IACb;IACA,SAAS;IACT;;EAEF;IACE;IACA;IACA,aAAa;IACb;IACA,OAAO;IACP,SAAS;IACT;;EAEF;IACE;IACA;IACA,aAAa;IACb;IACA,SAAS"}