@geekmidas/constructs 10.0.0-alpha.4 → 10.0.0-alpha.41
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-CMEGfRs8.d.cts} +21 -8
- package/dist/Cron-CMEGfRs8.d.cts.map +1 -0
- package/dist/{Cron-ByxdOfpE.d.mts → Cron-D6X4-xjB.d.mts} +21 -8
- package/dist/Cron-D6X4-xjB.d.mts.map +1 -0
- package/dist/CronBuilder-CEK7aOqD.d.cts +46 -0
- package/dist/CronBuilder-CEK7aOqD.d.cts.map +1 -0
- package/dist/CronBuilder-DB35T5dL.cjs +116 -0
- package/dist/CronBuilder-DB35T5dL.cjs.map +1 -0
- package/dist/CronBuilder-Dv0IlZs0.mjs +104 -0
- package/dist/CronBuilder-Dv0IlZs0.mjs.map +1 -0
- package/dist/CronBuilder-O_gvButp.d.mts +46 -0
- package/dist/CronBuilder-O_gvButp.d.mts.map +1 -0
- package/dist/{Endpoint-Dij_wOcc.mjs → Endpoint-CQAeh1Rh.mjs} +117 -109
- package/dist/Endpoint-CQAeh1Rh.mjs.map +1 -0
- package/dist/{Endpoint-DODn1RhN.cjs → Endpoint-D1L9qu5C.cjs} +145 -131
- package/dist/Endpoint-D1L9qu5C.cjs.map +1 -0
- package/dist/{Endpoint-2Wg7T7Cq.d.mts → Endpoint-Dp5AKIXl.d.cts} +69 -93
- package/dist/Endpoint-Dp5AKIXl.d.cts.map +1 -0
- package/dist/{Endpoint-DrD8a1yH.d.cts → Endpoint-DtI7heFm.d.mts} +70 -94
- package/dist/Endpoint-DtI7heFm.d.mts.map +1 -0
- package/dist/{EndpointFactory-b4ituq-s.mjs → EndpointFactory-BBdNeaGJ.mjs} +39 -74
- package/dist/EndpointFactory-BBdNeaGJ.mjs.map +1 -0
- package/dist/{EndpointFactory-BHFMmFkV.cjs → EndpointFactory-BZOCOaK6.cjs} +75 -110
- package/dist/EndpointFactory-BZOCOaK6.cjs.map +1 -0
- package/dist/{index-BxHDdy6a.d.mts → EndpointFactory-CgMDvERK.d.mts} +63 -133
- package/dist/EndpointFactory-CgMDvERK.d.mts.map +1 -0
- package/dist/{index-B8g8POkr.d.cts → EndpointFactory-FeFRmlDZ.d.cts} +62 -132
- package/dist/EndpointFactory-FeFRmlDZ.d.cts.map +1 -0
- package/dist/{HonoEndpointAdaptor-BM2jbWht.mjs → HonoEndpointAdaptor-Aui-x9Lg.mjs} +41 -47
- package/dist/HonoEndpointAdaptor-Aui-x9Lg.mjs.map +1 -0
- package/dist/{HonoEndpointAdaptor-De6IlBZe.cjs → HonoEndpointAdaptor-Cq99r9H7.cjs} +50 -53
- package/dist/HonoEndpointAdaptor-Cq99r9H7.cjs.map +1 -0
- package/dist/Queue-C1uDgjxt.mjs +100 -0
- package/dist/Queue-C1uDgjxt.mjs.map +1 -0
- package/dist/Queue-Ckmudcm8.cjs +105 -0
- package/dist/Queue-Ckmudcm8.cjs.map +1 -0
- package/dist/{Queue-D7ZuwBhy.d.cts → Queue-CpQIGB_2.d.cts} +28 -40
- package/dist/Queue-CpQIGB_2.d.cts.map +1 -0
- package/dist/{Queue-gVGfi2Yk.d.mts → Queue-YmvN2vEP.d.mts} +28 -40
- package/dist/Queue-YmvN2vEP.d.mts.map +1 -0
- package/dist/QueueBuilder-CJNcv4dy.cjs +112 -0
- package/dist/QueueBuilder-CJNcv4dy.cjs.map +1 -0
- package/dist/QueueBuilder-CM0WUxfw.d.mts +62 -0
- package/dist/QueueBuilder-CM0WUxfw.d.mts.map +1 -0
- package/dist/QueueBuilder-XEnnOWGe.d.cts +62 -0
- package/dist/QueueBuilder-XEnnOWGe.d.cts.map +1 -0
- package/dist/QueueBuilder-XuPKZwKH.mjs +95 -0
- package/dist/QueueBuilder-XuPKZwKH.mjs.map +1 -0
- package/dist/{Subscriber-2mEi0ImH.d.cts → Subscriber-B91YSkZt.d.cts} +14 -16
- package/dist/Subscriber-B91YSkZt.d.cts.map +1 -0
- package/dist/{Subscriber-xTJ9ayPN.d.mts → Subscriber-BjHYe5hK.d.mts} +14 -16
- package/dist/Subscriber-BjHYe5hK.d.mts.map +1 -0
- package/dist/SubscriberBuilder-BSpQX1JT.d.cts +55 -0
- package/dist/SubscriberBuilder-BSpQX1JT.d.cts.map +1 -0
- package/dist/SubscriberBuilder-BhMphk4z.d.mts +55 -0
- package/dist/SubscriberBuilder-BhMphk4z.d.mts.map +1 -0
- package/dist/{SubscriberBuilder-4OPehf2R.cjs → SubscriberBuilder-Duk028pD.cjs} +34 -37
- package/dist/SubscriberBuilder-Duk028pD.cjs.map +1 -0
- package/dist/{SubscriberBuilder-BjkbeT9l.mjs → SubscriberBuilder-DzQUWE08.mjs} +23 -25
- package/dist/SubscriberBuilder-DzQUWE08.mjs.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 +171 -108
- package/dist/adaptors/aws.cjs.map +1 -1
- package/dist/adaptors/aws.d.cts +75 -43
- package/dist/adaptors/aws.d.cts.map +1 -1
- package/dist/adaptors/aws.d.mts +76 -44
- package/dist/adaptors/aws.d.mts.map +1 -1
- package/dist/adaptors/aws.mjs +143 -83
- 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 +515 -87
- package/dist/adaptors/testing.cjs.map +1 -1
- package/dist/adaptors/testing.d.cts +250 -48
- package/dist/adaptors/testing.d.cts.map +1 -1
- package/dist/adaptors/testing.d.mts +250 -48
- package/dist/adaptors/testing.d.mts.map +1 -1
- package/dist/adaptors/testing.mjs +484 -68
- package/dist/adaptors/testing.mjs.map +1 -1
- package/dist/auth-CMwml9QN.d.mts +188 -0
- package/dist/auth-CMwml9QN.d.mts.map +1 -0
- package/dist/auth-rVRDjIw_.d.cts +188 -0
- package/dist/auth-rVRDjIw_.d.cts.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-C9a_hVCc.d.cts} +4 -7
- package/dist/cache-C9a_hVCc.d.cts.map +1 -0
- package/dist/{cache-BtZY_tHe.d.cts → cache-CeTMI8LR.d.mts} +4 -7
- package/dist/cache-CeTMI8LR.d.mts.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/{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-g5GM5pwR.d.mts → construct-interface-_3zgxzXl.d.mts} +20 -11
- package/dist/construct-interface-_3zgxzXl.d.mts.map +1 -0
- package/dist/{construct-interface-D9d4Gm4p.d.cts → construct-interface-_xi4BPN8.d.cts} +20 -11
- package/dist/construct-interface-_xi4BPN8.d.cts.map +1 -0
- package/dist/construct-interface.cjs +87 -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 +81 -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/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-DS3mujT5.d.mts +86 -0
- package/dist/external-api-DS3mujT5.d.mts.map +1 -0
- package/dist/external-api-LBfE-q3g.d.cts +86 -0
- package/dist/external-api-LBfE-q3g.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 +2 -4
- package/dist/functions/index.d.mts +2 -4
- package/dist/functions/index.mjs +2 -6
- package/dist/{functions-Ck21Uyq0.mjs → functions-DCIfCRR-.mjs} +371 -241
- package/dist/functions-DCIfCRR-.mjs.map +1 -0
- package/dist/{functions-DJJA7VGc.cjs → functions-ZH60FE7H.cjs} +409 -273
- package/dist/functions-ZH60FE7H.cjs.map +1 -0
- package/dist/{index-AIfVzkhi.d.cts → index-B0kxstwf.d.cts} +49 -42
- package/dist/index-B0kxstwf.d.cts.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-CubPzHd9.d.mts → index-CjVEjOw0.d.mts} +49 -42
- package/dist/index-CjVEjOw0.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/kysely-BJ8IQ_1P.d.mts +159 -0
- package/dist/kysely-BJ8IQ_1P.d.mts.map +1 -0
- package/dist/kysely-DVF8wOT4.d.cts +159 -0
- package/dist/kysely-DVF8wOT4.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 +70 -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 +69 -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 +118 -35
- package/dist/worker.cjs.map +1 -1
- package/dist/worker.d.cts +95 -42
- package/dist/worker.d.cts.map +1 -1
- package/dist/worker.d.mts +95 -42
- package/dist/worker.d.mts.map +1 -1
- package/dist/worker.mjs +113 -30
- package/dist/worker.mjs.map +1 -1
- package/package.json +66 -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-ByxdOfpE.d.mts.map +0 -1
- package/dist/CronBuilder-BL0AP6fs.d.mts +0 -44
- package/dist/CronBuilder-BL0AP6fs.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-2Wg7T7Cq.d.mts.map +0 -1
- package/dist/Endpoint-DODn1RhN.cjs.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.map +0 -1
- package/dist/index-B8g8POkr.d.cts.map +0 -1
- package/dist/index-BxHDdy6a.d.mts.map +0 -1
- package/dist/index-CubPzHd9.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
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
const __geekmidas_audit = require_chunk.__toESM(require("@geekmidas/audit"));
|
|
3
|
-
|
|
1
|
+
let _geekmidas_audit = require("@geekmidas/audit");
|
|
4
2
|
//#region src/endpoints/processAudits.ts
|
|
5
3
|
/**
|
|
6
4
|
* Create audit context for handler execution.
|
|
@@ -13,9 +11,8 @@ const __geekmidas_audit = require_chunk.__toESM(require("@geekmidas/audit"));
|
|
|
13
11
|
* @returns Audit context with auditor and storage, or undefined if not configured
|
|
14
12
|
*/
|
|
15
13
|
async function createAuditContext(endpoint, serviceDiscovery, logger, ctx) {
|
|
16
|
-
if (!endpoint.auditorStorageService) return
|
|
17
|
-
const
|
|
18
|
-
const storage = services[endpoint.auditorStorageService.serviceName];
|
|
14
|
+
if (!endpoint.auditorStorageService) return;
|
|
15
|
+
const storage = (await serviceDiscovery.register([endpoint.auditorStorageService]))[endpoint.auditorStorageService.serviceName];
|
|
19
16
|
let actor = {
|
|
20
17
|
id: "system",
|
|
21
18
|
type: "system"
|
|
@@ -31,16 +28,15 @@ async function createAuditContext(endpoint, serviceDiscovery, logger, ctx) {
|
|
|
31
28
|
} catch (error) {
|
|
32
29
|
logger.error(error, "Failed to extract actor for audits");
|
|
33
30
|
}
|
|
34
|
-
const auditor = new __geekmidas_audit.DefaultAuditor({
|
|
35
|
-
actor,
|
|
36
|
-
storage,
|
|
37
|
-
metadata: {
|
|
38
|
-
endpoint: endpoint.route,
|
|
39
|
-
method: endpoint.method
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
31
|
return {
|
|
43
|
-
auditor
|
|
32
|
+
auditor: new _geekmidas_audit.DefaultAuditor({
|
|
33
|
+
actor,
|
|
34
|
+
storage,
|
|
35
|
+
metadata: {
|
|
36
|
+
endpoint: endpoint.route,
|
|
37
|
+
method: endpoint.method
|
|
38
|
+
}
|
|
39
|
+
}),
|
|
44
40
|
storage
|
|
45
41
|
};
|
|
46
42
|
}
|
|
@@ -66,27 +62,27 @@ async function executeWithAuditTransaction(auditContext, handler, onComplete, op
|
|
|
66
62
|
if (!auditContext) return handler(void 0);
|
|
67
63
|
const { auditor, storage } = auditContext;
|
|
68
64
|
if (storage.withTransaction) return storage.withTransaction(auditor, async () => {
|
|
69
|
-
const response
|
|
70
|
-
if (onComplete) await onComplete(response
|
|
71
|
-
return response
|
|
65
|
+
const response = await handler(auditor);
|
|
66
|
+
if (onComplete) await onComplete(response, auditor);
|
|
67
|
+
return response;
|
|
72
68
|
}, options?.db);
|
|
73
69
|
const response = await handler(auditor);
|
|
74
70
|
if (onComplete) await onComplete(response, auditor);
|
|
75
71
|
await auditor.flush();
|
|
76
72
|
return response;
|
|
77
73
|
}
|
|
78
|
-
|
|
79
74
|
//#endregion
|
|
80
|
-
Object.defineProperty(exports,
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
75
|
+
Object.defineProperty(exports, "createAuditContext", {
|
|
76
|
+
enumerable: true,
|
|
77
|
+
get: function() {
|
|
78
|
+
return createAuditContext;
|
|
79
|
+
}
|
|
85
80
|
});
|
|
86
|
-
Object.defineProperty(exports,
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
81
|
+
Object.defineProperty(exports, "executeWithAuditTransaction", {
|
|
82
|
+
enumerable: true,
|
|
83
|
+
get: function() {
|
|
84
|
+
return executeWithAuditTransaction;
|
|
85
|
+
}
|
|
91
86
|
});
|
|
92
|
-
|
|
87
|
+
|
|
88
|
+
//# sourceMappingURL=processAudits-D_2W5x8k.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"processAudits-D_2W5x8k.cjs","names":["DefaultAuditor"],"sources":["../src/endpoints/processAudits.ts"],"sourcesContent":["import type {\n\tAuditActor,\n\tAuditableAction,\n\tAuditor,\n\tAuditStorage,\n} from '@geekmidas/audit';\nimport { DefaultAuditor } from '@geekmidas/audit';\nimport type { Logger } from '@geekmidas/logger';\nimport type { InferStandardSchema } from '@geekmidas/schema';\nimport type { Service, ServiceDiscovery } from '@geekmidas/services';\nimport type { StandardSchemaV1 } from '@standard-schema/spec';\nimport type { ActorExtractor, MappedAudit } from './audit';\nimport type { CookieFn, Endpoint, HeaderFn } from './Endpoint';\n\n/**\n * Process declarative audit definitions after successful endpoint execution.\n * Similar to publishConstructEvents for events.\n *\n * @param endpoint - The endpoint with audit configuration\n * @param response - The handler response to generate audit payloads from\n * @param serviceDiscovery - Service discovery for registering audit storage\n * @param logger - Logger for debug/error messages\n * @param ctx - Request context (session, headers, cookies, services)\n * @param existingAuditor - Optional existing auditor instance (e.g., from handler context).\n * If provided, uses this auditor (with its stored transaction).\n * If not provided, creates a new auditor.\n */\nexport async function processEndpointAudits<\n\tTServices extends Service[] = [],\n\tTSession = unknown,\n\tTLogger extends Logger = Logger,\n\tOutSchema extends StandardSchemaV1 | undefined = undefined,\n\tTAuditStorage extends AuditStorage | undefined = undefined,\n\tTAuditStorageServiceName extends string = string,\n\tTAuditAction extends AuditableAction<string, unknown> = AuditableAction<\n\t\tstring,\n\t\tunknown\n\t>,\n>(\n\tendpoint: Endpoint<\n\t\tany,\n\t\tany,\n\t\tany,\n\t\tOutSchema,\n\t\tTServices,\n\t\tTLogger,\n\t\tTSession,\n\t\tTAuditStorage,\n\t\tTAuditStorageServiceName,\n\t\tTAuditAction\n\t>,\n\tresponse: InferStandardSchema<OutSchema>,\n\tserviceDiscovery: ServiceDiscovery<any>,\n\tlogger: TLogger,\n\tctx: {\n\t\tsession: TSession;\n\t\theader: HeaderFn;\n\t\tcookie: CookieFn;\n\t\tservices: Record<string, unknown>;\n\t},\n\texistingAuditor?: Auditor<TAuditAction>,\n): Promise<void> {\n\ttry {\n\t\tconst audits = endpoint.audits as MappedAudit<TAuditAction, OutSchema>[];\n\n\t\t// If we have an existing auditor (from handler context), we need to flush\n\t\t// any manual audits it collected, even if there are no declarative audits\n\t\tconst hasExistingRecords =\n\t\t\texistingAuditor && existingAuditor.getRecords().length > 0;\n\n\t\t// Skip if no declarative audits and no existing records to flush\n\t\tif (!audits?.length && !hasExistingRecords) {\n\t\t\tlogger.debug('No audits to process');\n\t\t\treturn;\n\t\t}\n\n\t\t// If no auditor storage service and we have things to process, warn\n\t\tif (!endpoint.auditorStorageService) {\n\t\t\tif (hasExistingRecords || audits?.length) {\n\t\t\t\tlogger.warn('No auditor storage service available');\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\t// Get or create auditor\n\t\tlet auditor: Auditor<TAuditAction>;\n\n\t\tif (existingAuditor) {\n\t\t\t// Use existing auditor (preserves stored transaction and manual audits)\n\t\t\tauditor = existingAuditor;\n\t\t\tlogger.debug('Using existing auditor from handler context');\n\t\t} else {\n\t\t\t// Create new auditor (backward compatibility)\n\t\t\tconst services = await serviceDiscovery.register([\n\t\t\t\tendpoint.auditorStorageService,\n\t\t\t]);\n\t\t\tconst storage = services[\n\t\t\t\tendpoint.auditorStorageService.serviceName\n\t\t\t] as AuditStorage;\n\n\t\t\t// Extract actor if configured\n\t\t\tlet actor: AuditActor = { id: 'system', type: 'system' };\n\t\t\tif (endpoint.actorExtractor) {\n\t\t\t\ttry {\n\t\t\t\t\tactor = await (\n\t\t\t\t\t\tendpoint.actorExtractor as ActorExtractor<\n\t\t\t\t\t\t\tTServices,\n\t\t\t\t\t\t\tTSession,\n\t\t\t\t\t\t\tTLogger\n\t\t\t\t\t\t>\n\t\t\t\t\t)({\n\t\t\t\t\t\tservices: ctx.services as any,\n\t\t\t\t\t\tsession: ctx.session,\n\t\t\t\t\t\theader: ctx.header,\n\t\t\t\t\t\tcookie: ctx.cookie,\n\t\t\t\t\t\tlogger,\n\t\t\t\t\t});\n\t\t\t\t} catch (error) {\n\t\t\t\t\tlogger.error(error as Error, 'Failed to extract actor for audits');\n\t\t\t\t\t// Continue with system actor\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tauditor = new DefaultAuditor<TAuditAction>({\n\t\t\t\tactor,\n\t\t\t\tstorage,\n\t\t\t\tmetadata: {\n\t\t\t\t\tendpoint: endpoint.route,\n\t\t\t\t\tmethod: endpoint.method,\n\t\t\t\t},\n\t\t\t});\n\t\t}\n\n\t\t// Process each declarative audit\n\t\tif (audits?.length) {\n\t\t\tfor (const audit of audits) {\n\t\t\t\tlogger.debug({ audit: audit.type }, 'Processing declarative audit');\n\n\t\t\t\t// Check when condition\n\t\t\t\tif (audit.when && !audit.when(response as any)) {\n\t\t\t\t\tlogger.debug(\n\t\t\t\t\t\t{ audit: audit.type },\n\t\t\t\t\t\t'Audit skipped due to when condition',\n\t\t\t\t\t);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\t// Extract payload\n\t\t\t\tconst payload = audit.payload(response as any);\n\n\t\t\t\t// Extract entityId if configured\n\t\t\t\tconst entityId = audit.entityId?.(response as any);\n\n\t\t\t\t// Record the audit\n\t\t\t\tauditor.audit(audit.type as any, payload as any, {\n\t\t\t\t\ttable: audit.table,\n\t\t\t\t\tentityId,\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\n\t\t// Flush audits to storage\n\t\t// Note: If existingAuditor has a stored transaction (via setTransaction),\n\t\t// flush() will use it automatically\n\t\tconst recordCount = auditor.getRecords().length;\n\t\tif (recordCount > 0) {\n\t\t\t// Check if auditor has a stored transaction (for logging purposes)\n\t\t\tconst trx =\n\t\t\t\t'getTransaction' in auditor\n\t\t\t\t\t? (auditor as { getTransaction(): unknown }).getTransaction()\n\t\t\t\t\t: undefined;\n\t\t\tlogger.debug(\n\t\t\t\t{ auditCount: recordCount, hasTransaction: !!trx },\n\t\t\t\t'Flushing audits',\n\t\t\t);\n\t\t\tawait auditor.flush();\n\t\t}\n\t} catch (error) {\n\t\tlogger.error(error as Error, 'Failed to process audits');\n\t\t// Don't rethrow - audit failures shouldn't fail the request\n\t}\n}\n\n/**\n * Context for audit-aware handler execution.\n */\nexport interface AuditExecutionContext<\n\tTAuditAction extends AuditableAction<string, unknown> = AuditableAction<\n\t\tstring,\n\t\tunknown\n\t>,\n> {\n\t/** The auditor instance for recording audits */\n\tauditor: Auditor<TAuditAction>;\n\t/** The audit storage instance */\n\tstorage: AuditStorage;\n}\n\n/**\n * Create audit context for handler execution.\n * Returns the auditor and storage for use in the handler.\n *\n * @param endpoint - The endpoint with audit configuration\n * @param serviceDiscovery - Service discovery for getting audit storage\n * @param logger - Logger for debug/error messages\n * @param ctx - Request context for actor extraction\n * @returns Audit context with auditor and storage, or undefined if not configured\n */\nexport async function createAuditContext<\n\tTServices extends Service[] = [],\n\tTSession = unknown,\n\tTLogger extends Logger = Logger,\n\tTAuditStorage extends AuditStorage | undefined = undefined,\n\tTAuditStorageServiceName extends string = string,\n\tTAuditAction extends AuditableAction<string, unknown> = AuditableAction<\n\t\tstring,\n\t\tunknown\n\t>,\n\tTDatabase = undefined,\n\tTDatabaseServiceName extends string = string,\n>(\n\tendpoint: Endpoint<\n\t\tany,\n\t\tany,\n\t\tany,\n\t\tany,\n\t\tTServices,\n\t\tTLogger,\n\t\tTSession,\n\t\tTAuditStorage,\n\t\tTAuditStorageServiceName,\n\t\tTAuditAction,\n\t\tTDatabase,\n\t\tTDatabaseServiceName\n\t>,\n\tserviceDiscovery: ServiceDiscovery<any>,\n\tlogger: TLogger,\n\tctx: {\n\t\tsession: TSession;\n\t\theader: HeaderFn;\n\t\tcookie: CookieFn;\n\t\tservices: Record<string, unknown>;\n\t},\n): Promise<AuditExecutionContext<TAuditAction> | undefined> {\n\tif (!endpoint.auditorStorageService) {\n\t\treturn undefined;\n\t}\n\n\tconst services = await serviceDiscovery.register([\n\t\tendpoint.auditorStorageService,\n\t]);\n\tconst storage = services[\n\t\tendpoint.auditorStorageService.serviceName\n\t] as AuditStorage;\n\n\t// Extract actor if configured\n\tlet actor: AuditActor = { id: 'system', type: 'system' };\n\tif (endpoint.actorExtractor) {\n\t\ttry {\n\t\t\tactor = await (\n\t\t\t\tendpoint.actorExtractor as ActorExtractor<TServices, TSession, TLogger>\n\t\t\t)({\n\t\t\t\tservices: ctx.services as any,\n\t\t\t\tsession: ctx.session,\n\t\t\t\theader: ctx.header,\n\t\t\t\tcookie: ctx.cookie,\n\t\t\t\tlogger,\n\t\t\t});\n\t\t} catch (error) {\n\t\t\tlogger.error(error as Error, 'Failed to extract actor for audits');\n\t\t}\n\t}\n\n\tconst auditor = new DefaultAuditor<TAuditAction>({\n\t\tactor,\n\t\tstorage,\n\t\tmetadata: {\n\t\t\tendpoint: endpoint.route,\n\t\t\tmethod: endpoint.method,\n\t\t},\n\t});\n\n\treturn { auditor, storage };\n}\n\n/**\n * Options for executeWithAuditTransaction.\n */\nexport interface ExecuteWithAuditTransactionOptions {\n\t/**\n\t * Database connection to use for the transaction.\n\t * If this is already a transaction, it will be reused instead of creating a nested one.\n\t * If not provided, the storage's internal database is used.\n\t */\n\tdb?: unknown;\n}\n\n/**\n * Execute a handler with automatic audit transaction support.\n * If the audit storage provides a withTransaction method, wraps execution\n * in a transaction so audits are atomic with handler's database operations.\n *\n * This is database-agnostic - each storage implementation provides its own\n * transaction handling based on the underlying database (Kysely, Drizzle, etc.).\n *\n * If the db parameter is provided and is already a transaction, the storage\n * will reuse it instead of creating a nested transaction (similar to\n * packages/db/src/kysely.ts#withTransaction).\n *\n * @param auditContext - The audit context from createAuditContext\n * @param handler - The handler function to execute (receives auditor)\n * @param onComplete - Called after handler with response, to process declarative audits\n * @param options - Optional configuration including database connection\n * @returns The handler result\n */\nexport async function executeWithAuditTransaction<\n\tT,\n\tTAuditAction extends AuditableAction<string, unknown> = AuditableAction<\n\t\tstring,\n\t\tunknown\n\t>,\n>(\n\tauditContext: AuditExecutionContext<TAuditAction> | undefined,\n\thandler: (auditor?: Auditor<TAuditAction>) => Promise<T>,\n\tonComplete?: (response: T, auditor: Auditor<TAuditAction>) => Promise<void>,\n\toptions?: ExecuteWithAuditTransactionOptions,\n): Promise<T> {\n\t// No audit context - just run handler\n\tif (!auditContext) {\n\t\treturn handler(undefined);\n\t}\n\n\tconst { auditor, storage } = auditContext;\n\n\t// Check if storage provides a transaction wrapper\n\tif (storage.withTransaction) {\n\t\t// Wrap in transaction - audits are atomic with handler operations\n\t\t// The storage's withTransaction handles setTransaction and flush\n\t\t// Pass db so existing transactions are reused\n\t\treturn storage.withTransaction(\n\t\t\tauditor,\n\t\t\tasync () => {\n\t\t\t\tconst response = await handler(auditor);\n\n\t\t\t\t// Process declarative audits within the transaction\n\t\t\t\tif (onComplete) {\n\t\t\t\t\tawait onComplete(response, auditor);\n\t\t\t\t}\n\n\t\t\t\treturn response;\n\t\t\t},\n\t\t\toptions?.db,\n\t\t);\n\t}\n\n\t// No transaction support - run handler and flush audits after\n\tconst response = await handler(auditor);\n\n\tif (onComplete) {\n\t\tawait onComplete(response, auditor);\n\t}\n\n\t// Flush audits (no transaction)\n\tawait auditor.flush();\n\n\treturn response;\n}\n"],"mappings":";;;;;;;;;;;;AAgNA,eAAsB,mBAarB,UAcA,kBACA,QACA,KAM2D;CAC3D,IAAI,CAAC,SAAS,uBACb;CAMD,MAAM,WAAU,MAHO,iBAAiB,SAAS,CAChD,SAAS,qBACV,CAAC,EAAA,CAEA,SAAS,sBAAsB;CAIhC,IAAI,QAAoB;EAAE,IAAI;EAAU,MAAM;CAAS;CACvD,IAAI,SAAS,gBACZ,IAAI;EACH,QAAQ,MACP,SAAS,eACR;GACD,UAAU,IAAI;GACd,SAAS,IAAI;GACb,QAAQ,IAAI;GACZ,QAAQ,IAAI;GACZ;EACD,CAAC;CACF,SAAS,OAAO;EACf,OAAO,MAAM,OAAgB,oCAAoC;CAClE;CAYD,OAAO;EAAE,SAAA,IATWA,iBAAAA,eAA6B;GAChD;GACA;GACA,UAAU;IACT,UAAU,SAAS;IACnB,QAAQ,SAAS;GAClB;EACD,CAEe;EAAG;CAAQ;AAC3B;;;;;;;;;;;;;;;;;;;AAgCA,eAAsB,4BAOrB,cACA,SACA,YACA,SACa;CAEb,IAAI,CAAC,cACJ,OAAO,QAAQ,KAAA,CAAS;CAGzB,MAAM,EAAE,SAAS,YAAY;CAG7B,IAAI,QAAQ,iBAIX,OAAO,QAAQ,gBACd,SACA,YAAY;EACX,MAAM,WAAW,MAAM,QAAQ,OAAO;EAGtC,IAAI,YACH,MAAM,WAAW,UAAU,OAAO;EAGnC,OAAO;CACR,GACA,SAAS,EACV;CAID,MAAM,WAAW,MAAM,QAAQ,OAAO;CAEtC,IAAI,YACH,MAAM,WAAW,UAAU,OAAO;CAInC,MAAM,QAAQ,MAAM;CAEpB,OAAO;AACR"}
|
package/dist/queue/index.cjs
CHANGED
|
@@ -1,189 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
const
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const __geekmidas_events = require_chunk.__toESM(require("@geekmidas/events"));
|
|
8
|
-
|
|
9
|
-
//#region src/queue/Queue.ts
|
|
10
|
-
/**
|
|
11
|
-
* A queue worker — a point-to-point SQS-style queue and its single consumer.
|
|
12
|
-
* Unlike a `Subscriber` (topic fan-out, filtered by `subscribedEvents`), a queue
|
|
13
|
-
* drains every message of its one `message` type. Build one with `q` (see
|
|
14
|
-
* `QueueBuilder`); `gkm build` discovers it into the manifest's `queues` field.
|
|
15
|
-
*
|
|
16
|
-
* The producer side is {@link Queue.publisher} — a ready-to-inject `Service`
|
|
17
|
-
* that any endpoint/function drops into `.services([...])` to send messages.
|
|
18
|
-
*/
|
|
19
|
-
var Queue = class extends require_Construct.Construct {
|
|
20
|
-
__IS_QUEUE__ = true;
|
|
21
|
-
static isQueue(obj) {
|
|
22
|
-
return Boolean(obj && obj.__IS_QUEUE__ === true && obj.type === require_Construct.ConstructType.Queue);
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* The canonical id this queue is declared under.
|
|
26
|
-
*
|
|
27
|
-
* Derived from the name rather than given separately, so `emails` and
|
|
28
|
-
* `Emails` are one queue. The name stays what it was: it is the wire `type`
|
|
29
|
-
* a producer sends and the worker subscribes to, and changing that would
|
|
30
|
-
* silently orphan in-flight messages.
|
|
31
|
-
*/
|
|
32
|
-
id;
|
|
33
|
-
/**
|
|
34
|
-
* The producer's env key. Read by both {@link declare} and
|
|
35
|
-
* {@link publisher}, so what the target publishes and what the producer
|
|
36
|
-
* looks up cannot drift.
|
|
37
|
-
*/
|
|
38
|
-
connectionKey;
|
|
39
|
-
constructor(name, handler, messageSchema, timeout = 3e4, services = [], logger = __geekmidas_logger_console.DEFAULT_LOGGER, batchSize, fifo, constructs = []) {
|
|
40
|
-
super(require_Construct.ConstructType.Queue, logger, services, [], void 0, void 0, timeout, void 0, void 0, constructs);
|
|
41
|
-
this.name = name;
|
|
42
|
-
this.handler = handler;
|
|
43
|
-
this.messageSchema = messageSchema;
|
|
44
|
-
this.timeout = timeout;
|
|
45
|
-
this.services = services;
|
|
46
|
-
this.logger = logger;
|
|
47
|
-
this.batchSize = batchSize;
|
|
48
|
-
this.fifo = fifo;
|
|
49
|
-
this.id = (0, __geekmidas_manifest.canonicalId)(name);
|
|
50
|
-
this.connectionKey = (0, __geekmidas_manifest.provideKey)(this.id, "publisherConnectionString");
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* What this queue is in the manifest.
|
|
54
|
-
*
|
|
55
|
-
* A queue is a resource, not a handler: the worker is reached *through* it,
|
|
56
|
-
* so the declaration carries the producer's key and nothing about the code
|
|
57
|
-
* that drains it. The local target reads this to know which broker has to be
|
|
58
|
-
* running and what connection string to inject.
|
|
59
|
-
*/
|
|
60
|
-
declare() {
|
|
61
|
-
return [{
|
|
62
|
-
kind: "queue",
|
|
63
|
-
id: this.id,
|
|
64
|
-
provides: [this.connectionKey],
|
|
65
|
-
...this.fifo ? { fifo: true } : {},
|
|
66
|
-
worker: {
|
|
67
|
-
id: `${this.id}Worker`,
|
|
68
|
-
handler: `${this.id}.handler`,
|
|
69
|
-
dependencies: []
|
|
70
|
-
}
|
|
71
|
-
}];
|
|
72
|
-
}
|
|
73
|
-
/**
|
|
74
|
-
* The producer side — a `Service` exposing an `EventPublisher` typed to this
|
|
75
|
-
* queue's message. Inject it via `.services([queue.publisher])`; the handler
|
|
76
|
-
* then calls `services.<name>Publisher.publish([{ type, payload }])`.
|
|
77
|
-
*
|
|
78
|
-
* It reads `<NAME>_PUBLISHER_CONNECTION_STRING` and builds the transport from
|
|
79
|
-
* the URL protocol — `pgboss://` locally, `sqs://` deployed — so the same
|
|
80
|
-
* code publishes to Postgres in dev and SQS in prod. Because it's a `Service`,
|
|
81
|
-
* `Construct.getEnvironment()` sniffs it, so the env requirement flows into
|
|
82
|
-
* the manifest and infra links exactly this queue with least privilege.
|
|
83
|
-
*/
|
|
84
|
-
/**
|
|
85
|
-
* The queue as a dependency — what `.dependsOn([emailsQueue])` dissolves
|
|
86
|
-
* into, reachable as `services.emails`.
|
|
87
|
-
*
|
|
88
|
-
* It is the producer: a consumer is the worker written right here, so the
|
|
89
|
-
* only thing another construct can want from a queue is the ability to send
|
|
90
|
-
* to it. {@link publisher} is the same service under its older
|
|
91
|
-
* `<name>Publisher` key, kept for `.services([queue.publisher])`.
|
|
92
|
-
*/
|
|
93
|
-
get service() {
|
|
94
|
-
const { register } = this.publisher;
|
|
95
|
-
return {
|
|
96
|
-
serviceName: (0, __geekmidas_manifest.serviceKey)(this.id),
|
|
97
|
-
register
|
|
98
|
-
};
|
|
99
|
-
}
|
|
100
|
-
get publisher() {
|
|
101
|
-
const envVar = this.connectionKey;
|
|
102
|
-
return {
|
|
103
|
-
serviceName: `${this.name}Publisher`,
|
|
104
|
-
async register({ envParser }) {
|
|
105
|
-
const { connectionString } = envParser.create((get) => ({ connectionString: get(envVar).string() })).parse();
|
|
106
|
-
return __geekmidas_events.Publisher.fromConnectionString(connectionString);
|
|
107
|
-
}
|
|
108
|
-
};
|
|
109
|
-
}
|
|
110
|
-
};
|
|
111
|
-
|
|
112
|
-
//#endregion
|
|
113
|
-
//#region src/queue/QueueBuilder.ts
|
|
114
|
-
/**
|
|
115
|
-
* Builds a {@link Queue} worker — `q.queue('orders').services([db]).message(schema).handle(fn)`.
|
|
116
|
-
* Services are an array (sniffed for required env vars); `message` is the typed
|
|
117
|
-
* job payload; `handle` is the single consumer. The queue name is captured as a
|
|
118
|
-
* literal so `queue.publisher` is typed to `{ type: '<name>', payload }`.
|
|
119
|
-
*/
|
|
120
|
-
var QueueBuilder = class {
|
|
121
|
-
_name;
|
|
122
|
-
_messageSchema;
|
|
123
|
-
_timeout = 3e4;
|
|
124
|
-
_batchSize;
|
|
125
|
-
_fifo;
|
|
126
|
-
_services = [];
|
|
127
|
-
/** The construct ids `.dependsOn()` named — what the manifest records. */
|
|
128
|
-
_constructs = [];
|
|
129
|
-
_logger = __geekmidas_logger_console.DEFAULT_LOGGER;
|
|
130
|
-
/** The queue name — drives the infra queue and its `<NAME>_*` env vars. */
|
|
131
|
-
queue(name) {
|
|
132
|
-
return require_clone.cloneWith(this, { _name: name });
|
|
133
|
-
}
|
|
134
|
-
timeout(timeout) {
|
|
135
|
-
return require_clone.cloneWith(this, { _timeout: timeout });
|
|
136
|
-
}
|
|
137
|
-
/** SQS event-source batch size (deployed). */
|
|
138
|
-
batchSize(batchSize) {
|
|
139
|
-
return require_clone.cloneWith(this, { _batchSize: batchSize });
|
|
140
|
-
}
|
|
141
|
-
/** Mark the queue as FIFO (deployed). */
|
|
142
|
-
fifo(fifo = true) {
|
|
143
|
-
return require_clone.cloneWith(this, { _fifo: fifo });
|
|
144
|
-
}
|
|
145
|
-
/**
|
|
146
|
-
* Depend on constructs — a database, a bucket, a mail sender, a queue, a
|
|
147
|
-
* topic.
|
|
148
|
-
*
|
|
149
|
-
* It records the edge and dissolves each construct's client into the
|
|
150
|
-
* handler's service record under the construct's own id, so
|
|
151
|
-
* `.dependsOn([uploads])` is what makes `services.uploads` exist and type.
|
|
152
|
-
*
|
|
153
|
-
* Constructs only. A `Service` does not match the shape, which is what keeps
|
|
154
|
-
* env sniffing confined to `.services()` and the explicit lift.
|
|
155
|
-
*/
|
|
156
|
-
dependsOn(constructs) {
|
|
157
|
-
const services = require_construct_interface.servicesOf(constructs);
|
|
158
|
-
return require_clone.cloneWith(this, {
|
|
159
|
-
_services: [...this._services, ...services],
|
|
160
|
-
_constructs: require_construct_interface.idsOf(constructs, this._constructs)
|
|
161
|
-
});
|
|
162
|
-
}
|
|
163
|
-
services(services) {
|
|
164
|
-
return require_clone.cloneWith(this, { _services: [...this._services, ...services] });
|
|
165
|
-
}
|
|
166
|
-
logger(logger) {
|
|
167
|
-
return require_clone.cloneWith(this, { _logger: logger });
|
|
168
|
-
}
|
|
169
|
-
/** The typed message (job) payload the queue carries. */
|
|
170
|
-
message(schema) {
|
|
171
|
-
return require_clone.cloneWith(this, { _messageSchema: schema });
|
|
172
|
-
}
|
|
173
|
-
handle(fn) {
|
|
174
|
-
if (!this._name) throw new Error("Queue requires a name — call .queue(name) before .handle().");
|
|
175
|
-
if (!this._messageSchema) throw new Error("Queue requires a message schema — call .message(schema) before .handle().");
|
|
176
|
-
const queue = new Queue(this._name, fn, this._messageSchema, this._timeout, this._services, this._logger, this._batchSize, this._fifo, this._constructs);
|
|
177
|
-
return queue;
|
|
178
|
-
}
|
|
179
|
-
};
|
|
180
|
-
|
|
181
|
-
//#endregion
|
|
182
|
-
//#region src/queue/index.ts
|
|
183
|
-
const q = new QueueBuilder();
|
|
184
|
-
|
|
185
|
-
//#endregion
|
|
186
|
-
exports.Queue = Queue;
|
|
187
|
-
exports.QueueBuilder = QueueBuilder;
|
|
188
|
-
exports.q = q;
|
|
189
|
-
//# sourceMappingURL=index.cjs.map
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_Queue = require("../Queue-Ckmudcm8.cjs");
|
|
3
|
+
const require_QueueBuilder = require("../QueueBuilder-CJNcv4dy.cjs");
|
|
4
|
+
exports.Queue = require_Queue.Queue;
|
|
5
|
+
exports.QueueNeedsMessage = require_QueueBuilder.QueueNeedsMessage;
|
|
6
|
+
exports.QueueNeedsName = require_QueueBuilder.QueueNeedsName;
|
package/dist/queue/index.d.cts
CHANGED
|
@@ -1,60 +1,3 @@
|
|
|
1
|
-
import "../
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
import * as _geekmidas_logger6 from "@geekmidas/logger";
|
|
5
|
-
import { Logger } from "@geekmidas/logger";
|
|
6
|
-
import { Service } from "@geekmidas/services";
|
|
7
|
-
import { StandardSchemaV1 } from "@standard-schema/spec";
|
|
8
|
-
|
|
9
|
-
//#region src/queue/QueueBuilder.d.ts
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Builds a {@link Queue} worker — `q.queue('orders').services([db]).message(schema).handle(fn)`.
|
|
13
|
-
* Services are an array (sniffed for required env vars); `message` is the typed
|
|
14
|
-
* job payload; `handle` is the single consumer. The queue name is captured as a
|
|
15
|
-
* literal so `queue.publisher` is typed to `{ type: '<name>', payload }`.
|
|
16
|
-
*/
|
|
17
|
-
declare class QueueBuilder<TName extends string = string, TMessage extends StandardSchemaV1 | undefined = undefined, TServices extends Service[] = [], TLogger extends Logger = Logger> {
|
|
18
|
-
private _name?;
|
|
19
|
-
private _messageSchema?;
|
|
20
|
-
private _timeout;
|
|
21
|
-
private _batchSize?;
|
|
22
|
-
private _fifo?;
|
|
23
|
-
private _services;
|
|
24
|
-
/** The construct ids `.dependsOn()` named — what the manifest records. */
|
|
25
|
-
_constructs: string[];
|
|
26
|
-
private _logger;
|
|
27
|
-
/** The queue name — drives the infra queue and its `<NAME>_*` env vars. */
|
|
28
|
-
queue<T extends string>(name: T): QueueBuilder<T, TMessage, TServices, TLogger>;
|
|
29
|
-
timeout(timeout: number): this;
|
|
30
|
-
/** SQS event-source batch size (deployed). */
|
|
31
|
-
batchSize(batchSize: number): this;
|
|
32
|
-
/** Mark the queue as FIFO (deployed). */
|
|
33
|
-
fifo(fifo?: boolean): this;
|
|
34
|
-
/**
|
|
35
|
-
* Depend on constructs — a database, a bucket, a mail sender, a queue, a
|
|
36
|
-
* topic.
|
|
37
|
-
*
|
|
38
|
-
* It records the edge and dissolves each construct's client into the
|
|
39
|
-
* handler's service record under the construct's own id, so
|
|
40
|
-
* `.dependsOn([uploads])` is what makes `services.uploads` exist and type.
|
|
41
|
-
*
|
|
42
|
-
* Constructs only. A `Service` does not match the shape, which is what keeps
|
|
43
|
-
* env sniffing confined to `.services()` and the explicit lift.
|
|
44
|
-
*/
|
|
45
|
-
dependsOn<const T extends readonly Consumable[]>(constructs: T): QueueBuilder<TName, TMessage, [...TServices, ...ServicesOf<T>], TLogger>;
|
|
46
|
-
services<T extends Service[]>(services: T): QueueBuilder<TName, TMessage, [...TServices, ...T], TLogger>;
|
|
47
|
-
logger<T extends Logger>(logger: T): QueueBuilder<TName, TMessage, TServices, T>;
|
|
48
|
-
/** The typed message (job) payload the queue carries. */
|
|
49
|
-
message<T extends StandardSchemaV1>(schema: T): QueueBuilder<TName, T, TServices, TLogger>;
|
|
50
|
-
handle(fn: QueueHandler<NonNullable<TMessage>, TServices, TLogger>): Queue<TName, NonNullable<TMessage>, TServices, TLogger>;
|
|
51
|
-
}
|
|
52
|
-
//# sourceMappingURL=QueueBuilder.d.ts.map
|
|
53
|
-
//#endregion
|
|
54
|
-
//#region src/queue/index.d.ts
|
|
55
|
-
declare const q: QueueBuilder<string, undefined, [], _geekmidas_logger6.Logger>;
|
|
56
|
-
//# sourceMappingURL=index.d.ts.map
|
|
57
|
-
|
|
58
|
-
//#endregion
|
|
59
|
-
export { Queue, QueueBuilder, QueueContext, QueueHandler, QueueMessage, q };
|
|
60
|
-
//# sourceMappingURL=index.d.cts.map
|
|
1
|
+
import { i as QueueMessage, n as QueueContext, r as QueueHandler, t as Queue } from "../Queue-CpQIGB_2.cjs";
|
|
2
|
+
import { n as QueueNeedsMessage, r as QueueNeedsName } from "../QueueBuilder-XEnnOWGe.cjs";
|
|
3
|
+
export { Queue, type QueueContext, type QueueHandler, type QueueMessage, QueueNeedsMessage, QueueNeedsName };
|
package/dist/queue/index.d.mts
CHANGED
|
@@ -1,60 +1,3 @@
|
|
|
1
|
-
import "../
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
import { Service } from "@geekmidas/services";
|
|
5
|
-
import * as _geekmidas_logger25 from "@geekmidas/logger";
|
|
6
|
-
import { Logger } from "@geekmidas/logger";
|
|
7
|
-
import { StandardSchemaV1 } from "@standard-schema/spec";
|
|
8
|
-
|
|
9
|
-
//#region src/queue/QueueBuilder.d.ts
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Builds a {@link Queue} worker — `q.queue('orders').services([db]).message(schema).handle(fn)`.
|
|
13
|
-
* Services are an array (sniffed for required env vars); `message` is the typed
|
|
14
|
-
* job payload; `handle` is the single consumer. The queue name is captured as a
|
|
15
|
-
* literal so `queue.publisher` is typed to `{ type: '<name>', payload }`.
|
|
16
|
-
*/
|
|
17
|
-
declare class QueueBuilder<TName extends string = string, TMessage extends StandardSchemaV1 | undefined = undefined, TServices extends Service[] = [], TLogger extends Logger = Logger> {
|
|
18
|
-
private _name?;
|
|
19
|
-
private _messageSchema?;
|
|
20
|
-
private _timeout;
|
|
21
|
-
private _batchSize?;
|
|
22
|
-
private _fifo?;
|
|
23
|
-
private _services;
|
|
24
|
-
/** The construct ids `.dependsOn()` named — what the manifest records. */
|
|
25
|
-
_constructs: string[];
|
|
26
|
-
private _logger;
|
|
27
|
-
/** The queue name — drives the infra queue and its `<NAME>_*` env vars. */
|
|
28
|
-
queue<T extends string>(name: T): QueueBuilder<T, TMessage, TServices, TLogger>;
|
|
29
|
-
timeout(timeout: number): this;
|
|
30
|
-
/** SQS event-source batch size (deployed). */
|
|
31
|
-
batchSize(batchSize: number): this;
|
|
32
|
-
/** Mark the queue as FIFO (deployed). */
|
|
33
|
-
fifo(fifo?: boolean): this;
|
|
34
|
-
/**
|
|
35
|
-
* Depend on constructs — a database, a bucket, a mail sender, a queue, a
|
|
36
|
-
* topic.
|
|
37
|
-
*
|
|
38
|
-
* It records the edge and dissolves each construct's client into the
|
|
39
|
-
* handler's service record under the construct's own id, so
|
|
40
|
-
* `.dependsOn([uploads])` is what makes `services.uploads` exist and type.
|
|
41
|
-
*
|
|
42
|
-
* Constructs only. A `Service` does not match the shape, which is what keeps
|
|
43
|
-
* env sniffing confined to `.services()` and the explicit lift.
|
|
44
|
-
*/
|
|
45
|
-
dependsOn<const T extends readonly Consumable[]>(constructs: T): QueueBuilder<TName, TMessage, [...TServices, ...ServicesOf<T>], TLogger>;
|
|
46
|
-
services<T extends Service[]>(services: T): QueueBuilder<TName, TMessage, [...TServices, ...T], TLogger>;
|
|
47
|
-
logger<T extends Logger>(logger: T): QueueBuilder<TName, TMessage, TServices, T>;
|
|
48
|
-
/** The typed message (job) payload the queue carries. */
|
|
49
|
-
message<T extends StandardSchemaV1>(schema: T): QueueBuilder<TName, T, TServices, TLogger>;
|
|
50
|
-
handle(fn: QueueHandler<NonNullable<TMessage>, TServices, TLogger>): Queue<TName, NonNullable<TMessage>, TServices, TLogger>;
|
|
51
|
-
}
|
|
52
|
-
//# sourceMappingURL=QueueBuilder.d.ts.map
|
|
53
|
-
//#endregion
|
|
54
|
-
//#region src/queue/index.d.ts
|
|
55
|
-
declare const q: QueueBuilder<string, undefined, [], _geekmidas_logger25.Logger>;
|
|
56
|
-
//# sourceMappingURL=index.d.ts.map
|
|
57
|
-
|
|
58
|
-
//#endregion
|
|
59
|
-
export { Queue, QueueBuilder, QueueContext, QueueHandler, QueueMessage, q };
|
|
60
|
-
//# sourceMappingURL=index.d.mts.map
|
|
1
|
+
import { i as QueueMessage, n as QueueContext, r as QueueHandler, t as Queue } from "../Queue-YmvN2vEP.mjs";
|
|
2
|
+
import { n as QueueNeedsMessage, r as QueueNeedsName } from "../QueueBuilder-CM0WUxfw.mjs";
|
|
3
|
+
export { Queue, type QueueContext, type QueueHandler, type QueueMessage, QueueNeedsMessage, QueueNeedsName };
|
package/dist/queue/index.mjs
CHANGED
|
@@ -1,186 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
import { canonicalId, provideKey, serviceKey } from "@geekmidas/manifest";
|
|
5
|
-
import { DEFAULT_LOGGER } from "@geekmidas/logger/console";
|
|
6
|
-
import { Publisher } from "@geekmidas/events";
|
|
7
|
-
|
|
8
|
-
//#region src/queue/Queue.ts
|
|
9
|
-
/**
|
|
10
|
-
* A queue worker — a point-to-point SQS-style queue and its single consumer.
|
|
11
|
-
* Unlike a `Subscriber` (topic fan-out, filtered by `subscribedEvents`), a queue
|
|
12
|
-
* drains every message of its one `message` type. Build one with `q` (see
|
|
13
|
-
* `QueueBuilder`); `gkm build` discovers it into the manifest's `queues` field.
|
|
14
|
-
*
|
|
15
|
-
* The producer side is {@link Queue.publisher} — a ready-to-inject `Service`
|
|
16
|
-
* that any endpoint/function drops into `.services([...])` to send messages.
|
|
17
|
-
*/
|
|
18
|
-
var Queue = class extends Construct {
|
|
19
|
-
__IS_QUEUE__ = true;
|
|
20
|
-
static isQueue(obj) {
|
|
21
|
-
return Boolean(obj && obj.__IS_QUEUE__ === true && obj.type === ConstructType.Queue);
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* The canonical id this queue is declared under.
|
|
25
|
-
*
|
|
26
|
-
* Derived from the name rather than given separately, so `emails` and
|
|
27
|
-
* `Emails` are one queue. The name stays what it was: it is the wire `type`
|
|
28
|
-
* a producer sends and the worker subscribes to, and changing that would
|
|
29
|
-
* silently orphan in-flight messages.
|
|
30
|
-
*/
|
|
31
|
-
id;
|
|
32
|
-
/**
|
|
33
|
-
* The producer's env key. Read by both {@link declare} and
|
|
34
|
-
* {@link publisher}, so what the target publishes and what the producer
|
|
35
|
-
* looks up cannot drift.
|
|
36
|
-
*/
|
|
37
|
-
connectionKey;
|
|
38
|
-
constructor(name, handler, messageSchema, timeout = 3e4, services = [], logger = DEFAULT_LOGGER, batchSize, fifo, constructs = []) {
|
|
39
|
-
super(ConstructType.Queue, logger, services, [], void 0, void 0, timeout, void 0, void 0, constructs);
|
|
40
|
-
this.name = name;
|
|
41
|
-
this.handler = handler;
|
|
42
|
-
this.messageSchema = messageSchema;
|
|
43
|
-
this.timeout = timeout;
|
|
44
|
-
this.services = services;
|
|
45
|
-
this.logger = logger;
|
|
46
|
-
this.batchSize = batchSize;
|
|
47
|
-
this.fifo = fifo;
|
|
48
|
-
this.id = canonicalId(name);
|
|
49
|
-
this.connectionKey = provideKey(this.id, "publisherConnectionString");
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* What this queue is in the manifest.
|
|
53
|
-
*
|
|
54
|
-
* A queue is a resource, not a handler: the worker is reached *through* it,
|
|
55
|
-
* so the declaration carries the producer's key and nothing about the code
|
|
56
|
-
* that drains it. The local target reads this to know which broker has to be
|
|
57
|
-
* running and what connection string to inject.
|
|
58
|
-
*/
|
|
59
|
-
declare() {
|
|
60
|
-
return [{
|
|
61
|
-
kind: "queue",
|
|
62
|
-
id: this.id,
|
|
63
|
-
provides: [this.connectionKey],
|
|
64
|
-
...this.fifo ? { fifo: true } : {},
|
|
65
|
-
worker: {
|
|
66
|
-
id: `${this.id}Worker`,
|
|
67
|
-
handler: `${this.id}.handler`,
|
|
68
|
-
dependencies: []
|
|
69
|
-
}
|
|
70
|
-
}];
|
|
71
|
-
}
|
|
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() {
|
|
93
|
-
const { register } = this.publisher;
|
|
94
|
-
return {
|
|
95
|
-
serviceName: serviceKey(this.id),
|
|
96
|
-
register
|
|
97
|
-
};
|
|
98
|
-
}
|
|
99
|
-
get publisher() {
|
|
100
|
-
const envVar = this.connectionKey;
|
|
101
|
-
return {
|
|
102
|
-
serviceName: `${this.name}Publisher`,
|
|
103
|
-
async register({ envParser }) {
|
|
104
|
-
const { connectionString } = envParser.create((get) => ({ connectionString: get(envVar).string() })).parse();
|
|
105
|
-
return Publisher.fromConnectionString(connectionString);
|
|
106
|
-
}
|
|
107
|
-
};
|
|
108
|
-
}
|
|
109
|
-
};
|
|
110
|
-
|
|
111
|
-
//#endregion
|
|
112
|
-
//#region src/queue/QueueBuilder.ts
|
|
113
|
-
/**
|
|
114
|
-
* Builds a {@link Queue} worker — `q.queue('orders').services([db]).message(schema).handle(fn)`.
|
|
115
|
-
* Services are an array (sniffed for required env vars); `message` is the typed
|
|
116
|
-
* job payload; `handle` is the single consumer. The queue name is captured as a
|
|
117
|
-
* literal so `queue.publisher` is typed to `{ type: '<name>', payload }`.
|
|
118
|
-
*/
|
|
119
|
-
var QueueBuilder = class {
|
|
120
|
-
_name;
|
|
121
|
-
_messageSchema;
|
|
122
|
-
_timeout = 3e4;
|
|
123
|
-
_batchSize;
|
|
124
|
-
_fifo;
|
|
125
|
-
_services = [];
|
|
126
|
-
/** The construct ids `.dependsOn()` named — what the manifest records. */
|
|
127
|
-
_constructs = [];
|
|
128
|
-
_logger = DEFAULT_LOGGER;
|
|
129
|
-
/** The queue name — drives the infra queue and its `<NAME>_*` env vars. */
|
|
130
|
-
queue(name) {
|
|
131
|
-
return cloneWith(this, { _name: name });
|
|
132
|
-
}
|
|
133
|
-
timeout(timeout) {
|
|
134
|
-
return cloneWith(this, { _timeout: timeout });
|
|
135
|
-
}
|
|
136
|
-
/** SQS event-source batch size (deployed). */
|
|
137
|
-
batchSize(batchSize) {
|
|
138
|
-
return cloneWith(this, { _batchSize: batchSize });
|
|
139
|
-
}
|
|
140
|
-
/** Mark the queue as FIFO (deployed). */
|
|
141
|
-
fifo(fifo = true) {
|
|
142
|
-
return cloneWith(this, { _fifo: fifo });
|
|
143
|
-
}
|
|
144
|
-
/**
|
|
145
|
-
* Depend on constructs — a database, a bucket, a mail sender, a queue, a
|
|
146
|
-
* topic.
|
|
147
|
-
*
|
|
148
|
-
* It records the edge and dissolves each construct's client into the
|
|
149
|
-
* handler's service record under the construct's own id, so
|
|
150
|
-
* `.dependsOn([uploads])` is what makes `services.uploads` exist and type.
|
|
151
|
-
*
|
|
152
|
-
* Constructs only. A `Service` does not match the shape, which is what keeps
|
|
153
|
-
* env sniffing confined to `.services()` and the explicit lift.
|
|
154
|
-
*/
|
|
155
|
-
dependsOn(constructs) {
|
|
156
|
-
const services = servicesOf(constructs);
|
|
157
|
-
return cloneWith(this, {
|
|
158
|
-
_services: [...this._services, ...services],
|
|
159
|
-
_constructs: idsOf(constructs, this._constructs)
|
|
160
|
-
});
|
|
161
|
-
}
|
|
162
|
-
services(services) {
|
|
163
|
-
return cloneWith(this, { _services: [...this._services, ...services] });
|
|
164
|
-
}
|
|
165
|
-
logger(logger) {
|
|
166
|
-
return cloneWith(this, { _logger: logger });
|
|
167
|
-
}
|
|
168
|
-
/** The typed message (job) payload the queue carries. */
|
|
169
|
-
message(schema) {
|
|
170
|
-
return cloneWith(this, { _messageSchema: schema });
|
|
171
|
-
}
|
|
172
|
-
handle(fn) {
|
|
173
|
-
if (!this._name) throw new Error("Queue requires a name — call .queue(name) before .handle().");
|
|
174
|
-
if (!this._messageSchema) throw new Error("Queue requires a message schema — call .message(schema) before .handle().");
|
|
175
|
-
const queue = new Queue(this._name, fn, this._messageSchema, this._timeout, this._services, this._logger, this._batchSize, this._fifo, this._constructs);
|
|
176
|
-
return queue;
|
|
177
|
-
}
|
|
178
|
-
};
|
|
179
|
-
|
|
180
|
-
//#endregion
|
|
181
|
-
//#region src/queue/index.ts
|
|
182
|
-
const q = new QueueBuilder();
|
|
183
|
-
|
|
184
|
-
//#endregion
|
|
185
|
-
export { Queue, QueueBuilder, q };
|
|
186
|
-
//# sourceMappingURL=index.mjs.map
|
|
1
|
+
import { t as Queue } from "../Queue-C1uDgjxt.mjs";
|
|
2
|
+
import { n as QueueNeedsMessage, r as QueueNeedsName } from "../QueueBuilder-XuPKZwKH.mjs";
|
|
3
|
+
export { Queue, QueueNeedsMessage, QueueNeedsName };
|