@geekmidas/events 1.0.0 → 1.1.1

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 (257) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/{BasicConnection-BTRsXiuH.d.cts → BasicConnection-CQsJpx2J.d.cts} +2 -2
  3. package/dist/{BasicConnection-DIxtA7jK.d.mts.map → BasicConnection-CQsJpx2J.d.cts.map} +1 -1
  4. package/dist/{BasicConnection-Bz3F2rXA.cjs → BasicConnection-CxfNEvlb.cjs} +2 -2
  5. package/dist/{BasicConnection-Bz3F2rXA.cjs.map → BasicConnection-CxfNEvlb.cjs.map} +1 -1
  6. package/dist/{BasicConnection-DIxtA7jK.d.mts → BasicConnection-DcRelT64.d.mts} +2 -2
  7. package/dist/{BasicConnection-BTRsXiuH.d.cts.map → BasicConnection-DcRelT64.d.mts.map} +1 -1
  8. package/dist/{BasicConnection-DOSOFSsW.mjs → BasicConnection-hl-Ogz3a.mjs} +2 -2
  9. package/dist/{BasicConnection-DOSOFSsW.mjs.map → BasicConnection-hl-Ogz3a.mjs.map} +1 -1
  10. package/dist/{BasicPublisher-D1q0a2xp.d.cts → BasicPublisher-C-hMX2Hy.d.mts} +3 -3
  11. package/dist/{BasicPublisher-CpJFK2oS.d.mts.map → BasicPublisher-C-hMX2Hy.d.mts.map} +1 -1
  12. package/dist/{BasicPublisher-CpJFK2oS.d.mts → BasicPublisher-CGMXg2I2.d.cts} +3 -3
  13. package/dist/{BasicPublisher-D1q0a2xp.d.cts.map → BasicPublisher-CGMXg2I2.d.cts.map} +1 -1
  14. package/dist/{BasicPublisher-afwuA4Xp.cjs → BasicPublisher-CXAVKxgq.cjs} +1 -1
  15. package/dist/{BasicPublisher-afwuA4Xp.cjs.map → BasicPublisher-CXAVKxgq.cjs.map} +1 -1
  16. package/dist/{BasicPublisher-CaX8GCUi.mjs → BasicPublisher-DogbeHAH.mjs} +1 -1
  17. package/dist/{BasicPublisher-CaX8GCUi.mjs.map → BasicPublisher-DogbeHAH.mjs.map} +1 -1
  18. package/dist/{BasicSubscriber-BgsKYQmi.mjs → BasicSubscriber-BJSZN22M.mjs} +1 -1
  19. package/dist/{BasicSubscriber-BgsKYQmi.mjs.map → BasicSubscriber-BJSZN22M.mjs.map} +1 -1
  20. package/dist/{BasicSubscriber-DXxQewjc.d.cts → BasicSubscriber-HzSJ_MbB.d.mts} +3 -3
  21. package/dist/{BasicSubscriber-6w0Af4DD.d.mts.map → BasicSubscriber-HzSJ_MbB.d.mts.map} +1 -1
  22. package/dist/{BasicSubscriber-BN9fKRrU.cjs → BasicSubscriber-mVJRMXhZ.cjs} +1 -1
  23. package/dist/{BasicSubscriber-BN9fKRrU.cjs.map → BasicSubscriber-mVJRMXhZ.cjs.map} +1 -1
  24. package/dist/{BasicSubscriber-6w0Af4DD.d.mts → BasicSubscriber-uW3IOyBj.d.cts} +3 -3
  25. package/dist/{BasicSubscriber-DXxQewjc.d.cts.map → BasicSubscriber-uW3IOyBj.d.cts.map} +1 -1
  26. package/dist/{EventConnection-BaJRXdg7.d.cts → EventConnection-4niMI6D8.d.mts} +2 -2
  27. package/dist/{EventConnection-BaJRXdg7.d.cts.map → EventConnection-4niMI6D8.d.mts.map} +1 -1
  28. package/dist/{EventConnection-F_N81SXu.cjs → EventConnection-BkA9FSVL.cjs} +6 -2
  29. package/dist/{EventConnection-F_N81SXu.cjs.map → EventConnection-BkA9FSVL.cjs.map} +1 -1
  30. package/dist/{EventConnection-ClLMoIUU.mjs → EventConnection-Kr32GAzq.mjs} +6 -2
  31. package/dist/{EventConnection-ClLMoIUU.mjs.map → EventConnection-Kr32GAzq.mjs.map} +1 -1
  32. package/dist/{EventConnection-SOhtmxib.d.mts → EventConnection-dP42P87q.d.cts} +2 -2
  33. package/dist/{EventConnection-SOhtmxib.d.mts.map → EventConnection-dP42P87q.d.cts.map} +1 -1
  34. package/dist/EventConnection.cjs +2 -2
  35. package/dist/EventConnection.d.cts +2 -2
  36. package/dist/EventConnection.d.mts +2 -2
  37. package/dist/EventConnection.mjs +2 -2
  38. package/dist/PgBossConnection-B71ssr72.cjs +80 -0
  39. package/dist/PgBossConnection-B71ssr72.cjs.map +1 -0
  40. package/dist/PgBossConnection-Bj_Wo1lQ.mjs +74 -0
  41. package/dist/PgBossConnection-Bj_Wo1lQ.mjs.map +1 -0
  42. package/dist/PgBossConnection-DCfLGoHx.d.mts +32 -0
  43. package/dist/PgBossConnection-DCfLGoHx.d.mts.map +1 -0
  44. package/dist/PgBossConnection-oto_CAbP.d.cts +32 -0
  45. package/dist/PgBossConnection-oto_CAbP.d.cts.map +1 -0
  46. package/dist/PgBossPublisher-Bwo7qSoH.mjs +35 -0
  47. package/dist/PgBossPublisher-Bwo7qSoH.mjs.map +1 -0
  48. package/dist/PgBossPublisher-CqjigBVC.d.mts +20 -0
  49. package/dist/PgBossPublisher-CqjigBVC.d.mts.map +1 -0
  50. package/dist/PgBossPublisher-FTdYh58W.cjs +41 -0
  51. package/dist/PgBossPublisher-FTdYh58W.cjs.map +1 -0
  52. package/dist/PgBossPublisher-JIiB1zpA.d.cts +20 -0
  53. package/dist/PgBossPublisher-JIiB1zpA.d.cts.map +1 -0
  54. package/dist/PgBossSubscriber-BUiB1JKf.d.mts +24 -0
  55. package/dist/PgBossSubscriber-BUiB1JKf.d.mts.map +1 -0
  56. package/dist/PgBossSubscriber-BubVfuWm.cjs +52 -0
  57. package/dist/PgBossSubscriber-BubVfuWm.cjs.map +1 -0
  58. package/dist/PgBossSubscriber-Cozijfdj.d.cts +24 -0
  59. package/dist/PgBossSubscriber-Cozijfdj.d.cts.map +1 -0
  60. package/dist/PgBossSubscriber-DopATe80.mjs +46 -0
  61. package/dist/PgBossSubscriber-DopATe80.mjs.map +1 -0
  62. package/dist/{Publisher-ceu6OxCj.cjs → Publisher-CKloIGh6.cjs} +11 -2
  63. package/dist/{Publisher-ceu6OxCj.cjs.map → Publisher-CKloIGh6.cjs.map} +1 -1
  64. package/dist/{Publisher-DS0aOh8r.mjs → Publisher-ChLTrUeP.mjs} +11 -2
  65. package/dist/{Publisher-DS0aOh8r.mjs.map → Publisher-ChLTrUeP.mjs.map} +1 -1
  66. package/dist/{Publisher-1CfcYRnm.d.mts → Publisher-DDee6xau.d.cts} +2 -2
  67. package/dist/{Publisher-1CfcYRnm.d.mts.map → Publisher-DDee6xau.d.cts.map} +1 -1
  68. package/dist/{Publisher-BfNgvHwQ.d.cts → Publisher-VHumMkrP.d.mts} +2 -2
  69. package/dist/{Publisher-BfNgvHwQ.d.cts.map → Publisher-VHumMkrP.d.mts.map} +1 -1
  70. package/dist/Publisher.cjs +2 -2
  71. package/dist/Publisher.d.cts +2 -2
  72. package/dist/Publisher.d.mts +2 -2
  73. package/dist/Publisher.mjs +2 -2
  74. package/dist/{RabbitMQConnection-DFLkr2vq.mjs → RabbitMQConnection-BtKZjtZY.mjs} +2 -2
  75. package/dist/{RabbitMQConnection-DFLkr2vq.mjs.map → RabbitMQConnection-BtKZjtZY.mjs.map} +1 -1
  76. package/dist/{RabbitMQConnection-Bm8VCI2R.d.cts → RabbitMQConnection-DV9t3VYp.d.mts} +2 -2
  77. package/dist/{RabbitMQConnection-Bm8VCI2R.d.cts.map → RabbitMQConnection-DV9t3VYp.d.mts.map} +1 -1
  78. package/dist/{RabbitMQConnection-CjBoCd9n.cjs → RabbitMQConnection-DmMMosT4.cjs} +2 -2
  79. package/dist/{RabbitMQConnection-CjBoCd9n.cjs.map → RabbitMQConnection-DmMMosT4.cjs.map} +1 -1
  80. package/dist/{RabbitMQConnection-Ck-ktCp_.d.mts → RabbitMQConnection-jNME_eR7.d.cts} +2 -2
  81. package/dist/{RabbitMQConnection-Ck-ktCp_.d.mts.map → RabbitMQConnection-jNME_eR7.d.cts.map} +1 -1
  82. package/dist/{RabbitMQPublisher-COnxcWEZ.d.mts → RabbitMQPublisher-DKmgwqVj.d.mts} +3 -3
  83. package/dist/{RabbitMQPublisher-COnxcWEZ.d.mts.map → RabbitMQPublisher-DKmgwqVj.d.mts.map} +1 -1
  84. package/dist/{RabbitMQPublisher-qQT7-1-p.d.cts → RabbitMQPublisher-d257OHLa.d.cts} +3 -3
  85. package/dist/{RabbitMQPublisher-qQT7-1-p.d.cts.map → RabbitMQPublisher-d257OHLa.d.cts.map} +1 -1
  86. package/dist/{RabbitMQSubscriber-C_sZjDPU.d.mts → RabbitMQSubscriber-BF7JGfYm.d.cts} +3 -3
  87. package/dist/{RabbitMQSubscriber-C_sZjDPU.d.mts.map → RabbitMQSubscriber-BF7JGfYm.d.cts.map} +1 -1
  88. package/dist/{RabbitMQSubscriber-D12sssMb.d.cts → RabbitMQSubscriber-CdbUy5mB.d.mts} +3 -3
  89. package/dist/{RabbitMQSubscriber-D12sssMb.d.cts.map → RabbitMQSubscriber-CdbUy5mB.d.mts.map} +1 -1
  90. package/dist/{SNSConnection-DqLbiQ_X.cjs → SNSConnection-CAcbLQOy.cjs} +2 -2
  91. package/dist/{SNSConnection-DqLbiQ_X.cjs.map → SNSConnection-CAcbLQOy.cjs.map} +1 -1
  92. package/dist/{SNSConnection-BDfQrVBO.d.cts → SNSConnection-CG4iEwA8.d.mts} +2 -2
  93. package/dist/{SNSConnection-BDfQrVBO.d.cts.map → SNSConnection-CG4iEwA8.d.mts.map} +1 -1
  94. package/dist/{SNSConnection-D8a31sJK.mjs → SNSConnection-CVjH93lb.mjs} +2 -2
  95. package/dist/{SNSConnection-D8a31sJK.mjs.map → SNSConnection-CVjH93lb.mjs.map} +1 -1
  96. package/dist/{SNSConnection-mHb10nQ6.d.mts → SNSConnection-Dol9FuxA.d.cts} +2 -2
  97. package/dist/{SNSConnection-mHb10nQ6.d.mts.map → SNSConnection-Dol9FuxA.d.cts.map} +1 -1
  98. package/dist/{SNSPublisher-i4w_-RmP.mjs → SNSPublisher-CjlMS3Z2.mjs} +1 -1
  99. package/dist/{SNSPublisher-i4w_-RmP.mjs.map → SNSPublisher-CjlMS3Z2.mjs.map} +1 -1
  100. package/dist/{SNSPublisher-CM7UAWtf.d.mts → SNSPublisher-D50dPCEh.d.mts} +3 -3
  101. package/dist/{SNSPublisher-CM7UAWtf.d.mts.map → SNSPublisher-D50dPCEh.d.mts.map} +1 -1
  102. package/dist/{SNSPublisher-kpsSlGDn.d.cts → SNSPublisher-DQunY4NM.d.cts} +3 -3
  103. package/dist/{SNSPublisher-kpsSlGDn.d.cts.map → SNSPublisher-DQunY4NM.d.cts.map} +1 -1
  104. package/dist/{SNSPublisher-BRgwumLS.cjs → SNSPublisher-DV_8GGsi.cjs} +1 -1
  105. package/dist/{SNSPublisher-BRgwumLS.cjs.map → SNSPublisher-DV_8GGsi.cjs.map} +1 -1
  106. package/dist/{SNSSubscriber-BEf-H4p5.mjs → SNSSubscriber-BWaCQFl6.mjs} +3 -3
  107. package/dist/{SNSSubscriber-BEf-H4p5.mjs.map → SNSSubscriber-BWaCQFl6.mjs.map} +1 -1
  108. package/dist/{SNSSubscriber-DDB3--pm.d.cts → SNSSubscriber-CUgHK4W2.d.mts} +3 -3
  109. package/dist/{SNSSubscriber-DDB3--pm.d.cts.map → SNSSubscriber-CUgHK4W2.d.mts.map} +1 -1
  110. package/dist/{SNSSubscriber-FYqSi346.cjs → SNSSubscriber-ZE_-Hsps.cjs} +3 -3
  111. package/dist/{SNSSubscriber-FYqSi346.cjs.map → SNSSubscriber-ZE_-Hsps.cjs.map} +1 -1
  112. package/dist/{SNSSubscriber-Dwo8391f.d.mts → SNSSubscriber-ZGJjhXFQ.d.cts} +3 -3
  113. package/dist/{SNSSubscriber-Dwo8391f.d.mts.map → SNSSubscriber-ZGJjhXFQ.d.cts.map} +1 -1
  114. package/dist/{SQSConnection-B5Ep9Tma.d.cts → SQSConnection-BtEkDha8.d.cts} +2 -2
  115. package/dist/{SQSConnection-B5Ep9Tma.d.cts.map → SQSConnection-BtEkDha8.d.cts.map} +1 -1
  116. package/dist/{SQSConnection-BwHhXLIu.mjs → SQSConnection-CT3S7_zP.mjs} +2 -2
  117. package/dist/{SQSConnection-BwHhXLIu.mjs.map → SQSConnection-CT3S7_zP.mjs.map} +1 -1
  118. package/dist/{SQSConnection-BI_xOzyJ.d.mts → SQSConnection-DVy43GCV.d.mts} +2 -2
  119. package/dist/{SQSConnection-BI_xOzyJ.d.mts.map → SQSConnection-DVy43GCV.d.mts.map} +1 -1
  120. package/dist/{SQSConnection-Ctu3XY9E.cjs → SQSConnection-Y0mdVTcB.cjs} +2 -2
  121. package/dist/{SQSConnection-Ctu3XY9E.cjs.map → SQSConnection-Y0mdVTcB.cjs.map} +1 -1
  122. package/dist/{SQSPublisher-BDGMw1uf.mjs → SQSPublisher-B-32CC4G.mjs} +1 -1
  123. package/dist/{SQSPublisher-BDGMw1uf.mjs.map → SQSPublisher-B-32CC4G.mjs.map} +1 -1
  124. package/dist/{SQSPublisher-C3Y_gOjV.cjs → SQSPublisher-CgUduk6H.cjs} +1 -1
  125. package/dist/{SQSPublisher-C3Y_gOjV.cjs.map → SQSPublisher-CgUduk6H.cjs.map} +1 -1
  126. package/dist/{SQSPublisher-BN1ds6SN.d.mts → SQSPublisher-kyl5HW3N.d.cts} +3 -3
  127. package/dist/{SQSPublisher-BN1ds6SN.d.mts.map → SQSPublisher-kyl5HW3N.d.cts.map} +1 -1
  128. package/dist/{SQSPublisher-DFTqwzRW.d.cts → SQSPublisher-qDE5Fp-N.d.mts} +3 -3
  129. package/dist/{SQSPublisher-DFTqwzRW.d.cts.map → SQSPublisher-qDE5Fp-N.d.mts.map} +1 -1
  130. package/dist/{SQSSubscriber-BB9TWyLA.cjs → SQSSubscriber-C4UA2hKq.cjs} +1 -1
  131. package/dist/{SQSSubscriber-BB9TWyLA.cjs.map → SQSSubscriber-C4UA2hKq.cjs.map} +1 -1
  132. package/dist/{SQSSubscriber-BO2me_gs.d.cts → SQSSubscriber-CDvaG4ij.d.cts} +3 -3
  133. package/dist/{SQSSubscriber-BO2me_gs.d.cts.map → SQSSubscriber-CDvaG4ij.d.cts.map} +1 -1
  134. package/dist/{SQSSubscriber-ux7QEMdd.mjs → SQSSubscriber-CQdSFzpe.mjs} +1 -1
  135. package/dist/{SQSSubscriber-ux7QEMdd.mjs.map → SQSSubscriber-CQdSFzpe.mjs.map} +1 -1
  136. package/dist/{SQSSubscriber-FyZFfr2-.d.mts → SQSSubscriber-JfFuAAoP.d.mts} +3 -3
  137. package/dist/{SQSSubscriber-FyZFfr2-.d.mts.map → SQSSubscriber-JfFuAAoP.d.mts.map} +1 -1
  138. package/dist/{Subscriber-BxT-KzFJ.d.mts → Subscriber-CG_QUQZs.d.cts} +2 -2
  139. package/dist/{Subscriber-BxT-KzFJ.d.mts.map → Subscriber-CG_QUQZs.d.cts.map} +1 -1
  140. package/dist/{Subscriber-saVOWuMq.cjs → Subscriber-CghW0A02.cjs} +11 -2
  141. package/dist/Subscriber-CghW0A02.cjs.map +1 -0
  142. package/dist/{Subscriber-DDD_4Nlx.d.cts → Subscriber-DiYHmuF0.d.mts} +2 -2
  143. package/dist/{Subscriber-DDD_4Nlx.d.cts.map → Subscriber-DiYHmuF0.d.mts.map} +1 -1
  144. package/dist/{Subscriber-Bd9hb_jp.mjs → Subscriber-bnkFtSvt.mjs} +11 -2
  145. package/dist/Subscriber-bnkFtSvt.mjs.map +1 -0
  146. package/dist/Subscriber.cjs +2 -2
  147. package/dist/Subscriber.d.cts +2 -2
  148. package/dist/Subscriber.d.mts +2 -2
  149. package/dist/Subscriber.mjs +2 -2
  150. package/dist/basic/BasicConnection.cjs +2 -2
  151. package/dist/basic/BasicConnection.d.cts +2 -2
  152. package/dist/basic/BasicConnection.d.mts +2 -2
  153. package/dist/basic/BasicConnection.mjs +2 -2
  154. package/dist/basic/BasicPublisher.cjs +1 -1
  155. package/dist/basic/BasicPublisher.d.cts +3 -3
  156. package/dist/basic/BasicPublisher.d.mts +3 -3
  157. package/dist/basic/BasicPublisher.mjs +1 -1
  158. package/dist/basic/BasicSubscriber.cjs +1 -1
  159. package/dist/basic/BasicSubscriber.d.cts +3 -3
  160. package/dist/basic/BasicSubscriber.d.mts +3 -3
  161. package/dist/basic/BasicSubscriber.mjs +1 -1
  162. package/dist/basic/index.cjs +4 -4
  163. package/dist/basic/index.d.cts +4 -4
  164. package/dist/basic/index.d.mts +4 -4
  165. package/dist/basic/index.mjs +4 -4
  166. package/dist/index.cjs +4 -4
  167. package/dist/index.d.cts +4 -4
  168. package/dist/index.d.mts +4 -4
  169. package/dist/index.mjs +4 -4
  170. package/dist/pgboss/PgBossConnection.cjs +4 -0
  171. package/dist/pgboss/PgBossConnection.d.cts +3 -0
  172. package/dist/pgboss/PgBossConnection.d.mts +3 -0
  173. package/dist/pgboss/PgBossConnection.mjs +4 -0
  174. package/dist/pgboss/PgBossPublisher.cjs +3 -0
  175. package/dist/pgboss/PgBossPublisher.d.cts +4 -0
  176. package/dist/pgboss/PgBossPublisher.d.mts +4 -0
  177. package/dist/pgboss/PgBossPublisher.mjs +3 -0
  178. package/dist/pgboss/PgBossSubscriber.cjs +3 -0
  179. package/dist/pgboss/PgBossSubscriber.d.cts +4 -0
  180. package/dist/pgboss/PgBossSubscriber.d.mts +4 -0
  181. package/dist/pgboss/PgBossSubscriber.mjs +3 -0
  182. package/dist/pgboss/index.cjs +8 -0
  183. package/dist/pgboss/index.d.cts +5 -0
  184. package/dist/pgboss/index.d.mts +5 -0
  185. package/dist/pgboss/index.mjs +6 -0
  186. package/dist/rabbitmq/RabbitMQConnection.cjs +2 -2
  187. package/dist/rabbitmq/RabbitMQConnection.d.cts +2 -2
  188. package/dist/rabbitmq/RabbitMQConnection.d.mts +2 -2
  189. package/dist/rabbitmq/RabbitMQConnection.mjs +2 -2
  190. package/dist/rabbitmq/RabbitMQPublisher.d.cts +3 -3
  191. package/dist/rabbitmq/RabbitMQPublisher.d.mts +3 -3
  192. package/dist/rabbitmq/RabbitMQSubscriber.d.cts +3 -3
  193. package/dist/rabbitmq/RabbitMQSubscriber.d.mts +3 -3
  194. package/dist/rabbitmq/index.cjs +2 -2
  195. package/dist/rabbitmq/index.d.cts +4 -4
  196. package/dist/rabbitmq/index.d.mts +4 -4
  197. package/dist/rabbitmq/index.mjs +2 -2
  198. package/dist/sns/SNSConnection.cjs +2 -2
  199. package/dist/sns/SNSConnection.d.cts +2 -2
  200. package/dist/sns/SNSConnection.d.mts +2 -2
  201. package/dist/sns/SNSConnection.mjs +2 -2
  202. package/dist/sns/SNSPublisher.cjs +1 -1
  203. package/dist/sns/SNSPublisher.d.cts +3 -3
  204. package/dist/sns/SNSPublisher.d.mts +3 -3
  205. package/dist/sns/SNSPublisher.mjs +1 -1
  206. package/dist/sns/SNSSubscriber.cjs +4 -4
  207. package/dist/sns/SNSSubscriber.d.cts +3 -3
  208. package/dist/sns/SNSSubscriber.d.mts +3 -3
  209. package/dist/sns/SNSSubscriber.mjs +4 -4
  210. package/dist/sns/index.cjs +6 -6
  211. package/dist/sns/index.d.cts +4 -4
  212. package/dist/sns/index.d.mts +4 -4
  213. package/dist/sns/index.mjs +6 -6
  214. package/dist/sqs/SQSConnection.cjs +2 -2
  215. package/dist/sqs/SQSConnection.d.cts +2 -2
  216. package/dist/sqs/SQSConnection.d.mts +2 -2
  217. package/dist/sqs/SQSConnection.mjs +2 -2
  218. package/dist/sqs/SQSPublisher.cjs +1 -1
  219. package/dist/sqs/SQSPublisher.d.cts +3 -3
  220. package/dist/sqs/SQSPublisher.d.mts +3 -3
  221. package/dist/sqs/SQSPublisher.mjs +1 -1
  222. package/dist/sqs/SQSSubscriber.cjs +1 -1
  223. package/dist/sqs/SQSSubscriber.d.cts +3 -3
  224. package/dist/sqs/SQSSubscriber.d.mts +3 -3
  225. package/dist/sqs/SQSSubscriber.mjs +1 -1
  226. package/dist/sqs/index.cjs +4 -4
  227. package/dist/sqs/index.d.cts +4 -4
  228. package/dist/sqs/index.d.mts +4 -4
  229. package/dist/sqs/index.mjs +4 -4
  230. package/dist/{types-B63qHVOG.mjs → types-BrdcSEnd.mjs} +2 -1
  231. package/dist/types-BrdcSEnd.mjs.map +1 -0
  232. package/dist/{types-CvSMEO5z.cjs → types-Byv8N9ma.cjs} +2 -1
  233. package/dist/types-Byv8N9ma.cjs.map +1 -0
  234. package/dist/{types-DSVsPgKd.d.mts → types-Dh9Jyinx.d.mts} +2 -1
  235. package/dist/types-Dh9Jyinx.d.mts.map +1 -0
  236. package/dist/{types-Dmbp1U-6.d.cts → types-Dj23od3e.d.cts} +2 -1
  237. package/dist/types-Dj23od3e.d.cts.map +1 -0
  238. package/dist/types.cjs +1 -1
  239. package/dist/types.d.cts +1 -1
  240. package/dist/types.d.mts +1 -1
  241. package/dist/types.mjs +1 -1
  242. package/package.json +11 -1
  243. package/src/EventConnection.ts +4 -0
  244. package/src/Publisher.ts +11 -0
  245. package/src/Subscriber.ts +11 -0
  246. package/src/pgboss/PgBossConnection.ts +91 -0
  247. package/src/pgboss/PgBossPublisher.ts +49 -0
  248. package/src/pgboss/PgBossSubscriber.ts +81 -0
  249. package/src/pgboss/__tests__/pgboss.spec.ts +183 -0
  250. package/src/pgboss/index.ts +5 -0
  251. package/src/types.ts +1 -0
  252. package/dist/Subscriber-Bd9hb_jp.mjs.map +0 -1
  253. package/dist/Subscriber-saVOWuMq.cjs.map +0 -1
  254. package/dist/types-B63qHVOG.mjs.map +0 -1
  255. package/dist/types-CvSMEO5z.cjs.map +0 -1
  256. package/dist/types-DSVsPgKd.d.mts.map +0 -1
  257. package/dist/types-Dmbp1U-6.d.cts.map +0 -1
