@geekmidas/events 10.0.0-alpha.98 → 10.0.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 (352) hide show
  1. package/CHANGELOG.md +116 -0
  2. package/README.md +1 -46
  3. package/dist/BasicConnection-CQsJpx2J.d.cts +27 -0
  4. package/dist/BasicConnection-CQsJpx2J.d.cts.map +1 -0
  5. package/dist/BasicConnection-CxfNEvlb.cjs +48 -0
  6. package/dist/BasicConnection-CxfNEvlb.cjs.map +1 -0
  7. package/dist/BasicConnection-DcRelT64.d.mts +27 -0
  8. package/dist/BasicConnection-DcRelT64.d.mts.map +1 -0
  9. package/dist/BasicConnection-hl-Ogz3a.mjs +42 -0
  10. package/dist/BasicConnection-hl-Ogz3a.mjs.map +1 -0
  11. package/dist/BasicPublisher-C-hMX2Hy.d.mts +14 -0
  12. package/dist/BasicPublisher-C-hMX2Hy.d.mts.map +1 -0
  13. package/dist/BasicPublisher-CGMXg2I2.d.cts +14 -0
  14. package/dist/BasicPublisher-CGMXg2I2.d.cts.map +1 -0
  15. package/dist/BasicPublisher-CXAVKxgq.cjs +20 -0
  16. package/dist/BasicPublisher-CXAVKxgq.cjs.map +1 -0
  17. package/dist/BasicPublisher-DogbeHAH.mjs +14 -0
  18. package/dist/BasicPublisher-DogbeHAH.mjs.map +1 -0
  19. package/dist/BasicSubscriber-BJSZN22M.mjs +16 -0
  20. package/dist/BasicSubscriber-BJSZN22M.mjs.map +1 -0
  21. package/dist/BasicSubscriber-HzSJ_MbB.d.mts +14 -0
  22. package/dist/BasicSubscriber-HzSJ_MbB.d.mts.map +1 -0
  23. package/dist/BasicSubscriber-mVJRMXhZ.cjs +22 -0
  24. package/dist/BasicSubscriber-mVJRMXhZ.cjs.map +1 -0
  25. package/dist/BasicSubscriber-uW3IOyBj.d.cts +14 -0
  26. package/dist/BasicSubscriber-uW3IOyBj.d.cts.map +1 -0
  27. package/dist/EventConnection-4niMI6D8.d.mts +13 -0
  28. package/dist/EventConnection-4niMI6D8.d.mts.map +1 -0
  29. package/dist/EventConnection-BkA9FSVL.cjs +45 -0
  30. package/dist/EventConnection-BkA9FSVL.cjs.map +1 -0
  31. package/dist/EventConnection-Kr32GAzq.mjs +40 -0
  32. package/dist/EventConnection-Kr32GAzq.mjs.map +1 -0
  33. package/dist/EventConnection-dP42P87q.d.cts +13 -0
  34. package/dist/EventConnection-dP42P87q.d.cts.map +1 -0
  35. package/dist/EventConnection.cjs +5 -0
  36. package/dist/EventConnection.d.cts +3 -0
  37. package/dist/EventConnection.d.mts +3 -0
  38. package/dist/EventConnection.mjs +4 -0
  39. package/dist/PgBossConnection-B71ssr72.cjs +80 -0
  40. package/dist/PgBossConnection-B71ssr72.cjs.map +1 -0
  41. package/dist/PgBossConnection-Bj_Wo1lQ.mjs +74 -0
  42. package/dist/PgBossConnection-Bj_Wo1lQ.mjs.map +1 -0
  43. package/dist/PgBossConnection-DCfLGoHx.d.mts +32 -0
  44. package/dist/PgBossConnection-DCfLGoHx.d.mts.map +1 -0
  45. package/dist/PgBossConnection-oto_CAbP.d.cts +32 -0
  46. package/dist/PgBossConnection-oto_CAbP.d.cts.map +1 -0
  47. package/dist/PgBossPublisher-Bwo7qSoH.mjs +35 -0
  48. package/dist/PgBossPublisher-Bwo7qSoH.mjs.map +1 -0
  49. package/dist/PgBossPublisher-CqjigBVC.d.mts +20 -0
  50. package/dist/PgBossPublisher-CqjigBVC.d.mts.map +1 -0
  51. package/dist/PgBossPublisher-FTdYh58W.cjs +41 -0
  52. package/dist/PgBossPublisher-FTdYh58W.cjs.map +1 -0
  53. package/dist/PgBossPublisher-JIiB1zpA.d.cts +20 -0
  54. package/dist/PgBossPublisher-JIiB1zpA.d.cts.map +1 -0
  55. package/dist/PgBossSubscriber-BUiB1JKf.d.mts +24 -0
  56. package/dist/PgBossSubscriber-BUiB1JKf.d.mts.map +1 -0
  57. package/dist/PgBossSubscriber-BubVfuWm.cjs +52 -0
  58. package/dist/PgBossSubscriber-BubVfuWm.cjs.map +1 -0
  59. package/dist/PgBossSubscriber-Cozijfdj.d.cts +24 -0
  60. package/dist/PgBossSubscriber-Cozijfdj.d.cts.map +1 -0
  61. package/dist/PgBossSubscriber-DopATe80.mjs +46 -0
  62. package/dist/PgBossSubscriber-DopATe80.mjs.map +1 -0
  63. package/dist/Publisher-CKloIGh6.cjs +79 -0
  64. package/dist/Publisher-CKloIGh6.cjs.map +1 -0
  65. package/dist/Publisher-ChLTrUeP.mjs +74 -0
  66. package/dist/Publisher-ChLTrUeP.mjs.map +1 -0
  67. package/dist/Publisher-DDee6xau.d.cts +21 -0
  68. package/dist/Publisher-DDee6xau.d.cts.map +1 -0
  69. package/dist/Publisher-VHumMkrP.d.mts +21 -0
  70. package/dist/Publisher-VHumMkrP.d.mts.map +1 -0
  71. package/dist/Publisher.cjs +4 -0
  72. package/dist/Publisher.d.cts +3 -0
  73. package/dist/Publisher.d.mts +3 -0
  74. package/dist/Publisher.mjs +4 -0
  75. package/dist/RabbitMQConnection-BtKZjtZY.mjs +107 -0
  76. package/dist/RabbitMQConnection-BtKZjtZY.mjs.map +1 -0
  77. package/dist/RabbitMQConnection-DV9t3VYp.d.mts +44 -0
  78. package/dist/RabbitMQConnection-DV9t3VYp.d.mts.map +1 -0
  79. package/dist/RabbitMQConnection-DmMMosT4.cjs +113 -0
  80. package/dist/RabbitMQConnection-DmMMosT4.cjs.map +1 -0
  81. package/dist/RabbitMQConnection-jNME_eR7.d.cts +44 -0
  82. package/dist/RabbitMQConnection-jNME_eR7.d.cts.map +1 -0
  83. package/dist/RabbitMQPublisher-C94q6g8q.cjs +45 -0
  84. package/dist/RabbitMQPublisher-C94q6g8q.cjs.map +1 -0
  85. package/dist/RabbitMQPublisher-DKmgwqVj.d.mts +25 -0
  86. package/dist/RabbitMQPublisher-DKmgwqVj.d.mts.map +1 -0
  87. package/dist/RabbitMQPublisher-d257OHLa.d.cts +25 -0
  88. package/dist/RabbitMQPublisher-d257OHLa.d.cts.map +1 -0
  89. package/dist/RabbitMQPublisher-yUqWNq-P.mjs +39 -0
  90. package/dist/RabbitMQPublisher-yUqWNq-P.mjs.map +1 -0
  91. package/dist/RabbitMQSubscriber-BF7JGfYm.d.cts +27 -0
  92. package/dist/RabbitMQSubscriber-BF7JGfYm.d.cts.map +1 -0
  93. package/dist/RabbitMQSubscriber-BWniDtFs.mjs +56 -0
  94. package/dist/RabbitMQSubscriber-BWniDtFs.mjs.map +1 -0
  95. package/dist/RabbitMQSubscriber-CdbUy5mB.d.mts +27 -0
  96. package/dist/RabbitMQSubscriber-CdbUy5mB.d.mts.map +1 -0
  97. package/dist/RabbitMQSubscriber-DGEO-clQ.cjs +62 -0
  98. package/dist/RabbitMQSubscriber-DGEO-clQ.cjs.map +1 -0
  99. package/dist/SNSConnection-CAcbLQOy.cjs +76 -0
  100. package/dist/SNSConnection-CAcbLQOy.cjs.map +1 -0
  101. package/dist/SNSConnection-CG4iEwA8.d.mts +41 -0
  102. package/dist/SNSConnection-CG4iEwA8.d.mts.map +1 -0
  103. package/dist/SNSConnection-CVjH93lb.mjs +70 -0
  104. package/dist/SNSConnection-CVjH93lb.mjs.map +1 -0
  105. package/dist/SNSConnection-Dol9FuxA.d.cts +41 -0
  106. package/dist/SNSConnection-Dol9FuxA.d.cts.map +1 -0
  107. package/dist/SNSPublisher-CjlMS3Z2.mjs +41 -0
  108. package/dist/SNSPublisher-CjlMS3Z2.mjs.map +1 -0
  109. package/dist/SNSPublisher-D50dPCEh.d.mts +22 -0
  110. package/dist/SNSPublisher-D50dPCEh.d.mts.map +1 -0
  111. package/dist/SNSPublisher-DQunY4NM.d.cts +22 -0
  112. package/dist/SNSPublisher-DQunY4NM.d.cts.map +1 -0
  113. package/dist/SNSPublisher-DV_8GGsi.cjs +47 -0
  114. package/dist/SNSPublisher-DV_8GGsi.cjs.map +1 -0
  115. package/dist/SNSSubscriber-BWaCQFl6.mjs +139 -0
  116. package/dist/SNSSubscriber-BWaCQFl6.mjs.map +1 -0
  117. package/dist/SNSSubscriber-CUgHK4W2.d.mts +55 -0
  118. package/dist/SNSSubscriber-CUgHK4W2.d.mts.map +1 -0
  119. package/dist/SNSSubscriber-ZE_-Hsps.cjs +145 -0
  120. package/dist/SNSSubscriber-ZE_-Hsps.cjs.map +1 -0
  121. package/dist/SNSSubscriber-ZGJjhXFQ.d.cts +55 -0
  122. package/dist/SNSSubscriber-ZGJjhXFQ.d.cts.map +1 -0
  123. package/dist/SQSConnection-BtEkDha8.d.cts +41 -0
  124. package/dist/SQSConnection-BtEkDha8.d.cts.map +1 -0
  125. package/dist/SQSConnection-CT3S7_zP.mjs +70 -0
  126. package/dist/SQSConnection-CT3S7_zP.mjs.map +1 -0
  127. package/dist/SQSConnection-DVy43GCV.d.mts +41 -0
  128. package/dist/SQSConnection-DVy43GCV.d.mts.map +1 -0
  129. package/dist/SQSConnection-Y0mdVTcB.cjs +76 -0
  130. package/dist/SQSConnection-Y0mdVTcB.cjs.map +1 -0
  131. package/dist/SQSPublisher-B-32CC4G.mjs +57 -0
  132. package/dist/SQSPublisher-B-32CC4G.mjs.map +1 -0
  133. package/dist/SQSPublisher-CgUduk6H.cjs +63 -0
  134. package/dist/SQSPublisher-CgUduk6H.cjs.map +1 -0
  135. package/dist/SQSPublisher-kyl5HW3N.d.cts +25 -0
  136. package/dist/SQSPublisher-kyl5HW3N.d.cts.map +1 -0
  137. package/dist/SQSPublisher-qDE5Fp-N.d.mts +25 -0
  138. package/dist/SQSPublisher-qDE5Fp-N.d.mts.map +1 -0
  139. package/dist/SQSSubscriber-C4UA2hKq.cjs +120 -0
  140. package/dist/SQSSubscriber-C4UA2hKq.cjs.map +1 -0
  141. package/dist/SQSSubscriber-CDvaG4ij.d.cts +44 -0
  142. package/dist/SQSSubscriber-CDvaG4ij.d.cts.map +1 -0
  143. package/dist/SQSSubscriber-CQdSFzpe.mjs +114 -0
  144. package/dist/SQSSubscriber-CQdSFzpe.mjs.map +1 -0
  145. package/dist/SQSSubscriber-JfFuAAoP.d.mts +44 -0
  146. package/dist/SQSSubscriber-JfFuAAoP.d.mts.map +1 -0
  147. package/dist/Subscriber-CG_QUQZs.d.cts +21 -0
  148. package/dist/Subscriber-CG_QUQZs.d.cts.map +1 -0
  149. package/dist/Subscriber-CghW0A02.cjs +88 -0
  150. package/dist/Subscriber-CghW0A02.cjs.map +1 -0
  151. package/dist/Subscriber-DiYHmuF0.d.mts +21 -0
  152. package/dist/Subscriber-DiYHmuF0.d.mts.map +1 -0
  153. package/dist/Subscriber-bnkFtSvt.mjs +83 -0
  154. package/dist/Subscriber-bnkFtSvt.mjs.map +1 -0
  155. package/dist/Subscriber.cjs +4 -0
  156. package/dist/Subscriber.d.cts +3 -0
  157. package/dist/Subscriber.d.mts +3 -0
  158. package/dist/Subscriber.mjs +4 -0
  159. package/dist/basic/BasicConnection.cjs +4 -0
  160. package/dist/basic/BasicConnection.d.cts +3 -0
  161. package/dist/basic/BasicConnection.d.mts +3 -0
  162. package/dist/basic/BasicConnection.mjs +4 -0
  163. package/dist/basic/BasicPublisher.cjs +3 -0
  164. package/dist/basic/BasicPublisher.d.cts +4 -0
  165. package/dist/basic/BasicPublisher.d.mts +4 -0
  166. package/dist/basic/BasicPublisher.mjs +3 -0
  167. package/dist/basic/BasicSubscriber.cjs +3 -0
  168. package/dist/basic/BasicSubscriber.d.cts +4 -0
  169. package/dist/basic/BasicSubscriber.d.mts +4 -0
  170. package/dist/basic/BasicSubscriber.mjs +3 -0
  171. package/dist/basic/index.cjs +7 -100
  172. package/dist/basic/index.d.cts +5 -45
  173. package/dist/basic/index.d.mts +5 -45
  174. package/dist/basic/index.mjs +5 -96
  175. package/dist/{rolldown-runtime-C0BPl7ul.cjs → chunk-CUT6urMc.cjs} +10 -23
  176. package/dist/index.cjs +8 -87
  177. package/dist/index.d.cts +5 -102
  178. package/dist/index.d.mts +5 -102
  179. package/dist/index.mjs +5 -71
  180. package/dist/pgboss/PgBossConnection.cjs +4 -0
  181. package/dist/pgboss/PgBossConnection.d.cts +3 -0
  182. package/dist/pgboss/PgBossConnection.d.mts +3 -0
  183. package/dist/pgboss/PgBossConnection.mjs +4 -0
  184. package/dist/pgboss/PgBossPublisher.cjs +3 -0
  185. package/dist/pgboss/PgBossPublisher.d.cts +4 -0
  186. package/dist/pgboss/PgBossPublisher.d.mts +4 -0
  187. package/dist/pgboss/PgBossPublisher.mjs +3 -0
  188. package/dist/pgboss/PgBossSubscriber.cjs +3 -0
  189. package/dist/pgboss/PgBossSubscriber.d.cts +4 -0
  190. package/dist/pgboss/PgBossSubscriber.d.mts +4 -0
  191. package/dist/pgboss/PgBossSubscriber.mjs +3 -0
  192. package/dist/pgboss/index.cjs +7 -247
  193. package/dist/pgboss/index.d.cts +5 -107
  194. package/dist/pgboss/index.d.mts +5 -107
  195. package/dist/pgboss/index.mjs +5 -240
  196. package/dist/rabbitmq/RabbitMQConnection.cjs +4 -0
  197. package/dist/rabbitmq/RabbitMQConnection.d.cts +3 -0
  198. package/dist/rabbitmq/RabbitMQConnection.d.mts +3 -0
  199. package/dist/rabbitmq/RabbitMQConnection.mjs +4 -0
  200. package/dist/rabbitmq/RabbitMQPublisher.cjs +3 -0
  201. package/dist/rabbitmq/RabbitMQPublisher.d.cts +4 -0
  202. package/dist/rabbitmq/RabbitMQPublisher.d.mts +4 -0
  203. package/dist/rabbitmq/RabbitMQPublisher.mjs +3 -0
  204. package/dist/rabbitmq/RabbitMQSubscriber.cjs +3 -0
  205. package/dist/rabbitmq/RabbitMQSubscriber.d.cts +4 -0
  206. package/dist/rabbitmq/RabbitMQSubscriber.d.mts +4 -0
  207. package/dist/rabbitmq/RabbitMQSubscriber.mjs +3 -0
  208. package/dist/rabbitmq/index.cjs +7 -243
  209. package/dist/rabbitmq/index.d.cts +5 -92
  210. package/dist/rabbitmq/index.d.mts +5 -92
  211. package/dist/rabbitmq/index.mjs +5 -237
  212. package/dist/sns/SNSConnection.cjs +4 -0
  213. package/dist/sns/SNSConnection.d.cts +3 -0
  214. package/dist/sns/SNSConnection.d.mts +3 -0
  215. package/dist/sns/SNSConnection.mjs +4 -0
  216. package/dist/sns/SNSPublisher.cjs +3 -0
  217. package/dist/sns/SNSPublisher.d.cts +4 -0
  218. package/dist/sns/SNSPublisher.d.mts +4 -0
  219. package/dist/sns/SNSPublisher.mjs +3 -0
  220. package/dist/sns/SNSSubscriber.cjs +6 -0
  221. package/dist/sns/SNSSubscriber.d.cts +4 -0
  222. package/dist/sns/SNSSubscriber.d.mts +4 -0
  223. package/dist/sns/SNSSubscriber.mjs +6 -0
  224. package/dist/sns/index.cjs +9 -551
  225. package/dist/sns/index.d.cts +5 -273
  226. package/dist/sns/index.d.mts +5 -273
  227. package/dist/sns/index.mjs +7 -527
  228. package/dist/sqs/SQSConnection.cjs +4 -0
  229. package/dist/sqs/SQSConnection.d.cts +3 -0
  230. package/dist/sqs/SQSConnection.d.mts +3 -0
  231. package/dist/sqs/SQSConnection.mjs +4 -0
  232. package/dist/sqs/SQSPublisher.cjs +3 -0
  233. package/dist/sqs/SQSPublisher.d.cts +4 -0
  234. package/dist/sqs/SQSPublisher.d.mts +4 -0
  235. package/dist/sqs/SQSPublisher.mjs +3 -0
  236. package/dist/sqs/SQSSubscriber.cjs +3 -0
  237. package/dist/sqs/SQSSubscriber.d.cts +4 -0
  238. package/dist/sqs/SQSSubscriber.d.mts +4 -0
  239. package/dist/sqs/SQSSubscriber.mjs +3 -0
  240. package/dist/sqs/index.cjs +7 -35
  241. package/dist/sqs/index.d.cts +5 -118
  242. package/dist/sqs/index.d.mts +5 -118
  243. package/dist/sqs/index.mjs +5 -24
  244. package/dist/types-BrdcSEnd.mjs +18 -0
  245. package/dist/types-BrdcSEnd.mjs.map +1 -0
  246. package/dist/types-Byv8N9ma.cjs +24 -0
  247. package/dist/types-Byv8N9ma.cjs.map +1 -0
  248. package/dist/types-Dh9Jyinx.d.mts +67 -0
  249. package/dist/types-Dh9Jyinx.d.mts.map +1 -0
  250. package/dist/types-Dj23od3e.d.cts +67 -0
  251. package/dist/types-Dj23od3e.d.cts.map +1 -0
  252. package/dist/types.cjs +3 -0
  253. package/dist/types.d.cts +2 -0
  254. package/dist/types.d.mts +2 -0
  255. package/dist/types.mjs +3 -0
  256. package/package.json +12 -40
  257. package/src/EventConnection.ts +43 -0
  258. package/src/Publisher.ts +98 -0
  259. package/src/Subscriber.ts +113 -0
  260. package/src/__tests__/EventConnection.spec.ts +42 -0
  261. package/src/__tests__/Publisher.spec.ts +96 -0
  262. package/src/__tests__/Subscriber.spec.ts +109 -0
  263. package/src/basic/BasicConnection.ts +47 -0
  264. package/src/basic/BasicPublisher.ts +15 -0
  265. package/src/basic/BasicSubscriber.ts +21 -0
  266. package/src/basic/__tests__/BasicSubscriber.spec.ts +166 -0
  267. package/src/basic/index.ts +3 -0
  268. package/src/index.ts +25 -0
  269. package/src/pgboss/PgBossConnection.ts +91 -0
  270. package/src/pgboss/PgBossPublisher.ts +49 -0
  271. package/src/pgboss/PgBossSubscriber.ts +81 -0
  272. package/src/pgboss/__tests__/pgboss.spec.ts +196 -0
  273. package/src/pgboss/__tests__/setup.ts +21 -0
  274. package/src/pgboss/index.ts +5 -0
  275. package/src/rabbitmq/RabbitMQConnection.ts +148 -0
  276. package/src/rabbitmq/RabbitMQPublisher.ts +67 -0
  277. package/src/rabbitmq/RabbitMQSubscriber.ts +111 -0
  278. package/src/rabbitmq/__tests__/RabbitMQPublisher.spec.ts +378 -0
  279. package/src/rabbitmq/__tests__/RabbitMQSubscriber.spec.ts +292 -0
  280. package/src/rabbitmq/index.ts +6 -0
  281. package/src/sns/SNSConnection.ts +98 -0
  282. package/src/sns/SNSPublisher.ts +62 -0
  283. package/src/sns/SNSSubscriber.ts +218 -0
  284. package/src/sns/__tests__/SNS-SQS-Integration.spec.ts +389 -0
  285. package/src/sns/__tests__/SNSPublisher.spec.ts +449 -0
  286. package/src/sns/__tests__/SNSSubscriber.spec.ts +527 -0
  287. package/src/sns/index.ts +6 -0
  288. package/src/sqs/SQSConnection.ts +97 -0
  289. package/src/sqs/SQSPublisher.ts +105 -0
  290. package/src/sqs/SQSSubscriber.ts +181 -0
  291. package/src/sqs/__tests__/SQSPublisher.spec.ts +189 -0
  292. package/src/sqs/index.ts +6 -0
  293. package/src/types.ts +76 -0
  294. package/tsconfig.json +9 -0
  295. package/tsdown.config.ts +10 -0
  296. package/dist/SQSSubscriber-BEJBfNTe.mjs +0 -264
  297. package/dist/SQSSubscriber-BEJBfNTe.mjs.map +0 -1
  298. package/dist/SQSSubscriber-COTqWvOk.cjs +0 -288
  299. package/dist/SQSSubscriber-COTqWvOk.cjs.map +0 -1
  300. package/dist/basic/index.cjs.map +0 -1
  301. package/dist/basic/index.d.cts.map +0 -1
  302. package/dist/basic/index.d.mts.map +0 -1
  303. package/dist/basic/index.mjs.map +0 -1
  304. package/dist/index.cjs.map +0 -1
  305. package/dist/index.d.cts.map +0 -1
  306. package/dist/index.d.mts.map +0 -1
  307. package/dist/index.mjs.map +0 -1
  308. package/dist/pgboss/index.cjs.map +0 -1
  309. package/dist/pgboss/index.d.cts.map +0 -1
  310. package/dist/pgboss/index.d.mts.map +0 -1
  311. package/dist/pgboss/index.mjs.map +0 -1
  312. package/dist/rabbitmq/index.cjs.map +0 -1
  313. package/dist/rabbitmq/index.d.cts.map +0 -1
  314. package/dist/rabbitmq/index.d.mts.map +0 -1
  315. package/dist/rabbitmq/index.mjs.map +0 -1
  316. package/dist/registry-DIx25Q5s.d.cts +0 -255
  317. package/dist/registry-DIx25Q5s.d.cts.map +0 -1
  318. package/dist/registry-DIx25Q5s.d.mts +0 -255
  319. package/dist/registry-DIx25Q5s.d.mts.map +0 -1
  320. package/dist/registry-DXLY1Xf6.mjs +0 -99
  321. package/dist/registry-DXLY1Xf6.mjs.map +0 -1
  322. package/dist/registry-DlT36229.cjs +0 -122
  323. package/dist/registry-DlT36229.cjs.map +0 -1
  324. package/dist/rolldown-runtime-D7D4PA-g.mjs +0 -13
  325. package/dist/sns/index.cjs.map +0 -1
  326. package/dist/sns/index.d.cts.map +0 -1
  327. package/dist/sns/index.d.mts.map +0 -1
  328. package/dist/sns/index.mjs.map +0 -1
  329. package/dist/sns/snsUrl.cjs +0 -92
  330. package/dist/sns/snsUrl.cjs.map +0 -1
  331. package/dist/sns/snsUrl.d.cts +0 -57
  332. package/dist/sns/snsUrl.d.cts.map +0 -1
  333. package/dist/sns/snsUrl.d.mts +0 -57
  334. package/dist/sns/snsUrl.d.mts.map +0 -1
  335. package/dist/sns/snsUrl.mjs +0 -82
  336. package/dist/sns/snsUrl.mjs.map +0 -1
  337. package/dist/sqs/index.cjs.map +0 -1
  338. package/dist/sqs/index.d.cts.map +0 -1
  339. package/dist/sqs/index.d.mts.map +0 -1
  340. package/dist/sqs/index.mjs.map +0 -1
  341. package/dist/sqs/sqsUrl.cjs +0 -93
  342. package/dist/sqs/sqsUrl.cjs.map +0 -1
  343. package/dist/sqs/sqsUrl.d.cts +0 -56
  344. package/dist/sqs/sqsUrl.d.cts.map +0 -1
  345. package/dist/sqs/sqsUrl.d.mts +0 -56
  346. package/dist/sqs/sqsUrl.d.mts.map +0 -1
  347. package/dist/sqs/sqsUrl.mjs +0 -83
  348. package/dist/sqs/sqsUrl.mjs.map +0 -1
  349. package/dist/telemetry-DG3l807O.cjs +0 -309
  350. package/dist/telemetry-DG3l807O.cjs.map +0 -1
  351. package/dist/telemetry-DjjgJMul.mjs +0 -244
  352. package/dist/telemetry-DjjgJMul.mjs.map +0 -1
