@geekmidas/constructs 10.0.0-alpha.5 → 10.0.0-alpha.50
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/README.md +223 -158
- package/dist/{Construct-BD5neF7w.mjs → Construct-BO1X-kt9.mjs} +32 -33
- package/dist/Construct-BO1X-kt9.mjs.map +1 -0
- package/dist/Construct-BQALFCh2.d.cts +230 -0
- package/dist/Construct-BQALFCh2.d.cts.map +1 -0
- package/dist/{Construct-CyS3RpTL.cjs → Construct-DmvXceVY.cjs} +52 -47
- package/dist/Construct-DmvXceVY.cjs.map +1 -0
- package/dist/Construct-QXnl3VqT.d.mts +230 -0
- package/dist/Construct-QXnl3VqT.d.mts.map +1 -0
- package/dist/{Cron-B2OFsfDM.d.cts → Cron-DI3nKoic.d.cts} +22 -8
- package/dist/Cron-DI3nKoic.d.cts.map +1 -0
- package/dist/{Cron-CqEbBbwH.d.mts → Cron-uYAHPnp7.d.mts} +22 -8
- package/dist/Cron-uYAHPnp7.d.mts.map +1 -0
- package/dist/CronBuilder-BoHzlWU_.cjs +121 -0
- package/dist/CronBuilder-BoHzlWU_.cjs.map +1 -0
- package/dist/CronBuilder-CCgt0wCE.mjs +109 -0
- package/dist/CronBuilder-CCgt0wCE.mjs.map +1 -0
- package/dist/CronBuilder-DaSUm2Na.d.mts +47 -0
- package/dist/CronBuilder-DaSUm2Na.d.mts.map +1 -0
- package/dist/CronBuilder-g1lZLWyG.d.cts +47 -0
- package/dist/CronBuilder-g1lZLWyG.d.cts.map +1 -0
- package/dist/{Endpoint-Dem2XyCu.d.mts → Endpoint-BkzU6nn1.d.cts} +70 -93
- package/dist/Endpoint-BkzU6nn1.d.cts.map +1 -0
- package/dist/{Endpoint-DrD8a1yH.d.cts → Endpoint-BpboleFh.d.mts} +71 -94
- package/dist/Endpoint-BpboleFh.d.mts.map +1 -0
- package/dist/{Endpoint-Dij_wOcc.mjs → Endpoint-CQ9RJ7p2.mjs} +130 -109
- package/dist/Endpoint-CQ9RJ7p2.mjs.map +1 -0
- package/dist/{Endpoint-DODn1RhN.cjs → Endpoint-DOi8c_Gy.cjs} +158 -131
- package/dist/Endpoint-DOi8c_Gy.cjs.map +1 -0
- package/dist/{index-B8g8POkr.d.cts → EndpointFactory-BZZOleQT.d.cts} +62 -132
- package/dist/EndpointFactory-BZZOleQT.d.cts.map +1 -0
- package/dist/{EndpointFactory-BHFMmFkV.cjs → EndpointFactory-Bo9lkMqB.cjs} +75 -110
- package/dist/EndpointFactory-Bo9lkMqB.cjs.map +1 -0
- package/dist/{EndpointFactory-b4ituq-s.mjs → EndpointFactory-DR1rebok.mjs} +39 -74
- package/dist/EndpointFactory-DR1rebok.mjs.map +1 -0
- package/dist/{index-DbKmfl-q.d.mts → EndpointFactory-DnNlYflU.d.mts} +63 -133
- package/dist/EndpointFactory-DnNlYflU.d.mts.map +1 -0
- package/dist/Function-DuqGcbOI.d.mts +76 -0
- package/dist/Function-DuqGcbOI.d.mts.map +1 -0
- package/dist/Function-Pu-1kKZz.d.cts +76 -0
- package/dist/Function-Pu-1kKZz.d.cts.map +1 -0
- package/dist/{HonoEndpointAdaptor-BM2jbWht.mjs → HonoEndpointAdaptor-BIS0O3M9.mjs} +41 -47
- package/dist/HonoEndpointAdaptor-BIS0O3M9.mjs.map +1 -0
- package/dist/{HonoEndpointAdaptor-De6IlBZe.cjs → HonoEndpointAdaptor-CMi0MJsF.cjs} +50 -53
- package/dist/HonoEndpointAdaptor-CMi0MJsF.cjs.map +1 -0
- package/dist/Queue-D5jcw0mu.cjs +109 -0
- package/dist/Queue-D5jcw0mu.cjs.map +1 -0
- package/dist/{Queue-D7ZuwBhy.d.cts → Queue-DlsHRzUp.d.mts} +48 -48
- package/dist/Queue-DlsHRzUp.d.mts.map +1 -0
- package/dist/{Queue-gVGfi2Yk.d.mts → Queue-HPyi0e1i.d.cts} +49 -49
- package/dist/Queue-HPyi0e1i.d.cts.map +1 -0
- package/dist/Queue-hwPN-t31.mjs +104 -0
- package/dist/Queue-hwPN-t31.mjs.map +1 -0
- package/dist/QueueBuilder-BFQn3OzZ.cjs +135 -0
- package/dist/QueueBuilder-BFQn3OzZ.cjs.map +1 -0
- package/dist/QueueBuilder-DCuYdjMw.mjs +118 -0
- package/dist/QueueBuilder-DCuYdjMw.mjs.map +1 -0
- package/dist/QueueBuilder-OSi6LkV9.d.cts +75 -0
- package/dist/QueueBuilder-OSi6LkV9.d.cts.map +1 -0
- package/dist/QueueBuilder-QHsnVt1P.d.mts +75 -0
- package/dist/QueueBuilder-QHsnVt1P.d.mts.map +1 -0
- package/dist/{Subscriber-2mEi0ImH.d.cts → Subscriber-Bpp02cGr.d.cts} +29 -20
- package/dist/Subscriber-Bpp02cGr.d.cts.map +1 -0
- package/dist/{Subscriber-xTJ9ayPN.d.mts → Subscriber-CtN9R48-.d.mts} +29 -20
- package/dist/Subscriber-CtN9R48-.d.mts.map +1 -0
- package/dist/{SubscriberBuilder-4OPehf2R.cjs → SubscriberBuilder-C2PwqwIl.cjs} +61 -36
- package/dist/SubscriberBuilder-C2PwqwIl.cjs.map +1 -0
- package/dist/SubscriberBuilder-CuCMFpYW.d.mts +67 -0
- package/dist/SubscriberBuilder-CuCMFpYW.d.mts.map +1 -0
- package/dist/{SubscriberBuilder-BjkbeT9l.mjs → SubscriberBuilder-DMFk_Ap1.mjs} +50 -24
- package/dist/SubscriberBuilder-DMFk_Ap1.mjs.map +1 -0
- package/dist/SubscriberBuilder-g3fAVWgs.d.cts +67 -0
- package/dist/SubscriberBuilder-g3fAVWgs.d.cts.map +1 -0
- package/dist/Topic-CkxOTrMv.cjs +104 -0
- package/dist/Topic-CkxOTrMv.cjs.map +1 -0
- package/dist/Topic-hPffOsot.mjs +99 -0
- package/dist/Topic-hPffOsot.mjs.map +1 -0
- package/dist/adaptors/aws.cjs +189 -110
- package/dist/adaptors/aws.cjs.map +1 -1
- package/dist/adaptors/aws.d.cts +81 -45
- package/dist/adaptors/aws.d.cts.map +1 -1
- package/dist/adaptors/aws.d.mts +82 -46
- package/dist/adaptors/aws.d.mts.map +1 -1
- package/dist/adaptors/aws.mjs +161 -85
- package/dist/adaptors/aws.mjs.map +1 -1
- package/dist/adaptors/hono.cjs +3 -10
- package/dist/adaptors/hono.d.cts +7 -16
- package/dist/adaptors/hono.d.cts.map +1 -1
- package/dist/adaptors/hono.d.mts +8 -17
- package/dist/adaptors/hono.d.mts.map +1 -1
- package/dist/adaptors/hono.mjs +2 -10
- package/dist/adaptors/testing.cjs +704 -90
- package/dist/adaptors/testing.cjs.map +1 -1
- package/dist/adaptors/testing.d.cts +325 -54
- package/dist/adaptors/testing.d.cts.map +1 -1
- package/dist/adaptors/testing.d.mts +325 -54
- package/dist/adaptors/testing.d.mts.map +1 -1
- package/dist/adaptors/testing.mjs +669 -71
- package/dist/adaptors/testing.mjs.map +1 -1
- package/dist/auth-3OAmK42n.d.cts +188 -0
- package/dist/auth-3OAmK42n.d.cts.map +1 -0
- package/dist/auth-BWbiewHa.d.mts +188 -0
- package/dist/auth-BWbiewHa.d.mts.map +1 -0
- package/dist/auth.cjs +171 -31
- package/dist/auth.cjs.map +1 -1
- package/dist/auth.d.cts +2 -108
- package/dist/auth.d.mts +2 -108
- package/dist/auth.mjs +160 -24
- package/dist/auth.mjs.map +1 -1
- package/dist/{cache-BrRz3fEB.d.mts → cache-CXh6GIgb.d.mts} +3 -6
- package/dist/cache-CXh6GIgb.d.mts.map +1 -0
- package/dist/{cache-BtZY_tHe.d.cts → cache-DnGDGly3.d.cts} +3 -6
- package/dist/cache-DnGDGly3.d.cts.map +1 -0
- package/dist/cache.cjs +68 -2
- package/dist/cache.cjs.map +1 -0
- package/dist/cache.d.cts +1 -2
- package/dist/cache.d.mts +1 -2
- package/dist/cache.mjs +67 -2
- package/dist/cache.mjs.map +1 -0
- package/dist/cipher-C1lEFX63.mjs +225 -0
- package/dist/cipher-C1lEFX63.mjs.map +1 -0
- package/dist/cipher-CVxfwLjk.cjs +332 -0
- package/dist/cipher-CVxfwLjk.cjs.map +1 -0
- package/dist/{clone-DblgEZZa.mjs → clone-EKNovYHu.mjs} +3 -3
- package/dist/clone-EKNovYHu.mjs.map +1 -0
- package/dist/{clone-Dy0cR2SZ.cjs → clone-UGJpvQnL.cjs} +7 -8
- package/dist/clone-UGJpvQnL.cjs.map +1 -0
- package/dist/{construct-interface-D9d4Gm4p.d.cts → construct-interface-B1AfqRl4.d.cts} +42 -11
- package/dist/construct-interface-B1AfqRl4.d.cts.map +1 -0
- package/dist/{construct-interface-g5GM5pwR.d.mts → construct-interface-DluK3_da.d.mts} +42 -11
- package/dist/construct-interface-DluK3_da.d.mts.map +1 -0
- package/dist/construct-interface.cjs +113 -7
- package/dist/construct-interface.cjs.map +1 -0
- package/dist/construct-interface.d.cts +2 -2
- package/dist/construct-interface.d.mts +2 -2
- package/dist/construct-interface.mjs +106 -2
- package/dist/construct-interface.mjs.map +1 -0
- package/dist/credential.cjs +63 -16
- package/dist/credential.cjs.map +1 -1
- package/dist/credential.d.cts +16 -9
- package/dist/credential.d.cts.map +1 -1
- package/dist/credential.d.mts +16 -9
- package/dist/credential.d.mts.map +1 -1
- package/dist/credential.mjs +58 -12
- package/dist/credential.mjs.map +1 -1
- package/dist/crons/index.cjs +68 -10
- package/dist/crons/index.cjs.map +1 -1
- package/dist/crons/index.d.cts +32 -14
- package/dist/crons/index.d.cts.map +1 -1
- package/dist/crons/index.d.mts +32 -14
- package/dist/crons/index.d.mts.map +1 -1
- package/dist/crons/index.mjs +66 -10
- package/dist/crons/index.mjs.map +1 -1
- package/dist/database/kysely.cjs +40 -15
- package/dist/database/kysely.cjs.map +1 -1
- package/dist/database/kysely.d.cts +2 -152
- package/dist/database/kysely.d.mts +2 -152
- package/dist/database/kysely.mjs +28 -5
- package/dist/database/kysely.mjs.map +1 -1
- package/dist/email.cjs +25 -12
- package/dist/email.cjs.map +1 -1
- package/dist/email.d.cts +3 -7
- package/dist/email.d.cts.map +1 -1
- package/dist/email.d.mts +3 -7
- package/dist/email.d.mts.map +1 -1
- package/dist/email.mjs +16 -3
- package/dist/email.mjs.map +1 -1
- package/dist/encryption.cjs +96 -0
- package/dist/encryption.cjs.map +1 -0
- package/dist/encryption.d.cts +117 -0
- package/dist/encryption.d.cts.map +1 -0
- package/dist/encryption.d.mts +117 -0
- package/dist/encryption.d.mts.map +1 -0
- package/dist/encryption.mjs +83 -0
- package/dist/encryption.mjs.map +1 -0
- package/dist/endpoints/index.cjs +8 -10
- package/dist/endpoints/index.d.cts +51 -7
- package/dist/endpoints/index.d.cts.map +1 -0
- package/dist/endpoints/index.d.mts +51 -7
- package/dist/endpoints/index.d.mts.map +1 -0
- package/dist/endpoints/index.mjs +6 -10
- package/dist/external-api-CWY9orcO.d.mts +86 -0
- package/dist/external-api-CWY9orcO.d.mts.map +1 -0
- package/dist/external-api-D-5WB-sr.d.cts +86 -0
- package/dist/external-api-D-5WB-sr.d.cts.map +1 -0
- package/dist/external-api.cjs +124 -0
- package/dist/external-api.cjs.map +1 -0
- package/dist/external-api.d.cts +2 -0
- package/dist/external-api.d.mts +2 -0
- package/dist/external-api.mjs +121 -0
- package/dist/external-api.mjs.map +1 -0
- package/dist/file-server.cjs +42 -10
- package/dist/file-server.cjs.map +1 -1
- package/dist/file-server.d.cts +6 -10
- package/dist/file-server.d.cts.map +1 -1
- package/dist/file-server.d.mts +6 -10
- package/dist/file-server.d.mts.map +1 -1
- package/dist/file-server.mjs +34 -2
- package/dist/file-server.mjs.map +1 -1
- package/dist/functions/index.cjs +2 -6
- package/dist/functions/index.d.cts +3 -4
- package/dist/functions/index.d.mts +3 -4
- package/dist/functions/index.mjs +2 -6
- package/dist/{functions-DJJA7VGc.cjs → functions-CbP5ZKma.cjs} +421 -273
- package/dist/functions-CbP5ZKma.cjs.map +1 -0
- package/dist/{functions-Ck21Uyq0.mjs → functions-Di6n5ltG.mjs} +383 -241
- package/dist/functions-Di6n5ltG.mjs.map +1 -0
- package/dist/index-BuzRvKOQ.d.cts +115 -0
- package/dist/index-BuzRvKOQ.d.cts.map +1 -0
- package/dist/index-CTkKOer4.d.mts +115 -0
- package/dist/index-CTkKOer4.d.mts.map +1 -0
- package/dist/index-CeEtxDmK.d.cts +79 -0
- package/dist/index-CeEtxDmK.d.cts.map +1 -0
- package/dist/index-CeEtxDmK.d.mts +79 -0
- package/dist/index-CeEtxDmK.d.mts.map +1 -0
- package/dist/index.cjs +3 -3
- package/dist/index.d.cts +4 -4
- package/dist/index.d.mts +4 -4
- package/dist/index.mjs +2 -3
- package/dist/kms-B-Hm3d5r.cjs +85 -0
- package/dist/kms-B-Hm3d5r.cjs.map +1 -0
- package/dist/kms-BdUlMJEZ.mjs +85 -0
- package/dist/kms-BdUlMJEZ.mjs.map +1 -0
- package/dist/kysely-Bqov3fwv.d.mts +159 -0
- package/dist/kysely-Bqov3fwv.d.mts.map +1 -0
- package/dist/kysely-DTnkZsub.d.cts +159 -0
- package/dist/kysely-DTnkZsub.d.cts.map +1 -0
- package/dist/{lazyAccessors-BoJN3SMd.mjs → lazyAccessors-CFanua0O.mjs} +20 -60
- package/dist/lazyAccessors-CFanua0O.mjs.map +1 -0
- package/dist/{lazyAccessors-e3j2oE2m.cjs → lazyAccessors-hJKGv8Ay.cjs} +60 -113
- package/dist/lazyAccessors-hJKGv8Ay.cjs.map +1 -0
- package/dist/mobile-app.cjs +73 -0
- package/dist/mobile-app.cjs.map +1 -0
- package/dist/mobile-app.d.cts +61 -0
- package/dist/mobile-app.d.cts.map +1 -0
- package/dist/mobile-app.d.mts +61 -0
- package/dist/mobile-app.d.mts.map +1 -0
- package/dist/mobile-app.mjs +72 -0
- package/dist/mobile-app.mjs.map +1 -0
- package/dist/object-storage.cjs +18 -10
- package/dist/object-storage.cjs.map +1 -1
- package/dist/object-storage.d.cts +3 -7
- package/dist/object-storage.d.cts.map +1 -1
- package/dist/object-storage.d.mts +3 -7
- package/dist/object-storage.d.mts.map +1 -1
- package/dist/object-storage.mjs +11 -3
- package/dist/object-storage.mjs.map +1 -1
- package/dist/{processAudits-Dmts9H_b.mjs → processAudits-BpRlPQMW.mjs} +16 -19
- package/dist/processAudits-BpRlPQMW.mjs.map +1 -0
- package/dist/{processAudits-CGqttuXm.cjs → processAudits-D_2W5x8k.cjs} +26 -30
- package/dist/processAudits-D_2W5x8k.cjs.map +1 -0
- package/dist/queue/index.cjs +6 -189
- package/dist/queue/index.d.cts +3 -60
- package/dist/queue/index.d.mts +3 -60
- package/dist/queue/index.mjs +3 -186
- package/dist/rest-api.cjs +87 -63
- package/dist/rest-api.cjs.map +1 -1
- package/dist/rest-api.d.cts +62 -61
- package/dist/rest-api.d.cts.map +1 -1
- package/dist/rest-api.d.mts +62 -61
- package/dist/rest-api.d.mts.map +1 -1
- package/dist/rest-api.mjs +79 -55
- package/dist/rest-api.mjs.map +1 -1
- package/dist/{chunk-DWy1uDak.cjs → rolldown-runtime-y5ARvAq5.cjs} +14 -18
- package/dist/site.cjs +33 -9
- package/dist/site.cjs.map +1 -1
- package/dist/site.d.cts +11 -22
- package/dist/site.d.cts.map +1 -1
- package/dist/site.d.mts +11 -22
- package/dist/site.d.mts.map +1 -1
- package/dist/site.mjs +29 -5
- package/dist/site.mjs.map +1 -1
- package/dist/subscribers/index.cjs +2 -11
- package/dist/subscribers/index.d.cts +3 -14
- package/dist/subscribers/index.d.mts +3 -14
- package/dist/subscribers/index.mjs +2 -11
- package/dist/surfaceEnv-CNimK76p.cjs +56 -0
- package/dist/surfaceEnv-CNimK76p.cjs.map +1 -0
- package/dist/surfaceEnv-wMT5QzgZ.mjs +45 -0
- package/dist/surfaceEnv-wMT5QzgZ.mjs.map +1 -0
- package/dist/{telemetry-C3L0iS28.d.cts → telemetry-DGcFlVpB.d.cts} +2 -5
- package/dist/telemetry-DGcFlVpB.d.cts.map +1 -0
- package/dist/{telemetry-D7bVFLGi.d.mts → telemetry-DGcFlVpB.d.mts} +2 -5
- package/dist/telemetry-DGcFlVpB.d.mts.map +1 -0
- package/dist/topic/index.cjs +3 -137
- package/dist/topic/index.d.cts +2 -32
- package/dist/topic/index.d.mts +2 -32
- package/dist/topic/index.mjs +2 -134
- package/dist/{types-BlAkSuGI.d.cts → types-DMuSQeLL.d.cts} +3 -5
- package/dist/types-DMuSQeLL.d.cts.map +1 -0
- package/dist/{types-aKksMEWL.d.mts → types-DMuSQeLL.d.mts} +3 -5
- package/dist/types-DMuSQeLL.d.mts.map +1 -0
- package/dist/types.d.cts +1 -1
- package/dist/types.d.mts +1 -1
- package/dist/types.mjs +1 -0
- package/dist/worker.cjs +137 -38
- package/dist/worker.cjs.map +1 -1
- package/dist/worker.d.cts +113 -44
- package/dist/worker.d.cts.map +1 -1
- package/dist/worker.d.mts +113 -43
- package/dist/worker.d.mts.map +1 -1
- package/dist/worker.mjs +132 -33
- package/dist/worker.mjs.map +1 -1
- package/package.json +81 -41
- package/dist/Construct-BD5neF7w.mjs.map +0 -1
- package/dist/Construct-C0ijr2qp.d.cts +0 -117
- package/dist/Construct-C0ijr2qp.d.cts.map +0 -1
- package/dist/Construct-Ct8nalEi.d.mts +0 -117
- package/dist/Construct-Ct8nalEi.d.mts.map +0 -1
- package/dist/Construct-CyS3RpTL.cjs.map +0 -1
- package/dist/Cron-B2OFsfDM.d.cts.map +0 -1
- package/dist/Cron-CqEbBbwH.d.mts.map +0 -1
- package/dist/CronBuilder-Bg-9h2cc.d.mts +0 -44
- package/dist/CronBuilder-Bg-9h2cc.d.mts.map +0 -1
- package/dist/CronBuilder-CdibiHNB.mjs +0 -84
- package/dist/CronBuilder-CdibiHNB.mjs.map +0 -1
- package/dist/CronBuilder-DyUr6nYz.cjs +0 -96
- package/dist/CronBuilder-DyUr6nYz.cjs.map +0 -1
- package/dist/CronBuilder-LSJMfqnq.d.cts +0 -44
- package/dist/CronBuilder-LSJMfqnq.d.cts.map +0 -1
- package/dist/Endpoint-DODn1RhN.cjs.map +0 -1
- package/dist/Endpoint-Dem2XyCu.d.mts.map +0 -1
- package/dist/Endpoint-Dij_wOcc.mjs.map +0 -1
- package/dist/Endpoint-DrD8a1yH.d.cts.map +0 -1
- package/dist/EndpointFactory-BHFMmFkV.cjs.map +0 -1
- package/dist/EndpointFactory-b4ituq-s.mjs.map +0 -1
- package/dist/HonoEndpointAdaptor-BM2jbWht.mjs.map +0 -1
- package/dist/HonoEndpointAdaptor-De6IlBZe.cjs.map +0 -1
- package/dist/Queue-D7ZuwBhy.d.cts.map +0 -1
- package/dist/Queue-gVGfi2Yk.d.mts.map +0 -1
- package/dist/Subscriber-2mEi0ImH.d.cts.map +0 -1
- package/dist/Subscriber-xTJ9ayPN.d.mts.map +0 -1
- package/dist/SubscriberBuilder-4OPehf2R.cjs.map +0 -1
- package/dist/SubscriberBuilder-BjkbeT9l.mjs.map +0 -1
- package/dist/SubscriberBuilder-Dptmo-1A.d.mts +0 -62
- package/dist/SubscriberBuilder-Dptmo-1A.d.mts.map +0 -1
- package/dist/SubscriberBuilder-waNhzjSM.d.cts +0 -62
- package/dist/SubscriberBuilder-waNhzjSM.d.cts.map +0 -1
- package/dist/Topic-19QeHBIR.d.cts +0 -91
- package/dist/Topic-19QeHBIR.d.cts.map +0 -1
- package/dist/Topic-DuFeqkBh.d.mts +0 -91
- package/dist/Topic-DuFeqkBh.d.mts.map +0 -1
- package/dist/auth.d.cts.map +0 -1
- package/dist/auth.d.mts.map +0 -1
- package/dist/cache-0ANvRQnD.mjs +0 -51
- package/dist/cache-0ANvRQnD.mjs.map +0 -1
- package/dist/cache-3WSvAulx.cjs +0 -57
- package/dist/cache-3WSvAulx.cjs.map +0 -1
- package/dist/cache-BrRz3fEB.d.mts.map +0 -1
- package/dist/cache-BtZY_tHe.d.cts.map +0 -1
- package/dist/clone-DblgEZZa.mjs.map +0 -1
- package/dist/clone-Dy0cR2SZ.cjs.map +0 -1
- package/dist/construct-interface-BfjcOD_E.cjs +0 -117
- package/dist/construct-interface-BfjcOD_E.cjs.map +0 -1
- package/dist/construct-interface-D9d4Gm4p.d.cts.map +0 -1
- package/dist/construct-interface-Z4CpS8tK.mjs +0 -81
- package/dist/construct-interface-Z4CpS8tK.mjs.map +0 -1
- package/dist/construct-interface-g5GM5pwR.d.mts.map +0 -1
- package/dist/database/kysely.d.cts.map +0 -1
- package/dist/database/kysely.d.mts.map +0 -1
- package/dist/functions-Ck21Uyq0.mjs.map +0 -1
- package/dist/functions-DJJA7VGc.cjs.map +0 -1
- package/dist/index-AIfVzkhi.d.cts +0 -170
- package/dist/index-AIfVzkhi.d.cts.map +0 -1
- package/dist/index-B8g8POkr.d.cts.map +0 -1
- package/dist/index-D3zjrwjr.d.mts +0 -169
- package/dist/index-D3zjrwjr.d.mts.map +0 -1
- package/dist/index-DbKmfl-q.d.mts.map +0 -1
- package/dist/lazyAccessors-BoJN3SMd.mjs.map +0 -1
- package/dist/lazyAccessors-e3j2oE2m.cjs.map +0 -1
- package/dist/processAudits-CGqttuXm.cjs.map +0 -1
- package/dist/processAudits-Dmts9H_b.mjs.map +0 -1
- package/dist/queue/index.cjs.map +0 -1
- package/dist/queue/index.d.cts.map +0 -1
- package/dist/queue/index.d.mts.map +0 -1
- package/dist/queue/index.mjs.map +0 -1
- package/dist/subscribers/index.cjs.map +0 -1
- package/dist/subscribers/index.d.cts.map +0 -1
- package/dist/subscribers/index.d.mts.map +0 -1
- package/dist/subscribers/index.mjs.map +0 -1
- package/dist/surfaceEnv-BFXEms2f.cjs +0 -39
- package/dist/surfaceEnv-BFXEms2f.cjs.map +0 -1
- package/dist/surfaceEnv-C3Ktahea.mjs +0 -27
- package/dist/surfaceEnv-C3Ktahea.mjs.map +0 -1
- package/dist/telemetry-C3L0iS28.d.cts.map +0 -1
- package/dist/telemetry-D7bVFLGi.d.mts.map +0 -1
- package/dist/topic/index.cjs.map +0 -1
- package/dist/topic/index.d.cts.map +0 -1
- package/dist/topic/index.d.mts.map +0 -1
- package/dist/topic/index.mjs.map +0 -1
- package/dist/types-BlAkSuGI.d.cts.map +0 -1
- package/dist/types-aKksMEWL.d.mts.map +0 -1
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
const require_Construct = require("./Construct-DmvXceVY.cjs");
|
|
2
|
+
let _geekmidas_manifest = require("@geekmidas/manifest");
|
|
3
|
+
let _geekmidas_logger_console = require("@geekmidas/logger/console");
|
|
4
|
+
let _geekmidas_events = require("@geekmidas/events");
|
|
5
|
+
//#region src/queue/Queue.ts
|
|
6
|
+
/**
|
|
7
|
+
* A queue worker — a point-to-point SQS-style queue and its single consumer.
|
|
8
|
+
* Unlike a `Subscriber` (topic fan-out, filtered by `subscribedEvents`), a queue
|
|
9
|
+
* drains every message of its one `message` type. Build one from the worker
|
|
10
|
+
* that runs it — `worker.queue('Emails').message(schema).handle(…)` — and
|
|
11
|
+
* `gkm build` discovers it into the manifest's `queues` field.
|
|
12
|
+
*
|
|
13
|
+
* Producers send to it by depending on it: `.dependsOn([emails])` makes
|
|
14
|
+
* `services.emails` the publisher.
|
|
15
|
+
*
|
|
16
|
+
* Its handler gets `db` when it has a database: the worker's, declared once
|
|
17
|
+
* with `worker.database(db)`, or its own with `.database(other)`.
|
|
18
|
+
*/
|
|
19
|
+
var Queue = class extends require_Construct.Construct {
|
|
20
|
+
name;
|
|
21
|
+
handler;
|
|
22
|
+
messageSchema;
|
|
23
|
+
timeout;
|
|
24
|
+
services;
|
|
25
|
+
logger;
|
|
26
|
+
batchSize;
|
|
27
|
+
fifo;
|
|
28
|
+
__IS_QUEUE__ = true;
|
|
29
|
+
static isQueue(obj) {
|
|
30
|
+
return Boolean(obj && obj.__IS_QUEUE__ === true && obj.type === "dev.geekmidas.function.queue");
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* The canonical id this queue is declared under.
|
|
34
|
+
*
|
|
35
|
+
* Derived from the name rather than given separately, so `emails` and
|
|
36
|
+
* `Emails` are one queue. The name stays what it was: it is the wire `type`
|
|
37
|
+
* a producer sends and the worker subscribes to, and changing that would
|
|
38
|
+
* silently orphan in-flight messages.
|
|
39
|
+
*/
|
|
40
|
+
id;
|
|
41
|
+
/**
|
|
42
|
+
* The queue as a dependency — what `.dependsOn([emails])` dissolves into,
|
|
43
|
+
* reachable as `services.emails`.
|
|
44
|
+
*
|
|
45
|
+
* The producer: the queue's one consumer is the handler it was built with,
|
|
46
|
+
* so the only thing another construct can want from a queue is to send to
|
|
47
|
+
* it. It reads `<NAME>_PUBLISHER_CONNECTION_STRING` and picks the transport
|
|
48
|
+
* from its protocol — `pgboss://` locally, `sqs://` deployed. A field
|
|
49
|
+
* assigned once, not a getter: services are cached by object identity.
|
|
50
|
+
*/
|
|
51
|
+
service;
|
|
52
|
+
/**
|
|
53
|
+
* The producer's env key. Read by both {@link declare} and the service, so
|
|
54
|
+
* what the target publishes and what the producer looks up cannot drift.
|
|
55
|
+
*/
|
|
56
|
+
connectionKey;
|
|
57
|
+
constructor(name, handler, messageSchema, timeout = 3e4, services = [], logger = _geekmidas_logger_console.DEFAULT_LOGGER, batchSize, fifo, constructs = [], databaseService) {
|
|
58
|
+
super("dev.geekmidas.function.queue", logger, services, [], void 0, timeout, void 0, void 0, constructs);
|
|
59
|
+
this.name = name;
|
|
60
|
+
this.handler = handler;
|
|
61
|
+
this.messageSchema = messageSchema;
|
|
62
|
+
this.timeout = timeout;
|
|
63
|
+
this.services = services;
|
|
64
|
+
this.logger = logger;
|
|
65
|
+
this.batchSize = batchSize;
|
|
66
|
+
this.fifo = fifo;
|
|
67
|
+
this.databaseService = databaseService;
|
|
68
|
+
this.id = (0, _geekmidas_manifest.canonicalId)(name);
|
|
69
|
+
this.connectionKey = (0, _geekmidas_manifest.provideKey)(this.id, "publisherConnectionString");
|
|
70
|
+
const envVar = this.connectionKey;
|
|
71
|
+
this.service = {
|
|
72
|
+
serviceName: (0, _geekmidas_manifest.serviceKey)(this.id),
|
|
73
|
+
async register({ envParser }) {
|
|
74
|
+
const { connectionString } = envParser.create((get) => ({ connectionString: get(envVar).string() })).parse();
|
|
75
|
+
return _geekmidas_events.Publisher.fromConnectionString(connectionString);
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* What this queue is in the manifest.
|
|
81
|
+
*
|
|
82
|
+
* A queue is a resource, not a handler: the worker is reached *through* it,
|
|
83
|
+
* so the declaration carries the producer's key and nothing about the code
|
|
84
|
+
* that drains it. The local target reads this to know which broker has to be
|
|
85
|
+
* running and what connection string to inject.
|
|
86
|
+
*/
|
|
87
|
+
declare() {
|
|
88
|
+
return [{
|
|
89
|
+
kind: "queue",
|
|
90
|
+
id: this.id,
|
|
91
|
+
provides: [this.connectionKey],
|
|
92
|
+
...this.fifo ? { fifo: true } : {},
|
|
93
|
+
worker: {
|
|
94
|
+
id: `${this.id}Worker`,
|
|
95
|
+
handler: `${this.id}.handler`,
|
|
96
|
+
dependencies: []
|
|
97
|
+
}
|
|
98
|
+
}];
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
//#endregion
|
|
102
|
+
Object.defineProperty(exports, "Queue", {
|
|
103
|
+
enumerable: true,
|
|
104
|
+
get: function() {
|
|
105
|
+
return Queue;
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
//# sourceMappingURL=Queue-D5jcw0mu.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Queue-D5jcw0mu.cjs","names":["Construct","DEFAULT_LOGGER","canonicalId","provideKey","serviceKey","Publisher"],"sources":["../src/queue/Queue.ts"],"sourcesContent":["import {\n\ttype EventPublisher,\n\ttype EventPublisherConnectionString,\n\ttype PublishableMessage,\n\tPublisher,\n} from '@geekmidas/events';\nimport type { Logger } from '@geekmidas/logger';\nimport { DEFAULT_LOGGER } from '@geekmidas/logger/console';\nimport {\n\tcanonicalId,\n\ttype Declaration,\n\tprovideKey,\n\tserviceKey,\n} from '@geekmidas/manifest';\nimport type { InferStandardSchema } from '@geekmidas/schema';\nimport type { Service, ServiceRecord } from '@geekmidas/services';\nimport type { StandardSchemaV1 } from '@standard-schema/spec';\nimport { Construct, ConstructType } from '../Construct';\nimport type { DatabaseContext } from '../functions/Function';\n\n/**\n * The wire message a queue carries: `{ type: <queue name>, payload: <message> }`.\n * The producer publishes this shape and the worker receives the `payload`s as\n * its `messages`. Typing `type` to the queue name keeps the publisher fully\n * typed and lets pg-boss (local) / SQS (deployed) route by name.\n */\nexport type QueueMessage<\n\tTName extends string,\n\tTMessage extends StandardSchemaV1,\n> = PublishableMessage<TName, InferStandardSchema<TMessage>>;\n\n/**\n * A queue worker — a point-to-point SQS-style queue and its single consumer.\n * Unlike a `Subscriber` (topic fan-out, filtered by `subscribedEvents`), a queue\n * drains every message of its one `message` type. Build one from the worker\n * that runs it — `worker.queue('Emails').message(schema).handle(…)` — and\n * `gkm build` discovers it into the manifest's `queues` field.\n *\n * Producers send to it by depending on it: `.dependsOn([emails])` makes\n * `services.emails` the publisher.\n *\n * Its handler gets `db` when it has a database: the worker's, declared once\n * with `worker.database(db)`, or its own with `.database(other)`.\n */\nexport class Queue<\n\tTName extends string = string,\n\tTMessage extends StandardSchemaV1 = StandardSchemaV1,\n\tTServices extends Service[] = [],\n\tTLogger extends Logger = Logger,\n\tTDatabase = undefined,\n\tTDatabaseServiceName extends string = string,\n> extends Construct<\n\tTLogger,\n\tundefined,\n\tTServices,\n\tstring,\n\tundefined,\n\tTDatabaseServiceName,\n\tTDatabase\n> {\n\t__IS_QUEUE__ = true;\n\n\tstatic isQueue(\n\t\tobj: unknown,\n\t): obj is Queue<string, StandardSchemaV1, Service[], Logger, any> {\n\t\treturn Boolean(\n\t\t\tobj &&\n\t\t\t\t(obj as { __IS_QUEUE__?: boolean }).__IS_QUEUE__ === true &&\n\t\t\t\t(obj as Construct).type === ConstructType.Queue,\n\t\t);\n\t}\n\n\t/**\n\t * The canonical id this queue is declared under.\n\t *\n\t * Derived from the name rather than given separately, so `emails` and\n\t * `Emails` are one queue. The name stays what it was: it is the wire `type`\n\t * a producer sends and the worker subscribes to, and changing that would\n\t * silently orphan in-flight messages.\n\t */\n\treadonly id: string;\n\n\t/**\n\t * The queue as a dependency — what `.dependsOn([emails])` dissolves into,\n\t * reachable as `services.emails`.\n\t *\n\t * The producer: the queue's one consumer is the handler it was built with,\n\t * so the only thing another construct can want from a queue is to send to\n\t * it. It reads `<NAME>_PUBLISHER_CONNECTION_STRING` and picks the transport\n\t * from its protocol — `pgboss://` locally, `sqs://` deployed. A field\n\t * assigned once, not a getter: services are cached by object identity.\n\t */\n\treadonly service: Service<\n\t\tUncapitalize<TName>,\n\t\tEventPublisher<QueueMessage<TName, TMessage>>\n\t>;\n\n\t/**\n\t * The producer's env key. Read by both {@link declare} and the service, so\n\t * what the target publishes and what the producer looks up cannot drift.\n\t */\n\tprivate readonly connectionKey: string;\n\n\tconstructor(\n\t\tpublic readonly name: TName,\n\t\tpublic readonly handler: QueueHandler<\n\t\t\tTMessage,\n\t\t\tTServices,\n\t\t\tTLogger,\n\t\t\tTDatabase\n\t\t>,\n\t\tpublic readonly messageSchema: TMessage,\n\t\tpublic override readonly timeout: number = 30000,\n\t\tpublic override readonly services: TServices = [] as unknown as TServices,\n\t\tpublic override readonly logger: TLogger = DEFAULT_LOGGER as TLogger,\n\t\t/** SQS event-source batch size (deployed). */\n\t\tpublic readonly batchSize?: number,\n\t\t/** Whether the queue is FIFO (deployed). */\n\t\tpublic readonly fifo?: boolean,\n\t\t/**\n\t\t * The construct ids the *worker* `.dependsOn()` named — last, so no\n\t\t * existing positional argument moves.\n\t\t */\n\t\tconstructs: string[] = [],\n\t\t/**\n\t\t * What the handler's `db` is registered from — after `constructs`, for\n\t\t * the same reason.\n\t\t */\n\t\tdatabaseService?: Service<TDatabaseServiceName, TDatabase>,\n\t) {\n\t\tsuper(\n\t\t\tConstructType.Queue,\n\t\t\tlogger,\n\t\t\tservices,\n\t\t\t[],\n\t\t\tundefined,\n\t\t\ttimeout,\n\t\t\tundefined, // memorySize\n\t\t\tundefined, // auditorStorageService\n\t\t\tconstructs,\n\t\t);\n\n\t\tthis.databaseService = databaseService;\n\t\tthis.id = canonicalId(name);\n\t\tthis.connectionKey = provideKey(this.id, 'publisherConnectionString');\n\n\t\tconst envVar = this.connectionKey;\n\t\tthis.service = {\n\t\t\tserviceName: serviceKey(this.id) as Uncapitalize<TName>,\n\t\t\tasync register({ envParser }) {\n\t\t\t\tconst { connectionString } = envParser\n\t\t\t\t\t.create((get) => ({ connectionString: get(envVar).string() }))\n\t\t\t\t\t.parse();\n\n\t\t\t\treturn Publisher.fromConnectionString<QueueMessage<TName, TMessage>>(\n\t\t\t\t\tconnectionString as EventPublisherConnectionString,\n\t\t\t\t);\n\t\t\t},\n\t\t};\n\t}\n\n\t/**\n\t * What this queue is in the manifest.\n\t *\n\t * A queue is a resource, not a handler: the worker is reached *through* it,\n\t * so the declaration carries the producer's key and nothing about the code\n\t * that drains it. The local target reads this to know which broker has to be\n\t * running and what connection string to inject.\n\t */\n\tdeclare(): Declaration[] {\n\t\treturn [\n\t\t\t{\n\t\t\t\tkind: 'queue',\n\t\t\t\tid: this.id,\n\t\t\t\tprovides: [this.connectionKey],\n\t\t\t\t...(this.fifo ? { fifo: true } : {}),\n\t\t\t\t// Nested rather than a sibling node, because position carries the\n\t\t\t\t// trigger: this handler is reached by messages on this queue and\n\t\t\t\t// by nothing else, so there is no `trigger` field to keep in step.\n\t\t\t\t//\n\t\t\t\t// `handler` is the export name; which directory the build wrote it\n\t\t\t\t// to is the target's business, and a path with a cloud in it does\n\t\t\t\t// not belong in a neutral declaration.\n\t\t\t\tworker: {\n\t\t\t\t\tid: `${this.id}Worker`,\n\t\t\t\t\thandler: `${this.id}.handler`,\n\t\t\t\t\t// Filled by the build from what the worker declared. Empty is a\n\t\t\t\t\t// stated gap, not a claim that it reaches nothing.\n\t\t\t\t\tdependencies: [],\n\t\t\t\t},\n\t\t\t},\n\t\t];\n\t}\n}\n\n/**\n * The context a queue handler receives — a batch of typed messages, and `db`\n * when the queue has a database.\n */\nexport type QueueContext<\n\tTMessage extends StandardSchemaV1,\n\tTServices extends Service[] = [],\n\tTLogger extends Logger = Logger,\n\tTDatabase = undefined,\n> = {\n\tmessages: InferStandardSchema<TMessage>[];\n\tservices: ServiceRecord<TServices>;\n\tlogger: TLogger;\n} & DatabaseContext<TDatabase>;\n\nexport type QueueHandler<\n\tTMessage extends StandardSchemaV1,\n\tTServices extends Service[] = [],\n\tTLogger extends Logger = Logger,\n\tTDatabase = undefined,\n> = (\n\tctx: QueueContext<TMessage, TServices, TLogger, TDatabase>,\n) => unknown | Promise<unknown>;\n"],"mappings":";;;;;;;;;;;;;;;;;;AA4CA,IAAa,QAAb,cAOUA,kBAAAA,UAQR;CA6CgB;CACA;CAMA;CACS;CACA;CACA;CAET;CAEA;CA1DjB,eAAe;CAEf,OAAO,QACN,KACiE;EACjE,OAAO,QACN,OACE,IAAmC,iBAAiB,QACpD,IAAkB,SAAA,8BACrB;CACD;;;;;;;;;CAUA;;;;;;;;;;;CAYA;;;;;CASA;CAEA,YACC,MACA,SAMA,eACA,UAA2C,KAC3C,WAA+C,CAAC,GAChD,SAA2CC,0BAAAA,gBAE3C,WAEA,MAKA,aAAuB,CAAC,GAKxB,iBACC;EACD,MAAA,gCAEC,QACA,UACA,CAAC,GACD,KAAA,GACA,SACA,KAAA,GACA,KAAA,GACA,UACD;EApCgB,KAAA,OAAA;EACA,KAAA,UAAA;EAMA,KAAA,gBAAA;EACS,KAAA,UAAA;EACA,KAAA,WAAA;EACA,KAAA,SAAA;EAET,KAAA,YAAA;EAEA,KAAA,OAAA;EAwBhB,KAAK,kBAAkB;EACvB,KAAK,MAAA,GAAKC,oBAAAA,YAAAA,CAAY,IAAI;EAC1B,KAAK,iBAAA,GAAgBC,oBAAAA,WAAAA,CAAW,KAAK,IAAI,2BAA2B;EAEpE,MAAM,SAAS,KAAK;EACpB,KAAK,UAAU;GACd,cAAA,GAAaC,oBAAAA,WAAAA,CAAW,KAAK,EAAE;GAC/B,MAAM,SAAS,EAAE,aAAa;IAC7B,MAAM,EAAE,qBAAqB,UAC3B,QAAQ,SAAS,EAAE,kBAAkB,IAAI,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAC7D,MAAM;IAER,OAAOC,kBAAAA,UAAU,qBAChB,gBACD;GACD;EACD;CACD;;;;;;;;;CAUA,UAAyB;EACxB,OAAO,CACN;GACC,MAAM;GACN,IAAI,KAAK;GACT,UAAU,CAAC,KAAK,aAAa;GAC7B,GAAI,KAAK,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;GAQlC,QAAQ;IACP,IAAI,GAAG,KAAK,GAAG;IACf,SAAS,GAAG,KAAK,GAAG;IAGpB,cAAc,CAAC;GAChB;EACD,CACD;CACD;AACD"}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { t as StandardSchemaV1 } from "./index-CeEtxDmK.mjs";
|
|
2
|
+
import { t as Construct } from "./Construct-QXnl3VqT.mjs";
|
|
3
|
+
import { t as DatabaseContext } from "./Function-DuqGcbOI.mjs";
|
|
4
|
+
import { Declaration } from "@geekmidas/manifest";
|
|
2
5
|
import { EventPublisher, PublishableMessage } from "@geekmidas/events";
|
|
6
|
+
import { Service, ServiceRecord } from "@geekmidas/services";
|
|
3
7
|
import { Logger } from "@geekmidas/logger";
|
|
4
8
|
import { InferStandardSchema } from "@geekmidas/schema";
|
|
5
|
-
import { Service, ServiceRecord } from "@geekmidas/services";
|
|
6
|
-
import { StandardSchemaV1 } from "@standard-schema/spec";
|
|
7
|
-
import { Declaration } from "@geekmidas/manifest";
|
|
8
|
-
|
|
9
9
|
//#region src/queue/Queue.d.ts
|
|
10
|
-
|
|
11
10
|
/**
|
|
12
11
|
* The wire message a queue carries: `{ type: <queue name>, payload: <message> }`.
|
|
13
12
|
* The producer publishes this shape and the worker receives the `payload`s as
|
|
@@ -18,15 +17,19 @@ type QueueMessage<TName extends string, TMessage extends StandardSchemaV1> = Pub
|
|
|
18
17
|
/**
|
|
19
18
|
* A queue worker — a point-to-point SQS-style queue and its single consumer.
|
|
20
19
|
* Unlike a `Subscriber` (topic fan-out, filtered by `subscribedEvents`), a queue
|
|
21
|
-
* drains every message of its one `message` type. Build one
|
|
22
|
-
*
|
|
20
|
+
* drains every message of its one `message` type. Build one from the worker
|
|
21
|
+
* that runs it — `worker.queue('Emails').message(schema).handle(…)` — and
|
|
22
|
+
* `gkm build` discovers it into the manifest's `queues` field.
|
|
23
|
+
*
|
|
24
|
+
* Producers send to it by depending on it: `.dependsOn([emails])` makes
|
|
25
|
+
* `services.emails` the publisher.
|
|
23
26
|
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
27
|
+
* Its handler gets `db` when it has a database: the worker's, declared once
|
|
28
|
+
* with `worker.database(db)`, or its own with `.database(other)`.
|
|
26
29
|
*/
|
|
27
|
-
declare class Queue<TName extends string = string, TMessage extends StandardSchemaV1 = StandardSchemaV1, TServices extends Service[] = [], TLogger extends Logger = Logger> extends Construct<TLogger, string, undefined,
|
|
30
|
+
declare class Queue<TName extends string = string, TMessage extends StandardSchemaV1 = StandardSchemaV1, TServices extends Service[] = [], TLogger extends Logger = Logger, TDatabase = undefined, TDatabaseServiceName extends string = string> extends Construct<TLogger, undefined, TServices, string, undefined, TDatabaseServiceName, TDatabase> {
|
|
28
31
|
readonly name: TName;
|
|
29
|
-
readonly handler: QueueHandler<TMessage, TServices, TLogger>;
|
|
32
|
+
readonly handler: QueueHandler<TMessage, TServices, TLogger, TDatabase>;
|
|
30
33
|
readonly messageSchema: TMessage;
|
|
31
34
|
readonly timeout: number;
|
|
32
35
|
readonly services: TServices;
|
|
@@ -36,7 +39,7 @@ declare class Queue<TName extends string = string, TMessage extends StandardSche
|
|
|
36
39
|
/** Whether the queue is FIFO (deployed). */
|
|
37
40
|
readonly fifo?: boolean | undefined;
|
|
38
41
|
__IS_QUEUE__: boolean;
|
|
39
|
-
static isQueue(obj: unknown): obj is Queue<string, StandardSchemaV1, Service[], Logger>;
|
|
42
|
+
static isQueue(obj: unknown): obj is Queue<string, StandardSchemaV1, Service[], Logger, any>;
|
|
40
43
|
/**
|
|
41
44
|
* The canonical id this queue is declared under.
|
|
42
45
|
*
|
|
@@ -47,19 +50,36 @@ declare class Queue<TName extends string = string, TMessage extends StandardSche
|
|
|
47
50
|
*/
|
|
48
51
|
readonly id: string;
|
|
49
52
|
/**
|
|
50
|
-
* The
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
+
* The queue as a dependency — what `.dependsOn([emails])` dissolves into,
|
|
54
|
+
* reachable as `services.emails`.
|
|
55
|
+
*
|
|
56
|
+
* The producer: the queue's one consumer is the handler it was built with,
|
|
57
|
+
* so the only thing another construct can want from a queue is to send to
|
|
58
|
+
* it. It reads `<NAME>_PUBLISHER_CONNECTION_STRING` and picks the transport
|
|
59
|
+
* from its protocol — `pgboss://` locally, `sqs://` deployed. A field
|
|
60
|
+
* assigned once, not a getter: services are cached by object identity.
|
|
61
|
+
*/
|
|
62
|
+
readonly service: Service<Uncapitalize<TName>, EventPublisher<QueueMessage<TName, TMessage>>>;
|
|
63
|
+
/**
|
|
64
|
+
* The producer's env key. Read by both {@link declare} and the service, so
|
|
65
|
+
* what the target publishes and what the producer looks up cannot drift.
|
|
53
66
|
*/
|
|
54
67
|
private readonly connectionKey;
|
|
55
|
-
constructor(name: TName, handler: QueueHandler<TMessage, TServices, TLogger>, messageSchema: TMessage, timeout?: number, services?: TServices, logger?: TLogger,
|
|
56
|
-
|
|
68
|
+
constructor(name: TName, handler: QueueHandler<TMessage, TServices, TLogger, TDatabase>, messageSchema: TMessage, timeout?: number, services?: TServices, logger?: TLogger,
|
|
69
|
+
/** SQS event-source batch size (deployed). */
|
|
70
|
+
batchSize?: number | undefined,
|
|
71
|
+
/** Whether the queue is FIFO (deployed). */
|
|
57
72
|
fifo?: boolean | undefined,
|
|
58
73
|
/**
|
|
59
74
|
* The construct ids the *worker* `.dependsOn()` named — last, so no
|
|
60
75
|
* existing positional argument moves.
|
|
61
76
|
*/
|
|
62
|
-
constructs?: string[]
|
|
77
|
+
constructs?: string[],
|
|
78
|
+
/**
|
|
79
|
+
* What the handler's `db` is registered from — after `constructs`, for
|
|
80
|
+
* the same reason.
|
|
81
|
+
*/
|
|
82
|
+
databaseService?: Service<TDatabaseServiceName, TDatabase>);
|
|
63
83
|
/**
|
|
64
84
|
* What this queue is in the manifest.
|
|
65
85
|
*
|
|
@@ -69,37 +89,17 @@ declare class Queue<TName extends string = string, TMessage extends StandardSche
|
|
|
69
89
|
* running and what connection string to inject.
|
|
70
90
|
*/
|
|
71
91
|
declare(): Declaration[];
|
|
72
|
-
/**
|
|
73
|
-
* The producer side — a `Service` exposing an `EventPublisher` typed to this
|
|
74
|
-
* queue's message. Inject it via `.services([queue.publisher])`; the handler
|
|
75
|
-
* then calls `services.<name>Publisher.publish([{ type, payload }])`.
|
|
76
|
-
*
|
|
77
|
-
* It reads `<NAME>_PUBLISHER_CONNECTION_STRING` and builds the transport from
|
|
78
|
-
* the URL protocol — `pgboss://` locally, `sqs://` deployed — so the same
|
|
79
|
-
* code publishes to Postgres in dev and SQS in prod. Because it's a `Service`,
|
|
80
|
-
* `Construct.getEnvironment()` sniffs it, so the env requirement flows into
|
|
81
|
-
* the manifest and infra links exactly this queue with least privilege.
|
|
82
|
-
*/
|
|
83
|
-
/**
|
|
84
|
-
* The queue as a dependency — what `.dependsOn([emailsQueue])` dissolves
|
|
85
|
-
* into, reachable as `services.emails`.
|
|
86
|
-
*
|
|
87
|
-
* It is the producer: a consumer is the worker written right here, so the
|
|
88
|
-
* only thing another construct can want from a queue is the ability to send
|
|
89
|
-
* to it. {@link publisher} is the same service under its older
|
|
90
|
-
* `<name>Publisher` key, kept for `.services([queue.publisher])`.
|
|
91
|
-
*/
|
|
92
|
-
get service(): Service<Uncapitalize<TName>, EventPublisher<QueueMessage<TName, TMessage>>>;
|
|
93
|
-
get publisher(): Service<`${TName}Publisher`, EventPublisher<QueueMessage<TName, TMessage>>>;
|
|
94
92
|
}
|
|
95
|
-
/**
|
|
96
|
-
|
|
93
|
+
/**
|
|
94
|
+
* The context a queue handler receives — a batch of typed messages, and `db`
|
|
95
|
+
* when the queue has a database.
|
|
96
|
+
*/
|
|
97
|
+
type QueueContext<TMessage extends StandardSchemaV1, TServices extends Service[] = [], TLogger extends Logger = Logger, TDatabase = undefined> = {
|
|
97
98
|
messages: InferStandardSchema<TMessage>[];
|
|
98
99
|
services: ServiceRecord<TServices>;
|
|
99
100
|
logger: TLogger;
|
|
100
|
-
}
|
|
101
|
-
type QueueHandler<TMessage extends StandardSchemaV1, TServices extends Service[] = [], TLogger extends Logger = Logger> = (ctx: QueueContext<TMessage, TServices, TLogger>) => unknown | Promise<unknown>;
|
|
102
|
-
//# sourceMappingURL=Queue.d.ts.map
|
|
101
|
+
} & DatabaseContext<TDatabase>;
|
|
102
|
+
type QueueHandler<TMessage extends StandardSchemaV1, TServices extends Service[] = [], TLogger extends Logger = Logger, TDatabase = undefined> = (ctx: QueueContext<TMessage, TServices, TLogger, TDatabase>) => unknown | Promise<unknown>;
|
|
103
103
|
//#endregion
|
|
104
|
-
export {
|
|
105
|
-
//# sourceMappingURL=Queue-
|
|
104
|
+
export { QueueMessage as i, QueueContext as n, QueueHandler as r, Queue as t };
|
|
105
|
+
//# sourceMappingURL=Queue-DlsHRzUp.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Queue-DlsHRzUp.d.mts","names":[],"sources":["../src/queue/Queue.ts"],"mappings":";;;;;;;;;;;;;;;KA0BY,aACX,sBACA,iBAAiB,oBACd,mBAAmB,OAAO,oBAAoB;;;;;;;;;;;;;;cAerC,MACZ,+BACA,iBAAiB,mBAAmB,kBACpC,kBAAkB,gBAClB,gBAAgB,SAAS,QACzB,uBACA,sDACS,UACT,oBAEA,8BAGA,sBACA;WA8CiB,MAAM;WACN,SAAS,aACxB,UACA,WACA,SACA;WAEe,eAAe;WACN;WACA,UAAU;WACV,QAAQ;;WAEjB;;WAEA;EA1DjB;SAEO,QACN,eACE,OAAO,cAAc,kBAAkB,WAAW;;;;;;;;;WAgB5C;;;;;;;;;;;WAYA,SAAS,QACjB,aAAa,QACb,eAAe,aAAa,OAAO;;;;;mBAOnB;EAEjB,YACiB,MAAM,OACN,SAAS,aACxB,UACA,WACA,SACA,YAEe,eAAe,UACN,kBACA,WAAU,WACV,SAAQ,SAEjB;;EAAA,gCAEA;;EAAA,4BAKhB;;;;;EAAA,uBAKA;;;;;EAAA,kBAAkB,QAAQ,sBAAsB;;;;;;;;;EAyCjD,WAAW;;;;;;KA8BA,aACX,iBAAiB,kBACjB,kBAAkB,gBAClB,gBAAgB,SAAS,QACzB;EAEA,UAAU,oBAAoB;EAC9B,UAAU,cAAc;EACxB,QAAQ;IACL,gBAAgB;KAER,aACX,iBAAiB,kBACjB,kBAAkB,gBAClB,gBAAgB,SAAS,QACzB,0BAEA,KAAK,aAAa,UAAU,WAAW,SAAS,yBAClC"}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { EventPublisher, PublishableMessage } from "@geekmidas/events";
|
|
1
|
+
import { t as StandardSchemaV1 } from "./index-CeEtxDmK.cjs";
|
|
2
|
+
import { t as Construct } from "./Construct-BQALFCh2.cjs";
|
|
3
|
+
import { t as DatabaseContext } from "./Function-Pu-1kKZz.cjs";
|
|
5
4
|
import { Logger } from "@geekmidas/logger";
|
|
6
5
|
import { InferStandardSchema } from "@geekmidas/schema";
|
|
7
|
-
import {
|
|
8
|
-
|
|
6
|
+
import { Service, ServiceRecord } from "@geekmidas/services";
|
|
7
|
+
import { EventPublisher, PublishableMessage } from "@geekmidas/events";
|
|
8
|
+
import { Declaration } from "@geekmidas/manifest";
|
|
9
9
|
//#region src/queue/Queue.d.ts
|
|
10
|
-
|
|
11
10
|
/**
|
|
12
11
|
* The wire message a queue carries: `{ type: <queue name>, payload: <message> }`.
|
|
13
12
|
* The producer publishes this shape and the worker receives the `payload`s as
|
|
@@ -18,15 +17,19 @@ type QueueMessage<TName extends string, TMessage extends StandardSchemaV1> = Pub
|
|
|
18
17
|
/**
|
|
19
18
|
* A queue worker — a point-to-point SQS-style queue and its single consumer.
|
|
20
19
|
* Unlike a `Subscriber` (topic fan-out, filtered by `subscribedEvents`), a queue
|
|
21
|
-
* drains every message of its one `message` type. Build one
|
|
22
|
-
*
|
|
20
|
+
* drains every message of its one `message` type. Build one from the worker
|
|
21
|
+
* that runs it — `worker.queue('Emails').message(schema).handle(…)` — and
|
|
22
|
+
* `gkm build` discovers it into the manifest's `queues` field.
|
|
23
23
|
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
24
|
+
* Producers send to it by depending on it: `.dependsOn([emails])` makes
|
|
25
|
+
* `services.emails` the publisher.
|
|
26
|
+
*
|
|
27
|
+
* Its handler gets `db` when it has a database: the worker's, declared once
|
|
28
|
+
* with `worker.database(db)`, or its own with `.database(other)`.
|
|
26
29
|
*/
|
|
27
|
-
declare class Queue<TName extends string = string, TMessage extends StandardSchemaV1 = StandardSchemaV1, TServices extends Service[] = [], TLogger extends Logger = Logger> extends Construct<TLogger, string, undefined,
|
|
30
|
+
declare class Queue<TName extends string = string, TMessage extends StandardSchemaV1 = StandardSchemaV1, TServices extends Service[] = [], TLogger extends Logger = Logger, TDatabase = undefined, TDatabaseServiceName extends string = string> extends Construct<TLogger, undefined, TServices, string, undefined, TDatabaseServiceName, TDatabase> {
|
|
28
31
|
readonly name: TName;
|
|
29
|
-
readonly handler: QueueHandler<TMessage, TServices, TLogger>;
|
|
32
|
+
readonly handler: QueueHandler<TMessage, TServices, TLogger, TDatabase>;
|
|
30
33
|
readonly messageSchema: TMessage;
|
|
31
34
|
readonly timeout: number;
|
|
32
35
|
readonly services: TServices;
|
|
@@ -36,7 +39,7 @@ declare class Queue<TName extends string = string, TMessage extends StandardSche
|
|
|
36
39
|
/** Whether the queue is FIFO (deployed). */
|
|
37
40
|
readonly fifo?: boolean | undefined;
|
|
38
41
|
__IS_QUEUE__: boolean;
|
|
39
|
-
static isQueue(obj: unknown): obj is Queue<string, StandardSchemaV1, Service[], Logger>;
|
|
42
|
+
static isQueue(obj: unknown): obj is Queue<string, StandardSchemaV1, Service[], Logger, any>;
|
|
40
43
|
/**
|
|
41
44
|
* The canonical id this queue is declared under.
|
|
42
45
|
*
|
|
@@ -47,19 +50,36 @@ declare class Queue<TName extends string = string, TMessage extends StandardSche
|
|
|
47
50
|
*/
|
|
48
51
|
readonly id: string;
|
|
49
52
|
/**
|
|
50
|
-
* The
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
+
* The queue as a dependency — what `.dependsOn([emails])` dissolves into,
|
|
54
|
+
* reachable as `services.emails`.
|
|
55
|
+
*
|
|
56
|
+
* The producer: the queue's one consumer is the handler it was built with,
|
|
57
|
+
* so the only thing another construct can want from a queue is to send to
|
|
58
|
+
* it. It reads `<NAME>_PUBLISHER_CONNECTION_STRING` and picks the transport
|
|
59
|
+
* from its protocol — `pgboss://` locally, `sqs://` deployed. A field
|
|
60
|
+
* assigned once, not a getter: services are cached by object identity.
|
|
61
|
+
*/
|
|
62
|
+
readonly service: Service<Uncapitalize<TName>, EventPublisher<QueueMessage<TName, TMessage>>>;
|
|
63
|
+
/**
|
|
64
|
+
* The producer's env key. Read by both {@link declare} and the service, so
|
|
65
|
+
* what the target publishes and what the producer looks up cannot drift.
|
|
53
66
|
*/
|
|
54
67
|
private readonly connectionKey;
|
|
55
|
-
constructor(name: TName, handler: QueueHandler<TMessage, TServices, TLogger>, messageSchema: TMessage, timeout?: number, services?: TServices, logger?: TLogger,
|
|
56
|
-
|
|
68
|
+
constructor(name: TName, handler: QueueHandler<TMessage, TServices, TLogger, TDatabase>, messageSchema: TMessage, timeout?: number, services?: TServices, logger?: TLogger,
|
|
69
|
+
/** SQS event-source batch size (deployed). */
|
|
70
|
+
batchSize?: number | undefined,
|
|
71
|
+
/** Whether the queue is FIFO (deployed). */
|
|
57
72
|
fifo?: boolean | undefined,
|
|
58
73
|
/**
|
|
59
74
|
* The construct ids the *worker* `.dependsOn()` named — last, so no
|
|
60
75
|
* existing positional argument moves.
|
|
61
76
|
*/
|
|
62
|
-
constructs?: string[]
|
|
77
|
+
constructs?: string[],
|
|
78
|
+
/**
|
|
79
|
+
* What the handler's `db` is registered from — after `constructs`, for
|
|
80
|
+
* the same reason.
|
|
81
|
+
*/
|
|
82
|
+
databaseService?: Service<TDatabaseServiceName, TDatabase>);
|
|
63
83
|
/**
|
|
64
84
|
* What this queue is in the manifest.
|
|
65
85
|
*
|
|
@@ -69,37 +89,17 @@ declare class Queue<TName extends string = string, TMessage extends StandardSche
|
|
|
69
89
|
* running and what connection string to inject.
|
|
70
90
|
*/
|
|
71
91
|
declare(): Declaration[];
|
|
72
|
-
/**
|
|
73
|
-
* The producer side — a `Service` exposing an `EventPublisher` typed to this
|
|
74
|
-
* queue's message. Inject it via `.services([queue.publisher])`; the handler
|
|
75
|
-
* then calls `services.<name>Publisher.publish([{ type, payload }])`.
|
|
76
|
-
*
|
|
77
|
-
* It reads `<NAME>_PUBLISHER_CONNECTION_STRING` and builds the transport from
|
|
78
|
-
* the URL protocol — `pgboss://` locally, `sqs://` deployed — so the same
|
|
79
|
-
* code publishes to Postgres in dev and SQS in prod. Because it's a `Service`,
|
|
80
|
-
* `Construct.getEnvironment()` sniffs it, so the env requirement flows into
|
|
81
|
-
* the manifest and infra links exactly this queue with least privilege.
|
|
82
|
-
*/
|
|
83
|
-
/**
|
|
84
|
-
* The queue as a dependency — what `.dependsOn([emailsQueue])` dissolves
|
|
85
|
-
* into, reachable as `services.emails`.
|
|
86
|
-
*
|
|
87
|
-
* It is the producer: a consumer is the worker written right here, so the
|
|
88
|
-
* only thing another construct can want from a queue is the ability to send
|
|
89
|
-
* to it. {@link publisher} is the same service under its older
|
|
90
|
-
* `<name>Publisher` key, kept for `.services([queue.publisher])`.
|
|
91
|
-
*/
|
|
92
|
-
get service(): Service<Uncapitalize<TName>, EventPublisher<QueueMessage<TName, TMessage>>>;
|
|
93
|
-
get publisher(): Service<`${TName}Publisher`, EventPublisher<QueueMessage<TName, TMessage>>>;
|
|
94
92
|
}
|
|
95
|
-
/**
|
|
96
|
-
|
|
93
|
+
/**
|
|
94
|
+
* The context a queue handler receives — a batch of typed messages, and `db`
|
|
95
|
+
* when the queue has a database.
|
|
96
|
+
*/
|
|
97
|
+
type QueueContext<TMessage extends StandardSchemaV1, TServices extends Service[] = [], TLogger extends Logger = Logger, TDatabase = undefined> = {
|
|
97
98
|
messages: InferStandardSchema<TMessage>[];
|
|
98
99
|
services: ServiceRecord<TServices>;
|
|
99
100
|
logger: TLogger;
|
|
100
|
-
}
|
|
101
|
-
type QueueHandler<TMessage extends StandardSchemaV1, TServices extends Service[] = [], TLogger extends Logger = Logger> = (ctx: QueueContext<TMessage, TServices, TLogger>) => unknown | Promise<unknown>;
|
|
102
|
-
//# sourceMappingURL=Queue.d.ts.map
|
|
101
|
+
} & DatabaseContext<TDatabase>;
|
|
102
|
+
type QueueHandler<TMessage extends StandardSchemaV1, TServices extends Service[] = [], TLogger extends Logger = Logger, TDatabase = undefined> = (ctx: QueueContext<TMessage, TServices, TLogger, TDatabase>) => unknown | Promise<unknown>;
|
|
103
103
|
//#endregion
|
|
104
|
-
export {
|
|
105
|
-
//# sourceMappingURL=Queue-
|
|
104
|
+
export { QueueMessage as i, QueueContext as n, QueueHandler as r, Queue as t };
|
|
105
|
+
//# sourceMappingURL=Queue-HPyi0e1i.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Queue-HPyi0e1i.d.cts","names":[],"sources":["../src/queue/Queue.ts"],"mappings":";;;;;;;;;;;;;;;KA0BY,aACX,sBACA,iBAAiB,oBACd,mBAAmB,OAAO,oBAAoB;;;;;;;;;;;;;;cAerC,MACZ,+BACA,iBAAiB,mBAAmB,kBACpC,kBAAkB,gBAClB,gBAAgB,SAAS,QACzB,uBACA,sDACS,UACT,oBAEA,8BAGA,sBACA;WA8CiB,MAAM;WACN,SAAS,aACxB,UACA,WACA,SACA;WAEe,eAAe;WACN;WACA,UAAU;WACV,QAAQ;;WAEjB;;WAEA;EA1DjB;SAEO,QACN,eACE,OAAO,cAAc,kBAAkB,WAAW;;;;;;;;;WAgB5C;;;;;;;;;;;WAYA,SAAS,QACjB,aAAa,QACb,eAAe,aAAa,OAAO;;;;;mBAOnB;EAEjB,YACiB,MAAM,OACN,SAAS,aACxB,UACA,WACA,SACA,YAEe,eAAe,UACN,kBACA,WAAU,WACV,SAAQ,SAEjB;;EAAA,gCAEA;;EAAA,4BAKhB;;;;;EAAA,uBAKA;;;;;EAAA,kBAAkB,QAAQ,sBAAsB;;;;;;;;;EAyCjD,WAAW;;;;;;KA8BA,aACX,iBAAiB,kBACjB,kBAAkB,gBAClB,gBAAgB,SAAS,QACzB;EAEA,UAAU,oBAAoB;EAC9B,UAAU,cAAc;EACxB,QAAQ;IACL,gBAAgB;KAER,aACX,iBAAiB,kBACjB,kBAAkB,gBAClB,gBAAgB,SAAS,QACzB,0BAEA,KAAK,aAAa,UAAU,WAAW,SAAS,yBAClC"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { t as Construct } from "./Construct-BO1X-kt9.mjs";
|
|
2
|
+
import { canonicalId, provideKey, serviceKey } from "@geekmidas/manifest";
|
|
3
|
+
import { DEFAULT_LOGGER } from "@geekmidas/logger/console";
|
|
4
|
+
import { Publisher } from "@geekmidas/events";
|
|
5
|
+
//#region src/queue/Queue.ts
|
|
6
|
+
/**
|
|
7
|
+
* A queue worker — a point-to-point SQS-style queue and its single consumer.
|
|
8
|
+
* Unlike a `Subscriber` (topic fan-out, filtered by `subscribedEvents`), a queue
|
|
9
|
+
* drains every message of its one `message` type. Build one from the worker
|
|
10
|
+
* that runs it — `worker.queue('Emails').message(schema).handle(…)` — and
|
|
11
|
+
* `gkm build` discovers it into the manifest's `queues` field.
|
|
12
|
+
*
|
|
13
|
+
* Producers send to it by depending on it: `.dependsOn([emails])` makes
|
|
14
|
+
* `services.emails` the publisher.
|
|
15
|
+
*
|
|
16
|
+
* Its handler gets `db` when it has a database: the worker's, declared once
|
|
17
|
+
* with `worker.database(db)`, or its own with `.database(other)`.
|
|
18
|
+
*/
|
|
19
|
+
var Queue = class extends Construct {
|
|
20
|
+
name;
|
|
21
|
+
handler;
|
|
22
|
+
messageSchema;
|
|
23
|
+
timeout;
|
|
24
|
+
services;
|
|
25
|
+
logger;
|
|
26
|
+
batchSize;
|
|
27
|
+
fifo;
|
|
28
|
+
__IS_QUEUE__ = true;
|
|
29
|
+
static isQueue(obj) {
|
|
30
|
+
return Boolean(obj && obj.__IS_QUEUE__ === true && obj.type === "dev.geekmidas.function.queue");
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* The canonical id this queue is declared under.
|
|
34
|
+
*
|
|
35
|
+
* Derived from the name rather than given separately, so `emails` and
|
|
36
|
+
* `Emails` are one queue. The name stays what it was: it is the wire `type`
|
|
37
|
+
* a producer sends and the worker subscribes to, and changing that would
|
|
38
|
+
* silently orphan in-flight messages.
|
|
39
|
+
*/
|
|
40
|
+
id;
|
|
41
|
+
/**
|
|
42
|
+
* The queue as a dependency — what `.dependsOn([emails])` dissolves into,
|
|
43
|
+
* reachable as `services.emails`.
|
|
44
|
+
*
|
|
45
|
+
* The producer: the queue's one consumer is the handler it was built with,
|
|
46
|
+
* so the only thing another construct can want from a queue is to send to
|
|
47
|
+
* it. It reads `<NAME>_PUBLISHER_CONNECTION_STRING` and picks the transport
|
|
48
|
+
* from its protocol — `pgboss://` locally, `sqs://` deployed. A field
|
|
49
|
+
* assigned once, not a getter: services are cached by object identity.
|
|
50
|
+
*/
|
|
51
|
+
service;
|
|
52
|
+
/**
|
|
53
|
+
* The producer's env key. Read by both {@link declare} and the service, so
|
|
54
|
+
* what the target publishes and what the producer looks up cannot drift.
|
|
55
|
+
*/
|
|
56
|
+
connectionKey;
|
|
57
|
+
constructor(name, handler, messageSchema, timeout = 3e4, services = [], logger = DEFAULT_LOGGER, batchSize, fifo, constructs = [], databaseService) {
|
|
58
|
+
super("dev.geekmidas.function.queue", logger, services, [], void 0, timeout, void 0, void 0, constructs);
|
|
59
|
+
this.name = name;
|
|
60
|
+
this.handler = handler;
|
|
61
|
+
this.messageSchema = messageSchema;
|
|
62
|
+
this.timeout = timeout;
|
|
63
|
+
this.services = services;
|
|
64
|
+
this.logger = logger;
|
|
65
|
+
this.batchSize = batchSize;
|
|
66
|
+
this.fifo = fifo;
|
|
67
|
+
this.databaseService = databaseService;
|
|
68
|
+
this.id = canonicalId(name);
|
|
69
|
+
this.connectionKey = provideKey(this.id, "publisherConnectionString");
|
|
70
|
+
const envVar = this.connectionKey;
|
|
71
|
+
this.service = {
|
|
72
|
+
serviceName: serviceKey(this.id),
|
|
73
|
+
async register({ envParser }) {
|
|
74
|
+
const { connectionString } = envParser.create((get) => ({ connectionString: get(envVar).string() })).parse();
|
|
75
|
+
return Publisher.fromConnectionString(connectionString);
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* What this queue is in the manifest.
|
|
81
|
+
*
|
|
82
|
+
* A queue is a resource, not a handler: the worker is reached *through* it,
|
|
83
|
+
* so the declaration carries the producer's key and nothing about the code
|
|
84
|
+
* that drains it. The local target reads this to know which broker has to be
|
|
85
|
+
* running and what connection string to inject.
|
|
86
|
+
*/
|
|
87
|
+
declare() {
|
|
88
|
+
return [{
|
|
89
|
+
kind: "queue",
|
|
90
|
+
id: this.id,
|
|
91
|
+
provides: [this.connectionKey],
|
|
92
|
+
...this.fifo ? { fifo: true } : {},
|
|
93
|
+
worker: {
|
|
94
|
+
id: `${this.id}Worker`,
|
|
95
|
+
handler: `${this.id}.handler`,
|
|
96
|
+
dependencies: []
|
|
97
|
+
}
|
|
98
|
+
}];
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
//#endregion
|
|
102
|
+
export { Queue as t };
|
|
103
|
+
|
|
104
|
+
//# sourceMappingURL=Queue-hwPN-t31.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Queue-hwPN-t31.mjs","names":[],"sources":["../src/queue/Queue.ts"],"sourcesContent":["import {\n\ttype EventPublisher,\n\ttype EventPublisherConnectionString,\n\ttype PublishableMessage,\n\tPublisher,\n} from '@geekmidas/events';\nimport type { Logger } from '@geekmidas/logger';\nimport { DEFAULT_LOGGER } from '@geekmidas/logger/console';\nimport {\n\tcanonicalId,\n\ttype Declaration,\n\tprovideKey,\n\tserviceKey,\n} from '@geekmidas/manifest';\nimport type { InferStandardSchema } from '@geekmidas/schema';\nimport type { Service, ServiceRecord } from '@geekmidas/services';\nimport type { StandardSchemaV1 } from '@standard-schema/spec';\nimport { Construct, ConstructType } from '../Construct';\nimport type { DatabaseContext } from '../functions/Function';\n\n/**\n * The wire message a queue carries: `{ type: <queue name>, payload: <message> }`.\n * The producer publishes this shape and the worker receives the `payload`s as\n * its `messages`. Typing `type` to the queue name keeps the publisher fully\n * typed and lets pg-boss (local) / SQS (deployed) route by name.\n */\nexport type QueueMessage<\n\tTName extends string,\n\tTMessage extends StandardSchemaV1,\n> = PublishableMessage<TName, InferStandardSchema<TMessage>>;\n\n/**\n * A queue worker — a point-to-point SQS-style queue and its single consumer.\n * Unlike a `Subscriber` (topic fan-out, filtered by `subscribedEvents`), a queue\n * drains every message of its one `message` type. Build one from the worker\n * that runs it — `worker.queue('Emails').message(schema).handle(…)` — and\n * `gkm build` discovers it into the manifest's `queues` field.\n *\n * Producers send to it by depending on it: `.dependsOn([emails])` makes\n * `services.emails` the publisher.\n *\n * Its handler gets `db` when it has a database: the worker's, declared once\n * with `worker.database(db)`, or its own with `.database(other)`.\n */\nexport class Queue<\n\tTName extends string = string,\n\tTMessage extends StandardSchemaV1 = StandardSchemaV1,\n\tTServices extends Service[] = [],\n\tTLogger extends Logger = Logger,\n\tTDatabase = undefined,\n\tTDatabaseServiceName extends string = string,\n> extends Construct<\n\tTLogger,\n\tundefined,\n\tTServices,\n\tstring,\n\tundefined,\n\tTDatabaseServiceName,\n\tTDatabase\n> {\n\t__IS_QUEUE__ = true;\n\n\tstatic isQueue(\n\t\tobj: unknown,\n\t): obj is Queue<string, StandardSchemaV1, Service[], Logger, any> {\n\t\treturn Boolean(\n\t\t\tobj &&\n\t\t\t\t(obj as { __IS_QUEUE__?: boolean }).__IS_QUEUE__ === true &&\n\t\t\t\t(obj as Construct).type === ConstructType.Queue,\n\t\t);\n\t}\n\n\t/**\n\t * The canonical id this queue is declared under.\n\t *\n\t * Derived from the name rather than given separately, so `emails` and\n\t * `Emails` are one queue. The name stays what it was: it is the wire `type`\n\t * a producer sends and the worker subscribes to, and changing that would\n\t * silently orphan in-flight messages.\n\t */\n\treadonly id: string;\n\n\t/**\n\t * The queue as a dependency — what `.dependsOn([emails])` dissolves into,\n\t * reachable as `services.emails`.\n\t *\n\t * The producer: the queue's one consumer is the handler it was built with,\n\t * so the only thing another construct can want from a queue is to send to\n\t * it. It reads `<NAME>_PUBLISHER_CONNECTION_STRING` and picks the transport\n\t * from its protocol — `pgboss://` locally, `sqs://` deployed. A field\n\t * assigned once, not a getter: services are cached by object identity.\n\t */\n\treadonly service: Service<\n\t\tUncapitalize<TName>,\n\t\tEventPublisher<QueueMessage<TName, TMessage>>\n\t>;\n\n\t/**\n\t * The producer's env key. Read by both {@link declare} and the service, so\n\t * what the target publishes and what the producer looks up cannot drift.\n\t */\n\tprivate readonly connectionKey: string;\n\n\tconstructor(\n\t\tpublic readonly name: TName,\n\t\tpublic readonly handler: QueueHandler<\n\t\t\tTMessage,\n\t\t\tTServices,\n\t\t\tTLogger,\n\t\t\tTDatabase\n\t\t>,\n\t\tpublic readonly messageSchema: TMessage,\n\t\tpublic override readonly timeout: number = 30000,\n\t\tpublic override readonly services: TServices = [] as unknown as TServices,\n\t\tpublic override readonly logger: TLogger = DEFAULT_LOGGER as TLogger,\n\t\t/** SQS event-source batch size (deployed). */\n\t\tpublic readonly batchSize?: number,\n\t\t/** Whether the queue is FIFO (deployed). */\n\t\tpublic readonly fifo?: boolean,\n\t\t/**\n\t\t * The construct ids the *worker* `.dependsOn()` named — last, so no\n\t\t * existing positional argument moves.\n\t\t */\n\t\tconstructs: string[] = [],\n\t\t/**\n\t\t * What the handler's `db` is registered from — after `constructs`, for\n\t\t * the same reason.\n\t\t */\n\t\tdatabaseService?: Service<TDatabaseServiceName, TDatabase>,\n\t) {\n\t\tsuper(\n\t\t\tConstructType.Queue,\n\t\t\tlogger,\n\t\t\tservices,\n\t\t\t[],\n\t\t\tundefined,\n\t\t\ttimeout,\n\t\t\tundefined, // memorySize\n\t\t\tundefined, // auditorStorageService\n\t\t\tconstructs,\n\t\t);\n\n\t\tthis.databaseService = databaseService;\n\t\tthis.id = canonicalId(name);\n\t\tthis.connectionKey = provideKey(this.id, 'publisherConnectionString');\n\n\t\tconst envVar = this.connectionKey;\n\t\tthis.service = {\n\t\t\tserviceName: serviceKey(this.id) as Uncapitalize<TName>,\n\t\t\tasync register({ envParser }) {\n\t\t\t\tconst { connectionString } = envParser\n\t\t\t\t\t.create((get) => ({ connectionString: get(envVar).string() }))\n\t\t\t\t\t.parse();\n\n\t\t\t\treturn Publisher.fromConnectionString<QueueMessage<TName, TMessage>>(\n\t\t\t\t\tconnectionString as EventPublisherConnectionString,\n\t\t\t\t);\n\t\t\t},\n\t\t};\n\t}\n\n\t/**\n\t * What this queue is in the manifest.\n\t *\n\t * A queue is a resource, not a handler: the worker is reached *through* it,\n\t * so the declaration carries the producer's key and nothing about the code\n\t * that drains it. The local target reads this to know which broker has to be\n\t * running and what connection string to inject.\n\t */\n\tdeclare(): Declaration[] {\n\t\treturn [\n\t\t\t{\n\t\t\t\tkind: 'queue',\n\t\t\t\tid: this.id,\n\t\t\t\tprovides: [this.connectionKey],\n\t\t\t\t...(this.fifo ? { fifo: true } : {}),\n\t\t\t\t// Nested rather than a sibling node, because position carries the\n\t\t\t\t// trigger: this handler is reached by messages on this queue and\n\t\t\t\t// by nothing else, so there is no `trigger` field to keep in step.\n\t\t\t\t//\n\t\t\t\t// `handler` is the export name; which directory the build wrote it\n\t\t\t\t// to is the target's business, and a path with a cloud in it does\n\t\t\t\t// not belong in a neutral declaration.\n\t\t\t\tworker: {\n\t\t\t\t\tid: `${this.id}Worker`,\n\t\t\t\t\thandler: `${this.id}.handler`,\n\t\t\t\t\t// Filled by the build from what the worker declared. Empty is a\n\t\t\t\t\t// stated gap, not a claim that it reaches nothing.\n\t\t\t\t\tdependencies: [],\n\t\t\t\t},\n\t\t\t},\n\t\t];\n\t}\n}\n\n/**\n * The context a queue handler receives — a batch of typed messages, and `db`\n * when the queue has a database.\n */\nexport type QueueContext<\n\tTMessage extends StandardSchemaV1,\n\tTServices extends Service[] = [],\n\tTLogger extends Logger = Logger,\n\tTDatabase = undefined,\n> = {\n\tmessages: InferStandardSchema<TMessage>[];\n\tservices: ServiceRecord<TServices>;\n\tlogger: TLogger;\n} & DatabaseContext<TDatabase>;\n\nexport type QueueHandler<\n\tTMessage extends StandardSchemaV1,\n\tTServices extends Service[] = [],\n\tTLogger extends Logger = Logger,\n\tTDatabase = undefined,\n> = (\n\tctx: QueueContext<TMessage, TServices, TLogger, TDatabase>,\n) => unknown | Promise<unknown>;\n"],"mappings":";;;;;;;;;;;;;;;;;;AA4CA,IAAa,QAAb,cAOU,UAQR;CA6CgB;CACA;CAMA;CACS;CACA;CACA;CAET;CAEA;CA1DjB,eAAe;CAEf,OAAO,QACN,KACiE;EACjE,OAAO,QACN,OACE,IAAmC,iBAAiB,QACpD,IAAkB,SAAA,8BACrB;CACD;;;;;;;;;CAUA;;;;;;;;;;;CAYA;;;;;CASA;CAEA,YACC,MACA,SAMA,eACA,UAA2C,KAC3C,WAA+C,CAAC,GAChD,SAA2C,gBAE3C,WAEA,MAKA,aAAuB,CAAC,GAKxB,iBACC;EACD,MAAA,gCAEC,QACA,UACA,CAAC,GACD,KAAA,GACA,SACA,KAAA,GACA,KAAA,GACA,UACD;EApCgB,KAAA,OAAA;EACA,KAAA,UAAA;EAMA,KAAA,gBAAA;EACS,KAAA,UAAA;EACA,KAAA,WAAA;EACA,KAAA,SAAA;EAET,KAAA,YAAA;EAEA,KAAA,OAAA;EAwBhB,KAAK,kBAAkB;EACvB,KAAK,KAAK,YAAY,IAAI;EAC1B,KAAK,gBAAgB,WAAW,KAAK,IAAI,2BAA2B;EAEpE,MAAM,SAAS,KAAK;EACpB,KAAK,UAAU;GACd,aAAa,WAAW,KAAK,EAAE;GAC/B,MAAM,SAAS,EAAE,aAAa;IAC7B,MAAM,EAAE,qBAAqB,UAC3B,QAAQ,SAAS,EAAE,kBAAkB,IAAI,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAC7D,MAAM;IAER,OAAO,UAAU,qBAChB,gBACD;GACD;EACD;CACD;;;;;;;;;CAUA,UAAyB;EACxB,OAAO,CACN;GACC,MAAM;GACN,IAAI,KAAK;GACT,UAAU,CAAC,KAAK,aAAa;GAC7B,GAAI,KAAK,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;GAQlC,QAAQ;IACP,IAAI,GAAG,KAAK,GAAG;IACf,SAAS,GAAG,KAAK,GAAG;IAGpB,cAAc,CAAC;GAChB;EACD,CACD;CACD;AACD"}
|