@geekmidas/constructs 10.0.0-alpha.12 → 10.0.0-alpha.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{Construct-BD5neF7w.mjs → Construct-BeYVu_QF.mjs} +30 -28
- package/dist/Construct-BeYVu_QF.mjs.map +1 -0
- package/dist/{Construct-Ct8nalEi.d.mts → Construct-DfbwIntp.d.cts} +10 -12
- package/dist/Construct-DfbwIntp.d.cts.map +1 -0
- package/dist/{Construct-CyS3RpTL.cjs → Construct-DqdlARxq.cjs} +50 -42
- package/dist/{Construct-BD5neF7w.mjs.map → Construct-DqdlARxq.cjs.map} +1 -1
- package/dist/{Construct-C0ijr2qp.d.cts → Construct-l5aOn_jv.d.mts} +9 -11
- package/dist/Construct-l5aOn_jv.d.mts.map +1 -0
- package/dist/{Cron-DmQ8vQ4b.d.cts → Cron-DKqnnTdH.d.cts} +4 -5
- package/dist/Cron-DKqnnTdH.d.cts.map +1 -0
- package/dist/{Cron-dh4rUgib.d.mts → Cron-SyqS5oWJ.d.mts} +5 -6
- package/dist/Cron-SyqS5oWJ.d.mts.map +1 -0
- package/dist/{CronBuilder-Da0C0edR.cjs → CronBuilder-BdnI6lxF.cjs} +24 -25
- package/dist/CronBuilder-BdnI6lxF.cjs.map +1 -0
- package/dist/{CronBuilder-BquXDbDI.d.cts → CronBuilder-CRGnDfTq.d.mts} +7 -10
- package/dist/CronBuilder-CRGnDfTq.d.mts.map +1 -0
- package/dist/{CronBuilder-CYKT5RiO.mjs → CronBuilder-D_0HNBTr.mjs} +14 -15
- package/dist/CronBuilder-D_0HNBTr.mjs.map +1 -0
- package/dist/{CronBuilder-CGgY2080.d.mts → CronBuilder-Df1q9PNy.d.cts} +7 -10
- package/dist/CronBuilder-Df1q9PNy.d.cts.map +1 -0
- package/dist/{Endpoint-DCQPMdUX.mjs → Endpoint-BCiCYvx2.mjs} +79 -106
- package/dist/Endpoint-BCiCYvx2.mjs.map +1 -0
- package/dist/{Endpoint-BjWKinFA.d.mts → Endpoint-C6yyHpRS.d.cts} +14 -65
- package/dist/Endpoint-C6yyHpRS.d.cts.map +1 -0
- package/dist/{Endpoint-dav89W6-.d.cts → Endpoint-DuT4TEEq.d.mts} +14 -65
- package/dist/Endpoint-DuT4TEEq.d.mts.map +1 -0
- package/dist/{Endpoint-DcWXE-SZ.cjs → Endpoint-s0AyrQGC.cjs} +101 -128
- package/dist/Endpoint-s0AyrQGC.cjs.map +1 -0
- package/dist/{EndpointFactory-CdWB7wPw.cjs → EndpointFactory-M8OQKZRY.cjs} +57 -66
- package/dist/EndpointFactory-M8OQKZRY.cjs.map +1 -0
- package/dist/{EndpointFactory-CjV8F_lJ.mjs → EndpointFactory-ptPR1cXw.mjs} +20 -29
- package/dist/EndpointFactory-ptPR1cXw.mjs.map +1 -0
- package/dist/{HonoEndpointAdaptor-DtL9j19R.cjs → HonoEndpointAdaptor-7QagYKdP.cjs} +48 -52
- package/dist/HonoEndpointAdaptor-7QagYKdP.cjs.map +1 -0
- package/dist/{HonoEndpointAdaptor-P1ahhZHu.mjs → HonoEndpointAdaptor-CYHA0WAt.mjs} +40 -47
- package/dist/{HonoEndpointAdaptor-DtL9j19R.cjs.map → HonoEndpointAdaptor-CYHA0WAt.mjs.map} +1 -1
- package/dist/{Queue-D7ZuwBhy.d.cts → Queue-D9X6OoON.d.mts} +10 -11
- package/dist/Queue-D9X6OoON.d.mts.map +1 -0
- package/dist/{Queue-gVGfi2Yk.d.mts → Queue-DYPB2KWL.d.cts} +10 -11
- package/dist/Queue-DYPB2KWL.d.cts.map +1 -0
- package/dist/{Subscriber-2mEi0ImH.d.cts → Subscriber-C4heaAyO.d.mts} +7 -8
- package/dist/Subscriber-C4heaAyO.d.mts.map +1 -0
- package/dist/{Subscriber-xTJ9ayPN.d.mts → Subscriber-CotDUELC.d.cts} +7 -8
- package/dist/Subscriber-CotDUELC.d.cts.map +1 -0
- package/dist/{SubscriberBuilder-Dptmo-1A.d.mts → SubscriberBuilder-BEv0eoHy.d.cts} +8 -11
- package/dist/SubscriberBuilder-BEv0eoHy.d.cts.map +1 -0
- package/dist/{SubscriberBuilder-4OPehf2R.cjs → SubscriberBuilder-C0ZEtGDI.cjs} +28 -23
- package/dist/SubscriberBuilder-C0ZEtGDI.cjs.map +1 -0
- package/dist/{SubscriberBuilder-BjkbeT9l.mjs → SubscriberBuilder-h7B_cHMr.mjs} +16 -10
- package/dist/SubscriberBuilder-h7B_cHMr.mjs.map +1 -0
- package/dist/{SubscriberBuilder-waNhzjSM.d.cts → SubscriberBuilder-tyH5yTk5.d.mts} +8 -11
- package/dist/SubscriberBuilder-tyH5yTk5.d.mts.map +1 -0
- package/dist/{Topic-19QeHBIR.d.cts → Topic-DEVGo0Dm.d.cts} +5 -7
- package/dist/Topic-DEVGo0Dm.d.cts.map +1 -0
- package/dist/{Topic-DuFeqkBh.d.mts → Topic-zk_6Gthr.d.mts} +6 -8
- package/dist/Topic-zk_6Gthr.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 +60 -73
- package/dist/adaptors/testing.cjs.map +1 -1
- package/dist/adaptors/testing.d.cts +17 -28
- package/dist/adaptors/testing.d.cts.map +1 -1
- package/dist/adaptors/testing.d.mts +18 -29
- package/dist/adaptors/testing.d.mts.map +1 -1
- package/dist/adaptors/testing.mjs +42 -55
- package/dist/adaptors/testing.mjs.map +1 -1
- package/dist/auth.cjs +39 -14
- package/dist/auth.cjs.map +1 -1
- package/dist/auth.d.cts +5 -9
- package/dist/auth.d.cts.map +1 -1
- package/dist/auth.d.mts +5 -9
- package/dist/auth.d.mts.map +1 -1
- package/dist/auth.mjs +30 -5
- package/dist/auth.mjs.map +1 -1
- package/dist/cache.cjs +68 -2
- package/dist/cache.cjs.map +1 -0
- package/dist/cache.d.cts +43 -3
- package/dist/cache.d.cts.map +1 -0
- package/dist/cache.d.mts +43 -3
- package/dist/cache.d.mts.map +1 -0
- 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-DPlxfpoS.d.mts} +3 -6
- package/dist/construct-interface-DPlxfpoS.d.mts.map +1 -0
- package/dist/{construct-interface-D9d4Gm4p.d.cts → construct-interface-DgXTJcOD.d.cts} +3 -6
- package/dist/construct-interface-DgXTJcOD.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 +1 -1
- package/dist/construct-interface.d.mts +1 -1
- 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 +4 -7
- package/dist/crons/index.cjs.map +1 -1
- package/dist/crons/index.d.cts +5 -11
- package/dist/crons/index.d.cts.map +1 -1
- package/dist/crons/index.d.mts +5 -11
- package/dist/crons/index.d.mts.map +1 -1
- package/dist/crons/index.mjs +3 -7
- 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 +5 -8
- package/dist/database/kysely.d.cts.map +1 -1
- package/dist/database/kysely.d.mts +6 -9
- package/dist/database/kysely.d.mts.map +1 -1
- 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 +6 -10
- package/dist/endpoints/index.d.cts +3 -7
- package/dist/endpoints/index.d.mts +3 -7
- 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 +3 -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-i_la-N5r.cjs → functions-B6qCvfmy.cjs} +298 -252
- package/dist/functions-B6qCvfmy.cjs.map +1 -0
- package/dist/{functions-14lpEFL4.mjs → functions-C53GW2eQ.mjs} +272 -229
- package/dist/functions-C53GW2eQ.mjs.map +1 -0
- package/dist/{index-BknhM6Ux.d.mts → index-B2urf3YI.d.cts} +4 -9
- package/dist/index-B2urf3YI.d.cts.map +1 -0
- package/dist/{index-Bd5FqCoe.d.cts → index-BPSZ_Lp_.d.cts} +9 -38
- package/dist/index-BPSZ_Lp_.d.cts.map +1 -0
- package/dist/{index-lAO9egTb.d.mts → index-BoZ-iisU.d.mts} +12 -41
- package/dist/index-BoZ-iisU.d.mts.map +1 -0
- package/dist/{index-_ajboYxK.d.mts → index-CdaU--_B.d.cts} +10 -16
- package/dist/index-CdaU--_B.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-CBSfrowv.d.cts → index-DMCDvnsM.d.mts} +4 -9
- package/dist/index-DMCDvnsM.d.mts.map +1 -0
- package/dist/{index-D24Xm79M.d.cts → index-PQRWOQj4.d.mts} +10 -16
- package/dist/index-PQRWOQj4.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/{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 +15 -17
- package/dist/rest-api.cjs.map +1 -1
- package/dist/rest-api.d.cts +15 -20
- package/dist/rest-api.d.cts.map +1 -1
- package/dist/rest-api.d.mts +9 -14
- package/dist/rest-api.d.mts.map +1 -1
- package/dist/rest-api.mjs +7 -9
- package/dist/rest-api.mjs.map +1 -1
- package/dist/{chunk-DWy1uDak.cjs → rolldown-runtime-y5ARvAq5.cjs} +14 -18
- package/dist/site.cjs +31 -7
- package/dist/site.cjs.map +1 -1
- package/dist/site.d.cts +3 -7
- package/dist/site.d.cts.map +1 -1
- package/dist/site.d.mts +3 -7
- package/dist/site.d.mts.map +1 -1
- package/dist/site.mjs +27 -3
- package/dist/site.mjs.map +1 -1
- package/dist/subscribers/index.cjs +3 -6
- package/dist/subscribers/index.d.cts +2 -5
- package/dist/subscribers/index.d.mts +2 -5
- package/dist/subscribers/index.mjs +2 -6
- 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 -4
- package/dist/topic/index.d.mts +3 -4
- 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 +13 -14
- package/dist/worker.cjs.map +1 -1
- package/dist/worker.d.cts +21 -27
- package/dist/worker.d.cts.map +1 -1
- package/dist/worker.d.mts +14 -19
- package/dist/worker.d.mts.map +1 -1
- package/dist/worker.mjs +8 -9
- package/dist/worker.mjs.map +1 -1
- package/package.json +30 -30
- 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-DmQ8vQ4b.d.cts.map +0 -1
- package/dist/Cron-dh4rUgib.d.mts.map +0 -1
- package/dist/CronBuilder-BquXDbDI.d.cts.map +0 -1
- package/dist/CronBuilder-CGgY2080.d.mts.map +0 -1
- package/dist/CronBuilder-CYKT5RiO.mjs.map +0 -1
- package/dist/CronBuilder-Da0C0edR.cjs.map +0 -1
- package/dist/Endpoint-BjWKinFA.d.mts.map +0 -1
- package/dist/Endpoint-DCQPMdUX.mjs.map +0 -1
- package/dist/Endpoint-DcWXE-SZ.cjs.map +0 -1
- package/dist/Endpoint-dav89W6-.d.cts.map +0 -1
- package/dist/EndpointFactory-CdWB7wPw.cjs.map +0 -1
- package/dist/EndpointFactory-CjV8F_lJ.mjs.map +0 -1
- package/dist/HonoEndpointAdaptor-P1ahhZHu.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/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 +0 -47
- package/dist/cache-BrRz3fEB.d.mts.map +0 -1
- package/dist/cache-BtZY_tHe.d.cts +0 -47
- 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/functions-14lpEFL4.mjs.map +0 -1
- package/dist/functions-i_la-N5r.cjs.map +0 -1
- package/dist/index-Bd5FqCoe.d.cts.map +0 -1
- package/dist/index-BknhM6Ux.d.mts.map +0 -1
- package/dist/index-CBSfrowv.d.cts.map +0 -1
- package/dist/index-D24Xm79M.d.cts.map +0 -1
- package/dist/index-_ajboYxK.d.mts.map +0 -1
- package/dist/index-lAO9egTb.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/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/types-BlAkSuGI.d.cts.map +0 -1
- package/dist/types-aKksMEWL.d.mts.map +0 -1
package/dist/topic/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../src/topic/Topic.ts","../../src/topic/TopicBuilder.ts","../../src/topic/index.ts"],"sourcesContent":["import {\n\ttype EventPublisher,\n\ttype EventPublisherConnectionString,\n\ttype PublishableMessage,\n\tPublisher,\n} from '@geekmidas/events';\nimport type { Logger } from '@geekmidas/logger';\nimport { DEFAULT_LOGGER } from '@geekmidas/logger/console';\nimport {\n\tcanonicalId,\n\ttype Declaration,\n\tprovideKey,\n\tserviceKey,\n} from '@geekmidas/manifest';\nimport type { InferStandardSchema } from '@geekmidas/schema';\nimport type { Service } from '@geekmidas/services';\nimport type { StandardSchemaV1 } from '@standard-schema/spec';\nimport { Construct, ConstructType } from '../Construct';\n\n/** A topic's event contract — a map of event type → payload schema. */\nexport type TopicEvents = Record<string, StandardSchemaV1>;\n\n/**\n * The union of wire messages a topic carries, derived from its event map:\n * `{ type: 'user.created'; payload: … } | { type: 'user.updated'; payload: … }`.\n */\nexport type TopicMessage<TEvents extends TopicEvents> = {\n\t[K in keyof TEvents & string]: PublishableMessage<\n\t\tK,\n\t\tInferStandardSchema<TEvents[K]>\n\t>;\n}[keyof TEvents & string];\n\n/**\n * A topic — pub/sub fan-out. Unlike a `Queue` (point-to-point, one consumer), a\n * topic is a *resource* owned by no single handler: it declares the event\n * contract, derives a typed producer (`topic.publisher`), and any number of\n * subscribers (`s.topic(topic)`) bind to it. `gkm build` discovers it into the\n * manifest's `topics` field; infra provisions an SNS topic.\n *\n * This replaces hand-writing a publisher `Service`: the publisher is *derived*\n * from the declared event contract, the same way `Queue` derives its publisher.\n */\nexport class Topic<\n\tTName extends string = string,\n\tTEvents extends TopicEvents = TopicEvents,\n> extends Construct {\n\t__IS_TOPIC__ = true;\n\n\tstatic isTopic(obj: unknown): obj is Topic<string, TopicEvents> {\n\t\treturn Boolean(\n\t\t\tobj &&\n\t\t\t\t(obj as { __IS_TOPIC__?: boolean }).__IS_TOPIC__ === true &&\n\t\t\t\t(obj as Construct).type === ConstructType.Topic,\n\t\t);\n\t}\n\n\t/**\n\t * The canonical id this topic is declared under.\n\t *\n\t * Derived from the name, so `users` and `Users` are one topic. The name is\n\t * left alone: subscribers bind to it and it is what the broker routes on.\n\t */\n\treadonly id: string;\n\n\t/**\n\t * The producer's env key, read by both {@link declare} and\n\t * {@link publisher} so the two cannot drift.\n\t */\n\tprivate readonly connectionKey: string;\n\n\tconstructor(\n\t\tpublic readonly name: TName,\n\t\t/**\n\t\t * The event contract — a map of event type → payload schema. Named\n\t\t * `eventSchemas` (not `events`) to avoid clashing with `Construct.events`,\n\t\t * which is the array of `MappedEvent`s a construct *publishes*.\n\t\t */\n\t\tpublic readonly eventSchemas: TEvents,\n\t\tlogger: Logger = DEFAULT_LOGGER,\n\t) {\n\t\tsuper(ConstructType.Topic, logger, [], []);\n\n\t\tthis.id = canonicalId(name);\n\t\tthis.connectionKey = provideKey(this.id, 'publisherConnectionString');\n\t}\n\n\t/**\n\t * What this topic is in the manifest.\n\t *\n\t * Only the producer's key: a subscriber is *bound* to a topic rather than\n\t * depending on it, so the binding is an edge the deploy target reads and not\n\t * an env key anyone can hold. Locally both sides meet on the same broker.\n\t */\n\tdeclare(): Declaration[] {\n\t\treturn [\n\t\t\t{\n\t\t\t\tkind: 'topic',\n\t\t\t\tid: this.id,\n\t\t\t\tprovides: [this.connectionKey],\n\t\t\t\t// The contract this topic carries. Structural: which events exist\n\t\t\t\t// is a fact about the application, and a subscriber binding to one\n\t\t\t\t// that does not is a mistake worth catching at build.\n\t\t\t\tevents: this.eventTypes,\n\t\t\t\t// Bound rather than declared here — a subscriber names the topic,\n\t\t\t\t// not the other way round — so the build fills these from what it\n\t\t\t\t// found. Nested when it does, because position is the trigger.\n\t\t\t\tsubscribers: [],\n\t\t\t},\n\t\t];\n\t}\n\n\t/** The event type names this topic carries. */\n\tget eventTypes(): (keyof TEvents & string)[] {\n\t\treturn Object.keys(this.eventSchemas) as (keyof TEvents & string)[];\n\t}\n\n\t/**\n\t * The producer side — a `Service` exposing an `EventPublisher` typed to the\n\t * union of this topic's events. Inject via `.publisher(topic.publisher)` (for\n\t * declarative `.event(...)`) or `.services([topic.publisher])` (to publish\n\t * imperatively). Reads `<NAME>_PUBLISHER_CONNECTION_STRING` and selects the\n\t * transport from the URL protocol — `pgboss://` locally, `sns://` deployed.\n\t *\n\t * Because it's a `Service`, the connection-string requirement is sniffed into\n\t * the manifest of whatever construct injects it (least-privilege linking).\n\t */\n\t/**\n\t * The topic as a dependency — what `.dependsOn([users])` dissolves into,\n\t * reachable as `services.users`.\n\t *\n\t * It is the producer, because publishing is the only thing depending on a\n\t * topic can mean: a subscriber *binds* with `s.topic(…)` instead, and is\n\t * deliberately never handed this. {@link publisher} is the same service\n\t * under its older `<name>Publisher` key.\n\t */\n\tget service(): Service<\n\t\tUncapitalize<TName>,\n\t\tEventPublisher<TopicMessage<TEvents>>\n\t> {\n\t\tconst { register } = this.publisher;\n\n\t\treturn {\n\t\t\tserviceName: serviceKey(this.id) as Uncapitalize<TName>,\n\t\t\tregister,\n\t\t};\n\t}\n\n\tget publisher(): Service<\n\t\t`${TName}Publisher`,\n\t\tEventPublisher<TopicMessage<TEvents>>\n\t> {\n\t\tconst envVar = this.connectionKey;\n\t\treturn {\n\t\t\tserviceName: `${this.name}Publisher`,\n\t\t\tasync register({ envParser }) {\n\t\t\t\tconst { connectionString } = envParser\n\t\t\t\t\t.create((get) => ({\n\t\t\t\t\t\tconnectionString: get(envVar).string(),\n\t\t\t\t\t}))\n\t\t\t\t\t.parse();\n\n\t\t\t\treturn Publisher.fromConnectionString<TopicMessage<TEvents>>(\n\t\t\t\t\tconnectionString as EventPublisherConnectionString,\n\t\t\t\t);\n\t\t\t},\n\t\t};\n\t}\n}\n","import type { Logger } from '@geekmidas/logger';\nimport { DEFAULT_LOGGER } from '@geekmidas/logger/console';\nimport { cloneWith } from '../clone';\nimport { Topic, type TopicEvents } from './Topic';\n\n/**\n * Builds a {@link Topic} — `t.topic('users').events({ 'user.created': schema, … })`.\n * The event map is the topic's contract: it types the derived `topic.publisher`\n * and the subscribers that bind via `s.topic(topic)`.\n */\nexport class TopicBuilder<\n\tTName extends string = string,\n\tTEvents extends TopicEvents = TopicEvents,\n> {\n\tprivate _name?: string;\n\tprivate _logger: Logger = DEFAULT_LOGGER;\n\n\t/** The topic name — drives the infra topic and its `<NAME>_*` env vars. */\n\ttopic<T extends string>(name: T): TopicBuilder<T, TEvents> {\n\t\treturn cloneWith(this, { _name: name }) as unknown as TopicBuilder<\n\t\t\tT,\n\t\t\tTEvents\n\t\t>;\n\t}\n\n\tlogger(logger: Logger): this {\n\t\treturn cloneWith(this, { _logger: logger });\n\t}\n\n\t/**\n\t * The event contract — a map of event type → payload schema. Building the\n\t * topic requires this; it's what types the publisher and subscribers.\n\t */\n\tevents<T extends TopicEvents>(events: T): Topic<TName, T> {\n\t\tif (!this._name) {\n\t\t\tthrow new Error(\n\t\t\t\t'Topic requires a name — call .topic(name) before .events().',\n\t\t\t);\n\t\t}\n\n\t\tconst topic = new Topic<TName, T>(\n\t\t\tthis._name as TName,\n\t\t\tevents,\n\t\t\tthis._logger,\n\t\t);\n\n\t\t// No reset. `.events()` reads this builder and leaves it alone, so a\n\t\t// configured base stays usable for the next topic — and two chains off one\n\t\t// base cannot feed each other.\n\t\treturn topic;\n\t}\n}\n","export {\n\tTopic,\n\ttype TopicEvents,\n\ttype TopicMessage,\n} from './Topic';\n\nimport { TopicBuilder } from './TopicBuilder';\n\nexport { TopicBuilder } from './TopicBuilder';\n\nexport const t = new TopicBuilder();\n"],"mappings":";;;;;;;;;;;;;;;;AA2CA,IAAa,QAAb,cAGU,UAAU;CA0BF;CAMA;CA/BjB,eAAe;CAEf,OAAO,QAAQ,KAAiD;EAC/D,OAAO,QACN,OACE,IAAmC,iBAAiB,QACpD,IAAkB,SAAA,8BACrB;CACD;;;;;;;CAQA;;;;;CAMA;CAEA,YACC,MAMA,cACA,SAAiB,gBAChB;EACD,MAAA,gCAA2B,QAAQ,CAAC,GAAG,CAAC,CAAC;EATzB,KAAA,OAAA;EAMA,KAAA,eAAA;EAKhB,KAAK,KAAK,YAAY,IAAI;EAC1B,KAAK,gBAAgB,WAAW,KAAK,IAAI,2BAA2B;CACrE;;;;;;;;CASA,UAAyB;EACxB,OAAO,CACN;GACC,MAAM;GACN,IAAI,KAAK;GACT,UAAU,CAAC,KAAK,aAAa;GAI7B,QAAQ,KAAK;GAIb,aAAa,CAAC;EACf,CACD;CACD;;CAGA,IAAI,aAAyC;EAC5C,OAAO,OAAO,KAAK,KAAK,YAAY;CACrC;;;;;;;;;;;;;;;;;;;;CAqBA,IAAI,UAGF;EACD,MAAM,EAAE,aAAa,KAAK;EAE1B,OAAO;GACN,aAAa,WAAW,KAAK,EAAE;GAC/B;EACD;CACD;CAEA,IAAI,YAGF;EACD,MAAM,SAAS,KAAK;EACpB,OAAO;GACN,aAAa,GAAG,KAAK,KAAK;GAC1B,MAAM,SAAS,EAAE,aAAa;IAC7B,MAAM,EAAE,qBAAqB,UAC3B,QAAQ,SAAS,EACjB,kBAAkB,IAAI,MAAM,CAAC,CAAC,OAAO,EACtC,EAAE,CAAC,CACF,MAAM;IAER,OAAO,UAAU,qBAChB,gBACD;GACD;EACD;CACD;AACD;;;;;;;;AC9JA,IAAa,eAAb,MAGE;CACD;CACA,UAA0B;;CAG1B,MAAwB,MAAmC;EAC1D,OAAO,UAAU,MAAM,EAAE,OAAO,KAAK,CAAC;CAIvC;CAEA,OAAO,QAAsB;EAC5B,OAAO,UAAU,MAAM,EAAE,SAAS,OAAO,CAAC;CAC3C;;;;;CAMA,OAA8B,QAA4B;EACzD,IAAI,CAAC,KAAK,OACT,MAAM,IAAI,MACT,6DACD;EAYD,OAAO,IATW,MACjB,KAAK,OACL,QACA,KAAK,OAMK;CACZ;AACD;;;ACzCA,MAAa,IAAI,IAAI,aAAa"}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
//#region src/types.d.ts
|
|
2
|
-
type RemoveUndefined<T> = { [K in keyof T as T[K] extends undefined ? never : K]: T[K] };
|
|
2
|
+
type RemoveUndefined<T> = { [K in keyof T as T[K] extends undefined ? never : K]: T[K]; };
|
|
3
3
|
type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'OPTIONS';
|
|
4
4
|
type LowerHttpMethod<T extends HttpMethod> = Lowercase<T>;
|
|
5
|
-
//# sourceMappingURL=types.d.ts.map
|
|
6
|
-
|
|
7
5
|
//#endregion
|
|
8
|
-
export {
|
|
9
|
-
//# sourceMappingURL=types-
|
|
6
|
+
export { LowerHttpMethod as n, RemoveUndefined as r, HttpMethod as t };
|
|
7
|
+
//# sourceMappingURL=types-DMuSQeLL.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types-DMuSQeLL.d.cts","names":[],"sources":["../src/types.ts"],"mappings":";KAAY,gBAAgB,QAC1B,WAAW,KAAK,EAAE,+BAA+B,IAAI,EAAE;KAG7C;KAQA,gBAAgB,UAAU,cAAc,UAAU"}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
//#region src/types.d.ts
|
|
2
|
-
type RemoveUndefined<T> = { [K in keyof T as T[K] extends undefined ? never : K]: T[K] };
|
|
2
|
+
type RemoveUndefined<T> = { [K in keyof T as T[K] extends undefined ? never : K]: T[K]; };
|
|
3
3
|
type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'OPTIONS';
|
|
4
4
|
type LowerHttpMethod<T extends HttpMethod> = Lowercase<T>;
|
|
5
|
-
//# sourceMappingURL=types.d.ts.map
|
|
6
|
-
|
|
7
5
|
//#endregion
|
|
8
|
-
export {
|
|
9
|
-
//# sourceMappingURL=types-
|
|
6
|
+
export { LowerHttpMethod as n, RemoveUndefined as r, HttpMethod as t };
|
|
7
|
+
//# sourceMappingURL=types-DMuSQeLL.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types-DMuSQeLL.d.mts","names":[],"sources":["../src/types.ts"],"mappings":";KAAY,gBAAgB,QAC1B,WAAW,KAAK,EAAE,+BAA+B,IAAI,EAAE;KAG7C;KAQA,gBAAgB,UAAU,cAAc,UAAU"}
|
package/dist/types.d.cts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { n as LowerHttpMethod, r as RemoveUndefined, t as HttpMethod } from "./types-DMuSQeLL.cjs";
|
|
2
2
|
export { HttpMethod, LowerHttpMethod, RemoveUndefined };
|
package/dist/types.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { n as LowerHttpMethod, r as RemoveUndefined, t as HttpMethod } from "./types-DMuSQeLL.mjs";
|
|
2
2
|
export { HttpMethod, LowerHttpMethod, RemoveUndefined };
|
package/dist/types.mjs
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/worker.cjs
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
const require_construct_interface = require(
|
|
3
|
-
require(
|
|
4
|
-
const
|
|
5
|
-
require(
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const __geekmidas_manifest = require_chunk.__toESM(require("@geekmidas/manifest"));
|
|
10
|
-
const __geekmidas_logger_console = require_chunk.__toESM(require("@geekmidas/logger/console"));
|
|
11
|
-
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_construct_interface = require("./construct-interface.cjs");
|
|
3
|
+
const require_functions = require("./functions-B6qCvfmy.cjs");
|
|
4
|
+
const require_surfaceEnv = require("./surfaceEnv-CNimK76p.cjs");
|
|
5
|
+
const require_CronBuilder = require("./CronBuilder-BdnI6lxF.cjs");
|
|
6
|
+
const require_SubscriberBuilder = require("./SubscriberBuilder-C0ZEtGDI.cjs");
|
|
7
|
+
let _geekmidas_manifest = require("@geekmidas/manifest");
|
|
8
|
+
let _geekmidas_logger_console = require("@geekmidas/logger/console");
|
|
12
9
|
//#region src/worker.ts
|
|
13
10
|
var Worker = class Worker {
|
|
11
|
+
config;
|
|
12
|
+
dependencies;
|
|
14
13
|
id;
|
|
15
14
|
/** Always defined — the worker's own, or the console logger. */
|
|
16
15
|
logger;
|
|
@@ -24,9 +23,9 @@ var Worker = class Worker {
|
|
|
24
23
|
constructor(id, config = {}, dependencies = [], scheduleStore) {
|
|
25
24
|
this.config = config;
|
|
26
25
|
this.dependencies = dependencies;
|
|
27
|
-
const canonical = (0,
|
|
26
|
+
const canonical = (0, _geekmidas_manifest.canonicalId)(id);
|
|
28
27
|
this.id = canonical;
|
|
29
|
-
this.logger = config.logger ??
|
|
28
|
+
this.logger = config.logger ?? _geekmidas_logger_console.DEFAULT_LOGGER;
|
|
30
29
|
this.envParser = require_surfaceEnv.envParserFor(config.envParser ? {
|
|
31
30
|
id: canonical,
|
|
32
31
|
envParser: config.envParser
|
|
@@ -160,7 +159,7 @@ var Worker = class Worker {
|
|
|
160
159
|
}];
|
|
161
160
|
}
|
|
162
161
|
};
|
|
163
|
-
|
|
164
162
|
//#endregion
|
|
165
163
|
exports.Worker = Worker;
|
|
164
|
+
|
|
166
165
|
//# sourceMappingURL=worker.cjs.map
|
package/dist/worker.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"worker.cjs","names":["id: ConstructName<TName>","config: WorkerConfig","dependencies: readonly Dependency[]","scheduleStore?: Consumable<string, unknown>","DEFAULT_LOGGER","source: Consumable<TDbName, T>","schedule: ScheduleExpression","CronBuilder","topic: Topic<TTopicName, TEvents>","SubscriberBuilder","service: Service<TPubName, T> | Consumable<TPubName, T>","schema: T","ms: number","mb: number","constructs: T","services: T","FunctionBuilder","constructs: readonly Declarable[]","edgeTo","builder: T"],"sources":["../src/worker.ts"],"sourcesContent":["/**\n * A process with no port.\n *\n * `RestApi` is the process that answers HTTP. This is the one that does not —\n * the thing that runs a schedule, drains a queue, consumes a topic. Until it\n * existed, those had nowhere to say they belonged: a cron declared a schedule\n * and nothing else, and which container ran it was decided by the directory the\n * file sat in. A glob owned it.\n *\n * The cost of that shows up in the scaffolds. `gkm init --template worker` —\n * a project that is background jobs and nothing else — declared\n * `new RestApi('Api', { defaultAuthorizer: 'none', logger })`: an HTTP surface\n * with no HTTP on it, written because it was the only construct that made an\n * app exist and the only way to get a logger into the generated runtime.\n *\n * It takes no authorizer, and that is the tell that these are two constructs\n * rather than one with a flag: a `RestApi` needs one because an HTTP surface\n * can ship open by omission, and nothing reaches a worker from outside.\n *\n * ## Crons on a server target need a database\n *\n * A cron becomes an EventBridge rule on AWS and nothing here is consulted. A\n * server has nothing firing its crons but itself, and a process that schedules\n * in memory fires every job once per replica while reporting success — so the\n * schedule is kept in Postgres, and the worker says which one with\n * `.database(db)`.\n *\n * A worker with crons and no `.database(…)` schedules nothing on a server\n * target and says so at startup. That is a limitation of workers today rather\n * than a design: the store could be a cache, or something the target\n * provisions, and Postgres is what exists.\n *\n * It is not an app. A worker names the process that runs its crons and\n * subscribers, and that process is the app's server — the same one the\n * endpoints run in, minus the HTTP surface. Giving a worker a container of its\n * own made a second thing to build, deploy and keep alive for work that was\n * always going to run somewhere already. Declare as many as the shape of the\n * work wants: they are groupings, not deployments.\n *\n * @example\n * ```ts\n * // constructs/worker.ts\n * import { Worker } from '@geekmidas/constructs/worker';\n * import { logger } from './logger.js';\n *\n * export const worker = new Worker('Worker', { logger }).calls([database]);\n *\n * // crons/cleanup.ts\n * import { worker } from '@acme/constructs/worker.js';\n *\n * export const cleanup = worker\n * .cron('rate(1 day)')\n * .handle(async ({ logger }) => { … });\n * ```\n */\n\nimport type { EnvironmentParser } from '@geekmidas/envkit';\nimport type { EventPublisher } from '@geekmidas/events';\nimport type { Logger } from '@geekmidas/logger';\nimport { DEFAULT_LOGGER } from '@geekmidas/logger/console';\nimport {\n\ttype ConstructName,\n\tcanonicalId,\n\ttype Declaration,\n\ttype Dependency,\n} from '@geekmidas/manifest';\nimport type { ComposableStandardSchema } from '@geekmidas/schema';\nimport type { Service } from '@geekmidas/services';\nimport type { StandardSchemaV1 } from '@standard-schema/spec';\nimport {\n\ttype Consumable,\n\ttype Declarable,\n\tedgeTo,\n} from './construct-interface';\nimport type { ScheduleExpression } from './crons/Cron';\nimport { CronBuilder } from './crons/CronBuilder';\nimport { envParserFor } from './endpoints/surfaceEnv';\nimport { FunctionBuilder } from './functions/FunctionBuilder';\nimport { SubscriberBuilder } from './subscribers/SubscriberBuilder';\nimport type { Topic, TopicEvents } from './topic/Topic';\n\nexport interface WorkerConfig {\n\t/**\n\t * The logger everything built from this worker runs with.\n\t *\n\t * The actual logger, not a path to one — the same reason `RestApi` takes\n\t * one. Every cron and subscriber in a scaffolded project used to open with\n\t * `import { logger } from '…/constructs/logger.js'`, which is the line this\n\t * removes.\n\t */\n\tlogger?: Logger;\n\t/**\n\t * The environment parser everything built from this worker runs with.\n\t *\n\t * Defaults to `process.env` merged with the credentials `gkm dev` injected,\n\t * which is what an application's own `config/env.ts` always was.\n\t */\n\tenvParser?: EnvironmentParser<{}>;\n}\n\nexport class Worker<TName extends string = string>\n\timplements Declarable<TName>\n{\n\treadonly id: TName;\n\n\t/** Always defined — the worker's own, or the console logger. */\n\treadonly logger: Logger;\n\n\t/** Always defined, and normally the default. */\n\treadonly envParser: EnvironmentParser<{}>;\n\n\t/**\n\t * Where this worker's schedules live, when it has crons and a server runs\n\t * them. `undefined` until `.database(…)` says.\n\t */\n\treadonly scheduleStore?: Consumable<string, unknown>;\n\n\tconstructor(\n\t\tid: ConstructName<TName>,\n\t\tprivate readonly config: WorkerConfig = {},\n\t\t/** Internal: how `.calls()` carries edges into the copy it returns. */\n\t\tprivate readonly dependencies: readonly Dependency[] = [],\n\t\tscheduleStore?: Consumable<string, unknown>,\n\t) {\n\t\tconst canonical = canonicalId(id as string);\n\n\t\tthis.id = canonical as TName;\n\t\tthis.logger = config.logger ?? DEFAULT_LOGGER;\n\t\tthis.envParser = envParserFor(\n\t\t\tconfig.envParser\n\t\t\t\t? { id: canonical, envParser: config.envParser }\n\t\t\t\t: undefined,\n\t\t);\n\t\tthis.scheduleStore = scheduleStore;\n\t}\n\n\t/**\n\t * The database this worker keeps its schedules in.\n\t *\n\t * Only a server target uses it. On AWS a cron is an EventBridge rule\n\t * invoking a Lambda and nothing here is consulted — but a server has nothing\n\t * firing its crons except itself, and a process that schedules in memory\n\t * fires every job once per replica while reporting that all is well.\n\t *\n\t * So the store is declared rather than discovered. It could have been\n\t * inferred — from a database the app happens to declare, or from the events\n\t * backend when that backend is pg-boss — and both would work until an app\n\t * had two databases, or moved its events to SNS, at which point the\n\t * schedules would quietly move or stop. Naming it is one line and cannot\n\t * drift.\n\t *\n\t * @example\n\t * ```ts\n\t * export const jobs = new Worker('Jobs', { logger }).database(database);\n\t * ```\n\t */\n\tdatabase<T, TDbName extends string>(\n\t\tsource: Consumable<TDbName, T>,\n\t): Worker<TName> {\n\t\treturn new Worker<TName>(\n\t\t\tthis.id as ConstructName<TName>,\n\t\t\tthis.config,\n\t\t\t[...this.dependencies, edgeTo(source)],\n\t\t\tsource as unknown as Consumable<string, unknown>,\n\t\t);\n\t}\n\n\t/**\n\t * A scheduled runnable.\n\t *\n\t * @example `worker.cron('rate(1 day)').handle(async ({ logger }) => { … })`\n\t */\n\tcron(schedule: ScheduleExpression) {\n\t\treturn this.own(new CronBuilder().logger(this.logger)).schedule(schedule);\n\t}\n\n\t/**\n\t * A runnable that consumes a topic.\n\t *\n\t * Binding is not publishing: a consumer is handed the topic's event types\n\t * and no connection string it could publish with. Chain `.publishes(…)` when\n\t * the handler emits follow-up events, which is the only reason it would need\n\t * one.\n\t *\n\t * @example `worker.topic(users).subscribe(['user.created']).handle(…)`\n\t */\n\ttopic<TTopicName extends string, TEvents extends TopicEvents>(\n\t\ttopic: Topic<TTopicName, TEvents>,\n\t) {\n\t\treturn this.own(new SubscriberBuilder().logger(this.logger)).topic(topic);\n\t}\n\n\t/**\n\t * A runnable that consumes events typed from a publisher service.\n\t *\n\t * The older of the two ways to bind a subscriber, kept for a project whose\n\t * events come from a hand-written publisher rather than a `Topic`\n\t * construct. `topic()` is the one to reach for: it types the events the same\n\t * way and hands the consumer no connection string it could publish with.\n\t */\n\tpublisher<T extends EventPublisher<any>, TPubName extends string>(\n\t\tservice: Service<TPubName, T> | Consumable<TPubName, T>,\n\t) {\n\t\treturn this.own(new SubscriberBuilder().logger(this.logger)).publisher(\n\t\t\tservice as never,\n\t\t);\n\t}\n\n\t/**\n\t * Everything below builds a function — the runnable with no schedule and no\n\t * topic, invoked by something else.\n\t *\n\t * These sit on the worker rather than behind a `functions` namespace because\n\t * the namespace was a hop that said nothing: `worker.functions.input(…)`\n\t * names a collection to reach one member of it. What kind of runnable is\n\t * being built is decided by which of these is called first — a schedule\n\t * makes a cron, a topic makes a subscriber, and anything else makes a\n\t * function.\n\t */\n\tinput<T extends ComposableStandardSchema>(schema: T) {\n\t\treturn this.functions.input(schema);\n\t}\n\n\toutput<T extends StandardSchemaV1>(schema: T) {\n\t\treturn this.functions.output(schema);\n\t}\n\n\ttimeout(ms: number) {\n\t\treturn this.functions.timeout(ms);\n\t}\n\n\tmemorySize(mb: number) {\n\t\treturn this.functions.memorySize(mb);\n\t}\n\n\tdependsOn<const T extends readonly Consumable[]>(constructs: T) {\n\t\treturn this.functions.dependsOn(constructs);\n\t}\n\n\tservices<T extends Service[]>(services: T) {\n\t\treturn this.functions.services(services);\n\t}\n\n\t/**\n\t * A function with no input schema — the shortest runnable there is.\n\t *\n\t * @example `worker.handle(async ({ logger }) => { … })`\n\t */\n\thandle(\n\t\t...args: Parameters<\n\t\t\tReturnType<Worker<TName>['schemalessFunction']>['handle']\n\t\t>\n\t) {\n\t\treturn this.schemalessFunction().handle(...args);\n\t}\n\n\t/** The builder `handle` delegates to, named so its type can be referred to. */\n\tprivate schemalessFunction() {\n\t\treturn this.functions;\n\t}\n\n\t/** The function builder the delegating methods above are built on. */\n\tprivate get functions() {\n\t\treturn this.own(new FunctionBuilder().logger(this.logger));\n\t}\n\n\t/**\n\t * Resources and surfaces this worker calls.\n\t *\n\t * Not `.dependsOn()`: this records the edge that derives the worker's\n\t * environment and its access, the same distinction `RestApi.calls()` draws.\n\t */\n\tcalls(constructs: readonly Declarable[]): Worker<TName> {\n\t\treturn new Worker<TName>(\n\t\t\tthis.id as ConstructName<TName>,\n\t\t\tthis.config,\n\t\t\t[...this.dependencies, ...constructs.map(edgeTo)],\n\t\t\tthis.scheduleStore,\n\t\t);\n\t}\n\n\t/**\n\t * Stamps this worker's id onto a builder, so everything built from it says\n\t * which process runs it.\n\t */\n\tprivate own<T extends { _owner?: string; _scheduleStore?: unknown }>(\n\t\tbuilder: T,\n\t): T {\n\t\tbuilder._owner = this.id;\n\t\tbuilder._scheduleStore = this.scheduleStore;\n\n\t\treturn builder;\n\t}\n\n\tdeclare(): Declaration[] {\n\t\treturn [\n\t\t\t{\n\t\t\t\tkind: 'worker',\n\t\t\t\tid: this.id,\n\t\t\t\t...(this.dependencies.length\n\t\t\t\t\t? { dependencies: this.dependencies }\n\t\t\t\t\t: {}),\n\t\t\t\t// Nothing calls a worker, so it publishes no address.\n\t\t\t\tprovides: [],\n\t\t\t},\n\t\t];\n\t}\n}\n"],"mappings":";;;;;;;;;;;;AAoGA,IAAa,SAAb,MAAa,OAEb;CACC,AAAS;;CAGT,AAAS;;CAGT,AAAS;;;;;CAMT,AAAS;CAET,YACCA,IACiBC,SAAuB,CAAE,GAEzBC,eAAsC,CAAE,GACzDC,eACC;EAJgB;EAEA;EAGjB,MAAM,YAAY,sCAAY,GAAa;AAE3C,OAAK,KAAK;AACV,OAAK,SAAS,OAAO,UAAUC;AAC/B,OAAK,YAAY,gCAChB,OAAO,YACJ;GAAE,IAAI;GAAW,WAAW,OAAO;EAAW,WAEjD;AACD,OAAK,gBAAgB;CACrB;;;;;;;;;;;;;;;;;;;;;CAsBD,SACCC,QACgB;AAChB,SAAO,IAAI,OACV,KAAK,IACL,KAAK,QACL,CAAC,GAAG,KAAK,cAAc,mCAAO,OAAO,AAAC,GACtC;CAED;;;;;;CAOD,KAAKC,UAA8B;AAClC,SAAO,KAAK,IAAI,IAAIC,kCAAc,OAAO,KAAK,OAAO,CAAC,CAAC,SAAS,SAAS;CACzE;;;;;;;;;;;CAYD,MACCC,OACC;AACD,SAAO,KAAK,IAAI,IAAIC,8CAAoB,OAAO,KAAK,OAAO,CAAC,CAAC,MAAM,MAAM;CACzE;;;;;;;;;CAUD,UACCC,SACC;AACD,SAAO,KAAK,IAAI,IAAID,8CAAoB,OAAO,KAAK,OAAO,CAAC,CAAC,UAC5D,QACA;CACD;;;;;;;;;;;;CAaD,MAA0CE,QAAW;AACpD,SAAO,KAAK,UAAU,MAAM,OAAO;CACnC;CAED,OAAmCA,QAAW;AAC7C,SAAO,KAAK,UAAU,OAAO,OAAO;CACpC;CAED,QAAQC,IAAY;AACnB,SAAO,KAAK,UAAU,QAAQ,GAAG;CACjC;CAED,WAAWC,IAAY;AACtB,SAAO,KAAK,UAAU,WAAW,GAAG;CACpC;CAED,UAAiDC,YAAe;AAC/D,SAAO,KAAK,UAAU,UAAU,WAAW;CAC3C;CAED,SAA8BC,UAAa;AAC1C,SAAO,KAAK,UAAU,SAAS,SAAS;CACxC;;;;;;CAOD,OACC,GAAG,MAGF;AACD,SAAO,KAAK,oBAAoB,CAAC,OAAO,GAAG,KAAK;CAChD;;CAGD,AAAQ,qBAAqB;AAC5B,SAAO,KAAK;CACZ;;CAGD,IAAY,YAAY;AACvB,SAAO,KAAK,IAAI,IAAIC,oCAAkB,OAAO,KAAK,OAAO,CAAC;CAC1D;;;;;;;CAQD,MAAMC,YAAkD;AACvD,SAAO,IAAI,OACV,KAAK,IACL,KAAK,QACL,CAAC,GAAG,KAAK,cAAc,GAAG,WAAW,IAAIC,mCAAO,AAAC,GACjD,KAAK;CAEN;;;;;CAMD,AAAQ,IACPC,SACI;AACJ,UAAQ,SAAS,KAAK;AACtB,UAAQ,iBAAiB,KAAK;AAE9B,SAAO;CACP;CAED,UAAyB;AACxB,SAAO,CACN;GACC,MAAM;GACN,IAAI,KAAK;GACT,GAAI,KAAK,aAAa,SACnB,EAAE,cAAc,KAAK,aAAc,IACnC,CAAE;GAEL,UAAU,CAAE;EACZ,CACD;CACD;AACD"}
|
|
1
|
+
{"version":3,"file":"worker.cjs","names":["canonicalId","DEFAULT_LOGGER","envParserFor","edgeTo","CronBuilder","SubscriberBuilder","FunctionBuilder"],"sources":["../src/worker.ts"],"sourcesContent":["/**\n * A process with no port.\n *\n * `RestApi` is the process that answers HTTP. This is the one that does not —\n * the thing that runs a schedule, drains a queue, consumes a topic. Until it\n * existed, those had nowhere to say they belonged: a cron declared a schedule\n * and nothing else, and which container ran it was decided by the directory the\n * file sat in. A glob owned it.\n *\n * The cost of that shows up in the scaffolds. `gkm init --template worker` —\n * a project that is background jobs and nothing else — declared\n * `new RestApi('Api', { defaultAuthorizer: 'none', logger })`: an HTTP surface\n * with no HTTP on it, written because it was the only construct that made an\n * app exist and the only way to get a logger into the generated runtime.\n *\n * It takes no authorizer, and that is the tell that these are two constructs\n * rather than one with a flag: a `RestApi` needs one because an HTTP surface\n * can ship open by omission, and nothing reaches a worker from outside.\n *\n * ## Crons on a server target need a database\n *\n * A cron becomes an EventBridge rule on AWS and nothing here is consulted. A\n * server has nothing firing its crons but itself, and a process that schedules\n * in memory fires every job once per replica while reporting success — so the\n * schedule is kept in Postgres, and the worker says which one with\n * `.database(db)`.\n *\n * A worker with crons and no `.database(…)` schedules nothing on a server\n * target and says so at startup. That is a limitation of workers today rather\n * than a design: the store could be a cache, or something the target\n * provisions, and Postgres is what exists.\n *\n * It is not an app. A worker names the process that runs its crons and\n * subscribers, and that process is the app's server — the same one the\n * endpoints run in, minus the HTTP surface. Giving a worker a container of its\n * own made a second thing to build, deploy and keep alive for work that was\n * always going to run somewhere already. Declare as many as the shape of the\n * work wants: they are groupings, not deployments.\n *\n * @example\n * ```ts\n * // constructs/worker.ts\n * import { Worker } from '@geekmidas/constructs/worker';\n * import { logger } from './logger.js';\n *\n * export const worker = new Worker('Worker', { logger }).calls([database]);\n *\n * // crons/cleanup.ts\n * import { worker } from '@acme/constructs/worker.js';\n *\n * export const cleanup = worker\n * .cron('rate(1 day)')\n * .handle(async ({ logger }) => { … });\n * ```\n */\n\nimport type { EnvironmentParser } from '@geekmidas/envkit';\nimport type { EventPublisher } from '@geekmidas/events';\nimport type { Logger } from '@geekmidas/logger';\nimport { DEFAULT_LOGGER } from '@geekmidas/logger/console';\nimport {\n\ttype ConstructName,\n\tcanonicalId,\n\ttype Declaration,\n\ttype Dependency,\n} from '@geekmidas/manifest';\nimport type { ComposableStandardSchema } from '@geekmidas/schema';\nimport type { Service } from '@geekmidas/services';\nimport type { StandardSchemaV1 } from '@standard-schema/spec';\nimport {\n\ttype Consumable,\n\ttype Declarable,\n\tedgeTo,\n} from './construct-interface';\nimport type { ScheduleExpression } from './crons/Cron';\nimport { CronBuilder } from './crons/CronBuilder';\nimport { envParserFor } from './endpoints/surfaceEnv';\nimport { FunctionBuilder } from './functions/FunctionBuilder';\nimport { SubscriberBuilder } from './subscribers/SubscriberBuilder';\nimport type { Topic, TopicEvents } from './topic/Topic';\n\nexport interface WorkerConfig {\n\t/**\n\t * The logger everything built from this worker runs with.\n\t *\n\t * The actual logger, not a path to one — the same reason `RestApi` takes\n\t * one. Every cron and subscriber in a scaffolded project used to open with\n\t * `import { logger } from '…/constructs/logger.js'`, which is the line this\n\t * removes.\n\t */\n\tlogger?: Logger;\n\t/**\n\t * The environment parser everything built from this worker runs with.\n\t *\n\t * Defaults to `process.env` merged with the credentials `gkm dev` injected,\n\t * which is what an application's own `config/env.ts` always was.\n\t */\n\tenvParser?: EnvironmentParser<{}>;\n}\n\nexport class Worker<TName extends string = string>\n\timplements Declarable<TName>\n{\n\treadonly id: TName;\n\n\t/** Always defined — the worker's own, or the console logger. */\n\treadonly logger: Logger;\n\n\t/** Always defined, and normally the default. */\n\treadonly envParser: EnvironmentParser<{}>;\n\n\t/**\n\t * Where this worker's schedules live, when it has crons and a server runs\n\t * them. `undefined` until `.database(…)` says.\n\t */\n\treadonly scheduleStore?: Consumable<string, unknown>;\n\n\tconstructor(\n\t\tid: ConstructName<TName>,\n\t\tprivate readonly config: WorkerConfig = {},\n\t\t/** Internal: how `.calls()` carries edges into the copy it returns. */\n\t\tprivate readonly dependencies: readonly Dependency[] = [],\n\t\tscheduleStore?: Consumable<string, unknown>,\n\t) {\n\t\tconst canonical = canonicalId(id as string);\n\n\t\tthis.id = canonical as TName;\n\t\tthis.logger = config.logger ?? DEFAULT_LOGGER;\n\t\tthis.envParser = envParserFor(\n\t\t\tconfig.envParser\n\t\t\t\t? { id: canonical, envParser: config.envParser }\n\t\t\t\t: undefined,\n\t\t);\n\t\tthis.scheduleStore = scheduleStore;\n\t}\n\n\t/**\n\t * The database this worker keeps its schedules in.\n\t *\n\t * Only a server target uses it. On AWS a cron is an EventBridge rule\n\t * invoking a Lambda and nothing here is consulted — but a server has nothing\n\t * firing its crons except itself, and a process that schedules in memory\n\t * fires every job once per replica while reporting that all is well.\n\t *\n\t * So the store is declared rather than discovered. It could have been\n\t * inferred — from a database the app happens to declare, or from the events\n\t * backend when that backend is pg-boss — and both would work until an app\n\t * had two databases, or moved its events to SNS, at which point the\n\t * schedules would quietly move or stop. Naming it is one line and cannot\n\t * drift.\n\t *\n\t * @example\n\t * ```ts\n\t * export const jobs = new Worker('Jobs', { logger }).database(database);\n\t * ```\n\t */\n\tdatabase<T, TDbName extends string>(\n\t\tsource: Consumable<TDbName, T>,\n\t): Worker<TName> {\n\t\treturn new Worker<TName>(\n\t\t\tthis.id as ConstructName<TName>,\n\t\t\tthis.config,\n\t\t\t[...this.dependencies, edgeTo(source)],\n\t\t\tsource as unknown as Consumable<string, unknown>,\n\t\t);\n\t}\n\n\t/**\n\t * A scheduled runnable.\n\t *\n\t * @example `worker.cron('rate(1 day)').handle(async ({ logger }) => { … })`\n\t */\n\tcron(schedule: ScheduleExpression) {\n\t\treturn this.own(new CronBuilder().logger(this.logger)).schedule(schedule);\n\t}\n\n\t/**\n\t * A runnable that consumes a topic.\n\t *\n\t * Binding is not publishing: a consumer is handed the topic's event types\n\t * and no connection string it could publish with. Chain `.publishes(…)` when\n\t * the handler emits follow-up events, which is the only reason it would need\n\t * one.\n\t *\n\t * @example `worker.topic(users).subscribe(['user.created']).handle(…)`\n\t */\n\ttopic<TTopicName extends string, TEvents extends TopicEvents>(\n\t\ttopic: Topic<TTopicName, TEvents>,\n\t) {\n\t\treturn this.own(new SubscriberBuilder().logger(this.logger)).topic(topic);\n\t}\n\n\t/**\n\t * A runnable that consumes events typed from a publisher service.\n\t *\n\t * The older of the two ways to bind a subscriber, kept for a project whose\n\t * events come from a hand-written publisher rather than a `Topic`\n\t * construct. `topic()` is the one to reach for: it types the events the same\n\t * way and hands the consumer no connection string it could publish with.\n\t */\n\tpublisher<T extends EventPublisher<any>, TPubName extends string>(\n\t\tservice: Service<TPubName, T> | Consumable<TPubName, T>,\n\t) {\n\t\treturn this.own(new SubscriberBuilder().logger(this.logger)).publisher(\n\t\t\tservice as never,\n\t\t);\n\t}\n\n\t/**\n\t * Everything below builds a function — the runnable with no schedule and no\n\t * topic, invoked by something else.\n\t *\n\t * These sit on the worker rather than behind a `functions` namespace because\n\t * the namespace was a hop that said nothing: `worker.functions.input(…)`\n\t * names a collection to reach one member of it. What kind of runnable is\n\t * being built is decided by which of these is called first — a schedule\n\t * makes a cron, a topic makes a subscriber, and anything else makes a\n\t * function.\n\t */\n\tinput<T extends ComposableStandardSchema>(schema: T) {\n\t\treturn this.functions.input(schema);\n\t}\n\n\toutput<T extends StandardSchemaV1>(schema: T) {\n\t\treturn this.functions.output(schema);\n\t}\n\n\ttimeout(ms: number) {\n\t\treturn this.functions.timeout(ms);\n\t}\n\n\tmemorySize(mb: number) {\n\t\treturn this.functions.memorySize(mb);\n\t}\n\n\tdependsOn<const T extends readonly Consumable[]>(constructs: T) {\n\t\treturn this.functions.dependsOn(constructs);\n\t}\n\n\tservices<T extends Service[]>(services: T) {\n\t\treturn this.functions.services(services);\n\t}\n\n\t/**\n\t * A function with no input schema — the shortest runnable there is.\n\t *\n\t * @example `worker.handle(async ({ logger }) => { … })`\n\t */\n\thandle(\n\t\t...args: Parameters<\n\t\t\tReturnType<Worker<TName>['schemalessFunction']>['handle']\n\t\t>\n\t) {\n\t\treturn this.schemalessFunction().handle(...args);\n\t}\n\n\t/** The builder `handle` delegates to, named so its type can be referred to. */\n\tprivate schemalessFunction() {\n\t\treturn this.functions;\n\t}\n\n\t/** The function builder the delegating methods above are built on. */\n\tprivate get functions() {\n\t\treturn this.own(new FunctionBuilder().logger(this.logger));\n\t}\n\n\t/**\n\t * Resources and surfaces this worker calls.\n\t *\n\t * Not `.dependsOn()`: this records the edge that derives the worker's\n\t * environment and its access, the same distinction `RestApi.calls()` draws.\n\t */\n\tcalls(constructs: readonly Declarable[]): Worker<TName> {\n\t\treturn new Worker<TName>(\n\t\t\tthis.id as ConstructName<TName>,\n\t\t\tthis.config,\n\t\t\t[...this.dependencies, ...constructs.map(edgeTo)],\n\t\t\tthis.scheduleStore,\n\t\t);\n\t}\n\n\t/**\n\t * Stamps this worker's id onto a builder, so everything built from it says\n\t * which process runs it.\n\t */\n\tprivate own<T extends { _owner?: string; _scheduleStore?: unknown }>(\n\t\tbuilder: T,\n\t): T {\n\t\tbuilder._owner = this.id;\n\t\tbuilder._scheduleStore = this.scheduleStore;\n\n\t\treturn builder;\n\t}\n\n\tdeclare(): Declaration[] {\n\t\treturn [\n\t\t\t{\n\t\t\t\tkind: 'worker',\n\t\t\t\tid: this.id,\n\t\t\t\t...(this.dependencies.length\n\t\t\t\t\t? { dependencies: this.dependencies }\n\t\t\t\t\t: {}),\n\t\t\t\t// Nothing calls a worker, so it publishes no address.\n\t\t\t\tprovides: [],\n\t\t\t},\n\t\t];\n\t}\n}\n"],"mappings":";;;;;;;;;AAoGA,IAAa,SAAb,MAAa,OAEb;CAiBmB;CAEA;CAlBlB;;CAGA;;CAGA;;;;;CAMA;CAEA,YACC,IACA,SAAwC,CAAC,GAEzC,eAAuD,CAAC,GACxD,eACC;EAJgB,KAAA,SAAA;EAEA,KAAA,eAAA;EAGjB,MAAM,aAAA,GAAYA,oBAAAA,YAAAA,CAAY,EAAY;EAE1C,KAAK,KAAK;EACV,KAAK,SAAS,OAAO,UAAUC,0BAAAA;EAC/B,KAAK,YAAYC,mBAAAA,aAChB,OAAO,YACJ;GAAE,IAAI;GAAW,WAAW,OAAO;EAAU,IAC7C,KAAA,CACJ;EACA,KAAK,gBAAgB;CACtB;;;;;;;;;;;;;;;;;;;;;CAsBA,SACC,QACgB;EAChB,OAAO,IAAI,OACV,KAAK,IACL,KAAK,QACL,CAAC,GAAG,KAAK,cAAcC,4BAAAA,OAAO,MAAM,CAAC,GACrC,MACD;CACD;;;;;;CAOA,KAAK,UAA8B;EAClC,OAAO,KAAK,IAAI,IAAIC,oBAAAA,YAAY,CAAC,CAAC,OAAO,KAAK,MAAM,CAAC,CAAC,CAAC,SAAS,QAAQ;CACzE;;;;;;;;;;;CAYA,MACC,OACC;EACD,OAAO,KAAK,IAAI,IAAIC,0BAAAA,kBAAkB,CAAC,CAAC,OAAO,KAAK,MAAM,CAAC,CAAC,CAAC,MAAM,KAAK;CACzE;;;;;;;;;CAUA,UACC,SACC;EACD,OAAO,KAAK,IAAI,IAAIA,0BAAAA,kBAAkB,CAAC,CAAC,OAAO,KAAK,MAAM,CAAC,CAAC,CAAC,UAC5D,OACD;CACD;;;;;;;;;;;;CAaA,MAA0C,QAAW;EACpD,OAAO,KAAK,UAAU,MAAM,MAAM;CACnC;CAEA,OAAmC,QAAW;EAC7C,OAAO,KAAK,UAAU,OAAO,MAAM;CACpC;CAEA,QAAQ,IAAY;EACnB,OAAO,KAAK,UAAU,QAAQ,EAAE;CACjC;CAEA,WAAW,IAAY;EACtB,OAAO,KAAK,UAAU,WAAW,EAAE;CACpC;CAEA,UAAiD,YAAe;EAC/D,OAAO,KAAK,UAAU,UAAU,UAAU;CAC3C;CAEA,SAA8B,UAAa;EAC1C,OAAO,KAAK,UAAU,SAAS,QAAQ;CACxC;;;;;;CAOA,OACC,GAAG,MAGF;EACD,OAAO,KAAK,mBAAmB,CAAC,CAAC,OAAO,GAAG,IAAI;CAChD;;CAGA,qBAA6B;EAC5B,OAAO,KAAK;CACb;;CAGA,IAAY,YAAY;EACvB,OAAO,KAAK,IAAI,IAAIC,kBAAAA,gBAAgB,CAAC,CAAC,OAAO,KAAK,MAAM,CAAC;CAC1D;;;;;;;CAQA,MAAM,YAAkD;EACvD,OAAO,IAAI,OACV,KAAK,IACL,KAAK,QACL,CAAC,GAAG,KAAK,cAAc,GAAG,WAAW,IAAIH,4BAAAA,MAAM,CAAC,GAChD,KAAK,aACN;CACD;;;;;CAMA,IACC,SACI;EACJ,QAAQ,SAAS,KAAK;EACtB,QAAQ,iBAAiB,KAAK;EAE9B,OAAO;CACR;CAEA,UAAyB;EACxB,OAAO,CACN;GACC,MAAM;GACN,IAAI,KAAK;GACT,GAAI,KAAK,aAAa,SACnB,EAAE,cAAc,KAAK,aAAa,IAClC,CAAC;GAEJ,UAAU,CAAC;EACZ,CACD;CACD;AACD"}
|
package/dist/worker.d.cts
CHANGED
|
@@ -1,24 +1,19 @@
|
|
|
1
|
-
import "./
|
|
2
|
-
import { Function, FunctionBuilder
|
|
3
|
-
import { Consumable, Declarable, ServicesOf } from "./construct-interface-
|
|
4
|
-
import { ScheduleExpression } from "./Cron-
|
|
5
|
-
import "./
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
9
|
-
import "./index-CBSfrowv.cjs";
|
|
1
|
+
import { t as StandardSchemaV1 } from "./index-CeEtxDmK.cjs";
|
|
2
|
+
import { a as FunctionHandler, r as Function, t as FunctionBuilder } from "./index-CdaU--_B.cjs";
|
|
3
|
+
import { n as Consumable, r as Declarable, s as ServicesOf } from "./construct-interface-DgXTJcOD.cjs";
|
|
4
|
+
import { i as ScheduleExpression } from "./Cron-DKqnnTdH.cjs";
|
|
5
|
+
import { t as CronBuilder } from "./CronBuilder-Df1q9PNy.cjs";
|
|
6
|
+
import { n as TopicEvents, r as TopicMessage, t as Topic } from "./Topic-DEVGo0Dm.cjs";
|
|
7
|
+
import { t as SubscriberBuilder } from "./SubscriberBuilder-BEv0eoHy.cjs";
|
|
8
|
+
import "./index-B2urf3YI.cjs";
|
|
10
9
|
import { EnvironmentParser } from "@geekmidas/envkit";
|
|
11
10
|
import { EventPublisher } from "@geekmidas/events";
|
|
12
11
|
import { Logger } from "@geekmidas/logger";
|
|
13
12
|
import { ComposableStandardSchema } from "@geekmidas/schema";
|
|
14
13
|
import { Service } from "@geekmidas/services";
|
|
15
|
-
import { StandardSchemaV1 } from "@standard-schema/spec";
|
|
16
|
-
import * as _geekmidas_audit15 from "@geekmidas/audit";
|
|
17
14
|
import { ConstructName, Declaration, Dependency } from "@geekmidas/manifest";
|
|
18
|
-
|
|
19
15
|
//#region src/worker.d.ts
|
|
20
|
-
|
|
21
|
-
interface WorkerConfig {
|
|
16
|
+
export interface WorkerConfig {
|
|
22
17
|
/**
|
|
23
18
|
* The logger everything built from this worker runs with.
|
|
24
19
|
*
|
|
@@ -36,7 +31,7 @@ interface WorkerConfig {
|
|
|
36
31
|
*/
|
|
37
32
|
envParser?: EnvironmentParser<{}>;
|
|
38
33
|
}
|
|
39
|
-
declare class Worker<TName extends string = string> implements Declarable<TName> {
|
|
34
|
+
export declare class Worker<TName extends string = string> implements Declarable<TName> {
|
|
40
35
|
private readonly config;
|
|
41
36
|
/** Internal: how `.calls()` carries edges into the copy it returns. */
|
|
42
37
|
private readonly dependencies;
|
|
@@ -50,7 +45,8 @@ declare class Worker<TName extends string = string> implements Declarable<TName>
|
|
|
50
45
|
* them. `undefined` until `.database(…)` says.
|
|
51
46
|
*/
|
|
52
47
|
readonly scheduleStore?: Consumable<string, unknown>;
|
|
53
|
-
constructor(id: ConstructName<TName>, config?: WorkerConfig,
|
|
48
|
+
constructor(id: ConstructName<TName>, config?: WorkerConfig,
|
|
49
|
+
/** Internal: how `.calls()` carries edges into the copy it returns. */
|
|
54
50
|
dependencies?: readonly Dependency[], scheduleStore?: Consumable<string, unknown>);
|
|
55
51
|
/**
|
|
56
52
|
* The database this worker keeps its schedules in.
|
|
@@ -78,7 +74,7 @@ declare class Worker<TName extends string = string> implements Declarable<TName>
|
|
|
78
74
|
*
|
|
79
75
|
* @example `worker.cron('rate(1 day)').handle(async ({ logger }) => { … })`
|
|
80
76
|
*/
|
|
81
|
-
cron(schedule: ScheduleExpression): CronBuilder<ComposableStandardSchema, Service
|
|
77
|
+
cron(schedule: ScheduleExpression): CronBuilder<ComposableStandardSchema, Service[], Logger, undefined, undefined, string, undefined, string>;
|
|
82
78
|
/**
|
|
83
79
|
* A runnable that consumes a topic.
|
|
84
80
|
*
|
|
@@ -89,7 +85,7 @@ declare class Worker<TName extends string = string> implements Declarable<TName>
|
|
|
89
85
|
*
|
|
90
86
|
* @example `worker.topic(users).subscribe(['user.created']).handle(…)`
|
|
91
87
|
*/
|
|
92
|
-
topic<TTopicName extends string, TEvents extends TopicEvents>(topic: Topic<TTopicName, TEvents>): SubscriberBuilder<[], Logger, undefined, EventPublisher<TopicMessage<
|
|
88
|
+
topic<TTopicName extends string, TEvents extends TopicEvents>(topic: Topic<TTopicName, TEvents>): SubscriberBuilder<[], Logger, undefined, EventPublisher<TopicMessage<TEvents_1>>, string, []>;
|
|
93
89
|
/**
|
|
94
90
|
* A runnable that consumes events typed from a publisher service.
|
|
95
91
|
*
|
|
@@ -110,18 +106,18 @@ declare class Worker<TName extends string = string> implements Declarable<TName>
|
|
|
110
106
|
* makes a cron, a topic makes a subscriber, and anything else makes a
|
|
111
107
|
* function.
|
|
112
108
|
*/
|
|
113
|
-
input<T extends ComposableStandardSchema>(schema: T): FunctionBuilder<T, undefined, [], Logger, undefined, string, undefined, string, undefined, string,
|
|
114
|
-
output<T extends StandardSchemaV1>(schema: T): FunctionBuilder<ComposableStandardSchema, T, [], Logger, undefined, string, undefined, string, undefined, string,
|
|
115
|
-
timeout(ms: number): FunctionBuilder<ComposableStandardSchema, undefined, [], Logger, undefined, string, undefined, string, undefined, string,
|
|
116
|
-
memorySize(mb: number): FunctionBuilder<ComposableStandardSchema, undefined, [], Logger, undefined, string, undefined, string, undefined, string,
|
|
117
|
-
dependsOn<const T extends readonly Consumable[]>(constructs: T): FunctionBuilder<ComposableStandardSchema, undefined, [...ServicesOf<T>], Logger, undefined, string, undefined, string, undefined, string,
|
|
118
|
-
services<T extends Service[]>(services: T): FunctionBuilder<ComposableStandardSchema, undefined, [...T], Logger, undefined, string, undefined, string, undefined, string,
|
|
109
|
+
input<T extends ComposableStandardSchema>(schema: T): FunctionBuilder<T, undefined, [], Logger, undefined, string, undefined, string, undefined, string, AuditableAction<string, unknown>>;
|
|
110
|
+
output<T extends StandardSchemaV1>(schema: T): FunctionBuilder<ComposableStandardSchema, T, [], Logger, undefined, string, undefined, string, undefined, string, AuditableAction<string, unknown>>;
|
|
111
|
+
timeout(ms: number): FunctionBuilder<ComposableStandardSchema, undefined, [], Logger, undefined, string, undefined, string, undefined, string, AuditableAction<string, unknown>>;
|
|
112
|
+
memorySize(mb: number): FunctionBuilder<ComposableStandardSchema, undefined, [], Logger, undefined, string, undefined, string, undefined, string, AuditableAction<string, unknown>>;
|
|
113
|
+
dependsOn<const T extends readonly Consumable[]>(constructs: T): FunctionBuilder<ComposableStandardSchema, undefined, [...ServicesOf<T>], Logger, undefined, string, undefined, string, undefined, string, AuditableAction<string, unknown>>;
|
|
114
|
+
services<T extends Service[]>(services: T): FunctionBuilder<ComposableStandardSchema, undefined, [...T], Logger, undefined, string, undefined, string, undefined, string, AuditableAction<string, unknown>>;
|
|
119
115
|
/**
|
|
120
116
|
* A function with no input schema — the shortest runnable there is.
|
|
121
117
|
*
|
|
122
118
|
* @example `worker.handle(async ({ logger }) => { … })`
|
|
123
119
|
*/
|
|
124
|
-
handle(...args: Parameters<ReturnType<Worker<TName>['schemalessFunction']>['handle']>): Function<ComposableStandardSchema, [], Logger, undefined, undefined, string, undefined, string, undefined, string,
|
|
120
|
+
handle(...args: Parameters<ReturnType<Worker<TName>['schemalessFunction']>['handle']>): Function<ComposableStandardSchema, [], Logger, undefined, undefined, string, undefined, string, undefined, string, AuditableAction<string, unknown>, FunctionHandler<ComposableStandardSchema, [], Logger, undefined, undefined, undefined, AuditableAction<string, unknown>>>;
|
|
125
121
|
/** The builder `handle` delegates to, named so its type can be referred to. */
|
|
126
122
|
private schemalessFunction;
|
|
127
123
|
/** The function builder the delegating methods above are built on. */
|
|
@@ -140,7 +136,5 @@ declare class Worker<TName extends string = string> implements Declarable<TName>
|
|
|
140
136
|
private own;
|
|
141
137
|
declare(): Declaration[];
|
|
142
138
|
}
|
|
143
|
-
//# sourceMappingURL=worker.d.ts.map
|
|
144
139
|
//#endregion
|
|
145
|
-
export { Worker, WorkerConfig };
|
|
146
140
|
//# sourceMappingURL=worker.d.cts.map
|
package/dist/worker.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"worker.d.cts","names":[],"sources":["../src/worker.ts"],"
|
|
1
|
+
{"version":3,"file":"worker.d.cts","names":["_$__topic0.TopicMessage","_$__construct_interface0.ServicesOf","_$__functions0.FunctionHandler","_$__functions0.Function"],"sources":["../src/worker.ts"],"mappings":";;;;;;;;;;;;;;;iBAiFiB;;;;;;;;;EAShB,SAAS;;;;;;;EAOT,YAAY;;qBAGA,OAAO,0CACR,WAAW;mBAkBJ;;mBAEA;WAlBT,IAAI;;WAGJ,QAAQ;;WAGR,WAAW;;;;;WAMX,gBAAgB;EAGxB,YAAA,IAAI,cAAc,QACD,SAAQ,cAER;;EAAA,wBAAuB,cACxC,gBAAgB;;;;;;;;;;;;;;;;;;;;;EAkCjB,SAAS,GAAG,wBACX,QAAQ,WAAW,SAAS,KAC1B,OAAO;;;;;;EAcV,KAAK,UAAU,qBAAkB,YAAA,0BAAA,WAAA;;;;;;;;;;;EAcjC,MAAM,2BAA2B,gBAAgB,aAChD,OAAO,MAAM,YAAY,WAAQ,sBAAA,mBAAA,eAAAA,aAAA;;;;;;;;;EAalC,UAAU,UAAU,qBAAqB,yBACxC,SAAS,QAAQ,UAAU,KAAK,WAAW,UAAU,KAAE,sBAAA,mBAAA;;;;;;;;;;;;EAkBxD,MAAM,UAAU,0BAA0B,QAAQ,IAAC,gBAAA,kBAAA,iEAAA;EAInD,OAAO,UAAU,kBAAkB,QAAQ,IAAC,gBAAA,0BAAA,OAAA,iEAAA;EAI5C,QAAQ,aAAU,gBAAA,yCAAA,iEAAA;EAIlB,WAAW,aAAU,gBAAA,yCAAA,iEAAA;EAIrB,gBAAgB,mBAAmB,cAAc,YAAY,IAAC,gBAAA,yCAAAC,WAAA,KAAA,iEAAA;EAI9D,SAAS,UAAU,WAAW,UAAU,IAAC,gBAAA,yCAAA,IAAA,iEAAA;;;;;;EASzC,UACI,MAAM,WACR,WAAW,OAAO,2CAClBE,SAAA,8BAAA,4EAAA,kCAAAD,gBAAA,8BAAA,yCAAA;;UAMM;;cAKI;;;;;;;EAUZ,MAAM,qBAAqB,eAAe,OAAO;;;;;UAazC;EASR,WAAW"}
|
package/dist/worker.d.mts
CHANGED
|
@@ -1,23 +1,19 @@
|
|
|
1
|
-
import "./
|
|
2
|
-
import { Function, FunctionBuilder
|
|
3
|
-
import { Consumable, Declarable, ServicesOf } from "./construct-interface-
|
|
4
|
-
import { ScheduleExpression } from "./Cron-
|
|
5
|
-
import "./
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
9
|
-
import "./index-BknhM6Ux.mjs";
|
|
1
|
+
import { t as StandardSchemaV1 } from "./index-CeEtxDmK.mjs";
|
|
2
|
+
import { a as FunctionHandler, r as Function, t as FunctionBuilder } from "./index-PQRWOQj4.mjs";
|
|
3
|
+
import { n as Consumable, r as Declarable, s as ServicesOf } from "./construct-interface-DPlxfpoS.mjs";
|
|
4
|
+
import { i as ScheduleExpression } from "./Cron-SyqS5oWJ.mjs";
|
|
5
|
+
import { t as CronBuilder } from "./CronBuilder-CRGnDfTq.mjs";
|
|
6
|
+
import { n as TopicEvents, r as TopicMessage, t as Topic } from "./Topic-zk_6Gthr.mjs";
|
|
7
|
+
import { t as SubscriberBuilder } from "./SubscriberBuilder-tyH5yTk5.mjs";
|
|
8
|
+
import "./index-DMCDvnsM.mjs";
|
|
10
9
|
import { ConstructName, Declaration, Dependency } from "@geekmidas/manifest";
|
|
11
10
|
import { EnvironmentParser } from "@geekmidas/envkit";
|
|
12
|
-
import { Service } from "@geekmidas/services";
|
|
13
11
|
import { EventPublisher } from "@geekmidas/events";
|
|
12
|
+
import { Service } from "@geekmidas/services";
|
|
14
13
|
import { Logger } from "@geekmidas/logger";
|
|
15
14
|
import { ComposableStandardSchema } from "@geekmidas/schema";
|
|
16
|
-
import { StandardSchemaV1 } from "@standard-schema/spec";
|
|
17
|
-
|
|
18
15
|
//#region src/worker.d.ts
|
|
19
|
-
|
|
20
|
-
interface WorkerConfig {
|
|
16
|
+
export interface WorkerConfig {
|
|
21
17
|
/**
|
|
22
18
|
* The logger everything built from this worker runs with.
|
|
23
19
|
*
|
|
@@ -35,7 +31,7 @@ interface WorkerConfig {
|
|
|
35
31
|
*/
|
|
36
32
|
envParser?: EnvironmentParser<{}>;
|
|
37
33
|
}
|
|
38
|
-
declare class Worker<TName extends string = string> implements Declarable<TName> {
|
|
34
|
+
export declare class Worker<TName extends string = string> implements Declarable<TName> {
|
|
39
35
|
private readonly config;
|
|
40
36
|
/** Internal: how `.calls()` carries edges into the copy it returns. */
|
|
41
37
|
private readonly dependencies;
|
|
@@ -49,7 +45,8 @@ declare class Worker<TName extends string = string> implements Declarable<TName>
|
|
|
49
45
|
* them. `undefined` until `.database(…)` says.
|
|
50
46
|
*/
|
|
51
47
|
readonly scheduleStore?: Consumable<string, unknown>;
|
|
52
|
-
constructor(id: ConstructName<TName>, config?: WorkerConfig,
|
|
48
|
+
constructor(id: ConstructName<TName>, config?: WorkerConfig,
|
|
49
|
+
/** Internal: how `.calls()` carries edges into the copy it returns. */
|
|
53
50
|
dependencies?: readonly Dependency[], scheduleStore?: Consumable<string, unknown>);
|
|
54
51
|
/**
|
|
55
52
|
* The database this worker keeps its schedules in.
|
|
@@ -77,7 +74,7 @@ declare class Worker<TName extends string = string> implements Declarable<TName>
|
|
|
77
74
|
*
|
|
78
75
|
* @example `worker.cron('rate(1 day)').handle(async ({ logger }) => { … })`
|
|
79
76
|
*/
|
|
80
|
-
cron(schedule: ScheduleExpression): CronBuilder<ComposableStandardSchema, Service
|
|
77
|
+
cron(schedule: ScheduleExpression): CronBuilder<ComposableStandardSchema, Service[], Logger, undefined, undefined, string, undefined, string>;
|
|
81
78
|
/**
|
|
82
79
|
* A runnable that consumes a topic.
|
|
83
80
|
*
|
|
@@ -139,7 +136,5 @@ declare class Worker<TName extends string = string> implements Declarable<TName>
|
|
|
139
136
|
private own;
|
|
140
137
|
declare(): Declaration[];
|
|
141
138
|
}
|
|
142
|
-
//# sourceMappingURL=worker.d.ts.map
|
|
143
139
|
//#endregion
|
|
144
|
-
export { Worker, WorkerConfig };
|
|
145
140
|
//# sourceMappingURL=worker.d.mts.map
|
package/dist/worker.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"worker.d.mts","names":[],"sources":["../src/worker.ts"],"
|
|
1
|
+
{"version":3,"file":"worker.d.mts","names":["_$__topic0.TopicMessage","_$__construct_interface0.ServicesOf","_$__functions0.FunctionHandler","_$__functions0.Function"],"sources":["../src/worker.ts"],"mappings":";;;;;;;;;;;;;;;iBAiFiB;;;;;;;;;EAShB,SAAS;;;;;;;EAOT,YAAY;;qBAGA,OAAO,0CACR,WAAW;mBAkBJ;;mBAEA;WAlBT,IAAI;;WAGJ,QAAQ;;WAGR,WAAW;;;;;WAMX,gBAAgB;EAGxB,YAAA,IAAI,cAAc,QACD,SAAQ,cAER;;EAAA,wBAAuB,cACxC,gBAAgB;;;;;;;;;;;;;;;;;;;;;EAkCjB,SAAS,GAAG,wBACX,QAAQ,WAAW,SAAS,KAC1B,OAAO;;;;;;EAcV,KAAK,UAAU,qBAAkB,YAAA,0BAAA,WAAA;;;;;;;;;;;EAcjC,MAAM,2BAA2B,gBAAgB,aAChD,OAAO,MAAM,YAAY,WAAQ,sBAAA,mBAAA,eAAAA,aAAA;;;;;;;;;EAalC,UAAU,UAAU,qBAAqB,yBACxC,SAAS,QAAQ,UAAU,KAAK,WAAW,UAAU,KAAE,sBAAA,mBAAA;;;;;;;;;;;;EAkBxD,MAAM,UAAU,0BAA0B,QAAQ,IAAC,gBAAA,kBAAA,iEAAA;EAInD,OAAO,UAAU,kBAAkB,QAAQ,IAAC,gBAAA,0BAAA,OAAA,iEAAA;EAI5C,QAAQ,aAAU,gBAAA,yCAAA,iEAAA;EAIlB,WAAW,aAAU,gBAAA,yCAAA,iEAAA;EAIrB,gBAAgB,mBAAmB,cAAc,YAAY,IAAC,gBAAA,yCAAAC,WAAA,KAAA,iEAAA;EAI9D,SAAS,UAAU,WAAW,UAAU,IAAC,gBAAA,yCAAA,IAAA,iEAAA;;;;;;EASzC,UACI,MAAM,WACR,WAAW,OAAO,2CAClBE,SAAA,8BAAA,4EAAA,kCAAAD,gBAAA,8BAAA,yCAAA;;UAMM;;cAKI;;;;;;;EAUZ,MAAM,qBAAqB,eAAe,OAAO;;;;;UAazC;EASR,WAAW"}
|
package/dist/worker.mjs
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
import "./
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import "./
|
|
5
|
-
import {
|
|
6
|
-
import { CronBuilder } from "./CronBuilder-CYKT5RiO.mjs";
|
|
7
|
-
import { SubscriberBuilder } from "./SubscriberBuilder-BjkbeT9l.mjs";
|
|
1
|
+
import { edgeTo } from "./construct-interface.mjs";
|
|
2
|
+
import { t as FunctionBuilder } from "./functions-C53GW2eQ.mjs";
|
|
3
|
+
import { n as envParserFor } from "./surfaceEnv-wMT5QzgZ.mjs";
|
|
4
|
+
import { t as CronBuilder } from "./CronBuilder-D_0HNBTr.mjs";
|
|
5
|
+
import { t as SubscriberBuilder } from "./SubscriberBuilder-h7B_cHMr.mjs";
|
|
8
6
|
import { canonicalId } from "@geekmidas/manifest";
|
|
9
7
|
import { DEFAULT_LOGGER } from "@geekmidas/logger/console";
|
|
10
|
-
|
|
11
8
|
//#region src/worker.ts
|
|
12
9
|
var Worker = class Worker {
|
|
10
|
+
config;
|
|
11
|
+
dependencies;
|
|
13
12
|
id;
|
|
14
13
|
/** Always defined — the worker's own, or the console logger. */
|
|
15
14
|
logger;
|
|
@@ -159,7 +158,7 @@ var Worker = class Worker {
|
|
|
159
158
|
}];
|
|
160
159
|
}
|
|
161
160
|
};
|
|
162
|
-
|
|
163
161
|
//#endregion
|
|
164
162
|
export { Worker };
|
|
163
|
+
|
|
165
164
|
//# sourceMappingURL=worker.mjs.map
|
package/dist/worker.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"worker.mjs","names":["id: ConstructName<TName>","config: WorkerConfig","dependencies: readonly Dependency[]","scheduleStore?: Consumable<string, unknown>","source: Consumable<TDbName, T>","schedule: ScheduleExpression","topic: Topic<TTopicName, TEvents>","service: Service<TPubName, T> | Consumable<TPubName, T>","schema: T","ms: number","mb: number","constructs: T","services: T","constructs: readonly Declarable[]","builder: T"],"sources":["../src/worker.ts"],"sourcesContent":["/**\n * A process with no port.\n *\n * `RestApi` is the process that answers HTTP. This is the one that does not —\n * the thing that runs a schedule, drains a queue, consumes a topic. Until it\n * existed, those had nowhere to say they belonged: a cron declared a schedule\n * and nothing else, and which container ran it was decided by the directory the\n * file sat in. A glob owned it.\n *\n * The cost of that shows up in the scaffolds. `gkm init --template worker` —\n * a project that is background jobs and nothing else — declared\n * `new RestApi('Api', { defaultAuthorizer: 'none', logger })`: an HTTP surface\n * with no HTTP on it, written because it was the only construct that made an\n * app exist and the only way to get a logger into the generated runtime.\n *\n * It takes no authorizer, and that is the tell that these are two constructs\n * rather than one with a flag: a `RestApi` needs one because an HTTP surface\n * can ship open by omission, and nothing reaches a worker from outside.\n *\n * ## Crons on a server target need a database\n *\n * A cron becomes an EventBridge rule on AWS and nothing here is consulted. A\n * server has nothing firing its crons but itself, and a process that schedules\n * in memory fires every job once per replica while reporting success — so the\n * schedule is kept in Postgres, and the worker says which one with\n * `.database(db)`.\n *\n * A worker with crons and no `.database(…)` schedules nothing on a server\n * target and says so at startup. That is a limitation of workers today rather\n * than a design: the store could be a cache, or something the target\n * provisions, and Postgres is what exists.\n *\n * It is not an app. A worker names the process that runs its crons and\n * subscribers, and that process is the app's server — the same one the\n * endpoints run in, minus the HTTP surface. Giving a worker a container of its\n * own made a second thing to build, deploy and keep alive for work that was\n * always going to run somewhere already. Declare as many as the shape of the\n * work wants: they are groupings, not deployments.\n *\n * @example\n * ```ts\n * // constructs/worker.ts\n * import { Worker } from '@geekmidas/constructs/worker';\n * import { logger } from './logger.js';\n *\n * export const worker = new Worker('Worker', { logger }).calls([database]);\n *\n * // crons/cleanup.ts\n * import { worker } from '@acme/constructs/worker.js';\n *\n * export const cleanup = worker\n * .cron('rate(1 day)')\n * .handle(async ({ logger }) => { … });\n * ```\n */\n\nimport type { EnvironmentParser } from '@geekmidas/envkit';\nimport type { EventPublisher } from '@geekmidas/events';\nimport type { Logger } from '@geekmidas/logger';\nimport { DEFAULT_LOGGER } from '@geekmidas/logger/console';\nimport {\n\ttype ConstructName,\n\tcanonicalId,\n\ttype Declaration,\n\ttype Dependency,\n} from '@geekmidas/manifest';\nimport type { ComposableStandardSchema } from '@geekmidas/schema';\nimport type { Service } from '@geekmidas/services';\nimport type { StandardSchemaV1 } from '@standard-schema/spec';\nimport {\n\ttype Consumable,\n\ttype Declarable,\n\tedgeTo,\n} from './construct-interface';\nimport type { ScheduleExpression } from './crons/Cron';\nimport { CronBuilder } from './crons/CronBuilder';\nimport { envParserFor } from './endpoints/surfaceEnv';\nimport { FunctionBuilder } from './functions/FunctionBuilder';\nimport { SubscriberBuilder } from './subscribers/SubscriberBuilder';\nimport type { Topic, TopicEvents } from './topic/Topic';\n\nexport interface WorkerConfig {\n\t/**\n\t * The logger everything built from this worker runs with.\n\t *\n\t * The actual logger, not a path to one — the same reason `RestApi` takes\n\t * one. Every cron and subscriber in a scaffolded project used to open with\n\t * `import { logger } from '…/constructs/logger.js'`, which is the line this\n\t * removes.\n\t */\n\tlogger?: Logger;\n\t/**\n\t * The environment parser everything built from this worker runs with.\n\t *\n\t * Defaults to `process.env` merged with the credentials `gkm dev` injected,\n\t * which is what an application's own `config/env.ts` always was.\n\t */\n\tenvParser?: EnvironmentParser<{}>;\n}\n\nexport class Worker<TName extends string = string>\n\timplements Declarable<TName>\n{\n\treadonly id: TName;\n\n\t/** Always defined — the worker's own, or the console logger. */\n\treadonly logger: Logger;\n\n\t/** Always defined, and normally the default. */\n\treadonly envParser: EnvironmentParser<{}>;\n\n\t/**\n\t * Where this worker's schedules live, when it has crons and a server runs\n\t * them. `undefined` until `.database(…)` says.\n\t */\n\treadonly scheduleStore?: Consumable<string, unknown>;\n\n\tconstructor(\n\t\tid: ConstructName<TName>,\n\t\tprivate readonly config: WorkerConfig = {},\n\t\t/** Internal: how `.calls()` carries edges into the copy it returns. */\n\t\tprivate readonly dependencies: readonly Dependency[] = [],\n\t\tscheduleStore?: Consumable<string, unknown>,\n\t) {\n\t\tconst canonical = canonicalId(id as string);\n\n\t\tthis.id = canonical as TName;\n\t\tthis.logger = config.logger ?? DEFAULT_LOGGER;\n\t\tthis.envParser = envParserFor(\n\t\t\tconfig.envParser\n\t\t\t\t? { id: canonical, envParser: config.envParser }\n\t\t\t\t: undefined,\n\t\t);\n\t\tthis.scheduleStore = scheduleStore;\n\t}\n\n\t/**\n\t * The database this worker keeps its schedules in.\n\t *\n\t * Only a server target uses it. On AWS a cron is an EventBridge rule\n\t * invoking a Lambda and nothing here is consulted — but a server has nothing\n\t * firing its crons except itself, and a process that schedules in memory\n\t * fires every job once per replica while reporting that all is well.\n\t *\n\t * So the store is declared rather than discovered. It could have been\n\t * inferred — from a database the app happens to declare, or from the events\n\t * backend when that backend is pg-boss — and both would work until an app\n\t * had two databases, or moved its events to SNS, at which point the\n\t * schedules would quietly move or stop. Naming it is one line and cannot\n\t * drift.\n\t *\n\t * @example\n\t * ```ts\n\t * export const jobs = new Worker('Jobs', { logger }).database(database);\n\t * ```\n\t */\n\tdatabase<T, TDbName extends string>(\n\t\tsource: Consumable<TDbName, T>,\n\t): Worker<TName> {\n\t\treturn new Worker<TName>(\n\t\t\tthis.id as ConstructName<TName>,\n\t\t\tthis.config,\n\t\t\t[...this.dependencies, edgeTo(source)],\n\t\t\tsource as unknown as Consumable<string, unknown>,\n\t\t);\n\t}\n\n\t/**\n\t * A scheduled runnable.\n\t *\n\t * @example `worker.cron('rate(1 day)').handle(async ({ logger }) => { … })`\n\t */\n\tcron(schedule: ScheduleExpression) {\n\t\treturn this.own(new CronBuilder().logger(this.logger)).schedule(schedule);\n\t}\n\n\t/**\n\t * A runnable that consumes a topic.\n\t *\n\t * Binding is not publishing: a consumer is handed the topic's event types\n\t * and no connection string it could publish with. Chain `.publishes(…)` when\n\t * the handler emits follow-up events, which is the only reason it would need\n\t * one.\n\t *\n\t * @example `worker.topic(users).subscribe(['user.created']).handle(…)`\n\t */\n\ttopic<TTopicName extends string, TEvents extends TopicEvents>(\n\t\ttopic: Topic<TTopicName, TEvents>,\n\t) {\n\t\treturn this.own(new SubscriberBuilder().logger(this.logger)).topic(topic);\n\t}\n\n\t/**\n\t * A runnable that consumes events typed from a publisher service.\n\t *\n\t * The older of the two ways to bind a subscriber, kept for a project whose\n\t * events come from a hand-written publisher rather than a `Topic`\n\t * construct. `topic()` is the one to reach for: it types the events the same\n\t * way and hands the consumer no connection string it could publish with.\n\t */\n\tpublisher<T extends EventPublisher<any>, TPubName extends string>(\n\t\tservice: Service<TPubName, T> | Consumable<TPubName, T>,\n\t) {\n\t\treturn this.own(new SubscriberBuilder().logger(this.logger)).publisher(\n\t\t\tservice as never,\n\t\t);\n\t}\n\n\t/**\n\t * Everything below builds a function — the runnable with no schedule and no\n\t * topic, invoked by something else.\n\t *\n\t * These sit on the worker rather than behind a `functions` namespace because\n\t * the namespace was a hop that said nothing: `worker.functions.input(…)`\n\t * names a collection to reach one member of it. What kind of runnable is\n\t * being built is decided by which of these is called first — a schedule\n\t * makes a cron, a topic makes a subscriber, and anything else makes a\n\t * function.\n\t */\n\tinput<T extends ComposableStandardSchema>(schema: T) {\n\t\treturn this.functions.input(schema);\n\t}\n\n\toutput<T extends StandardSchemaV1>(schema: T) {\n\t\treturn this.functions.output(schema);\n\t}\n\n\ttimeout(ms: number) {\n\t\treturn this.functions.timeout(ms);\n\t}\n\n\tmemorySize(mb: number) {\n\t\treturn this.functions.memorySize(mb);\n\t}\n\n\tdependsOn<const T extends readonly Consumable[]>(constructs: T) {\n\t\treturn this.functions.dependsOn(constructs);\n\t}\n\n\tservices<T extends Service[]>(services: T) {\n\t\treturn this.functions.services(services);\n\t}\n\n\t/**\n\t * A function with no input schema — the shortest runnable there is.\n\t *\n\t * @example `worker.handle(async ({ logger }) => { … })`\n\t */\n\thandle(\n\t\t...args: Parameters<\n\t\t\tReturnType<Worker<TName>['schemalessFunction']>['handle']\n\t\t>\n\t) {\n\t\treturn this.schemalessFunction().handle(...args);\n\t}\n\n\t/** The builder `handle` delegates to, named so its type can be referred to. */\n\tprivate schemalessFunction() {\n\t\treturn this.functions;\n\t}\n\n\t/** The function builder the delegating methods above are built on. */\n\tprivate get functions() {\n\t\treturn this.own(new FunctionBuilder().logger(this.logger));\n\t}\n\n\t/**\n\t * Resources and surfaces this worker calls.\n\t *\n\t * Not `.dependsOn()`: this records the edge that derives the worker's\n\t * environment and its access, the same distinction `RestApi.calls()` draws.\n\t */\n\tcalls(constructs: readonly Declarable[]): Worker<TName> {\n\t\treturn new Worker<TName>(\n\t\t\tthis.id as ConstructName<TName>,\n\t\t\tthis.config,\n\t\t\t[...this.dependencies, ...constructs.map(edgeTo)],\n\t\t\tthis.scheduleStore,\n\t\t);\n\t}\n\n\t/**\n\t * Stamps this worker's id onto a builder, so everything built from it says\n\t * which process runs it.\n\t */\n\tprivate own<T extends { _owner?: string; _scheduleStore?: unknown }>(\n\t\tbuilder: T,\n\t): T {\n\t\tbuilder._owner = this.id;\n\t\tbuilder._scheduleStore = this.scheduleStore;\n\n\t\treturn builder;\n\t}\n\n\tdeclare(): Declaration[] {\n\t\treturn [\n\t\t\t{\n\t\t\t\tkind: 'worker',\n\t\t\t\tid: this.id,\n\t\t\t\t...(this.dependencies.length\n\t\t\t\t\t? { dependencies: this.dependencies }\n\t\t\t\t\t: {}),\n\t\t\t\t// Nothing calls a worker, so it publishes no address.\n\t\t\t\tprovides: [],\n\t\t\t},\n\t\t];\n\t}\n}\n"],"mappings":";;;;;;;;;;;AAoGA,IAAa,SAAb,MAAa,OAEb;CACC,AAAS;;CAGT,AAAS;;CAGT,AAAS;;;;;CAMT,AAAS;CAET,YACCA,IACiBC,SAAuB,CAAE,GAEzBC,eAAsC,CAAE,GACzDC,eACC;EAJgB;EAEA;EAGjB,MAAM,YAAY,YAAY,GAAa;AAE3C,OAAK,KAAK;AACV,OAAK,SAAS,OAAO,UAAU;AAC/B,OAAK,YAAY,aAChB,OAAO,YACJ;GAAE,IAAI;GAAW,WAAW,OAAO;EAAW,WAEjD;AACD,OAAK,gBAAgB;CACrB;;;;;;;;;;;;;;;;;;;;;CAsBD,SACCC,QACgB;AAChB,SAAO,IAAI,OACV,KAAK,IACL,KAAK,QACL,CAAC,GAAG,KAAK,cAAc,OAAO,OAAO,AAAC,GACtC;CAED;;;;;;CAOD,KAAKC,UAA8B;AAClC,SAAO,KAAK,IAAI,IAAI,cAAc,OAAO,KAAK,OAAO,CAAC,CAAC,SAAS,SAAS;CACzE;;;;;;;;;;;CAYD,MACCC,OACC;AACD,SAAO,KAAK,IAAI,IAAI,oBAAoB,OAAO,KAAK,OAAO,CAAC,CAAC,MAAM,MAAM;CACzE;;;;;;;;;CAUD,UACCC,SACC;AACD,SAAO,KAAK,IAAI,IAAI,oBAAoB,OAAO,KAAK,OAAO,CAAC,CAAC,UAC5D,QACA;CACD;;;;;;;;;;;;CAaD,MAA0CC,QAAW;AACpD,SAAO,KAAK,UAAU,MAAM,OAAO;CACnC;CAED,OAAmCA,QAAW;AAC7C,SAAO,KAAK,UAAU,OAAO,OAAO;CACpC;CAED,QAAQC,IAAY;AACnB,SAAO,KAAK,UAAU,QAAQ,GAAG;CACjC;CAED,WAAWC,IAAY;AACtB,SAAO,KAAK,UAAU,WAAW,GAAG;CACpC;CAED,UAAiDC,YAAe;AAC/D,SAAO,KAAK,UAAU,UAAU,WAAW;CAC3C;CAED,SAA8BC,UAAa;AAC1C,SAAO,KAAK,UAAU,SAAS,SAAS;CACxC;;;;;;CAOD,OACC,GAAG,MAGF;AACD,SAAO,KAAK,oBAAoB,CAAC,OAAO,GAAG,KAAK;CAChD;;CAGD,AAAQ,qBAAqB;AAC5B,SAAO,KAAK;CACZ;;CAGD,IAAY,YAAY;AACvB,SAAO,KAAK,IAAI,IAAI,kBAAkB,OAAO,KAAK,OAAO,CAAC;CAC1D;;;;;;;CAQD,MAAMC,YAAkD;AACvD,SAAO,IAAI,OACV,KAAK,IACL,KAAK,QACL,CAAC,GAAG,KAAK,cAAc,GAAG,WAAW,IAAI,OAAO,AAAC,GACjD,KAAK;CAEN;;;;;CAMD,AAAQ,IACPC,SACI;AACJ,UAAQ,SAAS,KAAK;AACtB,UAAQ,iBAAiB,KAAK;AAE9B,SAAO;CACP;CAED,UAAyB;AACxB,SAAO,CACN;GACC,MAAM;GACN,IAAI,KAAK;GACT,GAAI,KAAK,aAAa,SACnB,EAAE,cAAc,KAAK,aAAc,IACnC,CAAE;GAEL,UAAU,CAAE;EACZ,CACD;CACD;AACD"}
|
|
1
|
+
{"version":3,"file":"worker.mjs","names":[],"sources":["../src/worker.ts"],"sourcesContent":["/**\n * A process with no port.\n *\n * `RestApi` is the process that answers HTTP. This is the one that does not —\n * the thing that runs a schedule, drains a queue, consumes a topic. Until it\n * existed, those had nowhere to say they belonged: a cron declared a schedule\n * and nothing else, and which container ran it was decided by the directory the\n * file sat in. A glob owned it.\n *\n * The cost of that shows up in the scaffolds. `gkm init --template worker` —\n * a project that is background jobs and nothing else — declared\n * `new RestApi('Api', { defaultAuthorizer: 'none', logger })`: an HTTP surface\n * with no HTTP on it, written because it was the only construct that made an\n * app exist and the only way to get a logger into the generated runtime.\n *\n * It takes no authorizer, and that is the tell that these are two constructs\n * rather than one with a flag: a `RestApi` needs one because an HTTP surface\n * can ship open by omission, and nothing reaches a worker from outside.\n *\n * ## Crons on a server target need a database\n *\n * A cron becomes an EventBridge rule on AWS and nothing here is consulted. A\n * server has nothing firing its crons but itself, and a process that schedules\n * in memory fires every job once per replica while reporting success — so the\n * schedule is kept in Postgres, and the worker says which one with\n * `.database(db)`.\n *\n * A worker with crons and no `.database(…)` schedules nothing on a server\n * target and says so at startup. That is a limitation of workers today rather\n * than a design: the store could be a cache, or something the target\n * provisions, and Postgres is what exists.\n *\n * It is not an app. A worker names the process that runs its crons and\n * subscribers, and that process is the app's server — the same one the\n * endpoints run in, minus the HTTP surface. Giving a worker a container of its\n * own made a second thing to build, deploy and keep alive for work that was\n * always going to run somewhere already. Declare as many as the shape of the\n * work wants: they are groupings, not deployments.\n *\n * @example\n * ```ts\n * // constructs/worker.ts\n * import { Worker } from '@geekmidas/constructs/worker';\n * import { logger } from './logger.js';\n *\n * export const worker = new Worker('Worker', { logger }).calls([database]);\n *\n * // crons/cleanup.ts\n * import { worker } from '@acme/constructs/worker.js';\n *\n * export const cleanup = worker\n * .cron('rate(1 day)')\n * .handle(async ({ logger }) => { … });\n * ```\n */\n\nimport type { EnvironmentParser } from '@geekmidas/envkit';\nimport type { EventPublisher } from '@geekmidas/events';\nimport type { Logger } from '@geekmidas/logger';\nimport { DEFAULT_LOGGER } from '@geekmidas/logger/console';\nimport {\n\ttype ConstructName,\n\tcanonicalId,\n\ttype Declaration,\n\ttype Dependency,\n} from '@geekmidas/manifest';\nimport type { ComposableStandardSchema } from '@geekmidas/schema';\nimport type { Service } from '@geekmidas/services';\nimport type { StandardSchemaV1 } from '@standard-schema/spec';\nimport {\n\ttype Consumable,\n\ttype Declarable,\n\tedgeTo,\n} from './construct-interface';\nimport type { ScheduleExpression } from './crons/Cron';\nimport { CronBuilder } from './crons/CronBuilder';\nimport { envParserFor } from './endpoints/surfaceEnv';\nimport { FunctionBuilder } from './functions/FunctionBuilder';\nimport { SubscriberBuilder } from './subscribers/SubscriberBuilder';\nimport type { Topic, TopicEvents } from './topic/Topic';\n\nexport interface WorkerConfig {\n\t/**\n\t * The logger everything built from this worker runs with.\n\t *\n\t * The actual logger, not a path to one — the same reason `RestApi` takes\n\t * one. Every cron and subscriber in a scaffolded project used to open with\n\t * `import { logger } from '…/constructs/logger.js'`, which is the line this\n\t * removes.\n\t */\n\tlogger?: Logger;\n\t/**\n\t * The environment parser everything built from this worker runs with.\n\t *\n\t * Defaults to `process.env` merged with the credentials `gkm dev` injected,\n\t * which is what an application's own `config/env.ts` always was.\n\t */\n\tenvParser?: EnvironmentParser<{}>;\n}\n\nexport class Worker<TName extends string = string>\n\timplements Declarable<TName>\n{\n\treadonly id: TName;\n\n\t/** Always defined — the worker's own, or the console logger. */\n\treadonly logger: Logger;\n\n\t/** Always defined, and normally the default. */\n\treadonly envParser: EnvironmentParser<{}>;\n\n\t/**\n\t * Where this worker's schedules live, when it has crons and a server runs\n\t * them. `undefined` until `.database(…)` says.\n\t */\n\treadonly scheduleStore?: Consumable<string, unknown>;\n\n\tconstructor(\n\t\tid: ConstructName<TName>,\n\t\tprivate readonly config: WorkerConfig = {},\n\t\t/** Internal: how `.calls()` carries edges into the copy it returns. */\n\t\tprivate readonly dependencies: readonly Dependency[] = [],\n\t\tscheduleStore?: Consumable<string, unknown>,\n\t) {\n\t\tconst canonical = canonicalId(id as string);\n\n\t\tthis.id = canonical as TName;\n\t\tthis.logger = config.logger ?? DEFAULT_LOGGER;\n\t\tthis.envParser = envParserFor(\n\t\t\tconfig.envParser\n\t\t\t\t? { id: canonical, envParser: config.envParser }\n\t\t\t\t: undefined,\n\t\t);\n\t\tthis.scheduleStore = scheduleStore;\n\t}\n\n\t/**\n\t * The database this worker keeps its schedules in.\n\t *\n\t * Only a server target uses it. On AWS a cron is an EventBridge rule\n\t * invoking a Lambda and nothing here is consulted — but a server has nothing\n\t * firing its crons except itself, and a process that schedules in memory\n\t * fires every job once per replica while reporting that all is well.\n\t *\n\t * So the store is declared rather than discovered. It could have been\n\t * inferred — from a database the app happens to declare, or from the events\n\t * backend when that backend is pg-boss — and both would work until an app\n\t * had two databases, or moved its events to SNS, at which point the\n\t * schedules would quietly move or stop. Naming it is one line and cannot\n\t * drift.\n\t *\n\t * @example\n\t * ```ts\n\t * export const jobs = new Worker('Jobs', { logger }).database(database);\n\t * ```\n\t */\n\tdatabase<T, TDbName extends string>(\n\t\tsource: Consumable<TDbName, T>,\n\t): Worker<TName> {\n\t\treturn new Worker<TName>(\n\t\t\tthis.id as ConstructName<TName>,\n\t\t\tthis.config,\n\t\t\t[...this.dependencies, edgeTo(source)],\n\t\t\tsource as unknown as Consumable<string, unknown>,\n\t\t);\n\t}\n\n\t/**\n\t * A scheduled runnable.\n\t *\n\t * @example `worker.cron('rate(1 day)').handle(async ({ logger }) => { … })`\n\t */\n\tcron(schedule: ScheduleExpression) {\n\t\treturn this.own(new CronBuilder().logger(this.logger)).schedule(schedule);\n\t}\n\n\t/**\n\t * A runnable that consumes a topic.\n\t *\n\t * Binding is not publishing: a consumer is handed the topic's event types\n\t * and no connection string it could publish with. Chain `.publishes(…)` when\n\t * the handler emits follow-up events, which is the only reason it would need\n\t * one.\n\t *\n\t * @example `worker.topic(users).subscribe(['user.created']).handle(…)`\n\t */\n\ttopic<TTopicName extends string, TEvents extends TopicEvents>(\n\t\ttopic: Topic<TTopicName, TEvents>,\n\t) {\n\t\treturn this.own(new SubscriberBuilder().logger(this.logger)).topic(topic);\n\t}\n\n\t/**\n\t * A runnable that consumes events typed from a publisher service.\n\t *\n\t * The older of the two ways to bind a subscriber, kept for a project whose\n\t * events come from a hand-written publisher rather than a `Topic`\n\t * construct. `topic()` is the one to reach for: it types the events the same\n\t * way and hands the consumer no connection string it could publish with.\n\t */\n\tpublisher<T extends EventPublisher<any>, TPubName extends string>(\n\t\tservice: Service<TPubName, T> | Consumable<TPubName, T>,\n\t) {\n\t\treturn this.own(new SubscriberBuilder().logger(this.logger)).publisher(\n\t\t\tservice as never,\n\t\t);\n\t}\n\n\t/**\n\t * Everything below builds a function — the runnable with no schedule and no\n\t * topic, invoked by something else.\n\t *\n\t * These sit on the worker rather than behind a `functions` namespace because\n\t * the namespace was a hop that said nothing: `worker.functions.input(…)`\n\t * names a collection to reach one member of it. What kind of runnable is\n\t * being built is decided by which of these is called first — a schedule\n\t * makes a cron, a topic makes a subscriber, and anything else makes a\n\t * function.\n\t */\n\tinput<T extends ComposableStandardSchema>(schema: T) {\n\t\treturn this.functions.input(schema);\n\t}\n\n\toutput<T extends StandardSchemaV1>(schema: T) {\n\t\treturn this.functions.output(schema);\n\t}\n\n\ttimeout(ms: number) {\n\t\treturn this.functions.timeout(ms);\n\t}\n\n\tmemorySize(mb: number) {\n\t\treturn this.functions.memorySize(mb);\n\t}\n\n\tdependsOn<const T extends readonly Consumable[]>(constructs: T) {\n\t\treturn this.functions.dependsOn(constructs);\n\t}\n\n\tservices<T extends Service[]>(services: T) {\n\t\treturn this.functions.services(services);\n\t}\n\n\t/**\n\t * A function with no input schema — the shortest runnable there is.\n\t *\n\t * @example `worker.handle(async ({ logger }) => { … })`\n\t */\n\thandle(\n\t\t...args: Parameters<\n\t\t\tReturnType<Worker<TName>['schemalessFunction']>['handle']\n\t\t>\n\t) {\n\t\treturn this.schemalessFunction().handle(...args);\n\t}\n\n\t/** The builder `handle` delegates to, named so its type can be referred to. */\n\tprivate schemalessFunction() {\n\t\treturn this.functions;\n\t}\n\n\t/** The function builder the delegating methods above are built on. */\n\tprivate get functions() {\n\t\treturn this.own(new FunctionBuilder().logger(this.logger));\n\t}\n\n\t/**\n\t * Resources and surfaces this worker calls.\n\t *\n\t * Not `.dependsOn()`: this records the edge that derives the worker's\n\t * environment and its access, the same distinction `RestApi.calls()` draws.\n\t */\n\tcalls(constructs: readonly Declarable[]): Worker<TName> {\n\t\treturn new Worker<TName>(\n\t\t\tthis.id as ConstructName<TName>,\n\t\t\tthis.config,\n\t\t\t[...this.dependencies, ...constructs.map(edgeTo)],\n\t\t\tthis.scheduleStore,\n\t\t);\n\t}\n\n\t/**\n\t * Stamps this worker's id onto a builder, so everything built from it says\n\t * which process runs it.\n\t */\n\tprivate own<T extends { _owner?: string; _scheduleStore?: unknown }>(\n\t\tbuilder: T,\n\t): T {\n\t\tbuilder._owner = this.id;\n\t\tbuilder._scheduleStore = this.scheduleStore;\n\n\t\treturn builder;\n\t}\n\n\tdeclare(): Declaration[] {\n\t\treturn [\n\t\t\t{\n\t\t\t\tkind: 'worker',\n\t\t\t\tid: this.id,\n\t\t\t\t...(this.dependencies.length\n\t\t\t\t\t? { dependencies: this.dependencies }\n\t\t\t\t\t: {}),\n\t\t\t\t// Nothing calls a worker, so it publishes no address.\n\t\t\t\tprovides: [],\n\t\t\t},\n\t\t];\n\t}\n}\n"],"mappings":";;;;;;;;AAoGA,IAAa,SAAb,MAAa,OAEb;CAiBmB;CAEA;CAlBlB;;CAGA;;CAGA;;;;;CAMA;CAEA,YACC,IACA,SAAwC,CAAC,GAEzC,eAAuD,CAAC,GACxD,eACC;EAJgB,KAAA,SAAA;EAEA,KAAA,eAAA;EAGjB,MAAM,YAAY,YAAY,EAAY;EAE1C,KAAK,KAAK;EACV,KAAK,SAAS,OAAO,UAAU;EAC/B,KAAK,YAAY,aAChB,OAAO,YACJ;GAAE,IAAI;GAAW,WAAW,OAAO;EAAU,IAC7C,KAAA,CACJ;EACA,KAAK,gBAAgB;CACtB;;;;;;;;;;;;;;;;;;;;;CAsBA,SACC,QACgB;EAChB,OAAO,IAAI,OACV,KAAK,IACL,KAAK,QACL,CAAC,GAAG,KAAK,cAAc,OAAO,MAAM,CAAC,GACrC,MACD;CACD;;;;;;CAOA,KAAK,UAA8B;EAClC,OAAO,KAAK,IAAI,IAAI,YAAY,CAAC,CAAC,OAAO,KAAK,MAAM,CAAC,CAAC,CAAC,SAAS,QAAQ;CACzE;;;;;;;;;;;CAYA,MACC,OACC;EACD,OAAO,KAAK,IAAI,IAAI,kBAAkB,CAAC,CAAC,OAAO,KAAK,MAAM,CAAC,CAAC,CAAC,MAAM,KAAK;CACzE;;;;;;;;;CAUA,UACC,SACC;EACD,OAAO,KAAK,IAAI,IAAI,kBAAkB,CAAC,CAAC,OAAO,KAAK,MAAM,CAAC,CAAC,CAAC,UAC5D,OACD;CACD;;;;;;;;;;;;CAaA,MAA0C,QAAW;EACpD,OAAO,KAAK,UAAU,MAAM,MAAM;CACnC;CAEA,OAAmC,QAAW;EAC7C,OAAO,KAAK,UAAU,OAAO,MAAM;CACpC;CAEA,QAAQ,IAAY;EACnB,OAAO,KAAK,UAAU,QAAQ,EAAE;CACjC;CAEA,WAAW,IAAY;EACtB,OAAO,KAAK,UAAU,WAAW,EAAE;CACpC;CAEA,UAAiD,YAAe;EAC/D,OAAO,KAAK,UAAU,UAAU,UAAU;CAC3C;CAEA,SAA8B,UAAa;EAC1C,OAAO,KAAK,UAAU,SAAS,QAAQ;CACxC;;;;;;CAOA,OACC,GAAG,MAGF;EACD,OAAO,KAAK,mBAAmB,CAAC,CAAC,OAAO,GAAG,IAAI;CAChD;;CAGA,qBAA6B;EAC5B,OAAO,KAAK;CACb;;CAGA,IAAY,YAAY;EACvB,OAAO,KAAK,IAAI,IAAI,gBAAgB,CAAC,CAAC,OAAO,KAAK,MAAM,CAAC;CAC1D;;;;;;;CAQA,MAAM,YAAkD;EACvD,OAAO,IAAI,OACV,KAAK,IACL,KAAK,QACL,CAAC,GAAG,KAAK,cAAc,GAAG,WAAW,IAAI,MAAM,CAAC,GAChD,KAAK,aACN;CACD;;;;;CAMA,IACC,SACI;EACJ,QAAQ,SAAS,KAAK;EACtB,QAAQ,iBAAiB,KAAK;EAE9B,OAAO;CACR;CAEA,UAAyB;EACxB,OAAO,CACN;GACC,MAAM;GACN,IAAI,KAAK;GACT,GAAI,KAAK,aAAa,SACnB,EAAE,cAAc,KAAK,aAAa,IAClC,CAAC;GAEJ,UAAU,CAAC;EACZ,CACD;CACD;AACD"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@geekmidas/constructs",
|
|
3
|
-
"version": "10.0.0-alpha.
|
|
3
|
+
"version": "10.0.0-alpha.13",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -245,13 +245,13 @@
|
|
|
245
245
|
"lodash.uniqby": "~4.7.0",
|
|
246
246
|
"openapi-types": "~12.1.3",
|
|
247
247
|
"qs": "~6.16.0",
|
|
248
|
-
"@geekmidas/envkit": "^10.0.0-alpha.
|
|
249
|
-
"@geekmidas/errors": "^10.0.0-alpha.
|
|
250
|
-
"@geekmidas/events": "^10.0.0-alpha.
|
|
251
|
-
"@geekmidas/logger": "^10.0.0-alpha.
|
|
252
|
-
"@geekmidas/manifest": "^10.0.0-alpha.
|
|
253
|
-
"@geekmidas/schema": "^10.0.0-alpha.
|
|
254
|
-
"@geekmidas/services": "^10.0.0-alpha.
|
|
248
|
+
"@geekmidas/envkit": "^10.0.0-alpha.13",
|
|
249
|
+
"@geekmidas/errors": "^10.0.0-alpha.13",
|
|
250
|
+
"@geekmidas/events": "^10.0.0-alpha.13",
|
|
251
|
+
"@geekmidas/logger": "^10.0.0-alpha.13",
|
|
252
|
+
"@geekmidas/manifest": "^10.0.0-alpha.13",
|
|
253
|
+
"@geekmidas/schema": "^10.0.0-alpha.13",
|
|
254
|
+
"@geekmidas/services": "^10.0.0-alpha.13"
|
|
255
255
|
},
|
|
256
256
|
"devDependencies": {
|
|
257
257
|
"@types/lodash.compact": "~3.0.9",
|
|
@@ -266,20 +266,20 @@
|
|
|
266
266
|
"msw": "~2.15.0",
|
|
267
267
|
"pg": "~8.23.0",
|
|
268
268
|
"zod": "~4.6.5",
|
|
269
|
-
"@geekmidas/audit": "^10.0.0-alpha.
|
|
270
|
-
"@geekmidas/auth": "10.0.0-alpha.
|
|
271
|
-
"@geekmidas/cache": "^10.0.0-alpha.
|
|
272
|
-
"@geekmidas/db": "^10.0.0-alpha.
|
|
273
|
-
"@geekmidas/emailkit": "^10.0.0-alpha.
|
|
274
|
-
"@geekmidas/envkit": "^10.0.0-alpha.
|
|
275
|
-
"@geekmidas/errors": "^10.0.0-alpha.
|
|
276
|
-
"@geekmidas/events": "^10.0.0-alpha.
|
|
277
|
-
"@geekmidas/logger": "^10.0.0-alpha.
|
|
278
|
-
"@geekmidas/rate-limit": "^10.0.0-alpha.
|
|
279
|
-
"@geekmidas/schema": "^10.0.0-alpha.
|
|
280
|
-
"@geekmidas/services": "^10.0.0-alpha.
|
|
281
|
-
"@geekmidas/telescope": "10.0.0-alpha.
|
|
282
|
-
"@geekmidas/testkit": "^10.0.0-alpha.
|
|
269
|
+
"@geekmidas/audit": "^10.0.0-alpha.13",
|
|
270
|
+
"@geekmidas/auth": "10.0.0-alpha.13",
|
|
271
|
+
"@geekmidas/cache": "^10.0.0-alpha.13",
|
|
272
|
+
"@geekmidas/db": "^10.0.0-alpha.13",
|
|
273
|
+
"@geekmidas/emailkit": "^10.0.0-alpha.13",
|
|
274
|
+
"@geekmidas/envkit": "^10.0.0-alpha.13",
|
|
275
|
+
"@geekmidas/errors": "^10.0.0-alpha.13",
|
|
276
|
+
"@geekmidas/events": "^10.0.0-alpha.13",
|
|
277
|
+
"@geekmidas/logger": "^10.0.0-alpha.13",
|
|
278
|
+
"@geekmidas/rate-limit": "^10.0.0-alpha.13",
|
|
279
|
+
"@geekmidas/schema": "^10.0.0-alpha.13",
|
|
280
|
+
"@geekmidas/services": "^10.0.0-alpha.13",
|
|
281
|
+
"@geekmidas/telescope": "10.0.0-alpha.13",
|
|
282
|
+
"@geekmidas/testkit": "^10.0.0-alpha.13"
|
|
283
283
|
},
|
|
284
284
|
"peerDependencies": {
|
|
285
285
|
"@middy/core": ">=7.9.2",
|
|
@@ -289,14 +289,14 @@
|
|
|
289
289
|
"kysely": "~0.29.6",
|
|
290
290
|
"msw": ">=2.15.0",
|
|
291
291
|
"pg": ">=8.23.0",
|
|
292
|
-
"@geekmidas/audit": "^10.0.0-alpha.
|
|
293
|
-
"@geekmidas/auth": "10.0.0-alpha.
|
|
294
|
-
"@geekmidas/cache": "^10.0.0-alpha.
|
|
295
|
-
"@geekmidas/db": "^10.0.0-alpha.
|
|
296
|
-
"@geekmidas/emailkit": "^10.0.0-alpha.
|
|
297
|
-
"@geekmidas/rate-limit": "^10.0.0-alpha.
|
|
298
|
-
"@geekmidas/storage": "^10.0.0-alpha.
|
|
299
|
-
"@geekmidas/telescope": "10.0.0-alpha.
|
|
292
|
+
"@geekmidas/audit": "^10.0.0-alpha.13",
|
|
293
|
+
"@geekmidas/auth": "10.0.0-alpha.13",
|
|
294
|
+
"@geekmidas/cache": "^10.0.0-alpha.13",
|
|
295
|
+
"@geekmidas/db": "^10.0.0-alpha.13",
|
|
296
|
+
"@geekmidas/emailkit": "^10.0.0-alpha.13",
|
|
297
|
+
"@geekmidas/rate-limit": "^10.0.0-alpha.13",
|
|
298
|
+
"@geekmidas/storage": "^10.0.0-alpha.13",
|
|
299
|
+
"@geekmidas/telescope": "10.0.0-alpha.13"
|
|
300
300
|
},
|
|
301
301
|
"peerDependenciesMeta": {
|
|
302
302
|
"@geekmidas/audit": {
|