@geekmidas/events 10.0.0-alpha.99 → 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.
- package/CHANGELOG.md +116 -0
- package/README.md +1 -46
- package/dist/BasicConnection-CQsJpx2J.d.cts +27 -0
- package/dist/BasicConnection-CQsJpx2J.d.cts.map +1 -0
- package/dist/BasicConnection-CxfNEvlb.cjs +48 -0
- package/dist/BasicConnection-CxfNEvlb.cjs.map +1 -0
- package/dist/BasicConnection-DcRelT64.d.mts +27 -0
- package/dist/BasicConnection-DcRelT64.d.mts.map +1 -0
- package/dist/BasicConnection-hl-Ogz3a.mjs +42 -0
- package/dist/BasicConnection-hl-Ogz3a.mjs.map +1 -0
- package/dist/BasicPublisher-C-hMX2Hy.d.mts +14 -0
- package/dist/BasicPublisher-C-hMX2Hy.d.mts.map +1 -0
- package/dist/BasicPublisher-CGMXg2I2.d.cts +14 -0
- package/dist/BasicPublisher-CGMXg2I2.d.cts.map +1 -0
- package/dist/BasicPublisher-CXAVKxgq.cjs +20 -0
- package/dist/BasicPublisher-CXAVKxgq.cjs.map +1 -0
- package/dist/BasicPublisher-DogbeHAH.mjs +14 -0
- package/dist/BasicPublisher-DogbeHAH.mjs.map +1 -0
- package/dist/BasicSubscriber-BJSZN22M.mjs +16 -0
- package/dist/BasicSubscriber-BJSZN22M.mjs.map +1 -0
- package/dist/BasicSubscriber-HzSJ_MbB.d.mts +14 -0
- package/dist/BasicSubscriber-HzSJ_MbB.d.mts.map +1 -0
- package/dist/BasicSubscriber-mVJRMXhZ.cjs +22 -0
- package/dist/BasicSubscriber-mVJRMXhZ.cjs.map +1 -0
- package/dist/BasicSubscriber-uW3IOyBj.d.cts +14 -0
- package/dist/BasicSubscriber-uW3IOyBj.d.cts.map +1 -0
- package/dist/EventConnection-4niMI6D8.d.mts +13 -0
- package/dist/EventConnection-4niMI6D8.d.mts.map +1 -0
- package/dist/EventConnection-BkA9FSVL.cjs +45 -0
- package/dist/EventConnection-BkA9FSVL.cjs.map +1 -0
- package/dist/EventConnection-Kr32GAzq.mjs +40 -0
- package/dist/EventConnection-Kr32GAzq.mjs.map +1 -0
- package/dist/EventConnection-dP42P87q.d.cts +13 -0
- package/dist/EventConnection-dP42P87q.d.cts.map +1 -0
- package/dist/EventConnection.cjs +5 -0
- package/dist/EventConnection.d.cts +3 -0
- package/dist/EventConnection.d.mts +3 -0
- package/dist/EventConnection.mjs +4 -0
- package/dist/PgBossConnection-B71ssr72.cjs +80 -0
- package/dist/PgBossConnection-B71ssr72.cjs.map +1 -0
- package/dist/PgBossConnection-Bj_Wo1lQ.mjs +74 -0
- package/dist/PgBossConnection-Bj_Wo1lQ.mjs.map +1 -0
- package/dist/PgBossConnection-DCfLGoHx.d.mts +32 -0
- package/dist/PgBossConnection-DCfLGoHx.d.mts.map +1 -0
- package/dist/PgBossConnection-oto_CAbP.d.cts +32 -0
- package/dist/PgBossConnection-oto_CAbP.d.cts.map +1 -0
- package/dist/PgBossPublisher-Bwo7qSoH.mjs +35 -0
- package/dist/PgBossPublisher-Bwo7qSoH.mjs.map +1 -0
- package/dist/PgBossPublisher-CqjigBVC.d.mts +20 -0
- package/dist/PgBossPublisher-CqjigBVC.d.mts.map +1 -0
- package/dist/PgBossPublisher-FTdYh58W.cjs +41 -0
- package/dist/PgBossPublisher-FTdYh58W.cjs.map +1 -0
- package/dist/PgBossPublisher-JIiB1zpA.d.cts +20 -0
- package/dist/PgBossPublisher-JIiB1zpA.d.cts.map +1 -0
- package/dist/PgBossSubscriber-BUiB1JKf.d.mts +24 -0
- package/dist/PgBossSubscriber-BUiB1JKf.d.mts.map +1 -0
- package/dist/PgBossSubscriber-BubVfuWm.cjs +52 -0
- package/dist/PgBossSubscriber-BubVfuWm.cjs.map +1 -0
- package/dist/PgBossSubscriber-Cozijfdj.d.cts +24 -0
- package/dist/PgBossSubscriber-Cozijfdj.d.cts.map +1 -0
- package/dist/PgBossSubscriber-DopATe80.mjs +46 -0
- package/dist/PgBossSubscriber-DopATe80.mjs.map +1 -0
- package/dist/Publisher-CKloIGh6.cjs +79 -0
- package/dist/Publisher-CKloIGh6.cjs.map +1 -0
- package/dist/Publisher-ChLTrUeP.mjs +74 -0
- package/dist/Publisher-ChLTrUeP.mjs.map +1 -0
- package/dist/Publisher-DDee6xau.d.cts +21 -0
- package/dist/Publisher-DDee6xau.d.cts.map +1 -0
- package/dist/Publisher-VHumMkrP.d.mts +21 -0
- package/dist/Publisher-VHumMkrP.d.mts.map +1 -0
- package/dist/Publisher.cjs +4 -0
- package/dist/Publisher.d.cts +3 -0
- package/dist/Publisher.d.mts +3 -0
- package/dist/Publisher.mjs +4 -0
- package/dist/RabbitMQConnection-BtKZjtZY.mjs +107 -0
- package/dist/RabbitMQConnection-BtKZjtZY.mjs.map +1 -0
- package/dist/RabbitMQConnection-DV9t3VYp.d.mts +44 -0
- package/dist/RabbitMQConnection-DV9t3VYp.d.mts.map +1 -0
- package/dist/RabbitMQConnection-DmMMosT4.cjs +113 -0
- package/dist/RabbitMQConnection-DmMMosT4.cjs.map +1 -0
- package/dist/RabbitMQConnection-jNME_eR7.d.cts +44 -0
- package/dist/RabbitMQConnection-jNME_eR7.d.cts.map +1 -0
- package/dist/RabbitMQPublisher-C94q6g8q.cjs +45 -0
- package/dist/RabbitMQPublisher-C94q6g8q.cjs.map +1 -0
- package/dist/RabbitMQPublisher-DKmgwqVj.d.mts +25 -0
- package/dist/RabbitMQPublisher-DKmgwqVj.d.mts.map +1 -0
- package/dist/RabbitMQPublisher-d257OHLa.d.cts +25 -0
- package/dist/RabbitMQPublisher-d257OHLa.d.cts.map +1 -0
- package/dist/RabbitMQPublisher-yUqWNq-P.mjs +39 -0
- package/dist/RabbitMQPublisher-yUqWNq-P.mjs.map +1 -0
- package/dist/RabbitMQSubscriber-BF7JGfYm.d.cts +27 -0
- package/dist/RabbitMQSubscriber-BF7JGfYm.d.cts.map +1 -0
- package/dist/RabbitMQSubscriber-BWniDtFs.mjs +56 -0
- package/dist/RabbitMQSubscriber-BWniDtFs.mjs.map +1 -0
- package/dist/RabbitMQSubscriber-CdbUy5mB.d.mts +27 -0
- package/dist/RabbitMQSubscriber-CdbUy5mB.d.mts.map +1 -0
- package/dist/RabbitMQSubscriber-DGEO-clQ.cjs +62 -0
- package/dist/RabbitMQSubscriber-DGEO-clQ.cjs.map +1 -0
- package/dist/SNSConnection-CAcbLQOy.cjs +76 -0
- package/dist/SNSConnection-CAcbLQOy.cjs.map +1 -0
- package/dist/SNSConnection-CG4iEwA8.d.mts +41 -0
- package/dist/SNSConnection-CG4iEwA8.d.mts.map +1 -0
- package/dist/SNSConnection-CVjH93lb.mjs +70 -0
- package/dist/SNSConnection-CVjH93lb.mjs.map +1 -0
- package/dist/SNSConnection-Dol9FuxA.d.cts +41 -0
- package/dist/SNSConnection-Dol9FuxA.d.cts.map +1 -0
- package/dist/SNSPublisher-CjlMS3Z2.mjs +41 -0
- package/dist/SNSPublisher-CjlMS3Z2.mjs.map +1 -0
- package/dist/SNSPublisher-D50dPCEh.d.mts +22 -0
- package/dist/SNSPublisher-D50dPCEh.d.mts.map +1 -0
- package/dist/SNSPublisher-DQunY4NM.d.cts +22 -0
- package/dist/SNSPublisher-DQunY4NM.d.cts.map +1 -0
- package/dist/SNSPublisher-DV_8GGsi.cjs +47 -0
- package/dist/SNSPublisher-DV_8GGsi.cjs.map +1 -0
- package/dist/SNSSubscriber-BWaCQFl6.mjs +139 -0
- package/dist/SNSSubscriber-BWaCQFl6.mjs.map +1 -0
- package/dist/SNSSubscriber-CUgHK4W2.d.mts +55 -0
- package/dist/SNSSubscriber-CUgHK4W2.d.mts.map +1 -0
- package/dist/SNSSubscriber-ZE_-Hsps.cjs +145 -0
- package/dist/SNSSubscriber-ZE_-Hsps.cjs.map +1 -0
- package/dist/SNSSubscriber-ZGJjhXFQ.d.cts +55 -0
- package/dist/SNSSubscriber-ZGJjhXFQ.d.cts.map +1 -0
- package/dist/SQSConnection-BtEkDha8.d.cts +41 -0
- package/dist/SQSConnection-BtEkDha8.d.cts.map +1 -0
- package/dist/SQSConnection-CT3S7_zP.mjs +70 -0
- package/dist/SQSConnection-CT3S7_zP.mjs.map +1 -0
- package/dist/SQSConnection-DVy43GCV.d.mts +41 -0
- package/dist/SQSConnection-DVy43GCV.d.mts.map +1 -0
- package/dist/SQSConnection-Y0mdVTcB.cjs +76 -0
- package/dist/SQSConnection-Y0mdVTcB.cjs.map +1 -0
- package/dist/SQSPublisher-B-32CC4G.mjs +57 -0
- package/dist/SQSPublisher-B-32CC4G.mjs.map +1 -0
- package/dist/SQSPublisher-CgUduk6H.cjs +63 -0
- package/dist/SQSPublisher-CgUduk6H.cjs.map +1 -0
- package/dist/SQSPublisher-kyl5HW3N.d.cts +25 -0
- package/dist/SQSPublisher-kyl5HW3N.d.cts.map +1 -0
- package/dist/SQSPublisher-qDE5Fp-N.d.mts +25 -0
- package/dist/SQSPublisher-qDE5Fp-N.d.mts.map +1 -0
- package/dist/SQSSubscriber-C4UA2hKq.cjs +120 -0
- package/dist/SQSSubscriber-C4UA2hKq.cjs.map +1 -0
- package/dist/SQSSubscriber-CDvaG4ij.d.cts +44 -0
- package/dist/SQSSubscriber-CDvaG4ij.d.cts.map +1 -0
- package/dist/SQSSubscriber-CQdSFzpe.mjs +114 -0
- package/dist/SQSSubscriber-CQdSFzpe.mjs.map +1 -0
- package/dist/SQSSubscriber-JfFuAAoP.d.mts +44 -0
- package/dist/SQSSubscriber-JfFuAAoP.d.mts.map +1 -0
- package/dist/Subscriber-CG_QUQZs.d.cts +21 -0
- package/dist/Subscriber-CG_QUQZs.d.cts.map +1 -0
- package/dist/Subscriber-CghW0A02.cjs +88 -0
- package/dist/Subscriber-CghW0A02.cjs.map +1 -0
- package/dist/Subscriber-DiYHmuF0.d.mts +21 -0
- package/dist/Subscriber-DiYHmuF0.d.mts.map +1 -0
- package/dist/Subscriber-bnkFtSvt.mjs +83 -0
- package/dist/Subscriber-bnkFtSvt.mjs.map +1 -0
- package/dist/Subscriber.cjs +4 -0
- package/dist/Subscriber.d.cts +3 -0
- package/dist/Subscriber.d.mts +3 -0
- package/dist/Subscriber.mjs +4 -0
- package/dist/basic/BasicConnection.cjs +4 -0
- package/dist/basic/BasicConnection.d.cts +3 -0
- package/dist/basic/BasicConnection.d.mts +3 -0
- package/dist/basic/BasicConnection.mjs +4 -0
- package/dist/basic/BasicPublisher.cjs +3 -0
- package/dist/basic/BasicPublisher.d.cts +4 -0
- package/dist/basic/BasicPublisher.d.mts +4 -0
- package/dist/basic/BasicPublisher.mjs +3 -0
- package/dist/basic/BasicSubscriber.cjs +3 -0
- package/dist/basic/BasicSubscriber.d.cts +4 -0
- package/dist/basic/BasicSubscriber.d.mts +4 -0
- package/dist/basic/BasicSubscriber.mjs +3 -0
- package/dist/basic/index.cjs +7 -100
- package/dist/basic/index.d.cts +5 -45
- package/dist/basic/index.d.mts +5 -45
- package/dist/basic/index.mjs +5 -96
- package/dist/{rolldown-runtime-C0BPl7ul.cjs → chunk-CUT6urMc.cjs} +10 -23
- package/dist/index.cjs +8 -87
- package/dist/index.d.cts +5 -102
- package/dist/index.d.mts +5 -102
- package/dist/index.mjs +5 -71
- package/dist/pgboss/PgBossConnection.cjs +4 -0
- package/dist/pgboss/PgBossConnection.d.cts +3 -0
- package/dist/pgboss/PgBossConnection.d.mts +3 -0
- package/dist/pgboss/PgBossConnection.mjs +4 -0
- package/dist/pgboss/PgBossPublisher.cjs +3 -0
- package/dist/pgboss/PgBossPublisher.d.cts +4 -0
- package/dist/pgboss/PgBossPublisher.d.mts +4 -0
- package/dist/pgboss/PgBossPublisher.mjs +3 -0
- package/dist/pgboss/PgBossSubscriber.cjs +3 -0
- package/dist/pgboss/PgBossSubscriber.d.cts +4 -0
- package/dist/pgboss/PgBossSubscriber.d.mts +4 -0
- package/dist/pgboss/PgBossSubscriber.mjs +3 -0
- package/dist/pgboss/index.cjs +7 -247
- package/dist/pgboss/index.d.cts +5 -107
- package/dist/pgboss/index.d.mts +5 -107
- package/dist/pgboss/index.mjs +5 -240
- package/dist/rabbitmq/RabbitMQConnection.cjs +4 -0
- package/dist/rabbitmq/RabbitMQConnection.d.cts +3 -0
- package/dist/rabbitmq/RabbitMQConnection.d.mts +3 -0
- package/dist/rabbitmq/RabbitMQConnection.mjs +4 -0
- package/dist/rabbitmq/RabbitMQPublisher.cjs +3 -0
- package/dist/rabbitmq/RabbitMQPublisher.d.cts +4 -0
- package/dist/rabbitmq/RabbitMQPublisher.d.mts +4 -0
- package/dist/rabbitmq/RabbitMQPublisher.mjs +3 -0
- package/dist/rabbitmq/RabbitMQSubscriber.cjs +3 -0
- package/dist/rabbitmq/RabbitMQSubscriber.d.cts +4 -0
- package/dist/rabbitmq/RabbitMQSubscriber.d.mts +4 -0
- package/dist/rabbitmq/RabbitMQSubscriber.mjs +3 -0
- package/dist/rabbitmq/index.cjs +7 -243
- package/dist/rabbitmq/index.d.cts +5 -92
- package/dist/rabbitmq/index.d.mts +5 -92
- package/dist/rabbitmq/index.mjs +5 -237
- package/dist/sns/SNSConnection.cjs +4 -0
- package/dist/sns/SNSConnection.d.cts +3 -0
- package/dist/sns/SNSConnection.d.mts +3 -0
- package/dist/sns/SNSConnection.mjs +4 -0
- package/dist/sns/SNSPublisher.cjs +3 -0
- package/dist/sns/SNSPublisher.d.cts +4 -0
- package/dist/sns/SNSPublisher.d.mts +4 -0
- package/dist/sns/SNSPublisher.mjs +3 -0
- package/dist/sns/SNSSubscriber.cjs +6 -0
- package/dist/sns/SNSSubscriber.d.cts +4 -0
- package/dist/sns/SNSSubscriber.d.mts +4 -0
- package/dist/sns/SNSSubscriber.mjs +6 -0
- package/dist/sns/index.cjs +9 -551
- package/dist/sns/index.d.cts +5 -273
- package/dist/sns/index.d.mts +5 -273
- package/dist/sns/index.mjs +7 -527
- package/dist/sqs/SQSConnection.cjs +4 -0
- package/dist/sqs/SQSConnection.d.cts +3 -0
- package/dist/sqs/SQSConnection.d.mts +3 -0
- package/dist/sqs/SQSConnection.mjs +4 -0
- package/dist/sqs/SQSPublisher.cjs +3 -0
- package/dist/sqs/SQSPublisher.d.cts +4 -0
- package/dist/sqs/SQSPublisher.d.mts +4 -0
- package/dist/sqs/SQSPublisher.mjs +3 -0
- package/dist/sqs/SQSSubscriber.cjs +3 -0
- package/dist/sqs/SQSSubscriber.d.cts +4 -0
- package/dist/sqs/SQSSubscriber.d.mts +4 -0
- package/dist/sqs/SQSSubscriber.mjs +3 -0
- package/dist/sqs/index.cjs +7 -35
- package/dist/sqs/index.d.cts +5 -118
- package/dist/sqs/index.d.mts +5 -118
- package/dist/sqs/index.mjs +5 -24
- package/dist/types-BrdcSEnd.mjs +18 -0
- package/dist/types-BrdcSEnd.mjs.map +1 -0
- package/dist/types-Byv8N9ma.cjs +24 -0
- package/dist/types-Byv8N9ma.cjs.map +1 -0
- package/dist/types-Dh9Jyinx.d.mts +67 -0
- package/dist/types-Dh9Jyinx.d.mts.map +1 -0
- package/dist/types-Dj23od3e.d.cts +67 -0
- package/dist/types-Dj23od3e.d.cts.map +1 -0
- package/dist/types.cjs +3 -0
- package/dist/types.d.cts +2 -0
- package/dist/types.d.mts +2 -0
- package/dist/types.mjs +3 -0
- package/package.json +12 -40
- package/src/EventConnection.ts +43 -0
- package/src/Publisher.ts +98 -0
- package/src/Subscriber.ts +113 -0
- package/src/__tests__/EventConnection.spec.ts +42 -0
- package/src/__tests__/Publisher.spec.ts +96 -0
- package/src/__tests__/Subscriber.spec.ts +109 -0
- package/src/basic/BasicConnection.ts +47 -0
- package/src/basic/BasicPublisher.ts +15 -0
- package/src/basic/BasicSubscriber.ts +21 -0
- package/src/basic/__tests__/BasicSubscriber.spec.ts +166 -0
- package/src/basic/index.ts +3 -0
- package/src/index.ts +25 -0
- package/src/pgboss/PgBossConnection.ts +91 -0
- package/src/pgboss/PgBossPublisher.ts +49 -0
- package/src/pgboss/PgBossSubscriber.ts +81 -0
- package/src/pgboss/__tests__/pgboss.spec.ts +196 -0
- package/src/pgboss/__tests__/setup.ts +21 -0
- package/src/pgboss/index.ts +5 -0
- package/src/rabbitmq/RabbitMQConnection.ts +148 -0
- package/src/rabbitmq/RabbitMQPublisher.ts +67 -0
- package/src/rabbitmq/RabbitMQSubscriber.ts +111 -0
- package/src/rabbitmq/__tests__/RabbitMQPublisher.spec.ts +378 -0
- package/src/rabbitmq/__tests__/RabbitMQSubscriber.spec.ts +292 -0
- package/src/rabbitmq/index.ts +6 -0
- package/src/sns/SNSConnection.ts +98 -0
- package/src/sns/SNSPublisher.ts +62 -0
- package/src/sns/SNSSubscriber.ts +218 -0
- package/src/sns/__tests__/SNS-SQS-Integration.spec.ts +389 -0
- package/src/sns/__tests__/SNSPublisher.spec.ts +449 -0
- package/src/sns/__tests__/SNSSubscriber.spec.ts +527 -0
- package/src/sns/index.ts +6 -0
- package/src/sqs/SQSConnection.ts +97 -0
- package/src/sqs/SQSPublisher.ts +105 -0
- package/src/sqs/SQSSubscriber.ts +181 -0
- package/src/sqs/__tests__/SQSPublisher.spec.ts +189 -0
- package/src/sqs/index.ts +6 -0
- package/src/types.ts +76 -0
- package/tsconfig.json +9 -0
- package/tsdown.config.ts +10 -0
- package/dist/SQSSubscriber-BEJBfNTe.mjs +0 -264
- package/dist/SQSSubscriber-BEJBfNTe.mjs.map +0 -1
- package/dist/SQSSubscriber-COTqWvOk.cjs +0 -288
- package/dist/SQSSubscriber-COTqWvOk.cjs.map +0 -1
- package/dist/basic/index.cjs.map +0 -1
- package/dist/basic/index.d.cts.map +0 -1
- package/dist/basic/index.d.mts.map +0 -1
- package/dist/basic/index.mjs.map +0 -1
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.cts.map +0 -1
- package/dist/index.d.mts.map +0 -1
- package/dist/index.mjs.map +0 -1
- package/dist/pgboss/index.cjs.map +0 -1
- package/dist/pgboss/index.d.cts.map +0 -1
- package/dist/pgboss/index.d.mts.map +0 -1
- package/dist/pgboss/index.mjs.map +0 -1
- package/dist/rabbitmq/index.cjs.map +0 -1
- package/dist/rabbitmq/index.d.cts.map +0 -1
- package/dist/rabbitmq/index.d.mts.map +0 -1
- package/dist/rabbitmq/index.mjs.map +0 -1
- package/dist/registry-DIx25Q5s.d.cts +0 -255
- package/dist/registry-DIx25Q5s.d.cts.map +0 -1
- package/dist/registry-DIx25Q5s.d.mts +0 -255
- package/dist/registry-DIx25Q5s.d.mts.map +0 -1
- package/dist/registry-DXLY1Xf6.mjs +0 -99
- package/dist/registry-DXLY1Xf6.mjs.map +0 -1
- package/dist/registry-DlT36229.cjs +0 -122
- package/dist/registry-DlT36229.cjs.map +0 -1
- package/dist/rolldown-runtime-D7D4PA-g.mjs +0 -13
- package/dist/sns/index.cjs.map +0 -1
- package/dist/sns/index.d.cts.map +0 -1
- package/dist/sns/index.d.mts.map +0 -1
- package/dist/sns/index.mjs.map +0 -1
- package/dist/sns/snsUrl.cjs +0 -92
- package/dist/sns/snsUrl.cjs.map +0 -1
- package/dist/sns/snsUrl.d.cts +0 -57
- package/dist/sns/snsUrl.d.cts.map +0 -1
- package/dist/sns/snsUrl.d.mts +0 -57
- package/dist/sns/snsUrl.d.mts.map +0 -1
- package/dist/sns/snsUrl.mjs +0 -82
- package/dist/sns/snsUrl.mjs.map +0 -1
- package/dist/sqs/index.cjs.map +0 -1
- package/dist/sqs/index.d.cts.map +0 -1
- package/dist/sqs/index.d.mts.map +0 -1
- package/dist/sqs/index.mjs.map +0 -1
- package/dist/sqs/sqsUrl.cjs +0 -93
- package/dist/sqs/sqsUrl.cjs.map +0 -1
- package/dist/sqs/sqsUrl.d.cts +0 -56
- package/dist/sqs/sqsUrl.d.cts.map +0 -1
- package/dist/sqs/sqsUrl.d.mts +0 -56
- package/dist/sqs/sqsUrl.d.mts.map +0 -1
- package/dist/sqs/sqsUrl.mjs +0 -83
- package/dist/sqs/sqsUrl.mjs.map +0 -1
- package/dist/telemetry-DG3l807O.cjs +0 -309
- package/dist/telemetry-DG3l807O.cjs.map +0 -1
- package/dist/telemetry-DjjgJMul.mjs +0 -244
- package/dist/telemetry-DjjgJMul.mjs.map +0 -1
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
const require_types = require('./types-Byv8N9ma.cjs');
|
|
2
|
+
|
|
3
|
+
//#region src/Publisher.ts
|
|
4
|
+
var Publisher = class {
|
|
5
|
+
/**
|
|
6
|
+
* Create a publisher from a connection string
|
|
7
|
+
* This creates both a connection and a publisher
|
|
8
|
+
*/
|
|
9
|
+
static async fromConnectionString(connectionStr) {
|
|
10
|
+
const url = new URL(connectionStr);
|
|
11
|
+
switch (url.protocol.replace(":", "")) {
|
|
12
|
+
case require_types.EventPublisherType.Basic: {
|
|
13
|
+
const { BasicConnection, BasicPublisher } = await Promise.resolve().then(() => require("./basic/index.cjs"));
|
|
14
|
+
const connection = await BasicConnection.fromConnectionString(connectionStr);
|
|
15
|
+
return new BasicPublisher(connection);
|
|
16
|
+
}
|
|
17
|
+
case require_types.EventPublisherType.RabbitMQ: {
|
|
18
|
+
const { RabbitMQPublisher } = await Promise.resolve().then(() => require("./rabbitmq/index.cjs"));
|
|
19
|
+
return RabbitMQPublisher.fromConnectionString(connectionStr);
|
|
20
|
+
}
|
|
21
|
+
case require_types.EventPublisherType.SQS: {
|
|
22
|
+
const { SQSPublisher } = await Promise.resolve().then(() => require("./sqs/index.cjs"));
|
|
23
|
+
return SQSPublisher.fromConnectionString(connectionStr);
|
|
24
|
+
}
|
|
25
|
+
case require_types.EventPublisherType.SNS: {
|
|
26
|
+
const { SNSPublisher } = await Promise.resolve().then(() => require("./sns/index.cjs"));
|
|
27
|
+
return SNSPublisher.fromConnectionString(connectionStr);
|
|
28
|
+
}
|
|
29
|
+
case require_types.EventPublisherType.PgBoss: {
|
|
30
|
+
const { PgBossPublisher } = await Promise.resolve().then(() => require("./pgboss/index.cjs"));
|
|
31
|
+
return PgBossPublisher.fromConnectionString(connectionStr);
|
|
32
|
+
}
|
|
33
|
+
default: throw new Error(`Unsupported event publisher type: ${url.protocol}`);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Create a publisher from an existing connection
|
|
38
|
+
* This allows sharing connections between publishers and subscribers
|
|
39
|
+
*/
|
|
40
|
+
static async fromConnection(connection) {
|
|
41
|
+
switch (connection.type) {
|
|
42
|
+
case require_types.EventPublisherType.Basic: {
|
|
43
|
+
const { BasicPublisher } = await Promise.resolve().then(() => require("./basic/index.cjs"));
|
|
44
|
+
const { BasicConnection } = await Promise.resolve().then(() => require("./basic/index.cjs"));
|
|
45
|
+
return new BasicPublisher(connection);
|
|
46
|
+
}
|
|
47
|
+
case require_types.EventPublisherType.RabbitMQ: {
|
|
48
|
+
const { RabbitMQPublisher } = await Promise.resolve().then(() => require("./rabbitmq/index.cjs"));
|
|
49
|
+
const { RabbitMQConnection } = await Promise.resolve().then(() => require("./rabbitmq/index.cjs"));
|
|
50
|
+
return new RabbitMQPublisher(connection);
|
|
51
|
+
}
|
|
52
|
+
case require_types.EventPublisherType.SQS: {
|
|
53
|
+
const { SQSPublisher } = await Promise.resolve().then(() => require("./sqs/index.cjs"));
|
|
54
|
+
const { SQSConnection } = await Promise.resolve().then(() => require("./sqs/index.cjs"));
|
|
55
|
+
return new SQSPublisher(connection);
|
|
56
|
+
}
|
|
57
|
+
case require_types.EventPublisherType.SNS: {
|
|
58
|
+
const { SNSPublisher } = await Promise.resolve().then(() => require("./sns/index.cjs"));
|
|
59
|
+
const { SNSConnection } = await Promise.resolve().then(() => require("./sns/index.cjs"));
|
|
60
|
+
return new SNSPublisher(connection);
|
|
61
|
+
}
|
|
62
|
+
case require_types.EventPublisherType.PgBoss: {
|
|
63
|
+
const { PgBossPublisher } = await Promise.resolve().then(() => require("./pgboss/index.cjs"));
|
|
64
|
+
const { PgBossConnection } = await Promise.resolve().then(() => require("./pgboss/index.cjs"));
|
|
65
|
+
return new PgBossPublisher(connection);
|
|
66
|
+
}
|
|
67
|
+
default: throw new Error(`Unsupported connection type: ${connection.type}`);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
//#endregion
|
|
73
|
+
Object.defineProperty(exports, 'Publisher', {
|
|
74
|
+
enumerable: true,
|
|
75
|
+
get: function () {
|
|
76
|
+
return Publisher;
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
//# sourceMappingURL=Publisher-CKloIGh6.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Publisher-CKloIGh6.cjs","names":["connectionStr: EventPublisherConnectionString","EventPublisherType","connection: EventConnection"],"sources":["../src/Publisher.ts"],"sourcesContent":["import type {\n\tEventConnection,\n\tEventPublisher,\n\tPublishableMessage,\n} from './types';\nimport { EventPublisherType } from './types';\n\nexport class Publisher {\n\t/**\n\t * Create a publisher from a connection string\n\t * This creates both a connection and a publisher\n\t */\n\tstatic async fromConnectionString<\n\t\tTMessage extends PublishableMessage<string, any>,\n\t>(\n\t\tconnectionStr: EventPublisherConnectionString,\n\t): Promise<EventPublisher<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, BasicPublisher } = await import('./basic');\n\t\t\t\tconst connection =\n\t\t\t\t\tawait BasicConnection.fromConnectionString(connectionStr);\n\t\t\t\treturn new BasicPublisher<TMessage>(connection);\n\t\t\t}\n\t\t\tcase EventPublisherType.RabbitMQ: {\n\t\t\t\tconst { RabbitMQPublisher } = await import('./rabbitmq');\n\t\t\t\treturn RabbitMQPublisher.fromConnectionString<TMessage>(connectionStr);\n\t\t\t}\n\t\t\tcase EventPublisherType.SQS: {\n\t\t\t\tconst { SQSPublisher } = await import('./sqs');\n\t\t\t\treturn SQSPublisher.fromConnectionString<TMessage>(connectionStr);\n\t\t\t}\n\t\t\tcase EventPublisherType.SNS: {\n\t\t\t\tconst { SNSPublisher } = await import('./sns');\n\t\t\t\treturn SNSPublisher.fromConnectionString<TMessage>(connectionStr);\n\t\t\t}\n\t\t\tcase EventPublisherType.PgBoss: {\n\t\t\t\tconst { PgBossPublisher } = await import('./pgboss');\n\t\t\t\treturn PgBossPublisher.fromConnectionString<TMessage>(connectionStr);\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 publisher type: ${url.protocol}`);\n\t\t}\n\t}\n\n\t/**\n\t * Create a publisher 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<EventPublisher<TMessage>> {\n\t\tswitch (connection.type) {\n\t\t\tcase EventPublisherType.Basic: {\n\t\t\t\tconst { BasicPublisher } = await import('./basic');\n\t\t\t\tconst { BasicConnection } = await import('./basic');\n\t\t\t\treturn new BasicPublisher<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 { RabbitMQPublisher } = await import('./rabbitmq');\n\t\t\t\tconst { RabbitMQConnection } = await import('./rabbitmq');\n\t\t\t\treturn new RabbitMQPublisher<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.SQS: {\n\t\t\t\tconst { SQSPublisher } = await import('./sqs');\n\t\t\t\tconst { SQSConnection } = await import('./sqs');\n\t\t\t\treturn new SQSPublisher<TMessage>(\n\t\t\t\t\tconnection as InstanceType<typeof SQSConnection>,\n\t\t\t\t);\n\t\t\t}\n\t\t\tcase EventPublisherType.SNS: {\n\t\t\t\tconst { SNSPublisher } = await import('./sns');\n\t\t\t\tconst { SNSConnection } = await import('./sns');\n\t\t\t\treturn new SNSPublisher<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.PgBoss: {\n\t\t\t\tconst { PgBossPublisher } = await import('./pgboss');\n\t\t\t\tconst { PgBossConnection } = await import('./pgboss');\n\t\t\t\treturn new PgBossPublisher<TMessage>(\n\t\t\t\t\tconnection as InstanceType<typeof PgBossConnection>,\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 EventPublisherConnectionString =\n\t`${EventPublisherType}://${string}`;\n"],"mappings":";;;AAOA,IAAa,YAAb,MAAuB;;;;;CAKtB,aAAa,qBAGZA,eACoC;EACpC,MAAM,MAAM,IAAI,IAAI;AACpB,UAAQ,IAAI,SAAS,QAAQ,KAAK,GAAG,EAArC;GACC,KAAKC,iCAAmB,OAAO;IAC9B,MAAM,EAAE,iBAAiB,gBAAgB,GAAG,2CAAM;IAClD,MAAM,aACL,MAAM,gBAAgB,qBAAqB,cAAc;AAC1D,WAAO,IAAI,eAAyB;GACpC;GACD,KAAKA,iCAAmB,UAAU;IACjC,MAAM,EAAE,mBAAmB,GAAG,2CAAM;AACpC,WAAO,kBAAkB,qBAA+B,cAAc;GACtE;GACD,KAAKA,iCAAmB,KAAK;IAC5B,MAAM,EAAE,cAAc,GAAG,2CAAM;AAC/B,WAAO,aAAa,qBAA+B,cAAc;GACjE;GACD,KAAKA,iCAAmB,KAAK;IAC5B,MAAM,EAAE,cAAc,GAAG,2CAAM;AAC/B,WAAO,aAAa,qBAA+B,cAAc;GACjE;GACD,KAAKA,iCAAmB,QAAQ;IAC/B,MAAM,EAAE,iBAAiB,GAAG,2CAAM;AAClC,WAAO,gBAAgB,qBAA+B,cAAc;GACpE;GAED,QACC,OAAM,IAAI,OAAO,oCAAoC,IAAI,SAAS;EACnE;CACD;;;;;CAMD,aAAa,eACZC,YACoC;AACpC,UAAQ,WAAW,MAAnB;GACC,KAAKD,iCAAmB,OAAO;IAC9B,MAAM,EAAE,gBAAgB,GAAG,2CAAM;IACjC,MAAM,EAAE,iBAAiB,GAAG,2CAAM;AAClC,WAAO,IAAI,eACV;GAED;GACD,KAAKA,iCAAmB,UAAU;IACjC,MAAM,EAAE,mBAAmB,GAAG,2CAAM;IACpC,MAAM,EAAE,oBAAoB,GAAG,2CAAM;AACrC,WAAO,IAAI,kBACV;GAED;GACD,KAAKA,iCAAmB,KAAK;IAC5B,MAAM,EAAE,cAAc,GAAG,2CAAM;IAC/B,MAAM,EAAE,eAAe,GAAG,2CAAM;AAChC,WAAO,IAAI,aACV;GAED;GACD,KAAKA,iCAAmB,KAAK;IAC5B,MAAM,EAAE,cAAc,GAAG,2CAAM;IAC/B,MAAM,EAAE,eAAe,GAAG,2CAAM;AAChC,WAAO,IAAI,aACV;GAED;GACD,KAAKA,iCAAmB,QAAQ;IAC/B,MAAM,EAAE,iBAAiB,GAAG,2CAAM;IAClC,MAAM,EAAE,kBAAkB,GAAG,2CAAM;AACnC,WAAO,IAAI,gBACV;GAED;GACD,QACC,OAAM,IAAI,OAAO,+BAA+B,WAAW,KAAK;EACjE;CACD;AACD"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { EventPublisherType } from "./types-BrdcSEnd.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/Publisher.ts
|
|
4
|
+
var Publisher = class {
|
|
5
|
+
/**
|
|
6
|
+
* Create a publisher from a connection string
|
|
7
|
+
* This creates both a connection and a publisher
|
|
8
|
+
*/
|
|
9
|
+
static async fromConnectionString(connectionStr) {
|
|
10
|
+
const url = new URL(connectionStr);
|
|
11
|
+
switch (url.protocol.replace(":", "")) {
|
|
12
|
+
case EventPublisherType.Basic: {
|
|
13
|
+
const { BasicConnection, BasicPublisher } = await import("./basic/index.mjs");
|
|
14
|
+
const connection = await BasicConnection.fromConnectionString(connectionStr);
|
|
15
|
+
return new BasicPublisher(connection);
|
|
16
|
+
}
|
|
17
|
+
case EventPublisherType.RabbitMQ: {
|
|
18
|
+
const { RabbitMQPublisher } = await import("./rabbitmq/index.mjs");
|
|
19
|
+
return RabbitMQPublisher.fromConnectionString(connectionStr);
|
|
20
|
+
}
|
|
21
|
+
case EventPublisherType.SQS: {
|
|
22
|
+
const { SQSPublisher } = await import("./sqs/index.mjs");
|
|
23
|
+
return SQSPublisher.fromConnectionString(connectionStr);
|
|
24
|
+
}
|
|
25
|
+
case EventPublisherType.SNS: {
|
|
26
|
+
const { SNSPublisher } = await import("./sns/index.mjs");
|
|
27
|
+
return SNSPublisher.fromConnectionString(connectionStr);
|
|
28
|
+
}
|
|
29
|
+
case EventPublisherType.PgBoss: {
|
|
30
|
+
const { PgBossPublisher } = await import("./pgboss/index.mjs");
|
|
31
|
+
return PgBossPublisher.fromConnectionString(connectionStr);
|
|
32
|
+
}
|
|
33
|
+
default: throw new Error(`Unsupported event publisher type: ${url.protocol}`);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Create a publisher from an existing connection
|
|
38
|
+
* This allows sharing connections between publishers and subscribers
|
|
39
|
+
*/
|
|
40
|
+
static async fromConnection(connection) {
|
|
41
|
+
switch (connection.type) {
|
|
42
|
+
case EventPublisherType.Basic: {
|
|
43
|
+
const { BasicPublisher } = await import("./basic/index.mjs");
|
|
44
|
+
const { BasicConnection } = await import("./basic/index.mjs");
|
|
45
|
+
return new BasicPublisher(connection);
|
|
46
|
+
}
|
|
47
|
+
case EventPublisherType.RabbitMQ: {
|
|
48
|
+
const { RabbitMQPublisher } = await import("./rabbitmq/index.mjs");
|
|
49
|
+
const { RabbitMQConnection } = await import("./rabbitmq/index.mjs");
|
|
50
|
+
return new RabbitMQPublisher(connection);
|
|
51
|
+
}
|
|
52
|
+
case EventPublisherType.SQS: {
|
|
53
|
+
const { SQSPublisher } = await import("./sqs/index.mjs");
|
|
54
|
+
const { SQSConnection } = await import("./sqs/index.mjs");
|
|
55
|
+
return new SQSPublisher(connection);
|
|
56
|
+
}
|
|
57
|
+
case EventPublisherType.SNS: {
|
|
58
|
+
const { SNSPublisher } = await import("./sns/index.mjs");
|
|
59
|
+
const { SNSConnection } = await import("./sns/index.mjs");
|
|
60
|
+
return new SNSPublisher(connection);
|
|
61
|
+
}
|
|
62
|
+
case EventPublisherType.PgBoss: {
|
|
63
|
+
const { PgBossPublisher } = await import("./pgboss/index.mjs");
|
|
64
|
+
const { PgBossConnection } = await import("./pgboss/index.mjs");
|
|
65
|
+
return new PgBossPublisher(connection);
|
|
66
|
+
}
|
|
67
|
+
default: throw new Error(`Unsupported connection type: ${connection.type}`);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
//#endregion
|
|
73
|
+
export { Publisher };
|
|
74
|
+
//# sourceMappingURL=Publisher-ChLTrUeP.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Publisher-ChLTrUeP.mjs","names":["connectionStr: EventPublisherConnectionString","connection: EventConnection"],"sources":["../src/Publisher.ts"],"sourcesContent":["import type {\n\tEventConnection,\n\tEventPublisher,\n\tPublishableMessage,\n} from './types';\nimport { EventPublisherType } from './types';\n\nexport class Publisher {\n\t/**\n\t * Create a publisher from a connection string\n\t * This creates both a connection and a publisher\n\t */\n\tstatic async fromConnectionString<\n\t\tTMessage extends PublishableMessage<string, any>,\n\t>(\n\t\tconnectionStr: EventPublisherConnectionString,\n\t): Promise<EventPublisher<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, BasicPublisher } = await import('./basic');\n\t\t\t\tconst connection =\n\t\t\t\t\tawait BasicConnection.fromConnectionString(connectionStr);\n\t\t\t\treturn new BasicPublisher<TMessage>(connection);\n\t\t\t}\n\t\t\tcase EventPublisherType.RabbitMQ: {\n\t\t\t\tconst { RabbitMQPublisher } = await import('./rabbitmq');\n\t\t\t\treturn RabbitMQPublisher.fromConnectionString<TMessage>(connectionStr);\n\t\t\t}\n\t\t\tcase EventPublisherType.SQS: {\n\t\t\t\tconst { SQSPublisher } = await import('./sqs');\n\t\t\t\treturn SQSPublisher.fromConnectionString<TMessage>(connectionStr);\n\t\t\t}\n\t\t\tcase EventPublisherType.SNS: {\n\t\t\t\tconst { SNSPublisher } = await import('./sns');\n\t\t\t\treturn SNSPublisher.fromConnectionString<TMessage>(connectionStr);\n\t\t\t}\n\t\t\tcase EventPublisherType.PgBoss: {\n\t\t\t\tconst { PgBossPublisher } = await import('./pgboss');\n\t\t\t\treturn PgBossPublisher.fromConnectionString<TMessage>(connectionStr);\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 publisher type: ${url.protocol}`);\n\t\t}\n\t}\n\n\t/**\n\t * Create a publisher 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<EventPublisher<TMessage>> {\n\t\tswitch (connection.type) {\n\t\t\tcase EventPublisherType.Basic: {\n\t\t\t\tconst { BasicPublisher } = await import('./basic');\n\t\t\t\tconst { BasicConnection } = await import('./basic');\n\t\t\t\treturn new BasicPublisher<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 { RabbitMQPublisher } = await import('./rabbitmq');\n\t\t\t\tconst { RabbitMQConnection } = await import('./rabbitmq');\n\t\t\t\treturn new RabbitMQPublisher<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.SQS: {\n\t\t\t\tconst { SQSPublisher } = await import('./sqs');\n\t\t\t\tconst { SQSConnection } = await import('./sqs');\n\t\t\t\treturn new SQSPublisher<TMessage>(\n\t\t\t\t\tconnection as InstanceType<typeof SQSConnection>,\n\t\t\t\t);\n\t\t\t}\n\t\t\tcase EventPublisherType.SNS: {\n\t\t\t\tconst { SNSPublisher } = await import('./sns');\n\t\t\t\tconst { SNSConnection } = await import('./sns');\n\t\t\t\treturn new SNSPublisher<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.PgBoss: {\n\t\t\t\tconst { PgBossPublisher } = await import('./pgboss');\n\t\t\t\tconst { PgBossConnection } = await import('./pgboss');\n\t\t\t\treturn new PgBossPublisher<TMessage>(\n\t\t\t\t\tconnection as InstanceType<typeof PgBossConnection>,\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 EventPublisherConnectionString =\n\t`${EventPublisherType}://${string}`;\n"],"mappings":";;;AAOA,IAAa,YAAb,MAAuB;;;;;CAKtB,aAAa,qBAGZA,eACoC;EACpC,MAAM,MAAM,IAAI,IAAI;AACpB,UAAQ,IAAI,SAAS,QAAQ,KAAK,GAAG,EAArC;GACC,KAAK,mBAAmB,OAAO;IAC9B,MAAM,EAAE,iBAAiB,gBAAgB,GAAG,MAAM,OAAO;IACzD,MAAM,aACL,MAAM,gBAAgB,qBAAqB,cAAc;AAC1D,WAAO,IAAI,eAAyB;GACpC;GACD,KAAK,mBAAmB,UAAU;IACjC,MAAM,EAAE,mBAAmB,GAAG,MAAM,OAAO;AAC3C,WAAO,kBAAkB,qBAA+B,cAAc;GACtE;GACD,KAAK,mBAAmB,KAAK;IAC5B,MAAM,EAAE,cAAc,GAAG,MAAM,OAAO;AACtC,WAAO,aAAa,qBAA+B,cAAc;GACjE;GACD,KAAK,mBAAmB,KAAK;IAC5B,MAAM,EAAE,cAAc,GAAG,MAAM,OAAO;AACtC,WAAO,aAAa,qBAA+B,cAAc;GACjE;GACD,KAAK,mBAAmB,QAAQ;IAC/B,MAAM,EAAE,iBAAiB,GAAG,MAAM,OAAO;AACzC,WAAO,gBAAgB,qBAA+B,cAAc;GACpE;GAED,QACC,OAAM,IAAI,OAAO,oCAAoC,IAAI,SAAS;EACnE;CACD;;;;;CAMD,aAAa,eACZC,YACoC;AACpC,UAAQ,WAAW,MAAnB;GACC,KAAK,mBAAmB,OAAO;IAC9B,MAAM,EAAE,gBAAgB,GAAG,MAAM,OAAO;IACxC,MAAM,EAAE,iBAAiB,GAAG,MAAM,OAAO;AACzC,WAAO,IAAI,eACV;GAED;GACD,KAAK,mBAAmB,UAAU;IACjC,MAAM,EAAE,mBAAmB,GAAG,MAAM,OAAO;IAC3C,MAAM,EAAE,oBAAoB,GAAG,MAAM,OAAO;AAC5C,WAAO,IAAI,kBACV;GAED;GACD,KAAK,mBAAmB,KAAK;IAC5B,MAAM,EAAE,cAAc,GAAG,MAAM,OAAO;IACtC,MAAM,EAAE,eAAe,GAAG,MAAM,OAAO;AACvC,WAAO,IAAI,aACV;GAED;GACD,KAAK,mBAAmB,KAAK;IAC5B,MAAM,EAAE,cAAc,GAAG,MAAM,OAAO;IACtC,MAAM,EAAE,eAAe,GAAG,MAAM,OAAO;AACvC,WAAO,IAAI,aACV;GAED;GACD,KAAK,mBAAmB,QAAQ;IAC/B,MAAM,EAAE,iBAAiB,GAAG,MAAM,OAAO;IACzC,MAAM,EAAE,kBAAkB,GAAG,MAAM,OAAO;AAC1C,WAAO,IAAI,gBACV;GAED;GACD,QACC,OAAM,IAAI,OAAO,+BAA+B,WAAW,KAAK;EACjE;CACD;AACD"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { EventConnection, EventPublisher, EventPublisherType, PublishableMessage } from "./types-Dj23od3e.cjs";
|
|
2
|
+
|
|
3
|
+
//#region src/Publisher.d.ts
|
|
4
|
+
declare class Publisher {
|
|
5
|
+
/**
|
|
6
|
+
* Create a publisher from a connection string
|
|
7
|
+
* This creates both a connection and a publisher
|
|
8
|
+
*/
|
|
9
|
+
static fromConnectionString<TMessage extends PublishableMessage<string, any>>(connectionStr: EventPublisherConnectionString): Promise<EventPublisher<TMessage>>;
|
|
10
|
+
/**
|
|
11
|
+
* Create a publisher from an existing connection
|
|
12
|
+
* This allows sharing connections between publishers and subscribers
|
|
13
|
+
*/
|
|
14
|
+
static fromConnection<TMessage extends PublishableMessage<string, any>>(connection: EventConnection): Promise<EventPublisher<TMessage>>;
|
|
15
|
+
}
|
|
16
|
+
type EventPublisherConnectionString = `${EventPublisherType}://${string}`;
|
|
17
|
+
//# sourceMappingURL=Publisher.d.ts.map
|
|
18
|
+
|
|
19
|
+
//#endregion
|
|
20
|
+
export { EventPublisherConnectionString, Publisher };
|
|
21
|
+
//# sourceMappingURL=Publisher-DDee6xau.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Publisher-DDee6xau.d.cts","names":[],"sources":["../src/Publisher.ts"],"sourcesContent":[],"mappings":";;;cAOa,SAAA;EAAA;;;;EAQkC,OACpB,oBAAA,CAAA,iBAHR,kBAGQ,CAAA,MAAA,EAAA,GAAA,CAAA,CAAA,CAAA,aAAA,EADV,8BACU,CAAA,EAAvB,OAAuB,CAAf,cAAe,CAAA,QAAA,CAAA,CAAA;EAAQ;;;;EAoCN,OACF,cAAA,CAAA,iBAFmB,kBAEnB,CAAA,MAAA,EAAA,GAAA,CAAA,CAAA,CAAA,UAAA,EADb,eACa,CAAA,EAAvB,OAAuB,CAAf,cAAe,CAAA,QAAA,CAAA,CAAA;;AAAvB,KA2CQ,8BAAA,GA3CR,GA4CA,kBA5CA,MAAA,MAAA,EAAA;AAAO"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { EventConnection, EventPublisher, EventPublisherType, PublishableMessage } from "./types-Dh9Jyinx.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/Publisher.d.ts
|
|
4
|
+
declare class Publisher {
|
|
5
|
+
/**
|
|
6
|
+
* Create a publisher from a connection string
|
|
7
|
+
* This creates both a connection and a publisher
|
|
8
|
+
*/
|
|
9
|
+
static fromConnectionString<TMessage extends PublishableMessage<string, any>>(connectionStr: EventPublisherConnectionString): Promise<EventPublisher<TMessage>>;
|
|
10
|
+
/**
|
|
11
|
+
* Create a publisher from an existing connection
|
|
12
|
+
* This allows sharing connections between publishers and subscribers
|
|
13
|
+
*/
|
|
14
|
+
static fromConnection<TMessage extends PublishableMessage<string, any>>(connection: EventConnection): Promise<EventPublisher<TMessage>>;
|
|
15
|
+
}
|
|
16
|
+
type EventPublisherConnectionString = `${EventPublisherType}://${string}`;
|
|
17
|
+
//# sourceMappingURL=Publisher.d.ts.map
|
|
18
|
+
|
|
19
|
+
//#endregion
|
|
20
|
+
export { EventPublisherConnectionString, Publisher };
|
|
21
|
+
//# sourceMappingURL=Publisher-VHumMkrP.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Publisher-VHumMkrP.d.mts","names":[],"sources":["../src/Publisher.ts"],"sourcesContent":[],"mappings":";;;cAOa,SAAA;EAAA;;;;EAQkC,OACpB,oBAAA,CAAA,iBAHR,kBAGQ,CAAA,MAAA,EAAA,GAAA,CAAA,CAAA,CAAA,aAAA,EADV,8BACU,CAAA,EAAvB,OAAuB,CAAf,cAAe,CAAA,QAAA,CAAA,CAAA;EAAQ;;;;EAoCN,OACF,cAAA,CAAA,iBAFmB,kBAEnB,CAAA,MAAA,EAAA,GAAA,CAAA,CAAA,CAAA,UAAA,EADb,eACa,CAAA,EAAvB,OAAuB,CAAf,cAAe,CAAA,QAAA,CAAA,CAAA;;AAAvB,KA2CQ,8BAAA,GA3CR,GA4CA,kBA5CA,MAAA,MAAA,EAAA;AAAO"}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { EventPublisherType } from "./types-BrdcSEnd.mjs";
|
|
2
|
+
import amqplib from "amqplib";
|
|
3
|
+
|
|
4
|
+
//#region src/rabbitmq/RabbitMQConnection.ts
|
|
5
|
+
var RabbitMQConnection = class RabbitMQConnection {
|
|
6
|
+
type = EventPublisherType.RabbitMQ;
|
|
7
|
+
connection;
|
|
8
|
+
channel;
|
|
9
|
+
connecting;
|
|
10
|
+
config;
|
|
11
|
+
constructor(config) {
|
|
12
|
+
this.config = {
|
|
13
|
+
...config,
|
|
14
|
+
exchange: config.exchange || "geekmidas.events",
|
|
15
|
+
exchangeType: config.exchangeType || "topic",
|
|
16
|
+
timeout: config.timeout ?? 5e3,
|
|
17
|
+
exchangeOptions: {
|
|
18
|
+
durable: true,
|
|
19
|
+
...config.exchangeOptions
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Create a RabbitMQConnection from a connection string
|
|
25
|
+
* Format: rabbitmq://user:pass@host:port/vhost?exchange=name&type=topic&timeout=5000
|
|
26
|
+
*/
|
|
27
|
+
static async fromConnectionString(connectionString) {
|
|
28
|
+
const url = new URL(connectionString);
|
|
29
|
+
const params = url.searchParams;
|
|
30
|
+
const baseUrl = `amqp://${url.username ? `${url.username}:${url.password}@` : ""}${url.host}${url.pathname}`;
|
|
31
|
+
const timeoutParam = params.get("timeout");
|
|
32
|
+
const config = {
|
|
33
|
+
url: baseUrl,
|
|
34
|
+
exchange: params.get("exchange") || "geekmidas.events",
|
|
35
|
+
exchangeType: params.get("type") || "topic",
|
|
36
|
+
timeout: timeoutParam ? Number.parseInt(timeoutParam, 10) : void 0
|
|
37
|
+
};
|
|
38
|
+
const connection = new RabbitMQConnection(config);
|
|
39
|
+
await connection.connect();
|
|
40
|
+
return connection;
|
|
41
|
+
}
|
|
42
|
+
async connect() {
|
|
43
|
+
if (this.channel) return;
|
|
44
|
+
if (this.connecting) {
|
|
45
|
+
await this.connecting;
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
this.connecting = (async () => {
|
|
49
|
+
try {
|
|
50
|
+
const connection = await amqplib.connect(this.config.url, { timeout: this.config.timeout });
|
|
51
|
+
const channel = await connection.createChannel();
|
|
52
|
+
await channel.assertExchange(this.config.exchange, this.config.exchangeType, this.config.exchangeOptions);
|
|
53
|
+
connection.on("error", (_err) => {
|
|
54
|
+
this.cleanup();
|
|
55
|
+
});
|
|
56
|
+
connection.on("close", () => {
|
|
57
|
+
this.cleanup();
|
|
58
|
+
});
|
|
59
|
+
this.connection = connection;
|
|
60
|
+
this.channel = channel;
|
|
61
|
+
} catch (error) {
|
|
62
|
+
this.cleanup();
|
|
63
|
+
throw error;
|
|
64
|
+
}
|
|
65
|
+
})();
|
|
66
|
+
await this.connecting;
|
|
67
|
+
this.connecting = void 0;
|
|
68
|
+
}
|
|
69
|
+
async close() {
|
|
70
|
+
try {
|
|
71
|
+
await this.channel?.close();
|
|
72
|
+
await this.connection?.close();
|
|
73
|
+
} catch (_error) {} finally {
|
|
74
|
+
this.cleanup();
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
isConnected() {
|
|
78
|
+
return !!this.channel;
|
|
79
|
+
}
|
|
80
|
+
cleanup() {
|
|
81
|
+
this.channel = void 0;
|
|
82
|
+
this.connection = void 0;
|
|
83
|
+
this.connecting = void 0;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Get the underlying channel for publishing/subscribing
|
|
87
|
+
*/
|
|
88
|
+
get amqpChannel() {
|
|
89
|
+
return this.channel;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Get the exchange name for this connection
|
|
93
|
+
*/
|
|
94
|
+
get exchangeName() {
|
|
95
|
+
return this.config.exchange;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Get the exchange type for this connection
|
|
99
|
+
*/
|
|
100
|
+
get exchangeType() {
|
|
101
|
+
return this.config.exchangeType;
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
//#endregion
|
|
106
|
+
export { RabbitMQConnection };
|
|
107
|
+
//# sourceMappingURL=RabbitMQConnection-BtKZjtZY.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RabbitMQConnection-BtKZjtZY.mjs","names":["config: RabbitMQConnectionConfig","connectionString: string","_err: Error"],"sources":["../src/rabbitmq/RabbitMQConnection.ts"],"sourcesContent":["import amqplib from 'amqplib';\nimport type { EventConnection } from '../types';\nimport { EventPublisherType } from '../types';\n\nexport interface RabbitMQConnectionConfig {\n\turl: string;\n\texchange?: string;\n\texchangeType?: 'topic' | 'direct' | 'fanout' | 'headers';\n\texchangeOptions?: amqplib.Options.AssertExchange;\n\ttimeout?: number; // Connection timeout in milliseconds (default: 5000)\n}\n\nexport class RabbitMQConnection implements EventConnection {\n\treadonly type = EventPublisherType.RabbitMQ;\n\tprivate connection?: amqplib.ChannelModel;\n\tprivate channel?: amqplib.Channel;\n\tprivate connecting?: Promise<void>;\n\tprivate config: Required<\n\t\tPick<RabbitMQConnectionConfig, 'exchange' | 'exchangeType' | 'timeout'>\n\t> &\n\t\tRabbitMQConnectionConfig;\n\n\tconstructor(config: RabbitMQConnectionConfig) {\n\t\tthis.config = {\n\t\t\t...config,\n\t\t\texchange: config.exchange || 'geekmidas.events',\n\t\t\texchangeType: config.exchangeType || 'topic',\n\t\t\ttimeout: config.timeout ?? 5000,\n\t\t\texchangeOptions: {\n\t\t\t\tdurable: true,\n\t\t\t\t...config.exchangeOptions,\n\t\t\t},\n\t\t};\n\t}\n\n\t/**\n\t * Create a RabbitMQConnection from a connection string\n\t * Format: rabbitmq://user:pass@host:port/vhost?exchange=name&type=topic&timeout=5000\n\t */\n\tstatic async fromConnectionString(\n\t\tconnectionString: string,\n\t): Promise<RabbitMQConnection> {\n\t\tconst url = new URL(connectionString);\n\t\tconst params = url.searchParams;\n\n\t\t// Extract connection URL without query params\n\t\tconst baseUrl = `amqp://${url.username ? `${url.username}:${url.password}@` : ''}${url.host}${url.pathname}`;\n\n\t\tconst timeoutParam = params.get('timeout');\n\t\tconst config: RabbitMQConnectionConfig = {\n\t\t\turl: baseUrl,\n\t\t\texchange: params.get('exchange') || 'geekmidas.events',\n\t\t\texchangeType: (params.get('type') as any) || 'topic',\n\t\t\ttimeout: timeoutParam ? Number.parseInt(timeoutParam, 10) : undefined,\n\t\t};\n\n\t\tconst connection = new RabbitMQConnection(config);\n\t\tawait connection.connect();\n\t\treturn connection;\n\t}\n\n\tasync connect(): Promise<void> {\n\t\tif (this.channel) return;\n\n\t\t// Prevent multiple simultaneous connection attempts\n\t\tif (this.connecting) {\n\t\t\tawait this.connecting;\n\t\t\treturn;\n\t\t}\n\n\t\tthis.connecting = (async () => {\n\t\t\ttry {\n\t\t\t\tconst connection = await amqplib.connect(this.config.url, {\n\t\t\t\t\ttimeout: this.config.timeout,\n\t\t\t\t});\n\t\t\t\tconst channel = await connection.createChannel();\n\n\t\t\t\t// Assert the exchange exists\n\t\t\t\tawait channel.assertExchange(\n\t\t\t\t\tthis.config.exchange!,\n\t\t\t\t\tthis.config.exchangeType!,\n\t\t\t\t\tthis.config.exchangeOptions,\n\t\t\t\t);\n\n\t\t\t\t// Handle connection errors\n\t\t\t\tconnection.on('error', (_err: Error) => {\n\t\t\t\t\tthis.cleanup();\n\t\t\t\t});\n\n\t\t\t\tconnection.on('close', () => {\n\t\t\t\t\tthis.cleanup();\n\t\t\t\t});\n\n\t\t\t\t// Only set after successful setup\n\t\t\t\tthis.connection = connection;\n\t\t\t\tthis.channel = channel;\n\t\t\t} catch (error) {\n\t\t\t\tthis.cleanup();\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t})();\n\n\t\tawait this.connecting;\n\t\tthis.connecting = undefined;\n\t}\n\n\tasync close(): Promise<void> {\n\t\ttry {\n\t\t\tawait this.channel?.close();\n\t\t\tawait this.connection?.close();\n\t\t} catch (_error) {\n\t\t\t// Ignore errors during close\n\t\t} finally {\n\t\t\tthis.cleanup();\n\t\t}\n\t}\n\n\tisConnected(): boolean {\n\t\treturn !!this.channel;\n\t}\n\n\tprivate cleanup(): void {\n\t\tthis.channel = undefined;\n\t\tthis.connection = undefined;\n\t\tthis.connecting = undefined;\n\t}\n\n\t/**\n\t * Get the underlying channel for publishing/subscribing\n\t */\n\tget amqpChannel(): amqplib.Channel | undefined {\n\t\treturn this.channel;\n\t}\n\n\t/**\n\t * Get the exchange name for this connection\n\t */\n\tget exchangeName(): string {\n\t\treturn this.config.exchange;\n\t}\n\n\t/**\n\t * Get the exchange type for this connection\n\t */\n\tget exchangeType(): string {\n\t\treturn this.config.exchangeType;\n\t}\n}\n"],"mappings":";;;;AAYA,IAAa,qBAAb,MAAa,mBAA8C;CAC1D,AAAS,OAAO,mBAAmB;CACnC,AAAQ;CACR,AAAQ;CACR,AAAQ;CACR,AAAQ;CAKR,YAAYA,QAAkC;AAC7C,OAAK,SAAS;GACb,GAAG;GACH,UAAU,OAAO,YAAY;GAC7B,cAAc,OAAO,gBAAgB;GACrC,SAAS,OAAO,WAAW;GAC3B,iBAAiB;IAChB,SAAS;IACT,GAAG,OAAO;GACV;EACD;CACD;;;;;CAMD,aAAa,qBACZC,kBAC8B;EAC9B,MAAM,MAAM,IAAI,IAAI;EACpB,MAAM,SAAS,IAAI;EAGnB,MAAM,WAAW,SAAS,IAAI,YAAY,EAAE,IAAI,SAAS,GAAG,IAAI,SAAS,KAAK,GAAG,EAAE,IAAI,KAAK,EAAE,IAAI,SAAS;EAE3G,MAAM,eAAe,OAAO,IAAI,UAAU;EAC1C,MAAMD,SAAmC;GACxC,KAAK;GACL,UAAU,OAAO,IAAI,WAAW,IAAI;GACpC,cAAe,OAAO,IAAI,OAAO,IAAY;GAC7C,SAAS,eAAe,OAAO,SAAS,cAAc,GAAG;EACzD;EAED,MAAM,aAAa,IAAI,mBAAmB;AAC1C,QAAM,WAAW,SAAS;AAC1B,SAAO;CACP;CAED,MAAM,UAAyB;AAC9B,MAAI,KAAK,QAAS;AAGlB,MAAI,KAAK,YAAY;AACpB,SAAM,KAAK;AACX;EACA;AAED,OAAK,aAAa,CAAC,YAAY;AAC9B,OAAI;IACH,MAAM,aAAa,MAAM,QAAQ,QAAQ,KAAK,OAAO,KAAK,EACzD,SAAS,KAAK,OAAO,QACrB,EAAC;IACF,MAAM,UAAU,MAAM,WAAW,eAAe;AAGhD,UAAM,QAAQ,eACb,KAAK,OAAO,UACZ,KAAK,OAAO,cACZ,KAAK,OAAO,gBACZ;AAGD,eAAW,GAAG,SAAS,CAACE,SAAgB;AACvC,UAAK,SAAS;IACd,EAAC;AAEF,eAAW,GAAG,SAAS,MAAM;AAC5B,UAAK,SAAS;IACd,EAAC;AAGF,SAAK,aAAa;AAClB,SAAK,UAAU;GACf,SAAQ,OAAO;AACf,SAAK,SAAS;AACd,UAAM;GACN;EACD,IAAG;AAEJ,QAAM,KAAK;AACX,OAAK;CACL;CAED,MAAM,QAAuB;AAC5B,MAAI;AACH,SAAM,KAAK,SAAS,OAAO;AAC3B,SAAM,KAAK,YAAY,OAAO;EAC9B,SAAQ,QAAQ,CAEhB,UAAS;AACT,QAAK,SAAS;EACd;CACD;CAED,cAAuB;AACtB,WAAS,KAAK;CACd;CAED,AAAQ,UAAgB;AACvB,OAAK;AACL,OAAK;AACL,OAAK;CACL;;;;CAKD,IAAI,cAA2C;AAC9C,SAAO,KAAK;CACZ;;;;CAKD,IAAI,eAAuB;AAC1B,SAAO,KAAK,OAAO;CACnB;;;;CAKD,IAAI,eAAuB;AAC1B,SAAO,KAAK,OAAO;CACnB;AACD"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { EventConnection, EventPublisherType } from "./types-Dh9Jyinx.mjs";
|
|
2
|
+
import amqplib from "amqplib";
|
|
3
|
+
|
|
4
|
+
//#region src/rabbitmq/RabbitMQConnection.d.ts
|
|
5
|
+
interface RabbitMQConnectionConfig {
|
|
6
|
+
url: string;
|
|
7
|
+
exchange?: string;
|
|
8
|
+
exchangeType?: 'topic' | 'direct' | 'fanout' | 'headers';
|
|
9
|
+
exchangeOptions?: amqplib.Options.AssertExchange;
|
|
10
|
+
timeout?: number;
|
|
11
|
+
}
|
|
12
|
+
declare class RabbitMQConnection implements EventConnection {
|
|
13
|
+
readonly type = EventPublisherType.RabbitMQ;
|
|
14
|
+
private connection?;
|
|
15
|
+
private channel?;
|
|
16
|
+
private connecting?;
|
|
17
|
+
private config;
|
|
18
|
+
constructor(config: RabbitMQConnectionConfig);
|
|
19
|
+
/**
|
|
20
|
+
* Create a RabbitMQConnection from a connection string
|
|
21
|
+
* Format: rabbitmq://user:pass@host:port/vhost?exchange=name&type=topic&timeout=5000
|
|
22
|
+
*/
|
|
23
|
+
static fromConnectionString(connectionString: string): Promise<RabbitMQConnection>;
|
|
24
|
+
connect(): Promise<void>;
|
|
25
|
+
close(): Promise<void>;
|
|
26
|
+
isConnected(): boolean;
|
|
27
|
+
private cleanup;
|
|
28
|
+
/**
|
|
29
|
+
* Get the underlying channel for publishing/subscribing
|
|
30
|
+
*/
|
|
31
|
+
get amqpChannel(): amqplib.Channel | undefined;
|
|
32
|
+
/**
|
|
33
|
+
* Get the exchange name for this connection
|
|
34
|
+
*/
|
|
35
|
+
get exchangeName(): string;
|
|
36
|
+
/**
|
|
37
|
+
* Get the exchange type for this connection
|
|
38
|
+
*/
|
|
39
|
+
get exchangeType(): string;
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=RabbitMQConnection.d.ts.map
|
|
42
|
+
//#endregion
|
|
43
|
+
export { RabbitMQConnection, RabbitMQConnectionConfig };
|
|
44
|
+
//# sourceMappingURL=RabbitMQConnection-DV9t3VYp.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RabbitMQConnection-DV9t3VYp.d.mts","names":[],"sources":["../src/rabbitmq/RabbitMQConnection.ts"],"sourcesContent":[],"mappings":";;;;UAIiB,wBAAA;EAAA,GAAA,EAAA,MAAA;EAQJ,QAAA,CAAA,EAAA,MAAA;EAAmB,YAAA,CAAA,EAAA,OAAA,GAAA,QAAA,GAAA,QAAA,GAAA,SAAA;EAAA,eAClB,CAAA,EALK,OAAA,CAAQ,OAAA,CAAQ,cAKrB;EAAA,OASO,CAAA,EAAA,MAAA;;AAmBjB,cA7BS,kBAAA,YAA8B,eA6BvC,CAAA;EAAO,SAoBO,IAAA,GAhDJ,kBAAA,CAAA,QAAA;EAgDW,QA6CT,UAAA;EAAO,QAwBH,OAAQ;EAAO,QAtHQ,UAAA;EAAe,QAAA,MAAA;sBAUrC;;;;;yDAmBjB,QAAQ;aAoBM;WA6CF;;;;;;qBAwBI,OAAA,CAAQ"}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
const require_chunk = require('./chunk-CUT6urMc.cjs');
|
|
2
|
+
const require_types = require('./types-Byv8N9ma.cjs');
|
|
3
|
+
const amqplib = require_chunk.__toESM(require("amqplib"));
|
|
4
|
+
|
|
5
|
+
//#region src/rabbitmq/RabbitMQConnection.ts
|
|
6
|
+
var RabbitMQConnection = class RabbitMQConnection {
|
|
7
|
+
type = require_types.EventPublisherType.RabbitMQ;
|
|
8
|
+
connection;
|
|
9
|
+
channel;
|
|
10
|
+
connecting;
|
|
11
|
+
config;
|
|
12
|
+
constructor(config) {
|
|
13
|
+
this.config = {
|
|
14
|
+
...config,
|
|
15
|
+
exchange: config.exchange || "geekmidas.events",
|
|
16
|
+
exchangeType: config.exchangeType || "topic",
|
|
17
|
+
timeout: config.timeout ?? 5e3,
|
|
18
|
+
exchangeOptions: {
|
|
19
|
+
durable: true,
|
|
20
|
+
...config.exchangeOptions
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Create a RabbitMQConnection from a connection string
|
|
26
|
+
* Format: rabbitmq://user:pass@host:port/vhost?exchange=name&type=topic&timeout=5000
|
|
27
|
+
*/
|
|
28
|
+
static async fromConnectionString(connectionString) {
|
|
29
|
+
const url = new URL(connectionString);
|
|
30
|
+
const params = url.searchParams;
|
|
31
|
+
const baseUrl = `amqp://${url.username ? `${url.username}:${url.password}@` : ""}${url.host}${url.pathname}`;
|
|
32
|
+
const timeoutParam = params.get("timeout");
|
|
33
|
+
const config = {
|
|
34
|
+
url: baseUrl,
|
|
35
|
+
exchange: params.get("exchange") || "geekmidas.events",
|
|
36
|
+
exchangeType: params.get("type") || "topic",
|
|
37
|
+
timeout: timeoutParam ? Number.parseInt(timeoutParam, 10) : void 0
|
|
38
|
+
};
|
|
39
|
+
const connection = new RabbitMQConnection(config);
|
|
40
|
+
await connection.connect();
|
|
41
|
+
return connection;
|
|
42
|
+
}
|
|
43
|
+
async connect() {
|
|
44
|
+
if (this.channel) return;
|
|
45
|
+
if (this.connecting) {
|
|
46
|
+
await this.connecting;
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
this.connecting = (async () => {
|
|
50
|
+
try {
|
|
51
|
+
const connection = await amqplib.default.connect(this.config.url, { timeout: this.config.timeout });
|
|
52
|
+
const channel = await connection.createChannel();
|
|
53
|
+
await channel.assertExchange(this.config.exchange, this.config.exchangeType, this.config.exchangeOptions);
|
|
54
|
+
connection.on("error", (_err) => {
|
|
55
|
+
this.cleanup();
|
|
56
|
+
});
|
|
57
|
+
connection.on("close", () => {
|
|
58
|
+
this.cleanup();
|
|
59
|
+
});
|
|
60
|
+
this.connection = connection;
|
|
61
|
+
this.channel = channel;
|
|
62
|
+
} catch (error) {
|
|
63
|
+
this.cleanup();
|
|
64
|
+
throw error;
|
|
65
|
+
}
|
|
66
|
+
})();
|
|
67
|
+
await this.connecting;
|
|
68
|
+
this.connecting = void 0;
|
|
69
|
+
}
|
|
70
|
+
async close() {
|
|
71
|
+
try {
|
|
72
|
+
await this.channel?.close();
|
|
73
|
+
await this.connection?.close();
|
|
74
|
+
} catch (_error) {} finally {
|
|
75
|
+
this.cleanup();
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
isConnected() {
|
|
79
|
+
return !!this.channel;
|
|
80
|
+
}
|
|
81
|
+
cleanup() {
|
|
82
|
+
this.channel = void 0;
|
|
83
|
+
this.connection = void 0;
|
|
84
|
+
this.connecting = void 0;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Get the underlying channel for publishing/subscribing
|
|
88
|
+
*/
|
|
89
|
+
get amqpChannel() {
|
|
90
|
+
return this.channel;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Get the exchange name for this connection
|
|
94
|
+
*/
|
|
95
|
+
get exchangeName() {
|
|
96
|
+
return this.config.exchange;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Get the exchange type for this connection
|
|
100
|
+
*/
|
|
101
|
+
get exchangeType() {
|
|
102
|
+
return this.config.exchangeType;
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
//#endregion
|
|
107
|
+
Object.defineProperty(exports, 'RabbitMQConnection', {
|
|
108
|
+
enumerable: true,
|
|
109
|
+
get: function () {
|
|
110
|
+
return RabbitMQConnection;
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
//# sourceMappingURL=RabbitMQConnection-DmMMosT4.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RabbitMQConnection-DmMMosT4.cjs","names":["EventPublisherType","config: RabbitMQConnectionConfig","connectionString: string","_err: Error"],"sources":["../src/rabbitmq/RabbitMQConnection.ts"],"sourcesContent":["import amqplib from 'amqplib';\nimport type { EventConnection } from '../types';\nimport { EventPublisherType } from '../types';\n\nexport interface RabbitMQConnectionConfig {\n\turl: string;\n\texchange?: string;\n\texchangeType?: 'topic' | 'direct' | 'fanout' | 'headers';\n\texchangeOptions?: amqplib.Options.AssertExchange;\n\ttimeout?: number; // Connection timeout in milliseconds (default: 5000)\n}\n\nexport class RabbitMQConnection implements EventConnection {\n\treadonly type = EventPublisherType.RabbitMQ;\n\tprivate connection?: amqplib.ChannelModel;\n\tprivate channel?: amqplib.Channel;\n\tprivate connecting?: Promise<void>;\n\tprivate config: Required<\n\t\tPick<RabbitMQConnectionConfig, 'exchange' | 'exchangeType' | 'timeout'>\n\t> &\n\t\tRabbitMQConnectionConfig;\n\n\tconstructor(config: RabbitMQConnectionConfig) {\n\t\tthis.config = {\n\t\t\t...config,\n\t\t\texchange: config.exchange || 'geekmidas.events',\n\t\t\texchangeType: config.exchangeType || 'topic',\n\t\t\ttimeout: config.timeout ?? 5000,\n\t\t\texchangeOptions: {\n\t\t\t\tdurable: true,\n\t\t\t\t...config.exchangeOptions,\n\t\t\t},\n\t\t};\n\t}\n\n\t/**\n\t * Create a RabbitMQConnection from a connection string\n\t * Format: rabbitmq://user:pass@host:port/vhost?exchange=name&type=topic&timeout=5000\n\t */\n\tstatic async fromConnectionString(\n\t\tconnectionString: string,\n\t): Promise<RabbitMQConnection> {\n\t\tconst url = new URL(connectionString);\n\t\tconst params = url.searchParams;\n\n\t\t// Extract connection URL without query params\n\t\tconst baseUrl = `amqp://${url.username ? `${url.username}:${url.password}@` : ''}${url.host}${url.pathname}`;\n\n\t\tconst timeoutParam = params.get('timeout');\n\t\tconst config: RabbitMQConnectionConfig = {\n\t\t\turl: baseUrl,\n\t\t\texchange: params.get('exchange') || 'geekmidas.events',\n\t\t\texchangeType: (params.get('type') as any) || 'topic',\n\t\t\ttimeout: timeoutParam ? Number.parseInt(timeoutParam, 10) : undefined,\n\t\t};\n\n\t\tconst connection = new RabbitMQConnection(config);\n\t\tawait connection.connect();\n\t\treturn connection;\n\t}\n\n\tasync connect(): Promise<void> {\n\t\tif (this.channel) return;\n\n\t\t// Prevent multiple simultaneous connection attempts\n\t\tif (this.connecting) {\n\t\t\tawait this.connecting;\n\t\t\treturn;\n\t\t}\n\n\t\tthis.connecting = (async () => {\n\t\t\ttry {\n\t\t\t\tconst connection = await amqplib.connect(this.config.url, {\n\t\t\t\t\ttimeout: this.config.timeout,\n\t\t\t\t});\n\t\t\t\tconst channel = await connection.createChannel();\n\n\t\t\t\t// Assert the exchange exists\n\t\t\t\tawait channel.assertExchange(\n\t\t\t\t\tthis.config.exchange!,\n\t\t\t\t\tthis.config.exchangeType!,\n\t\t\t\t\tthis.config.exchangeOptions,\n\t\t\t\t);\n\n\t\t\t\t// Handle connection errors\n\t\t\t\tconnection.on('error', (_err: Error) => {\n\t\t\t\t\tthis.cleanup();\n\t\t\t\t});\n\n\t\t\t\tconnection.on('close', () => {\n\t\t\t\t\tthis.cleanup();\n\t\t\t\t});\n\n\t\t\t\t// Only set after successful setup\n\t\t\t\tthis.connection = connection;\n\t\t\t\tthis.channel = channel;\n\t\t\t} catch (error) {\n\t\t\t\tthis.cleanup();\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t})();\n\n\t\tawait this.connecting;\n\t\tthis.connecting = undefined;\n\t}\n\n\tasync close(): Promise<void> {\n\t\ttry {\n\t\t\tawait this.channel?.close();\n\t\t\tawait this.connection?.close();\n\t\t} catch (_error) {\n\t\t\t// Ignore errors during close\n\t\t} finally {\n\t\t\tthis.cleanup();\n\t\t}\n\t}\n\n\tisConnected(): boolean {\n\t\treturn !!this.channel;\n\t}\n\n\tprivate cleanup(): void {\n\t\tthis.channel = undefined;\n\t\tthis.connection = undefined;\n\t\tthis.connecting = undefined;\n\t}\n\n\t/**\n\t * Get the underlying channel for publishing/subscribing\n\t */\n\tget amqpChannel(): amqplib.Channel | undefined {\n\t\treturn this.channel;\n\t}\n\n\t/**\n\t * Get the exchange name for this connection\n\t */\n\tget exchangeName(): string {\n\t\treturn this.config.exchange;\n\t}\n\n\t/**\n\t * Get the exchange type for this connection\n\t */\n\tget exchangeType(): string {\n\t\treturn this.config.exchangeType;\n\t}\n}\n"],"mappings":";;;;;AAYA,IAAa,qBAAb,MAAa,mBAA8C;CAC1D,AAAS,OAAOA,iCAAmB;CACnC,AAAQ;CACR,AAAQ;CACR,AAAQ;CACR,AAAQ;CAKR,YAAYC,QAAkC;AAC7C,OAAK,SAAS;GACb,GAAG;GACH,UAAU,OAAO,YAAY;GAC7B,cAAc,OAAO,gBAAgB;GACrC,SAAS,OAAO,WAAW;GAC3B,iBAAiB;IAChB,SAAS;IACT,GAAG,OAAO;GACV;EACD;CACD;;;;;CAMD,aAAa,qBACZC,kBAC8B;EAC9B,MAAM,MAAM,IAAI,IAAI;EACpB,MAAM,SAAS,IAAI;EAGnB,MAAM,WAAW,SAAS,IAAI,YAAY,EAAE,IAAI,SAAS,GAAG,IAAI,SAAS,KAAK,GAAG,EAAE,IAAI,KAAK,EAAE,IAAI,SAAS;EAE3G,MAAM,eAAe,OAAO,IAAI,UAAU;EAC1C,MAAMD,SAAmC;GACxC,KAAK;GACL,UAAU,OAAO,IAAI,WAAW,IAAI;GACpC,cAAe,OAAO,IAAI,OAAO,IAAY;GAC7C,SAAS,eAAe,OAAO,SAAS,cAAc,GAAG;EACzD;EAED,MAAM,aAAa,IAAI,mBAAmB;AAC1C,QAAM,WAAW,SAAS;AAC1B,SAAO;CACP;CAED,MAAM,UAAyB;AAC9B,MAAI,KAAK,QAAS;AAGlB,MAAI,KAAK,YAAY;AACpB,SAAM,KAAK;AACX;EACA;AAED,OAAK,aAAa,CAAC,YAAY;AAC9B,OAAI;IACH,MAAM,aAAa,MAAM,gBAAQ,QAAQ,KAAK,OAAO,KAAK,EACzD,SAAS,KAAK,OAAO,QACrB,EAAC;IACF,MAAM,UAAU,MAAM,WAAW,eAAe;AAGhD,UAAM,QAAQ,eACb,KAAK,OAAO,UACZ,KAAK,OAAO,cACZ,KAAK,OAAO,gBACZ;AAGD,eAAW,GAAG,SAAS,CAACE,SAAgB;AACvC,UAAK,SAAS;IACd,EAAC;AAEF,eAAW,GAAG,SAAS,MAAM;AAC5B,UAAK,SAAS;IACd,EAAC;AAGF,SAAK,aAAa;AAClB,SAAK,UAAU;GACf,SAAQ,OAAO;AACf,SAAK,SAAS;AACd,UAAM;GACN;EACD,IAAG;AAEJ,QAAM,KAAK;AACX,OAAK;CACL;CAED,MAAM,QAAuB;AAC5B,MAAI;AACH,SAAM,KAAK,SAAS,OAAO;AAC3B,SAAM,KAAK,YAAY,OAAO;EAC9B,SAAQ,QAAQ,CAEhB,UAAS;AACT,QAAK,SAAS;EACd;CACD;CAED,cAAuB;AACtB,WAAS,KAAK;CACd;CAED,AAAQ,UAAgB;AACvB,OAAK;AACL,OAAK;AACL,OAAK;CACL;;;;CAKD,IAAI,cAA2C;AAC9C,SAAO,KAAK;CACZ;;;;CAKD,IAAI,eAAuB;AAC1B,SAAO,KAAK,OAAO;CACnB;;;;CAKD,IAAI,eAAuB;AAC1B,SAAO,KAAK,OAAO;CACnB;AACD"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { EventConnection, EventPublisherType } from "./types-Dj23od3e.cjs";
|
|
2
|
+
import amqplib from "amqplib";
|
|
3
|
+
|
|
4
|
+
//#region src/rabbitmq/RabbitMQConnection.d.ts
|
|
5
|
+
interface RabbitMQConnectionConfig {
|
|
6
|
+
url: string;
|
|
7
|
+
exchange?: string;
|
|
8
|
+
exchangeType?: 'topic' | 'direct' | 'fanout' | 'headers';
|
|
9
|
+
exchangeOptions?: amqplib.Options.AssertExchange;
|
|
10
|
+
timeout?: number;
|
|
11
|
+
}
|
|
12
|
+
declare class RabbitMQConnection implements EventConnection {
|
|
13
|
+
readonly type = EventPublisherType.RabbitMQ;
|
|
14
|
+
private connection?;
|
|
15
|
+
private channel?;
|
|
16
|
+
private connecting?;
|
|
17
|
+
private config;
|
|
18
|
+
constructor(config: RabbitMQConnectionConfig);
|
|
19
|
+
/**
|
|
20
|
+
* Create a RabbitMQConnection from a connection string
|
|
21
|
+
* Format: rabbitmq://user:pass@host:port/vhost?exchange=name&type=topic&timeout=5000
|
|
22
|
+
*/
|
|
23
|
+
static fromConnectionString(connectionString: string): Promise<RabbitMQConnection>;
|
|
24
|
+
connect(): Promise<void>;
|
|
25
|
+
close(): Promise<void>;
|
|
26
|
+
isConnected(): boolean;
|
|
27
|
+
private cleanup;
|
|
28
|
+
/**
|
|
29
|
+
* Get the underlying channel for publishing/subscribing
|
|
30
|
+
*/
|
|
31
|
+
get amqpChannel(): amqplib.Channel | undefined;
|
|
32
|
+
/**
|
|
33
|
+
* Get the exchange name for this connection
|
|
34
|
+
*/
|
|
35
|
+
get exchangeName(): string;
|
|
36
|
+
/**
|
|
37
|
+
* Get the exchange type for this connection
|
|
38
|
+
*/
|
|
39
|
+
get exchangeType(): string;
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=RabbitMQConnection.d.ts.map
|
|
42
|
+
//#endregion
|
|
43
|
+
export { RabbitMQConnection, RabbitMQConnectionConfig };
|
|
44
|
+
//# sourceMappingURL=RabbitMQConnection-jNME_eR7.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RabbitMQConnection-jNME_eR7.d.cts","names":[],"sources":["../src/rabbitmq/RabbitMQConnection.ts"],"sourcesContent":[],"mappings":";;;;UAIiB,wBAAA;EAAA,GAAA,EAAA,MAAA;EAQJ,QAAA,CAAA,EAAA,MAAA;EAAmB,YAAA,CAAA,EAAA,OAAA,GAAA,QAAA,GAAA,QAAA,GAAA,SAAA;EAAA,eAClB,CAAA,EALK,OAAA,CAAQ,OAAA,CAAQ,cAKrB;EAAA,OASO,CAAA,EAAA,MAAA;;AAmBjB,cA7BS,kBAAA,YAA8B,eA6BvC,CAAA;EAAO,SAoBO,IAAA,GAhDJ,kBAAA,CAAA,QAAA;EAgDW,QA6CT,UAAA;EAAO,QAwBH,OAAQ;EAAO,QAtHQ,UAAA;EAAe,QAAA,MAAA;sBAUrC;;;;;yDAmBjB,QAAQ;aAoBM;WA6CF;;;;;;qBAwBI,OAAA,CAAQ"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
|
|
2
|
+
//#region src/rabbitmq/RabbitMQPublisher.ts
|
|
3
|
+
var RabbitMQPublisher = class RabbitMQPublisher {
|
|
4
|
+
constructor(connection, options = {}) {
|
|
5
|
+
this.connection = connection;
|
|
6
|
+
this.options = options;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Create a RabbitMQPublisher from a connection string
|
|
10
|
+
* Format: rabbitmq://user:pass@host:port/vhost?exchange=name&type=topic&timeout=5000
|
|
11
|
+
*/
|
|
12
|
+
static async fromConnectionString(connectionString) {
|
|
13
|
+
const { RabbitMQConnection } = await Promise.resolve().then(() => require("./rabbitmq/RabbitMQConnection.cjs"));
|
|
14
|
+
const connection = await RabbitMQConnection.fromConnectionString(connectionString);
|
|
15
|
+
return new RabbitMQPublisher(connection);
|
|
16
|
+
}
|
|
17
|
+
async publish(messages) {
|
|
18
|
+
if (!this.connection.isConnected()) await this.connection.connect();
|
|
19
|
+
const channel = this.connection.amqpChannel;
|
|
20
|
+
if (!channel) throw new Error("Channel not initialized");
|
|
21
|
+
const exchange = this.connection.exchangeName;
|
|
22
|
+
for (const message of messages) {
|
|
23
|
+
const content = Buffer.from(JSON.stringify(message.payload));
|
|
24
|
+
const routingKey = message.type;
|
|
25
|
+
const published = channel.publish(exchange, routingKey, content, {
|
|
26
|
+
contentType: "application/json",
|
|
27
|
+
timestamp: Date.now(),
|
|
28
|
+
type: message.type,
|
|
29
|
+
persistent: true,
|
|
30
|
+
...this.options.publishOptions
|
|
31
|
+
});
|
|
32
|
+
if (!published) await new Promise((resolve) => channel.once("drain", resolve));
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
async close() {}
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
//#endregion
|
|
39
|
+
Object.defineProperty(exports, 'RabbitMQPublisher', {
|
|
40
|
+
enumerable: true,
|
|
41
|
+
get: function () {
|
|
42
|
+
return RabbitMQPublisher;
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
//# sourceMappingURL=RabbitMQPublisher-C94q6g8q.cjs.map
|