@geekmidas/cli 10.0.0-alpha.167 → 10.0.0-alpha.168
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/{EndpointGenerator-DxrRqfJ3.cjs → EndpointGenerator-C1h_wExz.cjs} +2 -2
- package/dist/{EndpointGenerator-DxrRqfJ3.cjs.map → EndpointGenerator-C1h_wExz.cjs.map} +1 -1
- package/dist/{EndpointGenerator-B5BKAoLz.mjs → EndpointGenerator-CSKhAD6W.mjs} +2 -2
- package/dist/{EndpointGenerator-B5BKAoLz.mjs.map → EndpointGenerator-CSKhAD6W.mjs.map} +1 -1
- package/dist/{GoDaddyProvider-Dci0SlN5.mjs → GoDaddyProvider-CJIYlkUN.mjs} +2 -2
- package/dist/{GoDaddyProvider-Dci0SlN5.mjs.map → GoDaddyProvider-CJIYlkUN.mjs.map} +1 -1
- package/dist/{GoDaddyProvider-o6DJAsBZ.cjs → GoDaddyProvider-CYAlIeML.cjs} +2 -2
- package/dist/{GoDaddyProvider-o6DJAsBZ.cjs.map → GoDaddyProvider-CYAlIeML.cjs.map} +1 -1
- package/dist/{HostingerProvider-BzHPhONW.cjs → HostingerProvider-Ceqc_nlG.cjs} +2 -2
- package/dist/{HostingerProvider-BzHPhONW.cjs.map → HostingerProvider-Ceqc_nlG.cjs.map} +1 -1
- package/dist/{HostingerProvider-Dd5x1zvF.mjs → HostingerProvider-Tb0bnTpM.mjs} +2 -2
- package/dist/{HostingerProvider-Dd5x1zvF.mjs.map → HostingerProvider-Tb0bnTpM.mjs.map} +1 -1
- package/dist/{LegacyStateStore-tqY0hM8z.cjs → LegacyStateStore-Ci-CRqt2.cjs} +2 -2
- package/dist/{LegacyStateStore-tqY0hM8z.cjs.map → LegacyStateStore-Ci-CRqt2.cjs.map} +1 -1
- package/dist/{LegacyStateStore-CpF6rmZc.mjs → LegacyStateStore-DJWY64Jj.mjs} +2 -2
- package/dist/{LegacyStateStore-CpF6rmZc.mjs.map → LegacyStateStore-DJWY64Jj.mjs.map} +1 -1
- package/dist/{LocalStateStore-Adp96xPy.mjs → LocalStateStore-BFgjv29N.mjs} +2 -2
- package/dist/{LocalStateStore-Adp96xPy.mjs.map → LocalStateStore-BFgjv29N.mjs.map} +1 -1
- package/dist/{LocalStateStore-BYMUEGZN.cjs → LocalStateStore-Enw_wV7d.cjs} +2 -2
- package/dist/{LocalStateStore-BYMUEGZN.cjs.map → LocalStateStore-Enw_wV7d.cjs.map} +1 -1
- package/dist/{OpenApiTsGenerator-Vaf0pI8u.mjs → OpenApiTsGenerator-5xPn-p65.mjs} +2 -2
- package/dist/{OpenApiTsGenerator-Vaf0pI8u.mjs.map → OpenApiTsGenerator-5xPn-p65.mjs.map} +1 -1
- package/dist/{OpenApiTsGenerator-DOTLKBFf.cjs → OpenApiTsGenerator-CzrLGzC0.cjs} +2 -2
- package/dist/{OpenApiTsGenerator-DOTLKBFf.cjs.map → OpenApiTsGenerator-CzrLGzC0.cjs.map} +1 -1
- package/dist/{S3StateStore-DjXyhGIP.cjs → S3StateStore-B48M3z7L.cjs} +4 -4
- package/dist/{S3StateStore-DjXyhGIP.cjs.map → S3StateStore-B48M3z7L.cjs.map} +1 -1
- package/dist/{S3StateStore-13Go3hfM.mjs → S3StateStore-Cwfd-ZnJ.mjs} +4 -4
- package/dist/{S3StateStore-13Go3hfM.mjs.map → S3StateStore-Cwfd-ZnJ.mjs.map} +1 -1
- package/dist/{SSMStateStore-DspMPho-.cjs → SSMStateStore-CuBe-NK5.cjs} +2 -2
- package/dist/{SSMStateStore-DspMPho-.cjs.map → SSMStateStore-CuBe-NK5.cjs.map} +1 -1
- package/dist/{SSMStateStore-CQHUyH-c.mjs → SSMStateStore-DYgE98Sm.mjs} +2 -2
- package/dist/{SSMStateStore-CQHUyH-c.mjs.map → SSMStateStore-DYgE98Sm.mjs.map} +1 -1
- package/dist/{SubscriberGenerator-BybB6uez.mjs → SubscriberGenerator-CfZWX0lT.mjs} +6 -6
- package/dist/SubscriberGenerator-CfZWX0lT.mjs.map +1 -0
- package/dist/{SubscriberGenerator-mZpSuSU7.cjs → SubscriberGenerator-DMi4siph.cjs} +5 -5
- package/dist/SubscriberGenerator-DMi4siph.cjs.map +1 -0
- package/dist/{add-DsxJ0Knr.cjs → add-4AT0LlDK.cjs} +10 -10
- package/dist/add-4AT0LlDK.cjs.map +1 -0
- package/dist/{add-Dt8QKSOw.mjs → add-C85tazt0.mjs} +11 -11
- package/dist/add-C85tazt0.mjs.map +1 -0
- package/dist/{apps-C6s-trVp.cjs → apps-By6pnfzA.cjs} +40 -40
- package/dist/apps-By6pnfzA.cjs.map +1 -0
- package/dist/{apps-w2sRQKCr.mjs → apps-CWGmV2nQ.mjs} +41 -41
- package/dist/apps-CWGmV2nQ.mjs.map +1 -0
- package/dist/{bundler-BCWWne6N.mjs → bundler-B9rkNGpK.mjs} +6 -6
- package/dist/{bundler-BCWWne6N.mjs.map → bundler-B9rkNGpK.mjs.map} +1 -1
- package/dist/{bundler-AzkSRAuu.cjs → bundler-DPBLrtjT.cjs} +6 -6
- package/dist/{bundler-AzkSRAuu.cjs.map → bundler-DPBLrtjT.cjs.map} +1 -1
- package/dist/{cli-OGss08bZ.cjs → cli-BnWRqhwx.cjs} +4 -4
- package/dist/{cli-OGss08bZ.cjs.map → cli-BnWRqhwx.cjs.map} +1 -1
- package/dist/{cli-DSGw0Mw-.mjs → cli-DgL0QED8.mjs} +4 -4
- package/dist/{cli-DSGw0Mw-.mjs.map → cli-DgL0QED8.mjs.map} +1 -1
- package/dist/{compose-QSBmhr4V.cjs → compose-CLM-sqgE.cjs} +11 -11
- package/dist/compose-CLM-sqgE.cjs.map +1 -0
- package/dist/{compose-Csegtvq_.mjs → compose-CcK-QoYU.mjs} +12 -12
- package/dist/compose-CcK-QoYU.mjs.map +1 -0
- package/dist/{compose-RhuFQmZS.mjs → compose-DuRBnjxx.mjs} +9 -9
- package/dist/compose-DuRBnjxx.mjs.map +1 -0
- package/dist/{compose-BqTuzitb.cjs → compose-DwjaxFFK.cjs} +8 -8
- package/dist/compose-DwjaxFFK.cjs.map +1 -0
- package/dist/config.cjs +2 -2
- package/dist/config.mjs +2 -2
- package/dist/{credentialSchemas-mz9QZTYh.mjs → credentialSchemas-BzJiK1nQ.mjs} +4 -4
- package/dist/credentialSchemas-BzJiK1nQ.mjs.map +1 -0
- package/dist/{credentialSchemas-BAklWDna.cjs → credentialSchemas-OVXofU-r.cjs} +3 -3
- package/dist/credentialSchemas-OVXofU-r.cjs.map +1 -0
- package/dist/{credentials-CORvhcrO.cjs → credentials-CCCAy3NL.cjs} +7 -7
- package/dist/{credentials-CORvhcrO.cjs.map → credentials-CCCAy3NL.cjs.map} +1 -1
- package/dist/{credentials-D4DUPPPP.mjs → credentials-CeCOEKP3.mjs} +7 -7
- package/dist/{credentials-D4DUPPPP.mjs.map → credentials-CeCOEKP3.mjs.map} +1 -1
- package/dist/{databases-CrKh5jw6.cjs → databases-CuTL1e7s.cjs} +3 -3
- package/dist/databases-CuTL1e7s.cjs.map +1 -0
- package/dist/{databases-C1qqNxTu.mjs → databases-zN-gEox0.mjs} +4 -4
- package/dist/databases-zN-gEox0.mjs.map +1 -0
- package/dist/deploy/public.cjs +12 -12
- package/dist/deploy/public.d.cts.map +1 -1
- package/dist/deploy/public.d.mts.map +1 -1
- package/dist/deploy/public.mjs +12 -12
- package/dist/{deploy-BwJ7uWXd.cjs → deploy-Dy5jyciI.cjs} +36 -36
- package/dist/deploy-Dy5jyciI.cjs.map +1 -0
- package/dist/{deploy-DDfnQm8l.mjs → deploy-F6GA-u59.mjs} +37 -37
- package/dist/deploy-F6GA-u59.mjs.map +1 -0
- package/dist/{destroy-nTNRfdy6.cjs → destroy-B7-8EgCJ.cjs} +9 -9
- package/dist/{destroy-nTNRfdy6.cjs.map → destroy-B7-8EgCJ.cjs.map} +1 -1
- package/dist/{destroy-DKt8S051.mjs → destroy-Gyxrl5yO.mjs} +9 -9
- package/dist/{destroy-DKt8S051.mjs.map → destroy-Gyxrl5yO.mjs.map} +1 -1
- package/dist/{discover-CRywE7yc.cjs → discover-39VKSE2i.cjs} +5 -5
- package/dist/discover-39VKSE2i.cjs.map +1 -0
- package/dist/{discover-DbDrCQ8h.mjs → discover-B_PDDaVj.mjs} +6 -6
- package/dist/discover-B_PDDaVj.mjs.map +1 -0
- package/dist/{docker-Ele34O8z.mjs → docker-COHyyOkv.mjs} +11 -11
- package/dist/docker-COHyyOkv.mjs.map +1 -0
- package/dist/{docker-Dy1ZJUzV.cjs → docker-CP4bspkW.cjs} +10 -10
- package/dist/docker-CP4bspkW.cjs.map +1 -0
- package/dist/{dokploy-DN2W1YIH.cjs → dokploy-C7ampvzk.cjs} +2 -2
- package/dist/{dokploy-DN2W1YIH.cjs.map → dokploy-C7ampvzk.cjs.map} +1 -1
- package/dist/{dokploy-BrfA2m5K.mjs → dokploy-DBmB9vWu.mjs} +2 -2
- package/dist/{dokploy-BrfA2m5K.mjs.map → dokploy-DBmB9vWu.mjs.map} +1 -1
- package/dist/{eas-BRBdxmwe.cjs → eas-CbnTdz8d.cjs} +3 -3
- package/dist/{eas-BRBdxmwe.cjs.map → eas-CbnTdz8d.cjs.map} +1 -1
- package/dist/{eas-CO3ogve5.mjs → eas-EXRkhGSM.mjs} +3 -3
- package/dist/{eas-CO3ogve5.mjs.map → eas-EXRkhGSM.mjs.map} +1 -1
- package/dist/{encryption-BZ1zgtF5.cjs → encryption-CdDDSAu_.cjs} +4 -4
- package/dist/encryption-CdDDSAu_.cjs.map +1 -0
- package/dist/{encryption-CHmfNBAy.mjs → encryption-lLZV2eMs.mjs} +5 -5
- package/dist/encryption-lLZV2eMs.mjs.map +1 -0
- package/dist/{engine-DewbDHOq.cjs → engine-Cg92m1Xf.cjs} +37 -37
- package/dist/engine-Cg92m1Xf.cjs.map +1 -0
- package/dist/{engine-B3Gmu8-O.mjs → engine-ZzUy2czq.mjs} +38 -38
- package/dist/engine-ZzUy2czq.mjs.map +1 -0
- package/dist/{github-DPNgIxdc.cjs → github-BHqRcUgU.cjs} +8 -8
- package/dist/{github-DPNgIxdc.cjs.map → github-BHqRcUgU.cjs.map} +1 -1
- package/dist/{github-DU3iEmJN.mjs → github-CPpJmNgV.mjs} +8 -8
- package/dist/{github-DU3iEmJN.mjs.map → github-CPpJmNgV.mjs.map} +1 -1
- package/dist/{googlePlay-C2jnPqYn.cjs → googlePlay-DRz0ya3q.cjs} +4 -4
- package/dist/{googlePlay-C2jnPqYn.cjs.map → googlePlay-DRz0ya3q.cjs.map} +1 -1
- package/dist/{googlePlay-KPHn9H2f.mjs → googlePlay-Dg-0ASWN.mjs} +4 -4
- package/dist/{googlePlay-KPHn9H2f.mjs.map → googlePlay-Dg-0ASWN.mjs.map} +1 -1
- package/dist/{iam-CW61VcT3.mjs → iam-CLIne3Ny.mjs} +2 -2
- package/dist/{iam-CW61VcT3.mjs.map → iam-CLIne3Ny.mjs.map} +1 -1
- package/dist/{iam-C2sf6AUi.cjs → iam-b4IvC1fm.cjs} +2 -2
- package/dist/{iam-C2sf6AUi.cjs.map → iam-b4IvC1fm.cjs.map} +1 -1
- package/dist/index.cjs +79 -79
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +80 -80
- package/dist/index.mjs.map +1 -1
- package/dist/{local-BxjA0EXj.cjs → local-BIrl0ENw.cjs} +3 -3
- package/dist/{local-BxjA0EXj.cjs.map → local-BIrl0ENw.cjs.map} +1 -1
- package/dist/{local-CwR2DW6i.mjs → local-Cin6exc0.mjs} +3 -3
- package/dist/{local-CwR2DW6i.mjs.map → local-Cin6exc0.mjs.map} +1 -1
- package/dist/{migrate-B0a3WY4X.cjs → migrate-BtkwylxW.cjs} +7 -7
- package/dist/{migrate-B0a3WY4X.cjs.map → migrate-BtkwylxW.cjs.map} +1 -1
- package/dist/{migrate-CYtM1UBH.cjs → migrate-CxI07Ey0.cjs} +3 -3
- package/dist/{migrate-CYtM1UBH.cjs.map → migrate-CxI07Ey0.cjs.map} +1 -1
- package/dist/{migrate-vWy2CUoi.mjs → migrate-DEU8I8sQ.mjs} +7 -7
- package/dist/{migrate-vWy2CUoi.mjs.map → migrate-DEU8I8sQ.mjs.map} +1 -1
- package/dist/{migrate-DHWy64pc.mjs → migrate-DpLMJLCw.mjs} +3 -3
- package/dist/{migrate-DHWy64pc.mjs.map → migrate-DpLMJLCw.mjs.map} +1 -1
- package/dist/{notes-9bOfe08J.mjs → notes-or_kXTal.mjs} +11 -11
- package/dist/notes-or_kXTal.mjs.map +1 -0
- package/dist/{notes-DRdlsCYV.cjs → notes-rTfi6rfN.cjs} +10 -10
- package/dist/notes-rTfi6rfN.cjs.map +1 -0
- package/dist/openapi.cjs +3 -3
- package/dist/openapi.mjs +3 -3
- package/dist/{projectBucket-gIQUuhGm.cjs → projectBucket-CRa1b1Td.cjs} +2 -2
- package/dist/{projectBucket-gIQUuhGm.cjs.map → projectBucket-CRa1b1Td.cjs.map} +1 -1
- package/dist/{projectBucket-Cd7sEDhG.mjs → projectBucket-Coh5K3-g.mjs} +2 -2
- package/dist/{projectBucket-Cd7sEDhG.mjs.map → projectBucket-Coh5K3-g.mjs.map} +1 -1
- package/dist/{publish-DOxz4mxf.mjs → publish-Bwhywmpz.mjs} +2 -2
- package/dist/{publish-DOxz4mxf.mjs.map → publish-Bwhywmpz.mjs.map} +1 -1
- package/dist/{publish-BgDFx08y.cjs → publish-D9Yl4AzW.cjs} +2 -2
- package/dist/{publish-BgDFx08y.cjs.map → publish-D9Yl4AzW.cjs.map} +1 -1
- package/dist/{ready-BjFMu_1J.mjs → ready-COJHr1Yi.mjs} +9 -9
- package/dist/ready-COJHr1Yi.mjs.map +1 -0
- package/dist/{ready-eVMJIcWn.cjs → ready-DcD0SCnV.cjs} +8 -8
- package/dist/ready-DcD0SCnV.cjs.map +1 -0
- package/dist/reconcile/public.cjs +1 -1
- package/dist/reconcile/public.mjs +1 -1
- package/dist/{resolve-CdDyPOE8.mjs → resolve-B9tboVm2.mjs} +4 -4
- package/dist/{resolve-CdDyPOE8.mjs.map → resolve-B9tboVm2.mjs.map} +1 -1
- package/dist/{resolve-BhQd4IkT.cjs → resolve-BrJUFIUu.cjs} +4 -4
- package/dist/{resolve-BhQd4IkT.cjs.map → resolve-BrJUFIUu.cjs.map} +1 -1
- package/dist/{rollback-Brc-_HBJ.cjs → rollback-D48bPMpD.cjs} +7 -7
- package/dist/{rollback-Brc-_HBJ.cjs.map → rollback-D48bPMpD.cjs.map} +1 -1
- package/dist/{rollback-CLBKeSMl.mjs → rollback-M6b0z1tp.mjs} +7 -7
- package/dist/{rollback-CLBKeSMl.mjs.map → rollback-M6b0z1tp.mjs.map} +1 -1
- package/dist/{s3-CuLmr6Q9.cjs → s3-3iS3jlKU.cjs} +3 -3
- package/dist/{s3-CuLmr6Q9.cjs.map → s3-3iS3jlKU.cjs.map} +1 -1
- package/dist/{s3-D0BIG_ml.mjs → s3-CNOSRjqH.mjs} +3 -3
- package/dist/{s3-D0BIG_ml.mjs.map → s3-CNOSRjqH.mjs.map} +1 -1
- package/dist/sandbox/credentials-worker.cjs +2 -2
- package/dist/sandbox/credentials-worker.mjs +2 -2
- package/dist/sandbox/discover-worker.cjs +1 -1
- package/dist/sandbox/discover-worker.mjs +1 -1
- package/dist/sandbox/migrate-worker.cjs +2 -2
- package/dist/sandbox/migrate-worker.mjs +2 -2
- package/dist/{serverSetup-An1fE9nd.mjs → serverSetup-CzLJ_RV0.mjs} +6 -6
- package/dist/{serverSetup-An1fE9nd.mjs.map → serverSetup-CzLJ_RV0.mjs.map} +1 -1
- package/dist/{serverSetup-BMpzrB1y.cjs → serverSetup-DnOdoucM.cjs} +6 -6
- package/dist/{serverSetup-BMpzrB1y.cjs.map → serverSetup-DnOdoucM.cjs.map} +1 -1
- package/dist/{sniffer-9a8wQeeD.cjs → sniffer-C5F7uYQB.cjs} +8 -8
- package/dist/{sniffer-9a8wQeeD.cjs.map → sniffer-C5F7uYQB.cjs.map} +1 -1
- package/dist/{sniffer-BObBXR5q.mjs → sniffer-yeftYpWK.mjs} +8 -8
- package/dist/{sniffer-BObBXR5q.mjs.map → sniffer-yeftYpWK.mjs.map} +1 -1
- package/dist/{snsSubscriptions-oUTOkG-s.mjs → snsSubscriptions-CXRa_bwG.mjs} +3 -3
- package/dist/{snsSubscriptions-oUTOkG-s.mjs.map → snsSubscriptions-CXRa_bwG.mjs.map} +1 -1
- package/dist/{snsSubscriptions-BRmEdsks.cjs → snsSubscriptions-CXwELBil.cjs} +3 -3
- package/dist/{snsSubscriptions-BRmEdsks.cjs.map → snsSubscriptions-CXwELBil.cjs.map} +1 -1
- package/dist/{sst-DVIeKWCH.mjs → sst-BAQrBaGa.mjs} +6 -6
- package/dist/{sst-DVIeKWCH.mjs.map → sst-BAQrBaGa.mjs.map} +1 -1
- package/dist/{sst-CJQI9GYW.cjs → sst-B_srWo15.cjs} +6 -6
- package/dist/{sst-CJQI9GYW.cjs.map → sst-B_srWo15.cjs.map} +1 -1
- package/dist/{stack-2jMvQfLo.cjs → stack-DaJ9D2Uc.cjs} +20 -20
- package/dist/stack-DaJ9D2Uc.cjs.map +1 -0
- package/dist/{stack-kcxH-2tZ.mjs → stack-t2tN1jYo.mjs} +21 -21
- package/dist/stack-t2tN1jYo.mjs.map +1 -0
- package/dist/{stage-BQSSMJL4.mjs → stage-B4gqRg7l.mjs} +7 -7
- package/dist/{stage-BQSSMJL4.mjs.map → stage-B4gqRg7l.mjs.map} +1 -1
- package/dist/{stage-AHgVG7H8.cjs → stage-Clk6oQO_.cjs} +7 -7
- package/dist/{stage-AHgVG7H8.cjs.map → stage-Clk6oQO_.cjs.map} +1 -1
- package/dist/{stages-BsK1Ro4s.mjs → stages-D1rnfO18.mjs} +2 -2
- package/dist/{stages-BsK1Ro4s.mjs.map → stages-D1rnfO18.mjs.map} +1 -1
- package/dist/{stages-DpF2K3PZ.cjs → stages-afi9P-Cd.cjs} +2 -2
- package/dist/{stages-DpF2K3PZ.cjs.map → stages-afi9P-Cd.cjs.map} +1 -1
- package/dist/target/public.cjs +1 -1
- package/dist/target/public.mjs +1 -1
- package/dist/{terminal-DWROY7JE.mjs → terminal-D4kY5oz7.mjs} +3 -3
- package/dist/{terminal-DWROY7JE.mjs.map → terminal-D4kY5oz7.mjs.map} +1 -1
- package/dist/{terminal-BNjNr7BN.cjs → terminal-JAudEZRC.cjs} +3 -3
- package/dist/{terminal-BNjNr7BN.cjs.map → terminal-JAudEZRC.cjs.map} +1 -1
- package/dist/vitest.cjs +1 -1
- package/dist/vitest.mjs +1 -1
- package/dist/workspace/index.cjs +1 -1
- package/dist/workspace/index.mjs +1 -1
- package/dist/{workspace-9q4TSHlM.mjs → workspace-Gubg8xLJ.mjs} +3 -3
- package/dist/workspace-Gubg8xLJ.mjs.map +1 -0
- package/dist/{workspace-Ciw3SnME.cjs → workspace-p7gmCQVS.cjs} +2 -2
- package/dist/workspace-p7gmCQVS.cjs.map +1 -0
- package/package.json +15 -15
- package/dist/SubscriberGenerator-BybB6uez.mjs.map +0 -1
- package/dist/SubscriberGenerator-mZpSuSU7.cjs.map +0 -1
- package/dist/add-DsxJ0Knr.cjs.map +0 -1
- package/dist/add-Dt8QKSOw.mjs.map +0 -1
- package/dist/apps-C6s-trVp.cjs.map +0 -1
- package/dist/apps-w2sRQKCr.mjs.map +0 -1
- package/dist/compose-BqTuzitb.cjs.map +0 -1
- package/dist/compose-Csegtvq_.mjs.map +0 -1
- package/dist/compose-QSBmhr4V.cjs.map +0 -1
- package/dist/compose-RhuFQmZS.mjs.map +0 -1
- package/dist/credentialSchemas-BAklWDna.cjs.map +0 -1
- package/dist/credentialSchemas-mz9QZTYh.mjs.map +0 -1
- package/dist/databases-C1qqNxTu.mjs.map +0 -1
- package/dist/databases-CrKh5jw6.cjs.map +0 -1
- package/dist/deploy-BwJ7uWXd.cjs.map +0 -1
- package/dist/deploy-DDfnQm8l.mjs.map +0 -1
- package/dist/discover-CRywE7yc.cjs.map +0 -1
- package/dist/discover-DbDrCQ8h.mjs.map +0 -1
- package/dist/docker-Dy1ZJUzV.cjs.map +0 -1
- package/dist/docker-Ele34O8z.mjs.map +0 -1
- package/dist/encryption-BZ1zgtF5.cjs.map +0 -1
- package/dist/encryption-CHmfNBAy.mjs.map +0 -1
- package/dist/engine-B3Gmu8-O.mjs.map +0 -1
- package/dist/engine-DewbDHOq.cjs.map +0 -1
- package/dist/notes-9bOfe08J.mjs.map +0 -1
- package/dist/notes-DRdlsCYV.cjs.map +0 -1
- package/dist/ready-BjFMu_1J.mjs.map +0 -1
- package/dist/ready-eVMJIcWn.cjs.map +0 -1
- package/dist/stack-2jMvQfLo.cjs.map +0 -1
- package/dist/stack-kcxH-2tZ.mjs.map +0 -1
- package/dist/workspace-9q4TSHlM.mjs.map +0 -1
- package/dist/workspace-Ciw3SnME.cjs.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"discover-B_PDDaVj.mjs","names":["kebabCase","z.discriminatedUnion","z.object","z.literal","z.record","z.string","z.array","z\n\t\t\t.record","z\n\t\t\t.object"],"sources":["../src/reconcile/edges.ts","../src/output.ts","../src/generators/Generator.ts","../src/sandbox/sandbox.ts","../src/owningTsconfigJsx.ts","../src/sandbox/worker.ts","../src/reconcile/discover.ts"],"sourcesContent":["/**\n * Edges a process records for what its runnables consume, beyond the\n * construct ids `.dependsOn()` names.\n */\n\nimport {\n\ttype ConstructManifest,\n\tcanonicalId,\n\tdependenciesOf,\n\ttype Fn,\n\tprovidedKeyFor,\n} from '@geekmidas/manifest';\n\nconst EVENTS_SUFFIX = '#events';\n\n/**\n * A bucket's events, as an edge: what a process running one of the bucket's\n * subscribers consumes. Not the bucket's id — binding to a bucket's changes\n * is not reading its objects, so the process is handed the events key alone.\n */\nexport function eventsEdge(bucketId: string): string {\n\treturn `${bucketId}${EVENTS_SUFFIX}`;\n}\n\n/** The bucket an events edge names, or nothing for any other edge. */\nexport function eventsEdgeBucket(edge: string): string | undefined {\n\treturn edge.endsWith(EVENTS_SUFFIX)\n\t\t? edge.slice(0, -EVENTS_SUFFIX.length)\n\t\t: undefined;\n}\n\n/**\n * The env key a subscriber's deliveries come from: its topic's publisher\n * connection string, or its bucket's events connection string.\n */\nexport function subscriberConnectionKey(construct: {\n\ttopicName?: string;\n\tbucketName?: string;\n}): string | undefined {\n\tif (construct.bucketName) {\n\t\treturn providedKeyFor(\n\t\t\tcanonicalId(construct.bucketName),\n\t\t\t'objects',\n\t\t\t'eventsConnectionString',\n\t\t);\n\t}\n\tif (construct.topicName) {\n\t\treturn providedKeyFor(\n\t\t\tcanonicalId(construct.topicName),\n\t\t\t'topic',\n\t\t\t'publisherConnectionString',\n\t\t);\n\t}\n\treturn undefined;\n}\n\n/**\n * The key a bucket's relay token is read from, by the process that runs the\n * bucket's subscribers — beside its events connection string.\n */\nexport function subscriberTokenKey(construct: {\n\tbucketName?: string;\n}): string | undefined {\n\treturn construct.bucketName\n\t\t? providedKeyFor(\n\t\t\t\tcanonicalId(construct.bucketName),\n\t\t\t\t'objects',\n\t\t\t\t'eventsToken',\n\t\t\t)\n\t\t: undefined;\n}\n\n/**\n * What a worker's process reaches: the worker's own edges, and those of\n * everything it owns — its crons and functions, its queue consumers and the\n * queue each drains, its subscribers and the topic each is bound to, or the\n * events of the bucket each watches.\n *\n * Read off the manifest: the same nodes every command sees, so `gkm dev`\n * hands a worker what a deploy grants it.\n */\nexport function workerEdges(\n\tmanifest: ConstructManifest,\n\tworkerId: string,\n): string[] {\n\tconst worker = manifest[workerId];\n\tif (worker?.kind !== 'worker') return [];\n\n\tconst edges = dependenciesOf(worker).map((edge) => edge.target);\n\tconst owned = (fn: Fn | undefined, consumed?: string) => {\n\t\tif (fn?.owner !== workerId) return;\n\t\tedges.push(...fn.dependencies.map((edge) => edge.target));\n\t\tif (consumed) edges.push(consumed);\n\t};\n\n\tfor (const declaration of Object.values(manifest)) {\n\t\tswitch (declaration.kind) {\n\t\t\tcase 'cron':\n\t\t\tcase 'function':\n\t\t\t\towned(declaration);\n\t\t\t\tbreak;\n\t\t\tcase 'queue':\n\t\t\t\towned(declaration.worker, declaration.id);\n\t\t\t\tbreak;\n\t\t\tcase 'topic':\n\t\t\t\tfor (const s of declaration.subscribers) owned(s, declaration.id);\n\t\t\t\tbreak;\n\t\t\tcase 'objects':\n\t\t\t\tfor (const s of declaration.subscribers ?? []) {\n\t\t\t\t\towned(s, eventsEdge(declaration.id));\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t}\n\t}\n\n\treturn [...new Set(edges)];\n}\n","/**\n * Where the CLI's progress lines go.\n *\n * Commands write their progress through `output` rather than `console`. Run\n * from the terminal that is the same thing. Run inside `deploy()`, each line\n * goes to the run that wrote it instead — as an event its caller can iterate,\n * and to the logger it was handed — so a deploy embedded in another program\n * does not print over that program's own output.\n *\n * Carried by `AsyncLocalStorage` rather than passed down, because the lines\n * come from everywhere a deploy reaches — the Dockerfile generator, the env\n * sniffer, construct discovery — and two deploys running in one process must\n * not hear each other.\n */\n\nimport { AsyncLocalStorage } from 'node:async_hooks';\nimport { format } from 'node:util';\n\n/** How loud a line is. */\nexport type OutputLevel = 'info' | 'warn' | 'error';\n\n/** Receives each line written while it is the current sink. */\nexport type OutputSink = (level: OutputLevel, message: string) => void;\n\nconst current = new AsyncLocalStorage<OutputSink>();\n\n/** Runs `fn` with every line written through `output` sent to `sink`. */\nexport function withOutput<T>(sink: OutputSink, fn: () => T): T {\n\treturn current.run(sink, fn);\n}\n\nfunction write(\n\tlevel: OutputLevel,\n\tfallback: (...args: unknown[]) => void,\n): (...args: unknown[]) => void {\n\treturn (...args) => {\n\t\tconst sink = current.getStore();\n\t\tif (sink) sink(level, format(...args));\n\t\telse fallback(...args);\n\t};\n}\n\n/**\n * `console`, for the methods the CLI logs through — routed to the current\n * run's sink when there is one.\n */\nexport const output = {\n\tlog: write('info', (...args) => console.log(...args)),\n\tinfo: write('info', (...args) => console.info(...args)),\n\twarn: write('warn', (...args) => console.warn(...args)),\n\terror: write('error', (...args) => console.error(...args)),\n};\n","import { relative } from 'node:path';\nimport type { Construct } from '@geekmidas/constructs';\nimport fg from 'fast-glob';\nimport kebabCase from 'lodash.kebabcase';\nimport type { BuildContext } from '../build/types';\nimport type { MainProvider, Routes } from '../types';\n\n/**\n * Zod v4 maintains a process-wide registry of schemas registered via\n * `.meta({ id })`. When we cache-bust user module imports (by appending a\n * `?t=timestamp` query), those modules re-execute and try to register the\n * same ids again, which throws `ID X already exists in the registry`.\n *\n * Clearing the registry in the CLI process is safe: the user's running\n * server lives in a subprocess and has its own isolated registry.\n *\n * Exported for tests.\n */\nexport function clearZodGlobalRegistry(): void {\n\tconst registry = (\n\t\tglobalThis as { __zod_globalRegistry?: { clear?: () => void } }\n\t).__zod_globalRegistry;\n\tif (registry && typeof registry.clear === 'function') {\n\t\tregistry.clear();\n\t}\n}\n\nexport interface GeneratorOptions {\n\t/** Where the build deploys: one Lambda per construct, or one process. */\n\ttarget?: MainProvider;\n\t/**\n\t * What a handler path in the manifest is relative to — the workspace root,\n\t * which is where `sst.config.ts` runs and resolves it from.\n\t */\n\troot?: string;\n\t[key: string]: any;\n}\n\nexport abstract class ConstructGenerator<T extends Construct, R = void> {\n\tabstract isConstruct(value: any): value is T;\n\n\tstatic async build<T extends Construct, R = void>(\n\t\tcontext: BuildContext,\n\t\toutputDir: string,\n\t\tgenerator: ConstructGenerator<T, R>,\n\t\tpatterns?: Routes,\n\t\toptions?: GeneratorOptions,\n\t): Promise<R> {\n\t\tconst constructs = await generator.load(patterns);\n\t\treturn generator.build(context, constructs, outputDir, options);\n\t}\n\n\tabstract build(\n\t\tcontext: BuildContext,\n\t\tconstructs: GeneratedConstruct<T>[],\n\t\toutputDir: string,\n\t\toptions?: GeneratorOptions,\n\t): Promise<R>;\n\n\tasync load(\n\t\tpatterns?: Routes,\n\t\tcwd = process.cwd(),\n\t\tbustCache = false,\n\t): Promise<GeneratedConstruct<T>[]> {\n\t\tconst logger = console;\n\n\t\tconst globPatterns = Array.isArray(patterns)\n\t\t\t? patterns\n\t\t\t: patterns\n\t\t\t\t? [patterns]\n\t\t\t\t: [];\n\n\t\t// Find all files\n\t\tconst files = fg.stream(globPatterns, {\n\t\t\tcwd,\n\t\t\tabsolute: true,\n\t\t});\n\n\t\t// Cache-busted re-imports re-execute user modules, which would try to\n\t\t// re-register Zod schemas with the same `.meta({ id })`. Clear the\n\t\t// global registry once per load to prevent duplicate-id errors.\n\t\tif (bustCache) {\n\t\t\tclearZodGlobalRegistry();\n\t\t}\n\n\t\t// Load constructs\n\t\tconst constructs: GeneratedConstruct<T>[] = [];\n\n\t\tfor await (const f of files) {\n\t\t\ttry {\n\t\t\t\tconst file = f.toString();\n\t\t\t\t// Append cache-busting query param to force re-import of changed modules\n\t\t\t\tconst importPath = bustCache ? `${file}?t=${Date.now()}` : file;\n\t\t\t\tconst module = await import(importPath);\n\n\t\t\t\t// Check all exports for constructs\n\t\t\t\tfor (const [key, construct] of Object.entries(module)) {\n\t\t\t\t\tif (this.isConstruct(construct)) {\n\t\t\t\t\t\tconstructs.push({\n\t\t\t\t\t\t\tkey,\n\t\t\t\t\t\t\tname: kebabCase(key),\n\t\t\t\t\t\t\tconstruct,\n\t\t\t\t\t\t\tpath: {\n\t\t\t\t\t\t\t\tabsolute: file,\n\t\t\t\t\t\t\t\trelative: relative(process.cwd(), file),\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} catch (error) {\n\t\t\t\tconst err = error as Error;\n\t\t\t\tlogger.error(`Failed to load ${f}: ${err.message}`);\n\t\t\t\tif (err.stack) {\n\t\t\t\t\tlogger.error(err.stack);\n\t\t\t\t}\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t}\n\n\t\treturn constructs;\n\t}\n}\n\nexport interface GeneratedConstruct<T extends Construct> {\n\tkey: string;\n\tname: string;\n\tconstruct: T;\n\tpath: {\n\t\tabsolute: string;\n\t\trelative: string;\n\t};\n}\n","/**\n * Where a deploy runs the project's own code.\n *\n * A deploy holds credentials — Dokploy's token, a registry login, an AWS key —\n * and loading `gkm.config.ts`, sniffing an app's environment and building it\n * all execute code from the repository being deployed. On a developer's own\n * laptop that is the developer's code. On a CI job for a fork, or a shared\n * build runner, it is not, and that code should not be able to read the\n * credentials used to deploy it, hang the deploy, or reach outside the\n * checkout.\n *\n * So every step that runs project code goes through a `Sandbox`: one call,\n * with an argument array rather than a shell line, the complete environment\n * the step needs rather than the host's, a timeout it cannot outlive, secrets\n * as files rather than variables, and a working directory inside the project.\n * The steps that need credentials — provisioning, pushing, releasing — are\n * the deploy's own code and never run in one.\n *\n * `LocalSandbox` is the default: a child process on this machine with an\n * allowlisted environment. A host that builds repositories it does not trust\n * passes its own — a container per build, a VM — through `deploy()`'s\n * `sandbox`.\n */\n\nimport { AsyncLocalStorage } from 'node:async_hooks';\nimport { existsSync, realpathSync } from 'node:fs';\nimport { isAbsolute, relative, resolve, sep } from 'node:path';\nimport { GkmError } from '../errors';\n\n/** Where a command's output goes. */\nexport type SandboxOutput = 'capture' | 'inherit' | 'stderr' | 'ignore';\n\nexport interface SandboxExecOptions {\n\t/**\n\t * Where the command runs: the project root or a directory below it, as an\n\t * absolute path or relative to the root. Anywhere else is refused with\n\t * {@link SandboxCwdEscape}.\n\t */\n\tcwd: string;\n\t/**\n\t * The command's whole environment. Nothing of the host's is added to it:\n\t * start from {@link Sandbox.env} and add what the step needs.\n\t */\n\tenv: Readonly<Record<string, string>>;\n\t/**\n\t * How long the command may run before it is killed. Required: a step that\n\t * waits forever — a sniffed entry that opens a server, a build stuck on a\n\t * prompt — would otherwise hold the deploy, and its lock, forever.\n\t */\n\ttimeoutMs: number;\n\t/**\n\t * Files the command can read, by name. Mounted in a directory of their own\n\t * — named by `GKM_SECRETS_DIR` in the command's environment — and removed\n\t * when it exits. Never set as variables, which every child inherits, a\n\t * crash report prints and `/proc/<pid>/environ` shows.\n\t */\n\tsecrets?: Readonly<Record<string, string>>;\n\t/**\n\t * `capture` (the default) returns stdout and stderr in the result;\n\t * `inherit` gives the command the host's terminal; `stderr` sends both\n\t * streams to the host's stderr; `ignore` discards them.\n\t */\n\toutput?: SandboxOutput;\n\t/** Kills the command when aborted; `exec` rejects with the signal's reason. */\n\tsignal?: AbortSignal;\n}\n\n/** How a command ended. A non-zero exit is a result, not an error. */\nexport interface SandboxResult {\n\texitCode: number | null;\n\tsignal: string | null;\n\t/** What it wrote to stdout, when its output was captured. */\n\tstdout: string;\n\t/** What it wrote to stderr, when its output was captured. */\n\tstderr: string;\n}\n\n/**\n * Runs a command against the project, and nothing else of the host's.\n *\n * `exec` resolves with the result however the command exited. It rejects\n * with {@link CommandTimedOut} once the timeout passes — after the command is\n * gone — with {@link SandboxCwdEscape} for a directory outside the project,\n * with the signal's reason when aborted, and with the spawn error when the\n * program cannot be started.\n */\nexport interface Sandbox {\n\t/** The project: the directory every command runs at or below. */\n\treadonly root: string;\n\t/**\n\t * Whether the code it runs is kept from the host: its files, its\n\t * processes, its memory.\n\t *\n\t * An isolating sandbox shares nothing but what crosses `exec`, so a config\n\t * reaches the deploy as data — a live object in it (a custom state store,\n\t * an inline target) cannot cross, and is refused with\n\t * `ConfigObjectNotSerializable`. A non-isolating one, like\n\t * {@link LocalSandbox}, runs on the host as the host's user; a project\n\t * whose config holds live objects is then loaded in-process as before,\n\t * because a project trusted to run there is trusted to do that.\n\t */\n\treadonly isolating: boolean;\n\t/**\n\t * The environment a command starts from: what any program needs to run\n\t * here — `PATH`, `HOME`, the locale — and no credential.\n\t */\n\treadonly env: Readonly<Record<string, string>>;\n\texec(\n\t\tcommand: string,\n\t\targs: readonly string[],\n\t\toptions: SandboxExecOptions,\n\t): Promise<SandboxResult>;\n}\n\n/** The variable naming the directory a command's secrets are mounted in. */\nexport const SECRETS_DIR_ENV = 'GKM_SECRETS_DIR';\n\n/** A command was asked to run outside the project. */\nexport class SandboxCwdEscape extends GkmError {\n\tconstructor(\n\t\treadonly cwd: string,\n\t\treadonly root: string,\n\t) {\n\t\tsuper(\n\t\t\t`Refusing to run in '${cwd}': it is outside the project at '${root}'. ` +\n\t\t\t\t'A sandboxed step only runs inside the project it was given — check ' +\n\t\t\t\t'the app paths in gkm.config.ts for `..` or an absolute path.',\n\t\t);\n\t\tthis.name = 'SandboxCwdEscape';\n\t}\n}\n\n/** A path with its symlinks resolved where it exists — `/tmp` is `/private/tmp`. */\nfunction real(path: string): string {\n\treturn existsSync(path) ? realpathSync(path) : path;\n}\n\n/**\n * `cwd` as an absolute directory inside `root`, or {@link SandboxCwdEscape}.\n *\n * Symlinks are resolved on both sides first, so a link inside the project\n * that points out of it is an escape, and a project reached through a link\n * (`/tmp` on macOS) is still itself. For a sandbox of a host's own to call\n * before it runs anything.\n */\nexport function confineCwd(root: string, cwd: string): string {\n\tconst absolute = resolve(root, cwd);\n\tconst from = relative(real(resolve(root)), real(absolute));\n\tif (from === '..' || from.startsWith(`..${sep}`) || isAbsolute(from)) {\n\t\tthrow new SandboxCwdEscape(cwd, root);\n\t}\n\treturn absolute;\n}\n\n/** A secret's file name: one path segment, so it cannot be written elsewhere. */\nexport class SecretNameInvalid extends GkmError {\n\tconstructor(readonly secretName: string) {\n\t\tsuper(\n\t\t\t`'${secretName}' cannot be a secret's name: it becomes a file name in ` +\n\t\t\t\t'the secrets directory, so it must be one segment of letters, digits, ' +\n\t\t\t\t\"'.', '-' or '_' and not start with '.'.\",\n\t\t);\n\t\tthis.name = 'SecretNameInvalid';\n\t}\n}\n\nconst SECRET_NAME = /^[A-Za-z0-9_-][A-Za-z0-9._-]*$/;\n\n/** Every secret name, checked before anything is written. */\nexport function assertSecretNames(\n\tsecrets: Readonly<Record<string, string>> | undefined,\n): void {\n\tfor (const name of Object.keys(secrets ?? {})) {\n\t\tif (!SECRET_NAME.test(name)) throw new SecretNameInvalid(name);\n\t}\n}\n\n/** A run's sandbox, and what its workers already answered. */\ninterface SandboxRun {\n\tsandbox: Sandbox;\n\tanswers: Map<string, Promise<unknown>>;\n}\n\nconst active = new AsyncLocalStorage<SandboxRun>();\n\n/**\n * Run `fn` with `sandbox` as the one its steps use.\n *\n * Per run rather than global, as `withOutput` routes a run's lines: two\n * deploys in one host process each build in their own sandbox. A step deep in\n * the engine — discovering constructs, sniffing an app — asks\n * {@link activeSandbox} rather than every function between `deploy()` and it\n * taking one more parameter.\n */\nexport function withSandbox<T>(sandbox: Sandbox, fn: () => T): T {\n\treturn active.run({ sandbox, answers: new Map() }, fn);\n}\n\n/** The sandbox of the run this is part of, if it was started with one. */\nexport function activeSandbox(): Sandbox | undefined {\n\treturn active.getStore()?.sandbox;\n}\n\n/**\n * `ask()`'s answer, asked once per run.\n *\n * A deploy loads its config and discovers its constructs from several places\n * — the first load, the engine, the Dockerfile generator — and in a sandbox\n * each was a child process of its own, for the same answer: the checkout does\n * not change while it deploys. Within a run in `sandbox`, the first answer\n * for `key` is the one every later ask gets. Outside one, or for another\n * sandbox, `ask()` runs each time.\n */\nexport function oncePerRun<T>(\n\tsandbox: Sandbox,\n\tkey: string,\n\task: () => Promise<T>,\n): Promise<T> {\n\tconst run = active.getStore();\n\tif (!run || run.sandbox !== sandbox) return ask();\n\n\tlet answer = run.answers.get(key) as Promise<T> | undefined;\n\tif (!answer) {\n\t\tanswer = ask();\n\t\trun.answers.set(key, answer);\n\t\t// A failure is not remembered: the next ask tries again.\n\t\tanswer.catch(() => run.answers.delete(key));\n\t}\n\treturn answer;\n}\n","import { existsSync } from 'node:fs';\nimport { dirname, join } from 'node:path';\nimport { fileURLToPath, pathToFileURL } from 'node:url';\n\nconst REGISTER = 'owning-tsconfig-jsx-register.mjs';\n\n/** The CLI's `bin/` was not found above the module looking for it. */\nexport class OwningTsconfigJsxHookMissing extends Error {\n\tconstructor(readonly from: string) {\n\t\tsuper(\n\t\t\t`Could not find bin/${REGISTER} in any directory above '${from}'. ` +\n\t\t\t\t'It ships with @geekmidas/cli beside bin/gkm.mjs; reinstall the ' +\n\t\t\t\t'package if it is missing.',\n\t\t);\n\t\tthis.name = 'OwningTsconfigJsxHookMissing';\n\t}\n}\n\n/**\n * The CLI's `bin/owning-tsconfig-jsx-register.mjs`, as a file URL. Searched\n * upward because this module runs from `src/` in the repo and from a chunk in\n * `dist/` once built, and `bin/` sits beside both.\n */\nfunction registerUrl(): string {\n\tconst from = dirname(fileURLToPath(import.meta.url));\n\tfor (let dir = from; ; dir = dirname(dir)) {\n\t\tconst candidate = join(dir, 'bin', REGISTER);\n\t\tif (existsSync(candidate)) return pathToFileURL(candidate).href;\n\t\tif (dirname(dir) === dir) throw new OwningTsconfigJsxHookMissing(from);\n\t}\n}\n\n/**\n * `NODE_OPTIONS` for a process that runs app code through tsx, with the hook\n * that compiles each `.tsx` with its own tsconfig's JSX settings (see\n * `bin/owning-tsconfig-jsx.mjs`) put in front of every other `--import`, so it\n * is registered before tsx and reads the source on tsx's behalf.\n *\n * `bin/gkm.mjs` already starts the CLI this way, and its children inherit it;\n * this is for those that set `NODE_OPTIONS` themselves, or whose CLI was\n * started with tsx already imported.\n */\nexport function withOwningTsconfigJsx(nodeOptions = ''): string {\n\tif (nodeOptions.includes(REGISTER)) return nodeOptions;\n\treturn [`--import=${registerUrl()}`, nodeOptions].filter(Boolean).join(' ');\n}\n","/**\n * Running one of the CLI's own worker scripts inside a sandbox, and reading\n * back the one JSON value it answers with.\n *\n * The worker imports the project's TypeScript — `gkm.config.ts`, construct\n * modules, an app's entry — so it starts with the CLI's own tsx and the two\n * hooks `gkm` itself runs with (JSX by the owning tsconfig, path aliases by\n * the adjacent one). The host process needs none of them loaded: a program\n * calling `deploy()` without `--import tsx` still loads a TypeScript config.\n */\n\nimport { existsSync } from 'node:fs';\nimport { createRequire } from 'node:module';\nimport { dirname, join } from 'node:path';\nimport { fileURLToPath, pathToFileURL } from 'node:url';\nimport type { z } from 'zod';\nimport { withOwningTsconfigJsx } from '../owningTsconfigJsx';\nimport { oncePerRun, type Sandbox } from './sandbox';\nimport { WORKER_RESULT_MARKER } from './workerRuntime';\n\nconst here = dirname(fileURLToPath(import.meta.url));\n\n/**\n * A worker's file: `dist/sandbox/<name>.mjs` once built — whether this module\n * was bundled into `dist/` or sits beside it — or the `.ts` source under tsx.\n */\nexport function workerFile(name: string): string {\n\tconst candidates = [\n\t\tjoin(here, 'sandbox', `${name}.mjs`),\n\t\tjoin(here, `${name}.mjs`),\n\t\tjoin(here, '..', 'sandbox', `${name}.mjs`),\n\t\tjoin(here, `${name}.ts`),\n\t];\n\treturn (\n\t\tcandidates.find((path) => existsSync(path)) ?? join(here, `${name}.ts`)\n\t);\n}\n\n/** tsx, from the CLI's own dependencies — never the project's. */\nexport function tsxUrl(): string {\n\treturn pathToFileURL(createRequire(import.meta.url).resolve('tsx')).href;\n}\n\n/**\n * `node`'s arguments for `script`: the CLI's TypeScript loaders, then any\n * further `imports`, then the script and its `args` — an argument array, so\n * nothing about a path is read by a shell.\n */\nexport function nodeWithTsx(\n\tscript: string,\n\targs: readonly string[],\n\timports: readonly string[] = [],\n): string[] {\n\treturn [\n\t\t...withOwningTsconfigJsx(`--import=${tsxUrl()}`).split(' '),\n\t\t...imports.map((path) => `--import=${pathToFileURL(path).href}`),\n\t\tscript,\n\t\t...args,\n\t];\n}\n\n/** A worker ended without the answer it exists to give. */\nexport class SandboxWorkerFailed extends Error {\n\tconstructor(\n\t\treadonly step: string,\n\t\treadonly exitCode: number | null,\n\t\treadonly stderr: string,\n\t) {\n\t\tsuper(\n\t\t\t`The sandboxed ${step} ended (exit code ${exitCode}) without an ` +\n\t\t\t\t`answer.${stderr.trim() ? `\\n${stderr.trim()}` : ''}\\nIts output ` +\n\t\t\t\t'above says why; the sandbox must be able to run `node` with the ' +\n\t\t\t\t\"CLI's own files at the paths they have here.\",\n\t\t);\n\t\tthis.name = 'SandboxWorkerFailed';\n\t}\n}\n\nexport interface WorkerRun<T> {\n\t/** What the worker answered, as the schema reads it. */\n\tvalue: T;\n\t/** What it wrote to stderr: warnings a caller may pass on. */\n\tstderr: string;\n}\n\n/**\n * Run worker `name` in `sandbox`, and parse its answer with `schema`.\n *\n * The answer is the last marked line on stdout. Anything else the project's\n * code printed is ignored, and an answer the schema refuses is a failure\n * rather than data — a worker in an isolating sandbox runs code the host does\n * not trust.\n *\n * Within a run (`withSandbox`), the same worker asked the same question is\n * started once; every ask gets its own copy of the answer, and its stderr, as\n * though it had run again.\n */\nexport async function runWorker<S extends z.ZodType>(\n\tsandbox: Sandbox,\n\tstep: string,\n\toptions: WorkerOptions<S>,\n): Promise<WorkerRun<z.infer<S>>> {\n\t// A step handed secrets acts on something — a database it migrates — and\n\t// is not a question whose answer can be reused; nor do its secrets belong\n\t// in a cache key.\n\tif (options.secrets) return startWorker(sandbox, step, options);\n\n\tconst key = JSON.stringify([\n\t\toptions.name,\n\t\toptions.cwd,\n\t\toptions.args,\n\t\toptions.env ?? {},\n\t]);\n\tconst answer = await oncePerRun(sandbox, key, () =>\n\t\tstartWorker(sandbox, step, options),\n\t);\n\treturn structuredClone(answer);\n}\n\ninterface WorkerOptions<S extends z.ZodType> {\n\tname: string;\n\targs: readonly string[];\n\tcwd: string;\n\ttimeoutMs: number;\n\tenv?: Readonly<Record<string, string>>;\n\t/** Mounted as files, named by `GKM_SECRETS_DIR` — never variables. */\n\tsecrets?: Readonly<Record<string, string>>;\n\tsignal?: AbortSignal;\n\tschema: S;\n}\n\nasync function startWorker<S extends z.ZodType>(\n\tsandbox: Sandbox,\n\tstep: string,\n\toptions: WorkerOptions<S>,\n): Promise<WorkerRun<z.infer<S>>> {\n\tconst result = await sandbox.exec(\n\t\t'node',\n\t\tnodeWithTsx(workerFile(options.name), options.args),\n\t\t{\n\t\t\tcwd: options.cwd,\n\t\t\tenv: { ...sandbox.env, ...options.env },\n\t\t\ttimeoutMs: options.timeoutMs,\n\t\t\toutput: 'capture',\n\t\t\t...(options.secrets ? { secrets: options.secrets } : {}),\n\t\t\t...(options.signal ? { signal: options.signal } : {}),\n\t\t},\n\t);\n\n\tconst line = result.stdout\n\t\t.split('\\n')\n\t\t.reverse()\n\t\t.find((l) => l.startsWith(WORKER_RESULT_MARKER));\n\tif (line) {\n\t\ttry {\n\t\t\tconst parsed = options.schema.safeParse(\n\t\t\t\tJSON.parse(line.slice(WORKER_RESULT_MARKER.length)),\n\t\t\t);\n\t\t\tif (parsed.success) return { value: parsed.data, stderr: result.stderr };\n\t\t} catch {\n\t\t\t// Not JSON: as good as no answer.\n\t\t}\n\t}\n\n\tthrow new SandboxWorkerFailed(step, result.exitCode, result.stderr);\n}\n","/**\n * Discovery — one glob, one structural test.\n *\n * A glob per kind is the same specialness the construct model removes, and\n * resources have no kind to be listed under: a declared `ObjectStorage` would\n * never be found by `routes:` or `crons:`. So there is one `constructs` glob,\n * every export of every matching module is inspected, and the per-kind\n * `isConstruct` checks collapse into a single question — does it have an id and\n * can it declare?\n *\n * Structural rather than `instanceof` on purpose. A construct from a different\n * copy of `@geekmidas/constructs` — a linked workspace, two versions in a\n * lockfile — is still a construct, and `instanceof` is exactly the check that\n * says otherwise.\n */\n\nimport { relative } from 'node:path';\nimport { Cron } from '@geekmidas/constructs/crons';\nimport { Endpoint } from '@geekmidas/constructs/endpoints';\nimport { Function } from '@geekmidas/constructs/functions';\nimport { Processor } from '@geekmidas/constructs/processors';\nimport { Queue } from '@geekmidas/constructs/queue';\nimport { Subscriber } from '@geekmidas/constructs/subscribers';\nimport { WebSocketRoute } from '@geekmidas/constructs/websocket-api';\nimport {\n\tassertDerivations,\n\ttype ConstructManifest,\n\tcanonicalId,\n\ttype Declaration,\n\ttype Dependency,\n\ttype ProcessorDeclaration,\n\tprovidedKeyFor,\n} from '@geekmidas/manifest';\nimport fg from 'fast-glob';\nimport { z } from 'zod';\nimport { GkmError } from '../errors';\nimport { clearZodGlobalRegistry } from '../generators/Generator';\nimport { output } from '../output';\nimport { activeSandbox, type Sandbox } from '../sandbox/sandbox';\nimport { runWorker } from '../sandbox/worker';\nimport { subscriberConnectionKey } from './edges';\n\n/** `console`, or the deploy run discovering the manifest. */\nconst logger = output;\n\n/** The construct face discovery needs: an id, and the ability to declare. */\ninterface Declarable {\n\tid: string;\n\tdeclare(): Declaration[];\n}\n\n/**\n * Whether a module export is a construct.\n *\n * Deliberately loose about what else it carries — a construct that also has a\n * `service` is still a construct, and requiring one would exclude the kinds that\n * own no address.\n */\nexport function isDeclarable(value: unknown): value is Declarable {\n\tif (typeof value !== 'object' || value === null) return false;\n\n\tconst candidate = value as Partial<Declarable>;\n\n\treturn (\n\t\ttypeof candidate.id === 'string' &&\n\t\tcandidate.id.length > 0 &&\n\t\ttypeof candidate.declare === 'function'\n\t);\n}\n\nexport interface DiscoverOptions {\n\t/** The glob(s) to search. One pattern, not one per kind. */\n\tpatterns: string | readonly string[];\n\tcwd?: string;\n\t/**\n\t * Re-import changed modules, for the dev watcher.\n\t *\n\t * A single glob makes discovery more central, not less: a new construct file\n\t * has to be picked up on `add`, not only on `change`.\n\t */\n\tbustCache?: boolean;\n\t/**\n\t * Filled in with where each construct was found, when provided.\n\t *\n\t * Discovery is the only thing that knows: it globbed the files and imported\n\t * them. Everything downstream that needs to *write* an import — the build,\n\t * generating a server entry that reads a surface's logger — would otherwise\n\t * have to be told the path in config, which is the string this removes.\n\t *\n\t * An out-parameter rather than a second return value so that every existing\n\t * caller, which wants the manifest and nothing else, is unchanged.\n\t */\n\tsources?: Record<string, ConstructSource>;\n\t/**\n\t * Filled in, when provided, with the files each worker's background work is\n\t * declared in — its crons, queue consumers and topic subscribers — keyed by\n\t * the worker.\n\t *\n\t * What says which app's build carries a worker's entry: the one whose\n\t * directory holds its work. A worker declares no path of its own.\n\t */\n\tbackground?: Record<string, string[]>;\n\t/**\n\t * Filled in, when provided, with the files that export something built\n\t * from each surface — an endpoint, a WebSocket route — keyed by the\n\t * surface. What a surface that serves itself imports its routes from.\n\t */\n\tserved?: Record<string, string[]>;\n\t/**\n\t * Filled in, when provided, with each worker's subscribers — by the export\n\t * a push route is named after, and the key its deliveries come from: its\n\t * topic's, or its bucket's events — keyed by the worker.\n\t *\n\t * What says which worker SNS pushes to, and on which paths: a build bound\n\t * for a server records no subscriber in the manifest, because none has a\n\t * handler of its own there.\n\t */\n\tsubscribers?: Record<string, BoundSubscriber[]>;\n\t/**\n\t * Import the construct modules in this sandbox rather than in this\n\t * process. Defaults to the run's own (`withSandbox`), so a deploy's every\n\t * discovery — the engine's included — happens there; with neither, they\n\t * are imported here, as before.\n\t */\n\tsandbox?: Sandbox;\n}\n\n/** A worker's subscriber — to a topic or to a bucket — as discovery found it. */\nexport interface BoundSubscriber {\n\t/** Its export — what its push route is named after. */\n\tname: string;\n\t/**\n\t * The env key its deliveries come from: its topic's publisher connection\n\t * string, or its bucket's events connection string. An `sns://` value is\n\t * what makes SNS push to it.\n\t */\n\tconnectionKey: string;\n\t/**\n\t * The event types a topic subscriber names — its SNS subscription's filter\n\t * on the `type` attribute the topic's publisher sets. Absent for a\n\t * bucket's subscriber: S3 sets no such attribute, and the subscriber's own\n\t * filter decides.\n\t */\n\tevents?: readonly string[];\n}\n\n/** What the discovery worker answers. Checked: the worker ran project code. */\nconst DiscoverAnswer = z.discriminatedUnion('reason', [\n\tz.object({\n\t\treason: z.literal('discovered'),\n\t\tmanifest: z.record(\n\t\t\tz.string(),\n\t\t\tz.object({ id: z.string(), kind: z.string() }).loose(),\n\t\t),\n\t\tbackground: z.record(z.string(), z.array(z.string())).optional(),\n\t\tsubscribers: z\n\t\t\t.record(\n\t\t\t\tz.string(),\n\t\t\t\tz.array(\n\t\t\t\t\tz.object({\n\t\t\t\t\t\tname: z.string(),\n\t\t\t\t\t\tconnectionKey: z.string(),\n\t\t\t\t\t\tevents: z.array(z.string()).optional(),\n\t\t\t\t\t}),\n\t\t\t\t),\n\t\t\t)\n\t\t\t.optional(),\n\t}),\n\tz.object({ reason: z.literal('live'), paths: z.array(z.string()) }),\n\tz.object({\n\t\treason: z.literal('failed'),\n\t\terror: z\n\t\t\t.object({\n\t\t\t\tname: z.string(),\n\t\t\t\tmessage: z.string(),\n\t\t\t\tid: z.string().optional(),\n\t\t\t\tsources: z.array(z.string()).optional(),\n\t\t\t})\n\t\t\t.loose(),\n\t}),\n]);\n\n/**\n * The manifest, discovered in `sandbox` and handed back as JSON — or\n * `undefined` when it holds something JSON cannot carry and the sandbox is\n * not isolating, for the caller to discover here as before.\n */\nasync function discoverInSandbox(\n\tsandbox: Sandbox,\n\toptions: DiscoverOptions,\n): Promise<ConstructManifest | undefined> {\n\tconst cwd = options.cwd ?? sandbox.root;\n\tconst patterns =\n\t\ttypeof options.patterns === 'string'\n\t\t\t? [options.patterns]\n\t\t\t: [...options.patterns];\n\n\tconst { value, stderr } = await runWorker(sandbox, 'construct discovery', {\n\t\tname: 'discover-worker',\n\t\targs: [JSON.stringify({ patterns, cwd })],\n\t\tcwd,\n\t\ttimeoutMs: DISCOVER_TIMEOUT_MS,\n\t\tschema: DiscoverAnswer,\n\t});\n\n\t// Discovery's own warnings — a glob that matched nothing — are the\n\t// run's, as they would be had it discovered in-process: as written, one\n\t// message, less the newline the worker's `console.warn` ended it with.\n\tif (stderr.trim()) logger.warn(stderr.replace(/\\n$/, ''));\n\n\tswitch (value.reason) {\n\t\tcase 'discovered':\n\t\t\tif (options.background) {\n\t\t\t\tfor (const [owner, files] of Object.entries(value.background ?? {})) {\n\t\t\t\t\toptions.background[owner] = files;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (options.subscribers) {\n\t\t\t\tfor (const [owner, bound] of Object.entries(value.subscribers ?? {})) {\n\t\t\t\t\toptions.subscribers[owner] = bound;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn value.manifest as unknown as ConstructManifest;\n\t\tcase 'failed':\n\t\t\tif (value.error.name === 'DuplicateConstruct' && value.error.id) {\n\t\t\t\tthrow new DuplicateConstruct(value.error.id, value.error.sources ?? []);\n\t\t\t}\n\t\t\tthrow new ConstructDiscoveryFailed(value.error.name, value.error.message);\n\t\tcase 'live':\n\t\t\tif (sandbox.isolating) throw new ConstructsNotSerializable(value.paths);\n\t\t\treturn undefined;\n\t}\n}\n\n/**\n * A caller asked for the construct objects (`sources`) or a watcher's\n * re-import under an isolating sandbox, where only data comes back.\n */\nexport class LiveConstructsUnavailable extends Error {\n\tconstructor() {\n\t\tsuper(\n\t\t\t'Discovery was asked for the construct objects themselves under an ' +\n\t\t\t\t'isolating sandbox, which hands back only data. Run this step ' +\n\t\t\t\t'without one, or ask only for the manifest.',\n\t\t);\n\t\tthis.name = 'LiveConstructsUnavailable';\n\t}\n}\n\n/** How long discovering a project's constructs may take in a sandbox. */\nconst DISCOVER_TIMEOUT_MS = 60_000;\n\n/** Importing a construct module, or declaring one, threw in the sandbox. */\nexport class ConstructDiscoveryFailed extends Error {\n\tconstructor(\n\t\treadonly errorName: string,\n\t\treadonly detail: string,\n\t) {\n\t\tsuper(`Discovering constructs failed (${errorName}): ${detail}`);\n\t\tthis.name = 'ConstructDiscoveryFailed';\n\t}\n}\n\n/**\n * The constructs' declarations hold something that is not data, and the\n * sandbox they were discovered in hands the deploy nothing but data.\n */\nexport class ConstructsNotSerializable extends Error {\n\tconstructor(readonly paths: readonly string[]) {\n\t\tsuper(\n\t\t\t`The construct manifest holds values that are not plain data at: ` +\n\t\t\t\t`${paths.join(', ')}. Under an isolating sandbox the deploy only ` +\n\t\t\t\t'receives what JSON can carry; deploy with a sandbox that is not ' +\n\t\t\t\t'isolating if the host trusts this project.',\n\t\t);\n\t\tthis.name = 'ConstructsNotSerializable';\n\t}\n}\n\n/** Where a construct was declared, and under what name. */\nexport interface ConstructSource {\n\t/** Absolute path to the module that exported it. */\n\tfile: string;\n\t/** The name it was exported as — what an import statement has to say. */\n\texportName: string;\n\t/**\n\t * The exported construct itself.\n\t *\n\t * What a declaration cannot say — whether it serves itself — the object can\n\t * be asked, and discovery already imported it.\n\t */\n\tconstruct: unknown;\n}\n\n/**\n * Build the construct manifest for a project.\n *\n * Runs the manifest's own validation before returning, so an app is wrong here\n * — where the error names a file — rather than at deploy.\n *\n * @throws {DuplicateConstruct} when two exports claim one id.\n */\nexport async function discover(\n\toptions: DiscoverOptions,\n): Promise<ConstructManifest> {\n\tconst sandbox = options.sandbox ?? activeSandbox();\n\tif (sandbox) {\n\t\tif (!options.sources && !options.bustCache) {\n\t\t\tconst sandboxed = await discoverInSandbox(sandbox, options);\n\t\t\tif (sandboxed) return sandboxed;\n\t\t} else if (sandbox.isolating) {\n\t\t\t// The construct objects themselves, or a re-import for the watcher:\n\t\t\t// neither can cross a sandbox that hands back only data.\n\t\t\tthrow new LiveConstructsUnavailable();\n\t\t}\n\t}\n\n\tconst {\n\t\tpatterns,\n\t\tcwd = process.cwd(),\n\t\tbustCache = false,\n\t\tsources: out,\n\t} = options;\n\n\t// Re-importing user modules re-executes them, and Zod v4 throws on a\n\t// re-registered `.meta({ id })`. Same reason the generators clear it.\n\tif (bustCache) clearZodGlobalRegistry();\n\n\tconst manifest: Record<string, Declaration> = {};\n\t/** Which file declared each id, for the error when two of them do. */\n\tconst sources: Record<string, string> = {};\n\t/**\n\t * Constructs already seen, by identity.\n\t *\n\t * A re-export is the *same object* reached through a second file — ESM\n\t * bindings are live, so `export * from './database.js'` hands back the\n\t * binding rather than a copy. Without this, a barrel file made every\n\t * construct in it appear declared twice, and `constructs/index.ts` is the\n\t * first thing anyone writes in a shared folder.\n\t *\n\t * Identity rather than file is also the more honest rule: what may not\n\t * happen twice is two *different* constructs claiming one id, and that is\n\t * still an error below.\n\t */\n\tconst seen = new WeakSet<object>();\n\n\tconst globs = Array.isArray(patterns) ? [...patterns] : [patterns as string];\n\tconst files = fg.stream(globs, { cwd, absolute: true });\n\n\t/** Matched files, for the diagnostic below. */\n\tlet matched = 0;\n\n\t/** Each processor, once, by the export that first reached it. */\n\tconst processors = new Map<\n\t\tobject,\n\t\t{ exportName: string; file: string; processor: Processor<string> }\n\t>();\n\t/** Each runnable, once, under the export most likely to define it. */\n\tconst runnables = new Map<object, Found>();\n\n\tfor await (const found of files) {\n\t\tmatched++;\n\t\tconst file = found.toString();\n\t\tconst module = await import(bustCache ? `${file}?t=${Date.now()}` : file);\n\n\t\tfor (const [exportName, exported] of Object.entries(module)) {\n\t\t\tif (options.background)\n\t\t\t\trecordBackground(options.background, exported, file);\n\t\t\tif (options.served) recordServed(options.served, exported, file);\n\t\t\tif (options.subscribers)\n\t\t\t\trecordSubscriber(options.subscribers, exported, exportName);\n\t\t\tif (Processor.isProcessor(exported)) {\n\t\t\t\tconst seenAt = processors.get(exported);\n\t\t\t\tif (!seenAt || definedIn(file, seenAt.file)) {\n\t\t\t\t\tprocessors.set(exported, { exportName, file, processor: exported });\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (isRunnable(exported)) {\n\t\t\t\tconst seenAt = runnables.get(exported);\n\t\t\t\tif (!seenAt || definedIn(file, seenAt.file)) {\n\t\t\t\t\trunnables.set(exported, { exportName, file, construct: exported });\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (!isDeclarable(exported)) continue;\n\n\t\t\t// The same construct, reached again through a re-export. Skipped\n\t\t\t// rather than re-declared: it has already claimed its id, from the\n\t\t\t// file that defined it.\n\t\t\tif (seen.has(exported as object)) continue;\n\t\t\tseen.add(exported as object);\n\n\t\t\tfor (const declaration of exported.declare()) {\n\t\t\t\t// Canonicalise here too: a construct built by hand rather than through\n\t\t\t\t// a constructor is still subject to the same identity rule.\n\t\t\t\tconst id = canonicalId(declaration.id);\n\t\t\t\tconst source = relative(cwd, file);\n\n\t\t\t\tconst claimed = sources[id];\n\t\t\t\tif (claimed !== undefined && claimed !== source) {\n\t\t\t\t\tthrow new DuplicateConstruct(id, [claimed, source]);\n\t\t\t\t}\n\n\t\t\t\tmanifest[id] = { ...declaration, id };\n\t\t\t\tsources[id] = source;\n\t\t\t\tif (out) out[id] = { file, exportName, construct: exported };\n\t\t\t}\n\t\t}\n\t}\n\n\tnestProcessors(manifest, [...processors.values()], cwd);\n\tnestRunnables(manifest, [...runnables.values()], cwd);\n\n\t// Reference integrity before anyone reads it — a schema tenant naming a\n\t// database that was deleted is a manifest error, not a reconcile failure.\n\tassertDerivations(manifest);\n\n\twarnIfNothingFound(globs, matched, Object.keys(manifest).length);\n\n\treturn manifest;\n}\n\n/**\n * Record where a worker's background work is declared: a cron, a queue\n * consumer or a topic subscriber, under the worker that owns it.\n */\nfunction recordBackground(\n\tbackground: Record<string, string[]>,\n\texported: unknown,\n\tfile: string,\n): void {\n\tif (\n\t\t!Cron.isCron(exported) &&\n\t\t!Queue.isQueue(exported) &&\n\t\t!Subscriber.isSubscriber(exported)\n\t) {\n\t\treturn;\n\t}\n\tconst owner = (exported as { owner?: unknown }).owner;\n\tif (typeof owner !== 'string') return;\n\n\tconst key = canonicalId(owner);\n\tconst files = background[key] ?? [];\n\tbackground[key] = files;\n\tif (!files.includes(file)) files.push(file);\n}\n\n/** Record the file of anything built from a surface, under that surface. */\nfunction recordServed(\n\tserved: Record<string, string[]>,\n\texported: unknown,\n\tfile: string,\n): void {\n\tif (typeof exported !== 'object' || exported === null) return;\n\tconst surface = (exported as { surface?: { id?: unknown } }).surface?.id;\n\tif (typeof surface !== 'string') return;\n\n\tconst key = canonicalId(surface);\n\tconst files = served[key] ?? [];\n\tserved[key] = files;\n\tif (!files.includes(file)) files.push(file);\n}\n\n/** A processor built from a file server the discovery never found. */\nexport class ProcessorServerUnknown extends GkmError {\n\tconstructor(\n\t\treadonly processor: string,\n\t\treadonly server: string,\n\t) {\n\t\tsuper(\n\t\t\t`The processor '${processor}' answers on '${server}', which no ` +\n\t\t\t\t`discovered file declares. Export the FileServer from a file the ` +\n\t\t\t\t`workspace's constructs glob matches.`,\n\t\t);\n\t\tthis.name = 'ProcessorServerUnknown';\n\t}\n}\n\n/**\n * Whether `file` is the likelier home of an export also reached from\n * `other`: not a barrel (`index.*`) where the other is, and otherwise the\n * first by path — so the answer never depends on the order the glob\n * streamed them in.\n */\nfunction definedIn(file: string, other: string): boolean {\n\tconst barrel = (path: string) => /(^|[/\\\\])index\\.[cm]?[jt]s$/.test(path);\n\tif (barrel(file) !== barrel(other)) return barrel(other);\n\treturn file < other;\n}\n\n/**\n * Nest each processor in the file server it answers on.\n *\n * A processor is positional, as a subscriber is: it answers on its server's\n * domain and nothing else. It is nested here, not only by the build, because\n * every deploy path — the compose stack, the CDN in front of the bucket, the\n * SST stack — reads the discovered manifest. Its handler is its source until a\n * build replaces it with the generated one.\n */\nfunction nestProcessors(\n\tmanifest: Record<string, Declaration>,\n\tprocessors: readonly {\n\t\texportName: string;\n\t\tfile: string;\n\t\tprocessor: Processor<string>;\n\t}[],\n\tcwd: string,\n): void {\n\tfor (const { exportName, file, processor } of processors) {\n\t\tconst server = manifest[processor.surfaceId];\n\t\tif (server?.kind !== 'file-server') {\n\t\t\tthrow new ProcessorServerUnknown(exportName, processor.surfaceId);\n\t\t}\n\t\tconst declaration: ProcessorDeclaration = {\n\t\t\tid: exportName,\n\t\t\thandler: `${relative(cwd, file)}#${exportName}`,\n\t\t\tpath: processor.pattern,\n\t\t\tprefix: processor.prefix,\n\t\t\t...(processor.native.length ? { native: [...processor.native] } : {}),\n\t\t\t...(processor.timeout !== undefined\n\t\t\t\t? { timeout: processor.timeout }\n\t\t\t\t: {}),\n\t\t\t...(processor.memorySize !== undefined\n\t\t\t\t? { memorySize: processor.memorySize }\n\t\t\t\t: {}),\n\t\t\tdependencies: processor.constructs.flatMap((id) => {\n\t\t\t\tconst target = manifest[canonicalId(id)];\n\t\t\t\treturn target ? [{ target: target.id, kind: target.kind }] : [];\n\t\t\t}),\n\t\t};\n\t\tmanifest[server.id] = {\n\t\t\t...server,\n\t\t\tprocessors: [\n\t\t\t\t...(server.processors ?? []).filter((p) => p.id !== exportName),\n\t\t\t\tdeclaration,\n\t\t\t].sort((a, b) => a.id.localeCompare(b.id)),\n\t\t};\n\t}\n}\n\n/** A runnable export, under the name and file it was found by. */\ninterface Found {\n\texportName: string;\n\tfile: string;\n\tconstruct: unknown;\n}\n\n/**\n * Whether an export is something a process runs: an endpoint or a WebSocket\n * route its surface serves, or a cron, function, queue consumer or subscriber\n * a worker does.\n */\nfunction isRunnable(value: unknown): value is object {\n\treturn (\n\t\tEndpoint.isEndpoint(value) ||\n\t\tWebSocketRoute.isRoute(value) ||\n\t\tCron.isCron(value) ||\n\t\tFunction.isFunction(value) ||\n\t\tQueue.isQueue(value) ||\n\t\tSubscriber.isSubscriber(value)\n\t);\n}\n\n/**\n * Nest each runnable where it runs: an endpoint in its surface, a route in\n * its WebSocket surface, a consumer in its queue, a subscriber in its topic or\n * bucket; a cron or function as a node of its own.\n *\n * Here and not in the build, so the manifest is the whole application in every\n * command: `gkm dev` reads the same edges `gkm build` writes and a deploy\n * grants. Each handler is its source, `<file>#<export>`, until a build that\n * generates one per function replaces it with the generated entry.\n */\nfunction nestRunnables(\n\tmanifest: Record<string, Declaration>,\n\tfound: readonly Found[],\n\tcwd: string,\n): void {\n\t// An id that names nothing is dropped: a handler can depend on a lifted\n\t// `Service`, which declares no node of its own.\n\tconst edges = (ids: readonly string[] = []): Dependency[] =>\n\t\t[...new Set(ids.map(canonicalId))].flatMap((id) => {\n\t\t\tconst target = manifest[id];\n\t\t\treturn target ? [{ target: target.id, kind: target.kind }] : [];\n\t\t});\n\tconst ownerOf = (construct: { owner?: unknown }) =>\n\t\ttypeof construct.owner === 'string'\n\t\t\t? { owner: canonicalId(construct.owner) }\n\t\t\t: {};\n\tconst byId = <T extends { id: string }>(list: readonly T[], next: T) =>\n\t\t[...list.filter((item) => item.id !== next.id), next].sort((a, b) =>\n\t\t\ta.id.localeCompare(b.id),\n\t\t);\n\n\tconst sorted = [...found].sort((a, b) =>\n\t\ta.exportName.localeCompare(b.exportName),\n\t);\n\tfor (const { exportName, file, construct } of sorted) {\n\t\tconst handler = `${relative(cwd, file)}#${exportName}`;\n\n\t\tif (Endpoint.isEndpoint(construct)) {\n\t\t\tconst surfaceId = construct.surface?.id;\n\t\t\tconst surface = surfaceId ? manifest[canonicalId(surfaceId)] : undefined;\n\t\t\tif (surface?.kind !== 'rest-api') continue;\n\t\t\tmanifest[surface.id] = {\n\t\t\t\t...surface,\n\t\t\t\tendpoints: byId(surface.endpoints, {\n\t\t\t\t\tid: `${surface.id}${construct.method}${construct._path}`,\n\t\t\t\t\thandler,\n\t\t\t\t\tmethod: construct.method,\n\t\t\t\t\tpath: construct._path,\n\t\t\t\t\tdependencies: edges(construct.constructs),\n\t\t\t\t\tauthorizer: construct.authorizer?.name ?? 'none',\n\t\t\t\t}),\n\t\t\t};\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (WebSocketRoute.isRoute(construct)) {\n\t\t\tconst surface = manifest[canonicalId(construct.surface.id)];\n\t\t\tif (surface?.kind !== 'websocket-api') continue;\n\t\t\tmanifest[surface.id] = {\n\t\t\t\t...surface,\n\t\t\t\troutes: byId(surface.routes ?? [], {\n\t\t\t\t\tid: `${surface.id}${construct.action}`,\n\t\t\t\t\thandler,\n\t\t\t\t\taction: construct.action,\n\t\t\t\t\tdependencies: edges(construct.constructs),\n\t\t\t\t}),\n\t\t\t};\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (Cron.isCron(construct)) {\n\t\t\tmanifest[exportName] = {\n\t\t\t\tkind: 'cron',\n\t\t\t\tid: exportName,\n\t\t\t\thandler,\n\t\t\t\tschedule: construct.schedule || 'rate(1 hour)',\n\t\t\t\tdependencies: edges(construct.constructs),\n\t\t\t\t...ownerOf(construct),\n\t\t\t};\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (Function.isFunction(construct)) {\n\t\t\tmanifest[exportName] = {\n\t\t\t\tkind: 'function',\n\t\t\t\tid: exportName,\n\t\t\t\thandler,\n\t\t\t\tdependencies: edges(construct.constructs),\n\t\t\t\tprovides: [providedKeyFor(exportName, 'function', 'url')],\n\t\t\t\t...ownerOf(construct),\n\t\t\t};\n\t\t\tcontinue;\n\t\t}\n\n\t\t// A queue declared itself; its consumer is what the worker runs.\n\t\tif (Queue.isQueue(construct)) {\n\t\t\tconst queue = manifest[construct.id];\n\t\t\tif (queue?.kind !== 'queue') continue;\n\t\t\tmanifest[queue.id] = {\n\t\t\t\t...queue,\n\t\t\t\tworker: {\n\t\t\t\t\t...queue.worker,\n\t\t\t\t\thandler,\n\t\t\t\t\tdependencies: edges(construct.constructs),\n\t\t\t\t\t...ownerOf(construct),\n\t\t\t\t},\n\t\t\t};\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (Subscriber.isSubscriber(construct)) {\n\t\t\tconst subscriber = {\n\t\t\t\tid: exportName,\n\t\t\t\thandler,\n\t\t\t\tevents: [...(construct.subscribedEvents ?? [])],\n\t\t\t\tdependencies: edges(construct.constructs),\n\t\t\t\t...ownerOf(construct),\n\t\t\t};\n\t\t\tif (construct.bucketName) {\n\t\t\t\tconst bucket = manifest[canonicalId(construct.bucketName)];\n\t\t\t\tif (bucket?.kind !== 'objects') continue;\n\t\t\t\tmanifest[bucket.id] = {\n\t\t\t\t\t...bucket,\n\t\t\t\t\tsubscribers: byId(bucket.subscribers ?? [], {\n\t\t\t\t\t\t...subscriber,\n\t\t\t\t\t\t...construct.objectFilter,\n\t\t\t\t\t}),\n\t\t\t\t};\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst topic = construct.topicName\n\t\t\t\t? manifest[canonicalId(construct.topicName)]\n\t\t\t\t: undefined;\n\t\t\tif (topic?.kind !== 'topic') continue;\n\t\t\tmanifest[topic.id] = {\n\t\t\t\t...topic,\n\t\t\t\tsubscribers: byId(topic.subscribers, subscriber),\n\t\t\t};\n\t\t}\n\t}\n}\n\n/**\n * Record a subscriber — to a topic or to a bucket — under the worker that\n * runs it, by its export. Once per name: a file reached twice through a\n * re-export finds it again.\n */\nfunction recordSubscriber(\n\tsubscribers: Record<string, BoundSubscriber[]>,\n\texported: unknown,\n\texportName: string,\n): void {\n\tif (!Subscriber.isSubscriber(exported)) return;\n\tconst owner = (exported as { owner?: unknown }).owner;\n\tconst connectionKey = subscriberConnectionKey(exported);\n\tif (typeof owner !== 'string' || !connectionKey) return;\n\n\tconst key = canonicalId(owner);\n\tconst bound = subscribers[key] ?? [];\n\tsubscribers[key] = bound;\n\tif (\n\t\t!bound.some(\n\t\t\t(s) => s.connectionKey === connectionKey && s.name === exportName,\n\t\t)\n\t) {\n\t\t// An inbox's topic is published to by the provider, bare, with no\n\t\t// `type` attribute a filter could match: its subscriber takes it all and\n\t\t// keeps what its inbox receives at.\n\t\tconst events =\n\t\t\texported.topicName && !exported.inboxName\n\t\t\t\t? exported.subscribedEvents\n\t\t\t\t: undefined;\n\t\tbound.push({\n\t\t\tname: exportName,\n\t\t\tconnectionKey,\n\t\t\t...(events ? { events: [...events] } : {}),\n\t\t});\n\t}\n}\n\n/**\n * What a runnable consumes, by id: a queue's consumer drains that queue, a\n * subscriber its topic. Nothing for anything else.\n */\nexport function consumedBy(runnable: unknown): string[] {\n\tif (Queue.isQueue(runnable)) return [runnable.id];\n\tif (Subscriber.isSubscriber(runnable) && runnable.topicName) {\n\t\treturn [canonicalId(runnable.topicName)];\n\t}\n\tif (Subscriber.isSubscriber(runnable) && runnable.bucketName) {\n\t\treturn [canonicalId(runnable.bucketName)];\n\t}\n\treturn [];\n}\n\n/**\n * Say so when a glob was configured and found nothing.\n *\n * The glob is not a filter over declarations already known — it is *how they\n * are found*, by importing what it matches. So a file it misses is a\n * declaration that does not exist, and every symptom of that appears somewhere\n * other than the cause: no container starts, no env key is written, and the\n * application fails on first use against a resource it can see in its own\n * source.\n *\n * Nothing reported it before, because an unmatched file is indistinguishable\n * from a file nobody wrote. These two cases are the ones that are *not*\n * ambiguous — a glob was configured, so something was expected.\n *\n * Silent when no glob is configured at all: that is a project which has not\n * adopted constructs, and has nothing to be missing.\n */\nfunction warnIfNothingFound(\n\tglobs: readonly string[],\n\tmatched: number,\n\tdeclared: number,\n): void {\n\tif (globs.length === 0) return;\n\n\tif (matched === 0) {\n\t\tlogger.warn(\n\t\t\t`\\n⚠️ The constructs glob matched no files, so nothing was declared.\\n` +\n\t\t\t\t` Patterns: ${globs.join(', ')}\\n` +\n\t\t\t\t` Nothing will be provisioned — no containers, no env keys, no ` +\n\t\t\t\t`resources.\\n` +\n\t\t\t\t` A common cause is depth: '*.ts' matches one level, '**/*.ts' ` +\n\t\t\t\t`matches any.`,\n\t\t);\n\t\treturn;\n\t}\n\n\tif (declared === 0) {\n\t\tlogger.warn(\n\t\t\t`\\n⚠️ The constructs glob matched ${matched} file(s) but none declared ` +\n\t\t\t\t`anything.\\n` +\n\t\t\t\t` Patterns: ${globs.join(', ')}\\n` +\n\t\t\t\t` Discovery keeps exports with an 'id' that can 'declare()'. A ` +\n\t\t\t\t`construct that is\\n` +\n\t\t\t\t` built but never exported is invisible to it.`,\n\t\t);\n\t}\n}\n\n/** Two constructs claiming one id. */\nexport class DuplicateConstruct extends GkmError {\n\t/** The id claimed twice. */\n\treadonly id: string;\n\t/** The files that claimed it. */\n\treadonly sources: readonly string[];\n\n\tconstructor(id: string, sources: readonly string[]) {\n\t\tsuper('Two constructs declare the same id');\n\t\tthis.name = 'DuplicateConstruct';\n\t\tthis.id = id;\n\t\tthis.sources = sources;\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAaA,MAAM,gBAAgB;;;;;;AAOtB,SAAgB,WAAW,UAA0B;CACpD,OAAO,GAAG,WAAW;AACtB;;AAGA,SAAgB,iBAAiB,MAAkC;CAClE,OAAO,KAAK,SAAS,aAAa,IAC/B,KAAK,MAAM,GAAG,EAAqB,IACnC,KAAA;AACJ;;;;;AAMA,SAAgB,wBAAwB,WAGjB;CACtB,IAAI,UAAU,YACb,OAAO,eACN,YAAY,UAAU,UAAU,GAChC,WACA,wBACD;CAED,IAAI,UAAU,WACb,OAAO,eACN,YAAY,UAAU,SAAS,GAC/B,SACA,2BACD;AAGF;;;;;AAMA,SAAgB,mBAAmB,WAEZ;CACtB,OAAO,UAAU,aACd,eACA,YAAY,UAAU,UAAU,GAChC,WACA,aACD,IACC,KAAA;AACJ;;;;;;;;;;AAWA,SAAgB,YACf,UACA,UACW;CACX,MAAM,SAAS,SAAS;CACxB,IAAI,QAAQ,SAAS,UAAU,OAAO,CAAC;CAEvC,MAAM,QAAQ,eAAe,MAAM,CAAC,CAAC,KAAK,SAAS,KAAK,MAAM;CAC9D,MAAM,SAA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,KAAK;CAC7B,MAAM,QAAQ,YAAY,QAAQ,CAAC;CACnC,YAAY,OAAO;CACnB,IACC,CAAC,MAAM,MACL,MAAM,EAAE,kBAAkB,iBAAiB,EAAE,SAAS,UACxD,GACC;EAID,MAAM,SACL,SAAS,aAAa,CAAC,SAAS,YAC7B,SAAS,mBACT,KAAA;EACJ,MAAM,KAAK;GACV,MAAM;GACN;GACA,GAAI,SAAS,EAAE,QAAQ,CAAC,GAAG,MAAM,EAAE,IAAI,CAAC;EACzC,CAAC;CACF;AACD;;;;;AAMA,SAAgB,WAAW,UAA6B;CACvD,IAAI,MAAM,QAAQ,QAAQ,GAAG,OAAO,CAAC,SAAS,EAAE;CAChD,IAAI,WAAW,aAAa,QAAQ,KAAK,SAAS,WACjD,OAAO,CAAC,YAAY,SAAS,SAAS,CAAC;CAExC,IAAI,WAAW,aAAa,QAAQ,KAAK,SAAS,YACjD,OAAO,CAAC,YAAY,SAAS,UAAU,CAAC;CAEzC,OAAO,CAAC;AACT;;;;;;;;;;;;;;;;;;AAmBA,SAAS,mBACR,OACA,SACA,UACO;CACP,IAAI,MAAM,WAAW,GAAG;CAExB,IAAI,YAAY,GAAG;EAClB,OAAO,KACN,sFACiB,MAAM,KAAK,IAAI,EAAE,2JAKnC;EACA;CACD;CAEA,IAAI,aAAa,GAChB,OAAO,KACN,qCAAqC,QAAQ,qDAE5B,MAAM,KAAK,IAAI,EAAE,qIAInC;AAEF;;AAGA,IAAa,qBAAb,cAAwC,SAAS;;CAEhD;;CAEA;CAEA,YAAY,IAAY,SAA4B;EACnD,MAAM,oCAAoC;EAC1C,KAAK,OAAO;EACZ,KAAK,KAAK;EACV,KAAK,UAAU;CAChB;AACD"}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { t as GkmError } from "./errors-D8Gwp5kU.mjs";
|
|
2
|
-
import { ot as run } from "./credentials-
|
|
3
|
-
import { ot as appKey } from "./workspace-
|
|
4
|
-
import { B as WORKER_PORT, D as ORIGIN_VERIFY_HEADER, F as imageLayout, G as generateEntryDockerfile, It as siteClientTelemetry, J as generateProcessorDockerfile, K as generateNextjsDockerfile, M as appImageOptions, O as PROCESSOR_ORIGIN_SECRET_ENV, Q as resolveDockerConfig, R as PROCESSOR_PORT, U as generateBackendDockerfile, Ut as PROCESSORS_DEV_PREFIX, W as generateDockerignore, X as generateWorkerDockerfile, Y as generateViteStaticDockerfile, ct as processorUnits, g as COMPOSE_PATH, i as dockerfileOf, lt as workerUnits, m as reconcileWorkspace, q as generateNodeWebDockerfile, st as processorUnitName } from "./apps-
|
|
5
|
-
import { rt as getPublicUrlArgNames } from "./compose-
|
|
6
|
-
import { t as SubscriberGenerator } from "./SubscriberGenerator-
|
|
7
|
-
import { a as startTelemetryCode, n as runtimeFor, s as writeTelemetryModule } from "./EndpointGenerator-
|
|
8
|
-
import { v as ConstructGenerator, y as output } from "./discover-
|
|
2
|
+
import { ot as run } from "./credentials-CeCOEKP3.mjs";
|
|
3
|
+
import { ot as appKey } from "./workspace-Gubg8xLJ.mjs";
|
|
4
|
+
import { B as WORKER_PORT, D as ORIGIN_VERIFY_HEADER, F as imageLayout, G as generateEntryDockerfile, It as siteClientTelemetry, J as generateProcessorDockerfile, K as generateNextjsDockerfile, M as appImageOptions, O as PROCESSOR_ORIGIN_SECRET_ENV, Q as resolveDockerConfig, R as PROCESSOR_PORT, U as generateBackendDockerfile, Ut as PROCESSORS_DEV_PREFIX, W as generateDockerignore, X as generateWorkerDockerfile, Y as generateViteStaticDockerfile, ct as processorUnits, g as COMPOSE_PATH, i as dockerfileOf, lt as workerUnits, m as reconcileWorkspace, q as generateNodeWebDockerfile, st as processorUnitName } from "./apps-CWGmV2nQ.mjs";
|
|
5
|
+
import { rt as getPublicUrlArgNames } from "./compose-DuRBnjxx.mjs";
|
|
6
|
+
import { t as SubscriberGenerator } from "./SubscriberGenerator-CfZWX0lT.mjs";
|
|
7
|
+
import { a as startTelemetryCode, n as runtimeFor, s as writeTelemetryModule } from "./EndpointGenerator-CSKhAD6W.mjs";
|
|
8
|
+
import { v as ConstructGenerator, y as output } from "./discover-B_PDDaVj.mjs";
|
|
9
9
|
import { loadWorkspaceConfig } from "./config.mjs";
|
|
10
10
|
import { dirname, join, relative } from "node:path";
|
|
11
11
|
import { existsSync } from "node:fs";
|
|
12
12
|
import { appendFile, mkdir, readFile, writeFile } from "node:fs/promises";
|
|
13
|
-
import { IMAGE_ORIGINS_KEY, PUBLIC_PREFIX, imageOriginSources,
|
|
13
|
+
import { IMAGE_ORIGINS_KEY, PUBLIC_PREFIX, imageOriginSources, providedKeyFor, publicEnvFor } from "@geekmidas/manifest";
|
|
14
14
|
import { Cron } from "@geekmidas/constructs/crons";
|
|
15
15
|
import { Processor } from "@geekmidas/constructs/processors";
|
|
16
16
|
import { Queue } from "@geekmidas/constructs/queue";
|
|
@@ -684,7 +684,7 @@ import { ServiceDiscovery } from '@geekmidas/services';
|
|
|
684
684
|
${Array.from(importsByFile.entries()).map(([importPath, exports]) => `import { ${exports.join(", ")} } from '${importPath}';`).join("\n")}
|
|
685
685
|
|
|
686
686
|
const queues = [
|
|
687
|
-
${queues.map(({ key, construct }) => ` { queue: ${key}, connectionKey: '${
|
|
687
|
+
${queues.map(({ key, construct }) => ` { queue: ${key}, connectionKey: '${providedKeyFor(construct.id, "queue", "publisherConnectionString")}' },`).join("\n")}
|
|
688
688
|
];
|
|
689
689
|
|
|
690
690
|
// What was opened, and what could not be: a worker's health check reads both,
|
|
@@ -1337,7 +1337,7 @@ function processorDockerfile(unit, host, options) {
|
|
|
1337
1337
|
function siteDockerfile(appName, app, options) {
|
|
1338
1338
|
const declared = options.manifest ? Object.entries(options.manifest).find(([id, d]) => d.kind === "site" && appKey(id) === appName)?.[1] : void 0;
|
|
1339
1339
|
const publicUrlArgs = options.publicUrlArgs ?? (declared?.kind === "site" && options.manifest ? [
|
|
1340
|
-
|
|
1340
|
+
providedKeyFor(declared.id, declared.kind, "url"),
|
|
1341
1341
|
...Object.keys(publicEnvFor(declared, options.manifest)),
|
|
1342
1342
|
...imageOriginSources(declared, options.manifest).length > 0 ? [`${PUBLIC_PREFIX[declared.variant]}${IMAGE_ORIGINS_KEY}`] : []
|
|
1343
1343
|
] : getPublicUrlArgNames(app));
|
|
@@ -1410,4 +1410,4 @@ function printRunInstructions(workspace) {
|
|
|
1410
1410
|
//#endregion
|
|
1411
1411
|
export { processorInfo as _, ensureDockerignore as a, workerDockerfileOf as c, workerEntryDir as d, QueueGenerator as f, processorEntryDir as g, processorBundleName as h, dockerCommand as i, WorkerGenerator as l, ProcessorGenerator as m, DockerPushFailed as n, processorDockerfile as o, CronGenerator as p, appDockerfile as r, workerDockerfile as s, DockerBuildFailed as t, workerBundleName as u, validateImageRef as v };
|
|
1412
1412
|
|
|
1413
|
-
//# sourceMappingURL=docker-
|
|
1413
|
+
//# sourceMappingURL=docker-COHyyOkv.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"docker-COHyyOkv.mjs","names":[],"sources":["../src/docker/imageRef.ts","../src/generators/ProcessorGenerator.ts","../src/generators/CronGenerator.ts","../src/generators/QueueGenerator.ts","../src/generators/WorkerGenerator.ts","../src/docker/index.ts"],"sourcesContent":["/**\n * An image reference, checked before it reaches `docker`.\n *\n * The parts come from the workspace — a registry in `gkm.config.ts`, an image\n * name from the project, a tag from `--tag` — and an argument array already\n * keeps them out of a shell. What it cannot do is stop `docker` reading a value\n * that starts with `-` as one of its own flags, so a ref is held to Docker's\n * own grammar (distribution/reference) and anything else is refused by name\n * before a build starts.\n */\n\nimport { GkmError } from '../errors';\n\nconst DOMAIN_COMPONENT = '(?:[a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9-]*[a-zA-Z0-9])';\nconst DOMAIN = `${DOMAIN_COMPONENT}(?:\\\\.${DOMAIN_COMPONENT})*(?::[0-9]+)?`;\nconst PATH_COMPONENT = '[a-z0-9]+(?:(?:[._]|__|-+)[a-z0-9]+)*';\nconst TAG = '[\\\\w][\\\\w.-]{0,127}';\nconst DIGEST =\n\t'[A-Za-z][A-Za-z0-9]*(?:[-_+.][A-Za-z][A-Za-z0-9]*)*:[0-9a-fA-F]{32,}';\n\nconst REFERENCE = new RegExp(\n\t`^(?:${DOMAIN}/)?${PATH_COMPONENT}(?:/${PATH_COMPONENT})*(?::${TAG})?(?:@${DIGEST})?$`,\n);\n\n/** Docker refuses a repository name longer than this. */\nconst MAX_NAME_LENGTH = 255;\n\n/** A value that is not an image reference was about to be built or pushed. */\nexport class ImageRefInvalid extends GkmError {\n\tconstructor(readonly ref: string) {\n\t\tsuper(\n\t\t\t`'${ref}' is not a valid image reference. An image is \\`[registry/]name[:tag]\\`: the name lowercase letters, digits and . _ - separators, the tag up to 128 of letters, digits, _ . and -, not starting with . or -. Check docker.registry in gkm.config.ts and the --tag passed.`,\n\t\t);\n\t\tthis.name = 'ImageRefInvalid';\n\t}\n}\n\n/** Throw {@link ImageRefInvalid} unless `ref` is a Docker image reference. */\nexport function validateImageRef(ref: string): string {\n\tconst name = ref.split('@')[0]!.replace(/:[\\w][\\w.-]*$/, '');\n\tif (!REFERENCE.test(ref) || name.length > MAX_NAME_LENGTH) {\n\t\tthrow new ImageRefInvalid(ref);\n\t}\n\treturn ref;\n}\n","import { mkdir, writeFile } from 'node:fs/promises';\nimport { dirname, join, relative } from 'node:path';\nimport { Processor } from '@geekmidas/constructs/processors';\nimport type { ProcessorInfo } from '@geekmidas/manifest';\nimport type { BuildContext } from '../build/types';\nimport { processorUnitName } from '../build/workers';\nimport {\n\tORIGIN_VERIFY_HEADER,\n\tPROCESSOR_ORIGIN_SECRET_ENV,\n} from '../providers/processorOrigin';\nimport {\n\tConstructGenerator,\n\ttype GeneratedConstruct,\n\ttype GeneratorOptions,\n} from './Generator';\nimport { PROCESSORS_DEV_PREFIX } from './processorRoute';\nimport {\n\tstartTelemetryCode,\n\ttype TelemetryContext,\n\twriteTelemetryModule,\n} from './telemetry';\n\ntype AnyProcessor = Processor<string, any, any, any>;\n\n/** Where a file server's processor entry lives, under an app's `.gkm/server`. */\nexport function processorEntryDir(\n\tserverDir: string,\n\tfileServerId: string,\n): string {\n\treturn join(serverDir, 'processors', processorUnitName(fileServerId));\n}\n\n/** The file its bundle is written to, beside the server's. */\nexport function processorBundleName(fileServerId: string): string {\n\treturn `${processorUnitName(fileServerId)}.mjs`;\n}\n\n/**\n * A file server's processors, as the build generates them.\n *\n * On AWS each is a Lambda behind a function URL — the CDN's origin for its\n * pattern. On a server they are one process per file server, the processor\n * unit (see {@link ProcessorGenerator.buildEntry}), so the `server` target\n * generates nothing per processor here.\n */\nexport class ProcessorGenerator extends ConstructGenerator<\n\tAnyProcessor,\n\tProcessorInfo[]\n> {\n\tisConstruct(value: unknown): value is AnyProcessor {\n\t\treturn Processor.isProcessor(value);\n\t}\n\n\tasync build(\n\t\tcontext: BuildContext,\n\t\tconstructs: GeneratedConstruct<AnyProcessor>[],\n\t\toutputDir: string,\n\t\toptions?: GeneratorOptions,\n\t): Promise<ProcessorInfo[]> {\n\t\tif ((options?.target ?? 'aws') !== 'aws' || constructs.length === 0) {\n\t\t\treturn [];\n\t\t}\n\n\t\tconst dir = join(outputDir, 'processors');\n\t\tawait mkdir(dir, { recursive: true });\n\n\t\tconst infos: ProcessorInfo[] = [];\n\t\tfor (const { key, construct, path } of constructs) {\n\t\t\tconst file = join(dir, `${key}.ts`);\n\t\t\tconst importPath = relative(dirname(file), path.relative).replace(\n\t\t\t\t/\\.ts$/,\n\t\t\t\t'.js',\n\t\t\t);\n\t\t\tawait writeFile(\n\t\t\t\tfile,\n\t\t\t\t`import { AWSLambdaProcessor } from '@geekmidas/constructs/processors';\nimport { ${key} } from '${importPath}';\n${context.storageDrivers?.imports ?? ''}\n${context.storageDrivers?.setup ? `\\n// The handler registers the drivers its target needs.\\n${context.storageDrivers.setup}\\n` : ''}\nconst adapter = new AWSLambdaProcessor(${key});\n\nexport const handler = adapter.handler;\n`,\n\t\t\t);\n\t\t\tinfos.push(\n\t\t\t\tawait processorInfo(\n\t\t\t\t\tkey,\n\t\t\t\t\tconstruct,\n\t\t\t\t\trelative(options?.root ?? process.cwd(), file).replace(\n\t\t\t\t\t\t/\\.ts$/,\n\t\t\t\t\t\t'.handler',\n\t\t\t\t\t),\n\t\t\t\t\tcontext,\n\t\t\t\t),\n\t\t\t);\n\t\t}\n\t\treturn infos;\n\t}\n\n\t/**\n\t * `gkm dev`'s half: `processors.ts` beside the dev server's app, mounting\n\t * each file server's processors under `/__gkm/processors/<FileServer>`.\n\t * The local edge sends each pattern on the file server's host there, so\n\t * `processedUrl()` answers locally as it does deployed.\n\t *\n\t * In the dev server's own process rather than a unit of its own: locally\n\t * there is no CPU to protect, and the dev server already reloads on change.\n\t */\n\tasync buildDev(\n\t\toutputDir: string,\n\t\tprocessors: GeneratedConstruct<AnyProcessor>[],\n\t): Promise<string> {\n\t\tawait mkdir(outputDir, { recursive: true });\n\t\tconst file = join(outputDir, 'processors.ts');\n\n\t\tconst imports = processors\n\t\t\t.map(({ key, path }) => {\n\t\t\t\tconst specifier = relative(outputDir, path.absolute).replace(\n\t\t\t\t\t/\\.ts$/,\n\t\t\t\t\t'.js',\n\t\t\t\t);\n\t\t\t\treturn `import { ${key} } from '${specifier.startsWith('.') ? specifier : `./${specifier}`}';`;\n\t\t\t})\n\t\t\t.join('\\n');\n\t\tconst byServer = new Map<string, string[]>();\n\t\tfor (const { key, construct } of processors) {\n\t\t\tbyServer.set(construct.surfaceId, [\n\t\t\t\t...(byServer.get(construct.surfaceId) ?? []),\n\t\t\t\tkey,\n\t\t\t]);\n\t\t}\n\t\tconst units = [...byServer.entries()]\n\t\t\t.map(([id, keys]) => ` ${JSON.stringify(id)}: [${keys.join(', ')}],`)\n\t\t\t.join('\\n');\n\n\t\tawait writeFile(\n\t\t\tfile,\n\t\t\t`/**\n * Generated processors setup for \\`gkm dev\\`.\n *\n * Each file server's processors, under ${PROCESSORS_DEV_PREFIX}<FileServer>: the\n * local edge rewrites each processor pattern on the file server's host here.\n */\nimport type { EnvironmentParser } from '@geekmidas/envkit';\nimport { processorServer } from '@geekmidas/constructs/processors';\n${imports}\n\nexport function setupProcessors(\n app: { all: (path: string, handler: (c: any) => unknown) => unknown },\n envParser: EnvironmentParser<any>,\n): void {\n const units: Record<string, ReturnType<typeof processorServer>> = Object.fromEntries(\n Object.entries({\n${units}\n }).map(([id, processors]) => [id, processorServer(processors, envParser)]),\n );\n\n app.all('${PROCESSORS_DEV_PREFIX}:server/*', async (c: any) => {\n const server = c.req.param('server') as string;\n const serve = units[server];\n if (!serve) return c.notFound();\n const path = c.req.path.slice(\\`${PROCESSORS_DEV_PREFIX}\\${server}\\`.length) || '/';\n const response = await serve({ method: c.req.method, path });\n if (!response) {\n return new Response(null, {\n status: 404,\n headers: { 'cache-control': 'public, max-age=60' },\n });\n }\n return new Response(c.req.method === 'HEAD' ? null : response.body, {\n status: response.status,\n headers: response.headers,\n });\n });\n}\n`,\n\t\t);\n\t\treturn file;\n\t}\n\n\t/**\n\t * A file server's processor unit: one process answering each of its\n\t * processors' patterns, and `/health`. Returns its entry, `processors.ts`.\n\t *\n\t * Its own process because making a derivative is CPU-bound — a resize\n\t * spike in the API's process would be every request's latency.\n\t */\n\tasync buildEntry(input: {\n\t\tcontext: BuildContext;\n\t\tfileServerId: string;\n\t\toutputDir: string;\n\t\tprocessors: GeneratedConstruct<AnyProcessor>[];\n\t\t/** From the file server's edge to a `Telemetry` node, when it has one. */\n\t\ttelemetry?: TelemetryContext;\n\t}): Promise<string> {\n\t\tconst { context, outputDir, processors } = input;\n\t\tawait mkdir(outputDir, { recursive: true });\n\t\t// The file server's own edge decides; without one the module loads\n\t\t// nothing, and the entry's start-up is the same shape either way.\n\t\tawait writeTelemetryModule(outputDir, input.telemetry);\n\n\t\tconst healthCheck = context.production?.healthCheck ?? '/health';\n\t\tconst imports = processors\n\t\t\t.map(({ key, path }) => {\n\t\t\t\tconst specifier = relative(outputDir, path.absolute).replace(\n\t\t\t\t\t/\\.ts$/,\n\t\t\t\t\t'.js',\n\t\t\t\t);\n\t\t\t\treturn `import { ${key} } from '${specifier.startsWith('.') ? specifier : `./${specifier}`}';`;\n\t\t\t})\n\t\t\t.join('\\n');\n\n\t\tconst entry = join(outputDir, 'processors.ts');\n\t\tawait writeFile(\n\t\t\tentry,\n\t\t\t`#!/usr/bin/env node\n/**\n * Production entry for ${input.fileServerId}'s processors.\n * Generated by 'gkm build --production'.\n *\n * Answers each processor's pattern, and ${healthCheck} on PORT. The edge\n * routes only those patterns here; everything else on the file server's\n * domain is the bucket.\n */\nimport { timingSafeEqual } from 'node:crypto';\nimport { createServer } from 'node:http';\nimport { runShutdownHooks } from '@geekmidas/constructs';\nimport { processorServer } from '@geekmidas/constructs/processors';\n${context.storageDrivers?.imports ?? ''}\n${imports}\n\n${startTelemetryCode([healthCheck])}\n${context.storageDrivers?.setup ? `// The entry point registers the drivers its target needs.\\n${context.storageDrivers.setup}\\n` : ''}\nprocess.env.GKM_APP_NAME ??= ${JSON.stringify(processorUnitName(input.fileServerId))};\n\nconst processors = [${processors.map(({ key }) => key).join(', ')}];\nconst serve = processorServer(processors);\nconst port = Number(process.env.PORT) || 3000;\nlet stopping = false;\n\n${input.telemetry ? REQUEST_SPANS : NO_REQUEST_SPANS}\n// Where the CDN fronts this unit, the secret it adds to every request: one\n// without it is refused here, whatever the edge in front did or could not.\nconst originSecret = process.env.${PROCESSOR_ORIGIN_SECRET_ENV}\n ? Buffer.from(process.env.${PROCESSOR_ORIGIN_SECRET_ENV})\n : undefined;\nconst fromOrigin = (header: string | string[] | undefined) => {\n if (!originSecret) return true;\n const given = Buffer.from(typeof header === 'string' ? header : '');\n return given.length === originSecret.length && timingSafeEqual(given, originSecret);\n};\n\nconst server = createServer(async (req, res) => {\n const method = req.method ?? 'GET';\n const path = (req.url ?? '/').split('?')[0] ?? '/';\n if (path === ${JSON.stringify(healthCheck)}) {\n res.writeHead(stopping ? 503 : 200, { 'content-type': 'application/json' });\n res.end(JSON.stringify({ status: stopping ? 'stopping' : 'ok' }));\n return;\n }\n if (!fromOrigin(req.headers[${JSON.stringify(ORIGIN_VERIFY_HEADER.toLowerCase())}])) {\n res.writeHead(403, { 'cache-control': 'no-store' }).end();\n return;\n }\n await traced(method, path, async () => {\n try {\n const response = await serve({ method, path });\n if (!response) {\n res.writeHead(404, { 'cache-control': 'public, max-age=60' }).end();\n return 404;\n }\n res.writeHead(response.status, response.headers);\n res.end(method === 'HEAD' ? undefined : response.body);\n return response.status;\n } catch (error) {\n console.error(error);\n res.writeHead(500, { 'cache-control': 'no-store' }).end();\n return 500;\n }\n });\n});\nserver.listen(port);\n\nconst shutdown = async () => {\n if (stopping) return;\n stopping = true;\n setTimeout(() => process.exit(1), Number(process.env.GKM_SHUTDOWN_TIMEOUT_MS) || 8000).unref();\n server.close();\n await runShutdownHooks((error) => console.error(error));\n process.exit(0);\n};\nprocess.on('SIGTERM', shutdown);\nprocess.on('SIGINT', shutdown);\n`,\n\t\t);\n\t\treturn entry;\n\t}\n}\n\n/**\n * A SERVER span per request, once telemetry has started — opened by the unit\n * rather than by hooking node:http, which sees nothing inside a bundle. Named\n * after the processor's pattern, never the key, which has no bound.\n *\n * Only in an entry whose file server has a `Telemetry` node: the bundle\n * follows the import, and an app without one need not install the API.\n */\nconst REQUEST_SPANS = `const tracing = requestSpans ? await import('@opentelemetry/api') : undefined;\nconst routeOf = (path: string) =>\n processors.find((processor) => path.startsWith(processor.prefix))?.pattern;\n\nasync function traced(\n method: string,\n path: string,\n run: () => Promise<number>,\n): Promise<void> {\n if (!tracing) {\n await run();\n return;\n }\n const route = routeOf(path);\n await tracing.trace.getTracer('@geekmidas/processors').startActiveSpan(\n route ? \\`\\${method} \\${route}\\` : method,\n {\n kind: tracing.SpanKind.SERVER,\n attributes: {\n 'http.request.method': method,\n 'url.path': path,\n ...(route ? { 'http.route': route } : {}),\n },\n },\n async (span) => {\n try {\n const status = await run();\n span.setAttribute('http.response.status_code', status);\n if (status >= 500) span.setStatus({ code: tracing.SpanStatusCode.ERROR });\n } finally {\n span.end();\n }\n },\n );\n}\n`;\n\n/** The same shape without telemetry: each request just runs. */\nconst NO_REQUEST_SPANS = `async function traced(\n _method: string,\n _path: string,\n run: () => Promise<number>,\n): Promise<void> {\n await run();\n}\n`;\n\n/** What the manifest records of one processor. */\nexport async function processorInfo(\n\tname: string,\n\tprocessor: AnyProcessor,\n\thandler: string,\n\tcontext: Pick<BuildContext, 'markOptional'>,\n): Promise<ProcessorInfo> {\n\treturn {\n\t\tname,\n\t\thandler,\n\t\tfileServer: processor.surfaceId,\n\t\tpath: processor.pattern,\n\t\tprefix: processor.prefix,\n\t\t...(processor.native.length ? { native: [...processor.native] } : {}),\n\t\t...(processor.timeout !== undefined ? { timeout: processor.timeout } : {}),\n\t\t...(processor.memorySize !== undefined\n\t\t\t? { memorySize: processor.memorySize }\n\t\t\t: {}),\n\t\tenvironment: await processor.getEnvironment({\n\t\t\tmarkOptional: context.markOptional,\n\t\t}),\n\t\tdependencies: processor.constructs,\n\t};\n}\n","import { mkdir, writeFile } from 'node:fs/promises';\nimport { dirname, join, relative } from 'node:path';\nimport { Cron } from '@geekmidas/constructs/crons';\nimport type { BuildContext } from '../build/types';\nimport type { CronInfo } from '../types';\nimport { runtimeFor } from './EndpointGenerator.js';\nimport {\n\tConstructGenerator,\n\ttype GeneratedConstruct,\n\ttype GeneratorOptions,\n} from './Generator';\n\nexport class CronGenerator extends ConstructGenerator<\n\tCron<any, any, any, any, any, any>,\n\tCronInfo[]\n> {\n\tasync build(\n\t\tcontext: BuildContext,\n\t\tconstructs: GeneratedConstruct<Cron<any, any, any, any, any, any>>[],\n\t\toutputDir: string,\n\t\toptions?: GeneratorOptions,\n\t): Promise<CronInfo[]> {\n\t\tconst target = options?.target ?? 'aws';\n\t\tconst logger = console;\n\t\tconst cronInfos: CronInfo[] = [];\n\n\t\tif (target === 'server') {\n\t\t\t// A server runs its crons itself, the way it already runs its\n\t\t\t// subscribers: one file, wired into the generated entry. Written even\n\t\t\t// when there are none, so the entry can import it unconditionally.\n\t\t\tawait this.generateServerCronsFile(outputDir, constructs);\n\n\t\t\tlogger.log(`Generated server crons file with ${constructs.length} crons`);\n\n\t\t\t// A server cron has no individual handler to point infra at — the\n\t\t\t// process schedules it.\n\t\t\treturn cronInfos;\n\t\t}\n\n\t\tif (constructs.length === 0) {\n\t\t\treturn cronInfos;\n\t\t}\n\n\t\t// Create crons subdirectory\n\t\tconst cronsDir = join(outputDir, 'crons');\n\t\tawait mkdir(cronsDir, { recursive: true });\n\n\t\t// Generate cron handlers\n\t\tfor (const { key, construct, path } of constructs) {\n\t\t\tconst handlerFile = await this.generateCronHandler(\n\t\t\t\tcronsDir,\n\t\t\t\tpath.relative,\n\t\t\t\tkey,\n\t\t\t\tcontext,\n\t\t\t\tconstruct.owner,\n\t\t\t);\n\n\t\t\tcronInfos.push({\n\t\t\t\tname: key,\n\t\t\t\thandler: relative(options?.root ?? process.cwd(), handlerFile).replace(\n\t\t\t\t\t/\\.ts$/,\n\t\t\t\t\t'.handler',\n\t\t\t\t),\n\t\t\t\tschedule: construct.schedule || 'rate(1 hour)',\n\t\t\t\ttimeout: construct.timeout,\n\t\t\t\tmemorySize: construct.memorySize,\n\t\t\t\tenvironment: await construct.getEnvironment({\n\t\t\t\t\tmarkOptional: context.markOptional,\n\t\t\t\t}),\n\t\t\t\tdependencies: construct.constructs,\n\t\t\t});\n\n\t\t\tlogger.log(`Generated cron handler: ${key}`);\n\t\t}\n\n\t\treturn cronInfos;\n\t}\n\n\tisConstruct(value: any): value is Cron<any, any, any, any, any, any> {\n\t\treturn Cron.isCron(value);\n\t}\n\n\t/**\n\t * The crons file a server entry imports.\n\t *\n\t * Shaped after `generateServerSubscribersFile`: one module, every cron, a\n\t * `setupCrons` the generated entry calls beside `setupSubscribers`.\n\t *\n\t * It picks its scheduler from what the process can reach. With a Postgres it\n\t * uses pg-boss, whose schedules live in the database — so a deployment\n\t * running four replicas fires each job once, which is the thing a timer in\n\t * every process gets wrong and does not report. With no database it falls\n\t * back to timers and says plainly that it is doing so.\n\t */\n\tprivate async generateServerCronsFile(\n\t\toutputDir: string,\n\t\tcrons: GeneratedConstruct<Cron<any, any, any, any, any, any>>[],\n\t): Promise<string> {\n\t\tawait mkdir(outputDir, { recursive: true });\n\n\t\tconst cronsPath = join(outputDir, 'crons.ts');\n\n\t\t// Nothing to schedule, so nothing to import — the entry imports this file\n\t\t// whatever the app declares, and a project with no events must not have\n\t\t// to resolve `@geekmidas/events`.\n\t\tif (crons.length === 0) {\n\t\t\tawait writeFile(\n\t\t\t\tcronsPath,\n\t\t\t\t`/**\n * Generated cron setup — this app declares none.\n */\nimport type { EnvironmentParser } from '@geekmidas/envkit';\nimport type { Logger } from '@geekmidas/logger';\n\nexport async function setupCrons(\n _envParser: EnvironmentParser<any>,\n _logger: Logger,\n): Promise<void> {}\n\nexport function cronsStatus(): { failed: string[]; connections: unknown[] } {\n return { failed: [], connections: [] };\n}\n\nexport async function stopCrons(): Promise<void> {}\n`,\n\t\t\t);\n\t\t\treturn cronsPath;\n\t\t}\n\n\t\tconst importsByFile = new Map<string, string[]>();\n\t\tfor (const { path, key } of crons) {\n\t\t\tconst relativePath = relative(dirname(cronsPath), path.relative);\n\t\t\tconst importPath = relativePath.replace(/\\.ts$/, '.js');\n\n\t\t\tif (!importsByFile.has(importPath)) importsByFile.set(importPath, []);\n\t\t\timportsByFile.get(importPath)?.push(key);\n\t\t}\n\n\t\tconst imports = Array.from(importsByFile.entries())\n\t\t\t.map(\n\t\t\t\t([importPath, exports]) =>\n\t\t\t\t\t`import { ${exports.join(', ')} } from '${importPath}';`,\n\t\t\t)\n\t\t\t.join('\\n');\n\n\t\tconst entries = crons\n\t\t\t.map(({ key }) => ` { name: '${key}', cron: ${key} }`)\n\t\t\t.join(',\\n');\n\n\t\tconst content = `/**\n * Generated cron setup.\n *\n * Schedules every cron this app declares, in the process that serves it.\n *\n * The schedule lives in Postgres, through pg-boss, in the database the worker\n * named with \\`.database(db)\\`. That is what makes running several replicas\n * safe: each job fires once, where a timer in every process fires it once per\n * replica and reports nothing.\n *\n * No connection string appears here. The construct that owns the database is\n * the only thing that knows its key, and it is resolved through service\n * discovery like any other dependency.\n */\nimport type { EnvironmentParser } from '@geekmidas/envkit';\nimport type { Logger } from '@geekmidas/logger';\nimport { runCron, scheduleInProcess, toCronExpression } from '@geekmidas/constructs/crons';\nimport { ServiceDiscovery } from '@geekmidas/services';\n${imports}\n\nconst crons = [\n${entries}\n];\n\ntype Stoppable = { stop: () => Promise<void> | void };\nconst running: Stoppable[] = [];\n// What a worker's health check reads: the crons that cannot be scheduled, and\n// the broker connection the schedule is kept through.\nconst failed: string[] = [];\nconst connections: import('@geekmidas/events').EventConnection[] = [];\n\nexport async function setupCrons(\n envParser: EnvironmentParser<any>,\n logger: Logger,\n): Promise<void> {\n if (crons.length === 0) {\n return;\n }\n\n const serviceDiscovery = ServiceDiscovery.getInstance(envParser);\n\n // Resolved once per cron rather than per firing: registering services on\n // every tick would reconnect a database every minute.\n const prepared = [];\n for (const { name, cron } of crons) {\n try {\n const schedule = toCronExpression(cron.schedule);\n const services = cron.services.length > 0\n ? await serviceDiscovery.register(cron.services)\n : {};\n\n prepared.push({ name, cron, schedule, services });\n } catch (error) {\n // An unrepresentable schedule is a build-time mistake, and failing the\n // process for it would take the HTTP server down with it.\n logger.error({ err: error, cron: name }, 'Cron has no runnable schedule, skipping');\n failed.push(name);\n }\n }\n\n const run = async (entry: (typeof prepared)[number]) => {\n try {\n // The cron's own function, the way its Lambda would run it — services,\n // the worker's database as \\`db\\`, its events. It used to call a\n // \\`handler\\` a Cron does not have, so every firing logged a failure.\n await runCron(entry.cron, serviceDiscovery, entry.name);\n } catch (error) {\n logger.error({ err: error, cron: entry.name }, 'Cron failed');\n }\n };\n\n // The app's one pg-boss: the events broker's, as the broker's role, in the\n // broker's schema. A server fires its own crons, and a process scheduling in\n // memory fires each job once per replica — so the schedule lives in\n // Postgres. It used to be a second pg-boss on the worker's database, as the\n // runtime role, which can neither create a schema nor use the broker's.\n const { url, devPid } = envParser\n .create((get) => ({\n url: get('EVENT_PUBLISHER_CONNECTION_STRING').string().optional(),\n // Set by \\`gkm dev\\` on the server it starts, and by nothing deployed.\n devPid: get('GKM_DEV_PID').string().optional(),\n }))\n .parse();\n\n if (!url?.startsWith('pgboss://')) {\n // \\`gkm dev\\` on a target whose crons are infrastructure once deployed —\n // EventBridge rules on AWS — has no broker to keep a schedule in. It is one\n // process, so a timer fires each job once, which is all pg-boss is for\n // here. Only there: a deployed server firing by timer fires once per\n // replica, so outside dev this stays the error below.\n if (devPid) {\n for (const entry of prepared) {\n running.push(scheduleInProcess(entry.schedule, () => run(entry)));\n logger.info({ cron: entry.name, schedule: entry.schedule }, 'Cron scheduled in this process');\n }\n return;\n }\n\n logger.error(\n { crons: prepared.map(({ name }) => name) },\n 'These crons have nowhere to keep their schedule. On a server they are ' +\n 'scheduled through the pg-boss events broker ' +\n '(EVENT_PUBLISHER_CONNECTION_STRING), and ' +\n (url ? 'the broker configured is not pg-boss.' : 'none is configured.'),\n );\n failed.push(...prepared.map(({ name }) => name));\n return;\n }\n\n // Through the registered pg-boss driver, which the entry registers for a\n // server whose broker is pg-boss. Naming \\`@geekmidas/events/pgboss\\` here\n // made every bundle with a cron resolve pg-boss, whatever its broker.\n const { EventConnectionFactory } = await import('@geekmidas/events');\n const connection = (await EventConnectionFactory.fromConnectionString(\n url,\n )) as import('@geekmidas/events').EventConnection & { instance?: any };\n const boss = connection.instance!;\n\n // What this app declares now. Anything else under the prefix belonged to a\n // cron since renamed or deleted, and would keep firing at a handler that has\n // gone.\n //\n // The prefix is \\`cron.\\` rather than \\`cron:\\`: pg-boss accepts\n // alphanumerics, underscores, hyphens, periods and slashes in a queue name,\n // and rejects a colon outright.\n const declared = new Set(prepared.map(({ name }) => \\`cron.\\${name}\\`));\n for (const existing of await boss.getSchedules()) {\n if (existing.name.startsWith('cron.') && !declared.has(existing.name)) {\n await boss.unschedule(existing.name);\n logger.info({ cron: existing.name }, 'Removed a schedule nothing declares');\n }\n }\n\n for (const entry of prepared) {\n const queue = \\`cron.\\${entry.name}\\`;\n await boss.createQueue(queue);\n // UTC, so this agrees with the schedule a deploy target would have made.\n await boss.schedule(queue, entry.schedule, undefined, { tz: 'UTC' });\n await boss.work(queue, () => run(entry));\n\n logger.info({ cron: entry.name, schedule: entry.schedule }, 'Cron scheduled');\n }\n\n running.push({ stop: () => connection.close() });\n connections.push(connection);\n logger.info({ count: prepared.length }, 'Crons scheduled');\n}\n\n/** The crons that cannot be scheduled, and the connection that schedules the rest. */\nexport function cronsStatus(): {\n failed: string[];\n connections: import('@geekmidas/events').EventConnection[];\n} {\n return { failed: [...failed], connections: [...connections] };\n}\n\n/**\n * Stop scheduling, let a firing in flight finish, and close the broker\n * connection — pg-boss's graceful stop does all three. The caller bounds it.\n */\nexport async function stopCrons(): Promise<void> {\n const open = [...running];\n running.length = 0;\n connections.length = 0;\n await Promise.all(open.map((r) => r.stop()));\n}\n`;\n\n\t\tawait writeFile(cronsPath, content);\n\n\t\treturn cronsPath;\n\t}\n\n\tprivate async generateCronHandler(\n\t\toutputDir: string,\n\t\tsourceFile: string,\n\t\texportName: string,\n\t\tcontext: BuildContext,\n\t\t/** The construct that owns this — its worker, or its surface. */\n\t\towner: string | undefined,\n\t): Promise<string> {\n\t\tconst handlerFileName = `${exportName}.ts`;\n\t\tconst handlerPath = join(outputDir, handlerFileName);\n\n\t\tconst relativePath = relative(dirname(handlerPath), sourceFile);\n\t\tconst importPath = relativePath.replace(/\\.ts$/, '.js');\n\n\t\t// Imports the construct that owns this, and binds `envParser` and\n\t\t// `logger` off it — the objects it was declared with, rather than a\n\t\t// module path printed in from config.\n\t\tconst runtime = runtimeFor(context, dirname(handlerPath), owner);\n\n\t\tconst content = `import { AWSScheduledFunction } from '@geekmidas/constructs/aws';\nimport { ${exportName} } from '${importPath}';\n${runtime.imports}\n${context.storageDrivers?.imports ?? ''}\n${runtime.bindings}\n${context.storageDrivers?.setup ? `\\n// The handler registers the drivers its target needs.\\n${context.storageDrivers.setup}\\n` : ''}\nconst adapter = new AWSScheduledFunction(envParser, ${exportName});\n\nexport const handler = adapter.handler;\n`;\n\n\t\tawait writeFile(handlerPath, content);\n\t\treturn handlerPath;\n\t}\n}\n","import { mkdir, writeFile } from 'node:fs/promises';\nimport { dirname, join, relative } from 'node:path';\nimport { Queue } from '@geekmidas/constructs/queue';\nimport { providedKeyFor } from '@geekmidas/manifest';\nimport type { BuildContext } from '../build/types';\nimport type { QueueInfo } from '../types';\nimport { runtimeFor } from './EndpointGenerator.js';\nimport {\n\tConstructGenerator,\n\ttype GeneratedConstruct,\n\ttype GeneratorOptions,\n} from './Generator';\n\n/**\n * Generates the runtime for queue consumers (`worker.queue(…)`).\n *\n * - **server** (`gkm dev`): a single `queues.ts` exposing `setupQueues()` that\n * polls each queue in-process, alongside the Hono server, through the queue's\n * own connection string — pg-boss by default, SQS on the AWS emulator.\n * - **aws-lambda**: one handler file per queue wrapping `AWSLambdaQueue`, backed\n * by an SQS event-source mapping.\n */\nexport class QueueGenerator extends ConstructGenerator<\n\tQueue<any, any, any, any, any, any>,\n\tQueueInfo[]\n> {\n\tisConstruct(value: any): value is Queue<any, any, any, any, any, any> {\n\t\treturn Queue.isQueue(value);\n\t}\n\n\tasync build(\n\t\tcontext: BuildContext,\n\t\tconstructs: GeneratedConstruct<Queue<any, any, any, any, any, any>>[],\n\t\toutputDir: string,\n\t\toptions?: GeneratorOptions,\n\t): Promise<QueueInfo[]> {\n\t\tconst target = options?.target ?? 'aws';\n\t\tconst logger = console;\n\t\tconst queueInfos: QueueInfo[] = [];\n\n\t\tif (target === 'server') {\n\t\t\t// Generate queues.ts for in-process polling (even if empty, so the\n\t\t\t// server entry can always import setupQueues).\n\t\t\tawait this.generateServerQueuesFile(outputDir, constructs);\n\t\t\tlogger.log(\n\t\t\t\t`Generated server queues file with ${constructs.length} queues (polling mode)`,\n\t\t\t);\n\t\t\treturn queueInfos;\n\t\t}\n\n\t\tif (constructs.length === 0) {\n\t\t\treturn queueInfos;\n\t\t}\n\n\t\tconst queuesDir = join(outputDir, 'queues');\n\t\tawait mkdir(queuesDir, { recursive: true });\n\n\t\tfor (const { key, construct, path } of constructs) {\n\t\t\tconst handlerFile = await this.generateQueueHandler(\n\t\t\t\tqueuesDir,\n\t\t\t\tpath.relative,\n\t\t\t\tkey,\n\t\t\t\tcontext,\n\t\t\t\tconstruct.owner,\n\t\t\t);\n\n\t\t\tqueueInfos.push({\n\t\t\t\tname: construct.name,\n\t\t\t\thandler: relative(options?.root ?? process.cwd(), handlerFile).replace(\n\t\t\t\t\t/\\.ts$/,\n\t\t\t\t\t'.handler',\n\t\t\t\t),\n\t\t\t\tbatchSize: construct.batchSize,\n\t\t\t\tfifo: construct.fifo,\n\t\t\t\ttimeout: construct.timeout,\n\t\t\t\tenvironment: await construct.getEnvironment({\n\t\t\t\t\tmarkOptional: context.markOptional,\n\t\t\t\t}),\n\t\t\t\tdependencies: construct.constructs,\n\t\t\t});\n\n\t\t\tlogger.log(`Generated queue handler: ${key}`);\n\t\t}\n\n\t\treturn queueInfos;\n\t}\n\n\tprivate async generateQueueHandler(\n\t\toutputDir: string,\n\t\tsourceFile: string,\n\t\texportName: string,\n\t\tcontext: BuildContext,\n\t\t/** The construct that owns this — its worker, or its surface. */\n\t\towner: string | undefined,\n\t): Promise<string> {\n\t\tconst handlerPath = join(outputDir, `${exportName}.ts`);\n\t\tconst importPath = relative(dirname(handlerPath), sourceFile).replace(\n\t\t\t/\\.ts$/,\n\t\t\t'.js',\n\t\t);\n\t\t// Imports the construct that owns this, and binds `envParser` and\n\t\t// `logger` off it — the objects it was declared with, rather than a\n\t\t// module path printed in from config.\n\t\tconst runtime = runtimeFor(context, dirname(handlerPath), owner);\n\n\t\tconst content = `import { AWSLambdaQueue } from '@geekmidas/constructs/aws';\nimport { ${exportName} } from '${importPath}';\n${runtime.imports}\n${context.storageDrivers?.imports ?? ''}\n${runtime.bindings}\n${context.storageDrivers?.setup ? `\\n// The handler registers the drivers its target needs.\\n${context.storageDrivers.setup}\\n` : ''}\nconst adapter = new AWSLambdaQueue(envParser, ${exportName});\n\nexport const handler = adapter.handler;\n`;\n\n\t\tawait writeFile(handlerPath, content);\n\t\treturn handlerPath;\n\t}\n\n\tprivate async generateServerQueuesFile(\n\t\toutputDir: string,\n\t\tqueues: GeneratedConstruct<Queue<any, any, any, any, any, any>>[],\n\t): Promise<string> {\n\t\tawait mkdir(outputDir, { recursive: true });\n\n\t\tconst queuesPath = join(outputDir, 'queues.ts');\n\n\t\t// Nothing to poll, so nothing to import. Every app gets this file, and\n\t\t// `@geekmidas/events` is only installed by one that declared a Topic or\n\t\t// a Queue — importing it here crashed every dev server that had not.\n\t\tif (queues.length === 0) {\n\t\t\tawait writeFile(\n\t\t\t\tqueuesPath,\n\t\t\t\t`/**\n * Generated queues setup — this app declares none.\n */\nimport type { EnvironmentParser } from '@geekmidas/envkit';\nimport type { Logger } from '@geekmidas/logger';\n\nexport async function setupQueues(\n _envParser: EnvironmentParser<any>,\n _logger: Logger,\n): Promise<void> {}\n\nexport function queuesStatus(): { failed: string[]; connections: unknown[] } {\n return { failed: [], connections: [] };\n}\n\nexport async function stopQueues(): Promise<void> {}\n`,\n\t\t\t);\n\t\t\treturn queuesPath;\n\t\t}\n\n\t\t// Group imports by file\n\t\tconst importsByFile = new Map<string, string[]>();\n\t\tfor (const { path, key } of queues) {\n\t\t\tconst importPath = relative(dirname(queuesPath), path.relative).replace(\n\t\t\t\t/\\.ts$/,\n\t\t\t\t'.js',\n\t\t\t);\n\t\t\tif (!importsByFile.has(importPath)) {\n\t\t\t\timportsByFile.set(importPath, []);\n\t\t\t}\n\t\t\timportsByFile.get(importPath)?.push(key);\n\t\t}\n\n\t\tconst imports = Array.from(importsByFile.entries())\n\t\t\t.map(\n\t\t\t\t([importPath, exports]) =>\n\t\t\t\t\t`import { ${exports.join(', ')} } from '${importPath}';`,\n\t\t\t)\n\t\t\t.join('\\n');\n\n\t\t// Each queue's consumer reaches its own queue, by the queue's own key.\n\t\tconst entries = queues\n\t\t\t.map(\n\t\t\t\t({ key, construct }) =>\n\t\t\t\t\t` { queue: ${key}, connectionKey: '${providedKeyFor(\n\t\t\t\t\t\tconstruct.id,\n\t\t\t\t\t\t'queue',\n\t\t\t\t\t\t'publisherConnectionString',\n\t\t\t\t\t)}' },`,\n\t\t\t)\n\t\t\t.join('\\n');\n\n\t\tconst content = `/**\n * Generated queue consumers setup.\n *\n * Each queue's one consumer polls its own queue, through the queue's own\n * connection string — the one its producers publish on. SQS cannot push, so\n * this is a poller on every transport: pg-boss locally by default, the SQS\n * queue on the AWS emulator.\n *\n * Deployed on Lambda, a queue's consumer is an SQS event source instead.\n */\nimport type { EnvironmentParser } from '@geekmidas/envkit';\nimport type { Logger } from '@geekmidas/logger';\nimport { EventConnectionFactory, Subscriber } from '@geekmidas/events';\nimport type { EventConnection } from '@geekmidas/events';\nimport { ServiceDiscovery } from '@geekmidas/services';\n${imports}\n\nconst queues = [\n${entries}\n];\n\n// What was opened, and what could not be: a worker's health check reads both,\n// and its shutdown closes what was opened.\nconst connections = new Map<string, EventConnection>();\nconst failed: string[] = [];\n\nexport async function setupQueues(\n envParser: EnvironmentParser<any>,\n logger: Logger,\n): Promise<void> {\n const serviceDiscovery = ServiceDiscovery.getInstance(envParser);\n\n for (const { queue, connectionKey } of queues) {\n const connectionString = process.env[connectionKey];\n if (!connectionString) {\n logger.error({ queue: queue.name, connectionKey }, 'No connection string for this queue');\n failed.push(queue.name);\n continue;\n }\n\n try {\n let connection = connections.get(connectionString);\n if (!connection) {\n connection = await EventConnectionFactory.fromConnectionString(connectionString);\n connections.set(connectionString, connection);\n }\n const eventSubscriber = await Subscriber.fromConnection(connection);\n const services = queue.services.length > 0\n ? await serviceDiscovery.register(queue.services)\n : {};\n // The queue's database — the worker's, or its own — handed over as \\`db\\`.\n const db = queue.databaseService\n ? (await serviceDiscovery.register([queue.databaseService]))[\n queue.databaseService.serviceName\n ]\n : undefined;\n\n // A queue's messages carry one type — its own name.\n await eventSubscriber.subscribe([queue.name], async (message) => {\n try {\n const validation = await queue.messageSchema['~standard'].validate(message.payload);\n if (validation.issues) {\n logger.error({ issues: validation.issues, queue: queue.name }, 'Queue message failed validation');\n return;\n }\n\n await queue.handler({\n messages: [validation.value],\n services: services,\n logger: queue.logger,\n db,\n } as any);\n } catch (error) {\n logger.error({ err: error, queue: queue.name }, 'Failed to process queue message');\n // Rethrown so the transport keeps the message for a retry.\n throw error;\n }\n });\n logger.info({ queue: queue.name }, 'Queue consumer started polling');\n } catch (error) {\n logger.error({ err: error, queue: queue.name }, 'Failed to set up queue consumer');\n failed.push(queue.name);\n }\n }\n}\n\n/** The consumers that could not start, and the connections that did. */\nexport function queuesStatus(): { failed: string[]; connections: EventConnection[] } {\n return { failed: [...failed], connections: [...connections.values()] };\n}\n\n/**\n * Stop polling, let the messages in flight finish, and close each broker\n * connection — pg-boss's graceful stop does all three. The caller bounds it.\n */\nexport async function stopQueues(): Promise<void> {\n const open = [...connections.values()];\n connections.clear();\n await Promise.all(open.map((connection) => connection.close()));\n}\n`;\n\n\t\tawait writeFile(queuesPath, content);\n\t\treturn queuesPath;\n\t}\n}\n","import { mkdir, writeFile } from 'node:fs/promises';\nimport { join } from 'node:path';\nimport type { Cron } from '@geekmidas/constructs/crons';\nimport type { Queue } from '@geekmidas/constructs/queue';\nimport type { Subscriber } from '@geekmidas/constructs/subscribers';\nimport type { BuildContext } from '../build/types';\nimport { GkmError } from '../errors';\nimport { appKey } from '../workspace/derive.js';\nimport { CronGenerator } from './CronGenerator';\nimport { runtimeFor } from './EndpointGenerator.js';\nimport type { GeneratedConstruct } from './Generator';\nimport { QueueGenerator } from './QueueGenerator';\nimport { SubscriberGenerator } from './SubscriberGenerator';\nimport {\n\tstartTelemetryCode,\n\ttype TelemetryContext,\n\twriteTelemetryModule,\n} from './telemetry';\n\n/**\n * A worker whose topic subscribers would have to be pushed to over HTTP.\n *\n * On SNS a subscriber is an HTTP endpoint SNS delivers to, and a worker's\n * process serves nothing but its health check. A server target's broker is\n * pg-boss, where each subscriber polls a queue of its own, so this is only\n * reached by building server images for a project that deploys to AWS — where\n * a subscriber is a Lambda instead.\n */\nexport class WorkerSubscribersNeedPush extends GkmError {\n\tconstructor(\n\t\treadonly worker: string,\n\t\treadonly subscribers: readonly string[],\n\t) {\n\t\tsuper(\n\t\t\t`The worker '${worker}' runs topic subscribers (${subscribers.join(', ')}), ` +\n\t\t\t\t`and this build's broker is SNS, which pushes each event to its ` +\n\t\t\t\t`subscriber over HTTP. A worker image serves only its health check. ` +\n\t\t\t\t`Deploy to a server target, whose broker is pg-boss and whose ` +\n\t\t\t\t`subscribers poll, or to AWS, where each subscriber is a Lambda.`,\n\t\t);\n\t\tthis.name = 'WorkerSubscribersNeedPush';\n\t}\n}\n\n/** Where a worker's generated entry lives, under an app's `.gkm/server`. */\nexport function workerEntryDir(serverDir: string, workerId: string): string {\n\treturn join(serverDir, 'workers', appKey(workerId));\n}\n\n/** The file a worker's bundle is written to, beside the server's. */\nexport function workerBundleName(workerId: string): string {\n\treturn `worker-${appKey(workerId)}.mjs`;\n}\n\nexport interface WorkerEntryInput {\n\tcontext: BuildContext;\n\t/** The worker's construct id, `Jobs`. */\n\tworkerId: string;\n\t/** The worker's own directory — see `workerEntryDir`. */\n\toutputDir: string;\n\t/** Everything built from this worker, and nothing built from another. */\n\tcrons: GeneratedConstruct<Cron<any, any, any, any, any, any>>[];\n\tqueues: GeneratedConstruct<Queue<any, any, any, any, any, any>>[];\n\tsubscribers: GeneratedConstruct<\n\t\tSubscriber<any, any, any, any, any, any, any>\n\t>[];\n\t/** What its process starts OpenTelemetry with — none without an edge. */\n\ttelemetry?: TelemetryContext;\n}\n\n/**\n * A Worker's production entry: the process that runs its crons, its queue\n * consumers and its topic subscribers, and answers nothing but a health check.\n *\n * It is the server's runtime without the server. The `crons.ts`, `queues.ts`\n * and `subscribers.ts` it starts are the files `gkm dev` starts — written by\n * the same generators, given only this worker's constructs — so a consumer\n * runs the same code in development and in the image. What it adds is the\n * process around them: drivers, a health check that says when a consumer or\n * the broker is down, and a shutdown that drains.\n */\nexport class WorkerGenerator {\n\tconstructor(\n\t\tprivate readonly generators = {\n\t\t\tcron: new CronGenerator(),\n\t\t\tqueue: new QueueGenerator(),\n\t\t\tsubscriber: new SubscriberGenerator(),\n\t\t},\n\t) {}\n\n\t/** Write the worker's files; returns its entry, `worker.ts`. */\n\tasync build(input: WorkerEntryInput): Promise<string> {\n\t\tconst { context, workerId, outputDir } = input;\n\n\t\tif (\n\t\t\tinput.subscribers.length > 0 &&\n\t\t\tcontext.eventsBackends?.includes('sns')\n\t\t) {\n\t\t\tthrow new WorkerSubscribersNeedPush(\n\t\t\t\tworkerId,\n\t\t\t\tinput.subscribers.map(({ key }) => key),\n\t\t\t);\n\t\t}\n\n\t\tawait mkdir(outputDir, { recursive: true });\n\t\tconst options = { target: 'server' as const };\n\t\tawait Promise.all([\n\t\t\tthis.generators.cron.build(context, input.crons, outputDir, options),\n\t\t\tthis.generators.queue.build(context, input.queues, outputDir, options),\n\t\t\tthis.generators.subscriber.build(\n\t\t\t\tcontext,\n\t\t\t\tinput.subscribers,\n\t\t\t\toutputDir,\n\t\t\t\toptions,\n\t\t\t),\n\t\t]);\n\n\t\tawait writeFile(\n\t\t\tjoin(outputDir, 'app.ts'),\n\t\t\tworkerApp(context, workerId, outputDir),\n\t\t);\n\t\t// The worker's own edge decides, not the app's that carries it.\n\t\tawait writeTelemetryModule(outputDir, input.telemetry);\n\n\t\tconst entry = join(outputDir, 'worker.ts');\n\t\tawait writeFile(\n\t\t\tentry,\n\t\t\tworkerEntry(context.production?.healthCheck ?? '/health'),\n\t\t);\n\t\treturn entry;\n\t}\n}\n\n/**\n * `app.ts`: the worker's runtime — its logger and environment parser off the\n * Worker construct, the drivers its target needs, and a `startWorker` that\n * starts every cron, consumer and subscriber it owns.\n */\nfunction workerApp(\n\tcontext: BuildContext,\n\tworkerId: string,\n\toutputDir: string,\n): string {\n\tconst runtime = runtimeFor(context, outputDir, workerId);\n\n\treturn `/**\n * Generated worker runtime for ${workerId}.\n * Generated by 'gkm build --production'.\n */\nimport { setupCrons, cronsStatus, stopCrons } from './crons.js';\nimport { setupQueues, queuesStatus, stopQueues } from './queues.js';\nimport { setupSubscribers, subscribersStatus, stopSubscribers } from './subscribers.js';\n${runtime.imports}\n${context.storageDrivers?.imports ?? ''}\n\n${runtime.bindings}\n\n${\n\tcontext.storageDrivers?.setup\n\t\t? `// The entry point registers the drivers its target needs.\n${context.storageDrivers.setup}\n`\n\t\t: ''\n}\n// Who this worker is to Postgres: application_name on every connection.\nprocess.env.GKM_APP_NAME ??= ${JSON.stringify(workerId)};\n\nexport { logger };\n\n/** What the health check answers, and why. */\nexport interface WorkerHealth {\n healthy: boolean;\n /** The crons, queues and subscribers that could not start. */\n failed: string[];\n /** How many broker connections did not answer. */\n down: number;\n}\n\n/** Whether one broker connection answers: open, and — on pg-boss — a query. */\nasync function answers(connection: unknown): Promise<boolean> {\n const c = connection as {\n isConnected?: () => boolean;\n instance?: { getDb?: () => { executeSql: (sql: string) => Promise<unknown> } };\n };\n if (c.isConnected && !c.isConnected()) return false;\n const db = c.instance?.getDb?.();\n if (!db) return true;\n try {\n await Promise.race([\n db.executeSql('select 1'),\n new Promise((_, reject) => setTimeout(() => reject(new Error('timeout')), 2000).unref()),\n ]);\n return true;\n } catch {\n return false;\n }\n}\n\n/** A request to a route this worker mounted, and what it answered. */\nexport interface WorkerRequest {\n headers: Record<string, string | string[] | undefined>;\n body: string;\n /** The request's query — Mailpit's webhook carries its token there. */\n query?: URLSearchParams;\n}\nexport interface WorkerAnswer {\n status: number;\n body: unknown;\n}\n\n// The routes something pushes to: an SNS subscriber's, and the one a local\n// object store posts a bucket's events to. Mounted by the subscribers, served\n// by the entry's HTTP server beside the health check.\nconst routes = new Map<string, (c: any) => unknown>();\nconst app = {\n post: (path: string, handler: (c: any) => unknown) => {\n routes.set(path, handler);\n },\n};\n\n/** Run one mounted route, as the subscribers' handlers expect to be called. */\nasync function route(path: string, request: WorkerRequest): Promise<WorkerAnswer | undefined> {\n const handler = routes.get(path);\n if (!handler) return undefined;\n let answer: WorkerAnswer | undefined;\n const c = {\n req: {\n text: async () => request.body,\n query: (name: string) => request.query?.get(name) ?? undefined,\n header: (name: string) => {\n const value = request.headers[name.toLowerCase()];\n return Array.isArray(value) ? value[0] : value;\n },\n },\n json: (body: unknown, status = 200) => {\n answer = { status, body };\n return answer;\n },\n };\n await handler(c);\n return answer ?? { status: 204, body: null };\n}\n\n/** Start everything this worker runs. */\nexport async function startWorker(): Promise<{\n health: () => Promise<WorkerHealth>;\n stop: () => Promise<void>;\n route: typeof route;\n /** Subscribe the pushed routes, once the server answers on \\`port\\`. */\n subscribeForPush: (port: number) => Promise<void>;\n}> {\n const subscribeForPush = await setupSubscribers(app, envParser, logger).catch((error) => {\n logger.error({ err: error }, 'Failed to start subscribers');\n return async (_port: number) => {};\n });\n await setupQueues(envParser, logger).catch((error) => {\n logger.error({ err: error }, 'Failed to start queue consumers');\n });\n await setupCrons(envParser, logger).catch((error) => {\n logger.error({ err: error }, 'Failed to schedule crons');\n });\n\n const statuses = () => [subscribersStatus(), queuesStatus(), cronsStatus()];\n\n return {\n route,\n subscribeForPush,\n async health() {\n const all = statuses();\n const failed = all.flatMap((s) => s.failed);\n const alive = await Promise.all(\n all.flatMap((s) => s.connections as unknown[]).map(answers),\n );\n const down = alive.filter((ok) => !ok).length;\n return { healthy: failed.length === 0 && down === 0, failed, down };\n },\n // Each stops pulling, waits for what it has in flight, and closes its\n // broker connection. Together, so one slow handler does not hold the\n // others' connections open.\n async stop() {\n await Promise.all([stopSubscribers(), stopQueues(), stopCrons()]);\n },\n };\n}\n`;\n}\n\n/**\n * `worker.ts`: the process. Health first, so the container answers while the\n * consumers connect; then the worker; then a shutdown that drains.\n */\nfunction workerEntry(healthCheck: string): string {\n\treturn `#!/usr/bin/env node\n/**\n * Production worker entry point.\n * Generated by 'gkm build --production'.\n *\n * Runs this worker's crons, queue consumers and topic subscribers, and serves\n * its health check: ${healthCheck}, on PORT — 200 when every consumer started\n * and every broker connection answers, 503 otherwise. Beside it, on the same\n * port, the POST routes its subscribers mounted: where a local object store\n * posts a bucket's events.\n *\n * On SIGTERM it stops pulling messages and scheduling crons, lets the handlers\n * in flight finish, closes its broker connections and database pools, and\n * exits 0 — or 1, at GKM_SHUTDOWN_TIMEOUT_MS (8s by default, under Docker's\n * 10s stop timeout).\n */\nimport { createServer } from 'node:http';\nimport { runShutdownHooks } from '@geekmidas/constructs';\n\n${startTelemetryCode([healthCheck])}\nconst { startWorker, logger } = await import('./app.js');\n\nconst port = Number(process.env.PORT) || 3000;\n\nlet worker: Awaited<ReturnType<typeof startWorker>> | undefined;\nlet stopping = false;\n\nconst server = createServer((req, res) => {\n // Parsed once: the path routes, the query goes to the route.\n const url = new URL(req.url ?? '/', 'http://localhost');\n const path = url.pathname;\n const answer = (status: number, body: unknown) => {\n res.writeHead(status, { 'content-type': 'application/json' });\n res.end(JSON.stringify(body));\n };\n\n // A route a subscriber mounted: what SNS pushes to, or what a local object\n // store posts a bucket's events to. Refused while starting or stopping, so\n // the sender keeps the message and sends it again.\n if (req.method === 'POST') {\n let body = '';\n req.setEncoding('utf8');\n req.on('data', (chunk) => {\n body += chunk;\n });\n req.on('end', () => {\n if (stopping) return answer(503, { status: 'stopping' });\n if (!worker) return answer(503, { status: 'starting' });\n worker.route(path, { headers: req.headers, body, query: url.searchParams }).then(\n (routed) => (routed ? answer(routed.status, routed.body) : answer(404, { status: 'not found' })),\n (error) => {\n logger.error({ err: error, path }, 'Route failed');\n answer(500, { status: 'failed' });\n },\n );\n });\n return;\n }\n\n if (path !== ${JSON.stringify(healthCheck)} || (req.method !== 'GET' && req.method !== 'HEAD')) {\n res.writeHead(404).end();\n return;\n }\n if (stopping) return answer(503, { status: 'stopping' });\n if (!worker) return answer(503, { status: 'starting' });\n worker.health().then(\n (health) => answer(health.healthy ? 200 : 503, { status: health.healthy ? 'ok' : 'unhealthy', ...health }),\n (error) => answer(503, { status: 'unhealthy', error: String(error) }),\n );\n});\nserver.listen(port);\n\nconst shutdown = async () => {\n if (stopping) return;\n stopping = true;\n const deadline = Number(process.env.GKM_SHUTDOWN_TIMEOUT_MS) || 8000;\n logger.info({ deadline }, 'Graceful shutdown initiated');\n setTimeout(() => {\n logger.warn({ deadline }, 'Shutdown deadline reached, exiting');\n process.exit(1);\n }, deadline).unref();\n\n // Nothing new is pulled or scheduled; what is in flight finishes.\n await worker?.stop().catch((error) => logger.error({ err: error }, 'Failed to stop the worker'));\n // Then what the handlers used: database pools.\n await runShutdownHooks((error) => logger.error({ err: error }, 'Shutdown hook failed'));\n server.close();\n logger.info('Worker stopped');\n process.exit(0);\n};\n\nprocess.on('SIGTERM', shutdown);\nprocess.on('SIGINT', shutdown);\n\nworker = await startWorker();\nlogger.info({ port }, 'Worker started');\nawait worker.subscribeForPush(port).catch((error) => {\n logger.error({ err: error }, 'Failed to subscribe for push');\n});\n`;\n}\n","import { existsSync } from 'node:fs';\nimport { appendFile, mkdir, readFile, writeFile } from 'node:fs/promises';\nimport { dirname, join, relative } from 'node:path';\nimport {\n\ttype ConstructManifest,\n\tIMAGE_ORIGINS_KEY,\n\timageOriginSources,\n\tPUBLIC_PREFIX,\n\tprovidedKeyFor,\n\tpublicEnvFor,\n} from '@geekmidas/manifest';\nimport {\n\ttype ProcessorUnit,\n\tprocessorUnits,\n\ttype WorkerUnit,\n\tworkerUnits,\n} from '../build/workers.js';\nimport { loadWorkspaceConfig } from '../config';\nimport { GkmError } from '../errors';\nimport { processorBundleName } from '../generators/ProcessorGenerator.js';\nimport { workerBundleName } from '../generators/WorkerGenerator.js';\nimport { output } from '../output';\nimport { dockerfileOf } from '../reconcile/apps.js';\nimport { COMPOSE_PATH } from '../reconcile/index.js';\nimport { reconcileWorkspace } from '../reconcile/workspace.js';\nimport { run } from '../run';\nimport { getPublicUrlArgNames } from '../target/dokploy/domain.js';\nimport { siteClientTelemetry } from '../telemetry/edges.js';\nimport type { CacheBackend, GkmConfig } from '../types';\nimport { appKey } from '../workspace/derive.js';\nimport type {\n\tNormalizedAppConfig,\n\tNormalizedWorkspace,\n} from '../workspace/types.js';\nimport { validateImageRef } from './imageRef';\nimport { appImageOptions, type ImageLayout, imageLayout } from './layout';\nimport {\n\tgenerateBackendDockerfile,\n\tgenerateDockerignore,\n\tgenerateEntryDockerfile,\n\tgenerateNextjsDockerfile,\n\tgenerateNodeWebDockerfile,\n\tgenerateProcessorDockerfile,\n\tgenerateViteStaticDockerfile,\n\tgenerateWorkerDockerfile,\n\tPROCESSOR_PORT,\n\tresolveDockerConfig,\n\tWORKER_PORT,\n} from './templates';\n\nexport { ImageRefInvalid, validateImageRef } from './imageRef';\nexport {\n\tappImageOptions,\n\tcomposeBuildPaths,\n\tfromBuildRoot,\n\ttype ImageLayout,\n\timageLayout,\n\tMonorepoNeedsTurbo,\n} from './layout';\nexport {\n\tdetectPackageManager,\n\tfindBuildRoot,\n\tfindLockfilePath,\n\thasTurboConfig,\n\tisMonorepo,\n} from './templates';\n\n// Through `output`, so a deploy run that generates a Dockerfile hears it.\nconst logger = output;\n\n/** `docker build` failed; what docker printed above says why. */\nexport class DockerBuildFailed extends Error {\n\tconstructor(\n\t\treadonly imageRef: string,\n\t\tcause: unknown,\n\t) {\n\t\tsuper(\n\t\t\t`Failed to build Docker image: ${cause instanceof Error ? cause.message : String(cause)}`,\n\t\t\t{ cause },\n\t\t);\n\t\tthis.name = 'DockerBuildFailed';\n\t}\n}\n\n/** `docker push` failed — usually the registry login or its permissions. */\nexport class DockerPushFailed extends Error {\n\tconstructor(\n\t\treadonly imageRef: string,\n\t\tcause: unknown,\n\t) {\n\t\tsuper(\n\t\t\t`Failed to push Docker image: ${cause instanceof Error ? cause.message : String(cause)}`,\n\t\t\t{ cause },\n\t\t);\n\t\tthis.name = 'DockerPushFailed';\n\t}\n}\n\n/** `gkm docker --push` was asked for with nowhere to push to. */\nexport class PushNeedsRegistry extends GkmError {\n\tconstructor(readonly imageName: string) {\n\t\tsuper(\n\t\t\t`Registry is required to push Docker image '${imageName}'. Use --registry or configure docker.registry in gkm.config.ts`,\n\t\t);\n\t\tthis.name = 'PushNeedsRegistry';\n\t}\n}\n\nexport interface DockerOptions {\n\t/** Build each app's image after generating files */\n\tbuild?: boolean;\n\t/** Push the images to the registry after building */\n\tpush?: boolean;\n\t/** Image tag (default: 'latest') */\n\ttag?: string;\n\t/** Container registry URL */\n\tregistry?: string;\n\t/**\n\t * The directory to generate for — an app's own, when a deploy builds it.\n\t * Defaults to the process's working directory.\n\t */\n\tcwd?: string;\n\t/**\n\t * The stage the images are for: a site's clients trace at its sample\n\t * rate. The local stage when absent.\n\t */\n\tstage?: string;\n}\n\n/**\n * Docker command implementation: one Dockerfile per deployable app, each\n * building its image inside Docker from a turbo-pruned slice of the build\n * root — nothing is built on the host — plus the build root's\n * `.dockerignore` and `docker-compose.constructs.yml`.\n */\nexport async function dockerCommand(\n\toptions: DockerOptions,\n): Promise<WorkspaceDockerResult> {\n\tconst cwd = options.cwd ?? process.cwd();\n\tconst loaded = await loadWorkspaceConfig(cwd);\n\n\t// A single-app config is a workspace of one app at its root; the image is\n\t// named the way its `docker` block says.\n\tconst names: Record<string, string> =\n\t\tloaded.type === 'single'\n\t\t\t? Object.fromEntries(\n\t\t\t\t\tObject.keys(loaded.workspace.apps).map((name) => [\n\t\t\t\t\t\tname,\n\t\t\t\t\t\tresolveDockerConfig(loaded.raw as GkmConfig).imageName,\n\t\t\t\t\t]),\n\t\t\t\t)\n\t\t\t: {};\n\n\tconst result = await workspaceDockerCommand(\n\t\tloaded.workspace,\n\t\tloaded.manifest,\n\t\tnames,\n\t\tloaded.background,\n\t\toptions.stage,\n\t);\n\n\tif (options.build) {\n\t\tfor (const app of result.apps) {\n\t\t\tawait buildDockerImage(app, result.buildRoot, options);\n\t\t}\n\t}\n\tif (options.push) {\n\t\tfor (const app of result.apps) {\n\t\t\tawait pushDockerImage(app.imageName, options, result.buildRoot);\n\t\t}\n\t}\n\n\treturn result;\n}\n\n/**\n * Build one app's image, from the build root.\n * Uses BuildKit for cache mount support\n */\nasync function buildDockerImage(\n\tapp: AppDockerResult,\n\tbuildRoot: string,\n\toptions: DockerOptions,\n): Promise<void> {\n\tconst tag = options.tag ?? 'latest';\n\tconst registry = options.registry;\n\n\t// Before anything runs: a ref docker would misread is refused by name.\n\tconst fullImageName = validateImageRef(\n\t\tregistry\n\t\t\t? `${registry}/${app.imageName}:${tag}`\n\t\t\t: `${app.imageName}:${tag}`,\n\t);\n\n\tlogger.log(`\\n🐳 Building Docker image: ${fullImageName}`);\n\n\ttry {\n\t\t// An argument array, so nothing in the ref is read by a shell, and\n\t\t// `--tag=` so it cannot be read as a flag.\n\t\tawait run(\n\t\t\t'docker',\n\t\t\t[\n\t\t\t\t'build',\n\t\t\t\t`--file=${relative(buildRoot, app.dockerfile)}`,\n\t\t\t\t`--tag=${fullImageName}`,\n\t\t\t\t'.',\n\t\t\t],\n\t\t\t{\n\t\t\t\tcwd: buildRoot,\n\t\t\t\t// BuildKit, for the templates' `RUN --mount=type=cache`.\n\t\t\t\tenv: { ...process.env, DOCKER_BUILDKIT: '1' },\n\t\t\t},\n\t\t);\n\t\tlogger.log(`✅ Docker image built: ${fullImageName}`);\n\t} catch (error) {\n\t\tthrow new DockerBuildFailed(fullImageName, error);\n\t}\n}\n\n/**\n * Push Docker image to registry\n */\nasync function pushDockerImage(\n\timageName: string,\n\toptions: DockerOptions,\n\tcwd: string,\n): Promise<void> {\n\tconst tag = options.tag ?? 'latest';\n\tconst registry = options.registry;\n\n\tif (!registry) {\n\t\tthrow new PushNeedsRegistry(imageName);\n\t}\n\n\tconst fullImageName = validateImageRef(`${registry}/${imageName}:${tag}`);\n\n\tlogger.log(`\\n🚀 Pushing Docker image: ${fullImageName}`);\n\n\ttry {\n\t\tawait run('docker', ['push', fullImageName], { cwd });\n\t\tlogger.log(`✅ Docker image pushed: ${fullImageName}`);\n\t} catch (error) {\n\t\tthrow new DockerPushFailed(fullImageName, error);\n\t}\n}\n\n/**\n * Result of generating Docker files for a single app in a workspace.\n */\nexport interface AppDockerResult {\n\tappName: string;\n\ttype: 'backend' | 'web' | 'mobile';\n\t/** The Dockerfile, absolute. */\n\tdockerfile: string;\n\timageName: string;\n}\n\n/**\n * Result of workspace docker command.\n */\nexport interface WorkspaceDockerResult {\n\tapps: AppDockerResult[];\n\tdockerCompose: string;\n\tdockerignore: string;\n\t/** Every image's build context, absolute. */\n\tbuildRoot: string;\n}\n\n/**\n * Generate Dockerfiles for all apps in a workspace.\n * @internal Exported for testing\n */\nexport async function workspaceDockerCommand(\n\tworkspace: NormalizedWorkspace,\n\t/** What the workspace declares — where a site's public keys come from. */\n\tmanifest?: ConstructManifest,\n\t/** Image names other than the app's own. */\n\timageNames: Readonly<Record<string, string>> = {},\n\t/** Each Worker's files, from discovery — which app each is built from. */\n\tbackground: Readonly<Record<string, readonly string[]>> = {},\n\t/** The stage a site's clients trace at the rate of — local when absent. */\n\tstage?: string,\n): Promise<WorkspaceDockerResult> {\n\tconst results: AppDockerResult[] = [];\n\tconst layout = imageLayout(workspace);\n\n\tlogger.log(`\\n🐳 Generating Dockerfiles for workspace: ${workspace.name}`);\n\tlogger.log(` Build root: ${layout.buildRoot}`);\n\tlogger.log(\n\t\t` Package manager: ${layout.tools.packageManager}${layout.tools.packageManagerVersion ? `@${layout.tools.packageManagerVersion}` : ''}, turbo@${layout.tools.turboVersion}`,\n\t);\n\n\tfor (const [appName, app] of Object.entries(workspace.apps)) {\n\t\t// Mobile apps deploy via their own toolchain (e.g. EAS Build for Expo)\n\t\t// — no Docker image is produced.\n\t\tif (app.type === 'mobile') {\n\t\t\tlogger.log(\n\t\t\t\t`\\n 📱 Skipping Docker for ${appName} (mobile app — deploy via framework toolchain)`,\n\t\t\t);\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst buildType = app.entry ? 'entry' : app.type;\n\t\tlogger.log(`\\n 📄 Generating Dockerfile for ${appName} (${buildType})`);\n\n\t\tconst dockerfile = appDockerfile(appName, app, {\n\t\t\tlayout,\n\t\t\tworkspaceRoot: workspace.root,\n\t\t\tapps: workspace.apps,\n\t\t\t...(manifest ? { manifest } : {}),\n\t\t\tworkspace,\n\t\t\t...(stage ? { stage } : {}),\n\t\t});\n\n\t\tconst path = dockerfileOf(appName, app.path);\n\t\tconst dockerfilePath = join(workspace.root, path);\n\t\tawait mkdir(dirname(dockerfilePath), { recursive: true });\n\t\tawait writeFile(dockerfilePath, dockerfile);\n\t\tlogger.log(` Generated: ${path}`);\n\n\t\tresults.push({\n\t\t\tappName,\n\t\t\ttype: app.type,\n\t\t\tdockerfile: dockerfilePath,\n\t\t\timageName: imageNames[appName] ?? appName,\n\t\t});\n\t}\n\n\t// Each Worker with background work: an image of its own, built from the\n\t// app whose build writes its entry.\n\tfor (const worker of manifest\n\t\t? workerUnits(workspace, manifest, background)\n\t\t: []) {\n\t\tlogger.log(\n\t\t\t`\\n 📄 Generating Dockerfile for ${worker.name} (worker ${worker.id}, built from ${worker.app})`,\n\t\t);\n\t\tconst dockerfile = workerDockerfile(worker, workspace.apps[worker.app]!, {\n\t\t\tlayout,\n\t\t\tworkspaceRoot: workspace.root,\n\t\t});\n\t\t// Always named for the worker: an app at the root has the bare\n\t\t// `Dockerfile`, which this must not overwrite.\n\t\tconst path = workerDockerfileOf(worker.name);\n\t\tconst dockerfilePath = join(workspace.root, path);\n\t\tawait mkdir(dirname(dockerfilePath), { recursive: true });\n\t\tawait writeFile(dockerfilePath, dockerfile);\n\t\tlogger.log(` Generated: ${path}`);\n\n\t\tresults.push({\n\t\t\tappName: worker.name,\n\t\t\ttype: 'backend',\n\t\t\tdockerfile: dockerfilePath,\n\t\t\timageName: imageNames[worker.name] ?? worker.name,\n\t\t});\n\t}\n\n\t// Each file server's processors: an image of their own, built from the\n\t// app whose build writes their entry.\n\tfor (const unit of manifest ? processorUnits(workspace, manifest) : []) {\n\t\tlogger.log(\n\t\t\t`\\n 📄 Generating Dockerfile for ${unit.name} (processors of ${unit.id}, built from ${unit.app})`,\n\t\t);\n\t\tconst dockerfile = processorDockerfile(unit, workspace.apps[unit.app]!, {\n\t\t\tlayout,\n\t\t\tworkspaceRoot: workspace.root,\n\t\t});\n\t\tconst path = workerDockerfileOf(unit.name);\n\t\tconst dockerfilePath = join(workspace.root, path);\n\t\tawait mkdir(dirname(dockerfilePath), { recursive: true });\n\t\tawait writeFile(dockerfilePath, dockerfile);\n\t\tlogger.log(` Generated: ${path}`);\n\n\t\tresults.push({\n\t\t\tappName: unit.name,\n\t\t\ttype: 'backend',\n\t\t\tdockerfile: dockerfilePath,\n\t\t\timageName: imageNames[unit.name] ?? unit.name,\n\t\t});\n\t}\n\n\tconst dockerignorePath = await ensureDockerignore(layout.buildRoot);\n\tlogger.log(`\\n Ensured: ${dockerignorePath}`);\n\n\tconst composePath = await writeConstructsCompose(workspace);\n\n\t// Summary\n\tlogger.log(\n\t\t`\\n✅ Generated ${results.length} Dockerfile(s) + ${COMPOSE_PATH}`,\n\t);\n\tlogger.log(`\\n📋 Build commands (from ${layout.buildRoot}):`);\n\tfor (const result of results) {\n\t\tconst icon =\n\t\t\tresult.type === 'backend' ? '⚙️' : result.type === 'mobile' ? '📱' : '🌐';\n\t\tlogger.log(\n\t\t\t` ${icon} docker build -f ${relative(layout.buildRoot, result.dockerfile)} -t ${result.imageName} .`,\n\t\t);\n\t}\n\tprintRunInstructions(workspace);\n\n\treturn {\n\t\tapps: results,\n\t\tdockerCompose: composePath,\n\t\tdockerignore: dockerignorePath,\n\t\tbuildRoot: layout.buildRoot,\n\t};\n}\n\n/**\n * One app's Dockerfile, by what it is: a gkm backend bundled by `gkm build`,\n * a backend with its own entry bundled by esbuild, or a site by its\n * framework. The one choice every builder of images makes.\n */\nexport function appDockerfile(\n\tappName: string,\n\tapp: NormalizedAppConfig,\n\toptions: {\n\t\tlayout: ImageLayout;\n\t\tworkspaceRoot: string;\n\t\t/**\n\t\t * Every app in the workspace, so a site's image knows the backends whose\n\t\t * clients it generates.\n\t\t */\n\t\tapps?: Readonly<Record<string, NormalizedAppConfig>>;\n\t\tmanifest?: ConstructManifest;\n\t\t/** The workspace's stages and `deploy.telemetry`, for a site's clients. */\n\t\tworkspace?: Pick<NormalizedWorkspace, 'stages' | 'deploy'>;\n\t\t/** A site's public keys, when the caller resolved them itself. */\n\t\tpublicUrlArgs?: string[];\n\t\t/**\n\t\t * The cache backend a gkm backend's entry registers, where it is not the\n\t\t * deploy target's — the compose stack's own Redis.\n\t\t */\n\t\tcache?: CacheBackend;\n\t\t/**\n\t\t * The stage whose sample rate a site's clients trace at — the local\n\t\t * stage when absent.\n\t\t */\n\t\tstage?: string;\n\t},\n): string {\n\tconst image = appImageOptions(\n\t\toptions.layout,\n\t\tappName,\n\t\tapp,\n\t\toptions.workspaceRoot,\n\t\toptions.apps,\n\t\tapp.type === 'web' && options.manifest && options.workspace\n\t\t\t? siteClientTelemetry(\n\t\t\t\t\toptions.manifest,\n\t\t\t\t\tappName,\n\t\t\t\t\toptions.workspace,\n\t\t\t\t\toptions.stage,\n\t\t\t\t)\n\t\t\t: undefined,\n\t);\n\n\tif (app.type === 'web') {\n\t\treturn siteDockerfile(appName, app, {\n\t\t\timage,\n\t\t\t...(options.manifest ? { manifest: options.manifest } : {}),\n\t\t\t...(options.publicUrlArgs\n\t\t\t\t? { publicUrlArgs: options.publicUrlArgs }\n\t\t\t\t: {}),\n\t\t});\n\t}\n\tif (app.entry) {\n\t\treturn generateEntryDockerfile({\n\t\t\t...image,\n\t\t\tentry: app.entry,\n\t\t\thealthCheckPath: '/health',\n\t\t});\n\t}\n\treturn generateBackendDockerfile({\n\t\t...image,\n\t\thealthCheckPath: '/health',\n\t\t...(options.cache ? { cache: options.cache } : {}),\n\t});\n}\n\n/** Where `gkm docker` writes a worker's Dockerfile. */\nexport function workerDockerfileOf(worker: string): string {\n\treturn `.gkm/docker/Dockerfile.${worker}`;\n}\n\n/**\n * A Worker's Dockerfile: its host app's build, and the worker's bundle as the\n * runner — see `generateWorkerDockerfile`.\n */\nexport function workerDockerfile(\n\tworker: WorkerUnit,\n\thost: NormalizedAppConfig,\n\toptions: {\n\t\tlayout: ImageLayout;\n\t\tworkspaceRoot: string;\n\t\t/** As {@link appDockerfile}'s: the cache backend its entry registers. */\n\t\tcache?: CacheBackend;\n\t},\n): string {\n\tconst image = appImageOptions(\n\t\toptions.layout,\n\t\tworker.app,\n\t\thost,\n\t\toptions.workspaceRoot,\n\t);\n\treturn generateWorkerDockerfile({\n\t\t...image,\n\t\timageName: worker.name,\n\t\tport: WORKER_PORT,\n\t\tworker: worker.id,\n\t\tbundle: workerBundleName(worker.id),\n\t\thealthCheckPath: '/health',\n\t\t...(options.cache ? { cache: options.cache } : {}),\n\t});\n}\n\n/**\n * A file server's processor unit's Dockerfile: its host app's build, and the\n * unit's bundle as the runner, with its processors' native packages\n * installed beside it — see `generateProcessorDockerfile`.\n */\nexport function processorDockerfile(\n\tunit: ProcessorUnit,\n\thost: NormalizedAppConfig,\n\toptions: {\n\t\tlayout: ImageLayout;\n\t\tworkspaceRoot: string;\n\t\tcache?: CacheBackend;\n\t},\n): string {\n\tconst image = appImageOptions(\n\t\toptions.layout,\n\t\tunit.app,\n\t\thost,\n\t\toptions.workspaceRoot,\n\t);\n\treturn generateProcessorDockerfile({\n\t\t...image,\n\t\timageName: unit.name,\n\t\tport: PROCESSOR_PORT,\n\t\tfileServer: unit.id,\n\t\tbundle: processorBundleName(unit.id),\n\t\thealthCheckPath: '/health',\n\t\t...(options.cache ? { cache: options.cache } : {}),\n\t});\n}\n\n/**\n * A site's Dockerfile, with an `ARG` for every key its bundler inlines.\n *\n * The keys come from the site's declaration where there is one — every\n * public key its edges give it, `VITE_UPLOADS_URL` included — and an\n * `ARG` the Dockerfile does not declare is a build argument the build drops,\n * leaving the bundle with an empty URL.\n */\nexport function siteDockerfile(\n\tappName: string,\n\tapp: NormalizedAppConfig,\n\toptions: {\n\t\timage: ReturnType<typeof appImageOptions>;\n\t\tmanifest?: ConstructManifest;\n\t\tpublicUrlArgs?: string[];\n\t},\n): string {\n\tconst declared = options.manifest\n\t\t? Object.entries(options.manifest).find(\n\t\t\t\t([id, d]) => d.kind === 'site' && appKey(id) === appName,\n\t\t\t)?.[1]\n\t\t: undefined;\n\tconst publicUrlArgs =\n\t\toptions.publicUrlArgs ??\n\t\t(declared?.kind === 'site' && options.manifest\n\t\t\t? [\n\t\t\t\t\t// Its own address under its own name, for server code that runs\n\t\t\t\t\t// at build — what `publicBuildValues` hands every image build.\n\t\t\t\t\tprovidedKeyFor(declared.id, declared.kind, 'url'),\n\t\t\t\t\t...Object.keys(publicEnvFor(declared, options.manifest)),\n\t\t\t\t\t// The origins its pages load files from, where it has any.\n\t\t\t\t\t...(imageOriginSources(declared, options.manifest).length > 0\n\t\t\t\t\t\t? [`${PUBLIC_PREFIX[declared.variant]}${IMAGE_ORIGINS_KEY}`]\n\t\t\t\t\t\t: []),\n\t\t\t\t]\n\t\t\t: getPublicUrlArgNames(app));\n\n\tconst webOpts = {\n\t\t...options.image,\n\t\tpublicUrlArgs,\n\t\t// Built against its stage's running APIs, so not offline.\n\t\t...(declared?.kind === 'site' && declared.prerender === 'stage'\n\t\t\t? { prerender: true }\n\t\t\t: {}),\n\t};\n\n\tswitch (app.framework) {\n\t\tcase 'vite':\n\t\t\treturn generateViteStaticDockerfile(webOpts);\n\t\tcase 'tanstack-start':\n\t\tcase 'remix':\n\t\t\treturn generateNodeWebDockerfile(webOpts);\n\t\tdefault:\n\t\t\t// nextjs (and any unspecified web framework — schema requires a valid\n\t\t\t// framework, so this is just a default).\n\t\t\treturn generateNextjsDockerfile(webOpts);\n\t}\n}\n\n/**\n * What a build root's `.dockerignore` must leave out of every image's\n * context: dependencies installed for another platform, anything built on the\n * host (every image builds from source), git, and gkm's own output —\n * `.gkm/compose`'s env files hold a stage's secrets.\n */\nconst REQUIRED_IGNORES = [\n\t'**/node_modules',\n\t'.git',\n\t'**/dist',\n\t'**/.next',\n\t'**/.turbo',\n\t'**/.gkm',\n\t'**/.gkm/compose',\n];\n\n/**\n * Make sure the build root's `.dockerignore` leaves out what no image may\n * hold: written whole where there is none, and each missing line appended to\n * one the project keeps.\n */\nexport async function ensureDockerignore(buildRoot: string): Promise<string> {\n\tconst path = join(buildRoot, '.dockerignore');\n\tif (!existsSync(path)) {\n\t\tawait writeFile(path, generateDockerignore());\n\t\treturn path;\n\t}\n\n\tconst current = await readFile(path, 'utf-8');\n\tconst lines = new Set(current.split(/\\r?\\n/).map((line) => line.trim()));\n\tconst missing = REQUIRED_IGNORES.filter((line) => !lines.has(line));\n\tif (missing.length === 0) return path;\n\n\tawait appendFile(\n\t\tpath,\n\t\t`${current.endsWith('\\n') || current === '' ? '' : '\\n'}\\n# gkm: images build from source, and a stack's env files hold its secrets\\n${missing.join('\\n')}\\n`,\n\t);\n\treturn path;\n}\n\n/**\n * Write `docker-compose.constructs.yml` — the same file `gkm dev` writes, with\n * the apps beside the containers their constructs derive.\n *\n * Through reconcile rather than a second generator, so what `gkm docker`\n * describes and what `gkm dev` runs cannot disagree. Nothing is started.\n */\nasync function writeConstructsCompose(\n\tworkspace: NormalizedWorkspace,\n): Promise<string> {\n\tawait reconcileWorkspace(workspace, {\n\t\tstage: workspace.stages.local,\n\t\tstart: false,\n\t});\n\tlogger.log(` Generated: ${COMPOSE_PATH} (project root)`);\n\treturn join(workspace.root, COMPOSE_PATH);\n}\n\nfunction printRunInstructions(workspace: NormalizedWorkspace): void {\n\tconst project = existsSync(join(workspace.root, 'docker-compose.yml'))\n\t\t? ' -f docker-compose.yml'\n\t\t: '';\n\tlogger.log('\\n📋 Run everything (the apps sit behind the \"apps\" profile):');\n\tlogger.log(\n\t\t' gkm setup # starts the containers and creates what they hold',\n\t);\n\tlogger.log(\n\t\t` docker compose -f ${COMPOSE_PATH}${project} --profile apps up --build`,\n\t);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAaA,MAAM,mBAAmB;AAC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ACA,OAAO,IACN,wBAAwB,eAAe,QAAQ,2BAChD;AACD"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
const require_errors = require("./errors-DMC4Umsb.cjs");
|
|
2
|
-
const require_credentials = require("./credentials-
|
|
3
|
-
const require_workspace = require("./workspace-
|
|
4
|
-
const require_apps = require("./apps-
|
|
5
|
-
const require_compose = require("./compose-
|
|
6
|
-
const require_SubscriberGenerator = require("./SubscriberGenerator-
|
|
7
|
-
const require_EndpointGenerator = require("./EndpointGenerator-
|
|
8
|
-
const require_discover = require("./discover-
|
|
2
|
+
const require_credentials = require("./credentials-CCCAy3NL.cjs");
|
|
3
|
+
const require_workspace = require("./workspace-p7gmCQVS.cjs");
|
|
4
|
+
const require_apps = require("./apps-By6pnfzA.cjs");
|
|
5
|
+
const require_compose = require("./compose-DwjaxFFK.cjs");
|
|
6
|
+
const require_SubscriberGenerator = require("./SubscriberGenerator-DMi4siph.cjs");
|
|
7
|
+
const require_EndpointGenerator = require("./EndpointGenerator-C1h_wExz.cjs");
|
|
8
|
+
const require_discover = require("./discover-39VKSE2i.cjs");
|
|
9
9
|
const require_config = require("./config.cjs");
|
|
10
10
|
let node_path = require("node:path");
|
|
11
11
|
let node_fs = require("node:fs");
|
|
@@ -684,7 +684,7 @@ import { ServiceDiscovery } from '@geekmidas/services';
|
|
|
684
684
|
${Array.from(importsByFile.entries()).map(([importPath, exports]) => `import { ${exports.join(", ")} } from '${importPath}';`).join("\n")}
|
|
685
685
|
|
|
686
686
|
const queues = [
|
|
687
|
-
${queues.map(({ key, construct }) => ` { queue: ${key}, connectionKey: '${(0, _geekmidas_manifest.
|
|
687
|
+
${queues.map(({ key, construct }) => ` { queue: ${key}, connectionKey: '${(0, _geekmidas_manifest.providedKeyFor)(construct.id, "queue", "publisherConnectionString")}' },`).join("\n")}
|
|
688
688
|
];
|
|
689
689
|
|
|
690
690
|
// What was opened, and what could not be: a worker's health check reads both,
|
|
@@ -1337,7 +1337,7 @@ function processorDockerfile(unit, host, options) {
|
|
|
1337
1337
|
function siteDockerfile(appName, app, options) {
|
|
1338
1338
|
const declared = options.manifest ? Object.entries(options.manifest).find(([id, d]) => d.kind === "site" && require_workspace.appKey(id) === appName)?.[1] : void 0;
|
|
1339
1339
|
const publicUrlArgs = options.publicUrlArgs ?? (declared?.kind === "site" && options.manifest ? [
|
|
1340
|
-
(0, _geekmidas_manifest.
|
|
1340
|
+
(0, _geekmidas_manifest.providedKeyFor)(declared.id, declared.kind, "url"),
|
|
1341
1341
|
...Object.keys((0, _geekmidas_manifest.publicEnvFor)(declared, options.manifest)),
|
|
1342
1342
|
...(0, _geekmidas_manifest.imageOriginSources)(declared, options.manifest).length > 0 ? [`${_geekmidas_manifest.PUBLIC_PREFIX[declared.variant]}${_geekmidas_manifest.IMAGE_ORIGINS_KEY}`] : []
|
|
1343
1343
|
] : require_compose.getPublicUrlArgNames(app));
|
|
@@ -1517,4 +1517,4 @@ Object.defineProperty(exports, "workerEntryDir", {
|
|
|
1517
1517
|
}
|
|
1518
1518
|
});
|
|
1519
1519
|
|
|
1520
|
-
//# sourceMappingURL=docker-
|
|
1520
|
+
//# sourceMappingURL=docker-CP4bspkW.cjs.map
|