@@ -1,6 +1,6 @@
1
- import "../types-B63qHVOG.mjs";
2
- import { SQSConnection } from "../SQSConnection-BwHhXLIu.mjs";
3
- import { SQSSubscriber } from "../SQSSubscriber-ux7QEMdd.mjs";
4
- import { SQSPublisher } from "../SQSPublisher-BDGMw1uf.mjs";
1
+ import "../types-BrdcSEnd.mjs";
2
+ import { SQSConnection } from "../SQSConnection-CT3S7_zP.mjs";
3
+ import { SQSSubscriber } from "../SQSSubscriber-CQdSFzpe.mjs";
4
+ import { SQSPublisher } from "../SQSPublisher-B-32CC4G.mjs";
5
5
 
6
6
  export { SQSConnection, SQSPublisher, SQSSubscriber };
@@ -9,9 +9,10 @@ let EventPublisherType = /* @__PURE__ */ function(EventPublisherType$1) {
9
9
  EventPublisherType$1["SNS"] = "sns";
10
10
  EventPublisherType$1["Kafka"] = "kafka";
11
11
  EventPublisherType$1["RabbitMQ"] = "rabbitmq";
12
+ EventPublisherType$1["PgBoss"] = "pgboss";
12
13
  return EventPublisherType$1;
13
14
  }({});
