@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
package/dist/sns/index.cjs
CHANGED
|
@@ -1,552 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
const
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
let _aws_sdk_client_sns = require("@aws-sdk/client-sns");
|
|
8
|
-
let node_crypto = require("node:crypto");
|
|
9
|
-
//#region src/sns/SNSConnection.ts
|
|
10
|
-
var SNSConnection_exports = /* @__PURE__ */ require_rolldown_runtime.__exportAll({ SNSConnection: () => SNSConnection });
|
|
11
|
-
var SNSConnection = class SNSConnection {
|
|
12
|
-
type = "sns";
|
|
13
|
-
client;
|
|
14
|
-
connected = false;
|
|
15
|
-
config;
|
|
16
|
-
constructor(config) {
|
|
17
|
-
this.config = config;
|
|
18
|
-
const clientConfig = {
|
|
19
|
-
region: config.region,
|
|
20
|
-
endpoint: config.endpoint,
|
|
21
|
-
credentials: config.credentials
|
|
22
|
-
};
|
|
23
|
-
this.client = new _aws_sdk_client_sns.SNSClient(clientConfig);
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Create an SNSConnection from a connection string
|
|
27
|
-
* Format: sns://?topicArn=arn:aws:sns:region:account:topic®ion=us-east-1&endpoint=http://localhost:4566
|
|
28
|
-
*/
|
|
29
|
-
static async fromConnectionString(connectionString) {
|
|
30
|
-
const { topicArn, region, endpoint } = require_sns_snsUrl.parse(connectionString);
|
|
31
|
-
const params = new URL(connectionString).searchParams;
|
|
32
|
-
const config = {
|
|
33
|
-
topicArn,
|
|
34
|
-
region,
|
|
35
|
-
endpoint
|
|
36
|
-
};
|
|
37
|
-
const accessKeyId = params.get("accessKeyId");
|
|
38
|
-
const secretAccessKey = params.get("secretAccessKey");
|
|
39
|
-
if (accessKeyId && secretAccessKey) config.credentials = {
|
|
40
|
-
accessKeyId,
|
|
41
|
-
secretAccessKey,
|
|
42
|
-
sessionToken: params.get("sessionToken") || void 0
|
|
43
|
-
};
|
|
44
|
-
const connection = new SNSConnection(config);
|
|
45
|
-
await connection.connect();
|
|
46
|
-
return connection;
|
|
47
|
-
}
|
|
48
|
-
async connect() {
|
|
49
|
-
this.connected = true;
|
|
50
|
-
}
|
|
51
|
-
async close() {
|
|
52
|
-
this.client.destroy();
|
|
53
|
-
this.connected = false;
|
|
54
|
-
}
|
|
55
|
-
isConnected() {
|
|
56
|
-
return this.connected;
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* Get the underlying SNS client
|
|
60
|
-
*/
|
|
61
|
-
get snsClient() {
|
|
62
|
-
return this.client;
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* Get the topic ARN for this connection
|
|
66
|
-
*/
|
|
67
|
-
get topicArn() {
|
|
68
|
-
return this.config.topicArn;
|
|
69
|
-
}
|
|
70
|
-
};
|
|
71
|
-
//#endregion
|
|
72
|
-
//#region src/sns/SNSPublisher.ts
|
|
73
|
-
var SNSPublisher = class SNSPublisher {
|
|
74
|
-
connection;
|
|
75
|
-
constructor(connection, _options = {}) {
|
|
76
|
-
this.connection = connection;
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* Create an SNSPublisher from a connection string
|
|
80
|
-
* Format: sns://?topicArn=arn:aws:sns:region:account:topic®ion=us-east-1&endpoint=http://localhost:4566
|
|
81
|
-
*/
|
|
82
|
-
static async fromConnectionString(connectionString) {
|
|
83
|
-
const { SNSConnection } = await Promise.resolve().then(() => SNSConnection_exports);
|
|
84
|
-
const connection = await SNSConnection.fromConnectionString(connectionString);
|
|
85
|
-
return new SNSPublisher(connection);
|
|
86
|
-
}
|
|
87
|
-
async publish(messages) {
|
|
88
|
-
if (messages.length === 0) return;
|
|
89
|
-
if (!this.connection.isConnected()) await this.connection.connect();
|
|
90
|
-
const topicArn = this.connection.topicArn;
|
|
91
|
-
const destination = topicArn.split(":").pop() ?? topicArn;
|
|
92
|
-
await require_telemetry.publishTraced(messages, (message) => ({
|
|
93
|
-
system: "aws_sns",
|
|
94
|
-
destination,
|
|
95
|
-
type: message.type
|
|
96
|
-
}), (carriers) => Promise.all(messages.map((message, i) => this.publishMessage(message, carriers[i]))));
|
|
97
|
-
}
|
|
98
|
-
async publishMessage(message, carrier) {
|
|
99
|
-
const command = new _aws_sdk_client_sns.PublishCommand({
|
|
100
|
-
TopicArn: this.connection.topicArn,
|
|
101
|
-
Message: JSON.stringify({
|
|
102
|
-
type: message.type,
|
|
103
|
-
payload: message.payload
|
|
104
|
-
}),
|
|
105
|
-
MessageAttributes: {
|
|
106
|
-
type: {
|
|
107
|
-
DataType: "String",
|
|
108
|
-
StringValue: message.type
|
|
109
|
-
},
|
|
110
|
-
...require_telemetry.carrierAsAttributes(carrier)
|
|
111
|
-
}
|
|
112
|
-
});
|
|
113
|
-
await this.connection.snsClient.send(command);
|
|
114
|
-
}
|
|
115
|
-
async close() {}
|
|
116
|
-
};
|
|
117
|
-
//#endregion
|
|
118
|
-
//#region src/sns/SNSSubscriber.ts
|
|
119
|
-
/**
|
|
120
|
-
* SNS Subscriber - receives push-based messages from SNS via SQS queue
|
|
121
|
-
*
|
|
122
|
-
* Architecture:
|
|
123
|
-
* SNS Topic → (push) → SQS Queue → Subscriber
|
|
124
|
-
*
|
|
125
|
-
* This subscriber automatically:
|
|
126
|
-
* 1. Creates an SQS queue (or uses existing one)
|
|
127
|
-
* 2. Subscribes the queue to the SNS topic
|
|
128
|
-
* 3. Receives messages pushed from SNS to the queue
|
|
129
|
-
* 4. Filters messages by topic ARN and message type
|
|
130
|
-
* 5. Processes and acknowledges messages
|
|
131
|
-
*
|
|
132
|
-
* Note: While SQS long-polling is used internally to receive messages,
|
|
133
|
-
* this is an implementation detail of the SNS push delivery mechanism.
|
|
134
|
-
* Messages are pushed from SNS to SQS, and we receive those pushed messages.
|
|
135
|
-
*/
|
|
136
|
-
var SNSSubscriber = class SNSSubscriber {
|
|
137
|
-
connection;
|
|
138
|
-
sqsClient;
|
|
139
|
-
queueUrl;
|
|
140
|
-
queueArn;
|
|
141
|
-
subscriptionArn;
|
|
142
|
-
sqsSubscriber;
|
|
143
|
-
options;
|
|
144
|
-
constructor(connection, options = {}) {
|
|
145
|
-
this.connection = connection;
|
|
146
|
-
this.options = {
|
|
147
|
-
queueName: options.queueName || `sns-sub-${Date.now()}-${Math.random().toString(36).substring(7)}`,
|
|
148
|
-
createQueue: options.createQueue ?? true,
|
|
149
|
-
deleteQueueOnClose: options.deleteQueueOnClose ?? !options.queueName,
|
|
150
|
-
waitTimeSeconds: options.waitTimeSeconds ?? 20,
|
|
151
|
-
maxMessages: options.maxMessages ?? 10
|
|
152
|
-
};
|
|
153
|
-
this.sqsClient = new _aws_sdk_client_sqs.SQSClient({
|
|
154
|
-
region: this.connection.config.region,
|
|
155
|
-
endpoint: this.connection.config.endpoint,
|
|
156
|
-
credentials: this.connection.config.credentials
|
|
157
|
-
});
|
|
158
|
-
}
|
|
159
|
-
/**
|
|
160
|
-
* Create an SNSSubscriber from a connection string
|
|
161
|
-
* Format: sns://?topicArn=...&queueName=myqueue®ion=us-east-1
|
|
162
|
-
*/
|
|
163
|
-
static async fromConnectionString(connectionString) {
|
|
164
|
-
const params = new URL(connectionString).searchParams;
|
|
165
|
-
const { SNSConnection } = await Promise.resolve().then(() => SNSConnection_exports);
|
|
166
|
-
const connection = await SNSConnection.fromConnectionString(connectionString);
|
|
167
|
-
const options = {
|
|
168
|
-
queueName: params.get("queueName") || void 0,
|
|
169
|
-
createQueue: params.get("createQueue") !== "false",
|
|
170
|
-
deleteQueueOnClose: params.get("deleteQueueOnClose") === "true",
|
|
171
|
-
waitTimeSeconds: params.get("waitTimeSeconds") ? Number.parseInt(params.get("waitTimeSeconds"), 10) : void 0
|
|
172
|
-
};
|
|
173
|
-
return new SNSSubscriber(connection, options);
|
|
174
|
-
}
|
|
175
|
-
async subscribe(messages, listener) {
|
|
176
|
-
await this.setupQueue();
|
|
177
|
-
await this.subscribeToTopic();
|
|
178
|
-
const sqsConnection = new require_SQSSubscriber.SQSConnection({
|
|
179
|
-
queueUrl: this.queueUrl,
|
|
180
|
-
region: this.connection.config.region,
|
|
181
|
-
endpoint: this.connection.config.endpoint,
|
|
182
|
-
credentials: this.connection.config.credentials
|
|
183
|
-
});
|
|
184
|
-
await sqsConnection.connect();
|
|
185
|
-
this.sqsSubscriber = new require_SQSSubscriber.SQSSubscriber(sqsConnection, {
|
|
186
|
-
waitTimeSeconds: this.options.waitTimeSeconds,
|
|
187
|
-
maxMessages: this.options.maxMessages,
|
|
188
|
-
expectedTopicArn: this.connection.topicArn
|
|
189
|
-
});
|
|
190
|
-
await this.sqsSubscriber.subscribe(messages, listener);
|
|
191
|
-
}
|
|
192
|
-
/**
|
|
193
|
-
* Stop receiving messages and clean up resources
|
|
194
|
-
*/
|
|
195
|
-
async stop() {
|
|
196
|
-
if (this.sqsSubscriber) this.sqsSubscriber.stop();
|
|
197
|
-
if (this.subscriptionArn) try {
|
|
198
|
-
const command = new _aws_sdk_client_sns.UnsubscribeCommand({ SubscriptionArn: this.subscriptionArn });
|
|
199
|
-
await this.connection.snsClient.send(command);
|
|
200
|
-
} catch (_error) {}
|
|
201
|
-
if (this.queueUrl && this.options.deleteQueueOnClose) try {
|
|
202
|
-
const command = new _aws_sdk_client_sqs.DeleteQueueCommand({ QueueUrl: this.queueUrl });
|
|
203
|
-
await this.sqsClient.send(command);
|
|
204
|
-
} catch (_error) {}
|
|
205
|
-
this.sqsClient.destroy();
|
|
206
|
-
}
|
|
207
|
-
async setupQueue() {
|
|
208
|
-
if (this.options.createQueue) {
|
|
209
|
-
const createCommand = new _aws_sdk_client_sqs.CreateQueueCommand({ QueueName: this.options.queueName });
|
|
210
|
-
const response = await this.sqsClient.send(createCommand);
|
|
211
|
-
this.queueUrl = response.QueueUrl;
|
|
212
|
-
} else throw new SnsQueueMissing(this.options.queueName);
|
|
213
|
-
const attrsCommand = new _aws_sdk_client_sqs.GetQueueAttributesCommand({
|
|
214
|
-
QueueUrl: this.queueUrl,
|
|
215
|
-
AttributeNames: ["QueueArn"]
|
|
216
|
-
});
|
|
217
|
-
const attrsResponse = await this.sqsClient.send(attrsCommand);
|
|
218
|
-
this.queueArn = attrsResponse.Attributes?.QueueArn;
|
|
219
|
-
await this.setQueuePolicy();
|
|
220
|
-
}
|
|
221
|
-
async setQueuePolicy() {
|
|
222
|
-
const policy = {
|
|
223
|
-
Version: "2012-10-17",
|
|
224
|
-
Statement: [{
|
|
225
|
-
Effect: "Allow",
|
|
226
|
-
Principal: "*",
|
|
227
|
-
Action: "SQS:SendMessage",
|
|
228
|
-
Resource: this.queueArn,
|
|
229
|
-
Condition: { ArnEquals: { "aws:SourceArn": this.connection.topicArn } }
|
|
230
|
-
}]
|
|
231
|
-
};
|
|
232
|
-
const command = new _aws_sdk_client_sqs.SetQueueAttributesCommand({
|
|
233
|
-
QueueUrl: this.queueUrl,
|
|
234
|
-
Attributes: { Policy: JSON.stringify(policy) }
|
|
235
|
-
});
|
|
236
|
-
await this.sqsClient.send(command);
|
|
237
|
-
}
|
|
238
|
-
async subscribeToTopic() {
|
|
239
|
-
const command = new _aws_sdk_client_sns.SubscribeCommand({
|
|
240
|
-
TopicArn: this.connection.topicArn,
|
|
241
|
-
Protocol: "sqs",
|
|
242
|
-
Endpoint: this.queueArn
|
|
243
|
-
});
|
|
244
|
-
const response = await this.connection.snsClient.send(command);
|
|
245
|
-
this.subscriptionArn = response.SubscriptionArn;
|
|
246
|
-
}
|
|
247
|
-
};
|
|
248
|
-
/**
|
|
249
|
-
* A subscriber asked to use a queue it may not create. The SQS queue behind an
|
|
250
|
-
* SNS subscription has to exist first, or `createQueue` has to allow it.
|
|
251
|
-
*/
|
|
252
|
-
var SnsQueueMissing = class extends Error {
|
|
253
|
-
queueName;
|
|
254
|
-
constructor(queueName) {
|
|
255
|
-
super(`The SNS subscriber's queue${queueName ? ` "${queueName}"` : ""} is not created here: pass createQueue: true, or create the queue first.`);
|
|
256
|
-
this.queueName = queueName;
|
|
257
|
-
this.name = "SnsQueueMissing";
|
|
258
|
-
}
|
|
259
|
-
};
|
|
260
|
-
//#endregion
|
|
261
|
-
//#region src/sns/driver.ts
|
|
262
|
-
/**
|
|
263
|
-
* `sns://` — an SNS topic, consumed through an SQS queue subscribed to it.
|
|
264
|
-
* Register it with `registerEventsDriver(snsEventsDriver)`; an AWS entry
|
|
265
|
-
* registers `sqsEventsDriver` beside it.
|
|
266
|
-
*/
|
|
267
|
-
const snsEventsDriver = {
|
|
268
|
-
scheme: "sns",
|
|
269
|
-
connect: (url) => SNSConnection.fromConnectionString(url),
|
|
270
|
-
publisher: (url) => SNSPublisher.fromConnectionString(url),
|
|
271
|
-
publisherFor: (connection) => new SNSPublisher(connection),
|
|
272
|
-
subscriber: (url) => SNSSubscriber.fromConnectionString(url),
|
|
273
|
-
subscriberFor: (connection) => new SNSSubscriber(connection)
|
|
274
|
-
};
|
|
275
|
-
//#endregion
|
|
276
|
-
//#region src/sns/push.ts
|
|
277
|
-
/** The fields signed, in the order SNS signs them, per message type. */
|
|
278
|
-
const SIGNED_FIELDS = {
|
|
279
|
-
Notification: [
|
|
280
|
-
"Message",
|
|
281
|
-
"MessageId",
|
|
282
|
-
"Subject",
|
|
283
|
-
"Timestamp",
|
|
284
|
-
"TopicArn",
|
|
285
|
-
"Type"
|
|
286
|
-
],
|
|
287
|
-
SubscriptionConfirmation: [
|
|
288
|
-
"Message",
|
|
289
|
-
"MessageId",
|
|
290
|
-
"SubscribeURL",
|
|
291
|
-
"Timestamp",
|
|
292
|
-
"Token",
|
|
293
|
-
"TopicArn",
|
|
294
|
-
"Type"
|
|
295
|
-
],
|
|
296
|
-
UnsubscribeConfirmation: [
|
|
297
|
-
"Message",
|
|
298
|
-
"MessageId",
|
|
299
|
-
"SubscribeURL",
|
|
300
|
-
"Timestamp",
|
|
301
|
-
"Token",
|
|
302
|
-
"TopicArn",
|
|
303
|
-
"Type"
|
|
304
|
-
]
|
|
305
|
-
};
|
|
306
|
-
/**
|
|
307
|
-
* Where SNS serves its signing certificates. Anywhere else is a certificate
|
|
308
|
-
* the sender chose, which would let the sender sign its own forgeries.
|
|
309
|
-
*/
|
|
310
|
-
const SNS_CERTIFICATE_HOST = /^sns\.[a-z0-9-]+\.amazonaws\.com(\.cn)?$/;
|
|
311
|
-
const certificates = /* @__PURE__ */ new Map();
|
|
312
|
-
async function defaultFetchCertificate(url) {
|
|
313
|
-
const response = await fetch(url);
|
|
314
|
-
if (!response.ok) throw new SnsCertificateUnavailable(url, response.status);
|
|
315
|
-
return response.text();
|
|
316
|
-
}
|
|
317
|
-
/**
|
|
318
|
-
* A URL, or undefined for a value that is not one at all — what an emulator
|
|
319
|
-
* sends — so it is untrusted rather than a crash. (`URL.parse` is Node 22.1+.)
|
|
320
|
-
*/
|
|
321
|
-
function parseUrl(value) {
|
|
322
|
-
try {
|
|
323
|
-
return new URL(String(value));
|
|
324
|
-
} catch {
|
|
325
|
-
return;
|
|
326
|
-
}
|
|
327
|
-
}
|
|
328
|
-
/** The string SNS signed for this message. */
|
|
329
|
-
function snsStringToSign(message) {
|
|
330
|
-
const fields = SIGNED_FIELDS[message.Type];
|
|
331
|
-
if (!fields) throw new SnsMessageTypeUnknown(String(message.Type));
|
|
332
|
-
return fields.filter((field) => message[field] !== void 0).map((field) => `${field}\n${message[field]}\n`).join("");
|
|
333
|
-
}
|
|
334
|
-
/**
|
|
335
|
-
* Check that SNS sent this message: the certificate is SNS's own, and the
|
|
336
|
-
* signature over the message's signed fields verifies against it.
|
|
337
|
-
*
|
|
338
|
-
* Throws rather than returning false, so a caller cannot forget to look.
|
|
339
|
-
*/
|
|
340
|
-
async function verifySnsMessage(message, options = {}) {
|
|
341
|
-
const url = parseUrl(message.SigningCertURL);
|
|
342
|
-
if (url?.protocol !== "https:" || !SNS_CERTIFICATE_HOST.test(url.hostname)) throw new SnsCertificateUntrusted(message.SigningCertURL);
|
|
343
|
-
const algorithm = message.SignatureVersion === "1" ? "RSA-SHA1" : message.SignatureVersion === "2" ? "RSA-SHA256" : void 0;
|
|
344
|
-
if (!algorithm) throw new SnsSignatureVersionUnknown(message.SignatureVersion);
|
|
345
|
-
const fetchCertificate = options.fetchCertificate ?? defaultFetchCertificate;
|
|
346
|
-
let certificate = certificates.get(message.SigningCertURL);
|
|
347
|
-
if (!certificate || options.fetchCertificate) {
|
|
348
|
-
certificate = fetchCertificate(message.SigningCertURL);
|
|
349
|
-
if (!options.fetchCertificate) {
|
|
350
|
-
certificates.set(message.SigningCertURL, certificate);
|
|
351
|
-
certificate.catch(() => certificates.delete(message.SigningCertURL));
|
|
352
|
-
}
|
|
353
|
-
}
|
|
354
|
-
const verifier = (0, node_crypto.createVerify)(algorithm);
|
|
355
|
-
verifier.update(snsStringToSign(message), "utf8");
|
|
356
|
-
if (!verifier.verify(await certificate, message.Signature, "base64")) throw new SnsSignatureInvalid(message.MessageId, message.TopicArn);
|
|
357
|
-
}
|
|
358
|
-
/**
|
|
359
|
-
* Confirm a subscription by visiting the URL SNS sent. Until this happens SNS
|
|
360
|
-
* delivers nothing to the endpoint.
|
|
361
|
-
*/
|
|
362
|
-
async function confirmSnsSubscription(message, request = fetch) {
|
|
363
|
-
if (message.Type !== "SubscriptionConfirmation" || !message.SubscribeURL) throw new SnsNotAConfirmation(message.Type);
|
|
364
|
-
const response = await request(message.SubscribeURL);
|
|
365
|
-
if (!response.ok) throw new SnsConfirmationFailed(message.TopicArn, response.status);
|
|
366
|
-
}
|
|
367
|
-
/**
|
|
368
|
-
* Subscribe an HTTP endpoint to the connection's topic, converging on one
|
|
369
|
-
* confirmed subscription with the filter asked for — so it is safe on every
|
|
370
|
-
* start:
|
|
371
|
-
*
|
|
372
|
-
* - **none yet** — subscribed; SNS sends a confirmation to the endpoint.
|
|
373
|
-
* - **confirmed** — its filter and dead-letter queue are brought up to date.
|
|
374
|
-
* Subscribing again with different attributes is an error on SNS, and the
|
|
375
|
-
* events a subscriber names change.
|
|
376
|
-
* - **stuck pending** — a confirmation that never landed (the endpoint was
|
|
377
|
-
* down, or answered wrong). Subscribing the same endpoint again is a no-op
|
|
378
|
-
* on an emulator, so it is dropped and subscribed afresh, which sends a new
|
|
379
|
-
* confirmation.
|
|
380
|
-
*/
|
|
381
|
-
async function subscribeHttpEndpoint(connection, options) {
|
|
382
|
-
const protocol = new URL(options.endpoint).protocol.replace(":", "");
|
|
383
|
-
if (protocol !== "http" && protocol !== "https") throw new SnsEndpointNotHttp(options.endpoint);
|
|
384
|
-
const attributes = {
|
|
385
|
-
FilterPolicyScope: "MessageAttributes",
|
|
386
|
-
FilterPolicy: JSON.stringify({ type: [...options.events] })
|
|
387
|
-
};
|
|
388
|
-
if (options.deadLetterQueueArn) attributes.RedrivePolicy = JSON.stringify({ deadLetterTargetArn: options.deadLetterQueueArn });
|
|
389
|
-
const client = connection.snsClient;
|
|
390
|
-
const existing = await existingSubscription(connection, options.endpoint);
|
|
391
|
-
if (existing) {
|
|
392
|
-
const { Attributes = {} } = await client.send(new _aws_sdk_client_sns.GetSubscriptionAttributesCommand({ SubscriptionArn: existing }));
|
|
393
|
-
if (Attributes.PendingConfirmation === "true") await client.send(new _aws_sdk_client_sns.UnsubscribeCommand({ SubscriptionArn: existing }));
|
|
394
|
-
else {
|
|
395
|
-
for (const [name, value] of Object.entries(attributes)) {
|
|
396
|
-
if (Attributes[name] === value) continue;
|
|
397
|
-
await client.send(new _aws_sdk_client_sns.SetSubscriptionAttributesCommand({
|
|
398
|
-
SubscriptionArn: existing,
|
|
399
|
-
AttributeName: name,
|
|
400
|
-
AttributeValue: value
|
|
401
|
-
}));
|
|
402
|
-
}
|
|
403
|
-
return existing;
|
|
404
|
-
}
|
|
405
|
-
}
|
|
406
|
-
const { SubscriptionArn } = await client.send(new _aws_sdk_client_sns.SubscribeCommand({
|
|
407
|
-
TopicArn: connection.topicArn,
|
|
408
|
-
Protocol: protocol,
|
|
409
|
-
Endpoint: options.endpoint,
|
|
410
|
-
Attributes: attributes,
|
|
411
|
-
ReturnSubscriptionArn: true
|
|
412
|
-
}));
|
|
413
|
-
return SubscriptionArn;
|
|
414
|
-
}
|
|
415
|
-
/**
|
|
416
|
-
* The ARN of the endpoint's subscription to the topic, if it has one SNS will
|
|
417
|
-
* name. (Real SNS lists a pending one as `PendingConfirmation`, with no ARN to
|
|
418
|
-
* act on — and resends its confirmation on a new Subscribe anyway.)
|
|
419
|
-
*/
|
|
420
|
-
async function existingSubscription(connection, endpoint) {
|
|
421
|
-
let NextToken;
|
|
422
|
-
do {
|
|
423
|
-
const page = await connection.snsClient.send(new _aws_sdk_client_sns.ListSubscriptionsByTopicCommand({
|
|
424
|
-
TopicArn: connection.topicArn,
|
|
425
|
-
NextToken
|
|
426
|
-
}));
|
|
427
|
-
const match = page.Subscriptions?.find((s) => s.Endpoint === endpoint && s.SubscriptionArn?.startsWith("arn:"));
|
|
428
|
-
if (match) return match.SubscriptionArn;
|
|
429
|
-
NextToken = page.NextToken;
|
|
430
|
-
} while (NextToken);
|
|
431
|
-
}
|
|
432
|
-
/**
|
|
433
|
-
* A pushed notification as the Lambda event SNS would have invoked a function
|
|
434
|
-
* with, so it can be handed to the same adaptor.
|
|
435
|
-
*/
|
|
436
|
-
function toSnsEvent(message, subscriptionArn = "") {
|
|
437
|
-
return { Records: [{
|
|
438
|
-
EventSource: "aws:sns",
|
|
439
|
-
EventVersion: "1.0",
|
|
440
|
-
EventSubscriptionArn: subscriptionArn,
|
|
441
|
-
Sns: {
|
|
442
|
-
Type: message.Type,
|
|
443
|
-
MessageId: message.MessageId,
|
|
444
|
-
TopicArn: message.TopicArn,
|
|
445
|
-
Subject: message.Subject ?? null,
|
|
446
|
-
Message: message.Message,
|
|
447
|
-
Timestamp: message.Timestamp,
|
|
448
|
-
SignatureVersion: message.SignatureVersion,
|
|
449
|
-
Signature: message.Signature,
|
|
450
|
-
SigningCertUrl: message.SigningCertURL,
|
|
451
|
-
UnsubscribeUrl: message.UnsubscribeURL ?? "",
|
|
452
|
-
MessageAttributes: message.MessageAttributes ?? {}
|
|
453
|
-
}
|
|
454
|
-
}] };
|
|
455
|
-
}
|
|
456
|
-
var SnsCertificateUntrusted = class extends Error {
|
|
457
|
-
url;
|
|
458
|
-
constructor(url) {
|
|
459
|
-
super(`The SNS message names a signing certificate at '${url}', which is not an https URL on sns.<region>.amazonaws.com. Only SNS can send to this endpoint; reject the request.`);
|
|
460
|
-
this.url = url;
|
|
461
|
-
this.name = "SnsCertificateUntrusted";
|
|
462
|
-
}
|
|
463
|
-
};
|
|
464
|
-
var SnsCertificateUnavailable = class extends Error {
|
|
465
|
-
url;
|
|
466
|
-
status;
|
|
467
|
-
constructor(url, status) {
|
|
468
|
-
super(`Fetching the SNS signing certificate at '${url}' answered ${status}. The message cannot be verified, so it is not handled; SNS will retry.`);
|
|
469
|
-
this.url = url;
|
|
470
|
-
this.status = status;
|
|
471
|
-
this.name = "SnsCertificateUnavailable";
|
|
472
|
-
}
|
|
473
|
-
};
|
|
474
|
-
var SnsSignatureVersionUnknown = class extends Error {
|
|
475
|
-
version;
|
|
476
|
-
constructor(version) {
|
|
477
|
-
super(`SNS signature version '${version}' is not one this endpoint verifies (it knows '1' and '2'). Reject the request.`);
|
|
478
|
-
this.version = version;
|
|
479
|
-
this.name = "SnsSignatureVersionUnknown";
|
|
480
|
-
}
|
|
481
|
-
};
|
|
482
|
-
var SnsSignatureInvalid = class extends Error {
|
|
483
|
-
messageId;
|
|
484
|
-
topicArn;
|
|
485
|
-
constructor(messageId, topicArn) {
|
|
486
|
-
super(`SNS message '${messageId}' from '${topicArn}' does not verify against its signing certificate. It was not sent by SNS, or was altered on the way; reject it.`);
|
|
487
|
-
this.messageId = messageId;
|
|
488
|
-
this.topicArn = topicArn;
|
|
489
|
-
this.name = "SnsSignatureInvalid";
|
|
490
|
-
}
|
|
491
|
-
};
|
|
492
|
-
var SnsMessageTypeUnknown = class extends Error {
|
|
493
|
-
type;
|
|
494
|
-
constructor(type) {
|
|
495
|
-
super(`'${type}' is not an SNS message type (Notification, SubscriptionConfirmation, UnsubscribeConfirmation). Reject it.`);
|
|
496
|
-
this.type = type;
|
|
497
|
-
this.name = "SnsMessageTypeUnknown";
|
|
498
|
-
}
|
|
499
|
-
};
|
|
500
|
-
var SnsNotAConfirmation = class extends Error {
|
|
501
|
-
type;
|
|
502
|
-
constructor(type) {
|
|
503
|
-
super(`Only a SubscriptionConfirmation carries a URL to confirm; this is a '${type}'.`);
|
|
504
|
-
this.type = type;
|
|
505
|
-
this.name = "SnsNotAConfirmation";
|
|
506
|
-
}
|
|
507
|
-
};
|
|
508
|
-
var SnsConfirmationFailed = class extends Error {
|
|
509
|
-
topicArn;
|
|
510
|
-
status;
|
|
511
|
-
constructor(topicArn, status) {
|
|
512
|
-
super(`Confirming the subscription to '${topicArn}' answered ${status}. SNS will deliver nothing until it is confirmed; it resends the confirmation, or subscribe the endpoint again.`);
|
|
513
|
-
this.topicArn = topicArn;
|
|
514
|
-
this.status = status;
|
|
515
|
-
this.name = "SnsConfirmationFailed";
|
|
516
|
-
}
|
|
517
|
-
};
|
|
518
|
-
var SnsEndpointNotHttp = class extends Error {
|
|
519
|
-
endpoint;
|
|
520
|
-
constructor(endpoint) {
|
|
521
|
-
super(`'${endpoint}' is not an http(s) URL. SNS pushes to an HTTP endpoint; subscribe a queue for anything else.`);
|
|
522
|
-
this.endpoint = endpoint;
|
|
523
|
-
this.name = "SnsEndpointNotHttp";
|
|
524
|
-
}
|
|
525
|
-
};
|
|
526
|
-
//#endregion
|
|
527
|
-
exports.SNSConnection = SNSConnection;
|
|
528
|
-
exports.SNSPublisher = SNSPublisher;
|
|
529
|
-
exports.SNSSubscriber = SNSSubscriber;
|
|
530
|
-
exports.SnsCertificateUnavailable = SnsCertificateUnavailable;
|
|
531
|
-
exports.SnsCertificateUntrusted = SnsCertificateUntrusted;
|
|
532
|
-
exports.SnsConfirmationFailed = SnsConfirmationFailed;
|
|
533
|
-
exports.SnsEndpointNotHttp = SnsEndpointNotHttp;
|
|
534
|
-
exports.SnsMessageTypeUnknown = SnsMessageTypeUnknown;
|
|
535
|
-
exports.SnsNotAConfirmation = SnsNotAConfirmation;
|
|
536
|
-
exports.SnsQueueMissing = SnsQueueMissing;
|
|
537
|
-
exports.SnsSignatureInvalid = SnsSignatureInvalid;
|
|
538
|
-
exports.SnsSignatureVersionUnknown = SnsSignatureVersionUnknown;
|
|
539
|
-
exports.confirmSnsSubscription = confirmSnsSubscription;
|
|
540
|
-
exports.snsEventsDriver = snsEventsDriver;
|
|
541
|
-
exports.snsStringToSign = snsStringToSign;
|
|
542
|
-
Object.defineProperty(exports, "snsUrl", {
|
|
543
|
-
enumerable: true,
|
|
544
|
-
get: function() {
|
|
545
|
-
return require_sns_snsUrl.snsUrl_exports;
|
|
546
|
-
}
|
|
547
|
-
});
|
|
548
|
-
exports.subscribeHttpEndpoint = subscribeHttpEndpoint;
|
|
549
|
-
exports.toSnsEvent = toSnsEvent;
|
|
550
|
-
exports.verifySnsMessage = verifySnsMessage;
|
|
1
|
+
require('../types-Byv8N9ma.cjs');
|
|
2
|
+
const require_SNSConnection = require('../SNSConnection-CAcbLQOy.cjs');
|
|
3
|
+
const require_SNSPublisher = require('../SNSPublisher-DV_8GGsi.cjs');
|
|
4
|
+
require('../SQSConnection-Y0mdVTcB.cjs');
|
|
5
|
+
require('../SQSSubscriber-C4UA2hKq.cjs');
|
|
6
|
+
const require_SNSSubscriber = require('../SNSSubscriber-ZE_-Hsps.cjs');
|
|
551
7
|
|
|
552
|
-
|
|
8
|
+
exports.SNSConnection = require_SNSConnection.SNSConnection;
|
|
9
|
+
exports.SNSPublisher = require_SNSPublisher.SNSPublisher;
|
|
10
|
+
exports.SNSSubscriber = require_SNSSubscriber.SNSSubscriber;
|