@geekmidas/constructs 10.0.0-alpha.2 → 10.0.0-alpha.21
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 +46 -3
- package/dist/{Construct-Ct8nalEi.d.mts → Construct-DTqYvkPG.d.cts} +11 -13
- package/dist/Construct-DTqYvkPG.d.cts.map +1 -0
- package/dist/{Construct-BD5neF7w.mjs → Construct-Detz65RA.mjs} +31 -29
- package/dist/Construct-Detz65RA.mjs.map +1 -0
- package/dist/{Construct-C0ijr2qp.d.cts → Construct-pVadmURD.d.mts} +10 -12
- package/dist/Construct-pVadmURD.d.mts.map +1 -0
- package/dist/{Construct-CyS3RpTL.cjs → Construct-yG9Sw-5p.cjs} +51 -43
- package/dist/Construct-yG9Sw-5p.cjs.map +1 -0
- package/dist/{Cron-ByxdOfpE.d.mts → Cron-AYpQq725.d.mts} +13 -6
- package/dist/Cron-AYpQq725.d.mts.map +1 -0
- package/dist/{Cron-Wqh464aO.d.cts → Cron-Bdcg9OAL.d.cts} +12 -5
- package/dist/Cron-Bdcg9OAL.d.cts.map +1 -0
- package/dist/{CronBuilder-BL0AP6fs.d.mts → CronBuilder-DR21m9h2.d.cts} +7 -10
- package/dist/CronBuilder-DR21m9h2.d.cts.map +1 -0
- package/dist/{CronBuilder-BqpEzMPQ.d.cts → CronBuilder-DeBnPVIT.d.mts} +7 -10
- package/dist/CronBuilder-DeBnPVIT.d.mts.map +1 -0
- package/dist/{CronBuilder-BmABazzH.mjs → CronBuilder-vkjuo1UP.mjs} +23 -15
- package/dist/CronBuilder-vkjuo1UP.mjs.map +1 -0
- package/dist/{CronBuilder-CkXPJiGO.cjs → CronBuilder-zdTdaT-e.cjs} +33 -25
- package/dist/CronBuilder-zdTdaT-e.cjs.map +1 -0
- package/dist/{Endpoint-2Wg7T7Cq.d.mts → Endpoint-BxkRWQ8G.d.mts} +63 -84
- package/dist/Endpoint-BxkRWQ8G.d.mts.map +1 -0
- package/dist/{Endpoint-BiaaMEn_.cjs → Endpoint-CtiPUpRX.cjs} +145 -131
- package/dist/Endpoint-CtiPUpRX.cjs.map +1 -0
- package/dist/{Endpoint-VIOpSo0S.mjs → Endpoint-DCr5tlbJ.mjs} +117 -109
- package/dist/Endpoint-DCr5tlbJ.mjs.map +1 -0
- package/dist/{Endpoint-CH9Fn1AD.d.cts → Endpoint-DbYQJgb-.d.cts} +61 -82
- package/dist/Endpoint-DbYQJgb-.d.cts.map +1 -0
- package/dist/{EndpointFactory-DTTCkGEL.mjs → EndpointFactory-Bs8pu-yY.mjs} +20 -29
- package/dist/EndpointFactory-Bs8pu-yY.mjs.map +1 -0
- package/dist/{index-BxHDdy6a.d.mts → EndpointFactory-DE6nKtFZ.d.cts} +12 -92
- package/dist/EndpointFactory-DE6nKtFZ.d.cts.map +1 -0
- package/dist/{index-V2nksZIJ.d.cts → EndpointFactory-T06kTFHg.d.mts} +12 -92
- package/dist/EndpointFactory-T06kTFHg.d.mts.map +1 -0
- package/dist/{EndpointFactory-ChxLZllA.cjs → EndpointFactory-vE2C1NG1.cjs} +57 -66
- package/dist/EndpointFactory-vE2C1NG1.cjs.map +1 -0
- package/dist/{HonoEndpointAdaptor-NKQQQbBY.mjs → HonoEndpointAdaptor-Be6UdK0r.mjs} +40 -47
- package/dist/{HonoEndpointAdaptor-D233Jvpk.cjs.map → HonoEndpointAdaptor-Be6UdK0r.mjs.map} +1 -1
- package/dist/{HonoEndpointAdaptor-D233Jvpk.cjs → HonoEndpointAdaptor-C9aivwKl.cjs} +48 -52
- package/dist/HonoEndpointAdaptor-C9aivwKl.cjs.map +1 -0
- package/dist/{Queue-D7ZuwBhy.d.cts → Queue-Bhzi2WQC.d.cts} +8 -9
- package/dist/Queue-Bhzi2WQC.d.cts.map +1 -0
- package/dist/{Queue-gVGfi2Yk.d.mts → Queue-BoUA-e83.d.mts} +9 -10
- package/dist/Queue-BoUA-e83.d.mts.map +1 -0
- package/dist/{Subscriber-2mEi0ImH.d.cts → Subscriber-CIO3pwji.d.mts} +7 -8
- package/dist/Subscriber-CIO3pwji.d.mts.map +1 -0
- package/dist/{Subscriber-xTJ9ayPN.d.mts → Subscriber-DQCaiOXF.d.cts} +7 -8
- package/dist/Subscriber-DQCaiOXF.d.cts.map +1 -0
- package/dist/{SubscriberBuilder-BjkbeT9l.mjs → SubscriberBuilder-B4YRTBng.mjs} +16 -10
- package/dist/SubscriberBuilder-B4YRTBng.mjs.map +1 -0
- package/dist/{SubscriberBuilder-4OPehf2R.cjs → SubscriberBuilder-C2bCOuPT.cjs} +28 -23
- package/dist/SubscriberBuilder-C2bCOuPT.cjs.map +1 -0
- package/dist/{SubscriberBuilder-Dptmo-1A.d.mts → SubscriberBuilder-ChX5v948.d.cts} +8 -11
- package/dist/SubscriberBuilder-ChX5v948.d.cts.map +1 -0
- package/dist/{SubscriberBuilder-waNhzjSM.d.cts → SubscriberBuilder-Dbiaskfi.d.mts} +8 -11
- package/dist/SubscriberBuilder-Dbiaskfi.d.mts.map +1 -0
- package/dist/{Topic-19QeHBIR.d.cts → Topic-D6blllEn.d.cts} +5 -7
- package/dist/Topic-D6blllEn.d.cts.map +1 -0
- package/dist/{Topic-DuFeqkBh.d.mts → Topic-DVvheJ_-.d.mts} +6 -8
- package/dist/Topic-DVvheJ_-.d.mts.map +1 -0
- package/dist/adaptors/aws.cjs +87 -106
- package/dist/adaptors/aws.cjs.map +1 -1
- package/dist/adaptors/aws.d.cts +14 -27
- package/dist/adaptors/aws.d.cts.map +1 -1
- package/dist/adaptors/aws.d.mts +16 -29
- package/dist/adaptors/aws.d.mts.map +1 -1
- package/dist/adaptors/aws.mjs +60 -81
- package/dist/adaptors/aws.mjs.map +1 -1
- package/dist/adaptors/hono.cjs +3 -10
- package/dist/adaptors/hono.d.cts +5 -13
- package/dist/adaptors/hono.d.cts.map +1 -1
- package/dist/adaptors/hono.d.mts +7 -15
- package/dist/adaptors/hono.d.mts.map +1 -1
- package/dist/adaptors/hono.mjs +2 -10
- package/dist/adaptors/testing.cjs +271 -82
- package/dist/adaptors/testing.cjs.map +1 -1
- package/dist/adaptors/testing.d.cts +62 -33
- package/dist/adaptors/testing.d.cts.map +1 -1
- package/dist/adaptors/testing.d.mts +63 -34
- package/dist/adaptors/testing.d.mts.map +1 -1
- package/dist/adaptors/testing.mjs +249 -63
- package/dist/adaptors/testing.mjs.map +1 -1
- package/dist/auth-BlO8MUkR.d.cts +123 -0
- package/dist/auth-BlO8MUkR.d.cts.map +1 -0
- package/dist/auth-CHWIdcQO.d.mts +123 -0
- package/dist/auth-CHWIdcQO.d.mts.map +1 -0
- package/dist/auth.cjs +41 -16
- 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 +32 -8
- package/dist/auth.mjs.map +1 -1
- package/dist/{cache-BrRz3fEB.d.mts → cache-AgQUMma6.d.mts} +3 -6
- package/dist/cache-AgQUMma6.d.mts.map +1 -0
- package/dist/{cache-BtZY_tHe.d.cts → cache-obq0fOIM.d.cts} +3 -6
- package/dist/cache-obq0fOIM.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/{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-Clz7_BwB.d.mts} +15 -6
- package/dist/construct-interface-Clz7_BwB.d.mts.map +1 -0
- package/dist/{construct-interface-D9d4Gm4p.d.cts → construct-interface-DIaTNKax.d.cts} +15 -6
- package/dist/construct-interface-DIaTNKax.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 +43 -9
- package/dist/credential.cjs.map +1 -1
- package/dist/credential.d.cts +5 -8
- package/dist/credential.d.cts.map +1 -1
- package/dist/credential.d.mts +5 -8
- package/dist/credential.d.mts.map +1 -1
- package/dist/credential.mjs +36 -2
- 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 +28 -14
- 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 +16 -4
- 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 +7 -10
- package/dist/endpoints/index.d.cts +60 -7
- package/dist/endpoints/index.d.cts.map +1 -0
- package/dist/endpoints/index.d.mts +60 -7
- package/dist/endpoints/index.d.mts.map +1 -0
- package/dist/endpoints/index.mjs +5 -10
- 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-Bd3TPxid.cjs → functions-VnOTEp74.cjs} +309 -264
- package/dist/functions-VnOTEp74.cjs.map +1 -0
- package/dist/{functions-Cxbo-pEd.mjs → functions-faoJOUmr.mjs} +282 -234
- package/dist/functions-faoJOUmr.mjs.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-JSf9xNIJ.d.cts → index-DU3Twmwh.d.mts} +19 -24
- package/dist/index-DU3Twmwh.d.mts.map +1 -0
- package/dist/index-fnpjXiA-.d.mts +26 -0
- package/dist/index-fnpjXiA-.d.mts.map +1 -0
- package/dist/{index-CubPzHd9.d.mts → index-nBQT1tAh.d.cts} +19 -24
- package/dist/index-nBQT1tAh.d.cts.map +1 -0
- package/dist/index-tE_119SX.d.cts +26 -0
- package/dist/index-tE_119SX.d.cts.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-CXi49zc2.d.cts +150 -0
- package/dist/kysely-CXi49zc2.d.cts.map +1 -0
- package/dist/kysely-D3-G5b0j.d.mts +150 -0
- package/dist/kysely-D3-G5b0j.d.mts.map +1 -0
- package/dist/{lazyAccessors-BoJN3SMd.mjs → lazyAccessors-BHtcqgz2.mjs} +22 -25
- package/dist/lazyAccessors-BHtcqgz2.mjs.map +1 -0
- package/dist/{lazyAccessors-e3j2oE2m.cjs → lazyAccessors-Dx9NLwJZ.cjs} +72 -76
- package/dist/lazyAccessors-Dx9NLwJZ.cjs.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 +25 -21
- package/dist/queue/index.cjs.map +1 -1
- package/dist/queue/index.d.cts +8 -15
- package/dist/queue/index.d.cts.map +1 -1
- package/dist/queue/index.d.mts +8 -15
- package/dist/queue/index.d.mts.map +1 -1
- package/dist/queue/index.mjs +15 -11
- package/dist/queue/index.mjs.map +1 -1
- package/dist/rest-api.cjs +88 -62
- package/dist/rest-api.cjs.map +1 -1
- package/dist/rest-api.d.cts +62 -60
- package/dist/rest-api.d.cts.map +1 -1
- package/dist/rest-api.d.mts +62 -60
- package/dist/rest-api.d.mts.map +1 -1
- package/dist/rest-api.mjs +80 -54
- 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 +18 -20
- package/dist/topic/index.cjs.map +1 -1
- package/dist/topic/index.d.cts +3 -32
- package/dist/topic/index.d.mts +3 -32
- package/dist/topic/index.mjs +8 -10
- package/dist/topic/index.mjs.map +1 -1
- 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 +109 -35
- package/dist/worker.cjs.map +1 -1
- package/dist/worker.d.cts +87 -42
- package/dist/worker.d.cts.map +1 -1
- package/dist/worker.d.mts +87 -42
- package/dist/worker.d.mts.map +1 -1
- package/dist/worker.mjs +104 -30
- package/dist/worker.mjs.map +1 -1
- package/package.json +59 -55
- package/dist/Construct-BD5neF7w.mjs.map +0 -1
- package/dist/Construct-C0ijr2qp.d.cts.map +0 -1
- package/dist/Construct-Ct8nalEi.d.mts.map +0 -1
- package/dist/Construct-CyS3RpTL.cjs.map +0 -1
- package/dist/Cron-ByxdOfpE.d.mts.map +0 -1
- package/dist/Cron-Wqh464aO.d.cts.map +0 -1
- package/dist/CronBuilder-BL0AP6fs.d.mts.map +0 -1
- package/dist/CronBuilder-BmABazzH.mjs.map +0 -1
- package/dist/CronBuilder-BqpEzMPQ.d.cts.map +0 -1
- package/dist/CronBuilder-CkXPJiGO.cjs.map +0 -1
- package/dist/Endpoint-2Wg7T7Cq.d.mts.map +0 -1
- package/dist/Endpoint-BiaaMEn_.cjs.map +0 -1
- package/dist/Endpoint-CH9Fn1AD.d.cts.map +0 -1
- package/dist/Endpoint-VIOpSo0S.mjs.map +0 -1
- package/dist/EndpointFactory-ChxLZllA.cjs.map +0 -1
- package/dist/EndpointFactory-DTTCkGEL.mjs.map +0 -1
- package/dist/HonoEndpointAdaptor-NKQQQbBY.mjs.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.map +0 -1
- package/dist/SubscriberBuilder-waNhzjSM.d.cts.map +0 -1
- package/dist/Topic-19QeHBIR.d.cts.map +0 -1
- 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-Bd3TPxid.cjs.map +0 -1
- package/dist/functions-Cxbo-pEd.mjs.map +0 -1
- package/dist/index-BxHDdy6a.d.mts.map +0 -1
- package/dist/index-CubPzHd9.d.mts.map +0 -1
- package/dist/index-JSf9xNIJ.d.cts.map +0 -1
- package/dist/index-V2nksZIJ.d.cts.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/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.d.cts.map +0 -1
- package/dist/topic/index.d.mts.map +0 -1
- package/dist/types-BlAkSuGI.d.cts.map +0 -1
- package/dist/types-aKksMEWL.d.mts.map +0 -1
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { getCookie } from "hono/cookie";
|
|
2
|
-
|
|
3
2
|
//#region src/publisher.ts
|
|
4
3
|
async function publishEvents(logger, serviceDiscovery, ev = [], response, publisherService) {
|
|
5
4
|
try {
|
|
@@ -11,10 +10,9 @@ async function publishEvents(logger, serviceDiscovery, ev = [], response, publis
|
|
|
11
10
|
logger.warn("No publisher service available");
|
|
12
11
|
return;
|
|
13
12
|
}
|
|
14
|
-
const
|
|
15
|
-
const publisher = services[publisherService.serviceName];
|
|
13
|
+
const publisher = (await serviceDiscovery.register([publisherService]))[publisherService.serviceName];
|
|
16
14
|
const events = [];
|
|
17
|
-
for (const { when, payload, type
|
|
15
|
+
for (const { when, payload, type, ...e } of ev) {
|
|
18
16
|
logger.debug({ event: type }, "Processing event");
|
|
19
17
|
const resolvedPayload = await payload(response);
|
|
20
18
|
const event = {
|
|
@@ -37,7 +35,6 @@ async function publishEvents(logger, serviceDiscovery, ev = [], response, publis
|
|
|
37
35
|
async function publishConstructEvents(construct, response, serviceDiscovery, logger = construct.logger) {
|
|
38
36
|
return publishEvents(logger, serviceDiscovery, construct.events, response, construct.publisherService);
|
|
39
37
|
}
|
|
40
|
-
|
|
41
38
|
//#endregion
|
|
42
39
|
//#region src/endpoints/lazyAccessors.ts
|
|
43
40
|
/**
|
|
@@ -47,11 +44,11 @@ async function publishConstructEvents(construct, response, serviceDiscovery, log
|
|
|
47
44
|
*/
|
|
48
45
|
function createHonoHeaders(c) {
|
|
49
46
|
let allHeaders = null;
|
|
50
|
-
return (key) => {
|
|
47
|
+
return ((key) => {
|
|
51
48
|
if (key !== void 0) return c.req.header(key);
|
|
52
49
|
if (!allHeaders) allHeaders = c.req.header();
|
|
53
50
|
return allHeaders;
|
|
54
|
-
};
|
|
51
|
+
});
|
|
55
52
|
}
|
|
56
53
|
/**
|
|
57
54
|
* Create a lazy cookie accessor for Hono.
|
|
@@ -60,7 +57,7 @@ function createHonoHeaders(c) {
|
|
|
60
57
|
*/
|
|
61
58
|
function createHonoCookies(c) {
|
|
62
59
|
let allCookies = null;
|
|
63
|
-
return (name) => {
|
|
60
|
+
return ((name) => {
|
|
64
61
|
if (name !== void 0) return getCookie(c, name);
|
|
65
62
|
if (!allCookies) {
|
|
66
63
|
allCookies = {};
|
|
@@ -76,7 +73,7 @@ function createHonoCookies(c) {
|
|
|
76
73
|
}
|
|
77
74
|
}
|
|
78
75
|
return allCookies;
|
|
79
|
-
};
|
|
76
|
+
});
|
|
80
77
|
}
|
|
81
78
|
/**
|
|
82
79
|
* Create a lazy header accessor for API Gateway events.
|
|
@@ -93,17 +90,17 @@ function createApiGatewayHeaders(headers) {
|
|
|
93
90
|
}
|
|
94
91
|
return normalizedHeaders;
|
|
95
92
|
};
|
|
96
|
-
return (key) => {
|
|
93
|
+
return ((key) => {
|
|
97
94
|
if (key !== void 0) {
|
|
98
95
|
if (headers) {
|
|
99
96
|
const direct = headers[key] ?? headers[key.toLowerCase()];
|
|
100
97
|
if (direct !== void 0) return direct;
|
|
101
98
|
return normalize()[key.toLowerCase()];
|
|
102
99
|
}
|
|
103
|
-
return
|
|
100
|
+
return;
|
|
104
101
|
}
|
|
105
102
|
return normalize();
|
|
106
|
-
};
|
|
103
|
+
});
|
|
107
104
|
}
|
|
108
105
|
/**
|
|
109
106
|
* Create a lazy cookie accessor for API Gateway events.
|
|
@@ -134,10 +131,10 @@ function createApiGatewayCookies(cookies, cookieHeader) {
|
|
|
134
131
|
}
|
|
135
132
|
return parsed;
|
|
136
133
|
};
|
|
137
|
-
return (name) => {
|
|
134
|
+
return ((name) => {
|
|
138
135
|
if (name !== void 0) return parse()[name];
|
|
139
136
|
return parse();
|
|
140
|
-
};
|
|
137
|
+
});
|
|
141
138
|
}
|
|
142
139
|
/**
|
|
143
140
|
* Create a lazy header accessor for plain object headers (test adaptor, etc).
|
|
@@ -145,7 +142,7 @@ function createApiGatewayCookies(cookies, cookieHeader) {
|
|
|
145
142
|
*/
|
|
146
143
|
function createObjectHeaders(headers) {
|
|
147
144
|
let normalized = null;
|
|
148
|
-
return (key) => {
|
|
145
|
+
return ((key) => {
|
|
149
146
|
if (key !== void 0) {
|
|
150
147
|
if (headers) {
|
|
151
148
|
const direct = headers[key] ?? headers[key.toLowerCase()];
|
|
@@ -162,7 +159,7 @@ function createObjectHeaders(headers) {
|
|
|
162
159
|
for (const [k, v] of Object.entries(headers)) normalized[k.toLowerCase()] = v;
|
|
163
160
|
}
|
|
164
161
|
return normalized ?? {};
|
|
165
|
-
};
|
|
162
|
+
});
|
|
166
163
|
}
|
|
167
164
|
/**
|
|
168
165
|
* Create a lazy cookie accessor from a cookie header string.
|
|
@@ -185,30 +182,30 @@ function createCookieHeaderAccessor(cookieHeader) {
|
|
|
185
182
|
}
|
|
186
183
|
return parsed;
|
|
187
184
|
};
|
|
188
|
-
return (name) => {
|
|
185
|
+
return ((name) => {
|
|
189
186
|
if (name !== void 0) return parse()[name];
|
|
190
187
|
return parse();
|
|
191
|
-
};
|
|
188
|
+
});
|
|
192
189
|
}
|
|
193
190
|
/**
|
|
194
191
|
* Create a no-op header accessor (for minimal endpoints that don't use headers).
|
|
195
192
|
*/
|
|
196
193
|
function createNoopHeaders() {
|
|
197
|
-
return (key) => {
|
|
194
|
+
return ((key) => {
|
|
198
195
|
if (key !== void 0) return void 0;
|
|
199
196
|
return {};
|
|
200
|
-
};
|
|
197
|
+
});
|
|
201
198
|
}
|
|
202
199
|
/**
|
|
203
200
|
* Create a no-op cookie accessor (for minimal endpoints that don't use cookies).
|
|
204
201
|
*/
|
|
205
202
|
function createNoopCookies() {
|
|
206
|
-
return (name) => {
|
|
203
|
+
return ((name) => {
|
|
207
204
|
if (name !== void 0) return void 0;
|
|
208
205
|
return {};
|
|
209
|
-
};
|
|
206
|
+
});
|
|
210
207
|
}
|
|
211
|
-
|
|
212
208
|
//#endregion
|
|
213
|
-
export {
|
|
214
|
-
|
|
209
|
+
export { createHonoHeaders as a, createObjectHeaders as c, createHonoCookies as i, publishConstructEvents as l, createApiGatewayHeaders as n, createNoopCookies as o, createCookieHeaderAccessor as r, createNoopHeaders as s, createApiGatewayCookies as t, publishEvents as u };
|
|
210
|
+
|
|
211
|
+
//# sourceMappingURL=lazyAccessors-BHtcqgz2.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lazyAccessors-BHtcqgz2.mjs","names":[],"sources":["../src/publisher.ts","../src/endpoints/lazyAccessors.ts"],"sourcesContent":["import type { AuditStorage } from '@geekmidas/audit';\nimport type { EventPublisher, MappedEvent } from '@geekmidas/events';\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 { Construct } from './Construct';\n\nexport async function publishEvents<\n\tT extends EventPublisher<any> | undefined,\n\tOutSchema extends StandardSchemaV1 | undefined = undefined,\n\tTServiceName extends string = string,\n\tTPublisherService extends Service<TServiceName, T> | undefined = undefined,\n>(\n\tlogger: Logger,\n\tserviceDiscovery: ServiceDiscovery<any>,\n\tev: MappedEvent<T, OutSchema>[] = [],\n\tresponse: InferStandardSchema<OutSchema>,\n\tpublisherService: TPublisherService,\n) {\n\ttry {\n\t\tif (!ev?.length) {\n\t\t\tlogger.debug('No events to publish');\n\t\t\treturn;\n\t\t}\n\t\tif (!publisherService) {\n\t\t\tlogger.warn('No publisher service available');\n\t\t\treturn;\n\t\t}\n\n\t\tconst services = await serviceDiscovery.register([publisherService]);\n\n\t\tconst publisher = services[\n\t\t\tpublisherService.serviceName\n\t\t] as EventPublisher<any>;\n\n\t\tconst events: MappedEvent<T, OutSchema>[] = [];\n\n\t\tfor (const { when, payload, type, ...e } of ev) {\n\t\t\tlogger.debug({ event: type }, 'Processing event');\n\t\t\tconst resolvedPayload = await payload(response);\n\t\t\tconst event = {\n\t\t\t\t...e,\n\t\t\t\ttype,\n\t\t\t\tpayload: resolvedPayload,\n\t\t\t};\n\n\t\t\tif (!when || when(response as any)) {\n\t\t\t\tevents.push(event);\n\t\t\t}\n\t\t}\n\n\t\tif (events.length) {\n\t\t\tlogger.debug({ eventCount: ev.length }, 'Publishing events');\n\n\t\t\tawait publisher.publish(events).catch((err) => {\n\t\t\t\tlogger.error(err, 'Failed to publish events');\n\t\t\t});\n\t\t}\n\t} catch (error) {\n\t\tlogger.error(error as any, 'Something went wrong publishing events');\n\t}\n}\n\nexport async function publishConstructEvents<\n\tT extends EventPublisher<any> | undefined,\n\tOutSchema extends StandardSchemaV1 | undefined = undefined,\n\tTServiceName extends string = string,\n\tTServices extends Service[] = [],\n\tTAuditStorageServiceName extends string = string,\n\tTAuditStorage extends AuditStorage | undefined = undefined,\n>(\n\tconstruct: Construct<\n\t\tLogger,\n\t\tTServiceName,\n\t\tT,\n\t\tOutSchema,\n\t\tTServices,\n\t\tTAuditStorageServiceName,\n\t\tTAuditStorage\n\t>,\n\tresponse: InferStandardSchema<OutSchema>,\n\tserviceDiscovery: ServiceDiscovery<any>,\n\tlogger: Logger = construct.logger,\n) {\n\treturn publishEvents(\n\t\tlogger,\n\t\tserviceDiscovery,\n\t\tconstruct.events,\n\t\tresponse,\n\t\tconstruct.publisherService,\n\t);\n}\n","/**\n * Lazy header and cookie accessors for different adaptors.\n *\n * Instead of parsing all headers/cookies upfront, these accessors\n * use native adaptor methods for single lookups and only parse\n * everything when `header()` or `cookie()` is called without arguments.\n */\nimport type { Context } from 'hono';\nimport { getCookie } from 'hono/cookie';\nimport type { CookieFn, HeaderFn } from './Endpoint';\n\n/**\n * Create a lazy header accessor for Hono.\n * Uses `c.req.header(name)` for single lookups (native, case-insensitive).\n * Only calls `c.req.header()` to get all headers when needed.\n */\nexport function createHonoHeaders(c: Context): HeaderFn {\n\tlet allHeaders: Record<string, string> | null = null;\n\n\treturn ((key?: string) => {\n\t\tif (key !== undefined) {\n\t\t\t// Single header lookup - use native Hono method (case-insensitive)\n\t\t\treturn c.req.header(key);\n\t\t}\n\t\t// Get all headers - cache the result\n\t\tif (!allHeaders) {\n\t\t\tallHeaders = c.req.header();\n\t\t}\n\t\treturn allHeaders;\n\t}) as HeaderFn;\n}\n\n/**\n * Create a lazy cookie accessor for Hono.\n * Uses `getCookie(c, name)` for single lookups (native).\n * Only parses the cookie header when all cookies are requested.\n */\nexport function createHonoCookies(c: Context): CookieFn {\n\tlet allCookies: Record<string, string> | null = null;\n\n\treturn ((name?: string) => {\n\t\tif (name !== undefined) {\n\t\t\t// Single cookie lookup - use native Hono method\n\t\t\treturn getCookie(c, name);\n\t\t}\n\t\t// Get all cookies - parse and cache\n\t\tif (!allCookies) {\n\t\t\tallCookies = {};\n\t\t\tconst cookieHeader = c.req.header('cookie');\n\t\t\tif (cookieHeader) {\n\t\t\t\tfor (const part of cookieHeader.split(';')) {\n\t\t\t\t\tconst trimmed = part.trim();\n\t\t\t\t\tconst eqIndex = trimmed.indexOf('=');\n\t\t\t\t\tif (eqIndex > 0) {\n\t\t\t\t\t\tconst key = trimmed.slice(0, eqIndex);\n\t\t\t\t\t\tconst value = trimmed.slice(eqIndex + 1);\n\t\t\t\t\t\tallCookies[key] = value;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn allCookies;\n\t}) as CookieFn;\n}\n\n/**\n * Create a lazy header accessor for API Gateway events.\n * Handles case-insensitive lookups.\n */\nexport function createApiGatewayHeaders(\n\theaders: Record<string, string | undefined> | null | undefined,\n): HeaderFn {\n\tlet normalizedHeaders: Record<string, string> | null = null;\n\n\tconst normalize = () => {\n\t\tif (!normalizedHeaders) {\n\t\t\tnormalizedHeaders = {};\n\t\t\tif (headers) {\n\t\t\t\tfor (const [k, v] of Object.entries(headers)) {\n\t\t\t\t\tif (v !== undefined) {\n\t\t\t\t\t\tnormalizedHeaders[k.toLowerCase()] = v;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn normalizedHeaders;\n\t};\n\n\treturn ((key?: string) => {\n\t\tif (key !== undefined) {\n\t\t\t// Try direct lookup first (common case: headers already lowercase)\n\t\t\tif (headers) {\n\t\t\t\tconst direct = headers[key] ?? headers[key.toLowerCase()];\n\t\t\t\tif (direct !== undefined) return direct;\n\t\t\t\t// Fall back to normalized lookup\n\t\t\t\treturn normalize()[key.toLowerCase()];\n\t\t\t}\n\t\t\treturn undefined;\n\t\t}\n\t\treturn normalize();\n\t}) as HeaderFn;\n}\n\n/**\n * Create a lazy cookie accessor for API Gateway events.\n * Decodes URL-encoded values to match browser behavior.\n */\nexport function createApiGatewayCookies(\n\tcookies: string[] | undefined,\n\tcookieHeader: string | undefined,\n): CookieFn {\n\tlet parsed: Record<string, string> | null = null;\n\n\tconst parse = () => {\n\t\tif (!parsed) {\n\t\t\tparsed = {};\n\t\t\t// API Gateway v2 provides cookies as array\n\t\t\tif (cookies) {\n\t\t\t\tfor (const cookie of cookies) {\n\t\t\t\t\tconst eqIndex = cookie.indexOf('=');\n\t\t\t\t\tif (eqIndex > 0) {\n\t\t\t\t\t\tconst key = cookie.slice(0, eqIndex);\n\t\t\t\t\t\tconst value = cookie.slice(eqIndex + 1);\n\t\t\t\t\t\tparsed[key] = decodeURIComponent(value);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else if (cookieHeader) {\n\t\t\t\t// Fall back to parsing cookie header\n\t\t\t\tfor (const part of cookieHeader.split(';')) {\n\t\t\t\t\tconst trimmed = part.trim();\n\t\t\t\t\tconst eqIndex = trimmed.indexOf('=');\n\t\t\t\t\tif (eqIndex > 0) {\n\t\t\t\t\t\tconst key = trimmed.slice(0, eqIndex);\n\t\t\t\t\t\tconst value = trimmed.slice(eqIndex + 1);\n\t\t\t\t\t\tparsed[key] = decodeURIComponent(value);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn parsed;\n\t};\n\n\treturn ((name?: string) => {\n\t\tif (name !== undefined) {\n\t\t\treturn parse()[name];\n\t\t}\n\t\treturn parse();\n\t}) as CookieFn;\n}\n\n/**\n * Create a lazy header accessor for plain object headers (test adaptor, etc).\n * Headers are already available as an object, just provide lazy access.\n */\nexport function createObjectHeaders(\n\theaders: Record<string, string> | undefined,\n): HeaderFn {\n\tlet normalized: Record<string, string> | null = null;\n\n\treturn ((key?: string) => {\n\t\tif (key !== undefined) {\n\t\t\t// Try direct lookup first (common case)\n\t\t\tif (headers) {\n\t\t\t\tconst direct = headers[key] ?? headers[key.toLowerCase()];\n\t\t\t\tif (direct !== undefined) return direct;\n\t\t\t}\n\t\t\t// Fall back to normalized lookup for case-insensitivity\n\t\t\tif (!normalized && headers) {\n\t\t\t\tnormalized = {};\n\t\t\t\tfor (const [k, v] of Object.entries(headers)) {\n\t\t\t\t\tnormalized[k.toLowerCase()] = v;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn normalized?.[key.toLowerCase()];\n\t\t}\n\t\t// Return all headers\n\t\tif (!normalized && headers) {\n\t\t\tnormalized = {};\n\t\t\tfor (const [k, v] of Object.entries(headers)) {\n\t\t\t\tnormalized[k.toLowerCase()] = v;\n\t\t\t}\n\t\t}\n\t\treturn normalized ?? {};\n\t}) as HeaderFn;\n}\n\n/**\n * Create a lazy cookie accessor from a cookie header string.\n * Decodes URL-encoded values to match browser behavior.\n */\nexport function createCookieHeaderAccessor(\n\tcookieHeader: string | undefined,\n): CookieFn {\n\tlet parsed: Record<string, string> | null = null;\n\n\tconst parse = () => {\n\t\tif (!parsed) {\n\t\t\tparsed = {};\n\t\t\tif (cookieHeader) {\n\t\t\t\tfor (const part of cookieHeader.split(';')) {\n\t\t\t\t\tconst trimmed = part.trim();\n\t\t\t\t\tconst eqIndex = trimmed.indexOf('=');\n\t\t\t\t\tif (eqIndex > 0) {\n\t\t\t\t\t\tconst key = trimmed.slice(0, eqIndex);\n\t\t\t\t\t\tconst value = trimmed.slice(eqIndex + 1);\n\t\t\t\t\t\t// Decode URL-encoded values to match Endpoint.createCookies behavior\n\t\t\t\t\t\tparsed[key] = decodeURIComponent(value);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn parsed;\n\t};\n\n\treturn ((name?: string) => {\n\t\tif (name !== undefined) {\n\t\t\treturn parse()[name];\n\t\t}\n\t\treturn parse();\n\t}) as CookieFn;\n}\n\n/**\n * Create a no-op header accessor (for minimal endpoints that don't use headers).\n */\nexport function createNoopHeaders(): HeaderFn {\n\treturn ((key?: string) => {\n\t\tif (key !== undefined) return undefined;\n\t\treturn {};\n\t}) as HeaderFn;\n}\n\n/**\n * Create a no-op cookie accessor (for minimal endpoints that don't use cookies).\n */\nexport function createNoopCookies(): CookieFn {\n\treturn ((name?: string) => {\n\t\tif (name !== undefined) return undefined;\n\t\treturn {};\n\t}) as CookieFn;\n}\n"],"mappings":";;AAQA,eAAsB,cAMrB,QACA,kBACA,KAAkC,CAAC,GACnC,UACA,kBACC;CACD,IAAI;EACH,IAAI,CAAC,IAAI,QAAQ;GAChB,OAAO,MAAM,sBAAsB;GACnC;EACD;EACA,IAAI,CAAC,kBAAkB;GACtB,OAAO,KAAK,gCAAgC;GAC5C;EACD;EAIA,MAAM,aAAY,MAFK,iBAAiB,SAAS,CAAC,gBAAgB,CAAC,EAAA,CAGlE,iBAAiB;EAGlB,MAAM,SAAsC,CAAC;EAE7C,KAAK,MAAM,EAAE,MAAM,SAAS,MAAM,GAAG,OAAO,IAAI;GAC/C,OAAO,MAAM,EAAE,OAAO,KAAK,GAAG,kBAAkB;GAChD,MAAM,kBAAkB,MAAM,QAAQ,QAAQ;GAC9C,MAAM,QAAQ;IACb,GAAG;IACH;IACA,SAAS;GACV;GAEA,IAAI,CAAC,QAAQ,KAAK,QAAe,GAChC,OAAO,KAAK,KAAK;EAEnB;EAEA,IAAI,OAAO,QAAQ;GAClB,OAAO,MAAM,EAAE,YAAY,GAAG,OAAO,GAAG,mBAAmB;GAE3D,MAAM,UAAU,QAAQ,MAAM,CAAC,CAAC,OAAO,QAAQ;IAC9C,OAAO,MAAM,KAAK,0BAA0B;GAC7C,CAAC;EACF;CACD,SAAS,OAAO;EACf,OAAO,MAAM,OAAc,wCAAwC;CACpE;AACD;AAEA,eAAsB,uBAQrB,WASA,UACA,kBACA,SAAiB,UAAU,QAC1B;CACD,OAAO,cACN,QACA,kBACA,UAAU,QACV,UACA,UAAU,gBACX;AACD;;;;;;;;AC5EA,SAAgB,kBAAkB,GAAsB;CACvD,IAAI,aAA4C;CAEhD,SAAS,QAAiB;EACzB,IAAI,QAAQ,KAAA,GAEX,OAAO,EAAE,IAAI,OAAO,GAAG;EAGxB,IAAI,CAAC,YACJ,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EACnB,IAAI,CAAC,QAAQ;GACZ,SAAS,CAAC;GACV,IAAI,cACH,KAAK,MAAM,QAAQ,aAAa,MAAM,GAAG,GAAG;IAC3C,MAAM,UAAU,KAAK,KAAK;IAC1B,MAAM,UAAU,QAAQ,QAAQ,GAAG;IACnC,IAAI,UAAU,GAAG;KAChB,MAAM,MAAM,QAAQ,MAAM,GAAG,OAAO;KACpC,MAAM,QAAQ,QAAQ,MAAM,UAAU,CAAC;KAEvC,OAAO,OAAO,mBAAmB,KAAK;IACvC;GACD;EAEF;EACA,OAAO;CACR;CAEA,SAAS,SAAkB;EAC1B,IAAI,SAAS,KAAA,GACZ,OAAO,MAAM,CAAC,CAAC;EAEhB,OAAO,MAAM;CACd;AACD;;;;AAKA,SAAgB,oBAA8B;CAC7C,SAAS,QAAiB;EACzB,IAAI,QAAQ,KAAA,GAAW,OAAO,KAAA;EAC9B,OAAO,CAAC;CACT;AACD;;;;AAKA,SAAgB,oBAA8B;CAC7C,SAAS,SAAkB;EAC1B,IAAI,SAAS,KAAA,GAAW,OAAO,KAAA;EAC/B,OAAO,CAAC;CACT;AACD"}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
const hono_cookie = require_chunk.__toESM(require("hono/cookie"));
|
|
3
|
-
|
|
1
|
+
let hono_cookie = require("hono/cookie");
|
|
4
2
|
//#region src/publisher.ts
|
|
5
3
|
async function publishEvents(logger, serviceDiscovery, ev = [], response, publisherService) {
|
|
6
4
|
try {
|
|
@@ -12,10 +10,9 @@ async function publishEvents(logger, serviceDiscovery, ev = [], response, publis
|
|
|
12
10
|
logger.warn("No publisher service available");
|
|
13
11
|
return;
|
|
14
12
|
}
|
|
15
|
-
const
|
|
16
|
-
const publisher = services[publisherService.serviceName];
|
|
13
|
+
const publisher = (await serviceDiscovery.register([publisherService]))[publisherService.serviceName];
|
|
17
14
|
const events = [];
|
|
18
|
-
for (const { when, payload, type
|
|
15
|
+
for (const { when, payload, type, ...e } of ev) {
|
|
19
16
|
logger.debug({ event: type }, "Processing event");
|
|
20
17
|
const resolvedPayload = await payload(response);
|
|
21
18
|
const event = {
|
|
@@ -38,7 +35,6 @@ async function publishEvents(logger, serviceDiscovery, ev = [], response, publis
|
|
|
38
35
|
async function publishConstructEvents(construct, response, serviceDiscovery, logger = construct.logger) {
|
|
39
36
|
return publishEvents(logger, serviceDiscovery, construct.events, response, construct.publisherService);
|
|
40
37
|
}
|
|
41
|
-
|
|
42
38
|
//#endregion
|
|
43
39
|
//#region src/endpoints/lazyAccessors.ts
|
|
44
40
|
/**
|
|
@@ -48,11 +44,11 @@ async function publishConstructEvents(construct, response, serviceDiscovery, log
|
|
|
48
44
|
*/
|
|
49
45
|
function createHonoHeaders(c) {
|
|
50
46
|
let allHeaders = null;
|
|
51
|
-
return (key) => {
|
|
47
|
+
return ((key) => {
|
|
52
48
|
if (key !== void 0) return c.req.header(key);
|
|
53
49
|
if (!allHeaders) allHeaders = c.req.header();
|
|
54
50
|
return allHeaders;
|
|
55
|
-
};
|
|
51
|
+
});
|
|
56
52
|
}
|
|
57
53
|
/**
|
|
58
54
|
* Create a lazy cookie accessor for Hono.
|
|
@@ -61,7 +57,7 @@ function createHonoHeaders(c) {
|
|
|
61
57
|
*/
|
|
62
58
|
function createHonoCookies(c) {
|
|
63
59
|
let allCookies = null;
|
|
64
|
-
return (name) => {
|
|
60
|
+
return ((name) => {
|
|
65
61
|
if (name !== void 0) return (0, hono_cookie.getCookie)(c, name);
|
|
66
62
|
if (!allCookies) {
|
|
67
63
|
allCookies = {};
|
|
@@ -77,7 +73,7 @@ function createHonoCookies(c) {
|
|
|
77
73
|
}
|
|
78
74
|
}
|
|
79
75
|
return allCookies;
|
|
80
|
-
};
|
|
76
|
+
});
|
|
81
77
|
}
|
|
82
78
|
/**
|
|
83
79
|
* Create a lazy header accessor for API Gateway events.
|
|
@@ -94,17 +90,17 @@ function createApiGatewayHeaders(headers) {
|
|
|
94
90
|
}
|
|
95
91
|
return normalizedHeaders;
|
|
96
92
|
};
|
|
97
|
-
return (key) => {
|
|
93
|
+
return ((key) => {
|
|
98
94
|
if (key !== void 0) {
|
|
99
95
|
if (headers) {
|
|
100
96
|
const direct = headers[key] ?? headers[key.toLowerCase()];
|
|
101
97
|
if (direct !== void 0) return direct;
|
|
102
98
|
return normalize()[key.toLowerCase()];
|
|
103
99
|
}
|
|
104
|
-
return
|
|
100
|
+
return;
|
|
105
101
|
}
|
|
106
102
|
return normalize();
|
|
107
|
-
};
|
|
103
|
+
});
|
|
108
104
|
}
|
|
109
105
|
/**
|
|
110
106
|
* Create a lazy cookie accessor for API Gateway events.
|
|
@@ -135,10 +131,10 @@ function createApiGatewayCookies(cookies, cookieHeader) {
|
|
|
135
131
|
}
|
|
136
132
|
return parsed;
|
|
137
133
|
};
|
|
138
|
-
return (name) => {
|
|
134
|
+
return ((name) => {
|
|
139
135
|
if (name !== void 0) return parse()[name];
|
|
140
136
|
return parse();
|
|
141
|
-
};
|
|
137
|
+
});
|
|
142
138
|
}
|
|
143
139
|
/**
|
|
144
140
|
* Create a lazy header accessor for plain object headers (test adaptor, etc).
|
|
@@ -146,7 +142,7 @@ function createApiGatewayCookies(cookies, cookieHeader) {
|
|
|
146
142
|
*/
|
|
147
143
|
function createObjectHeaders(headers) {
|
|
148
144
|
let normalized = null;
|
|
149
|
-
return (key) => {
|
|
145
|
+
return ((key) => {
|
|
150
146
|
if (key !== void 0) {
|
|
151
147
|
if (headers) {
|
|
152
148
|
const direct = headers[key] ?? headers[key.toLowerCase()];
|
|
@@ -163,7 +159,7 @@ function createObjectHeaders(headers) {
|
|
|
163
159
|
for (const [k, v] of Object.entries(headers)) normalized[k.toLowerCase()] = v;
|
|
164
160
|
}
|
|
165
161
|
return normalized ?? {};
|
|
166
|
-
};
|
|
162
|
+
});
|
|
167
163
|
}
|
|
168
164
|
/**
|
|
169
165
|
* Create a lazy cookie accessor from a cookie header string.
|
|
@@ -186,89 +182,89 @@ function createCookieHeaderAccessor(cookieHeader) {
|
|
|
186
182
|
}
|
|
187
183
|
return parsed;
|
|
188
184
|
};
|
|
189
|
-
return (name) => {
|
|
185
|
+
return ((name) => {
|
|
190
186
|
if (name !== void 0) return parse()[name];
|
|
191
187
|
return parse();
|
|
192
|
-
};
|
|
188
|
+
});
|
|
193
189
|
}
|
|
194
190
|
/**
|
|
195
191
|
* Create a no-op header accessor (for minimal endpoints that don't use headers).
|
|
196
192
|
*/
|
|
197
193
|
function createNoopHeaders() {
|
|
198
|
-
return (key) => {
|
|
194
|
+
return ((key) => {
|
|
199
195
|
if (key !== void 0) return void 0;
|
|
200
196
|
return {};
|
|
201
|
-
};
|
|
197
|
+
});
|
|
202
198
|
}
|
|
203
199
|
/**
|
|
204
200
|
* Create a no-op cookie accessor (for minimal endpoints that don't use cookies).
|
|
205
201
|
*/
|
|
206
202
|
function createNoopCookies() {
|
|
207
|
-
return (name) => {
|
|
203
|
+
return ((name) => {
|
|
208
204
|
if (name !== void 0) return void 0;
|
|
209
205
|
return {};
|
|
210
|
-
};
|
|
206
|
+
});
|
|
211
207
|
}
|
|
212
|
-
|
|
213
208
|
//#endregion
|
|
214
|
-
Object.defineProperty(exports,
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
209
|
+
Object.defineProperty(exports, "createApiGatewayCookies", {
|
|
210
|
+
enumerable: true,
|
|
211
|
+
get: function() {
|
|
212
|
+
return createApiGatewayCookies;
|
|
213
|
+
}
|
|
219
214
|
});
|
|
220
|
-
Object.defineProperty(exports,
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
215
|
+
Object.defineProperty(exports, "createApiGatewayHeaders", {
|
|
216
|
+
enumerable: true,
|
|
217
|
+
get: function() {
|
|
218
|
+
return createApiGatewayHeaders;
|
|
219
|
+
}
|
|
225
220
|
});
|
|
226
|
-
Object.defineProperty(exports,
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
221
|
+
Object.defineProperty(exports, "createCookieHeaderAccessor", {
|
|
222
|
+
enumerable: true,
|
|
223
|
+
get: function() {
|
|
224
|
+
return createCookieHeaderAccessor;
|
|
225
|
+
}
|
|
231
226
|
});
|
|
232
|
-
Object.defineProperty(exports,
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
227
|
+
Object.defineProperty(exports, "createHonoCookies", {
|
|
228
|
+
enumerable: true,
|
|
229
|
+
get: function() {
|
|
230
|
+
return createHonoCookies;
|
|
231
|
+
}
|
|
237
232
|
});
|
|
238
|
-
Object.defineProperty(exports,
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
233
|
+
Object.defineProperty(exports, "createHonoHeaders", {
|
|
234
|
+
enumerable: true,
|
|
235
|
+
get: function() {
|
|
236
|
+
return createHonoHeaders;
|
|
237
|
+
}
|
|
243
238
|
});
|
|
244
|
-
Object.defineProperty(exports,
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
239
|
+
Object.defineProperty(exports, "createNoopCookies", {
|
|
240
|
+
enumerable: true,
|
|
241
|
+
get: function() {
|
|
242
|
+
return createNoopCookies;
|
|
243
|
+
}
|
|
249
244
|
});
|
|
250
|
-
Object.defineProperty(exports,
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
245
|
+
Object.defineProperty(exports, "createNoopHeaders", {
|
|
246
|
+
enumerable: true,
|
|
247
|
+
get: function() {
|
|
248
|
+
return createNoopHeaders;
|
|
249
|
+
}
|
|
255
250
|
});
|
|
256
|
-
Object.defineProperty(exports,
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
251
|
+
Object.defineProperty(exports, "createObjectHeaders", {
|
|
252
|
+
enumerable: true,
|
|
253
|
+
get: function() {
|
|
254
|
+
return createObjectHeaders;
|
|
255
|
+
}
|
|
261
256
|
});
|
|
262
|
-
Object.defineProperty(exports,
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
257
|
+
Object.defineProperty(exports, "publishConstructEvents", {
|
|
258
|
+
enumerable: true,
|
|
259
|
+
get: function() {
|
|
260
|
+
return publishConstructEvents;
|
|
261
|
+
}
|
|
267
262
|
});
|
|
268
|
-
Object.defineProperty(exports,
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
263
|
+
Object.defineProperty(exports, "publishEvents", {
|
|
264
|
+
enumerable: true,
|
|
265
|
+
get: function() {
|
|
266
|
+
return publishEvents;
|
|
267
|
+
}
|
|
273
268
|
});
|
|
274
|
-
|
|
269
|
+
|
|
270
|
+
//# sourceMappingURL=lazyAccessors-Dx9NLwJZ.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lazyAccessors-Dx9NLwJZ.cjs","names":["getCookie"],"sources":["../src/publisher.ts","../src/endpoints/lazyAccessors.ts"],"sourcesContent":["import type { AuditStorage } from '@geekmidas/audit';\nimport type { EventPublisher, MappedEvent } from '@geekmidas/events';\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 { Construct } from './Construct';\n\nexport async function publishEvents<\n\tT extends EventPublisher<any> | undefined,\n\tOutSchema extends StandardSchemaV1 | undefined = undefined,\n\tTServiceName extends string = string,\n\tTPublisherService extends Service<TServiceName, T> | undefined = undefined,\n>(\n\tlogger: Logger,\n\tserviceDiscovery: ServiceDiscovery<any>,\n\tev: MappedEvent<T, OutSchema>[] = [],\n\tresponse: InferStandardSchema<OutSchema>,\n\tpublisherService: TPublisherService,\n) {\n\ttry {\n\t\tif (!ev?.length) {\n\t\t\tlogger.debug('No events to publish');\n\t\t\treturn;\n\t\t}\n\t\tif (!publisherService) {\n\t\t\tlogger.warn('No publisher service available');\n\t\t\treturn;\n\t\t}\n\n\t\tconst services = await serviceDiscovery.register([publisherService]);\n\n\t\tconst publisher = services[\n\t\t\tpublisherService.serviceName\n\t\t] as EventPublisher<any>;\n\n\t\tconst events: MappedEvent<T, OutSchema>[] = [];\n\n\t\tfor (const { when, payload, type, ...e } of ev) {\n\t\t\tlogger.debug({ event: type }, 'Processing event');\n\t\t\tconst resolvedPayload = await payload(response);\n\t\t\tconst event = {\n\t\t\t\t...e,\n\t\t\t\ttype,\n\t\t\t\tpayload: resolvedPayload,\n\t\t\t};\n\n\t\t\tif (!when || when(response as any)) {\n\t\t\t\tevents.push(event);\n\t\t\t}\n\t\t}\n\n\t\tif (events.length) {\n\t\t\tlogger.debug({ eventCount: ev.length }, 'Publishing events');\n\n\t\t\tawait publisher.publish(events).catch((err) => {\n\t\t\t\tlogger.error(err, 'Failed to publish events');\n\t\t\t});\n\t\t}\n\t} catch (error) {\n\t\tlogger.error(error as any, 'Something went wrong publishing events');\n\t}\n}\n\nexport async function publishConstructEvents<\n\tT extends EventPublisher<any> | undefined,\n\tOutSchema extends StandardSchemaV1 | undefined = undefined,\n\tTServiceName extends string = string,\n\tTServices extends Service[] = [],\n\tTAuditStorageServiceName extends string = string,\n\tTAuditStorage extends AuditStorage | undefined = undefined,\n>(\n\tconstruct: Construct<\n\t\tLogger,\n\t\tTServiceName,\n\t\tT,\n\t\tOutSchema,\n\t\tTServices,\n\t\tTAuditStorageServiceName,\n\t\tTAuditStorage\n\t>,\n\tresponse: InferStandardSchema<OutSchema>,\n\tserviceDiscovery: ServiceDiscovery<any>,\n\tlogger: Logger = construct.logger,\n) {\n\treturn publishEvents(\n\t\tlogger,\n\t\tserviceDiscovery,\n\t\tconstruct.events,\n\t\tresponse,\n\t\tconstruct.publisherService,\n\t);\n}\n","/**\n * Lazy header and cookie accessors for different adaptors.\n *\n * Instead of parsing all headers/cookies upfront, these accessors\n * use native adaptor methods for single lookups and only parse\n * everything when `header()` or `cookie()` is called without arguments.\n */\nimport type { Context } from 'hono';\nimport { getCookie } from 'hono/cookie';\nimport type { CookieFn, HeaderFn } from './Endpoint';\n\n/**\n * Create a lazy header accessor for Hono.\n * Uses `c.req.header(name)` for single lookups (native, case-insensitive).\n * Only calls `c.req.header()` to get all headers when needed.\n */\nexport function createHonoHeaders(c: Context): HeaderFn {\n\tlet allHeaders: Record<string, string> | null = null;\n\n\treturn ((key?: string) => {\n\t\tif (key !== undefined) {\n\t\t\t// Single header lookup - use native Hono method (case-insensitive)\n\t\t\treturn c.req.header(key);\n\t\t}\n\t\t// Get all headers - cache the result\n\t\tif (!allHeaders) {\n\t\t\tallHeaders = c.req.header();\n\t\t}\n\t\treturn allHeaders;\n\t}) as HeaderFn;\n}\n\n/**\n * Create a lazy cookie accessor for Hono.\n * Uses `getCookie(c, name)` for single lookups (native).\n * Only parses the cookie header when all cookies are requested.\n */\nexport function createHonoCookies(c: Context): CookieFn {\n\tlet allCookies: Record<string, string> | null = null;\n\n\treturn ((name?: string) => {\n\t\tif (name !== undefined) {\n\t\t\t// Single cookie lookup - use native Hono method\n\t\t\treturn getCookie(c, name);\n\t\t}\n\t\t// Get all cookies - parse and cache\n\t\tif (!allCookies) {\n\t\t\tallCookies = {};\n\t\t\tconst cookieHeader = c.req.header('cookie');\n\t\t\tif (cookieHeader) {\n\t\t\t\tfor (const part of cookieHeader.split(';')) {\n\t\t\t\t\tconst trimmed = part.trim();\n\t\t\t\t\tconst eqIndex = trimmed.indexOf('=');\n\t\t\t\t\tif (eqIndex > 0) {\n\t\t\t\t\t\tconst key = trimmed.slice(0, eqIndex);\n\t\t\t\t\t\tconst value = trimmed.slice(eqIndex + 1);\n\t\t\t\t\t\tallCookies[key] = value;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn allCookies;\n\t}) as CookieFn;\n}\n\n/**\n * Create a lazy header accessor for API Gateway events.\n * Handles case-insensitive lookups.\n */\nexport function createApiGatewayHeaders(\n\theaders: Record<string, string | undefined> | null | undefined,\n): HeaderFn {\n\tlet normalizedHeaders: Record<string, string> | null = null;\n\n\tconst normalize = () => {\n\t\tif (!normalizedHeaders) {\n\t\t\tnormalizedHeaders = {};\n\t\t\tif (headers) {\n\t\t\t\tfor (const [k, v] of Object.entries(headers)) {\n\t\t\t\t\tif (v !== undefined) {\n\t\t\t\t\t\tnormalizedHeaders[k.toLowerCase()] = v;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn normalizedHeaders;\n\t};\n\n\treturn ((key?: string) => {\n\t\tif (key !== undefined) {\n\t\t\t// Try direct lookup first (common case: headers already lowercase)\n\t\t\tif (headers) {\n\t\t\t\tconst direct = headers[key] ?? headers[key.toLowerCase()];\n\t\t\t\tif (direct !== undefined) return direct;\n\t\t\t\t// Fall back to normalized lookup\n\t\t\t\treturn normalize()[key.toLowerCase()];\n\t\t\t}\n\t\t\treturn undefined;\n\t\t}\n\t\treturn normalize();\n\t}) as HeaderFn;\n}\n\n/**\n * Create a lazy cookie accessor for API Gateway events.\n * Decodes URL-encoded values to match browser behavior.\n */\nexport function createApiGatewayCookies(\n\tcookies: string[] | undefined,\n\tcookieHeader: string | undefined,\n): CookieFn {\n\tlet parsed: Record<string, string> | null = null;\n\n\tconst parse = () => {\n\t\tif (!parsed) {\n\t\t\tparsed = {};\n\t\t\t// API Gateway v2 provides cookies as array\n\t\t\tif (cookies) {\n\t\t\t\tfor (const cookie of cookies) {\n\t\t\t\t\tconst eqIndex = cookie.indexOf('=');\n\t\t\t\t\tif (eqIndex > 0) {\n\t\t\t\t\t\tconst key = cookie.slice(0, eqIndex);\n\t\t\t\t\t\tconst value = cookie.slice(eqIndex + 1);\n\t\t\t\t\t\tparsed[key] = decodeURIComponent(value);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else if (cookieHeader) {\n\t\t\t\t// Fall back to parsing cookie header\n\t\t\t\tfor (const part of cookieHeader.split(';')) {\n\t\t\t\t\tconst trimmed = part.trim();\n\t\t\t\t\tconst eqIndex = trimmed.indexOf('=');\n\t\t\t\t\tif (eqIndex > 0) {\n\t\t\t\t\t\tconst key = trimmed.slice(0, eqIndex);\n\t\t\t\t\t\tconst value = trimmed.slice(eqIndex + 1);\n\t\t\t\t\t\tparsed[key] = decodeURIComponent(value);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn parsed;\n\t};\n\n\treturn ((name?: string) => {\n\t\tif (name !== undefined) {\n\t\t\treturn parse()[name];\n\t\t}\n\t\treturn parse();\n\t}) as CookieFn;\n}\n\n/**\n * Create a lazy header accessor for plain object headers (test adaptor, etc).\n * Headers are already available as an object, just provide lazy access.\n */\nexport function createObjectHeaders(\n\theaders: Record<string, string> | undefined,\n): HeaderFn {\n\tlet normalized: Record<string, string> | null = null;\n\n\treturn ((key?: string) => {\n\t\tif (key !== undefined) {\n\t\t\t// Try direct lookup first (common case)\n\t\t\tif (headers) {\n\t\t\t\tconst direct = headers[key] ?? headers[key.toLowerCase()];\n\t\t\t\tif (direct !== undefined) return direct;\n\t\t\t}\n\t\t\t// Fall back to normalized lookup for case-insensitivity\n\t\t\tif (!normalized && headers) {\n\t\t\t\tnormalized = {};\n\t\t\t\tfor (const [k, v] of Object.entries(headers)) {\n\t\t\t\t\tnormalized[k.toLowerCase()] = v;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn normalized?.[key.toLowerCase()];\n\t\t}\n\t\t// Return all headers\n\t\tif (!normalized && headers) {\n\t\t\tnormalized = {};\n\t\t\tfor (const [k, v] of Object.entries(headers)) {\n\t\t\t\tnormalized[k.toLowerCase()] = v;\n\t\t\t}\n\t\t}\n\t\treturn normalized ?? {};\n\t}) as HeaderFn;\n}\n\n/**\n * Create a lazy cookie accessor from a cookie header string.\n * Decodes URL-encoded values to match browser behavior.\n */\nexport function createCookieHeaderAccessor(\n\tcookieHeader: string | undefined,\n): CookieFn {\n\tlet parsed: Record<string, string> | null = null;\n\n\tconst parse = () => {\n\t\tif (!parsed) {\n\t\t\tparsed = {};\n\t\t\tif (cookieHeader) {\n\t\t\t\tfor (const part of cookieHeader.split(';')) {\n\t\t\t\t\tconst trimmed = part.trim();\n\t\t\t\t\tconst eqIndex = trimmed.indexOf('=');\n\t\t\t\t\tif (eqIndex > 0) {\n\t\t\t\t\t\tconst key = trimmed.slice(0, eqIndex);\n\t\t\t\t\t\tconst value = trimmed.slice(eqIndex + 1);\n\t\t\t\t\t\t// Decode URL-encoded values to match Endpoint.createCookies behavior\n\t\t\t\t\t\tparsed[key] = decodeURIComponent(value);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn parsed;\n\t};\n\n\treturn ((name?: string) => {\n\t\tif (name !== undefined) {\n\t\t\treturn parse()[name];\n\t\t}\n\t\treturn parse();\n\t}) as CookieFn;\n}\n\n/**\n * Create a no-op header accessor (for minimal endpoints that don't use headers).\n */\nexport function createNoopHeaders(): HeaderFn {\n\treturn ((key?: string) => {\n\t\tif (key !== undefined) return undefined;\n\t\treturn {};\n\t}) as HeaderFn;\n}\n\n/**\n * Create a no-op cookie accessor (for minimal endpoints that don't use cookies).\n */\nexport function createNoopCookies(): CookieFn {\n\treturn ((name?: string) => {\n\t\tif (name !== undefined) return undefined;\n\t\treturn {};\n\t}) as CookieFn;\n}\n"],"mappings":";;AAQA,eAAsB,cAMrB,QACA,kBACA,KAAkC,CAAC,GACnC,UACA,kBACC;CACD,IAAI;EACH,IAAI,CAAC,IAAI,QAAQ;GAChB,OAAO,MAAM,sBAAsB;GACnC;EACD;EACA,IAAI,CAAC,kBAAkB;GACtB,OAAO,KAAK,gCAAgC;GAC5C;EACD;EAIA,MAAM,aAAY,MAFK,iBAAiB,SAAS,CAAC,gBAAgB,CAAC,EAAA,CAGlE,iBAAiB;EAGlB,MAAM,SAAsC,CAAC;EAE7C,KAAK,MAAM,EAAE,MAAM,SAAS,MAAM,GAAG,OAAO,IAAI;GAC/C,OAAO,MAAM,EAAE,OAAO,KAAK,GAAG,kBAAkB;GAChD,MAAM,kBAAkB,MAAM,QAAQ,QAAQ;GAC9C,MA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AACD;;;;AAKA,SAAgB,oBAA8B;CAC7C,SAAS,SAAkB;EAC1B,IAAI,SAAS,KAAA,GAAW,OAAO,KAAA;EAC/B,OAAO,CAAC;CACT;AACD"}
|
package/dist/object-storage.cjs
CHANGED
|
@@ -1,9 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
let _geekmidas_manifest = require("@geekmidas/manifest");
|
|
3
|
+
let _geekmidas_storage = require("@geekmidas/storage");
|
|
5
4
|
//#region src/object-storage.ts
|
|
5
|
+
/**
|
|
6
|
+
* `ObjectStorage` — a declared bucket.
|
|
7
|
+
*
|
|
8
|
+
* Where the three packages meet: it implements the construct contract, derives
|
|
9
|
+
* its env key through `@geekmidas/manifest`, and hands back a
|
|
10
|
+
* `@geekmidas/storage` client. It names no cloud — `--target=aws` fills the
|
|
11
|
+
* injected URL with S3's values, local dev with MinIO's.
|
|
12
|
+
*/
|
|
6
13
|
var ObjectStorage = class {
|
|
14
|
+
options;
|
|
7
15
|
id;
|
|
8
16
|
service;
|
|
9
17
|
/**
|
|
@@ -14,12 +22,12 @@ var ObjectStorage = class {
|
|
|
14
22
|
keys;
|
|
15
23
|
constructor(id, options = {}) {
|
|
16
24
|
this.options = options;
|
|
17
|
-
const canonical = (0,
|
|
25
|
+
const canonical = (0, _geekmidas_manifest.canonicalId)(id);
|
|
18
26
|
this.id = canonical;
|
|
19
|
-
this.keys = { url: (0,
|
|
27
|
+
this.keys = { url: (0, _geekmidas_manifest.provideKey)(canonical, "url") };
|
|
20
28
|
this.service = {
|
|
21
|
-
serviceName: (0,
|
|
22
|
-
register: (options
|
|
29
|
+
serviceName: (0, _geekmidas_manifest.serviceKey)(canonical),
|
|
30
|
+
register: (options) => this.connect(options)
|
|
23
31
|
};
|
|
24
32
|
}
|
|
25
33
|
declare() {
|
|
@@ -39,10 +47,10 @@ var ObjectStorage = class {
|
|
|
39
47
|
*/
|
|
40
48
|
async connect({ envParser }) {
|
|
41
49
|
const { url } = envParser.create((get) => ({ url: get(this.keys.url).string() })).parse();
|
|
42
|
-
return (0,
|
|
50
|
+
return (0, _geekmidas_storage.createStorageClient)(url);
|
|
43
51
|
}
|
|
44
52
|
};
|
|
45
|
-
|
|
46
53
|
//#endregion
|
|
47
54
|
exports.ObjectStorage = ObjectStorage;
|
|
55
|
+
|
|
48
56
|
//# sourceMappingURL=object-storage.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"object-storage.cjs","names":["
|
|
1
|
+
{"version":3,"file":"object-storage.cjs","names":["canonicalId","provideKey","serviceKey","createStorageClient"],"sources":["../src/object-storage.ts"],"sourcesContent":["/**\n * `ObjectStorage` — a declared bucket.\n *\n * Where the three packages meet: it implements the construct contract, derives\n * its env key through `@geekmidas/manifest`, and hands back a\n * `@geekmidas/storage` client. It names no cloud — `--target=aws` fills the\n * injected URL with S3's values, local dev with MinIO's.\n */\n\nimport {\n\ttype ConstructName,\n\tcanonicalId,\n\ttype Declaration,\n\tprovideKey,\n\tserviceKey,\n} from '@geekmidas/manifest';\nimport type { Service, ServiceRegisterOptions } from '@geekmidas/services';\nimport { createStorageClient, type StorageClient } from '@geekmidas/storage';\nimport type { Construct } from './construct-interface';\n\nexport interface ObjectStorageOptions {\n\t/** Keep previous versions of an object. */\n\tversioned?: boolean;\n}\n\nexport class ObjectStorage<TName extends string = string>\n\timplements Construct<TName, StorageClient>\n{\n\treadonly id: TName;\n\treadonly service: Service<Uncapitalize<TName>, StorageClient>;\n\n\t/**\n\t * Declared once and read by both `declare()` and `connect()`, so the key the\n\t * build publishes and the key the client reads cannot drift — the whole point\n\t * of the construct owning both faces.\n\t */\n\tprivate readonly keys: { url: string };\n\n\tconstructor(\n\t\tid: ConstructName<TName>,\n\t\tprivate readonly options: ObjectStorageOptions = {},\n\t) {\n\t\t// Canonicalises, so `uploads` and `Uploads` are one construct rather than\n\t\t// two that collide. Throws on anything that cannot become a valid id.\n\t\tconst canonical = canonicalId(id as string);\n\n\t\tthis.id = canonical as TName;\n\t\tthis.keys = { url: provideKey(canonical, 'url') };\n\n\t\t// A field, not a getter: consumers cache services by object identity.\n\t\tthis.service = {\n\t\t\tserviceName: serviceKey(canonical) as Uncapitalize<TName>,\n\t\t\tregister: (options) => this.connect(options),\n\t\t};\n\t}\n\n\tdeclare(): Declaration[] {\n\t\treturn [\n\t\t\t{\n\t\t\t\tkind: 'objects',\n\t\t\t\tid: this.id,\n\t\t\t\tprovides: [this.keys.url],\n\t\t\t\t...(this.options.versioned ? { versioned: true } : {}),\n\t\t\t},\n\t\t];\n\t}\n\n\t/**\n\t * Builds the client from the single URL the adapter supplied.\n\t *\n\t * The URL's scheme selects the driver, so this construct imports no provider\n\t * and an app that never touches S3 never resolves the AWS SDK. Whoever\n\t * assembles the application registers the drivers its target needs.\n\t */\n\tprivate async connect({\n\t\tenvParser,\n\t}: ServiceRegisterOptions): Promise<StorageClient> {\n\t\tconst { url } = envParser\n\t\t\t.create((get) => ({ url: get(this.keys.url).string() }))\n\t\t\t.parse();\n\n\t\treturn createStorageClient(url);\n\t}\n}\n"],"mappings":";;;;;;;;;;;;AAyBA,IAAa,gBAAb,MAEA;CAamB;CAZlB;CACA;;;;;;CAOA;CAEA,YACC,IACA,UAAiD,CAAC,GACjD;EADgB,KAAA,UAAA;EAIjB,MAAM,aAAA,GAAYA,oBAAAA,YAAAA,CAAY,EAAY;EAE1C,KAAK,KAAK;EACV,KAAK,OAAO,EAAE,MAAA,GAAKC,oBAAAA,WAAAA,CAAW,WAAW,KAAK,EAAE;EAGhD,KAAK,UAAU;GACd,cAAA,GAAaC,oBAAAA,WAAAA,CAAW,SAAS;GACjC,WAAW,YAAY,KAAK,QAAQ,OAAO;EAC5C;CACD;CAEA,UAAyB;EACxB,OAAO,CACN;GACC,MAAM;GACN,IAAI,KAAK;GACT,UAAU,CAAC,KAAK,KAAK,GAAG;GACxB,GAAI,KAAK,QAAQ,YAAY,EAAE,WAAW,KAAK,IAAI,CAAC;EACrD,CACD;CACD;;;;;;;;CASA,MAAc,QAAQ,EACrB,aACkD;EAClD,MAAM,EAAE,QAAQ,UACd,QAAQ,SAAS,EAAE,KAAK,IAAI,KAAK,KAAK,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CACvD,MAAM;EAER,QAAA,GAAOC,mBAAAA,oBAAAA,CAAoB,GAAG;CAC/B;AACD"}
|
|
@@ -1,15 +1,13 @@
|
|
|
1
|
-
import { Construct } from "./construct-interface-
|
|
1
|
+
import { n as Construct } from "./construct-interface-DIaTNKax.cjs";
|
|
2
2
|
import { Service } from "@geekmidas/services";
|
|
3
3
|
import { ConstructName, Declaration } from "@geekmidas/manifest";
|
|
4
4
|
import { StorageClient } from "@geekmidas/storage";
|
|
5
|
-
|
|
6
5
|
//#region src/object-storage.d.ts
|
|
7
|
-
|
|
8
|
-
interface ObjectStorageOptions {
|
|
6
|
+
export interface ObjectStorageOptions {
|
|
9
7
|
/** Keep previous versions of an object. */
|
|
10
8
|
versioned?: boolean;
|
|
11
9
|
}
|
|
12
|
-
declare class ObjectStorage<TName extends string = string> implements Construct<TName, StorageClient> {
|
|
10
|
+
export declare class ObjectStorage<TName extends string = string> implements Construct<TName, StorageClient> {
|
|
13
11
|
private readonly options;
|
|
14
12
|
readonly id: TName;
|
|
15
13
|
readonly service: Service<Uncapitalize<TName>, StorageClient>;
|
|
@@ -30,7 +28,5 @@ declare class ObjectStorage<TName extends string = string> implements Construct<
|
|
|
30
28
|
*/
|
|
31
29
|
private connect;
|
|
32
30
|
}
|
|
33
|
-
//# sourceMappingURL=object-storage.d.ts.map
|
|
34
31
|
//#endregion
|
|
35
|
-
export { ObjectStorage, ObjectStorageOptions };
|
|
36
32
|
//# sourceMappingURL=object-storage.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"object-storage.d.cts","names":[],"sources":["../src/object-storage.ts"],"
|
|
1
|
+
{"version":3,"file":"object-storage.d.cts","names":[],"sources":["../src/object-storage.ts"],"mappings":";;;;;iBAoBiB;;EAEhB;;qBAGY,cAAc,0CACf,UAAU,OAAO;mBAcV;WAZT,IAAI;WACJ,SAAS,QAAQ,aAAa,QAAQ;;;;;;mBAO9B;EAEjB,YACC,IAAI,cAAc,QACD,UAAS;EAgB3B,WAAW;;;;;;;;UAkBG"}
|
|
@@ -1,15 +1,13 @@
|
|
|
1
|
-
import { Construct } from "./construct-interface-
|
|
1
|
+
import { n as Construct } from "./construct-interface-Clz7_BwB.mjs";
|
|
2
2
|
import { ConstructName, Declaration } from "@geekmidas/manifest";
|
|
3
3
|
import { StorageClient } from "@geekmidas/storage";
|
|
4
4
|
import { Service } from "@geekmidas/services";
|
|
5
|
-
|
|
6
5
|
//#region src/object-storage.d.ts
|
|
7
|
-
|
|
8
|
-
interface ObjectStorageOptions {
|
|
6
|
+
export interface ObjectStorageOptions {
|
|
9
7
|
/** Keep previous versions of an object. */
|
|
10
8
|
versioned?: boolean;
|
|
11
9
|
}
|
|
12
|
-
declare class ObjectStorage<TName extends string = string> implements Construct<TName, StorageClient> {
|
|
10
|
+
export declare class ObjectStorage<TName extends string = string> implements Construct<TName, StorageClient> {
|
|
13
11
|
private readonly options;
|
|
14
12
|
readonly id: TName;
|
|
15
13
|
readonly service: Service<Uncapitalize<TName>, StorageClient>;
|
|
@@ -30,7 +28,5 @@ declare class ObjectStorage<TName extends string = string> implements Construct<
|
|
|
30
28
|
*/
|
|
31
29
|
private connect;
|
|
32
30
|
}
|
|
33
|
-
//# sourceMappingURL=object-storage.d.ts.map
|
|
34
31
|
//#endregion
|
|
35
|
-
export { ObjectStorage, ObjectStorageOptions };
|
|
36
32
|
//# sourceMappingURL=object-storage.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"object-storage.d.mts","names":[],"sources":["../src/object-storage.ts"],"
|
|
1
|
+
{"version":3,"file":"object-storage.d.mts","names":[],"sources":["../src/object-storage.ts"],"mappings":";;;;;iBAoBiB;;EAEhB;;qBAGY,cAAc,0CACf,UAAU,OAAO;mBAcV;WAZT,IAAI;WACJ,SAAS,QAAQ,aAAa,QAAQ;;;;;;mBAO9B;EAEjB,YACC,IAAI,cAAc,QACD,UAAS;EAgB3B,WAAW;;;;;;;;UAkBG"}
|
package/dist/object-storage.mjs
CHANGED
|
@@ -1,8 +1,16 @@
|
|
|
1
1
|
import { canonicalId, provideKey, serviceKey } from "@geekmidas/manifest";
|
|
2
2
|
import { createStorageClient } from "@geekmidas/storage";
|
|
3
|
-
|
|
4
3
|
//#region src/object-storage.ts
|
|
4
|
+
/**
|
|
5
|
+
* `ObjectStorage` — a declared bucket.
|
|
6
|
+
*
|
|
7
|
+
* Where the three packages meet: it implements the construct contract, derives
|
|
8
|
+
* its env key through `@geekmidas/manifest`, and hands back a
|
|
9
|
+
* `@geekmidas/storage` client. It names no cloud — `--target=aws` fills the
|
|
10
|
+
* injected URL with S3's values, local dev with MinIO's.
|
|
11
|
+
*/
|
|
5
12
|
var ObjectStorage = class {
|
|
13
|
+
options;
|
|
6
14
|
id;
|
|
7
15
|
service;
|
|
8
16
|
/**
|
|
@@ -18,7 +26,7 @@ var ObjectStorage = class {
|
|
|
18
26
|
this.keys = { url: provideKey(canonical, "url") };
|
|
19
27
|
this.service = {
|
|
20
28
|
serviceName: serviceKey(canonical),
|
|
21
|
-
register: (options
|
|
29
|
+
register: (options) => this.connect(options)
|
|
22
30
|
};
|
|
23
31
|
}
|
|
24
32
|
declare() {
|
|
@@ -41,7 +49,7 @@ var ObjectStorage = class {
|
|
|
41
49
|
return createStorageClient(url);
|
|
42
50
|
}
|
|
43
51
|
};
|
|
44
|
-
|
|
45
52
|
//#endregion
|
|
46
53
|
export { ObjectStorage };
|
|
54
|
+
|
|
47
55
|
//# sourceMappingURL=object-storage.mjs.map
|