14
15
 
15
16
  //#endregion
16
17
  export { EventPublisherType };
17
- //# sourceMappingURL=types-B63qHVOG.mjs.map
18
+ //# sourceMappingURL=types-BrdcSEnd.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types-BrdcSEnd.mjs","names":[],"sources":["../src/types.ts"],"sourcesContent":["import type { InferStandardSchema } from '@geekmidas/schema';\nimport type { StandardSchemaV1 } from '@standard-schema/spec';\n\n/**\n * Represents a publishable event message with a type and payload.\n *\n * @template TType - The event type/name (e.g., 'user.created')\n * @template TPayload - The event payload data\n */\nexport type PublishableMessage<TType extends string, TPayload> = {\n\ttype: TType;\n\tpayload: TPayload;\n};\n\n/**\n * Event publisher/subscriber types\n */\nexport enum EventPublisherType {\n\tBasic = 'basic',\n\tEventBridge = 'eventbridge',\n\tSQS = 'sqs',\n\tSNS = 'sns',\n\tKafka = 'kafka',\n\tRabbitMQ = 'rabbitmq',\n\tPgBoss = 'pgboss',\n}\n\n/**\n * Base interface for event connections\n * Connections manage the underlying transport (RabbitMQ channel, SQS client, etc.)\n */\nexport interface EventConnection {\n\treadonly type: EventPublisherType;\n\tconnect(): Promise<void>;\n\tclose(): Promise<void>;\n\tisConnected(): boolean;\n}\n\n/**\n * Interface for event publishers that handle the actual publishing of events.\n * Implementations can send to EventBridge, SQS, Kafka, or any other event system.\n *\n * @template TMessage - The union type of all publishable messages\n */\nexport type EventPublisher<TMessage extends PublishableMessage<string, any>> = {\n\tpublish: (message: TMessage[]) => Promise<void>;\n};\n\n/**\n * Interface for event subscribers that handle receiving and processing events.\n *\n * @template TMessage - The union type of all publishable messages\n */\nexport type EventSubscriber<TMessage extends PublishableMessage<string, any>> =\n\t{\n\t\tsubscribe: (\n\t\t\tmessages: TMessage['type'][],\n\t\t\tlistener: (payload: TMessage) => Promise<void>,\n\t\t) => Promise<void>;\n\t};\n/**\n * Utility type to extract the message from EventPublisher\n */\nexport type ExtractPublisherMessage<T> =\n\tT extends EventPublisher<infer M> ? M : never;\n\nexport type MappedEvent<\n\tT extends EventPublisher<any> | undefined,\n\tOutSchema extends StandardSchemaV1 | undefined = undefined,\n> = {\n\ttype: ExtractPublisherMessage<T>['type'];\n\tpayload: (\n\t\tctx: InferStandardSchema<OutSchema>,\n\t) => ExtractPublisherMessage<T>['payload'];\n\twhen?: (ctx: InferStandardSchema<OutSchema>) => boolean;\n};\n"],"mappings":";;;;AAiBA,IAAY,oEAAL;AACN;AACA;AACA;AACA;AACA;AACA;AACA;;AACA"}
@@ -10,6 +10,7 @@ let EventPublisherType = /* @__PURE__ */ function(EventPublisherType$1) {
10
10
  EventPublisherType$1["SNS"] = "sns";
11
11
  EventPublisherType$1["Kafka"] = "kafka";
12
12
  EventPublisherType$1["RabbitMQ"] = "rabbitmq";
13
+ EventPublisherType$1["PgBoss"] = "pgboss";
13
14
  return EventPublisherType$1;
14
15
  }({});