@@ -0,0 +1,148 @@
1
+ import amqplib from 'amqplib';
2
+ import type { EventConnection } from '../types';
3
+ import { EventPublisherType } from '../types';
4
+
5
+ export interface RabbitMQConnectionConfig {
6
+ url: string;
7
+ exchange?: string;
8
+ exchangeType?: 'topic' | 'direct' | 'fanout' | 'headers';
9
+ exchangeOptions?: amqplib.Options.AssertExchange;
10
+ timeout?: number; // Connection timeout in milliseconds (default: 5000)
11
+ }
12
+
13
+ export class RabbitMQConnection implements EventConnection {
14
+ readonly type = EventPublisherType.RabbitMQ;
15
+ private connection?: amqplib.ChannelModel;
16
+ private channel?: amqplib.Channel;
17
+ private connecting?: Promise<void>;
18
+ private config: Required<
19
+ Pick<RabbitMQConnectionConfig, 'exchange' | 'exchangeType' | 'timeout'>
20
+ > &
21
+ RabbitMQConnectionConfig;
22
+
23
+ constructor(config: RabbitMQConnectionConfig) {
24
+ this.config = {
25
+ ...config,
26
+ exchange: config.exchange || 'geekmidas.events',
27
+ exchangeType: config.exchangeType || 'topic',
28
+ timeout: config.timeout ?? 5000,
29
+ exchangeOptions: {
30
+ durable: true,
31
+ ...config.exchangeOptions,
32
+ },
33
+ };
34
+ }
35
+
36
+ /**
37
+ * Create a RabbitMQConnection from a connection string
38
+ * Format: rabbitmq://user:pass@host:port/vhost?exchange=name&type=topic&timeout=5000
39
+ */
40
+ static async fromConnectionString(
41
+ connectionString: string,
42
+ ): Promise<RabbitMQConnection> {
43
+ const url = new URL(connectionString);
44
+ const params = url.searchParams;
45
+
46
+ // Extract connection URL without query params
47
+ const baseUrl = `amqp://${url.username ? `${url.username}:${url.password}@` : ''}${url.host}${url.pathname}`;
48
+
49
+ const timeoutParam = params.get('timeout');
50
+ const config: RabbitMQConnectionConfig = {
51
+ url: baseUrl,
52
+ exchange: params.get('exchange') || 'geekmidas.events',
53
+ exchangeType: (params.get('type') as any) || 'topic',
54
+ timeout: timeoutParam ? Number.parseInt(timeoutParam, 10) : undefined,
55
+ };
56
+
57
+ const connection = new RabbitMQConnection(config);
58
+ await connection.connect();
59
+ return connection;
60
+ }
61
+
62
+ async connect(): Promise<void> {
63
+ if (this.channel) return;
64
+
65
+ // Prevent multiple simultaneous connection attempts
66
+ if (this.connecting) {
67
+ await this.connecting;
68
+ return;
69
+ }
70
+
71
+ this.connecting = (async () => {
72
+ try {
73
+ const connection = await amqplib.connect(this.config.url, {
74
+ timeout: this.config.timeout,
75
+ });
76
+ const channel = await connection.createChannel();
77
+
78
+ // Assert the exchange exists
79
+ await channel.assertExchange(
80
+ this.config.exchange!,
81
+ this.config.exchangeType!,
82
+ this.config.exchangeOptions,
83
+ );
84
+
85
+ // Handle connection errors
86
+ connection.on('error', (_err: Error) => {
87
+ this.cleanup();
88
+ });
89
+
90
+ connection.on('close', () => {
91
+ this.cleanup();
92
+ });
93
+
94
+ // Only set after successful setup
95
+ this.connection = connection;
96
+ this.channel = channel;
97
+ } catch (error) {
98
+ this.cleanup();
99
+ throw error;
100
+ }
101
+ })();
102
+
103
+ await this.connecting;
104
+ this.connecting = undefined;
105
+ }
106
+
107
+ async close(): Promise<void> {
108
+ try {
109
+ await this.channel?.close();
110
+ await this.connection?.close();
111
+ } catch (_error) {
112
+ // Ignore errors during close
113
+ } finally {
114
+ this.cleanup();
115
+ }
116
+ }
117
+
118
+ isConnected(): boolean {
119
+ return !!this.channel;
120
+ }
121
+
122
+ private cleanup(): void {
123
+ this.channel = undefined;
124
+ this.connection = undefined;
125
+ this.connecting = undefined;
126
+ }
127
+
128
+ /**
129
+ * Get the underlying channel for publishing/subscribing
130
+ */
131
+ get amqpChannel(): amqplib.Channel | undefined {
132
+ return this.channel;
133
+ }
134
+
135
+ /**
136
+ * Get the exchange name for this connection
137
+ */
138
+ get exchangeName(): string {
139
+ return this.config.exchange;
140
+ }
141
+
142
+ /**
143
+ * Get the exchange type for this connection
144
+ */
145
+ get exchangeType(): string {
146
+ return this.config.exchangeType;
147
+ }
148
+ }
@@ -0,0 +1,67 @@
1
+ import type amqplib from 'amqplib';
2
+ import type { EventPublisher, PublishableMessage } from '../types';
3
+ import type { RabbitMQConnection } from './RabbitMQConnection';
4
+
5
+ export interface RabbitMQPublisherOptions {
6
+ publishOptions?: amqplib.Options.Publish;
7
+ }
8
+
9
+ export class RabbitMQPublisher<TMessage extends PublishableMessage<string, any>>
10
+ implements EventPublisher<TMessage>
11
+ {
12
+ constructor(
13
+ private connection: RabbitMQConnection,
14
+ private options: RabbitMQPublisherOptions = {},
15
+ ) {}
16
+
17
+ /**
18
+ * Create a RabbitMQPublisher from a connection string
19
+ * Format: rabbitmq://user:pass@host:port/vhost?exchange=name&type=topic&timeout=5000
20
+ */
21
+ static async fromConnectionString<
22
+ TMessage extends PublishableMessage<string, any>,
23
+ >(connectionString: string): Promise<RabbitMQPublisher<TMessage>> {
24
+ const { RabbitMQConnection } = await import('./RabbitMQConnection');
25
+ const connection =
26
+ await RabbitMQConnection.fromConnectionString(connectionString);
27
+ return new RabbitMQPublisher<TMessage>(connection);
28
+ }
29
+
30
+ async publish(messages: TMessage[]): Promise<void> {
31
+ if (!this.connection.isConnected()) {
32
+ await this.connection.connect();
33
+ }
34
+
35
+ const channel = this.connection.amqpChannel;
36
+ if (!channel) {
37
+ throw new Error('Channel not initialized');
38
+ }
39
+
40
+ const exchange = this.connection.exchangeName;
41
+
42
+ for (const message of messages) {
43
+ const content = Buffer.from(JSON.stringify(message.payload));
44
+
45
+ // Use message type as routing key for topic exchanges
46
+ const routingKey = message.type;
47
+
48
+ const published = channel.publish(exchange, routingKey, content, {
49
+ contentType: 'application/json',
50
+ timestamp: Date.now(),
51
+ type: message.type,
52
+ persistent: true,
53
+ ...this.options.publishOptions,
54
+ });
55
+
56
+ // Handle backpressure
57
+ if (!published) {
58
+ await new Promise((resolve) => channel.once('drain', resolve));
59
+ }
60
+ }
61
+ }
62
+
63
+ async close(): Promise<void> {
64
+ // Publisher doesn't own the connection
65
+ // Connection should be closed by whoever created it
66
+ }
67
+ }
@@ -0,0 +1,111 @@
1
+ import type amqplib from 'amqplib';
2
+ import type { EventSubscriber, PublishableMessage } from '../types';
3
+ import type { RabbitMQConnection } from './RabbitMQConnection';
4
+
5
+ export interface RabbitMQSubscriberOptions {
6
+ queueName?: string; // If not provided, a unique queue will be generated
7
+ queueOptions?: amqplib.Options.AssertQueue;
8
+ consumeOptions?: amqplib.Options.Consume;
9
+ prefetch?: number; // Number of messages to prefetch (default: 1)
10
+ }
11
+
12
+ export class RabbitMQSubscriber<
13
+ TMessage extends PublishableMessage<string, any>,
14
+ > implements EventSubscriber<TMessage>
15
+ {
16
+ constructor(
17
+ private connection: RabbitMQConnection,
18
+ private options: RabbitMQSubscriberOptions = {},
19
+ ) {}
20
+
21
+ /**
22
+ * Create a RabbitMQSubscriber from a connection string
23
+ * Format: rabbitmq://user:pass@host:port/vhost?exchange=name&type=topic&queueName=myqueue&prefetch=10
24
+ */
25
+ static async fromConnectionString<
26
+ TMessage extends PublishableMessage<string, any>,
27
+ >(connectionString: string): Promise<RabbitMQSubscriber<TMessage>> {
28
+ const url = new URL(connectionString);
29
+ const params = url.searchParams;
30
+
31
+ const { RabbitMQConnection } = await import('./RabbitMQConnection');
32
+ const connection =
33
+ await RabbitMQConnection.fromConnectionString(connectionString);
34
+
35
+ const options: RabbitMQSubscriberOptions = {
36
+ queueName: params.get('queueName') || undefined,
37
+ prefetch: params.get('prefetch')
38
+ ? Number.parseInt(params.get('prefetch')!, 10)
39
+ : undefined,
40
+ };
41
+
42
+ return new RabbitMQSubscriber<TMessage>(connection, options);
43
+ }
44
+
45
+ async subscribe(
46
+ messages: TMessage['type'][],
47
+ listener: (payload: TMessage) => Promise<void>,
48
+ ): Promise<void> {
49
+ if (!this.connection.isConnected()) {
50
+ await this.connection.connect();
51
+ }
52
+
53
+ const channel = this.connection.amqpChannel;
54
+ if (!channel) {
55
+ throw new Error('Channel not initialized');
56
+ }
57
+
58
+ const exchange = this.connection.exchangeName;
59
+
60
+ // Set prefetch if specified
61
+ if (this.options.prefetch) {
62
+ await channel.prefetch(this.options.prefetch);
63
+ }
64
+
65
+ // Assert queue
66
+ const queueName = this.options.queueName || '';
67
+ const queueOptions: amqplib.Options.AssertQueue = {
68
+ durable: true,
69
+ ...this.options.queueOptions,
70
+ };
71
+
72
+ const { queue } = await channel.assertQueue(queueName, queueOptions);
73
+
74
+ // Bind queue to exchange for each message type
75
+ for (const messageType of messages) {
76
+ await channel.bindQueue(queue, exchange, messageType);
77
+ }
78
+
79
+ // Consume messages
80
+ await channel.consume(
81
+ queue,
82
+ async (msg) => {
83
+ if (!msg) return;
84
+
85
+ try {
86
+ // Parse message payload
87
+ const content = msg.content.toString();
88
+ const payload = JSON.parse(content);
89
+
90
+ // Get message type from properties
91
+ const messageType = msg.properties.type;
92
+
93
+ // Reconstruct full message
94
+ const fullMessage: TMessage = {
95
+ type: messageType,
96
+ payload,
97
+ } as TMessage;
98
+
99
+ // Call listener
100
+ await listener(fullMessage);
101
+
102
+ // Ack message
103
+ channel.ack(msg);
104
+ } catch (_error) {
105
+ channel.nack(msg, false, true);
106
+ }
107
+ },
108
+ this.options.consumeOptions,
109
+ );
110
+ }
111
+ }
@@ -0,0 +1,378 @@
1
+ import { describe, expect, it } from 'vitest';
2
+ import type { PublishableMessage } from '../../types';
3
+ import { RabbitMQConnection } from '../RabbitMQConnection';
4
+ import { RabbitMQPublisher } from '../RabbitMQPublisher';
5
+
6
+ type TestMessage = PublishableMessage<'user.created' | 'user.updated', any>;
7
+
8
+ const RABBITMQ_URL = 'amqp://geekmidas:geekmidas@localhost:5672';
9
+
10
+ // Helper to generate unique exchange names
11
+ const uniqueExchange = () =>
12
+ `test-exchange-${Date.now()}-${Math.random().toString(36).substring(7)}`;
13
+
14
+ describe('RabbitMQPublisher - Integration Tests', () => {
15
+ describe('constructor', () => {
16
+ it('should create instance with default configuration', () => {
17
+ const connection = new RabbitMQConnection({
18
+ url: RABBITMQ_URL,
19
+ exchange: uniqueExchange(),
20
+ });
21
+ const publisher = new RabbitMQPublisher<TestMessage>(connection);
22
+
23
+ expect(publisher).toBeDefined();
24
+ });
25
+
26
+ it('should connect lazily on first publish', async () => {
27
+ const testExchange = uniqueExchange();
28
+ const connection = new RabbitMQConnection({
29
+ url: RABBITMQ_URL,
30
+ exchange: testExchange,
31
+ });
32
+ const publisher = new RabbitMQPublisher<TestMessage>(connection);
33
+
34
+ // Should not throw - connection happens on publish
35
+ await publisher.publish([
36
+ { type: 'user.created', payload: { userId: 'test' } },
37
+ ]);
38
+
39
+ await connection.close();
40
+ });
41
+
42
+ it('should work with custom exchange type', async () => {
43
+ const testExchange = uniqueExchange();
44
+ const connection = new RabbitMQConnection({
45
+ url: RABBITMQ_URL,
46
+ exchange: testExchange,
47
+ exchangeType: 'direct',
48
+ });
49
+ const publisher = new RabbitMQPublisher<TestMessage>(connection);
50
+
51
+ await publisher.publish([
52
+ { type: 'user.created', payload: { userId: 'test' } },
53
+ ]);
54
+
55
+ await connection.close();
56
+ });
57
+
58
+ it('should apply custom timeout', async () => {
59
+ const testExchange = uniqueExchange();
60
+ const connection = new RabbitMQConnection({
61
+ url: RABBITMQ_URL,
62
+ exchange: testExchange,
63
+ timeout: 10000,
64
+ });
65
+ const publisher = new RabbitMQPublisher<TestMessage>(connection);
66
+
67
+ await publisher.publish([
68
+ { type: 'user.created', payload: { userId: 'test' } },
69
+ ]);
70
+
71
+ await connection.close();
72
+ });
73
+ });
74
+
75
+ describe('fromConnectionString', () => {
76
+ it('should parse basic connection string with autoConnect=true', async () => {
77
+ const testExchange = uniqueExchange();
78
+ const publisher =
79
+ await RabbitMQPublisher.fromConnectionString<TestMessage>(
80
+ `rabbitmq://geekmidas:geekmidas@localhost:5672?exchange=${testExchange}&autoConnect=true`,
81
+ );
82
+
83
+ // Should already be connected
84
+ await publisher.publish([
85
+ { type: 'user.created', payload: { userId: 'test' } },
86
+ ]);
87
+
88
+ await publisher.close();
89
+ });
90
+
91
+ it('should parse connection string with custom exchange', async () => {
92
+ const testExchange = uniqueExchange();
93
+ const publisher =
94
+ await RabbitMQPublisher.fromConnectionString<TestMessage>(
95
+ `rabbitmq://geekmidas:geekmidas@localhost:5672?exchange=${testExchange}&autoConnect=true`,
96
+ );
97
+
98
+ await publisher.publish([
99
+ { type: 'user.created', payload: { userId: 'test' } },
100
+ ]);
101
+
102
+ await publisher.close();
103
+ });
104
+
105
+ it('should parse connection string with type parameter', async () => {
106
+ const testExchange = uniqueExchange();
107
+ const publisher =
108
+ await RabbitMQPublisher.fromConnectionString<TestMessage>(
109
+ `rabbitmq://geekmidas:geekmidas@localhost:5672?exchange=${testExchange}&type=fanout&autoConnect=true`,
110
+ );
111
+
112
+ await publisher.publish([
113
+ { type: 'user.created', payload: { userId: 'test' } },
114
+ ]);
115
+
116
+ await publisher.close();
117
+ });
118
+
119
+ it('should parse connection string with timeout parameter', async () => {
120
+ const testExchange = uniqueExchange();
121
+ const publisher =
122
+ await RabbitMQPublisher.fromConnectionString<TestMessage>(
123
+ `rabbitmq://geekmidas:geekmidas@localhost:5672?exchange=${testExchange}&autoConnect=true&timeout=10000`,
124
+ );
125
+
126
+ await publisher.publish([
127
+ { type: 'user.created', payload: { userId: 'test' } },
128
+ ]);
129
+
130
+ await publisher.close();
131
+ });
132
+
133
+ it('should not auto-connect by default', async () => {
134
+ const testExchange = uniqueExchange();
135
+ const publisher =
136
+ await RabbitMQPublisher.fromConnectionString<TestMessage>(
137
+ `rabbitmq://geekmidas:geekmidas@localhost:5672?exchange=${testExchange}`,
138
+ );
139
+
140
+ // Should connect lazily on publish
141
+ await publisher.publish([
142
+ { type: 'user.created', payload: { userId: 'test' } },
143
+ ]);
144
+
145
+ await publisher.close();
146
+ });
147
+
148
+ it('should respect autoConnect=false', async () => {
149
+ const testExchange = uniqueExchange();
150
+ const publisher =
151
+ await RabbitMQPublisher.fromConnectionString<TestMessage>(
152
+ `rabbitmq://geekmidas:geekmidas@localhost:5672?exchange=${testExchange}&autoConnect=false`,
153
+ );
154
+
155
+ // Should connect lazily on publish
156
+ await publisher.publish([
157
+ { type: 'user.created', payload: { userId: 'test' } },
158
+ ]);
159
+
160
+ await publisher.close();
161
+ });
162
+ });
163
+
164
+ describe('publish', () => {
165
+ it('should publish single message successfully', async () => {
166
+ const testExchange = uniqueExchange();
167
+ const connection = new RabbitMQConnection({
168
+ url: RABBITMQ_URL,
169
+ exchange: testExchange,
170
+ });
171
+ const publisher = new RabbitMQPublisher<TestMessage>(connection);
172
+
173
+ const messages: TestMessage[] = [
174
+ {
175
+ type: 'user.created',
176
+ payload: { userId: '123', email: 'test@example.com' },
177
+ },
178
+ ];
179
+
180
+ await publisher.publish(messages);
181
+ await connection.close();
182
+ });
183
+
184
+ it('should publish multiple messages with different routing keys', async () => {
185
+ const testExchange = uniqueExchange();
186
+ const connection = new RabbitMQConnection({
187
+ url: RABBITMQ_URL,
188
+ exchange: testExchange,
189
+ });
190
+ const publisher = new RabbitMQPublisher<TestMessage>(connection);
191
+
192
+ const messages: TestMessage[] = [
193
+ { type: 'user.created', payload: { userId: '1' } },
194
+ { type: 'user.updated', payload: { userId: '2' } },
195
+ { type: 'user.created', payload: { userId: '3' } },
196
+ { type: 'user.updated', payload: { userId: '4' } },
197
+ ];
198
+
199
+ await publisher.publish(messages);
200
+ await connection.close();
201
+ });
202
+
203
+ it('should serialize complex payloads to JSON', async () => {
204
+ const testExchange = uniqueExchange();
205
+ const connection = new RabbitMQConnection({
206
+ url: RABBITMQ_URL,
207
+ exchange: testExchange,
208
+ });
209
+ const publisher = new RabbitMQPublisher<TestMessage>(connection);
210
+
211
+ const complexPayload = {
212
+ userId: '123',
213
+ email: 'test@example.com',
214
+ metadata: {
215
+ createdAt: new Date().toISOString(),
216
+ tags: ['new', 'active'],
217
+ nested: {
218
+ deep: {
219
+ value: true,
220
+ },
221
+ },
222
+ },
223
+ };
224
+
225
+ await publisher.publish([
226
+ { type: 'user.created', payload: complexPayload },
227
+ ]);
228
+
229
+ await connection.close();
230
+ });
231
+
232
+ it('should handle large batch of messages', async () => {
233
+ const testExchange = uniqueExchange();
234
+ const connection = new RabbitMQConnection({
235
+ url: RABBITMQ_URL,
236
+ exchange: testExchange,
237
+ });
238
+ const publisher = new RabbitMQPublisher<TestMessage>(connection);
239
+
240
+ // Create 100 messages
241
+ const messages: TestMessage[] = Array.from({ length: 100 }, (_, i) => ({
242
+ type: i % 2 === 0 ? 'user.created' : 'user.updated',
243
+ payload: { userId: `user-${i}`, index: i },
244
+ }));
245
+
246
+ await publisher.publish(messages);
247
+ await connection.close();
248
+ });
249
+
250
+ it('should handle empty array', async () => {
251
+ const testExchange = uniqueExchange();
252
+ const connection = new RabbitMQConnection({
253
+ url: RABBITMQ_URL,
254
+ exchange: testExchange,
255
+ });
256
+ const publisher = new RabbitMQPublisher<TestMessage>(connection);
257
+
258
+ await publisher.publish([]);
259
+ await connection.close();
260
+ });
261
+ });
262
+
263
+ describe('close', () => {
264
+ it('should close connection gracefully', async () => {
265
+ const testExchange = uniqueExchange();
266
+ const connection = new RabbitMQConnection({
267
+ url: RABBITMQ_URL,
268
+ exchange: testExchange,
269
+ });
270
+ const publisher = new RabbitMQPublisher<TestMessage>(connection);
271
+
272
+ await publisher.publish([
273
+ { type: 'user.created', payload: { userId: 'test' } },
274
+ ]);
275
+
276
+ await connection.close();
277
+ });
278
+
279
+ it('should allow reconnection after close', async () => {
280
+ const testExchange = uniqueExchange();
281
+ const connection = new RabbitMQConnection({
282
+ url: RABBITMQ_URL,
283
+ exchange: testExchange,
284
+ });
285
+ const publisher = new RabbitMQPublisher<TestMessage>(connection);
286
+
287
+ await publisher.publish([
288
+ { type: 'user.created', payload: { userId: '1' } },
289
+ ]);
290
+
291
+ await connection.close();
292
+
293
+ // Should reconnect on next publish
294
+ await publisher.publish([
295
+ { type: 'user.created', payload: { userId: '2' } },
296
+ ]);
297
+
298
+ await connection.close();
299
+ });
300
+
301
+ it('should not throw error if already closed', async () => {
302
+ const testExchange = uniqueExchange();
303
+ const connection = new RabbitMQConnection({
304
+ url: RABBITMQ_URL,
305
+ exchange: testExchange,
306
+ });
307
+ const publisher = new RabbitMQPublisher<TestMessage>(connection);
308
+
309
+ await publisher.publish([
310
+ { type: 'user.created', payload: { userId: 'test' } },
311
+ ]);
312
+
313
+ await connection.close();
314
+ await expect(connection.close()).resolves.toBeUndefined();
315
+ });
316
+
317
+ it('should handle close without ever connecting', async () => {
318
+ const testExchange = uniqueExchange();
319
+ const connection = new RabbitMQConnection({
320
+ url: RABBITMQ_URL,
321
+ exchange: testExchange,
322
+ });
323
+ const _publisher = new RabbitMQPublisher<TestMessage>(connection);
324
+
325
+ await expect(connection.close()).resolves.toBeUndefined();
326
+ });
327
+ });
328
+
329
+ describe('connection error handling', () => {
330
+ it('should throw error for invalid hostname', async () => {
331
+ const testExchange = uniqueExchange();
332
+ const connection = new RabbitMQConnection({
333
+ url: 'amqp://geekmidas:geekmidas@invalid-host:5672',
334
+ exchange: testExchange,
335
+ timeout: 1000, // Short timeout for faster test
336
+ });
337
+ const publisher = new RabbitMQPublisher<TestMessage>(connection);
338
+
339
+ await expect(
340
+ publisher.publish([
341
+ { type: 'user.created', payload: { userId: '123' } },
342
+ ]),
343
+ ).rejects.toThrow();
344
+ });
345
+
346
+ it('should throw error for invalid credentials', async () => {
347
+ const testExchange = uniqueExchange();
348
+ const connection = new RabbitMQConnection({
349
+ url: 'amqp://wrong:wrong@localhost:5672',
350
+ exchange: testExchange,
351
+ timeout: 1000, // Short timeout for faster test
352
+ });
353
+ const publisher = new RabbitMQPublisher<TestMessage>(connection);
354
+
355
+ await expect(
356
+ publisher.publish([
357
+ { type: 'user.created', payload: { userId: '123' } },
358
+ ]),
359
+ ).rejects.toThrow();
360
+ });
361
+
362
+ it('should throw error for invalid port', async () => {
363
+ const testExchange = uniqueExchange();
364
+ const connection = new RabbitMQConnection({
365
+ url: 'amqp://geekmidas:geekmidas@localhost:9999',
366
+ exchange: testExchange,
367
+ timeout: 1000, // Short timeout for faster test
368
+ });
369
+ const publisher = new RabbitMQPublisher<TestMessage>(connection);
370
+
371
+ await expect(
372
+ publisher.publish([
373
+ { type: 'user.created', payload: { userId: '123' } },
374
+ ]),
375
+ ).rejects.toThrow();
376
+ });
377
+ });
378
+ });