@geekmidas/events 9.0.2 → 10.0.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{PgBossConnection-B71ssr72.cjs → PgBossConnection-23soZ_aM.cjs} +2 -2
- package/dist/{PgBossConnection-B71ssr72.cjs.map → PgBossConnection-23soZ_aM.cjs.map} +1 -1
- package/dist/PgBossConnection-CCXhoNzb.cjs +4 -0
- package/dist/{PgBossConnection-Bj_Wo1lQ.mjs → PgBossConnection-DvNbd4Zk.mjs} +2 -2
- package/dist/{PgBossConnection-Bj_Wo1lQ.mjs.map → PgBossConnection-DvNbd4Zk.mjs.map} +1 -1
- package/dist/PgBossConnection-_gdM40JB.mjs +4 -0
- package/dist/{RabbitMQConnection-DmMMosT4.cjs → RabbitMQConnection-BKEdCUro.cjs} +2 -2
- package/dist/{RabbitMQConnection-DmMMosT4.cjs.map → RabbitMQConnection-BKEdCUro.cjs.map} +1 -1
- package/dist/RabbitMQConnection-CCOqDDnb.cjs +4 -0
- package/dist/RabbitMQConnection-DJEyM-Bu.mjs +4 -0
- package/dist/{RabbitMQConnection-BtKZjtZY.mjs → RabbitMQConnection-DJgUPc19.mjs} +2 -2
- package/dist/{RabbitMQConnection-BtKZjtZY.mjs.map → RabbitMQConnection-DJgUPc19.mjs.map} +1 -1
- package/dist/{SNSConnection-CAcbLQOy.cjs → SNSConnection-B2K86hpz.cjs} +7 -8
- package/dist/SNSConnection-B2K86hpz.cjs.map +1 -0
- package/dist/SNSConnection-BVo84FeW.mjs +5 -0
- package/dist/SNSConnection-DIHRjrQF.cjs +5 -0
- package/dist/{SNSConnection-CVjH93lb.mjs → SNSConnection-v9jjF99w.mjs} +7 -8
- package/dist/SNSConnection-v9jjF99w.mjs.map +1 -0
- package/dist/{SQSConnection-CT3S7_zP.mjs → SQSConnection-4tBMkVZE.mjs} +7 -8
- package/dist/SQSConnection-4tBMkVZE.mjs.map +1 -0
- package/dist/SQSConnection-BBLAvF-1.cjs +5 -0
- package/dist/{SQSConnection-Y0mdVTcB.cjs → SQSConnection-BaC7rGhI.cjs} +7 -8
- package/dist/SQSConnection-BaC7rGhI.cjs.map +1 -0
- package/dist/SQSConnection-DbavOq8_.mjs +5 -0
- package/dist/{SQSSubscriber-CQdSFzpe.mjs → SQSSubscriber-BMWZ3s5q.mjs} +1 -1
- package/dist/{SQSSubscriber-CQdSFzpe.mjs.map → SQSSubscriber-BMWZ3s5q.mjs.map} +1 -1
- package/dist/{SQSSubscriber-C4UA2hKq.cjs → SQSSubscriber-YXPlg2rm.cjs} +2 -2
- package/dist/{SQSSubscriber-C4UA2hKq.cjs.map → SQSSubscriber-YXPlg2rm.cjs.map} +1 -1
- package/dist/basic/index.cjs +71 -8
- package/dist/basic/index.cjs.map +1 -0
- package/dist/basic/index.d.cts +44 -5
- package/dist/basic/index.d.cts.map +1 -0
- package/dist/basic/index.d.mts +44 -5
- package/dist/basic/index.d.mts.map +1 -0
- package/dist/basic/index.mjs +67 -5
- package/dist/basic/index.mjs.map +1 -0
- package/dist/chunk-B9dir_RE.mjs +11 -0
- package/dist/{chunk-CUT6urMc.cjs → chunk-CsX-DzYB.cjs} +12 -0
- package/dist/index.cjs +189 -6
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +46 -5
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +46 -5
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +188 -5
- package/dist/index.mjs.map +1 -0
- package/dist/pgboss/index.cjs +81 -5
- package/dist/pgboss/index.cjs.map +1 -0
- package/dist/pgboss/index.d.cts +65 -5
- package/dist/pgboss/index.d.cts.map +1 -0
- package/dist/pgboss/index.d.mts +65 -5
- package/dist/pgboss/index.d.mts.map +1 -0
- package/dist/pgboss/index.mjs +81 -5
- package/dist/pgboss/index.mjs.map +1 -0
- package/dist/rabbitmq/index.cjs +95 -5
- package/dist/rabbitmq/index.cjs.map +1 -0
- package/dist/rabbitmq/index.d.cts +83 -5
- package/dist/rabbitmq/index.d.cts.map +1 -0
- package/dist/rabbitmq/index.d.mts +83 -5
- package/dist/rabbitmq/index.d.mts.map +1 -0
- package/dist/rabbitmq/index.mjs +95 -5
- package/dist/rabbitmq/index.mjs.map +1 -0
- package/dist/sns/index.cjs +186 -7
- package/dist/sns/index.cjs.map +1 -0
- package/dist/sns/index.d.cts +109 -5
- package/dist/sns/index.d.cts.map +1 -0
- package/dist/sns/index.d.mts +109 -5
- package/dist/sns/index.d.mts.map +1 -0
- package/dist/sns/index.mjs +179 -7
- package/dist/sns/index.mjs.map +1 -0
- package/dist/sns/snsUrl.cjs +7 -0
- package/dist/sns/snsUrl.d.cts +2 -0
- package/dist/sns/snsUrl.d.mts +2 -0
- package/dist/sns/snsUrl.mjs +3 -0
- package/dist/snsUrl-ASdc0D1v.d.cts +61 -0
- package/dist/snsUrl-ASdc0D1v.d.cts.map +1 -0
- package/dist/snsUrl-CifYhPAa.mjs +79 -0
- package/dist/snsUrl-CifYhPAa.mjs.map +1 -0
- package/dist/snsUrl-FRbRcwF0.d.mts +61 -0
- package/dist/snsUrl-FRbRcwF0.d.mts.map +1 -0
- package/dist/snsUrl-f2gU3CzK.cjs +114 -0
- package/dist/snsUrl-f2gU3CzK.cjs.map +1 -0
- package/dist/sqs/index.cjs +67 -5
- package/dist/sqs/index.cjs.map +1 -0
- package/dist/sqs/index.d.cts +101 -5
- package/dist/sqs/index.d.cts.map +1 -0
- package/dist/sqs/index.d.mts +101 -5
- package/dist/sqs/index.d.mts.map +1 -0
- package/dist/sqs/index.mjs +60 -5
- package/dist/sqs/index.mjs.map +1 -0
- package/dist/sqs/sqsUrl.cjs +7 -0
- package/dist/sqs/sqsUrl.d.cts +2 -0
- package/dist/sqs/sqsUrl.d.mts +2 -0
- package/dist/sqs/sqsUrl.mjs +3 -0
- package/dist/sqsUrl-BV6zS-mi.d.mts +60 -0
- package/dist/sqsUrl-BV6zS-mi.d.mts.map +1 -0
- package/dist/sqsUrl-CbAsBFHI.mjs +80 -0
- package/dist/sqsUrl-CbAsBFHI.mjs.map +1 -0
- package/dist/sqsUrl-CdisN3GU.cjs +115 -0
- package/dist/sqsUrl-CdisN3GU.cjs.map +1 -0
- package/dist/sqsUrl-DZDPHxIk.d.cts +60 -0
- package/dist/sqsUrl-DZDPHxIk.d.cts.map +1 -0
- package/dist/{types-Dh9Jyinx.d.mts → types-BmixGrOD.d.cts} +1 -1
- package/dist/{types-Dh9Jyinx.d.mts.map → types-BmixGrOD.d.cts.map} +1 -1
- package/dist/{types-BrdcSEnd.mjs → types-CYDt-2RQ.mjs} +1 -1
- package/dist/{types-BrdcSEnd.mjs.map → types-CYDt-2RQ.mjs.map} +1 -1
- package/dist/{types-Dj23od3e.d.cts → types-DycjsYms.d.mts} +1 -1
- package/dist/{types-Dj23od3e.d.cts.map → types-DycjsYms.d.mts.map} +1 -1
- package/package.json +26 -3
- package/CHANGELOG.md +0 -109
- package/dist/BasicConnection-CQsJpx2J.d.cts +0 -27
- package/dist/BasicConnection-CQsJpx2J.d.cts.map +0 -1
- package/dist/BasicConnection-CxfNEvlb.cjs +0 -48
- package/dist/BasicConnection-CxfNEvlb.cjs.map +0 -1
- package/dist/BasicConnection-DcRelT64.d.mts +0 -27
- package/dist/BasicConnection-DcRelT64.d.mts.map +0 -1
- package/dist/BasicConnection-hl-Ogz3a.mjs +0 -42
- package/dist/BasicConnection-hl-Ogz3a.mjs.map +0 -1
- package/dist/BasicPublisher-C-hMX2Hy.d.mts +0 -14
- package/dist/BasicPublisher-C-hMX2Hy.d.mts.map +0 -1
- package/dist/BasicPublisher-CGMXg2I2.d.cts +0 -14
- package/dist/BasicPublisher-CGMXg2I2.d.cts.map +0 -1
- package/dist/BasicPublisher-CXAVKxgq.cjs +0 -20
- package/dist/BasicPublisher-CXAVKxgq.cjs.map +0 -1
- package/dist/BasicPublisher-DogbeHAH.mjs +0 -14
- package/dist/BasicPublisher-DogbeHAH.mjs.map +0 -1
- package/dist/BasicSubscriber-BJSZN22M.mjs +0 -16
- package/dist/BasicSubscriber-BJSZN22M.mjs.map +0 -1
- package/dist/BasicSubscriber-HzSJ_MbB.d.mts +0 -14
- package/dist/BasicSubscriber-HzSJ_MbB.d.mts.map +0 -1
- package/dist/BasicSubscriber-mVJRMXhZ.cjs +0 -22
- package/dist/BasicSubscriber-mVJRMXhZ.cjs.map +0 -1
- package/dist/BasicSubscriber-uW3IOyBj.d.cts +0 -14
- package/dist/BasicSubscriber-uW3IOyBj.d.cts.map +0 -1
- package/dist/EventConnection-4niMI6D8.d.mts +0 -13
- package/dist/EventConnection-4niMI6D8.d.mts.map +0 -1
- package/dist/EventConnection-BkA9FSVL.cjs +0 -45
- package/dist/EventConnection-BkA9FSVL.cjs.map +0 -1
- package/dist/EventConnection-Kr32GAzq.mjs +0 -40
- package/dist/EventConnection-Kr32GAzq.mjs.map +0 -1
- package/dist/EventConnection-dP42P87q.d.cts +0 -13
- package/dist/EventConnection-dP42P87q.d.cts.map +0 -1
- package/dist/EventConnection.cjs +0 -5
- package/dist/EventConnection.d.cts +0 -3
- package/dist/EventConnection.d.mts +0 -3
- package/dist/EventConnection.mjs +0 -4
- package/dist/PgBossConnection-DCfLGoHx.d.mts +0 -32
- package/dist/PgBossConnection-DCfLGoHx.d.mts.map +0 -1
- package/dist/PgBossConnection-oto_CAbP.d.cts +0 -32
- package/dist/PgBossConnection-oto_CAbP.d.cts.map +0 -1
- package/dist/PgBossPublisher-Bwo7qSoH.mjs +0 -35
- package/dist/PgBossPublisher-Bwo7qSoH.mjs.map +0 -1
- package/dist/PgBossPublisher-CqjigBVC.d.mts +0 -20
- package/dist/PgBossPublisher-CqjigBVC.d.mts.map +0 -1
- package/dist/PgBossPublisher-FTdYh58W.cjs +0 -41
- package/dist/PgBossPublisher-FTdYh58W.cjs.map +0 -1
- package/dist/PgBossPublisher-JIiB1zpA.d.cts +0 -20
- package/dist/PgBossPublisher-JIiB1zpA.d.cts.map +0 -1
- package/dist/PgBossSubscriber-BUiB1JKf.d.mts +0 -24
- package/dist/PgBossSubscriber-BUiB1JKf.d.mts.map +0 -1
- package/dist/PgBossSubscriber-BubVfuWm.cjs +0 -52
- package/dist/PgBossSubscriber-BubVfuWm.cjs.map +0 -1
- package/dist/PgBossSubscriber-Cozijfdj.d.cts +0 -24
- package/dist/PgBossSubscriber-Cozijfdj.d.cts.map +0 -1
- package/dist/PgBossSubscriber-DopATe80.mjs +0 -46
- package/dist/PgBossSubscriber-DopATe80.mjs.map +0 -1
- package/dist/Publisher-CKloIGh6.cjs +0 -79
- package/dist/Publisher-CKloIGh6.cjs.map +0 -1
- package/dist/Publisher-ChLTrUeP.mjs +0 -74
- package/dist/Publisher-ChLTrUeP.mjs.map +0 -1
- package/dist/Publisher-DDee6xau.d.cts +0 -21
- package/dist/Publisher-DDee6xau.d.cts.map +0 -1
- package/dist/Publisher-VHumMkrP.d.mts +0 -21
- package/dist/Publisher-VHumMkrP.d.mts.map +0 -1
- package/dist/Publisher.cjs +0 -4
- package/dist/Publisher.d.cts +0 -3
- package/dist/Publisher.d.mts +0 -3
- package/dist/Publisher.mjs +0 -4
- package/dist/RabbitMQConnection-DV9t3VYp.d.mts +0 -44
- package/dist/RabbitMQConnection-DV9t3VYp.d.mts.map +0 -1
- package/dist/RabbitMQConnection-jNME_eR7.d.cts +0 -44
- package/dist/RabbitMQConnection-jNME_eR7.d.cts.map +0 -1
- package/dist/RabbitMQPublisher-C94q6g8q.cjs +0 -45
- package/dist/RabbitMQPublisher-C94q6g8q.cjs.map +0 -1
- package/dist/RabbitMQPublisher-DKmgwqVj.d.mts +0 -25
- package/dist/RabbitMQPublisher-DKmgwqVj.d.mts.map +0 -1
- package/dist/RabbitMQPublisher-d257OHLa.d.cts +0 -25
- package/dist/RabbitMQPublisher-d257OHLa.d.cts.map +0 -1
- package/dist/RabbitMQPublisher-yUqWNq-P.mjs +0 -39
- package/dist/RabbitMQPublisher-yUqWNq-P.mjs.map +0 -1
- package/dist/RabbitMQSubscriber-BF7JGfYm.d.cts +0 -27
- package/dist/RabbitMQSubscriber-BF7JGfYm.d.cts.map +0 -1
- package/dist/RabbitMQSubscriber-BWniDtFs.mjs +0 -56
- package/dist/RabbitMQSubscriber-BWniDtFs.mjs.map +0 -1
- package/dist/RabbitMQSubscriber-CdbUy5mB.d.mts +0 -27
- package/dist/RabbitMQSubscriber-CdbUy5mB.d.mts.map +0 -1
- package/dist/RabbitMQSubscriber-DGEO-clQ.cjs +0 -62
- package/dist/RabbitMQSubscriber-DGEO-clQ.cjs.map +0 -1
- package/dist/SNSConnection-CAcbLQOy.cjs.map +0 -1
- package/dist/SNSConnection-CG4iEwA8.d.mts +0 -41
- package/dist/SNSConnection-CG4iEwA8.d.mts.map +0 -1
- package/dist/SNSConnection-CVjH93lb.mjs.map +0 -1
- package/dist/SNSConnection-Dol9FuxA.d.cts +0 -41
- package/dist/SNSConnection-Dol9FuxA.d.cts.map +0 -1
- package/dist/SNSPublisher-CjlMS3Z2.mjs +0 -41
- package/dist/SNSPublisher-CjlMS3Z2.mjs.map +0 -1
- package/dist/SNSPublisher-D50dPCEh.d.mts +0 -22
- package/dist/SNSPublisher-D50dPCEh.d.mts.map +0 -1
- package/dist/SNSPublisher-DQunY4NM.d.cts +0 -22
- package/dist/SNSPublisher-DQunY4NM.d.cts.map +0 -1
- package/dist/SNSPublisher-DV_8GGsi.cjs +0 -47
- package/dist/SNSPublisher-DV_8GGsi.cjs.map +0 -1
- package/dist/SNSSubscriber-BWaCQFl6.mjs +0 -139
- package/dist/SNSSubscriber-BWaCQFl6.mjs.map +0 -1
- package/dist/SNSSubscriber-CUgHK4W2.d.mts +0 -55
- package/dist/SNSSubscriber-CUgHK4W2.d.mts.map +0 -1
- package/dist/SNSSubscriber-ZE_-Hsps.cjs +0 -145
- package/dist/SNSSubscriber-ZE_-Hsps.cjs.map +0 -1
- package/dist/SNSSubscriber-ZGJjhXFQ.d.cts +0 -55
- package/dist/SNSSubscriber-ZGJjhXFQ.d.cts.map +0 -1
- package/dist/SQSConnection-BtEkDha8.d.cts +0 -41
- package/dist/SQSConnection-BtEkDha8.d.cts.map +0 -1
- package/dist/SQSConnection-CT3S7_zP.mjs.map +0 -1
- package/dist/SQSConnection-DVy43GCV.d.mts +0 -41
- package/dist/SQSConnection-DVy43GCV.d.mts.map +0 -1
- package/dist/SQSConnection-Y0mdVTcB.cjs.map +0 -1
- package/dist/SQSPublisher-B-32CC4G.mjs +0 -57
- package/dist/SQSPublisher-B-32CC4G.mjs.map +0 -1
- package/dist/SQSPublisher-CgUduk6H.cjs +0 -63
- package/dist/SQSPublisher-CgUduk6H.cjs.map +0 -1
- package/dist/SQSPublisher-kyl5HW3N.d.cts +0 -25
- package/dist/SQSPublisher-kyl5HW3N.d.cts.map +0 -1
- package/dist/SQSPublisher-qDE5Fp-N.d.mts +0 -25
- package/dist/SQSPublisher-qDE5Fp-N.d.mts.map +0 -1
- package/dist/SQSSubscriber-CDvaG4ij.d.cts +0 -44
- package/dist/SQSSubscriber-CDvaG4ij.d.cts.map +0 -1
- package/dist/SQSSubscriber-JfFuAAoP.d.mts +0 -44
- package/dist/SQSSubscriber-JfFuAAoP.d.mts.map +0 -1
- package/dist/Subscriber-CG_QUQZs.d.cts +0 -21
- package/dist/Subscriber-CG_QUQZs.d.cts.map +0 -1
- package/dist/Subscriber-CghW0A02.cjs +0 -88
- package/dist/Subscriber-CghW0A02.cjs.map +0 -1
- package/dist/Subscriber-DiYHmuF0.d.mts +0 -21
- package/dist/Subscriber-DiYHmuF0.d.mts.map +0 -1
- package/dist/Subscriber-bnkFtSvt.mjs +0 -83
- package/dist/Subscriber-bnkFtSvt.mjs.map +0 -1
- package/dist/Subscriber.cjs +0 -4
- package/dist/Subscriber.d.cts +0 -3
- package/dist/Subscriber.d.mts +0 -3
- package/dist/Subscriber.mjs +0 -4
- package/dist/basic/BasicConnection.cjs +0 -4
- package/dist/basic/BasicConnection.d.cts +0 -3
- package/dist/basic/BasicConnection.d.mts +0 -3
- package/dist/basic/BasicConnection.mjs +0 -4
- package/dist/basic/BasicPublisher.cjs +0 -3
- package/dist/basic/BasicPublisher.d.cts +0 -4
- package/dist/basic/BasicPublisher.d.mts +0 -4
- package/dist/basic/BasicPublisher.mjs +0 -3
- package/dist/basic/BasicSubscriber.cjs +0 -3
- package/dist/basic/BasicSubscriber.d.cts +0 -4
- package/dist/basic/BasicSubscriber.d.mts +0 -4
- package/dist/basic/BasicSubscriber.mjs +0 -3
- package/dist/pgboss/PgBossConnection.cjs +0 -4
- package/dist/pgboss/PgBossConnection.d.cts +0 -3
- package/dist/pgboss/PgBossConnection.d.mts +0 -3
- package/dist/pgboss/PgBossConnection.mjs +0 -4
- package/dist/pgboss/PgBossPublisher.cjs +0 -3
- package/dist/pgboss/PgBossPublisher.d.cts +0 -4
- package/dist/pgboss/PgBossPublisher.d.mts +0 -4
- package/dist/pgboss/PgBossPublisher.mjs +0 -3
- package/dist/pgboss/PgBossSubscriber.cjs +0 -3
- package/dist/pgboss/PgBossSubscriber.d.cts +0 -4
- package/dist/pgboss/PgBossSubscriber.d.mts +0 -4
- package/dist/pgboss/PgBossSubscriber.mjs +0 -3
- package/dist/rabbitmq/RabbitMQConnection.cjs +0 -4
- package/dist/rabbitmq/RabbitMQConnection.d.cts +0 -3
- package/dist/rabbitmq/RabbitMQConnection.d.mts +0 -3
- package/dist/rabbitmq/RabbitMQConnection.mjs +0 -4
- package/dist/rabbitmq/RabbitMQPublisher.cjs +0 -3
- package/dist/rabbitmq/RabbitMQPublisher.d.cts +0 -4
- package/dist/rabbitmq/RabbitMQPublisher.d.mts +0 -4
- package/dist/rabbitmq/RabbitMQPublisher.mjs +0 -3
- package/dist/rabbitmq/RabbitMQSubscriber.cjs +0 -3
- package/dist/rabbitmq/RabbitMQSubscriber.d.cts +0 -4
- package/dist/rabbitmq/RabbitMQSubscriber.d.mts +0 -4
- package/dist/rabbitmq/RabbitMQSubscriber.mjs +0 -3
- package/dist/sns/SNSConnection.cjs +0 -4
- package/dist/sns/SNSConnection.d.cts +0 -3
- package/dist/sns/SNSConnection.d.mts +0 -3
- package/dist/sns/SNSConnection.mjs +0 -4
- package/dist/sns/SNSPublisher.cjs +0 -3
- package/dist/sns/SNSPublisher.d.cts +0 -4
- package/dist/sns/SNSPublisher.d.mts +0 -4
- package/dist/sns/SNSPublisher.mjs +0 -3
- package/dist/sns/SNSSubscriber.cjs +0 -6
- package/dist/sns/SNSSubscriber.d.cts +0 -4
- package/dist/sns/SNSSubscriber.d.mts +0 -4
- package/dist/sns/SNSSubscriber.mjs +0 -6
- package/dist/sqs/SQSConnection.cjs +0 -4
- package/dist/sqs/SQSConnection.d.cts +0 -3
- package/dist/sqs/SQSConnection.d.mts +0 -3
- package/dist/sqs/SQSConnection.mjs +0 -4
- package/dist/sqs/SQSPublisher.cjs +0 -3
- package/dist/sqs/SQSPublisher.d.cts +0 -4
- package/dist/sqs/SQSPublisher.d.mts +0 -4
- package/dist/sqs/SQSPublisher.mjs +0 -3
- package/dist/sqs/SQSSubscriber.cjs +0 -3
- package/dist/sqs/SQSSubscriber.d.cts +0 -4
- package/dist/sqs/SQSSubscriber.d.mts +0 -4
- package/dist/sqs/SQSSubscriber.mjs +0 -3
- package/dist/types.cjs +0 -3
- package/dist/types.d.cts +0 -2
- package/dist/types.d.mts +0 -2
- package/dist/types.mjs +0 -3
- package/src/EventConnection.ts +0 -43
- package/src/Publisher.ts +0 -98
- package/src/Subscriber.ts +0 -113
- package/src/__tests__/EventConnection.spec.ts +0 -42
- package/src/__tests__/Publisher.spec.ts +0 -96
- package/src/__tests__/Subscriber.spec.ts +0 -109
- package/src/basic/BasicConnection.ts +0 -47
- package/src/basic/BasicPublisher.ts +0 -15
- package/src/basic/BasicSubscriber.ts +0 -21
- package/src/basic/__tests__/BasicSubscriber.spec.ts +0 -166
- package/src/basic/index.ts +0 -3
- package/src/index.ts +0 -25
- package/src/pgboss/PgBossConnection.ts +0 -91
- package/src/pgboss/PgBossPublisher.ts +0 -49
- package/src/pgboss/PgBossSubscriber.ts +0 -81
- package/src/pgboss/__tests__/pgboss.spec.ts +0 -196
- package/src/pgboss/__tests__/setup.ts +0 -21
- package/src/pgboss/index.ts +0 -5
- package/src/rabbitmq/RabbitMQConnection.ts +0 -148
- package/src/rabbitmq/RabbitMQPublisher.ts +0 -67
- package/src/rabbitmq/RabbitMQSubscriber.ts +0 -111
- package/src/rabbitmq/__tests__/RabbitMQPublisher.spec.ts +0 -378
- package/src/rabbitmq/__tests__/RabbitMQSubscriber.spec.ts +0 -292
- package/src/rabbitmq/index.ts +0 -6
- package/src/sns/SNSConnection.ts +0 -98
- package/src/sns/SNSPublisher.ts +0 -62
- package/src/sns/SNSSubscriber.ts +0 -218
- package/src/sns/__tests__/SNS-SQS-Integration.spec.ts +0 -389
- package/src/sns/__tests__/SNSPublisher.spec.ts +0 -449
- package/src/sns/__tests__/SNSSubscriber.spec.ts +0 -527
- package/src/sns/index.ts +0 -6
- package/src/sqs/SQSConnection.ts +0 -97
- package/src/sqs/SQSPublisher.ts +0 -105
- package/src/sqs/SQSSubscriber.ts +0 -181
- package/src/sqs/__tests__/SQSPublisher.spec.ts +0 -189
- package/src/sqs/index.ts +0 -6
- package/src/types.ts +0 -76
- package/tsconfig.json +0 -9
- package/tsdown.config.ts +0 -10
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from 'vitest';
|
|
2
|
-
import { BasicConnection, BasicPublisher } from '../basic';
|
|
3
|
-
import { Publisher } from '../Publisher';
|
|
4
|
-
import { SNSConnection } from '../sns/SNSConnection';
|
|
5
|
-
import { SNSPublisher } from '../sns/SNSPublisher';
|
|
6
|
-
import { SQSConnection } from '../sqs/SQSConnection';
|
|
7
|
-
import { SQSPublisher } from '../sqs/SQSPublisher';
|
|
8
|
-
import type { PublishableMessage } from '../types';
|
|
9
|
-
|
|
10
|
-
type TestMessage = PublishableMessage<'test.event', { data: string }>;
|
|
11
|
-
|
|
12
|
-
describe('Publisher', () => {
|
|
13
|
-
describe('fromConnectionString', () => {
|
|
14
|
-
it('should create Basic publisher from basic:// connection string', async () => {
|
|
15
|
-
const connectionStr = 'basic://localhost';
|
|
16
|
-
|
|
17
|
-
const publisher =
|
|
18
|
-
await Publisher.fromConnectionString<TestMessage>(connectionStr);
|
|
19
|
-
|
|
20
|
-
expect(publisher).toBeInstanceOf(BasicPublisher);
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
it('should create SQS publisher from sqs:// connection string', async () => {
|
|
24
|
-
const connectionStr =
|
|
25
|
-
'sqs://?queueUrl=https://sqs.us-east-1.amazonaws.com/123456789/test-queue®ion=us-east-1&endpoint=http://localhost:4566';
|
|
26
|
-
|
|
27
|
-
const publisher =
|
|
28
|
-
await Publisher.fromConnectionString<TestMessage>(connectionStr);
|
|
29
|
-
|
|
30
|
-
expect(publisher).toBeInstanceOf(SQSPublisher);
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
it('should create SNS publisher from sns:// connection string', async () => {
|
|
34
|
-
const connectionStr =
|
|
35
|
-
'sns://?topicArn=arn:aws:sns:us-east-1:123456789:test-topic®ion=us-east-1&endpoint=http://localhost:4566&accessKeyId=test&secretAccessKey=test';
|
|
36
|
-
|
|
37
|
-
const publisher =
|
|
38
|
-
await Publisher.fromConnectionString<TestMessage>(connectionStr);
|
|
39
|
-
|
|
40
|
-
expect(publisher).toBeInstanceOf(SNSPublisher);
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
it('should throw error for unsupported protocol', async () => {
|
|
44
|
-
const connectionStr = 'unsupported://localhost';
|
|
45
|
-
|
|
46
|
-
await expect(
|
|
47
|
-
Publisher.fromConnectionString<TestMessage>(connectionStr),
|
|
48
|
-
).rejects.toThrow('Unsupported event publisher type');
|
|
49
|
-
});
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
describe('fromConnection', () => {
|
|
53
|
-
it('should create Basic publisher from Basic connection', async () => {
|
|
54
|
-
const connection = new BasicConnection();
|
|
55
|
-
await connection.connect();
|
|
56
|
-
|
|
57
|
-
const publisher = await Publisher.fromConnection<TestMessage>(connection);
|
|
58
|
-
|
|
59
|
-
expect(publisher).toBeInstanceOf(BasicPublisher);
|
|
60
|
-
|
|
61
|
-
await connection.close();
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
it('should create SQS publisher from SQS connection', async () => {
|
|
65
|
-
const connection = await SQSConnection.fromConnectionString(
|
|
66
|
-
'sqs://?queueUrl=https://sqs.us-east-1.amazonaws.com/123456789/test-queue®ion=us-east-1&endpoint=http://localhost:4566',
|
|
67
|
-
);
|
|
68
|
-
|
|
69
|
-
const publisher = await Publisher.fromConnection<TestMessage>(connection);
|
|
70
|
-
|
|
71
|
-
expect(publisher).toBeInstanceOf(SQSPublisher);
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
it('should create SNS publisher from SNS connection', async () => {
|
|
75
|
-
const connection = await SNSConnection.fromConnectionString(
|
|
76
|
-
'sns://?topicArn=arn:aws:sns:us-east-1:123456789:test-topic®ion=us-east-1&endpoint=http://localhost:4566&accessKeyId=test&secretAccessKey=test',
|
|
77
|
-
);
|
|
78
|
-
|
|
79
|
-
const publisher = await Publisher.fromConnection<TestMessage>(connection);
|
|
80
|
-
|
|
81
|
-
expect(publisher).toBeInstanceOf(SNSPublisher);
|
|
82
|
-
|
|
83
|
-
await connection.close();
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
it('should throw error for unsupported connection type', async () => {
|
|
87
|
-
const fakeConnection = {
|
|
88
|
-
type: 'unsupported' as any,
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
await expect(
|
|
92
|
-
Publisher.fromConnection<TestMessage>(fakeConnection as any),
|
|
93
|
-
).rejects.toThrow('Unsupported connection type');
|
|
94
|
-
});
|
|
95
|
-
});
|
|
96
|
-
});
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from 'vitest';
|
|
2
|
-
import { BasicConnection, BasicSubscriber } from '../basic';
|
|
3
|
-
import { Subscriber } from '../Subscriber';
|
|
4
|
-
import { SNSConnection } from '../sns/SNSConnection';
|
|
5
|
-
import { SNSSubscriber } from '../sns/SNSSubscriber';
|
|
6
|
-
import { SQSConnection } from '../sqs/SQSConnection';
|
|
7
|
-
import { SQSSubscriber } from '../sqs/SQSSubscriber';
|
|
8
|
-
import type { PublishableMessage } from '../types';
|
|
9
|
-
|
|
10
|
-
type TestMessage = PublishableMessage<'test.event', { data: string }>;
|
|
11
|
-
|
|
12
|
-
describe('Subscriber', () => {
|
|
13
|
-
describe('fromConnectionString', () => {
|
|
14
|
-
it('should create Basic subscriber from basic:// connection string', async () => {
|
|
15
|
-
const connectionStr = 'basic://localhost';
|
|
16
|
-
|
|
17
|
-
const subscriber =
|
|
18
|
-
await Subscriber.fromConnectionString<TestMessage>(connectionStr);
|
|
19
|
-
|
|
20
|
-
expect(subscriber).toBeInstanceOf(BasicSubscriber);
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
it('should create SQS subscriber without topicArn', async () => {
|
|
24
|
-
const connectionStr =
|
|
25
|
-
'sqs://?queueUrl=https://sqs.us-east-1.amazonaws.com/123456789/test-queue®ion=us-east-1&endpoint=http://localhost:4566';
|
|
26
|
-
|
|
27
|
-
const subscriber =
|
|
28
|
-
await Subscriber.fromConnectionString<TestMessage>(connectionStr);
|
|
29
|
-
|
|
30
|
-
expect(subscriber).toBeInstanceOf(SQSSubscriber);
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
it('should create SNS subscriber when topicArn is present in SQS connection string', async () => {
|
|
34
|
-
const connectionStr =
|
|
35
|
-
'sqs://?topicArn=arn:aws:sns:us-east-1:123456789:test-topic&queueName=test-queue®ion=us-east-1&endpoint=http://localhost:4566&accessKeyId=test&secretAccessKey=test';
|
|
36
|
-
|
|
37
|
-
const subscriber =
|
|
38
|
-
await Subscriber.fromConnectionString<TestMessage>(connectionStr);
|
|
39
|
-
|
|
40
|
-
expect(subscriber).toBeInstanceOf(SNSSubscriber);
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
it('should create SNS subscriber from sns:// connection string', async () => {
|
|
44
|
-
const connectionStr =
|
|
45
|
-
'sns://?topicArn=arn:aws:sns:us-east-1:123456789:test-topic®ion=us-east-1&endpoint=http://localhost:4566&accessKeyId=test&secretAccessKey=test';
|
|
46
|
-
|
|
47
|
-
const subscriber =
|
|
48
|
-
await Subscriber.fromConnectionString<TestMessage>(connectionStr);
|
|
49
|
-
|
|
50
|
-
expect(subscriber).toBeInstanceOf(SNSSubscriber);
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
it('should throw error for unsupported protocol', async () => {
|
|
54
|
-
const connectionStr = 'unsupported://localhost';
|
|
55
|
-
|
|
56
|
-
await expect(
|
|
57
|
-
Subscriber.fromConnectionString<TestMessage>(connectionStr),
|
|
58
|
-
).rejects.toThrow('Unsupported event subscriber type');
|
|
59
|
-
});
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
describe('fromConnection', () => {
|
|
63
|
-
it('should create Basic subscriber from Basic connection', async () => {
|
|
64
|
-
const connection = new BasicConnection();
|
|
65
|
-
await connection.connect();
|
|
66
|
-
|
|
67
|
-
const subscriber =
|
|
68
|
-
await Subscriber.fromConnection<TestMessage>(connection);
|
|
69
|
-
|
|
70
|
-
expect(subscriber).toBeInstanceOf(BasicSubscriber);
|
|
71
|
-
|
|
72
|
-
await connection.close();
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
it('should create SQS subscriber from SQS connection', async () => {
|
|
76
|
-
const connection = await SQSConnection.fromConnectionString(
|
|
77
|
-
'sqs://?queueUrl=https://sqs.us-east-1.amazonaws.com/123456789/test-queue®ion=us-east-1&endpoint=http://localhost:4566',
|
|
78
|
-
);
|
|
79
|
-
|
|
80
|
-
const subscriber =
|
|
81
|
-
await Subscriber.fromConnection<TestMessage>(connection);
|
|
82
|
-
|
|
83
|
-
expect(subscriber).toBeInstanceOf(SQSSubscriber);
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
it('should create SNS subscriber from SNS connection', async () => {
|
|
87
|
-
const connection = await SNSConnection.fromConnectionString(
|
|
88
|
-
'sns://?topicArn=arn:aws:sns:us-east-1:123456789:test-topic®ion=us-east-1&endpoint=http://localhost:4566&accessKeyId=test&secretAccessKey=test',
|
|
89
|
-
);
|
|
90
|
-
|
|
91
|
-
const subscriber =
|
|
92
|
-
await Subscriber.fromConnection<TestMessage>(connection);
|
|
93
|
-
|
|
94
|
-
expect(subscriber).toBeInstanceOf(SNSSubscriber);
|
|
95
|
-
|
|
96
|
-
await connection.close();
|
|
97
|
-
});
|
|
98
|
-
|
|
99
|
-
it('should throw error for unsupported connection type', async () => {
|
|
100
|
-
const fakeConnection = {
|
|
101
|
-
type: 'unsupported' as any,
|
|
102
|
-
};
|
|
103
|
-
|
|
104
|
-
await expect(
|
|
105
|
-
Subscriber.fromConnection<TestMessage>(fakeConnection as any),
|
|
106
|
-
).rejects.toThrow('Unsupported connection type');
|
|
107
|
-
});
|
|
108
|
-
});
|
|
109
|
-
});
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { EventEmitter } from 'node:events';
|
|
2
|
-
import type { EventConnection } from '../types';
|
|
3
|
-
import { EventPublisherType } from '../types';
|
|
4
|
-
|
|
5
|
-
export class BasicConnection implements EventConnection {
|
|
6
|
-
readonly type = EventPublisherType.Basic;
|
|
7
|
-
private emitter: EventEmitter;
|
|
8
|
-
private connected = false;
|
|
9
|
-
|
|
10
|
-
constructor() {
|
|
11
|
-
this.emitter = new EventEmitter();
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Create a BasicConnection from a connection string
|
|
16
|
-
* Format: basic://
|
|
17
|
-
*/
|
|
18
|
-
static async fromConnectionString(
|
|
19
|
-
_connectionString: string,
|
|
20
|
-
): Promise<BasicConnection> {
|
|
21
|
-
// Basic connection doesn't need any configuration
|
|
22
|
-
const connection = new BasicConnection();
|
|
23
|
-
await connection.connect();
|
|
24
|
-
return connection;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
async connect(): Promise<void> {
|
|
28
|
-
this.connected = true;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
async close(): Promise<void> {
|
|
32
|
-
this.emitter.removeAllListeners();
|
|
33
|
-
this.connected = false;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
isConnected(): boolean {
|
|
37
|
-
return this.connected;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Get the underlying EventEmitter
|
|
42
|
-
* Used by BasicPublisher and BasicSubscriber
|
|
43
|
-
*/
|
|
44
|
-
get eventEmitter(): EventEmitter {
|
|
45
|
-
return this.emitter;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { EventPublisher, PublishableMessage } from '../types';
|
|
2
|
-
import type { BasicConnection } from './BasicConnection';
|
|
3
|
-
|
|
4
|
-
export class BasicPublisher<TMessage extends PublishableMessage<string, any>>
|
|
5
|
-
implements EventPublisher<TMessage>
|
|
6
|
-
{
|
|
7
|
-
constructor(private connection: BasicConnection) {}
|
|
8
|
-
|
|
9
|
-
async publish(messages: TMessage[]) {
|
|
10
|
-
const emitter = this.connection.eventEmitter;
|
|
11
|
-
for (const message of messages) {
|
|
12
|
-
emitter.emit(message.type, message);
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type { EventSubscriber, PublishableMessage } from '../types';
|
|
2
|
-
import type { BasicConnection } from './BasicConnection';
|
|
3
|
-
|
|
4
|
-
export class BasicSubscriber<TMessage extends PublishableMessage<string, any>>
|
|
5
|
-
implements EventSubscriber<TMessage>
|
|
6
|
-
{
|
|
7
|
-
constructor(private connection: BasicConnection) {}
|
|
8
|
-
|
|
9
|
-
async subscribe(
|
|
10
|
-
messages: TMessage['type'][],
|
|
11
|
-
listener: (payload: TMessage) => Promise<void>,
|
|
12
|
-
): Promise<void> {
|
|
13
|
-
const emitter = this.connection.eventEmitter;
|
|
14
|
-
|
|
15
|
-
for (const messageType of messages) {
|
|
16
|
-
emitter.on(messageType, (message: TMessage) => {
|
|
17
|
-
listener(message).catch((_error) => {});
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
}
|
|
@@ -1,166 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from 'vitest';
|
|
2
|
-
import type { PublishableMessage } from '../../types';
|
|
3
|
-
import { BasicConnection } from '../BasicConnection';
|
|
4
|
-
import { BasicPublisher } from '../BasicPublisher';
|
|
5
|
-
import { BasicSubscriber } from '../BasicSubscriber';
|
|
6
|
-
|
|
7
|
-
type TestMessage = PublishableMessage<'user.created' | 'user.updated', any>;
|
|
8
|
-
|
|
9
|
-
describe('BasicSubscriber', () => {
|
|
10
|
-
it('should receive published messages', async () => {
|
|
11
|
-
const connection = new BasicConnection();
|
|
12
|
-
await connection.connect();
|
|
13
|
-
|
|
14
|
-
const publisher = new BasicPublisher<TestMessage>(connection);
|
|
15
|
-
const subscriber = new BasicSubscriber<TestMessage>(connection);
|
|
16
|
-
|
|
17
|
-
const receivedMessages: TestMessage[] = [];
|
|
18
|
-
|
|
19
|
-
await subscriber.subscribe(['user.created'], async (message) => {
|
|
20
|
-
receivedMessages.push(message);
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
await publisher.publish([
|
|
24
|
-
{ type: 'user.created', payload: { userId: '123' } },
|
|
25
|
-
]);
|
|
26
|
-
|
|
27
|
-
// Give event emitter time to process
|
|
28
|
-
await new Promise((resolve) => setTimeout(resolve, 10));
|
|
29
|
-
|
|
30
|
-
expect(receivedMessages).toHaveLength(1);
|
|
31
|
-
expect(receivedMessages[0]).toEqual({
|
|
32
|
-
type: 'user.created',
|
|
33
|
-
payload: { userId: '123' },
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
await connection.close();
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
it('should receive multiple message types', async () => {
|
|
40
|
-
const connection = new BasicConnection();
|
|
41
|
-
await connection.connect();
|
|
42
|
-
|
|
43
|
-
const publisher = new BasicPublisher<TestMessage>(connection);
|
|
44
|
-
const subscriber = new BasicSubscriber<TestMessage>(connection);
|
|
45
|
-
|
|
46
|
-
const receivedMessages: TestMessage[] = [];
|
|
47
|
-
|
|
48
|
-
await subscriber.subscribe(
|
|
49
|
-
['user.created', 'user.updated'],
|
|
50
|
-
async (message) => {
|
|
51
|
-
receivedMessages.push(message);
|
|
52
|
-
},
|
|
53
|
-
);
|
|
54
|
-
|
|
55
|
-
await publisher.publish([
|
|
56
|
-
{ type: 'user.created', payload: { userId: '1' } },
|
|
57
|
-
{ type: 'user.updated', payload: { userId: '2' } },
|
|
58
|
-
{ type: 'user.created', payload: { userId: '3' } },
|
|
59
|
-
]);
|
|
60
|
-
|
|
61
|
-
// Give event emitter time to process
|
|
62
|
-
await new Promise((resolve) => setTimeout(resolve, 10));
|
|
63
|
-
|
|
64
|
-
expect(receivedMessages).toHaveLength(3);
|
|
65
|
-
expect(receivedMessages[0].type).toBe('user.created');
|
|
66
|
-
expect(receivedMessages[1].type).toBe('user.updated');
|
|
67
|
-
expect(receivedMessages[2].type).toBe('user.created');
|
|
68
|
-
|
|
69
|
-
await connection.close();
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
it('should only receive subscribed message types', async () => {
|
|
73
|
-
const connection = new BasicConnection();
|
|
74
|
-
await connection.connect();
|
|
75
|
-
|
|
76
|
-
const publisher = new BasicPublisher<TestMessage>(connection);
|
|
77
|
-
const subscriber = new BasicSubscriber<TestMessage>(connection);
|
|
78
|
-
|
|
79
|
-
const receivedMessages: TestMessage[] = [];
|
|
80
|
-
|
|
81
|
-
// Only subscribe to user.created
|
|
82
|
-
await subscriber.subscribe(['user.created'], async (message) => {
|
|
83
|
-
receivedMessages.push(message);
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
await publisher.publish([
|
|
87
|
-
{ type: 'user.created', payload: { userId: '1' } },
|
|
88
|
-
{ type: 'user.updated', payload: { userId: '2' } },
|
|
89
|
-
{ type: 'user.created', payload: { userId: '3' } },
|
|
90
|
-
]);
|
|
91
|
-
|
|
92
|
-
// Give event emitter time to process
|
|
93
|
-
await new Promise((resolve) => setTimeout(resolve, 10));
|
|
94
|
-
|
|
95
|
-
expect(receivedMessages).toHaveLength(2);
|
|
96
|
-
expect(receivedMessages.every((m) => m.type === 'user.created')).toBe(true);
|
|
97
|
-
|
|
98
|
-
await connection.close();
|
|
99
|
-
});
|
|
100
|
-
|
|
101
|
-
it('should handle multiple subscribers on same connection', async () => {
|
|
102
|
-
const connection = new BasicConnection();
|
|
103
|
-
await connection.connect();
|
|
104
|
-
|
|
105
|
-
const publisher = new BasicPublisher<TestMessage>(connection);
|
|
106
|
-
const subscriber1 = new BasicSubscriber<TestMessage>(connection);
|
|
107
|
-
const subscriber2 = new BasicSubscriber<TestMessage>(connection);
|
|
108
|
-
|
|
109
|
-
const messages1: TestMessage[] = [];
|
|
110
|
-
const messages2: TestMessage[] = [];
|
|
111
|
-
|
|
112
|
-
await subscriber1.subscribe(['user.created'], async (message) => {
|
|
113
|
-
messages1.push(message);
|
|
114
|
-
});
|
|
115
|
-
|
|
116
|
-
await subscriber2.subscribe(['user.created'], async (message) => {
|
|
117
|
-
messages2.push(message);
|
|
118
|
-
});
|
|
119
|
-
|
|
120
|
-
await publisher.publish([
|
|
121
|
-
{ type: 'user.created', payload: { userId: '123' } },
|
|
122
|
-
]);
|
|
123
|
-
|
|
124
|
-
// Give event emitter time to process
|
|
125
|
-
await new Promise((resolve) => setTimeout(resolve, 10));
|
|
126
|
-
|
|
127
|
-
// Both subscribers should receive the message
|
|
128
|
-
expect(messages1).toHaveLength(1);
|
|
129
|
-
expect(messages2).toHaveLength(1);
|
|
130
|
-
|
|
131
|
-
await connection.close();
|
|
132
|
-
});
|
|
133
|
-
|
|
134
|
-
it('should handle async listener errors gracefully', async () => {
|
|
135
|
-
const connection = new BasicConnection();
|
|
136
|
-
await connection.connect();
|
|
137
|
-
|
|
138
|
-
const publisher = new BasicPublisher<TestMessage>(connection);
|
|
139
|
-
const subscriber = new BasicSubscriber<TestMessage>(connection);
|
|
140
|
-
|
|
141
|
-
const receivedMessages: TestMessage[] = [];
|
|
142
|
-
|
|
143
|
-
await subscriber.subscribe(['user.created'], async (message) => {
|
|
144
|
-
if (message.payload.userId === '2') {
|
|
145
|
-
throw new Error('Test error');
|
|
146
|
-
}
|
|
147
|
-
receivedMessages.push(message);
|
|
148
|
-
});
|
|
149
|
-
|
|
150
|
-
await publisher.publish([
|
|
151
|
-
{ type: 'user.created', payload: { userId: '1' } },
|
|
152
|
-
{ type: 'user.created', payload: { userId: '2' } },
|
|
153
|
-
{ type: 'user.created', payload: { userId: '3' } },
|
|
154
|
-
]);
|
|
155
|
-
|
|
156
|
-
// Give event emitter time to process
|
|
157
|
-
await new Promise((resolve) => setTimeout(resolve, 10));
|
|
158
|
-
|
|
159
|
-
// Should receive messages 1 and 3 (2 throws error)
|
|
160
|
-
expect(receivedMessages).toHaveLength(2);
|
|
161
|
-
expect(receivedMessages[0].payload.userId).toBe('1');
|
|
162
|
-
expect(receivedMessages[1].payload.userId).toBe('3');
|
|
163
|
-
|
|
164
|
-
await connection.close();
|
|
165
|
-
});
|
|
166
|
-
});
|
package/src/basic/index.ts
DELETED
package/src/index.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
// Generic types and interfaces
|
|
2
|
-
|
|
3
|
-
export { EventConnectionFactory } from './EventConnection';
|
|
4
|
-
export type { EventPublisherConnectionString } from './Publisher';
|
|
5
|
-
|
|
6
|
-
// Generic factories
|
|
7
|
-
export { Publisher } from './Publisher';
|
|
8
|
-
export type { EventSubscriberConnectionString } from './Subscriber';
|
|
9
|
-
|
|
10
|
-
export { Subscriber } from './Subscriber';
|
|
11
|
-
export type {
|
|
12
|
-
EventConnection,
|
|
13
|
-
EventPublisher,
|
|
14
|
-
EventSubscriber,
|
|
15
|
-
ExtractPublisherMessage,
|
|
16
|
-
MappedEvent,
|
|
17
|
-
PublishableMessage,
|
|
18
|
-
} from './types';
|
|
19
|
-
export { EventPublisherType } from './types';
|
|
20
|
-
|
|
21
|
-
// Specific integrations should be imported via subpaths:
|
|
22
|
-
// - @geekmidas/events/basic
|
|
23
|
-
// - @geekmidas/events/rabbitmq
|
|
24
|
-
// - @geekmidas/events/sqs
|
|
25
|
-
// - @geekmidas/events/sns
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import { PgBoss } from 'pg-boss';
|
|
2
|
-
import type { EventConnection } from '../types';
|
|
3
|
-
import { EventPublisherType } from '../types';
|
|
4
|
-
|
|
5
|
-
export interface PgBossConnectionConfig {
|
|
6
|
-
connectionString: string;
|
|
7
|
-
schema?: string;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export class PgBossConnection implements EventConnection {
|
|
11
|
-
readonly type = EventPublisherType.PgBoss;
|
|
12
|
-
private boss?: PgBoss;
|
|
13
|
-
private connecting?: Promise<void>;
|
|
14
|
-
|
|
15
|
-
constructor(private config: PgBossConnectionConfig) {}
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Create a PgBossConnection from a connection string.
|
|
19
|
-
* Format: pgboss://user:pass@host:5432/database?schema=pgboss
|
|
20
|
-
*/
|
|
21
|
-
static async fromConnectionString(
|
|
22
|
-
connectionString: string,
|
|
23
|
-
): Promise<PgBossConnection> {
|
|
24
|
-
const url = new URL(connectionString);
|
|
25
|
-
const params = url.searchParams;
|
|
26
|
-
|
|
27
|
-
const postgresUrl = `postgres://${url.username ? `${url.username}:${url.password}@` : ''}${url.host}${url.pathname}`;
|
|
28
|
-
|
|
29
|
-
const config: PgBossConnectionConfig = {
|
|
30
|
-
connectionString: postgresUrl,
|
|
31
|
-
schema: params.get('schema') || undefined,
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
const connection = new PgBossConnection(config);
|
|
35
|
-
await connection.connect();
|
|
36
|
-
return connection;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
async connect(): Promise<void> {
|
|
40
|
-
if (this.boss) return;
|
|
41
|
-
|
|
42
|
-
if (this.connecting) {
|
|
43
|
-
await this.connecting;
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
this.connecting = (async () => {
|
|
48
|
-
try {
|
|
49
|
-
const boss = new PgBoss({
|
|
50
|
-
connectionString: this.config.connectionString,
|
|
51
|
-
...(this.config.schema && { schema: this.config.schema }),
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
await boss.start();
|
|
55
|
-
this.boss = boss;
|
|
56
|
-
} catch (error) {
|
|
57
|
-
this.cleanup();
|
|
58
|
-
throw error;
|
|
59
|
-
}
|
|
60
|
-
})();
|
|
61
|
-
|
|
62
|
-
await this.connecting;
|
|
63
|
-
this.connecting = undefined;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
async close(): Promise<void> {
|
|
67
|
-
try {
|
|
68
|
-
await this.boss?.stop({ graceful: true });
|
|
69
|
-
} catch {
|
|
70
|
-
// Ignore errors during close
|
|
71
|
-
} finally {
|
|
72
|
-
this.cleanup();
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
isConnected(): boolean {
|
|
77
|
-
return !!this.boss;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
private cleanup(): void {
|
|
81
|
-
this.boss = undefined;
|
|
82
|
-
this.connecting = undefined;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* Get the underlying pg-boss instance for publishing/subscribing
|
|
87
|
-
*/
|
|
88
|
-
get instance(): PgBoss | undefined {
|
|
89
|
-
return this.boss;
|
|
90
|
-
}
|
|
91
|
-
}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import type { EventPublisher, PublishableMessage } from '../types';
|
|
2
|
-
import type { PgBossConnection } from './PgBossConnection';
|
|
3
|
-
|
|
4
|
-
export class PgBossPublisher<TMessage extends PublishableMessage<string, any>>
|
|
5
|
-
implements EventPublisher<TMessage>
|
|
6
|
-
{
|
|
7
|
-
constructor(private connection: PgBossConnection) {}
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Create a PgBossPublisher from a connection string.
|
|
11
|
-
* Format: pgboss://user:pass@host:5432/database?schema=pgboss
|
|
12
|
-
*/
|
|
13
|
-
static async fromConnectionString<
|
|
14
|
-
TMessage extends PublishableMessage<string, any>,
|
|
15
|
-
>(connectionString: string): Promise<PgBossPublisher<TMessage>> {
|
|
16
|
-
const { PgBossConnection } = await import('./PgBossConnection');
|
|
17
|
-
const connection =
|
|
18
|
-
await PgBossConnection.fromConnectionString(connectionString);
|
|
19
|
-
return new PgBossPublisher<TMessage>(connection);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
async publish(messages: TMessage[]): Promise<void> {
|
|
23
|
-
if (!this.connection.isConnected()) {
|
|
24
|
-
await this.connection.connect();
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
const boss = this.connection.instance;
|
|
28
|
-
if (!boss) {
|
|
29
|
-
throw new Error('PgBoss instance not initialized');
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
// Group jobs by queue name (v11+ requires per-queue insert calls)
|
|
33
|
-
const groups = new Map<string, { data: TMessage['payload'] }[]>();
|
|
34
|
-
for (const m of messages) {
|
|
35
|
-
const list = groups.get(m.type) ?? [];
|
|
36
|
-
list.push({ data: m.payload });
|
|
37
|
-
groups.set(m.type, list);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
for (const [name, jobs] of groups) {
|
|
41
|
-
await boss.createQueue(name);
|
|
42
|
-
await boss.insert(name, jobs);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
async close(): Promise<void> {
|
|
47
|
-
// Publisher doesn't own the connection
|
|
48
|
-
}
|
|
49
|
-
}
|