15
16
 
@@ -20,4 +21,4 @@ Object.defineProperty(exports, 'EventPublisherType', {
20
21
  return EventPublisherType;
21
22
  }
22
23
  });
23
- //# sourceMappingURL=types-CvSMEO5z.cjs.map
24
+ //# sourceMappingURL=types-Byv8N9ma.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types-Byv8N9ma.cjs","names":[],"sources":["../src/types.ts"],"sourcesContent":["import type { InferStandardSchema } from '@geekmidas/schema';\nimport type { StandardSchemaV1 } from '@standard-schema/spec';\n\n/**\n * Represents a publishable event message with a type and payload.\n *\n * @template TType - The event type/name (e.g., 'user.created')\n * @template TPayload - The event payload data\n */\nexport type PublishableMessage<TType extends string, TPayload> = {\n\ttype: TType;\n\tpayload: TPayload;\n};\n\n/**\n * Event publisher/subscriber types\n */\nexport enum EventPublisherType {\n\tBasic = 'basic',\n\tEventBridge = 'eventbridge',\n\tSQS = 'sqs',\n\tSNS = 'sns',\n\tKafka = 'kafka',\n\tRabbitMQ = 'rabbitmq',\n\tPgBoss = 'pgboss',\n}\n\n/**\n * Base interface for event connections\n * Connections manage the underlying transport (RabbitMQ channel, SQS client, etc.)\n */\nexport interface EventConnection {\n\treadonly type: EventPublisherType;\n\tconnect(): Promise<void>;\n\tclose(): Promise<void>;\n\tisConnected(): boolean;\n}\n\n/**\n * Interface for event publishers that handle the actual publishing of events.\n * Implementations can send to EventBridge, SQS, Kafka, or any other event system.\n *\n * @template TMessage - The union type of all publishable messages\n */\nexport type EventPublisher<TMessage extends PublishableMessage<string, any>> = {\n\tpublish: (message: TMessage[]) => Promise<void>;\n};\n\n/**\n * Interface for event subscribers that handle receiving and processing events.\n *\n * @template TMessage - The union type of all publishable messages\n */\nexport type EventSubscriber<TMessage extends PublishableMessage<string, any>> =\n\t{\n\t\tsubscribe: (\n\t\t\tmessages: TMessage['type'][],\n\t\t\tlistener: (payload: TMessage) => Promise<void>,\n\t\t) => Promise<void>;\n\t};\n/**\n * Utility type to extract the message from EventPublisher\n */\nexport type ExtractPublisherMessage<T> =\n\tT extends EventPublisher<infer M> ? M : never;\n\nexport type MappedEvent<\n\tT extends EventPublisher<any> | undefined,\n\tOutSchema extends StandardSchemaV1 | undefined = undefined,\n> = {\n\ttype: ExtractPublisherMessage<T>['type'];\n\tpayload: (\n\t\tctx: InferStandardSchema<OutSchema>,\n\t) => ExtractPublisherMessage<T>['payload'];\n\twhen?: (ctx: InferStandardSchema<OutSchema>) => boolean;\n};\n"],"mappings":";;;;;AAiBA,IAAY,oEAAL;AACN;AACA;AACA;AACA;AACA;AACA;AACA;;AACA"}
@@ -23,6 +23,7 @@ declare enum EventPublisherType {
23
23
  SNS = "sns",
24
24
  Kafka = "kafka",
25
25
  RabbitMQ = "rabbitmq",
26
+ PgBoss = "pgboss",
26
27
  }
