@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.
- 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
package/dist/pgboss/index.mjs
CHANGED
|
@@ -1,241 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
var PgBossConnection_exports = /* @__PURE__ */ __exportAll({ PgBossConnection: () => PgBossConnection });
|
|
6
|
-
var PgBossConnection = class PgBossConnection {
|
|
7
|
-
config;
|
|
8
|
-
type = "pgboss";
|
|
9
|
-
boss;
|
|
10
|
-
connecting;
|
|
11
|
-
constructor(config) {
|
|
12
|
-
this.config = config;
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* Create a PgBossConnection from a connection string.
|
|
16
|
-
* Format: pgboss://user:pass@host:5432/database?schema=pgboss
|
|
17
|
-
*/
|
|
18
|
-
static async fromConnectionString(connectionString) {
|
|
19
|
-
const url = new URL(connectionString);
|
|
20
|
-
const params = url.searchParams;
|
|
21
|
-
const config = {
|
|
22
|
-
connectionString: `postgres://${url.username ? `${url.username}:${url.password}@` : ""}${url.host}${url.pathname}`,
|
|
23
|
-
schema: params.get("schema") || void 0
|
|
24
|
-
};
|
|
25
|
-
const connection = new PgBossConnection(config);
|
|
26
|
-
await connection.connect();
|
|
27
|
-
return connection;
|
|
28
|
-
}
|
|
29
|
-
async connect() {
|
|
30
|
-
if (this.boss) return;
|
|
31
|
-
if (this.connecting) {
|
|
32
|
-
await this.connecting;
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
this.connecting = (async () => {
|
|
36
|
-
try {
|
|
37
|
-
const applicationName = this.config.applicationName ?? process.env.GKM_APP_NAME;
|
|
38
|
-
const boss = new PgBoss({
|
|
39
|
-
connectionString: this.config.connectionString,
|
|
40
|
-
...this.config.schema && { schema: this.config.schema },
|
|
41
|
-
...applicationName && { application_name: applicationName }
|
|
42
|
-
});
|
|
43
|
-
await boss.start();
|
|
44
|
-
this.boss = boss;
|
|
45
|
-
} catch (error) {
|
|
46
|
-
this.cleanup();
|
|
47
|
-
throw error;
|
|
48
|
-
}
|
|
49
|
-
})();
|
|
50
|
-
await this.connecting;
|
|
51
|
-
this.connecting = void 0;
|
|
52
|
-
}
|
|
53
|
-
async close() {
|
|
54
|
-
try {
|
|
55
|
-
await this.boss?.stop({ graceful: true });
|
|
56
|
-
} catch {} finally {
|
|
57
|
-
this.cleanup();
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
isConnected() {
|
|
61
|
-
return !!this.boss;
|
|
62
|
-
}
|
|
63
|
-
cleanup() {
|
|
64
|
-
this.boss = void 0;
|
|
65
|
-
this.connecting = void 0;
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* Get the underlying pg-boss instance for publishing/subscribing
|
|
69
|
-
*/
|
|
70
|
-
get instance() {
|
|
71
|
-
return this.boss;
|
|
72
|
-
}
|
|
73
|
-
};
|
|
74
|
-
//#endregion
|
|
75
|
-
//#region src/pgboss/errors.ts
|
|
76
|
-
/** pg-boss connected but its instance never started. */
|
|
77
|
-
var PgBossNotStarted = class extends Error {
|
|
78
|
-
constructor() {
|
|
79
|
-
super("pg-boss did not start. Check the database in the connection string is reachable and the role may create the pg-boss schema.");
|
|
80
|
-
this.name = "PgBossNotStarted";
|
|
81
|
-
}
|
|
82
|
-
};
|
|
83
|
-
/** A topic subscription with no name to give the subscriber's own queue. */
|
|
84
|
-
var PgBossSubscriptionNeedsName = class extends Error {
|
|
85
|
-
topic;
|
|
86
|
-
constructor(topic) {
|
|
87
|
-
super(`Subscribing to topic '${topic}' on pg-boss needs a subscription name: each subscriber drains a queue of its own, and that queue is named for it. Pass \`subscription\`.`);
|
|
88
|
-
this.topic = topic;
|
|
89
|
-
this.name = "PgBossSubscriptionNeedsName";
|
|
90
|
-
}
|
|
91
|
-
};
|
|
92
|
-
//#endregion
|
|
93
|
-
//#region src/pgboss/PgBossPublisher.ts
|
|
94
|
-
/** The pg-boss event a topic's message type is published as. */
|
|
95
|
-
function topicEvent(topic, type) {
|
|
96
|
-
return `${topic}/${type}`;
|
|
97
|
-
}
|
|
98
|
-
var PgBossPublisher = class PgBossPublisher {
|
|
99
|
-
connection;
|
|
100
|
-
options;
|
|
101
|
-
constructor(connection, options = {}) {
|
|
102
|
-
this.connection = connection;
|
|
103
|
-
this.options = options;
|
|
104
|
-
}
|
|
105
|
-
/**
|
|
106
|
-
* Create a PgBossPublisher from a connection string.
|
|
107
|
-
* Format: pgboss://user:pass@host:5432/database?schema=pgboss
|
|
108
|
-
*/
|
|
109
|
-
static async fromConnectionString(connectionString, options = {}) {
|
|
110
|
-
const { PgBossConnection } = await Promise.resolve().then(() => PgBossConnection_exports);
|
|
111
|
-
const connection = await PgBossConnection.fromConnectionString(connectionString);
|
|
112
|
-
return new PgBossPublisher(connection, options);
|
|
113
|
-
}
|
|
114
|
-
async publish(messages) {
|
|
115
|
-
if (!this.connection.isConnected()) await this.connection.connect();
|
|
116
|
-
const boss = this.connection.instance;
|
|
117
|
-
if (!boss) throw new PgBossNotStarted();
|
|
118
|
-
const { topic } = this.options;
|
|
119
|
-
if (topic) {
|
|
120
|
-
await publishTraced(messages, (m) => ({
|
|
121
|
-
system: "pgboss",
|
|
122
|
-
destination: topic,
|
|
123
|
-
type: m.type
|
|
124
|
-
}), async (carriers) => {
|
|
125
|
-
for (const [i, m] of messages.entries()) await boss.publish(topicEvent(topic, m.type), withTraceKey({
|
|
126
|
-
type: m.type,
|
|
127
|
-
payload: m.payload
|
|
128
|
-
}, carriers[i]));
|
|
129
|
-
});
|
|
130
|
-
return;
|
|
131
|
-
}
|
|
132
|
-
await publishTraced(messages, (m) => ({
|
|
133
|
-
system: "pgboss",
|
|
134
|
-
destination: m.type,
|
|
135
|
-
type: m.type
|
|
136
|
-
}), async (carriers) => {
|
|
137
|
-
const groups = /* @__PURE__ */ new Map();
|
|
138
|
-
for (const [i, m] of messages.entries()) {
|
|
139
|
-
const list = groups.get(m.type) ?? [];
|
|
140
|
-
list.push({ data: withTraceKey(m.payload, carriers[i]) });
|
|
141
|
-
groups.set(m.type, list);
|
|
142
|
-
}
|
|
143
|
-
for (const [name, jobs] of groups) {
|
|
144
|
-
await boss.createQueue(name);
|
|
145
|
-
await boss.insert(name, jobs);
|
|
146
|
-
}
|
|
147
|
-
});
|
|
148
|
-
}
|
|
149
|
-
async close() {}
|
|
150
|
-
};
|
|
151
|
-
//#endregion
|
|
152
|
-
//#region src/pgboss/PgBossSubscriber.ts
|
|
153
|
-
var PgBossSubscriber = class PgBossSubscriber {
|
|
154
|
-
connection;
|
|
155
|
-
options;
|
|
156
|
-
constructor(connection, options = {}) {
|
|
157
|
-
this.connection = connection;
|
|
158
|
-
this.options = options;
|
|
159
|
-
}
|
|
160
|
-
/**
|
|
161
|
-
* Create a PgBossSubscriber from a connection string.
|
|
162
|
-
* Format: pgboss://user:pass@host:5432/database?schema=pgboss&batchSize=5
|
|
163
|
-
*/
|
|
164
|
-
static async fromConnectionString(connectionString) {
|
|
165
|
-
const params = new URL(connectionString).searchParams;
|
|
166
|
-
const { PgBossConnection } = await Promise.resolve().then(() => PgBossConnection_exports);
|
|
167
|
-
const connection = await PgBossConnection.fromConnectionString(connectionString);
|
|
168
|
-
const options = {
|
|
169
|
-
batchSize: params.get("batchSize") ? Number.parseInt(params.get("batchSize"), 10) : void 0,
|
|
170
|
-
pollingIntervalSeconds: params.get("pollingIntervalSeconds") ? Number.parseInt(params.get("pollingIntervalSeconds"), 10) : void 0
|
|
171
|
-
};
|
|
172
|
-
return new PgBossSubscriber(connection, options);
|
|
173
|
-
}
|
|
174
|
-
async subscribe(messages, listener) {
|
|
175
|
-
if (!this.connection.isConnected()) await this.connection.connect();
|
|
176
|
-
const boss = this.connection.instance;
|
|
177
|
-
if (!boss) throw new PgBossNotStarted();
|
|
178
|
-
const work = {
|
|
179
|
-
...this.options.batchSize && { batchSize: this.options.batchSize },
|
|
180
|
-
...this.options.pollingIntervalSeconds && { pollingIntervalSeconds: this.options.pollingIntervalSeconds }
|
|
181
|
-
};
|
|
182
|
-
const { topic, subscription } = this.options;
|
|
183
|
-
if (topic) {
|
|
184
|
-
if (!subscription) throw new PgBossSubscriptionNeedsName(topic);
|
|
185
|
-
const queue = topicEvent(topic, subscription);
|
|
186
|
-
await boss.createQueue(queue);
|
|
187
|
-
for (const type of messages) await boss.subscribe(topicEvent(topic, type), queue);
|
|
188
|
-
await boss.work(queue, work, async (jobs) => {
|
|
189
|
-
for (const job of jobs) {
|
|
190
|
-
const { data, carrier } = withoutTraceKey(job.data);
|
|
191
|
-
await consumeTraced({
|
|
192
|
-
system: "pgboss",
|
|
193
|
-
destination: topic,
|
|
194
|
-
type: data.type,
|
|
195
|
-
messageId: job.id
|
|
196
|
-
}, carrier, () => listener({
|
|
197
|
-
type: data.type,
|
|
198
|
-
payload: data.payload
|
|
199
|
-
}));
|
|
200
|
-
}
|
|
201
|
-
});
|
|
202
|
-
return;
|
|
203
|
-
}
|
|
204
|
-
for (const messageType of messages) {
|
|
205
|
-
await boss.createQueue(messageType);
|
|
206
|
-
await boss.work(messageType, work, async (jobs) => {
|
|
207
|
-
for (const job of jobs) {
|
|
208
|
-
const { data, carrier } = withoutTraceKey(job.data);
|
|
209
|
-
await consumeTraced({
|
|
210
|
-
system: "pgboss",
|
|
211
|
-
destination: messageType,
|
|
212
|
-
type: job.name,
|
|
213
|
-
messageId: job.id
|
|
214
|
-
}, carrier, () => listener({
|
|
215
|
-
type: job.name,
|
|
216
|
-
payload: data
|
|
217
|
-
}));
|
|
218
|
-
}
|
|
219
|
-
});
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
};
|
|
223
|
-
//#endregion
|
|
224
|
-
//#region src/pgboss/driver.ts
|
|
225
|
-
/**
|
|
226
|
-
* `pgboss://` — queues and topics in Postgres. Register it with
|
|
227
|
-
* `registerEventsDriver(pgbossEventsDriver)`; this subpath is the only one
|
|
228
|
-
* that imports `pg-boss`.
|
|
229
|
-
*/
|
|
230
|
-
const pgbossEventsDriver = {
|
|
231
|
-
scheme: "pgboss",
|
|
232
|
-
connect: (url) => PgBossConnection.fromConnectionString(url),
|
|
233
|
-
publisher: (url, options) => PgBossPublisher.fromConnectionString(url, options),
|
|
234
|
-
publisherFor: (connection, options) => new PgBossPublisher(connection, options),
|
|
235
|
-
subscriber: (url) => PgBossSubscriber.fromConnectionString(url),
|
|
236
|
-
subscriberFor: (connection, options) => new PgBossSubscriber(connection, options)
|
|
237
|
-
};
|
|
238
|
-
//#endregion
|
|
239
|
-
export { PgBossConnection, PgBossNotStarted, PgBossPublisher, PgBossSubscriber, PgBossSubscriptionNeedsName, pgbossEventsDriver, topicEvent };
|
|
1
|
+
import "../types-BrdcSEnd.mjs";
|
|
2
|
+
import { PgBossConnection } from "../PgBossConnection-Bj_Wo1lQ.mjs";
|
|
3
|
+
import { PgBossPublisher } from "../PgBossPublisher-Bwo7qSoH.mjs";
|
|
4
|
+
import { PgBossSubscriber } from "../PgBossSubscriber-DopATe80.mjs";
|
|
240
5
|
|
|
241
|
-
|
|
6
|
+
export { PgBossConnection, PgBossPublisher, PgBossSubscriber };
|
package/dist/rabbitmq/index.cjs
CHANGED
|
@@ -1,244 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
const
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
amqplib = require_rolldown_runtime.__toESM(amqplib, 1);
|
|
6
|
-
//#region src/rabbitmq/RabbitMQConnection.ts
|
|
7
|
-
var RabbitMQConnection_exports = /* @__PURE__ */ require_rolldown_runtime.__exportAll({ RabbitMQConnection: () => RabbitMQConnection });
|
|
8
|
-
var RabbitMQConnection = class RabbitMQConnection {
|
|
9
|
-
type = "rabbitmq";
|
|
10
|
-
connection;
|
|
11
|
-
channel;
|
|
12
|
-
connecting;
|
|
13
|
-
config;
|
|
14
|
-
constructor(config) {
|
|
15
|
-
this.config = {
|
|
16
|
-
...config,
|
|
17
|
-
exchange: config.exchange || "geekmidas.events",
|
|
18
|
-
exchangeType: config.exchangeType || "topic",
|
|
19
|
-
timeout: config.timeout ?? 5e3,
|
|
20
|
-
exchangeOptions: {
|
|
21
|
-
durable: true,
|
|
22
|
-
...config.exchangeOptions
|
|
23
|
-
}
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Create a RabbitMQConnection from a connection string
|
|
28
|
-
* Format: rabbitmq://user:pass@host:port/vhost?exchange=name&type=topic&timeout=5000
|
|
29
|
-
*/
|
|
30
|
-
static async fromConnectionString(connectionString) {
|
|
31
|
-
const url = new URL(connectionString);
|
|
32
|
-
const params = url.searchParams;
|
|
33
|
-
const baseUrl = `amqp://${url.username ? `${url.username}:${url.password}@` : ""}${url.host}${url.pathname}`;
|
|
34
|
-
const timeoutParam = params.get("timeout");
|
|
35
|
-
const config = {
|
|
36
|
-
url: baseUrl,
|
|
37
|
-
exchange: params.get("exchange") || "geekmidas.events",
|
|
38
|
-
exchangeType: params.get("type") || "topic",
|
|
39
|
-
timeout: timeoutParam ? Number.parseInt(timeoutParam, 10) : void 0
|
|
40
|
-
};
|
|
41
|
-
const connection = new RabbitMQConnection(config);
|
|
42
|
-
await connection.connect();
|
|
43
|
-
return connection;
|
|
44
|
-
}
|
|
45
|
-
async connect() {
|
|
46
|
-
if (this.channel) return;
|
|
47
|
-
if (this.connecting) {
|
|
48
|
-
await this.connecting;
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
51
|
-
this.connecting = (async () => {
|
|
52
|
-
try {
|
|
53
|
-
const connection = await amqplib.default.connect(this.config.url, { timeout: this.config.timeout });
|
|
54
|
-
const channel = await connection.createChannel();
|
|
55
|
-
await channel.assertExchange(this.config.exchange, this.config.exchangeType, this.config.exchangeOptions);
|
|
56
|
-
connection.on("error", (_err) => {
|
|
57
|
-
this.cleanup();
|
|
58
|
-
});
|
|
59
|
-
connection.on("close", () => {
|
|
60
|
-
this.cleanup();
|
|
61
|
-
});
|
|
62
|
-
this.connection = connection;
|
|
63
|
-
this.channel = channel;
|
|
64
|
-
} catch (error) {
|
|
65
|
-
this.cleanup();
|
|
66
|
-
throw error;
|
|
67
|
-
}
|
|
68
|
-
})();
|
|
69
|
-
await this.connecting;
|
|
70
|
-
this.connecting = void 0;
|
|
71
|
-
}
|
|
72
|
-
async close() {
|
|
73
|
-
try {
|
|
74
|
-
await this.channel?.close();
|
|
75
|
-
await this.connection?.close();
|
|
76
|
-
} catch (_error) {} finally {
|
|
77
|
-
this.cleanup();
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
isConnected() {
|
|
81
|
-
return !!this.channel;
|
|
82
|
-
}
|
|
83
|
-
cleanup() {
|
|
84
|
-
this.channel = void 0;
|
|
85
|
-
this.connection = void 0;
|
|
86
|
-
this.connecting = void 0;
|
|
87
|
-
}
|
|
88
|
-
/**
|
|
89
|
-
* Get the underlying channel for publishing/subscribing
|
|
90
|
-
*/
|
|
91
|
-
get amqpChannel() {
|
|
92
|
-
return this.channel;
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
|
-
* Get the exchange name for this connection
|
|
96
|
-
*/
|
|
97
|
-
get exchangeName() {
|
|
98
|
-
return this.config.exchange;
|
|
99
|
-
}
|
|
100
|
-
/**
|
|
101
|
-
* Get the exchange type for this connection
|
|
102
|
-
*/
|
|
103
|
-
get exchangeType() {
|
|
104
|
-
return this.config.exchangeType;
|
|
105
|
-
}
|
|
106
|
-
};
|
|
107
|
-
//#endregion
|
|
108
|
-
//#region src/rabbitmq/errors.ts
|
|
109
|
-
/** The connection opened but has no channel to publish or consume on. */
|
|
110
|
-
var RabbitMQChannelUnavailable = class extends Error {
|
|
111
|
-
constructor() {
|
|
112
|
-
super("RabbitMQ connected without a channel. Check the broker is reachable and the connection string names a vhost the user can open channels on.");
|
|
113
|
-
this.name = "RabbitMQChannelUnavailable";
|
|
114
|
-
}
|
|
115
|
-
};
|
|
116
|
-
//#endregion
|
|
117
|
-
//#region src/rabbitmq/RabbitMQPublisher.ts
|
|
118
|
-
var RabbitMQPublisher = class RabbitMQPublisher {
|
|
119
|
-
connection;
|
|
120
|
-
options;
|
|
121
|
-
constructor(connection, options = {}) {
|
|
122
|
-
this.connection = connection;
|
|
123
|
-
this.options = options;
|
|
124
|
-
}
|
|
125
|
-
/**
|
|
126
|
-
* Create a RabbitMQPublisher from a connection string
|
|
127
|
-
* Format: rabbitmq://user:pass@host:port/vhost?exchange=name&type=topic&timeout=5000
|
|
128
|
-
*/
|
|
129
|
-
static async fromConnectionString(connectionString) {
|
|
130
|
-
const { RabbitMQConnection } = await Promise.resolve().then(() => RabbitMQConnection_exports);
|
|
131
|
-
const connection = await RabbitMQConnection.fromConnectionString(connectionString);
|
|
132
|
-
return new RabbitMQPublisher(connection);
|
|
133
|
-
}
|
|
134
|
-
async publish(messages) {
|
|
135
|
-
if (!this.connection.isConnected()) await this.connection.connect();
|
|
136
|
-
const channel = this.connection.amqpChannel;
|
|
137
|
-
if (!channel) throw new RabbitMQChannelUnavailable();
|
|
138
|
-
const exchange = this.connection.exchangeName;
|
|
139
|
-
await require_telemetry.publishTraced(messages, (message) => ({
|
|
140
|
-
system: "rabbitmq",
|
|
141
|
-
destination: exchange,
|
|
142
|
-
type: message.type
|
|
143
|
-
}), async (carriers) => {
|
|
144
|
-
for (const [i, message] of messages.entries()) {
|
|
145
|
-
const content = Buffer.from(JSON.stringify(message.payload));
|
|
146
|
-
const { headers, ...publishOptions } = this.options.publishOptions ?? {};
|
|
147
|
-
if (!channel.publish(exchange, message.type, content, {
|
|
148
|
-
contentType: "application/json",
|
|
149
|
-
timestamp: Date.now(),
|
|
150
|
-
type: message.type,
|
|
151
|
-
persistent: true,
|
|
152
|
-
...publishOptions,
|
|
153
|
-
...(headers || carriers[i]) && { headers: {
|
|
154
|
-
...headers,
|
|
155
|
-
...carriers[i]
|
|
156
|
-
} }
|
|
157
|
-
})) await new Promise((resolve) => channel.once("drain", resolve));
|
|
158
|
-
}
|
|
159
|
-
});
|
|
160
|
-
}
|
|
161
|
-
async close() {}
|
|
162
|
-
};
|
|
163
|
-
//#endregion
|
|
164
|
-
//#region src/rabbitmq/RabbitMQSubscriber.ts
|
|
165
|
-
var RabbitMQSubscriber = class RabbitMQSubscriber {
|
|
166
|
-
connection;
|
|
167
|
-
options;
|
|
168
|
-
constructor(connection, options = {}) {
|
|
169
|
-
this.connection = connection;
|
|
170
|
-
this.options = options;
|
|
171
|
-
}
|
|
172
|
-
/**
|
|
173
|
-
* Create a RabbitMQSubscriber from a connection string
|
|
174
|
-
* Format: rabbitmq://user:pass@host:port/vhost?exchange=name&type=topic&queueName=myqueue&prefetch=10
|
|
175
|
-
*/
|
|
176
|
-
static async fromConnectionString(connectionString) {
|
|
177
|
-
const params = new URL(connectionString).searchParams;
|
|
178
|
-
const { RabbitMQConnection } = await Promise.resolve().then(() => RabbitMQConnection_exports);
|
|
179
|
-
const connection = await RabbitMQConnection.fromConnectionString(connectionString);
|
|
180
|
-
const options = {
|
|
181
|
-
queueName: params.get("queueName") || void 0,
|
|
182
|
-
prefetch: params.get("prefetch") ? Number.parseInt(params.get("prefetch"), 10) : void 0
|
|
183
|
-
};
|
|
184
|
-
return new RabbitMQSubscriber(connection, options);
|
|
185
|
-
}
|
|
186
|
-
async subscribe(messages, listener) {
|
|
187
|
-
if (!this.connection.isConnected()) await this.connection.connect();
|
|
188
|
-
const channel = this.connection.amqpChannel;
|
|
189
|
-
if (!channel) throw new RabbitMQChannelUnavailable();
|
|
190
|
-
const exchange = this.connection.exchangeName;
|
|
191
|
-
if (this.options.prefetch) await channel.prefetch(this.options.prefetch);
|
|
192
|
-
const queueName = this.options.queueName || "";
|
|
193
|
-
const queueOptions = {
|
|
194
|
-
durable: true,
|
|
195
|
-
...this.options.queueOptions
|
|
196
|
-
};
|
|
197
|
-
const { queue } = await channel.assertQueue(queueName, queueOptions);
|
|
198
|
-
for (const messageType of messages) await channel.bindQueue(queue, exchange, messageType);
|
|
199
|
-
await channel.consume(queue, async (msg) => {
|
|
200
|
-
if (!msg) return;
|
|
201
|
-
try {
|
|
202
|
-
const content = msg.content.toString();
|
|
203
|
-
const payload = JSON.parse(content);
|
|
204
|
-
const messageType = msg.properties.type;
|
|
205
|
-
const fullMessage = {
|
|
206
|
-
type: messageType,
|
|
207
|
-
payload
|
|
208
|
-
};
|
|
209
|
-
await require_telemetry.consumeTraced({
|
|
210
|
-
system: "rabbitmq",
|
|
211
|
-
destination: queue,
|
|
212
|
-
type: messageType,
|
|
213
|
-
messageId: msg.properties.messageId
|
|
214
|
-
}, require_telemetry.carrierFromAttributes(msg.properties.headers), () => listener(fullMessage));
|
|
215
|
-
channel.ack(msg);
|
|
216
|
-
} catch (_error) {
|
|
217
|
-
channel.nack(msg, false, true);
|
|
218
|
-
}
|
|
219
|
-
}, this.options.consumeOptions);
|
|
220
|
-
}
|
|
221
|
-
};
|
|
222
|
-
//#endregion
|
|
223
|
-
//#region src/rabbitmq/driver.ts
|
|
224
|
-
/**
|
|
225
|
-
* `rabbitmq://` — an AMQP exchange. Register it with
|
|
226
|
-
* `registerEventsDriver(rabbitmqEventsDriver)`; this subpath is the only one
|
|
227
|
-
* that imports `amqplib`.
|
|
228
|
-
*/
|
|
229
|
-
const rabbitmqEventsDriver = {
|
|
230
|
-
scheme: "rabbitmq",
|
|
231
|
-
connect: (url) => RabbitMQConnection.fromConnectionString(url),
|
|
232
|
-
publisher: (url) => RabbitMQPublisher.fromConnectionString(url),
|
|
233
|
-
publisherFor: (connection) => new RabbitMQPublisher(connection),
|
|
234
|
-
subscriber: (url) => RabbitMQSubscriber.fromConnectionString(url),
|
|
235
|
-
subscriberFor: (connection) => new RabbitMQSubscriber(connection)
|
|
236
|
-
};
|
|
237
|
-
//#endregion
|
|
238
|
-
exports.RabbitMQChannelUnavailable = RabbitMQChannelUnavailable;
|
|
239
|
-
exports.RabbitMQConnection = RabbitMQConnection;
|
|
240
|
-
exports.RabbitMQPublisher = RabbitMQPublisher;
|
|
241
|
-
exports.RabbitMQSubscriber = RabbitMQSubscriber;
|
|
242
|
-
exports.rabbitmqEventsDriver = rabbitmqEventsDriver;
|
|
1
|
+
require('../types-Byv8N9ma.cjs');
|
|
2
|
+
const require_RabbitMQConnection = require('../RabbitMQConnection-DmMMosT4.cjs');
|
|
3
|
+
const require_RabbitMQPublisher = require('../RabbitMQPublisher-C94q6g8q.cjs');
|
|
4
|
+
const require_RabbitMQSubscriber = require('../RabbitMQSubscriber-DGEO-clQ.cjs');
|
|
243
5
|
|
|
244
|
-
|
|
6
|
+
exports.RabbitMQConnection = require_RabbitMQConnection.RabbitMQConnection;
|
|
7
|
+
exports.RabbitMQPublisher = require_RabbitMQPublisher.RabbitMQPublisher;
|
|
8
|
+
exports.RabbitMQSubscriber = require_RabbitMQSubscriber.RabbitMQSubscriber;
|
|
@@ -1,92 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
* `registerEventsDriver(rabbitmqEventsDriver)`; this subpath is the only one
|
|
7
|
-
* that imports `amqplib`.
|
|
8
|
-
*/
|
|
9
|
-
export declare const rabbitmqEventsDriver: EventsDriver;
|
|
10
|
-
//#endregion
|
|
11
|
-
//#region src/rabbitmq/errors.d.ts
|
|
12
|
-
/** The connection opened but has no channel to publish or consume on. */
|
|
13
|
-
export declare class RabbitMQChannelUnavailable extends Error {
|
|
14
|
-
constructor();
|
|
15
|
-
}
|
|
16
|
-
//#endregion
|
|
17
|
-
//#region src/rabbitmq/RabbitMQConnection.d.ts
|
|
18
|
-
interface RabbitMQConnectionConfig {
|
|
19
|
-
url: string;
|
|
20
|
-
exchange?: string;
|
|
21
|
-
exchangeType?: 'topic' | 'direct' | 'fanout' | 'headers';
|
|
22
|
-
exchangeOptions?: amqplib.Options.AssertExchange;
|
|
23
|
-
timeout?: number;
|
|
24
|
-
}
|
|
25
|
-
export declare class RabbitMQConnection implements EventConnection {
|
|
26
|
-
readonly type = EventPublisherType.RabbitMQ;
|
|
27
|
-
private connection?;
|
|
28
|
-
private channel?;
|
|
29
|
-
private connecting?;
|
|
30
|
-
private config;
|
|
31
|
-
constructor(config: RabbitMQConnectionConfig);
|
|
32
|
-
/**
|
|
33
|
-
* Create a RabbitMQConnection from a connection string
|
|
34
|
-
* Format: rabbitmq://user:pass@host:port/vhost?exchange=name&type=topic&timeout=5000
|
|
35
|
-
*/
|
|
36
|
-
static fromConnectionString(connectionString: string): Promise<RabbitMQConnection>;
|
|
37
|
-
connect(): Promise<void>;
|
|
38
|
-
close(): Promise<void>;
|
|
39
|
-
isConnected(): boolean;
|
|
40
|
-
private cleanup;
|
|
41
|
-
/**
|
|
42
|
-
* Get the underlying channel for publishing/subscribing
|
|
43
|
-
*/
|
|
44
|
-
get amqpChannel(): amqplib.Channel | undefined;
|
|
45
|
-
/**
|
|
46
|
-
* Get the exchange name for this connection
|
|
47
|
-
*/
|
|
48
|
-
get exchangeName(): string;
|
|
49
|
-
/**
|
|
50
|
-
* Get the exchange type for this connection
|
|
51
|
-
*/
|
|
52
|
-
get exchangeType(): string;
|
|
53
|
-
}
|
|
54
|
-
//#endregion
|
|
55
|
-
//#region src/rabbitmq/RabbitMQPublisher.d.ts
|
|
56
|
-
interface RabbitMQPublisherOptions {
|
|
57
|
-
publishOptions?: amqplib.Options.Publish;
|
|
58
|
-
}
|
|
59
|
-
export declare class RabbitMQPublisher<TMessage extends PublishableMessage<string, any>> implements EventPublisher<TMessage> {
|
|
60
|
-
private connection;
|
|
61
|
-
private options;
|
|
62
|
-
constructor(connection: RabbitMQConnection, options?: RabbitMQPublisherOptions);
|
|
63
|
-
/**
|
|
64
|
-
* Create a RabbitMQPublisher from a connection string
|
|
65
|
-
* Format: rabbitmq://user:pass@host:port/vhost?exchange=name&type=topic&timeout=5000
|
|
66
|
-
*/
|
|
67
|
-
static fromConnectionString<TMessage extends PublishableMessage<string, any>>(connectionString: string): Promise<RabbitMQPublisher<TMessage>>;
|
|
68
|
-
publish(messages: TMessage[]): Promise<void>;
|
|
69
|
-
close(): Promise<void>;
|
|
70
|
-
}
|
|
71
|
-
//#endregion
|
|
72
|
-
//#region src/rabbitmq/RabbitMQSubscriber.d.ts
|
|
73
|
-
interface RabbitMQSubscriberOptions {
|
|
74
|
-
queueName?: string;
|
|
75
|
-
queueOptions?: amqplib.Options.AssertQueue;
|
|
76
|
-
consumeOptions?: amqplib.Options.Consume;
|
|
77
|
-
prefetch?: number;
|
|
78
|
-
}
|
|
79
|
-
export declare class RabbitMQSubscriber<TMessage extends PublishableMessage<string, any>> implements EventSubscriber<TMessage> {
|
|
80
|
-
private connection;
|
|
81
|
-
private options;
|
|
82
|
-
constructor(connection: RabbitMQConnection, options?: RabbitMQSubscriberOptions);
|
|
83
|
-
/**
|
|
84
|
-
* Create a RabbitMQSubscriber from a connection string
|
|
85
|
-
* Format: rabbitmq://user:pass@host:port/vhost?exchange=name&type=topic&queueName=myqueue&prefetch=10
|
|
86
|
-
*/
|
|
87
|
-
static fromConnectionString<TMessage extends PublishableMessage<string, any>>(connectionString: string): Promise<RabbitMQSubscriber<TMessage>>;
|
|
88
|
-
subscribe(messages: TMessage['type'][], listener: (payload: TMessage) => Promise<void>): Promise<void>;
|
|
89
|
-
}
|
|
90
|
-
//#endregion
|
|
91
|
-
export type { RabbitMQConnectionConfig, RabbitMQPublisherOptions, RabbitMQSubscriberOptions };
|
|
92
|
-
//# sourceMappingURL=index.d.cts.map
|
|
1
|
+
import "../types-Dj23od3e.cjs";
|
|
2
|
+
import { RabbitMQConnection, RabbitMQConnectionConfig } from "../RabbitMQConnection-jNME_eR7.cjs";
|
|
3
|
+
import { RabbitMQPublisher, RabbitMQPublisherOptions } from "../RabbitMQPublisher-d257OHLa.cjs";
|
|
4
|
+
import { RabbitMQSubscriber, RabbitMQSubscriberOptions } from "../RabbitMQSubscriber-BF7JGfYm.cjs";
|
|
5
|
+
export { RabbitMQConnection, RabbitMQConnectionConfig, RabbitMQPublisher, RabbitMQPublisherOptions, RabbitMQSubscriber, RabbitMQSubscriberOptions };
|