27
28
  /**
28
29
  * Base interface for event connections
@@ -63,4 +64,4 @@ type MappedEvent<T extends EventPublisher<any> | undefined, OutSchema extends St
63
64
  //# sourceMappingURL=types.d.ts.map
64
65
  //#endregion
65
66
  export { EventConnection, EventPublisher, EventPublisherType, EventSubscriber, ExtractPublisherMessage, MappedEvent, PublishableMessage };
66
- //# sourceMappingURL=types-DSVsPgKd.d.mts.map
67
+ //# sourceMappingURL=types-Dh9Jyinx.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types-Dh9Jyinx.d.mts","names":[],"sources":["../src/types.ts"],"sourcesContent":[],"mappings":";;;;;;;AASA;;;;AAEkB,KAFN,kBAEM,CAAA,cAAA,MAAA,EAAA,QAAA,CAAA,GAAA;EAMN,IAAA,EAPL,KAOK;EAcK,OAAA,EApBP,QAoBO;CAAe;;;;AAGf,aAjBL,kBAAA;EA2BA,KAAA,GAAA,OAAA;EAAc,WAAA,GAAA,aAAA;EAAA,GAAkB,GAAA,KAAA;EAAkB,GAC1C,GAAA,KAAA;EAAQ,KAAO,GAAA,OAAA;EAAO,QAAA,GAAA,UAAA;EAQ9B,MAAA,GAAA,QAAA;;;;;;AAKL,UA3BU,eAAA,CA2BV;EAAO,SAAA,IAAA,EA1BE,kBA0BF;EAKF,OAAA,EAAA,EA9BA,OA8BA,CAAA,IAAA,CAAA;EAAuB,KAAA,EAAA,EA7BzB,OA6ByB,CAAA,IAAA,CAAA;EAAA,WAClC,EAAA,EAAA,OAAA;;;AAAqC;AAEtC;;;;AAI+B,KA1BnB,cA0BmB,CAAA,iBA1Ba,kBA0Bb,CAAA,MAAA,EAAA,GAAA,CAAA,CAAA,GAAA;EAAC,OAAzB,EAAA,CAAA,OAAA,EAzBa,QAyBb,EAAA,EAAA,GAzB4B,OAyB5B,CAAA,IAAA,CAAA;CAAuB;;;;;;AAIG,KArBrB,eAqBqB,CAAA,iBArBY,kBAqBZ,CAAA,MAAA,EAAA,GAAA,CAAA,CAAA,GAAA;wBAlBpB,wCACU,aAAa,kBAC7B;;;;;KAKK,6BACX,UAAU,0BAA0B;KAEzB,sBACD,mDACQ;QAEZ,wBAAwB;iBAExB,oBAAoB,eACrB,wBAAwB;eAChB,oBAAoB"}
@@ -23,6 +23,7 @@ declare enum EventPublisherType {
23
23
  SNS = "sns",
24
24
  Kafka = "kafka",
25
25
  RabbitMQ = "rabbitmq",
26
+ PgBoss = "pgboss",
26
27
  }
27
28
  /**
28
29
  * Base interface for event connections
@@ -63,4 +64,4 @@ type MappedEvent<T extends EventPublisher<any> | undefined, OutSchema extends St
63
64
  //# sourceMappingURL=types.d.ts.map
64
65
  //#endregion
65
66
  export { EventConnection, EventPublisher, EventPublisherType, EventSubscriber, ExtractPublisherMessage, MappedEvent, PublishableMessage };
66
- //# sourceMappingURL=types-Dmbp1U-6.d.cts.map
67
+ //# sourceMappingURL=types-Dj23od3e.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types-Dj23od3e.d.cts","names":[],"sources":["../src/types.ts"],"sourcesContent":[],"mappings":";;;;;;;AASA;;;;AAEkB,KAFN,kBAEM,CAAA,cAAA,MAAA,EAAA,QAAA,CAAA,GAAA;EAMN,IAAA,EAPL,KAOK;EAcK,OAAA,EApBP,QAoBO;CAAe;;;;AAGf,aAjBL,kBAAA;EA2BA,KAAA,GAAA,OAAA;EAAc,WAAA,GAAA,aAAA;EAAA,GAAkB,GAAA,KAAA;EAAkB,GAC1C,GAAA,KAAA;EAAQ,KAAO,GAAA,OAAA;EAAO,QAAA,GAAA,UAAA;EAQ9B,MAAA,GAAA,QAAA;;;;;;AAKL,UA3BU,eAAA,CA2BV;EAAO,SAAA,IAAA,EA1BE,kBA0BF;EAKF,OAAA,EAAA,EA9BA,OA8BA,CAAA,IAAA,CAAA;EAAuB,KAAA,EAAA,EA7BzB,OA6ByB,CAAA,IAAA,CAAA;EAAA,WAClC,EAAA,EAAA,OAAA;;;AAAqC;AAEtC;;;;AAI+B,KA1BnB,cA0BmB,CAAA,iBA1Ba,kBA0Bb,CAAA,MAAA,EAAA,GAAA,CAAA,CAAA,GAAA;EAAC,OAAzB,EAAA,CAAA,OAAA,EAzBa,QAyBb,EAAA,EAAA,GAzB4B,OAyB5B,CAAA,IAAA,CAAA;CAAuB;;;;;;AAIG,KArBrB,eAqBqB,CAAA,iBArBY,kBAqBZ,CAAA,MAAA,EAAA,GAAA,CAAA,CAAA,GAAA;wBAlBpB,wCACU,aAAa,kBAC7B;;;;;KAKK,6BACX,UAAU,0BAA0B;KAEzB,sBACD,mDACQ;QAEZ,wBAAwB;iBAExB,oBAAoB,eACrB,wBAAwB;eAChB,oBAAoB"}
package/dist/types.cjs CHANGED
@@ -1,3 +1,3 @@
1
- const require_types = require('./types-CvSMEO5z.cjs');
1
+ const require_types = require('./types-Byv8N9ma.cjs');
2
2
 
3
3
  exports.EventPublisherType = require_types.EventPublisherType;
package/dist/types.d.cts CHANGED
@@ -1,2 +1,2 @@
1
- import { EventConnection, EventPublisher, EventPublisherType, EventSubscriber, ExtractPublisherMessage, MappedEvent, PublishableMessage } from "./types-Dmbp1U-6.cjs";
1
+ import { EventConnection, EventPublisher, EventPublisherType, EventSubscriber, ExtractPublisherMessage, MappedEvent, PublishableMessage } from "./types-Dj23od3e.cjs";
2
2
  export { EventConnection, EventPublisher, EventPublisherType, EventSubscriber, ExtractPublisherMessage, MappedEvent, PublishableMessage };
package/dist/types.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- import { EventConnection, EventPublisher, EventPublisherType, EventSubscriber, ExtractPublisherMessage, MappedEvent, PublishableMessage } from "./types-DSVsPgKd.mjs";
1
+ import { EventConnection, EventPublisher, EventPublisherType, EventSubscriber, ExtractPublisherMessage, MappedEvent, PublishableMessage } from "./types-Dh9Jyinx.mjs";
2
2
  export { EventConnection, EventPublisher, EventPublisherType, EventSubscriber, ExtractPublisherMessage, MappedEvent, PublishableMessage };
package/dist/types.mjs CHANGED
@@ -1,3 +1,3 @@
1
- import { EventPublisherType } from "./types-B63qHVOG.mjs";
1
+ import { EventPublisherType } from "./types-BrdcSEnd.mjs";
2
2
 
3
3
  export { EventPublisherType };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@geekmidas/events",
3
- "version": "1.0.0",
3
+ "version": "1.1.1",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
@@ -27,6 +27,11 @@
27
27
  "types": "./dist/sns/index.d.ts",
28
28
  "import": "./dist/sns/index.mjs",
29
29
  "require": "./dist/sns/index.cjs"
30
+ },
31
+ "./pgboss": {
32
+ "types": "./dist/pgboss/index.d.ts",
33
+ "import": "./dist/pgboss/index.mjs",
34
+ "require": "./dist/pgboss/index.cjs"
30
35
  }
31
36
  },
32
37
  "repository": {
@@ -44,6 +49,7 @@
44
49
  "amqplib": "^0.10.3",
45
50
  "@aws-sdk/client-sqs": "~3.908.0",
46
51
  "@aws-sdk/client-sns": "~3.908.0",
52
+ "pg-boss": ">=12.0.0",
47
53
  "@geekmidas/schema": "^1.0.0"
48
54
  },
49
55
  "peerDependenciesMeta": {
@@ -58,11 +64,15 @@
58
64
  },
59
65
  "@aws-sdk/client-sns": {
60
66
  "optional": true
67
+ },
68
+ "pg-boss": {
69
+ "optional": true
61
70
  }
62
71
  },
63
72
  "devDependencies": {
64
73
  "@types/amqplib": "~0.10.7",
65
74
  "@types/lodash.chunk": "~4.2.0",
75
+ "pg-boss": "~12.18.1",
66
76
  "@geekmidas/schema": "^1.0.0"
67
77
  }
68
78
  }
@@ -29,6 +29,10 @@ export class EventConnectionFactory {
29
29
  const { SNSConnection } = await import('./sns');
30
30
  return SNSConnection.fromConnectionString(connectionStr);
31
31
  }
32
+ case EventPublisherType.PgBoss: {
33
+ const { PgBossConnection } = await import('./pgboss');
34
+ return PgBossConnection.fromConnectionString(connectionStr);
35
+ }
32
36
  default:
33
37
  throw new Error(`Unsupported connection type: ${protocol}`);
34
38
  }
package/src/Publisher.ts CHANGED
@@ -35,6 +35,10 @@ export class Publisher {
35
35
  const { SNSPublisher } = await import('./sns');
36
36
  return SNSPublisher.fromConnectionString<TMessage>(connectionStr);
37
37
  }
38
+ case EventPublisherType.PgBoss: {
39
+ const { PgBossPublisher } = await import('./pgboss');
40
+ return PgBossPublisher.fromConnectionString<TMessage>(connectionStr);
41
+ }
38
42
  // Future implementations for EventBridge, Kafka, etc.
39
43
  default:
40
44
  throw new Error(`Unsupported event publisher type: ${url.protocol}`);
@@ -77,6 +81,13 @@ export class Publisher {
77
81
  connection as InstanceType<typeof SNSConnection>,
78
82
  );
79
83
  }
84
+ case EventPublisherType.PgBoss: {
85
+ const { PgBossPublisher } = await import('./pgboss');
86
+ const { PgBossConnection } = await import('./pgboss');
87
+ return new PgBossPublisher<TMessage>(
88
+ connection as InstanceType<typeof PgBossConnection>,
89
+ );
90
+ }
80
91
  default:
81
92
  throw new Error(`Unsupported connection type: ${connection.type}`);
82
93
  }
package/src/Subscriber.ts CHANGED
@@ -50,6 +50,10 @@ export class Subscriber {
50
50
  await SQSConnection.fromConnectionString(connectionStr);
51
51
  return new SQSSubscriber<TMessage>(connection);
52
52
  }
53
+ case EventPublisherType.PgBoss: {
54
+ const { PgBossSubscriber } = await import('./pgboss');
55
+ return PgBossSubscriber.fromConnectionString<TMessage>(connectionStr);
56
+ }
53
57
  // Future implementations for EventBridge, Kafka, etc.
54
58
  default:
55
59
  throw new Error(`Unsupported event subscriber type: ${url.protocol}`);
@@ -92,6 +96,13 @@ export class Subscriber {
92
96
  connection as InstanceType<typeof SQSConnection>,
93
97
  );
94
98
  }
99
+ case EventPublisherType.PgBoss: {
100
+ const { PgBossSubscriber } = await import('./pgboss');
101
+ const { PgBossConnection } = await import('./pgboss');
102
+ return new PgBossSubscriber<TMessage>(
103
+ connection as InstanceType<typeof PgBossConnection>,
104
+ );
105
+ }
95
106
  default:
96
107
  throw new Error(`Unsupported connection type: ${connection.type}`);
97
108
  }
@@ -0,0 +1,91 @@
1
+ import { PgBoss } from 'pg-boss';
2
+ import type { EventConnection } from '../types';
3
+ import { EventPublisherType } from '../types';
4
+
5
+ export interface PgBossConnectionConfig {
6
+ connectionString: string;
7
+ schema?: string;
8
+ }
9
+
10
+ export class PgBossConnection implements EventConnection {
11
+ readonly type = EventPublisherType.PgBoss;
12
+ private boss?: PgBoss;
13
+ private connecting?: Promise<void>;
14
+
15
+ constructor(private config: PgBossConnectionConfig) {}
16
+
17
+ /**
18
+ * Create a PgBossConnection from a connection string.
19
+ * Format: pgboss://user:pass@host:5432/database?schema=pgboss
20
+ */
21
+ static async fromConnectionString(
22
+ connectionString: string,
23
+ ): Promise<PgBossConnection> {
24
+ const url = new URL(connectionString);
25
+ const params = url.searchParams;
26
+
27
+ const postgresUrl = `postgres://${url.username ? `${url.username}:${url.password}@` : ''}${url.host}${url.pathname}`;
28
+
29
+ const config: PgBossConnectionConfig = {
30
+ connectionString: postgresUrl,
31
+ schema: params.get('schema') || undefined,
32
+ };
33
+
34
+ const connection = new PgBossConnection(config);
35
+ await connection.connect();
36
+ return connection;
37
+ }
38
+
39
+ async connect(): Promise<void> {
40
+ if (this.boss) return;
41
+
42
+ if (this.connecting) {
43
+ await this.connecting;
44
+ return;
45
+ }
46
+
47
+ this.connecting = (async () => {
48
+ try {
49
+ const boss = new PgBoss({
50
+ connectionString: this.config.connectionString,
51
+ ...(this.config.schema && { schema: this.config.schema }),
52
+ });
53
+
54
+ await boss.start();
55
+ this.boss = boss;
56
+ } catch (error) {
57
+ this.cleanup();
58
+ throw error;
59
+ }
60
+ })();
61
+
62
+ await this.connecting;
63
+ this.connecting = undefined;
64
+ }
65
+
66
+ async close(): Promise<void> {
67
+ try {
68
+ await this.boss?.stop({ graceful: true });
69
+ } catch {
70
+ // Ignore errors during close
71
+ } finally {
72
+ this.cleanup();
73
+ }
74
+ }
75
+
76
+ isConnected(): boolean {
77
+ return !!this.boss;
78
+ }
79
+
80
+ private cleanup(): void {
81
+ this.boss = undefined;
82
+ this.connecting = undefined;
83
+ }
84
+
85
+ /**
86
+ * Get the underlying pg-boss instance for publishing/subscribing
87
+ */
88
+ get instance(): PgBoss | undefined {
89
+ return this.boss;
90
+ }
91
+ }
@@ -0,0 +1,49 @@
1
+ import type { EventPublisher, PublishableMessage } from '../types';
2
+ import type { PgBossConnection } from './PgBossConnection';
3
+
4
+ export class PgBossPublisher<TMessage extends PublishableMessage<string, any>>
5
+ implements EventPublisher<TMessage>
6
+ {
7
+ constructor(private connection: PgBossConnection) {}
8
+
9
+ /**
10
+ * Create a PgBossPublisher from a connection string.
11
+ * Format: pgboss://user:pass@host:5432/database?schema=pgboss
12
+ */
13
+ static async fromConnectionString<
14
+ TMessage extends PublishableMessage<string, any>,
15
+ >(connectionString: string): Promise<PgBossPublisher<TMessage>> {
16
+ const { PgBossConnection } = await import('./PgBossConnection');
17
+ const connection =
18
+ await PgBossConnection.fromConnectionString(connectionString);
19
+ return new PgBossPublisher<TMessage>(connection);
20
+ }
21
+
22
+ async publish(messages: TMessage[]): Promise<void> {
23
+ if (!this.connection.isConnected()) {
24
+ await this.connection.connect();
25
+ }
26
+
27
+ const boss = this.connection.instance;
28
+ if (!boss) {
29
+ throw new Error('PgBoss instance not initialized');
30
+ }
31
+
32
+ // Group jobs by queue name (v11+ requires per-queue insert calls)
33
+ const groups = new Map<string, { data: TMessage['payload'] }[]>();
34
+ for (const m of messages) {
35
+ const list = groups.get(m.type) ?? [];
36
+ list.push({ data: m.payload });
37
+ groups.set(m.type, list);
38
+ }
39
+
40
+ for (const [name, jobs] of groups) {
41
+ await boss.createQueue(name);
42
+ await boss.insert(name, jobs);
43
+ }
44
+ }
45
+
46
+ async close(): Promise<void> {
47
+ // Publisher doesn't own the connection
48
+ }
49
+ }
@@ -0,0 +1,81 @@
1
+ import type { EventSubscriber, PublishableMessage } from '../types';
2
+ import type { PgBossConnection } from './PgBossConnection';
3
+
4
+ export interface PgBossSubscriberOptions {
5
+ batchSize?: number;
6
+ pollingIntervalSeconds?: number;
7
+ }
8
+
9
+ export class PgBossSubscriber<TMessage extends PublishableMessage<string, any>>
10
+ implements EventSubscriber<TMessage>
11
+ {
12
+ constructor(
13
+ private connection: PgBossConnection,
14
+ private options: PgBossSubscriberOptions = {},
15
+ ) {}
16
+
17
+ /**
18
+ * Create a PgBossSubscriber from a connection string.
19
+ * Format: pgboss://user:pass@host:5432/database?schema=pgboss&batchSize=5
20
+ */
21
+ static async fromConnectionString<
22
+ TMessage extends PublishableMessage<string, any>,
23
+ >(connectionString: string): Promise<PgBossSubscriber<TMessage>> {
24
+ const url = new URL(connectionString);
25
+ const params = url.searchParams;
26
+
27
+ const { PgBossConnection } = await import('./PgBossConnection');
28
+ const connection =
29
+ await PgBossConnection.fromConnectionString(connectionString);
30
+
31
+ const options: PgBossSubscriberOptions = {
32
+ batchSize: params.get('batchSize')
33
+ ? Number.parseInt(params.get('batchSize')!, 10)
34
+ : undefined,
35
+ pollingIntervalSeconds: params.get('pollingIntervalSeconds')
36
+ ? Number.parseInt(params.get('pollingIntervalSeconds')!, 10)
37
+ : undefined,
38
+ };
39
+
40
+ return new PgBossSubscriber<TMessage>(connection, options);
41
+ }
42
+
43
+ async subscribe(
44
+ messages: TMessage['type'][],
45
+ listener: (payload: TMessage) => Promise<void>,
46
+ ): Promise<void> {
47
+ if (!this.connection.isConnected()) {
48
+ await this.connection.connect();
49
+ }
50
+
51
+ const boss = this.connection.instance;
52
+ if (!boss) {
53
+ throw new Error('PgBoss instance not initialized');
54
+ }
55
+
56
+ for (const messageType of messages) {
57
+ await boss.createQueue(messageType);
58
+ await boss.work(
59
+ messageType,
60
+ {
61
+ ...(this.options.batchSize && {
62
+ batchSize: this.options.batchSize,
63
+ }),
64
+ ...(this.options.pollingIntervalSeconds && {
65
+ pollingIntervalSeconds: this.options.pollingIntervalSeconds,
66
+ }),
67
+ },
68
+ async (jobs) => {
69
+ for (const job of jobs) {
70
+ const fullMessage = {
71
+ type: job.name,
72
+ payload: job.data,
73
+ } as TMessage;
74
+
75
+ await listener(fullMessage);
76
+ }
77
+ },
78
+ );
79
+ }
80
+ }
81
+ }
@@ -0,0 +1,183 @@
1
+ import { afterAll, beforeAll, describe, expect, it } from 'vitest';
2
+ import type { PublishableMessage } from '../../types';
3
+ import { PgBossConnection } from '../PgBossConnection';
4
+ import { PgBossPublisher } from '../PgBossPublisher';
5
+ import { PgBossSubscriber } from '../PgBossSubscriber';
6
+
7
+ type TestMessage =
8
+ | PublishableMessage<'user.created', { userId: string }>
9
+ | PublishableMessage<'user.updated', { userId: string; name: string }>;
10
+
11
+ const POSTGRES_URL = 'postgres://geekmidas:geekmidas@localhost:5432/geekmidas';
12
+ const PGBOSS_CONNECTION_STRING =
13
+ 'pgboss://geekmidas:geekmidas@localhost:5432/geekmidas?schema=pgboss_test';
14
+
15
+ const uniqueQueue = () =>
16
+ `test-${Date.now()}-${Math.random().toString(36).substring(7)}`;
17
+
18
+ describe('PgBossConnection', () => {
19
+ it('should connect and report connected status', async () => {
20
+ const connection = new PgBossConnection({
21
+ connectionString: POSTGRES_URL,
22
+ schema: 'pgboss_conn_test',
23
+ });
24
+
25
+ expect(connection.isConnected()).toBe(false);
26
+ expect(connection.instance).toBeUndefined();
27
+
28
+ await connection.connect();
29
+
30
+ expect(connection.isConnected()).toBe(true);
31
+ expect(connection.instance).toBeDefined();
32
+
33
+ await connection.close();
34
+
35
+ expect(connection.isConnected()).toBe(false);
36
+ });
37
+
38
+ it('should not reconnect if already connected', async () => {
39
+ const connection = new PgBossConnection({
40
+ connectionString: POSTGRES_URL,
41
+ schema: 'pgboss_conn_test2',
42
+ });
43
+
44
+ await connection.connect();
45
+ const firstInstance = connection.instance;
46
+
47
+ await connection.connect();
48
+ expect(connection.instance).toBe(firstInstance);
49
+
50
+ await connection.close();
51
+ });
52
+
53
+ it('should parse connection string correctly', async () => {
54
+ const connection = await PgBossConnection.fromConnectionString(
55
+ PGBOSS_CONNECTION_STRING,
56
+ );
57
+
58
+ expect(connection.isConnected()).toBe(true);
59
+ expect(connection.instance).toBeDefined();
60
+
61
+ await connection.close();
62
+ });
63
+ });
64
+
65
+ describe('PgBossPublisher', () => {
66
+ let connection: PgBossConnection;
67
+
68
+ beforeAll(async () => {
69
+ connection = new PgBossConnection({
70
+ connectionString: POSTGRES_URL,
71
+ schema: 'pgboss_pub_test',
72
+ });
73
+ await connection.connect();
74
+ });
75
+
76
+ afterAll(async () => {
77
+ await connection.close();
78
+ });
79
+
80
+ it('should publish messages without errors', async () => {
81
+ const publisher = new PgBossPublisher<TestMessage>(connection);
82
+
83
+ await publisher.publish([
84
+ { type: uniqueQueue() as any, payload: { userId: '1' } },
85
+ ]);
86
+ });
87
+
88
+ it('should publish multiple messages with different types', async () => {
89
+ const publisher = new PgBossPublisher<TestMessage>(connection);
90
+ const queue1 = uniqueQueue() as any;
91
+ const queue2 = uniqueQueue() as any;
92
+
93
+ await publisher.publish([
94
+ { type: queue1, payload: { userId: '1' } },
95
+ { type: queue1, payload: { userId: '2' } },
96
+ { type: queue2, payload: { userId: '3', name: 'Alice' } },
97
+ ]);
98
+ });
99
+
100
+ it('should create publisher from connection string', async () => {
101
+ const publisher = await PgBossPublisher.fromConnectionString<TestMessage>(
102
+ PGBOSS_CONNECTION_STRING,
103
+ );
104
+
105
+ expect(publisher).toBeInstanceOf(PgBossPublisher);
106
+ });
107
+ });
108
+
109
+ describe('PgBossSubscriber', () => {
110
+ let connection: PgBossConnection;
111
+
112
+ beforeAll(async () => {
113
+ connection = new PgBossConnection({
114
+ connectionString: POSTGRES_URL,
115
+ schema: 'pgboss_sub_test',
116
+ });
117
+ await connection.connect();
118
+ });
119
+
120
+ afterAll(async () => {
121
+ await connection.close();
122
+ });
123
+
124
+ it('should receive published messages', async () => {
125
+ const queueName = uniqueQueue() as any;
126
+ const publisher = new PgBossPublisher<TestMessage>(connection);
127
+ const subscriber = new PgBossSubscriber<TestMessage>(connection, {
128
+ pollingIntervalSeconds: 1,
129
+ });
130
+
131
+ const received: TestMessage[] = [];
132
+
133
+ await subscriber.subscribe([queueName], async (message) => {
134
+ received.push(message);
135
+ });
136
+
137
+ await publisher.publish([{ type: queueName, payload: { userId: '42' } }]);
138
+
139
+ // Wait for pg-boss to poll and deliver
140
+ await new Promise((resolve) => setTimeout(resolve, 3000));
141
+
142
+ expect(received.length).toBe(1);
143
+ expect(received[0]).toEqual({
144
+ type: queueName,
145
+ payload: { userId: '42' },
146
+ });
147
+ });
148
+
149
+ it('should subscribe to multiple message types', async () => {
150
+ const queue1 = uniqueQueue() as any;
151
+ const queue2 = uniqueQueue() as any;
152
+ const publisher = new PgBossPublisher<TestMessage>(connection);
153
+ const subscriber = new PgBossSubscriber<TestMessage>(connection, {
154
+ pollingIntervalSeconds: 1,
155
+ });
156
+
157
+ const received: TestMessage[] = [];
158
+
159
+ await subscriber.subscribe([queue1, queue2], async (message) => {
160
+ received.push(message);
161
+ });
162
+
163
+ await publisher.publish([
164
+ { type: queue1, payload: { userId: '1' } },
165
+ { type: queue2, payload: { userId: '2', name: 'Bob' } },
166
+ ]);
167
+
168
+ await new Promise((resolve) => setTimeout(resolve, 3000));
169
+
170
+ expect(received.length).toBe(2);
171
+ expect(received.map((m) => m.payload)).toEqual(
172
+ expect.arrayContaining([{ userId: '1' }, { userId: '2', name: 'Bob' }]),
173
+ );
174
+ });
175
+
176
+ it('should create subscriber from connection string with options', async () => {
177
+ const subscriber = await PgBossSubscriber.fromConnectionString<TestMessage>(
178
+ `${PGBOSS_CONNECTION_STRING}&batchSize=10`,
179
+ );
180
+
181
+ expect(subscriber).toBeInstanceOf(PgBossSubscriber);
182
+ });
183
+ });
@@ -0,0 +1,5 @@
1
+ export type { PgBossConnectionConfig } from './PgBossConnection';
2
+ export { PgBossConnection } from './PgBossConnection';
3
+ export { PgBossPublisher } from './PgBossPublisher';
4
+ export type { PgBossSubscriberOptions } from './PgBossSubscriber';
5
+ export { PgBossSubscriber } from './PgBossSubscriber';
package/src/types.ts CHANGED
@@ -22,6 +22,7 @@ export enum EventPublisherType {
22
22
  SNS = 'sns',
23
23
  Kafka = 'kafka',
24
24
  RabbitMQ = 'rabbitmq',
25
+ PgBoss = 'pgboss',
25
26
  }
26
27
 
27
28
  /**
@@ -1 +0,0 @@
1
- {"version":3,"file":"Subscriber-Bd9hb_jp.mjs","names":["connectionStr: EventSubscriberConnectionString","url","connection: EventConnection"],"sources":["../src/Subscriber.ts"],"sourcesContent":["import type {\n\tEventConnection,\n\tEventSubscriber,\n\tPublishableMessage,\n} from './types';\nimport { EventPublisherType } from './types';\n\nexport class Subscriber {\n\t/**\n\t * Create a subscriber from a connection string\n\t * This creates both a connection and a subscriber\n\t */\n\tstatic async fromConnectionString<\n\t\tTMessage extends PublishableMessage<string, any>,\n\t>(\n\t\tconnectionStr: EventSubscriberConnectionString,\n\t): Promise<EventSubscriber<TMessage>> {\n\t\tconst url = new URL(connectionStr);\n\t\tswitch (url.protocol.replace(':', '')) {\n\t\t\tcase EventPublisherType.Basic: {\n\t\t\t\tconst { BasicConnection, BasicSubscriber } = await import('./basic');\n\t\t\t\tconst connection =\n\t\t\t\t\tawait BasicConnection.fromConnectionString(connectionStr);\n\t\t\t\treturn new BasicSubscriber<TMessage>(connection);\n\t\t\t}\n\t\t\tcase EventPublisherType.RabbitMQ: {\n\t\t\t\tconst { RabbitMQSubscriber } = await import('./rabbitmq');\n\t\t\t\treturn RabbitMQSubscriber.fromConnectionString<TMessage>(connectionStr);\n\t\t\t}\n\t\t\tcase EventPublisherType.SNS: {\n\t\t\t\tconst { SNSSubscriber } = await import('./sns');\n\t\t\t\treturn SNSSubscriber.fromConnectionString<TMessage>(connectionStr);\n\t\t\t}\n\t\t\tcase EventPublisherType.SQS: {\n\t\t\t\tconst url = new URL(connectionStr);\n\t\t\t\tconst topicArn = url.searchParams.get('topicArn');\n\n\t\t\t\t// If topicArn is present, use managed SNS→SQS subscription\n\t\t\t\tif (topicArn) {\n\t\t\t\t\tconst { SNSSubscriber } = await import('./sns');\n\t\t\t\t\t// Convert SQS connection string to SNS connection string\n\t\t\t\t\tconst snsConnectionStr = connectionStr.replace('sqs://', 'sns://');\n\t\t\t\t\treturn SNSSubscriber.fromConnectionString<TMessage>(snsConnectionStr);\n\t\t\t\t}\n\n\t\t\t\t// Direct SQS subscriber\n\t\t\t\tconst { SQSSubscriber } = await import('./sqs');\n\t\t\t\tconst { SQSConnection } = await import('./sqs');\n\t\t\t\tconst connection =\n\t\t\t\t\tawait SQSConnection.fromConnectionString(connectionStr);\n\t\t\t\treturn new SQSSubscriber<TMessage>(connection);\n\t\t\t}\n\t\t\t// Future implementations for EventBridge, Kafka, etc.\n\t\t\tdefault:\n\t\t\t\tthrow new Error(`Unsupported event subscriber type: ${url.protocol}`);\n\t\t}\n\t}\n\n\t/**\n\t * Create a subscriber from an existing connection\n\t * This allows sharing connections between publishers and subscribers\n\t */\n\tstatic async fromConnection<TMessage extends PublishableMessage<string, any>>(\n\t\tconnection: EventConnection,\n\t): Promise<EventSubscriber<TMessage>> {\n\t\tswitch (connection.type) {\n\t\t\tcase EventPublisherType.Basic: {\n\t\t\t\tconst { BasicSubscriber } = await import('./basic');\n\t\t\t\tconst { BasicConnection } = await import('./basic');\n\t\t\t\treturn new BasicSubscriber<TMessage>(\n\t\t\t\t\tconnection as InstanceType<typeof BasicConnection>,\n\t\t\t\t);\n\t\t\t}\n\t\t\tcase EventPublisherType.RabbitMQ: {\n\t\t\t\tconst { RabbitMQSubscriber } = await import('./rabbitmq');\n\t\t\t\tconst { RabbitMQConnection } = await import('./rabbitmq');\n\t\t\t\treturn new RabbitMQSubscriber<TMessage>(\n\t\t\t\t\tconnection as InstanceType<typeof RabbitMQConnection>,\n\t\t\t\t);\n\t\t\t}\n\t\t\tcase EventPublisherType.SNS: {\n\t\t\t\tconst { SNSSubscriber } = await import('./sns');\n\t\t\t\tconst { SNSConnection } = await import('./sns');\n\t\t\t\treturn new SNSSubscriber<TMessage>(\n\t\t\t\t\tconnection as InstanceType<typeof SNSConnection>,\n\t\t\t\t);\n\t\t\t}\n\t\t\tcase EventPublisherType.SQS: {\n\t\t\t\tconst { SQSSubscriber } = await import('./sqs');\n\t\t\t\tconst { SQSConnection } = await import('./sqs');\n\t\t\t\treturn new SQSSubscriber<TMessage>(\n\t\t\t\t\tconnection as InstanceType<typeof SQSConnection>,\n\t\t\t\t);\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tthrow new Error(`Unsupported connection type: ${connection.type}`);\n\t\t}\n\t}\n}\n\nexport type EventSubscriberConnectionString =\n\t`${EventPublisherType}://${string}`;\n"],"mappings":";;;AAOA,IAAa,aAAb,MAAwB;;;;;CAKvB,aAAa,qBAGZA,eACqC;EACrC,MAAM,MAAM,IAAI,IAAI;AACpB,UAAQ,IAAI,SAAS,QAAQ,KAAK,GAAG,EAArC;GACC,KAAK,mBAAmB,OAAO;IAC9B,MAAM,EAAE,iBAAiB,iBAAiB,GAAG,MAAM,OAAO;IAC1D,MAAM,aACL,MAAM,gBAAgB,qBAAqB,cAAc;AAC1D,WAAO,IAAI,gBAA0B;GACrC;GACD,KAAK,mBAAmB,UAAU;IACjC,MAAM,EAAE,oBAAoB,GAAG,MAAM,OAAO;AAC5C,WAAO,mBAAmB,qBAA+B,cAAc;GACvE;GACD,KAAK,mBAAmB,KAAK;IAC5B,MAAM,EAAE,eAAe,GAAG,MAAM,OAAO;AACvC,WAAO,cAAc,qBAA+B,cAAc;GAClE;GACD,KAAK,mBAAmB,KAAK;IAC5B,MAAMC,QAAM,IAAI,IAAI;IACpB,MAAM,WAAW,MAAI,aAAa,IAAI,WAAW;AAGjD,QAAI,UAAU;KACb,MAAM,EAAE,eAAe,GAAG,MAAM,OAAO;KAEvC,MAAM,mBAAmB,cAAc,QAAQ,UAAU,SAAS;AAClE,YAAO,cAAc,qBAA+B,iBAAiB;IACrE;IAGD,MAAM,EAAE,eAAe,GAAG,MAAM,OAAO;IACvC,MAAM,EAAE,eAAe,GAAG,MAAM,OAAO;IACvC,MAAM,aACL,MAAM,cAAc,qBAAqB,cAAc;AACxD,WAAO,IAAI,cAAwB;GACnC;GAED,QACC,OAAM,IAAI,OAAO,qCAAqC,IAAI,SAAS;EACpE;CACD;;;;;CAMD,aAAa,eACZC,YACqC;AACrC,UAAQ,WAAW,MAAnB;GACC,KAAK,mBAAmB,OAAO;IAC9B,MAAM,EAAE,iBAAiB,GAAG,MAAM,OAAO;IACzC,MAAM,EAAE,iBAAiB,GAAG,MAAM,OAAO;AACzC,WAAO,IAAI,gBACV;GAED;GACD,KAAK,mBAAmB,UAAU;IACjC,MAAM,EAAE,oBAAoB,GAAG,MAAM,OAAO;IAC5C,MAAM,EAAE,oBAAoB,GAAG,MAAM,OAAO;AAC5C,WAAO,IAAI,mBACV;GAED;GACD,KAAK,mBAAmB,KAAK;IAC5B,MAAM,EAAE,eAAe,GAAG,MAAM,OAAO;IACvC,MAAM,EAAE,eAAe,GAAG,MAAM,OAAO;AACvC,WAAO,IAAI,cACV;GAED;GACD,KAAK,mBAAmB,KAAK;IAC5B,MAAM,EAAE,eAAe,GAAG,MAAM,OAAO;IACvC,MAAM,EAAE,eAAe,GAAG,MAAM,OAAO;AACvC,WAAO,IAAI,cACV;GAED;GACD,QACC,OAAM,IAAI,OAAO,+BAA+B,WAAW,KAAK;EACjE;CACD;AACD"}