@geekmidas/cli 10.0.0-alpha.13 → 10.0.0-alpha.130
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +313 -380
- package/bin/adjacent-tsconfig.mjs +46 -8
- package/bin/gkm.mjs +11 -3
- package/bin/owning-tsconfig-jsx-register.mjs +18 -0
- package/bin/owning-tsconfig-jsx.mjs +108 -0
- package/dist/EndpointGenerator-B99OGzbO.mjs +1035 -0
- package/dist/EndpointGenerator-B99OGzbO.mjs.map +1 -0
- package/dist/EndpointGenerator-De0lknKD.cjs +1094 -0
- package/dist/EndpointGenerator-De0lknKD.cjs.map +1 -0
- package/dist/GoDaddyProvider-D10Le3VX.mjs +388 -0
- package/dist/GoDaddyProvider-D10Le3VX.mjs.map +1 -0
- package/dist/GoDaddyProvider-DTfa47i3.cjs +388 -0
- package/dist/GoDaddyProvider-DTfa47i3.cjs.map +1 -0
- package/dist/{HostingerProvider-BY26bWwB.mjs → HostingerProvider-Cjh_2Ml6.mjs} +11 -6
- package/dist/HostingerProvider-Cjh_2Ml6.mjs.map +1 -0
- package/dist/{HostingerProvider-BZFGYYVA.cjs → HostingerProvider-OdQmKXE3.cjs} +11 -6
- package/dist/HostingerProvider-OdQmKXE3.cjs.map +1 -0
- package/dist/LegacyStateStore-C5c_zS4h.mjs +124 -0
- package/dist/LegacyStateStore-C5c_zS4h.mjs.map +1 -0
- package/dist/LegacyStateStore-CZSBR6ar.cjs +124 -0
- package/dist/LegacyStateStore-CZSBR6ar.cjs.map +1 -0
- package/dist/LocalStateStore-Ba0Y6q5C.mjs +167 -0
- package/dist/LocalStateStore-Ba0Y6q5C.mjs.map +1 -0
- package/dist/LocalStateStore-CgQtQix2.cjs +178 -0
- package/dist/LocalStateStore-CgQtQix2.cjs.map +1 -0
- package/dist/OpenApiTsGenerator-DMLzN-LU.cjs +541 -0
- package/dist/OpenApiTsGenerator-DMLzN-LU.cjs.map +1 -0
- package/dist/OpenApiTsGenerator-DNUCgkkx.mjs +536 -0
- package/dist/OpenApiTsGenerator-DNUCgkkx.mjs.map +1 -0
- package/dist/{Route53Provider-DVILBsvV.cjs → Route53Provider-Bllus2NR.cjs} +2 -2
- package/dist/Route53Provider-Bllus2NR.cjs.map +1 -0
- package/dist/{Route53Provider-Cvj40A8I.mjs → Route53Provider-QXxjkZO1.mjs} +2 -2
- package/dist/Route53Provider-QXxjkZO1.mjs.map +1 -0
- package/dist/S3StateStore-00mB2AG4.mjs +223 -0
- package/dist/S3StateStore-00mB2AG4.mjs.map +1 -0
- package/dist/S3StateStore-C6amZI39.cjs +222 -0
- package/dist/S3StateStore-C6amZI39.cjs.map +1 -0
- package/dist/SSMStateStore-CkYqOAzW.mjs +205 -0
- package/dist/SSMStateStore-CkYqOAzW.mjs.map +1 -0
- package/dist/SSMStateStore-Cnn5fHCg.cjs +204 -0
- package/dist/SSMStateStore-Cnn5fHCg.cjs.map +1 -0
- package/dist/SubscriberGenerator-0ruEmYXj.mjs +646 -0
- package/dist/SubscriberGenerator-0ruEmYXj.mjs.map +1 -0
- package/dist/SubscriberGenerator-CPjbWEOI.cjs +687 -0
- package/dist/SubscriberGenerator-CPjbWEOI.cjs.map +1 -0
- package/dist/add-CdMInvmN.cjs +719 -0
- package/dist/add-CdMInvmN.cjs.map +1 -0
- package/dist/add-DZSU5Tcc.mjs +717 -0
- package/dist/add-DZSU5Tcc.mjs.map +1 -0
- package/dist/appPorts-BoXMwolc.mjs +249 -0
- package/dist/appPorts-BoXMwolc.mjs.map +1 -0
- package/dist/appPorts-IW-OZmRi.cjs +296 -0
- package/dist/appPorts-IW-OZmRi.cjs.map +1 -0
- package/dist/aws-8QQ8n-t6.mjs +89 -0
- package/dist/aws-8QQ8n-t6.mjs.map +1 -0
- package/dist/aws-DY9NqQIT.cjs +100 -0
- package/dist/aws-DY9NqQIT.cjs.map +1 -0
- package/dist/awsStore-Bx5nCFnS.mjs +121 -0
- package/dist/awsStore-Bx5nCFnS.mjs.map +1 -0
- package/dist/awsStore-u3ehhMoY.cjs +138 -0
- package/dist/awsStore-u3ehhMoY.cjs.map +1 -0
- package/dist/{backup-provisioner-DIVCbfee.mjs → backup-provisioner-C8DnCmxK.mjs} +2 -2
- package/dist/backup-provisioner-C8DnCmxK.mjs.map +1 -0
- package/dist/{backup-provisioner-BmhIO_Yr.cjs → backup-provisioner-oDEsPj02.cjs} +2 -2
- package/dist/backup-provisioner-oDEsPj02.cjs.map +1 -0
- package/dist/backups/runner.cjs +519 -0
- package/dist/backups/runner.cjs.map +1 -0
- package/dist/backups/runner.d.cts +102 -0
- package/dist/backups/runner.d.cts.map +1 -0
- package/dist/backups/runner.d.mts +102 -0
- package/dist/backups/runner.d.mts.map +1 -0
- package/dist/backups/runner.mjs +506 -0
- package/dist/backups/runner.mjs.map +1 -0
- package/dist/{bundler-BodTL4kf.mjs → bundler-BzDMJbx8.mjs} +32 -11
- package/dist/bundler-BzDMJbx8.mjs.map +1 -0
- package/dist/{bundler-BeNDZdHQ.cjs → bundler-GKF4xpYI.cjs} +32 -11
- package/dist/bundler-GKF4xpYI.cjs.map +1 -0
- package/dist/cli-Ct6PQtc7.cjs +71 -0
- package/dist/cli-Ct6PQtc7.cjs.map +1 -0
- package/dist/cli-DXeLFtpA.mjs +71 -0
- package/dist/cli-DXeLFtpA.mjs.map +1 -0
- package/dist/compose-BfLDidYU.cjs +3977 -0
- package/dist/compose-BfLDidYU.cjs.map +1 -0
- package/dist/compose-CnanpQBB.mjs +3834 -0
- package/dist/compose-CnanpQBB.mjs.map +1 -0
- package/dist/config-DPsCfNpR.d.mts +268 -0
- package/dist/config-DPsCfNpR.d.mts.map +1 -0
- package/dist/config-azErNJSd.d.cts +268 -0
- package/dist/config-azErNJSd.d.cts.map +1 -0
- package/dist/config.cjs +420 -9
- package/dist/config.cjs.map +1 -0
- package/dist/config.d.cts +4 -117
- package/dist/config.d.mts +4 -117
- package/dist/config.mjs +406 -3
- package/dist/config.mjs.map +1 -0
- package/dist/credentialSchemas-CM0rxWmS.cjs +272 -0
- package/dist/credentialSchemas-CM0rxWmS.cjs.map +1 -0
- package/dist/credentialSchemas-DPOGqOrU.mjs +237 -0
- package/dist/credentialSchemas-DPOGqOrU.mjs.map +1 -0
- package/dist/credentials-D7XJypNd.cjs +520 -0
- package/dist/credentials-D7XJypNd.cjs.map +1 -0
- package/dist/credentials-DpfnUvIR.mjs +395 -0
- package/dist/credentials-DpfnUvIR.mjs.map +1 -0
- package/dist/databases-Db48ZIXL.mjs +588 -0
- package/dist/databases-Db48ZIXL.mjs.map +1 -0
- package/dist/databases-P824RTnx.cjs +703 -0
- package/dist/databases-P824RTnx.cjs.map +1 -0
- package/dist/define-6poNqm5O.mjs +106 -0
- package/dist/define-6poNqm5O.mjs.map +1 -0
- package/dist/define-crmMcXFS.cjs +153 -0
- package/dist/define-crmMcXFS.cjs.map +1 -0
- package/dist/deploy/public.cjs +211 -0
- package/dist/deploy/public.cjs.map +1 -0
- package/dist/deploy/public.d.cts +652 -0
- package/dist/deploy/public.d.cts.map +1 -0
- package/dist/deploy/public.d.mts +652 -0
- package/dist/deploy/public.d.mts.map +1 -0
- package/dist/deploy/public.mjs +144 -0
- package/dist/deploy/public.mjs.map +1 -0
- package/dist/deploy/sniffer-envparser-worker.cjs +54 -0
- package/dist/deploy/sniffer-envparser-worker.cjs.map +1 -0
- package/dist/deploy/sniffer-envparser-worker.d.cts +1 -0
- package/dist/deploy/sniffer-envparser-worker.d.mts +1 -0
- package/dist/deploy/sniffer-envparser-worker.mjs +55 -0
- package/dist/deploy/sniffer-envparser-worker.mjs.map +1 -0
- package/dist/deploy/sniffer-hooks.cjs +1 -1
- package/dist/deploy/sniffer-hooks.mjs +1 -1
- package/dist/deploy/sniffer-loader.cjs +2 -2
- package/dist/deploy/sniffer-loader.mjs +1 -1
- package/dist/deploy/sniffer-routes-worker.cjs +2 -2
- package/dist/deploy/sniffer-routes-worker.mjs +2 -2
- package/dist/deploy-B35L6CMr.mjs +3439 -0
- package/dist/deploy-B35L6CMr.mjs.map +1 -0
- package/dist/deploy-zFe_W4WS.cjs +3494 -0
- package/dist/deploy-zFe_W4WS.cjs.map +1 -0
- package/dist/derive-BtGidITm.cjs +161 -0
- package/dist/derive-BtGidITm.cjs.map +1 -0
- package/dist/derive-Dew0QoGe.mjs +150 -0
- package/dist/derive-Dew0QoGe.mjs.map +1 -0
- package/dist/discover-DEOspD9M.cjs +796 -0
- package/dist/discover-DEOspD9M.cjs.map +1 -0
- package/dist/discover-DOhYSKY_.mjs +693 -0
- package/dist/discover-DOhYSKY_.mjs.map +1 -0
- package/dist/dokploy-BGJxcEh0.cjs +38 -0
- package/dist/dokploy-BGJxcEh0.cjs.map +1 -0
- package/dist/dokploy-sDTohVj5.mjs +38 -0
- package/dist/dokploy-sDTohVj5.mjs.map +1 -0
- package/dist/drivers-C47nm-wB.cjs +311 -0
- package/dist/drivers-C47nm-wB.cjs.map +1 -0
- package/dist/drivers-CDjpjakg.mjs +252 -0
- package/dist/drivers-CDjpjakg.mjs.map +1 -0
- package/dist/eas-Bxb9pymo.mjs +334 -0
- package/dist/eas-Bxb9pymo.mjs.map +1 -0
- package/dist/eas-DogHTOxl.cjs +337 -0
- package/dist/eas-DogHTOxl.cjs.map +1 -0
- package/dist/{emit-BdoPFjZf.cjs → emit-CYloptRS.cjs} +44 -54
- package/dist/emit-CYloptRS.cjs.map +1 -0
- package/dist/{emit-Bzq7JsMP.mjs → emit-CiJGdy_f.mjs} +45 -43
- package/dist/emit-CiJGdy_f.mjs.map +1 -0
- package/dist/encryption-BZk_sxC-.mjs +89 -0
- package/dist/encryption-BZk_sxC-.mjs.map +1 -0
- package/dist/encryption-DRXgL9Lh.cjs +90 -0
- package/dist/encryption-DRXgL9Lh.cjs.map +1 -0
- package/dist/engine-BuPhWFVm.cjs +3328 -0
- package/dist/engine-BuPhWFVm.cjs.map +1 -0
- package/dist/engine-uQmNnvNQ.mjs +3215 -0
- package/dist/engine-uQmNnvNQ.mjs.map +1 -0
- package/dist/errors-D8Gwp5kU.mjs +23 -0
- package/dist/errors-D8Gwp5kU.mjs.map +1 -0
- package/dist/errors-DMC4Umsb.cjs +34 -0
- package/dist/errors-DMC4Umsb.cjs.map +1 -0
- package/dist/github-BCRbDSQa.cjs +901 -0
- package/dist/github-BCRbDSQa.cjs.map +1 -0
- package/dist/github-YknZQnYF.mjs +900 -0
- package/dist/github-YknZQnYF.mjs.map +1 -0
- package/dist/googlePlay-B_2dIDSO.mjs +931 -0
- package/dist/googlePlay-B_2dIDSO.mjs.map +1 -0
- package/dist/googlePlay-Cm2uipeZ.cjs +931 -0
- package/dist/googlePlay-Cm2uipeZ.cjs.map +1 -0
- package/dist/identity-CBXr4wNi.mjs +129 -0
- package/dist/identity-CBXr4wNi.mjs.map +1 -0
- package/dist/identity-CbLfgQNT.cjs +182 -0
- package/dist/identity-CbLfgQNT.cjs.map +1 -0
- package/dist/{index-D-iAVHx-.d.cts → index-D-gNc445.d.cts} +39 -15
- package/dist/index-D-gNc445.d.cts.map +1 -0
- package/dist/{index-Cd-qeOam.d.mts → index-Ur-ZIDYC.d.mts} +39 -15
- package/dist/index-Ur-ZIDYC.d.mts.map +1 -0
- package/dist/index.cjs +13461 -12270
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +13486 -12293
- package/dist/index.mjs.map +1 -1
- package/dist/local-B7Zv1NoA.mjs +224 -0
- package/dist/local-B7Zv1NoA.mjs.map +1 -0
- package/dist/local-OPC9BCZt.cjs +241 -0
- package/dist/local-OPC9BCZt.cjs.map +1 -0
- package/dist/migrate-BIl4kLb1.cjs +181 -0
- package/dist/migrate-BIl4kLb1.cjs.map +1 -0
- package/dist/migrate-Co3UnkrE.cjs +273 -0
- package/dist/migrate-Co3UnkrE.cjs.map +1 -0
- package/dist/migrate-D71REG0N.mjs +268 -0
- package/dist/migrate-D71REG0N.mjs.map +1 -0
- package/dist/migrate-zqsyod5I.mjs +181 -0
- package/dist/migrate-zqsyod5I.mjs.map +1 -0
- package/dist/openapi.cjs +214 -7
- package/dist/openapi.cjs.map +1 -0
- package/dist/openapi.d.cts +32 -8
- package/dist/openapi.d.cts.map +1 -1
- package/dist/openapi.d.mts +32 -8
- package/dist/openapi.d.mts.map +1 -1
- package/dist/openapi.mjs +209 -2
- package/dist/openapi.mjs.map +1 -0
- package/dist/projectBucket-BBbQ1lHF.cjs +263 -0
- package/dist/projectBucket-BBbQ1lHF.cjs.map +1 -0
- package/dist/projectBucket-C_DN4WzF.mjs +222 -0
- package/dist/projectBucket-C_DN4WzF.mjs.map +1 -0
- package/dist/provider-BqpjG9QM.cjs +57 -0
- package/dist/provider-BqpjG9QM.cjs.map +1 -0
- package/dist/provider-CEOKk8NS.mjs +46 -0
- package/dist/provider-CEOKk8NS.mjs.map +1 -0
- package/dist/publish-BUnnuLl_.cjs +124 -0
- package/dist/publish-BUnnuLl_.cjs.map +1 -0
- package/dist/publish-BtmLOhV9.mjs +123 -0
- package/dist/publish-BtmLOhV9.mjs.map +1 -0
- package/dist/ready-BwtLriAF.mjs +375 -0
- package/dist/ready-BwtLriAF.mjs.map +1 -0
- package/dist/ready-Cj4pI0dw.cjs +404 -0
- package/dist/ready-Cj4pI0dw.cjs.map +1 -0
- package/dist/reconcile/public.cjs +2 -4
- package/dist/reconcile/public.d.cts +8 -67
- package/dist/reconcile/public.d.cts.map +1 -1
- package/dist/reconcile/public.d.mts +8 -67
- package/dist/reconcile/public.d.mts.map +1 -1
- package/dist/reconcile/public.mjs +3 -3
- package/dist/{reconcile-DhQ00DpU.mjs → reconcile--I7V4Klj.mjs} +2 -2
- package/dist/{reconcile-DhQ00DpU.mjs.map → reconcile--I7V4Klj.mjs.map} +1 -1
- package/dist/{reconcile-Dd2iyILf.cjs → reconcile-CuCQBa5-.cjs} +3 -3
- package/dist/{reconcile-Dd2iyILf.cjs.map → reconcile-CuCQBa5-.cjs.map} +1 -1
- package/dist/resolve-B1zK9f8_.mjs +263 -0
- package/dist/resolve-B1zK9f8_.mjs.map +1 -0
- package/dist/resolve-BVVSf27Y.cjs +316 -0
- package/dist/resolve-BVVSf27Y.cjs.map +1 -0
- package/dist/rollback-CAPWtOm3.mjs +136 -0
- package/dist/rollback-CAPWtOm3.mjs.map +1 -0
- package/dist/rollback-hV8Kbbg_.cjs +165 -0
- package/dist/rollback-hV8Kbbg_.cjs.map +1 -0
- package/dist/runtime-C0okGPpK.d.cts +82 -0
- package/dist/runtime-C0okGPpK.d.cts.map +1 -0
- package/dist/runtime-DfwIeO8f.d.mts +82 -0
- package/dist/runtime-DfwIeO8f.d.mts.map +1 -0
- package/dist/s3-CkERdmxm.mjs +215 -0
- package/dist/s3-CkERdmxm.mjs.map +1 -0
- package/dist/s3-xJtWm6WN.cjs +215 -0
- package/dist/s3-xJtWm6WN.cjs.map +1 -0
- package/dist/sandbox/config-worker.cjs +43 -0
- package/dist/sandbox/config-worker.cjs.map +1 -0
- package/dist/sandbox/config-worker.d.cts +1 -0
- package/dist/sandbox/config-worker.d.mts +1 -0
- package/dist/sandbox/config-worker.mjs +44 -0
- package/dist/sandbox/config-worker.mjs.map +1 -0
- package/dist/sandbox/credentials-worker.cjs +54 -0
- package/dist/sandbox/credentials-worker.cjs.map +1 -0
- package/dist/sandbox/credentials-worker.d.cts +1 -0
- package/dist/sandbox/credentials-worker.d.mts +1 -0
- package/dist/sandbox/credentials-worker.mjs +55 -0
- package/dist/sandbox/credentials-worker.mjs.map +1 -0
- package/dist/sandbox/discover-worker.cjs +50 -0
- package/dist/sandbox/discover-worker.cjs.map +1 -0
- package/dist/sandbox/discover-worker.d.cts +1 -0
- package/dist/sandbox/discover-worker.d.mts +1 -0
- package/dist/sandbox/discover-worker.mjs +51 -0
- package/dist/sandbox/discover-worker.mjs.map +1 -0
- package/dist/sandbox/migrate-worker.cjs +76 -0
- package/dist/sandbox/migrate-worker.cjs.map +1 -0
- package/dist/sandbox/migrate-worker.d.cts +1 -0
- package/dist/sandbox/migrate-worker.d.mts +1 -0
- package/dist/sandbox/migrate-worker.mjs +77 -0
- package/dist/sandbox/migrate-worker.mjs.map +1 -0
- package/dist/sandbox-CHv3OYXg.cjs +165 -0
- package/dist/sandbox-CHv3OYXg.cjs.map +1 -0
- package/dist/sandbox-CbVB7uOD.mjs +118 -0
- package/dist/sandbox-CbVB7uOD.mjs.map +1 -0
- package/dist/{workspace-mFpI_ky_.cjs → schemas-BCwKKA42.mjs} +399 -1162
- package/dist/schemas-BCwKKA42.mjs.map +1 -0
- package/dist/{workspace-CgwmXEtc.mjs → schemas-BQ_v0lEX.cjs} +487 -971
- package/dist/schemas-BQ_v0lEX.cjs.map +1 -0
- package/dist/secretsManager-CQORubp9.mjs +97 -0
- package/dist/secretsManager-CQORubp9.mjs.map +1 -0
- package/dist/secretsManager-RAGcEDX1.cjs +108 -0
- package/dist/secretsManager-RAGcEDX1.cjs.map +1 -0
- package/dist/seeds-CNPdk_2f.mjs +9198 -0
- package/dist/seeds-CNPdk_2f.mjs.map +1 -0
- package/dist/seeds-MR13eS-F.cjs +10303 -0
- package/dist/seeds-MR13eS-F.cjs.map +1 -0
- package/dist/serverSetup-9kFFmA86.cjs +651 -0
- package/dist/serverSetup-9kFFmA86.cjs.map +1 -0
- package/dist/serverSetup-DgAERQ5s.mjs +651 -0
- package/dist/serverSetup-DgAERQ5s.mjs.map +1 -0
- package/dist/sniffer-Biw5SE1V.cjs +1998 -0
- package/dist/sniffer-Biw5SE1V.cjs.map +1 -0
- package/dist/sniffer-KS_EcbAk.mjs +1825 -0
- package/dist/sniffer-KS_EcbAk.mjs.map +1 -0
- package/dist/snsSubscriptions-Bl3CChIH.mjs +1472 -0
- package/dist/snsSubscriptions-Bl3CChIH.mjs.map +1 -0
- package/dist/snsSubscriptions-CQFfrCJf.cjs +1695 -0
- package/dist/snsSubscriptions-CQFfrCJf.cjs.map +1 -0
- package/dist/sst-DmVJRu5l.cjs +463 -0
- package/dist/sst-DmVJRu5l.cjs.map +1 -0
- package/dist/sst-fop6uZ25.mjs +440 -0
- package/dist/sst-fop6uZ25.mjs.map +1 -0
- package/dist/stage-BIKAMxNc.cjs +313 -0
- package/dist/stage-BIKAMxNc.cjs.map +1 -0
- package/dist/stage-tIMFTQtj.mjs +302 -0
- package/dist/stage-tIMFTQtj.mjs.map +1 -0
- package/dist/stages-C9uSkohw.cjs +190 -0
- package/dist/stages-C9uSkohw.cjs.map +1 -0
- package/dist/stages-DhmbURs_.mjs +190 -0
- package/dist/stages-DhmbURs_.mjs.map +1 -0
- package/dist/target/public.cjs +15 -0
- package/dist/target/public.d.cts +28 -0
- package/dist/target/public.d.cts.map +1 -0
- package/dist/target/public.d.mts +28 -0
- package/dist/target/public.d.mts.map +1 -0
- package/dist/target/public.mjs +4 -0
- package/dist/terminal-CebFDhWQ.mjs +85 -0
- package/dist/terminal-CebFDhWQ.mjs.map +1 -0
- package/dist/terminal-DBwedwSS.cjs +85 -0
- package/dist/terminal-DBwedwSS.cjs.map +1 -0
- package/dist/{types-BGo5TaNE.d.mts → types-Cjnqw1ta.d.cts} +2199 -462
- package/dist/types-Cjnqw1ta.d.cts.map +1 -0
- package/dist/{types-C5ZNpUad.d.cts → types-xBx-07__.d.mts} +2197 -462
- package/dist/types-xBx-07__.d.mts.map +1 -0
- package/dist/utils-D2Nk1Nv2.cjs +205 -0
- package/dist/utils-D2Nk1Nv2.cjs.map +1 -0
- package/dist/utils-D_fxUqvU.mjs +156 -0
- package/dist/utils-D_fxUqvU.mjs.map +1 -0
- package/dist/vitest.cjs +65 -0
- package/dist/vitest.cjs.map +1 -0
- package/dist/vitest.d.cts +29 -0
- package/dist/vitest.d.cts.map +1 -0
- package/dist/vitest.d.mts +29 -0
- package/dist/vitest.d.mts.map +1 -0
- package/dist/vitest.mjs +65 -0
- package/dist/vitest.mjs.map +1 -0
- package/dist/workerRuntime-BXfhbe13.cjs +108 -0
- package/dist/workerRuntime-BXfhbe13.cjs.map +1 -0
- package/dist/workerRuntime-CsOyBRx2.mjs +79 -0
- package/dist/workerRuntime-CsOyBRx2.mjs.map +1 -0
- package/dist/workspace/index.cjs +6 -2
- package/dist/workspace/index.d.cts +3 -3
- package/dist/workspace/index.d.mts +3 -3
- package/dist/workspace/index.mjs +2 -2
- package/dist/workspace-CjSfjfMK.mjs +2396 -0
- package/dist/workspace-CjSfjfMK.mjs.map +1 -0
- package/dist/workspace-DImrdet4.cjs +2808 -0
- package/dist/workspace-DImrdet4.cjs.map +1 -0
- package/package.json +55 -20
- package/dist/HostingerProvider-BY26bWwB.mjs.map +0 -1
- package/dist/HostingerProvider-BZFGYYVA.cjs.map +0 -1
- package/dist/LocalStateProvider-7HR6SS2t.cjs +0 -48
- package/dist/LocalStateProvider-7HR6SS2t.cjs.map +0 -1
- package/dist/LocalStateProvider-D7QyJoLM.mjs +0 -48
- package/dist/LocalStateProvider-D7QyJoLM.mjs.map +0 -1
- package/dist/Route53Provider-Cvj40A8I.mjs.map +0 -1
- package/dist/Route53Provider-DVILBsvV.cjs.map +0 -1
- package/dist/SSMStateProvider-B0Hu1MKZ.mjs +0 -75
- package/dist/SSMStateProvider-B0Hu1MKZ.mjs.map +0 -1
- package/dist/SSMStateProvider-VrQ-yeqd.cjs +0 -74
- package/dist/SSMStateProvider-VrQ-yeqd.cjs.map +0 -1
- package/dist/backup-provisioner-BmhIO_Yr.cjs.map +0 -1
- package/dist/backup-provisioner-DIVCbfee.mjs.map +0 -1
- package/dist/bundler-BeNDZdHQ.cjs.map +0 -1
- package/dist/bundler-BodTL4kf.mjs.map +0 -1
- package/dist/config-Q1rvKHvw.cjs +0 -467
- package/dist/config-Q1rvKHvw.cjs.map +0 -1
- package/dist/config-pqGD3hF9.mjs +0 -414
- package/dist/config-pqGD3hF9.mjs.map +0 -1
- package/dist/config.d.cts.map +0 -1
- package/dist/config.d.mts.map +0 -1
- package/dist/credentials-BekkKtY_.mjs +0 -2780
- package/dist/credentials-BekkKtY_.mjs.map +0 -1
- package/dist/credentials-Q6F0uqJq.cjs +0 -2917
- package/dist/credentials-Q6F0uqJq.cjs.map +0 -1
- package/dist/discover-BERGFg8v.cjs +0 -288
- package/dist/discover-BERGFg8v.cjs.map +0 -1
- package/dist/discover-CK-n3w6b.mjs +0 -244
- package/dist/discover-CK-n3w6b.mjs.map +0 -1
- package/dist/emit-BdoPFjZf.cjs.map +0 -1
- package/dist/emit-Bzq7JsMP.mjs.map +0 -1
- package/dist/fullstack-secrets-BET8gqwK.mjs +0 -81
- package/dist/fullstack-secrets-BET8gqwK.mjs.map +0 -1
- package/dist/fullstack-secrets-DXsWO-5m.cjs +0 -92
- package/dist/fullstack-secrets-DXsWO-5m.cjs.map +0 -1
- package/dist/generator-LfZU7NlU.mjs +0 -247
- package/dist/generator-LfZU7NlU.mjs.map +0 -1
- package/dist/generator-Wdfp0jCS.cjs +0 -282
- package/dist/generator-Wdfp0jCS.cjs.map +0 -1
- package/dist/github-BfflNPVe.cjs +0 -203
- package/dist/github-BfflNPVe.cjs.map +0 -1
- package/dist/github-CRwnxKmD.mjs +0 -203
- package/dist/github-CRwnxKmD.mjs.map +0 -1
- package/dist/index-Cd-qeOam.d.mts.map +0 -1
- package/dist/index-D-iAVHx-.d.cts.map +0 -1
- package/dist/keystore-B4PRlbgE.mjs +0 -81
- package/dist/keystore-B4PRlbgE.mjs.map +0 -1
- package/dist/keystore-DgGRj2Yy.cjs +0 -98
- package/dist/keystore-DgGRj2Yy.cjs.map +0 -1
- package/dist/openapi-Dcbme-Us.cjs +0 -2038
- package/dist/openapi-Dcbme-Us.cjs.map +0 -1
- package/dist/openapi-react-query.cjs +0 -158
- package/dist/openapi-react-query.cjs.map +0 -1
- package/dist/openapi-react-query.d.cts +0 -9
- package/dist/openapi-react-query.d.cts.map +0 -1
- package/dist/openapi-react-query.d.mts +0 -9
- package/dist/openapi-react-query.d.mts.map +0 -1
- package/dist/openapi-react-query.mjs +0 -158
- package/dist/openapi-react-query.mjs.map +0 -1
- package/dist/openapi-vy4JzhUv.mjs +0 -1991
- package/dist/openapi-vy4JzhUv.mjs.map +0 -1
- package/dist/storage-C-30BD1e.cjs +0 -272
- package/dist/storage-C-30BD1e.cjs.map +0 -1
- package/dist/storage-P_b3w7uj.mjs +0 -231
- package/dist/storage-P_b3w7uj.mjs.map +0 -1
- package/dist/sync-B3xxXtJT.mjs +0 -88
- package/dist/sync-B3xxXtJT.mjs.map +0 -1
- package/dist/sync-D7uTIIEi.cjs +0 -111
- package/dist/sync-D7uTIIEi.cjs.map +0 -1
- package/dist/types-BGo5TaNE.d.mts.map +0 -1
- package/dist/types-C5ZNpUad.d.cts.map +0 -1
- package/dist/workspace-CgwmXEtc.mjs.map +0 -1
- package/dist/workspace-mFpI_ky_.cjs.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"discover-DOhYSKY_.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/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 { canonicalId, provideKey } 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 provideKey(\n\t\t\tcanonicalId(construct.bucketName),\n\t\t\t'eventsConnectionString',\n\t\t);\n\t}\n\tif (construct.topicName) {\n\t\treturn provideKey(\n\t\t\tcanonicalId(construct.topicName),\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? provideKey(canonicalId(construct.bucketName), 'eventsToken')\n\t\t: undefined;\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","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 { Processor } from '@geekmidas/constructs/processors';\nimport { Queue } from '@geekmidas/constructs/queue';\nimport { Subscriber } from '@geekmidas/constructs/subscribers';\nimport {\n\tassertDerivations,\n\ttype ConstructManifest,\n\tcanonicalId,\n\ttype Declaration,\n\ttype ProcessorDeclaration,\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 { eventsEdge, 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 ids each owner's runnables declared an\n\t * edge to — keyed by the surface an endpoint was built from, or the worker\n\t * a cron or subscriber was.\n\t *\n\t * A runnable is not a declaration: a surface's endpoints are found by the\n\t * glob, not listed by the surface, so its node says `endpoints: []` until a\n\t * build folds the routes in. Anything deciding what an app's process reaches\n\t * — which keys its container is given — needs those edges before any build,\n\t * and discovery is already importing the files they are in.\n\t */\n\trunnables?: Record<string, string[]>;\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\trunnables: z.record(z.string(), z.array(z.string())),\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.runnables) {\n\t\t\t\tfor (const [owner, edges] of Object.entries(value.runnables)) {\n\t\t\t\t\toptions.runnables[owner] = edges;\n\t\t\t\t}\n\t\t\t}\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\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 (!isDeclarable(exported)) {\n\t\t\t\tif (options.runnables) recordRunnable(options.runnables, exported);\n\t\t\t\tcontinue;\n\t\t\t}\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\t// A construct that is also something a process runs — a queue and its\n\t\t\t// consumer, built from a worker — reaches what it depends on through\n\t\t\t// that process, exactly as an endpoint or a cron does.\n\t\t\tif (\n\t\t\t\toptions.runnables &&\n\t\t\t\ttypeof (exported as { owner?: unknown }).owner === 'string'\n\t\t\t) {\n\t\t\t\trecordRunnable(options.runnables, exported);\n\t\t\t}\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\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/**\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\tconst events = exported.topicName ? exported.subscribedEvents : 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 * The edges a runnable's process records for what it consumes. A bucket's\n * subscriber consumes the bucket's *events*, not the bucket: binding to its\n * changes is not reading its objects, so its process is handed the events\n * key and not the bucket's URL — that still takes `.dependsOn([bucket])`.\n */\nfunction consumedEdges(runnable: unknown): string[] {\n\tif (Subscriber.isSubscriber(runnable) && runnable.bucketName) {\n\t\treturn [eventsEdge(canonicalId(runnable.bucketName))];\n\t}\n\treturn consumedBy(runnable);\n}\n\n/**\n * Record a runnable's edges under the construct that owns it — the surface an\n * endpoint was built from, or the worker a cron or subscriber was. Anything\n * with no owner, or that is not a runnable at all, is left alone.\n */\nfunction recordRunnable(\n\trunnables: Record<string, string[]>,\n\texported: unknown,\n): void {\n\tif (typeof exported !== 'object' || exported === null) return;\n\n\tconst runnable = exported as {\n\t\tsurface?: { id?: unknown };\n\t\towner?: unknown;\n\t\tconstructs?: unknown;\n\t};\n\tconst owner =\n\t\ttypeof runnable.surface?.id === 'string'\n\t\t\t? runnable.surface.id\n\t\t\t: typeof runnable.owner === 'string'\n\t\t\t\t? runnable.owner\n\t\t\t\t: undefined;\n\tif (!owner || !Array.isArray(runnable.constructs)) return;\n\n\tconst key = canonicalId(owner);\n\tconst edges = runnables[key] ?? [];\n\trunnables[key] = edges;\n\t// What it consumes is an edge of its process too, so a worker is handed\n\t// the carriers its own work is bound to and no other.\n\tfor (const id of runnable.constructs) {\n\t\tif (typeof id !== 'string') continue;\n\t\tconst target = canonicalId(id);\n\t\tif (!edges.includes(target)) edges.push(target);\n\t}\n\tfor (const edge of consumedEdges(exported)) {\n\t\tif (!edges.includes(edge)) edges.push(edge);\n\t}\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":";;;;;;;;;;;;;;;;;;;;;;;AAOA,MAAM,gBAAgB;;;;;;AAOtB,SAAgB,WAAW,UA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ErD,OAAO,WAAW,QAAQ;AAC3B;;;;;;AAOA,SAAS,eACR,WACA,UACO;CACP,IAAI,OAAO,aAAa,YAAY,aAAa,MAAM;CAEvD,MAAM,WAAW;CAKjB,MAAM,QACL,OAAO,SAAS,SAAS,OAAO,WAC7B,SAAS,QAAQ,KACjB,OAAO,SAAS,UAAU,WACzB,SAAS,QACT,KAAA;CACL,IAAI,CAAC,SAAS,CAAC,MAAM,QAAQ,SAAS,UAAU,GAAG;CAEnD,MAAM,MAAM,YAAY,KAAK;CAC7B,MAAM,QAAQ,UAAU,QAAQ,CAAC;CACjC,UAAU,OAAO;CAGjB,KAAK,MAAM,MAAM,SAAS,YAAY;EACrC,IAAI,OAAO,OAAO,UAAU;EAC5B,MAAM,SAAS,YAAY,EAAE;EAC7B,IAAI,CAAC,MAAM,SAAS,MAAM,GAAG,MAAM,KAAK,MAAM;CAC/C;CACA,KAAK,MAAM,QAAQ,cAAc,QAAQ,GACxC,IAAI,CAAC,MAAM,SAAS,IAAI,GAAG,MAAM,KAAK,IAAI;AAE5C;;;;;;;;;;;;;;;;;;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"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
const require_define = require("./define-crmMcXFS.cjs");
|
|
2
|
+
const require_engine = require("./engine-BuPhWFVm.cjs");
|
|
3
|
+
//#region src/target/dokploy/index.ts
|
|
4
|
+
/**
|
|
5
|
+
* The built-in `dokploy` target: the Dokploy engine `gkm deploy` has always
|
|
6
|
+
* run, behind the phases.
|
|
7
|
+
*
|
|
8
|
+
* - `provision`: the project, environment and registry, and what the
|
|
9
|
+
* manifest declares — its databases' roles applied over a port published
|
|
10
|
+
* for the purpose.
|
|
11
|
+
* - `release`: the stage's migrations, then each image built and pushed
|
|
12
|
+
* beside its application and deployed, waited on until Dokploy has
|
|
13
|
+
* finished; backends first and checked before any site is released.
|
|
14
|
+
* - `verify`: each site answering its health check.
|
|
15
|
+
* - `rollback`: what failed — or, `--atomic`, everything the run released —
|
|
16
|
+
* pointed back at the image it ran before.
|
|
17
|
+
*/
|
|
18
|
+
const dokployTarget = require_define.defineTarget({
|
|
19
|
+
name: "dokploy",
|
|
20
|
+
runtime: "server",
|
|
21
|
+
capabilities: {
|
|
22
|
+
rollback: true,
|
|
23
|
+
migrations: "target",
|
|
24
|
+
images: true
|
|
25
|
+
},
|
|
26
|
+
credentials: ["dokploy", "registry"],
|
|
27
|
+
validate: (ctx) => require_engine.validateDokploy(ctx),
|
|
28
|
+
plan: (_ctx, run) => require_engine.planDokploy(run),
|
|
29
|
+
provision: (_ctx, run) => require_engine.provisionDokploy(run),
|
|
30
|
+
release: (_ctx, run) => require_engine.releaseDokploy(run),
|
|
31
|
+
verify: (_ctx, run) => require_engine.verifyDokploy(run),
|
|
32
|
+
rollback: (_ctx, run, failure) => require_engine.rollbackDokploy(run, failure),
|
|
33
|
+
result: (_ctx, run) => require_engine.dokployResult(run)
|
|
34
|
+
});
|
|
35
|
+
//#endregion
|
|
36
|
+
exports.dokployTarget = dokployTarget;
|
|
37
|
+
|
|
38
|
+
//# sourceMappingURL=dokploy-BGJxcEh0.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dokploy-BGJxcEh0.cjs","names":["defineTarget","validateDokploy","planDokploy","provisionDokploy","releaseDokploy","verifyDokploy","rollbackDokploy","dokployResult"],"sources":["../src/target/dokploy/index.ts"],"sourcesContent":["/**\n * The built-in `dokploy` target: the Dokploy engine `gkm deploy` has always\n * run, behind the phases.\n *\n * - `provision`: the project, environment and registry, and what the\n * manifest declares — its databases' roles applied over a port published\n * for the purpose.\n * - `release`: the stage's migrations, then each image built and pushed\n * beside its application and deployed, waited on until Dokploy has\n * finished; backends first and checked before any site is released.\n * - `verify`: each site answering its health check.\n * - `rollback`: what failed — or, `--atomic`, everything the run released —\n * pointed back at the image it ran before.\n */\n\nimport { defineTarget } from '../define';\nimport {\n\ttype DokployRun,\n\tdokployResult,\n\tplanDokploy,\n\tprovisionDokploy,\n\treleaseDokploy,\n\trollbackDokploy,\n\tvalidateDokploy,\n\tverifyDokploy,\n} from './engine';\n\nexport const dokployTarget = defineTarget<undefined, DokployRun>({\n\tname: 'dokploy',\n\truntime: 'server',\n\tcapabilities: { rollback: true, migrations: 'target', images: true },\n\tcredentials: ['dokploy', 'registry'],\n\tvalidate: (ctx) => validateDokploy(ctx),\n\tplan: (_ctx, run) => planDokploy(run),\n\tprovision: (_ctx, run) => provisionDokploy(run),\n\trelease: (_ctx, run) => releaseDokploy(run),\n\tverify: (_ctx, run) => verifyDokploy(run),\n\trollback: (_ctx, run, failure) => rollbackDokploy(run, failure),\n\tresult: (_ctx, run) => dokployResult(run),\n});\n"],"mappings":";;;;;;;;;;;;;;;;;AA2BA,MAAa,gBAAgBA,eAAAA,aAAoC;CAChE,MAAM;CACN,SAAS;CACT,cAAc;EAAE,UAAU;EAAM,YAAY;EAAU,QAAQ;CAAK;CACnE,aAAa,CAAC,WAAW,UAAU;CACnC,WAAW,QAAQC,eAAAA,gBAAgB,GAAG;CACtC,OAAO,MAAM,QAAQC,eAAAA,YAAY,GAAG;CACpC,YAAY,MAAM,QAAQC,eAAAA,iBAAiB,GAAG;CAC9C,UAAU,MAAM,QAAQC,eAAAA,eAAe,GAAG;CAC1C,SAAS,MAAM,QAAQC,eAAAA,cAAc,GAAG;CACxC,WAAW,MAAM,KAAK,YAAYC,eAAAA,gBAAgB,KAAK,OAAO;CAC9D,SAAS,MAAM,QAAQC,eAAAA,cAAc,GAAG;AACzC,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { t as defineTarget } from "./define-6poNqm5O.mjs";
|
|
2
|
+
import { a as dokployResult, c as releaseDokploy, d as validateDokploy, f as verifyDokploy, o as planDokploy, s as provisionDokploy, u as rollbackDokploy } from "./engine-uQmNnvNQ.mjs";
|
|
3
|
+
//#region src/target/dokploy/index.ts
|
|
4
|
+
/**
|
|
5
|
+
* The built-in `dokploy` target: the Dokploy engine `gkm deploy` has always
|
|
6
|
+
* run, behind the phases.
|
|
7
|
+
*
|
|
8
|
+
* - `provision`: the project, environment and registry, and what the
|
|
9
|
+
* manifest declares — its databases' roles applied over a port published
|
|
10
|
+
* for the purpose.
|
|
11
|
+
* - `release`: the stage's migrations, then each image built and pushed
|
|
12
|
+
* beside its application and deployed, waited on until Dokploy has
|
|
13
|
+
* finished; backends first and checked before any site is released.
|
|
14
|
+
* - `verify`: each site answering its health check.
|
|
15
|
+
* - `rollback`: what failed — or, `--atomic`, everything the run released —
|
|
16
|
+
* pointed back at the image it ran before.
|
|
17
|
+
*/
|
|
18
|
+
const dokployTarget = defineTarget({
|
|
19
|
+
name: "dokploy",
|
|
20
|
+
runtime: "server",
|
|
21
|
+
capabilities: {
|
|
22
|
+
rollback: true,
|
|
23
|
+
migrations: "target",
|
|
24
|
+
images: true
|
|
25
|
+
},
|
|
26
|
+
credentials: ["dokploy", "registry"],
|
|
27
|
+
validate: (ctx) => validateDokploy(ctx),
|
|
28
|
+
plan: (_ctx, run) => planDokploy(run),
|
|
29
|
+
provision: (_ctx, run) => provisionDokploy(run),
|
|
30
|
+
release: (_ctx, run) => releaseDokploy(run),
|
|
31
|
+
verify: (_ctx, run) => verifyDokploy(run),
|
|
32
|
+
rollback: (_ctx, run, failure) => rollbackDokploy(run, failure),
|
|
33
|
+
result: (_ctx, run) => dokployResult(run)
|
|
34
|
+
});
|
|
35
|
+
//#endregion
|
|
36
|
+
export { dokployTarget };
|
|
37
|
+
|
|
38
|
+
//# sourceMappingURL=dokploy-sDTohVj5.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dokploy-sDTohVj5.mjs","names":[],"sources":["../src/target/dokploy/index.ts"],"sourcesContent":["/**\n * The built-in `dokploy` target: the Dokploy engine `gkm deploy` has always\n * run, behind the phases.\n *\n * - `provision`: the project, environment and registry, and what the\n * manifest declares — its databases' roles applied over a port published\n * for the purpose.\n * - `release`: the stage's migrations, then each image built and pushed\n * beside its application and deployed, waited on until Dokploy has\n * finished; backends first and checked before any site is released.\n * - `verify`: each site answering its health check.\n * - `rollback`: what failed — or, `--atomic`, everything the run released —\n * pointed back at the image it ran before.\n */\n\nimport { defineTarget } from '../define';\nimport {\n\ttype DokployRun,\n\tdokployResult,\n\tplanDokploy,\n\tprovisionDokploy,\n\treleaseDokploy,\n\trollbackDokploy,\n\tvalidateDokploy,\n\tverifyDokploy,\n} from './engine';\n\nexport const dokployTarget = defineTarget<undefined, DokployRun>({\n\tname: 'dokploy',\n\truntime: 'server',\n\tcapabilities: { rollback: true, migrations: 'target', images: true },\n\tcredentials: ['dokploy', 'registry'],\n\tvalidate: (ctx) => validateDokploy(ctx),\n\tplan: (_ctx, run) => planDokploy(run),\n\tprovision: (_ctx, run) => provisionDokploy(run),\n\trelease: (_ctx, run) => releaseDokploy(run),\n\tverify: (_ctx, run) => verifyDokploy(run),\n\trollback: (_ctx, run, failure) => rollbackDokploy(run, failure),\n\tresult: (_ctx, run) => dokployResult(run),\n});\n"],"mappings":";;;;;;;;;;;;;;;;;AA2BA,MAAa,gBAAgB,aAAoC;CAChE,MAAM;CACN,SAAS;CACT,cAAc;EAAE,UAAU;EAAM,YAAY;EAAU,QAAQ;CAAK;CACnE,aAAa,CAAC,WAAW,UAAU;CACnC,WAAW,QAAQ,gBAAgB,GAAG;CACtC,OAAO,MAAM,QAAQ,YAAY,GAAG;CACpC,YAAY,MAAM,QAAQ,iBAAiB,GAAG;CAC9C,UAAU,MAAM,QAAQ,eAAe,GAAG;CAC1C,SAAS,MAAM,QAAQ,cAAc,GAAG;CACxC,WAAW,MAAM,KAAK,YAAY,gBAAgB,KAAK,OAAO;CAC9D,SAAS,MAAM,QAAQ,cAAc,GAAG;AACzC,CAAC"}
|
|
@@ -0,0 +1,311 @@
|
|
|
1
|
+
let node_path = require("node:path");
|
|
2
|
+
let node_fs = require("node:fs");
|
|
3
|
+
//#region src/types.ts
|
|
4
|
+
/** Whether `value` names a cache backend. */
|
|
5
|
+
function isCacheBackend(value) {
|
|
6
|
+
return value === "upstash" || value === "elasticache" || value === "db" || value === "redis";
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Whether a backend holds every declared cache, a cache declared from a
|
|
10
|
+
* database (`database.cache('Sessions')`) included.
|
|
11
|
+
*
|
|
12
|
+
* Every other backend leaves such a cache where its declaration put it: the
|
|
13
|
+
* declaration is the stronger statement. The stack's own Redis is the
|
|
14
|
+
* exception, because a stack that runs one runs it *for* the cache — a table
|
|
15
|
+
* beside it would be a second cache nobody asked for.
|
|
16
|
+
*/
|
|
17
|
+
function holdsEveryCache(backend) {
|
|
18
|
+
return backend === "redis";
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* The backend a project gets when it says nothing, by where it deploys.
|
|
22
|
+
*
|
|
23
|
+
* Flat defaults could not be right for both: `upstash` on a single box means a
|
|
24
|
+
* SaaS round-trip for a cache the database could have held, and `minio` on AWS
|
|
25
|
+
* means running a bucket beside S3. So the default is a function of the target,
|
|
26
|
+
* and an app that says nothing gets the obvious answer in both places — which
|
|
27
|
+
* is the whole of what "zero config" can mean once there is more than one
|
|
28
|
+
* target.
|
|
29
|
+
*
|
|
30
|
+
* `server` covers Dokploy and a bare host alike: the question these answer is
|
|
31
|
+
* whether the app is next to a managed cloud or next to its own containers, and
|
|
32
|
+
* on that question the two are the same.
|
|
33
|
+
*
|
|
34
|
+
* A per-construct, per-stage override is the layer above this — see
|
|
35
|
+
* `constructs-outstanding.md` — so two buckets in one app can differ. This is
|
|
36
|
+
* only what happens when nobody has said anything at all.
|
|
37
|
+
*/
|
|
38
|
+
const DEFAULT_CACHE = {
|
|
39
|
+
aws: "upstash",
|
|
40
|
+
server: "db"
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* Which broker carries a declared queue or topic, by target.
|
|
44
|
+
*
|
|
45
|
+
* Whether there are events at all is the manifest's answer — a declared
|
|
46
|
+
* `Topic` or `Queue` — so this only ever answers the second question. AWS
|
|
47
|
+
* deploys them to SNS and SQS, and locally the AWS emulator stands in, so the
|
|
48
|
+
* broker a developer runs is the one production has. A server has a Postgres
|
|
49
|
+
* already, and pg-boss keeps its queues there.
|
|
50
|
+
*/
|
|
51
|
+
const DEFAULT_EVENTS = {
|
|
52
|
+
aws: "sns",
|
|
53
|
+
server: "pgboss"
|
|
54
|
+
};
|
|
55
|
+
/** Where a bucket lives when nobody said — see {@link DEFAULT_CACHE}. */
|
|
56
|
+
const DEFAULT_STORAGE = {
|
|
57
|
+
aws: "s3",
|
|
58
|
+
server: "minio"
|
|
59
|
+
};
|
|
60
|
+
//#endregion
|
|
61
|
+
//#region src/generators/drivers.ts
|
|
62
|
+
/**
|
|
63
|
+
* Driver registration for generated entry points.
|
|
64
|
+
*
|
|
65
|
+
* A construct declares that it needs object storage and is handed one URL; the
|
|
66
|
+
* scheme in that URL picks the driver that builds the client. Which drivers
|
|
67
|
+
* exist is therefore the *entry point's* decision, not the construct's and not
|
|
68
|
+
* the application's — an app that never talks to S3 should never resolve the AWS
|
|
69
|
+
* SDK, and application code that registers a driver has named a provider in the
|
|
70
|
+
* one layer this design keeps provider-free.
|
|
71
|
+
*
|
|
72
|
+
* So the generated entries register: `gkm dev`'s server for local development,
|
|
73
|
+
* and each Lambda handler for its own target. Registration is an explicit call
|
|
74
|
+
* rather than an import side effect, because a side-effecting module is exactly
|
|
75
|
+
* what a bundler is entitled to drop.
|
|
76
|
+
*/
|
|
77
|
+
/** The `s3://` driver, which serves MinIO locally and S3 deployed. */
|
|
78
|
+
const S3 = {
|
|
79
|
+
imports: `import { registerStorageDriver } from '@geekmidas/storage';\nimport { s3Driver } from '@geekmidas/storage/aws';`,
|
|
80
|
+
setup: "registerStorageDriver(s3Driver);"
|
|
81
|
+
};
|
|
82
|
+
const NONE = {
|
|
83
|
+
imports: "",
|
|
84
|
+
setup: ""
|
|
85
|
+
};
|
|
86
|
+
/** The Redis wire protocol's drivers: both schemes, plain and TLS. */
|
|
87
|
+
const REDIS = {
|
|
88
|
+
imports: `import { registerCacheDriver } from '@geekmidas/cache';\nimport { redisCacheDriver, redissCacheDriver } from '@geekmidas/cache/redis';`,
|
|
89
|
+
setup: "registerCacheDriver(redisCacheDriver);\nregisterCacheDriver(redissCacheDriver);"
|
|
90
|
+
};
|
|
91
|
+
/**
|
|
92
|
+
* The cache driver for a backend — exactly one, never all three.
|
|
93
|
+
*
|
|
94
|
+
* Keyed off the *backend* rather than off a dependency, because unlike storage
|
|
95
|
+
* the backend already says which driver is right: a project caching in Postgres
|
|
96
|
+
* resolves `pg` and never `ioredis`, and one caching in Upstash resolves
|
|
97
|
+
* neither. That is the whole reason the drivers live behind separate subpaths.
|
|
98
|
+
*
|
|
99
|
+
* Both HTTP schemes are registered for Upstash, because the local proxy speaks
|
|
100
|
+
* `http://` and Upstash speaks `https://`, and an entry that registered one
|
|
101
|
+
* would work in exactly one of the two places.
|
|
102
|
+
*/
|
|
103
|
+
const CACHE_DRIVERS = {
|
|
104
|
+
upstash: {
|
|
105
|
+
imports: `import { registerCacheDriver } from '@geekmidas/cache';\nimport { upstashCacheDriver, upstashInsecureCacheDriver } from '@geekmidas/cache/upstash';`,
|
|
106
|
+
setup: "registerCacheDriver(upstashCacheDriver);\nregisterCacheDriver(upstashInsecureCacheDriver);"
|
|
107
|
+
},
|
|
108
|
+
elasticache: REDIS,
|
|
109
|
+
redis: REDIS,
|
|
110
|
+
db: {
|
|
111
|
+
imports: `import { registerCacheDriver } from '@geekmidas/cache';\nimport { postgresCacheDriver } from '@geekmidas/cache/postgres';`,
|
|
112
|
+
setup: "registerCacheDriver(postgresCacheDriver);"
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
/**
|
|
116
|
+
* The events drivers for a broker — only its own, so a bundle never resolves
|
|
117
|
+
* another broker's client library.
|
|
118
|
+
*
|
|
119
|
+
* Keyed off the backend, as the cache is: the target already says which broker
|
|
120
|
+
* carries the app's topics and queues. SNS registers SQS beside it, because on
|
|
121
|
+
* AWS a topic is `sns://` and a queue is `sqs://`, and an entry registering one
|
|
122
|
+
* would publish to topics and fail on the first queue.
|
|
123
|
+
*/
|
|
124
|
+
const EVENTS_DRIVERS = {
|
|
125
|
+
pgboss: {
|
|
126
|
+
imports: `import { registerEventsDriver } from '@geekmidas/events';\nimport { pgbossEventsDriver } from '@geekmidas/events/pgboss';`,
|
|
127
|
+
setup: "registerEventsDriver(pgbossEventsDriver);"
|
|
128
|
+
},
|
|
129
|
+
sns: {
|
|
130
|
+
imports: `import { registerEventsDriver } from '@geekmidas/events';\nimport { snsEventsDriver } from '@geekmidas/events/sns';\nimport { sqsEventsDriver } from '@geekmidas/events/sqs';`,
|
|
131
|
+
setup: "registerEventsDriver(snsEventsDriver);\nregisterEventsDriver(sqsEventsDriver);"
|
|
132
|
+
},
|
|
133
|
+
rabbitmq: {
|
|
134
|
+
imports: `import { registerEventsDriver } from '@geekmidas/events';\nimport { rabbitmqEventsDriver } from '@geekmidas/events/rabbitmq';`,
|
|
135
|
+
setup: "registerEventsDriver(rabbitmqEventsDriver);"
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
/**
|
|
139
|
+
* The KMS cipher, for an entry whose keys are on AWS. `aes256gcm:` is built
|
|
140
|
+
* into `Encryption`; only this one needs a driver, because only it needs an
|
|
141
|
+
* SDK — and only an AWS build has `kms://` keys to open.
|
|
142
|
+
*/
|
|
143
|
+
const KMS = {
|
|
144
|
+
imports: `import { registerCipherDriver } from '@geekmidas/constructs/encryption';\nimport { kmsCipherDriver } from '@geekmidas/constructs/encryption/kms';`,
|
|
145
|
+
setup: "registerCipherDriver(kmsCipherDriver);"
|
|
146
|
+
};
|
|
147
|
+
/**
|
|
148
|
+
* Whether an entry opens KMS keys: built for AWS, from a process that reaches
|
|
149
|
+
* an `Encryption`. A server's keys are keyrings, and `gkm dev` and `gkm test`
|
|
150
|
+
* derive theirs locally — none of them imports `@aws-sdk/client-kms`.
|
|
151
|
+
*/
|
|
152
|
+
function opensKmsKeys(manifest, target) {
|
|
153
|
+
return target === "aws" && Object.values(manifest).some((d) => d.kind === "encryption");
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Everything a generated entry should register: object storage, the cache,
|
|
157
|
+
* the events broker and the KMS cipher.
|
|
158
|
+
*
|
|
159
|
+
* Merged here rather than threaded separately, because a generated file has one
|
|
160
|
+
* import block and one setup block whatever fills them.
|
|
161
|
+
*/
|
|
162
|
+
function driversFor(options) {
|
|
163
|
+
const backends = listOf(options.cache);
|
|
164
|
+
const brokers = listOf(options.events);
|
|
165
|
+
const parts = [
|
|
166
|
+
storageDriversFor(options.appRoot),
|
|
167
|
+
...[...new Set(backends)].map((backend) => CACHE_DRIVERS[backend] ?? CACHE_DRIVERS[DEFAULT_CACHE.aws]),
|
|
168
|
+
...[...new Set(brokers)].map((broker) => EVENTS_DRIVERS[broker]),
|
|
169
|
+
...options.kms ? [KMS] : []
|
|
170
|
+
].filter((part) => part.imports || part.setup);
|
|
171
|
+
if (parts.length === 0) return NONE;
|
|
172
|
+
return {
|
|
173
|
+
imports: parts.map((part) => part.imports).join("\n"),
|
|
174
|
+
setup: parts.map((part) => part.setup).join("\n")
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
function listOf(value) {
|
|
178
|
+
if (value === false || value === void 0) return [];
|
|
179
|
+
return typeof value === "string" ? [value] : value;
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Which events brokers an app's entry has to speak: the target's, when the app
|
|
183
|
+
* declares a `Topic` or a `Queue` — and none at all when it declares neither,
|
|
184
|
+
* so a project without events never resolves `@geekmidas/events`.
|
|
185
|
+
*
|
|
186
|
+
* A worker on pg-boss counts too: a server schedules its crons through the
|
|
187
|
+
* pg-boss broker, which the plan provisions for a declared worker beside a
|
|
188
|
+
* declared database (`workerBroker` in `reconcile/plan.ts`) whether or not
|
|
189
|
+
* anything publishes.
|
|
190
|
+
*/
|
|
191
|
+
function eventsBackendsIn(manifest, configured) {
|
|
192
|
+
const kinds = new Set(Object.values(manifest).map((d) => d.kind));
|
|
193
|
+
return kinds.has("topic") || kinds.has("queue") || configured === "pgboss" && kinds.has("worker") && kinds.has("database") ? [configured] : [];
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* Which cache backends an app's entry actually has to speak.
|
|
197
|
+
*
|
|
198
|
+
* The config answers this for a cache that named nowhere, and the *declaration*
|
|
199
|
+
* answers it for one that named a database — `orders.cache('Sessions')` is a
|
|
200
|
+
* statement about the application, so a deployment cannot move that cache and
|
|
201
|
+
* the entry cannot register a driver for somewhere else.
|
|
202
|
+
*
|
|
203
|
+
* Reading only the config is how an entry ends up registering the Upstash
|
|
204
|
+
* driver for a URL the target composed as `postgres://`, which fails at the
|
|
205
|
+
* first request with `UnregisteredCacheScheme` and a stack that points at the
|
|
206
|
+
* cache rather than at the config that disagreed.
|
|
207
|
+
*/
|
|
208
|
+
function cacheBackendsIn(manifest, configured) {
|
|
209
|
+
const caches = Object.values(manifest).filter((d) => d.kind === "cache");
|
|
210
|
+
return [...new Set(caches.map((c) => c.of && !holdsEveryCache(configured) ? "db" : configured))];
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* The drivers an app's entry points should register.
|
|
214
|
+
*
|
|
215
|
+
* Keyed off the dependency rather than off a declared bucket, because the entry
|
|
216
|
+
* is generated before discovery has run on the watcher's rebuild path — and an
|
|
217
|
+
* app that installed `@geekmidas/storage` has already paid for the SDK it would
|
|
218
|
+
* otherwise resolve lazily.
|
|
219
|
+
*
|
|
220
|
+
* "Installed" the way Node resolves it: the app's own `package.json`, or any
|
|
221
|
+
* directory above it. A workspace that lists `@geekmidas/storage` once, at its
|
|
222
|
+
* root, is the common case — and reading only the app's file registered no S3
|
|
223
|
+
* driver there, so the first service to inject a bucket threw
|
|
224
|
+
* `UnregisteredStorageScheme`. A queue whose consumer depended on one logged
|
|
225
|
+
* that once and was never polled.
|
|
226
|
+
*/
|
|
227
|
+
function storageDriversFor(appRoot) {
|
|
228
|
+
return installedFrom(appRoot, "@geekmidas/storage") ? S3 : NONE;
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* Whether `pkg` is a dependency of the app at `appRoot` the way Node resolves
|
|
232
|
+
* it: listed in the app's own `package.json`, or in any directory above it.
|
|
233
|
+
*/
|
|
234
|
+
function installedFrom(appRoot, pkg) {
|
|
235
|
+
for (let dir = (0, node_path.resolve)(appRoot);; dir = (0, node_path.dirname)(dir)) {
|
|
236
|
+
if (lists((0, node_path.join)(dir, "package.json"), pkg)) return true;
|
|
237
|
+
if ((0, node_path.dirname)(dir) === dir) return false;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
function lists(manifest, dependency) {
|
|
241
|
+
if (!(0, node_fs.existsSync)(manifest)) return false;
|
|
242
|
+
try {
|
|
243
|
+
const pkg = JSON.parse((0, node_fs.readFileSync)(manifest, "utf8"));
|
|
244
|
+
return Boolean(pkg.dependencies?.[dependency] ?? pkg.devDependencies?.[dependency]);
|
|
245
|
+
} catch {
|
|
246
|
+
return false;
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
//#endregion
|
|
250
|
+
Object.defineProperty(exports, "DEFAULT_CACHE", {
|
|
251
|
+
enumerable: true,
|
|
252
|
+
get: function() {
|
|
253
|
+
return DEFAULT_CACHE;
|
|
254
|
+
}
|
|
255
|
+
});
|
|
256
|
+
Object.defineProperty(exports, "DEFAULT_EVENTS", {
|
|
257
|
+
enumerable: true,
|
|
258
|
+
get: function() {
|
|
259
|
+
return DEFAULT_EVENTS;
|
|
260
|
+
}
|
|
261
|
+
});
|
|
262
|
+
Object.defineProperty(exports, "DEFAULT_STORAGE", {
|
|
263
|
+
enumerable: true,
|
|
264
|
+
get: function() {
|
|
265
|
+
return DEFAULT_STORAGE;
|
|
266
|
+
}
|
|
267
|
+
});
|
|
268
|
+
Object.defineProperty(exports, "cacheBackendsIn", {
|
|
269
|
+
enumerable: true,
|
|
270
|
+
get: function() {
|
|
271
|
+
return cacheBackendsIn;
|
|
272
|
+
}
|
|
273
|
+
});
|
|
274
|
+
Object.defineProperty(exports, "driversFor", {
|
|
275
|
+
enumerable: true,
|
|
276
|
+
get: function() {
|
|
277
|
+
return driversFor;
|
|
278
|
+
}
|
|
279
|
+
});
|
|
280
|
+
Object.defineProperty(exports, "eventsBackendsIn", {
|
|
281
|
+
enumerable: true,
|
|
282
|
+
get: function() {
|
|
283
|
+
return eventsBackendsIn;
|
|
284
|
+
}
|
|
285
|
+
});
|
|
286
|
+
Object.defineProperty(exports, "holdsEveryCache", {
|
|
287
|
+
enumerable: true,
|
|
288
|
+
get: function() {
|
|
289
|
+
return holdsEveryCache;
|
|
290
|
+
}
|
|
291
|
+
});
|
|
292
|
+
Object.defineProperty(exports, "installedFrom", {
|
|
293
|
+
enumerable: true,
|
|
294
|
+
get: function() {
|
|
295
|
+
return installedFrom;
|
|
296
|
+
}
|
|
297
|
+
});
|
|
298
|
+
Object.defineProperty(exports, "isCacheBackend", {
|
|
299
|
+
enumerable: true,
|
|
300
|
+
get: function() {
|
|
301
|
+
return isCacheBackend;
|
|
302
|
+
}
|
|
303
|
+
});
|
|
304
|
+
Object.defineProperty(exports, "opensKmsKeys", {
|
|
305
|
+
enumerable: true,
|
|
306
|
+
get: function() {
|
|
307
|
+
return opensKmsKeys;
|
|
308
|
+
}
|
|
309
|
+
});
|
|
310
|
+
|
|
311
|
+
//# sourceMappingURL=drivers-C47nm-wB.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drivers-C47nm-wB.cjs","names":["resolve","dirname","join","existsSync","readFileSync"],"sources":["../src/types.ts","../src/generators/drivers.ts"],"sourcesContent":["import type {\n\tDevConfig,\n\tSecretsConfig,\n\tStagesConfig,\n\tTestConfig,\n} from './workspace/types.js';\n\nexport type MainProvider = 'aws' | 'server';\n\nexport type Routes = string | string[];\n\n/**\n * Supported event backend types.\n *\n * - `pgboss`: Reuses PostgreSQL with a dedicated user/schema. Auto-enables db service.\n * - `sns`: Adds the AWS emulator (floci) container; each topic and queue is\n * created on it and addressed by its own string.\n * - `rabbitmq`: Adds RabbitMQ container.\n *\n * Each topic and queue resolves its own `<ID>_PUBLISHER_CONNECTION_STRING`,\n * which its producers and its consumers both read. pg-boss and RabbitMQ also\n * resolve `EVENT_PUBLISHER_CONNECTION_STRING`, the one broker crons schedule\n * through.\n */\nexport type EventsBackend = 'pgboss' | 'sns' | 'rabbitmq';\n\n/**\n * Where a declared cache actually lives.\n *\n * A deployment choice, not an application one — the same code caches into any\n * of these — so it is config here beside `events` rather than a field on the\n * construct. Each backend is consistent between local and deployed, which is\n * the property worth having: a cache that behaves differently in the two places\n * is worse than a slower one.\n *\n * - `upstash` (default) — HTTP with a token. Reachable from a Lambda with no\n * VPC and no connection pool, which is why it is the default; locally the\n * `serverless-redis-http` proxy in front of Redis speaks the same protocol.\n * - `elasticache` — the Redis wire protocol, inside a VPC. Locally, plain Redis.\n * - `db` — a table in the database the app already declared. No infrastructure\n * at all, and the same relationship pg-boss has to Postgres: it creates its\n * own table on first use and needs a declared database to live in.\n * - `redis` — a Redis the stack runs beside the apps, on its network. It holds\n * *every* declared cache, one declared from a database included, so the\n * cache never competes with the database for its connections. Only the\n * compose target selects it today (`gkm compose`).\n */\nexport type CacheBackend = 'upstash' | 'elasticache' | 'db' | 'redis';\n\n/**\n * The backends a deploy target defaults to — every one but the compose\n * stack's own Redis, which only that target runs.\n */\nexport type TargetCacheBackend = Exclude<CacheBackend, 'redis'>;\n\n/** Whether `value` names a cache backend. */\nexport function isCacheBackend(value: string): value is CacheBackend {\n\treturn (\n\t\tvalue === 'upstash' ||\n\t\tvalue === 'elasticache' ||\n\t\tvalue === 'db' ||\n\t\tvalue === 'redis'\n\t);\n}\n\n/**\n * Whether a backend holds every declared cache, a cache declared from a\n * database (`database.cache('Sessions')`) included.\n *\n * Every other backend leaves such a cache where its declaration put it: the\n * declaration is the stronger statement. The stack's own Redis is the\n * exception, because a stack that runs one runs it *for* the cache — a table\n * beside it would be a second cache nobody asked for.\n */\nexport function holdsEveryCache(backend: CacheBackend): boolean {\n\treturn backend === 'redis';\n}\n\n/**\n * Where a declared bucket actually lives.\n *\n * The fourth of these selectors and the last to arrive, which is why\n * `UPLOADS_URL` had no answer on a container target: there was nothing to\n * choose with. Like the others it changes no application code — the `s3://`\n * scheme picks the driver, and every one of these speaks it.\n *\n * - `s3` — a real bucket. Nothing is created on the host; the URL is composed\n * against credentials you already hold, the same way `resend` is an API key\n * rather than infrastructure.\n * - `r2` — Cloudflare's, reached through the same S3 API and differing only in\n * its endpoint.\n * - `minio` — a container. Everything the app declares lives on the box, which\n * is what makes a single-host deploy self-contained, and what makes it a\n * single disk with no replication. Locally this is what every backend is.\n */\nexport type StorageBackend = 'minio' | 's3' | 'r2';\n\n/**\n * The backend a project gets when it says nothing, by where it deploys.\n *\n * Flat defaults could not be right for both: `upstash` on a single box means a\n * SaaS round-trip for a cache the database could have held, and `minio` on AWS\n * means running a bucket beside S3. So the default is a function of the target,\n * and an app that says nothing gets the obvious answer in both places — which\n * is the whole of what \"zero config\" can mean once there is more than one\n * target.\n *\n * `server` covers Dokploy and a bare host alike: the question these answer is\n * whether the app is next to a managed cloud or next to its own containers, and\n * on that question the two are the same.\n *\n * A per-construct, per-stage override is the layer above this — see\n * `constructs-outstanding.md` — so two buckets in one app can differ. This is\n * only what happens when nobody has said anything at all.\n */\nexport const DEFAULT_CACHE: Record<MainProvider, TargetCacheBackend> = {\n\t// Reachable from a Lambda with no VPC and no connection pool.\n\taws: 'upstash',\n\t// The database is already there and already has a connection pool open to\n\t// it. Anything else is a second service to run for a table.\n\tserver: 'db',\n};\n\n/**\n * Which broker carries a declared queue or topic, by target.\n *\n * Whether there are events at all is the manifest's answer — a declared\n * `Topic` or `Queue` — so this only ever answers the second question. AWS\n * deploys them to SNS and SQS, and locally the AWS emulator stands in, so the\n * broker a developer runs is the one production has. A server has a Postgres\n * already, and pg-boss keeps its queues there.\n */\nexport const DEFAULT_EVENTS: Record<MainProvider, EventsBackend> = {\n\taws: 'sns',\n\tserver: 'pgboss',\n};\n\n/** Where a bucket lives when nobody said — see {@link DEFAULT_CACHE}. */\nexport const DEFAULT_STORAGE: Record<MainProvider, StorageBackend> = {\n\taws: 's3',\n\tserver: 'minio',\n};\n\n/**\n * Who delivers a declared app's mail.\n *\n * Unlike a cache, this changes *nothing* about the client. Every backend speaks\n * SMTP, so the declaration's `smtp://` URL is true of all of them and only the\n * provisioner differs — which is the same reason the declaration has no\n * `provider` field and there is no `ses://` scheme.\n *\n * - `ses` (default) — the only backend that can be a *chain* of resources: an\n * identity, a user, an access key, and an SMTP password derived from it,\n * because SES issues IAM credentials rather than SMTP ones. Hand it a URL and\n * it uses that instead, which is what you want when the credentials already\n * exist — provisioning a second set of sending credentials for an identity\n * that already has them is not a thing to do by default.\n * - `resend` — an API key you hold, composed into an SMTP URL. Nothing to\n * provision: a SaaS account is not infrastructure.\n * - `smtp` — a URL supplied whole, for a relay somebody else runs.\n *\n * Locally every one of them is Mailpit, because locally none of it matters.\n */\nexport type EmailBackend = 'resend' | 'ses' | 'smtp';\n\n/**\n * Who delivers mail when nobody said.\n *\n * Flat, unlike the others, and deliberately: mail is a SaaS on every target.\n * There is no self-hosted preset to default a container deploy to — Mailpit is\n * a development inbox, not a sender — so `server` has no answer of its own to\n * give and would only be `ses` written twice.\n */\nexport const DEFAULT_EMAIL: EmailBackend = 'ses';\n\n/** Supported docker-compose service names */\nexport type ComposeServiceName =\n\t| 'postgres'\n\t| 'redis'\n\t| 'rabbitmq'\n\t| 'minio'\n\t| 'mailpit'\n\t| 'localstack';\n\nexport interface DockerConfig {\n\t/** Container registry URL (e.g., 'ghcr.io/myorg') */\n\tregistry?: string;\n\t/** Docker image name (default: derived from package.json name) */\n\timageName?: string;\n\t/** Base Docker image (default: 'node:22.23.4-alpine', a Node security release) */\n\tbaseImage?: string;\n\t/** Container port (default: 3000) */\n\tport?: number;\n}\n\nexport type Runtime = 'node' | 'bun';\n\nexport interface TelescopeConfig {\n\t/** Enable/disable telescope (default: true in development) */\n\tenabled?: boolean;\n\t/** Port for telescope to use (defaults to server port) */\n\tport?: number;\n\t/** Path prefix for telescope UI (default: /__telescope) */\n\tpath?: string;\n\t/** Ignore patterns for telescope (e.g., ['/health', '/metrics']) */\n\tignore?: string[];\n\t/** Record request/response bodies (default: true) */\n\trecordBody?: boolean;\n\t/** Maximum entries to keep in memory (default: 1000) */\n\tmaxEntries?: number;\n\t/** Enable WebSocket for real-time updates (default: true, requires @hono/node-ws for Node.js) */\n\twebsocket?: boolean;\n}\n\nexport interface OpenApiConfig {\n\t/** Enable OpenAPI generation (default: true) */\n\tenabled?: boolean;\n\t/** API title */\n\ttitle?: string;\n\t/** API version */\n\tversion?: string;\n\t/** API description */\n\tdescription?: string;\n}\n\nexport interface HooksConfig {\n\t/**\n\t * Path to a module exporting server lifecycle hooks.\n\t * The module should export `beforeSetup` and/or `afterSetup` functions.\n\t *\n\t * @example\n\t * ```typescript\n\t * // src/config/hooks.ts\n\t * import type { Hono } from 'hono';\n\t * import type { Logger } from '@geekmidas/logger';\n\t * import type { EnvironmentParser } from '@geekmidas/envkit';\n\t *\n\t * // Called BEFORE gkm endpoints are registered\n\t * export function beforeSetup(app: Hono, ctx: { envParser: EnvironmentParser; logger: Logger }) {\n\t * app.use('*', cors());\n\t * app.get('/custom/health', (c) => c.json({ status: 'ok' }));\n\t * }\n\t *\n\t * // Called AFTER gkm endpoints are registered\n\t * export function afterSetup(app: Hono, ctx: { envParser: EnvironmentParser; logger: Logger }) {\n\t * app.notFound((c) => c.json({ error: 'Not found' }, 404));\n\t * app.onError((err, c) => c.json({ error: err.message }, 500));\n\t * }\n\t * ```\n\t */\n\tserver?: string;\n}\n\nexport interface GkmConfig {\n\t/**\n\t * What this app is called, and therefore how everything it declares is named.\n\t *\n\t * The same field `sst.config.ts` carries, doing the same job: every physical\n\t * name is `{stage}-{name}-{construct}`, so `Database` in the `production`\n\t * stage of `kitchen-sink` is `production-kitchen-sink-database` on AWS and on\n\t * Dokploy alike. One statement, in the config, rather than a rule each\n\t * provider restates.\n\t *\n\t * `defineWorkspace` has always had this. A single-app config did not, so its\n\t * names fell back to whatever the directory happened to be called — the\n\t * monorepo's package name for the project and the app's for the application,\n\t * two accidents of layout standing in for a decision.\n\t *\n\t * Defaults to the package.json name with any scope stripped, then the\n\t * directory name.\n\t */\n\tname?: string;\n\t/** The project's stages: which one is local, which deploy */\n\tstages: StagesConfig;\n\t/** Encrypted secrets, and where deployed stages' secrets are stored */\n\tsecrets?: SecretsConfig;\n\t/** What `gkm test` hands a feature test: where the factories are. */\n\ttest?: TestConfig;\n\t/** How `gkm dev` is reached: the discovery endpoint's port and origins. */\n\tdev?: DevConfig;\n\t/**\n\t * Constructs glob pattern — one glob, every kind.\n\t *\n\t * What reconcile reads to derive the containers a stage needs: a database\n\t * implies Postgres, objects imply MinIO, mail implies Mailpit. A glob per\n\t * kind cannot find a resource, because a declared `ObjectStorage` has no\n\t * kind to be listed under.\n\t *\n\t * @example './src/**\\/*.ts'\n\t */\n\tconstructs: Routes;\n\t/**\n\t * Server lifecycle hooks for customizing the Hono app.\n\t * Allows adding custom routes, middleware, error handlers, etc.\n\t *\n\t * @example\n\t * hooks: {\n\t * server: './src/config/hooks'\n\t * }\n\t */\n\thooks?: HooksConfig;\n\t/**\n\t * Telescope configuration for debugging/monitoring.\n\t * Can be:\n\t * - A string path to a module that exports a Telescope instance (recommended)\n\t * - A boolean to enable/disable with defaults\n\t * - A TelescopeConfig object for inline configuration\n\t */\n\ttelescope?: string | boolean | TelescopeConfig;\n\t/**\n\t * OpenAPI generation configuration.\n\t * Can be:\n\t * - A boolean to enable/disable with defaults (output: ./src/api/openapi.ts)\n\t * - An OpenApiConfig object for customization\n\t *\n\t * When enabled, OpenAPI spec is generated on startup and regenerated on route changes.\n\t *\n\t * @example\n\t * openapi: true\n\t *\n\t * @example\n\t * openapi: {\n\t * output: './src/api/openapi.ts',\n\t * title: 'My API',\n\t * version: '1.0.0',\n\t * }\n\t */\n\topenapi?: boolean | OpenApiConfig;\n\t/** Runtime to use for dev server (default: 'node') */\n\truntime?: Runtime;\n\t/**\n\t * Environment file(s) to load for development.\n\t * Can be:\n\t * - A string path to a single env file (e.g., '.env.local')\n\t * - An array of paths to load in order (later files override earlier)\n\t * - Defaults to '.env' if not specified\n\t *\n\t * @example\n\t * env: '.env.local'\n\t *\n\t * @example\n\t * env: ['.env', '.env.local']\n\t */\n\tenv?: string | string[];\n\t/**\n\t * Docker deployment configuration.\n\t * Used by `gkm docker` and `gkm prepack` commands.\n\t *\n\t * @example\n\t * docker: {\n\t * registry: 'ghcr.io/myorg',\n\t * imageName: 'my-api',\n\t * compose: {\n\t * services: ['postgres', 'redis']\n\t * }\n\t * }\n\t */\n\tdocker?: DockerConfig;\n\t/**\n\t * Where this app deploys, and what the target needs to know.\n\t *\n\t * Absent until now, which meant a single-app project could not configure a\n\t * Dokploy deploy at all: the wrap that turns one into a workspace hardcoded\n\t * `{ default: 'dokploy' }` and dropped everything else, so there was no\n\t * endpoint, no registry and no domain — and `resolveHost` failed with \"no\n\t * domain configured for stage\" on a config that had nowhere to put one.\n\t *\n\t * The same shape a workspace config uses, so moving from one to the other is\n\t * a rename rather than a rewrite.\n\t */\n\tdeploy?: import('./workspace/types').DeployConfig;\n\t/** Each deployed stage's base domain — the same field a workspace has. */\n\tdomains?: import('./workspace/types').DomainsConfig;\n\t/** Each root domain's DNS provider — the same field a workspace has. */\n\tdns?: import('./workspace/types').WorkspaceDnsConfig;\n}\n\nexport interface BuildOptions {\n\t/** Overrides the deploy target's: a Dockerfile builds a server regardless. */\n\tprovider?: MainProvider;\n\t/**\n\t * Overrides the target's cache backend for the drivers the entry\n\t * registers — set by the Dockerfiles `gkm compose` writes, whose stack runs\n\t * its own Redis.\n\t */\n\tcache?: CacheBackend;\n\tenableOpenApi?: boolean;\n\t/** Build for production (no dev tools, bundled output) */\n\tproduction?: boolean;\n\t/** Skip bundling step in production build */\n\tskipBundle?: boolean;\n\t/** Stage for secrets injection (e.g., 'production', 'staging') */\n\tstage?: string;\n\t/**\n\t * When true, optional environment variables (those with `.optional()` or\n\t * `.default()` in the envParser) are suffixed with `?` within each\n\t * construct's `environment` array in the manifest (e.g. `PORT?`).\n\t * Defaults to false.\n\t */\n\tmarkOptional?: boolean;\n\t/**\n\t * Where the apps' own build scripts (turbo) run. Defaults to a\n\t * `LocalSandbox` on the workspace: this machine, with an allowlisted\n\t * environment.\n\t */\n\tsandbox?: import('./sandbox/sandbox').Sandbox;\n}\n\n/** Result from build command when secrets are injected */\nexport interface BuildResult {\n\t/** Ephemeral master key for deployment (only if stage was provided) */\n\tmasterKey?: string;\n}\n\n// The deployment manifest types are a shared, dependency-free data contract\n// in `@geekmidas/manifest`, re-exported here for back-compat with existing\n// `@geekmidas/cli` imports.\nexport type {\n\tCronInfo,\n\tFunctionInfo,\n\tProcessorInfo,\n\tQueueInfo,\n\tRouteInfo,\n\tSubscriberInfo,\n\tTopicInfo,\n} from '@geekmidas/manifest';\n","/**\n * Driver registration for generated entry points.\n *\n * A construct declares that it needs object storage and is handed one URL; the\n * scheme in that URL picks the driver that builds the client. Which drivers\n * exist is therefore the *entry point's* decision, not the construct's and not\n * the application's — an app that never talks to S3 should never resolve the AWS\n * SDK, and application code that registers a driver has named a provider in the\n * one layer this design keeps provider-free.\n *\n * So the generated entries register: `gkm dev`'s server for local development,\n * and each Lambda handler for its own target. Registration is an explicit call\n * rather than an import side effect, because a side-effecting module is exactly\n * what a bundler is entitled to drop.\n */\n\nimport { existsSync, readFileSync } from 'node:fs';\nimport { dirname, join, resolve } from 'node:path';\nimport {\n\ttype CacheBackend,\n\tDEFAULT_CACHE,\n\ttype EventsBackend,\n\tholdsEveryCache,\n} from '../types.js';\n\n/** The `s3://` driver, which serves MinIO locally and S3 deployed. */\nconst S3 = {\n\timports: `import { registerStorageDriver } from '@geekmidas/storage';\\nimport { s3Driver } from '@geekmidas/storage/aws';`,\n\tsetup: 'registerStorageDriver(s3Driver);',\n};\n\n/** What a generated entry needs in order to register the drivers it uses. */\nexport interface RuntimeDrivers {\n\t/** Import lines, or `''` when there is nothing to register. */\n\timports: string;\n\t/** The registration calls, or `''`. */\n\tsetup: string;\n}\n\n/** @deprecated The same shape, from when only storage had drivers. */\nexport type StorageDrivers = RuntimeDrivers;\n\nconst NONE: RuntimeDrivers = { imports: '', setup: '' };\n\n/** The Redis wire protocol's drivers: both schemes, plain and TLS. */\nconst REDIS: RuntimeDrivers = {\n\timports: `import { registerCacheDriver } from '@geekmidas/cache';\\nimport { redisCacheDriver, redissCacheDriver } from '@geekmidas/cache/redis';`,\n\tsetup:\n\t\t'registerCacheDriver(redisCacheDriver);\\nregisterCacheDriver(redissCacheDriver);',\n};\n\n/**\n * The cache driver for a backend — exactly one, never all three.\n *\n * Keyed off the *backend* rather than off a dependency, because unlike storage\n * the backend already says which driver is right: a project caching in Postgres\n * resolves `pg` and never `ioredis`, and one caching in Upstash resolves\n * neither. That is the whole reason the drivers live behind separate subpaths.\n *\n * Both HTTP schemes are registered for Upstash, because the local proxy speaks\n * `http://` and Upstash speaks `https://`, and an entry that registered one\n * would work in exactly one of the two places.\n */\nconst CACHE_DRIVERS: Record<CacheBackend, RuntimeDrivers> = {\n\tupstash: {\n\t\timports: `import { registerCacheDriver } from '@geekmidas/cache';\\nimport { upstashCacheDriver, upstashInsecureCacheDriver } from '@geekmidas/cache/upstash';`,\n\t\tsetup:\n\t\t\t'registerCacheDriver(upstashCacheDriver);\\nregisterCacheDriver(upstashInsecureCacheDriver);',\n\t},\n\telasticache: REDIS,\n\t// The stack's own Redis speaks the same wire protocol — and a managed\n\t// Redis set in its place may be `rediss://`.\n\tredis: REDIS,\n\tdb: {\n\t\timports: `import { registerCacheDriver } from '@geekmidas/cache';\\nimport { postgresCacheDriver } from '@geekmidas/cache/postgres';`,\n\t\tsetup: 'registerCacheDriver(postgresCacheDriver);',\n\t},\n};\n\n/**\n * The events drivers for a broker — only its own, so a bundle never resolves\n * another broker's client library.\n *\n * Keyed off the backend, as the cache is: the target already says which broker\n * carries the app's topics and queues. SNS registers SQS beside it, because on\n * AWS a topic is `sns://` and a queue is `sqs://`, and an entry registering one\n * would publish to topics and fail on the first queue.\n */\nconst EVENTS_DRIVERS: Record<EventsBackend, RuntimeDrivers> = {\n\tpgboss: {\n\t\timports: `import { registerEventsDriver } from '@geekmidas/events';\\nimport { pgbossEventsDriver } from '@geekmidas/events/pgboss';`,\n\t\tsetup: 'registerEventsDriver(pgbossEventsDriver);',\n\t},\n\tsns: {\n\t\timports: `import { registerEventsDriver } from '@geekmidas/events';\\nimport { snsEventsDriver } from '@geekmidas/events/sns';\\nimport { sqsEventsDriver } from '@geekmidas/events/sqs';`,\n\t\tsetup:\n\t\t\t'registerEventsDriver(snsEventsDriver);\\nregisterEventsDriver(sqsEventsDriver);',\n\t},\n\trabbitmq: {\n\t\timports: `import { registerEventsDriver } from '@geekmidas/events';\\nimport { rabbitmqEventsDriver } from '@geekmidas/events/rabbitmq';`,\n\t\tsetup: 'registerEventsDriver(rabbitmqEventsDriver);',\n\t},\n};\n\n/**\n * The KMS cipher, for an entry whose keys are on AWS. `aes256gcm:` is built\n * into `Encryption`; only this one needs a driver, because only it needs an\n * SDK — and only an AWS build has `kms://` keys to open.\n */\nconst KMS: RuntimeDrivers = {\n\timports: `import { registerCipherDriver } from '@geekmidas/constructs/encryption';\\nimport { kmsCipherDriver } from '@geekmidas/constructs/encryption/kms';`,\n\tsetup: 'registerCipherDriver(kmsCipherDriver);',\n};\n\n/**\n * Whether an entry opens KMS keys: built for AWS, from a process that reaches\n * an `Encryption`. A server's keys are keyrings, and `gkm dev` and `gkm test`\n * derive theirs locally — none of them imports `@aws-sdk/client-kms`.\n */\nexport function opensKmsKeys(\n\tmanifest: Record<string, { kind: string }>,\n\ttarget: 'aws' | 'server',\n): boolean {\n\treturn (\n\t\ttarget === 'aws' &&\n\t\tObject.values(manifest).some((d) => d.kind === 'encryption')\n\t);\n}\n\n/**\n * Everything a generated entry should register: object storage, the cache,\n * the events broker and the KMS cipher.\n *\n * Merged here rather than threaded separately, because a generated file has one\n * import block and one setup block whatever fills them.\n */\nexport function driversFor(options: {\n\tappRoot: string;\n\t/**\n\t * The cache backends actually in play — normally one, and more than one only\n\t * where an app declares two caches that live in different places.\n\t *\n\t * Absent or empty means nothing declared a cache, so no cache driver is\n\t * registered at all.\n\t */\n\tcache?: CacheBackend | readonly CacheBackend[] | false;\n\t/**\n\t * The events brokers in play — see {@link eventsBackendsIn}. Absent or\n\t * empty means nothing declared a topic or a queue, so no events driver is\n\t * registered and `@geekmidas/events` is never resolved.\n\t */\n\tevents?: EventsBackend | readonly EventsBackend[] | false;\n\t/** Whether it opens KMS keys — see {@link opensKmsKeys}. */\n\tkms?: boolean;\n}): RuntimeDrivers {\n\tconst backends = listOf(options.cache);\n\tconst brokers = listOf(options.events);\n\n\tconst parts = [\n\t\tstorageDriversFor(options.appRoot),\n\t\t...[...new Set(backends)].map(\n\t\t\t(backend) => CACHE_DRIVERS[backend] ?? CACHE_DRIVERS[DEFAULT_CACHE.aws],\n\t\t),\n\t\t...[...new Set(brokers)].map((broker) => EVENTS_DRIVERS[broker]),\n\t\t...(options.kms ? [KMS] : []),\n\t].filter((part) => part.imports || part.setup);\n\n\tif (parts.length === 0) return NONE;\n\n\treturn {\n\t\timports: parts.map((part) => part.imports).join('\\n'),\n\t\tsetup: parts.map((part) => part.setup).join('\\n'),\n\t};\n}\n\nfunction listOf<T extends string>(\n\tvalue: T | readonly T[] | false | undefined,\n): readonly T[] {\n\tif (value === false || value === undefined) return [];\n\treturn typeof value === 'string' ? [value] : (value as readonly T[]);\n}\n\n/**\n * Which events brokers an app's entry has to speak: the target's, when the app\n * declares a `Topic` or a `Queue` — and none at all when it declares neither,\n * so a project without events never resolves `@geekmidas/events`.\n *\n * A worker on pg-boss counts too: a server schedules its crons through the\n * pg-boss broker, which the plan provisions for a declared worker beside a\n * declared database (`workerBroker` in `reconcile/plan.ts`) whether or not\n * anything publishes.\n */\nexport function eventsBackendsIn(\n\tmanifest: Record<string, { kind: string }>,\n\tconfigured: EventsBackend,\n): EventsBackend[] {\n\tconst kinds = new Set(Object.values(manifest).map((d) => d.kind));\n\tconst declared =\n\t\tkinds.has('topic') ||\n\t\tkinds.has('queue') ||\n\t\t(configured === 'pgboss' && kinds.has('worker') && kinds.has('database'));\n\n\treturn declared ? [configured] : [];\n}\n\n/**\n * Which cache backends an app's entry actually has to speak.\n *\n * The config answers this for a cache that named nowhere, and the *declaration*\n * answers it for one that named a database — `orders.cache('Sessions')` is a\n * statement about the application, so a deployment cannot move that cache and\n * the entry cannot register a driver for somewhere else.\n *\n * Reading only the config is how an entry ends up registering the Upstash\n * driver for a URL the target composed as `postgres://`, which fails at the\n * first request with `UnregisteredCacheScheme` and a stack that points at the\n * cache rather than at the config that disagreed.\n */\nexport function cacheBackendsIn(\n\tmanifest: Record<string, { kind: string; of?: string }>,\n\tconfigured: CacheBackend,\n): CacheBackend[] {\n\tconst caches = Object.values(manifest).filter((d) => d.kind === 'cache');\n\n\t// The stack's own Redis holds every cache, one that named a database too.\n\treturn [\n\t\t...new Set(\n\t\t\tcaches.map((c) =>\n\t\t\t\tc.of && !holdsEveryCache(configured) ? 'db' : configured,\n\t\t\t),\n\t\t),\n\t];\n}\n\n/**\n * The drivers an app's entry points should register.\n *\n * Keyed off the dependency rather than off a declared bucket, because the entry\n * is generated before discovery has run on the watcher's rebuild path — and an\n * app that installed `@geekmidas/storage` has already paid for the SDK it would\n * otherwise resolve lazily.\n *\n * \"Installed\" the way Node resolves it: the app's own `package.json`, or any\n * directory above it. A workspace that lists `@geekmidas/storage` once, at its\n * root, is the common case — and reading only the app's file registered no S3\n * driver there, so the first service to inject a bucket threw\n * `UnregisteredStorageScheme`. A queue whose consumer depended on one logged\n * that once and was never polled.\n */\nexport function storageDriversFor(appRoot: string): RuntimeDrivers {\n\treturn installedFrom(appRoot, '@geekmidas/storage') ? S3 : NONE;\n}\n\n/**\n * Whether `pkg` is a dependency of the app at `appRoot` the way Node resolves\n * it: listed in the app's own `package.json`, or in any directory above it.\n */\nexport function installedFrom(appRoot: string, pkg: string): boolean {\n\tfor (let dir = resolve(appRoot); ; dir = dirname(dir)) {\n\t\tif (lists(join(dir, 'package.json'), pkg)) return true;\n\t\tif (dirname(dir) === dir) return false;\n\t}\n}\n\nfunction lists(manifest: string, dependency: string): boolean {\n\tif (!existsSync(manifest)) return false;\n\n\ttry {\n\t\tconst pkg = JSON.parse(readFileSync(manifest, 'utf8')) as {\n\t\t\tdependencies?: Record<string, string>;\n\t\t\tdevDependencies?: Record<string, string>;\n\t\t};\n\n\t\treturn Boolean(\n\t\t\tpkg.dependencies?.[dependency] ?? pkg.devDependencies?.[dependency],\n\t\t);\n\t} catch {\n\t\t// An unreadable package.json is the build's problem, not this function's.\n\t\treturn false;\n\t}\n}\n"],"mappings":";;;;AAwDA,SAAgB,eAAe,OAAsC;CACpE,OACC,UAAU,aACV,UAAU,iBACV,UAAU,QACV,UAAU;AAEZ;;;;;;;;;;AAWA,SAAgB,gBAAgB,SAAgC;CAC/D,OAAO,YAAY;AACpB;;;;;;;;;;;;;;;;;;;AAuCA,MAAa,gBAA0D;CAEtE,KAAK;CAGL,QAAQ;AACT;;;;;;;;;;AAWA,MAAa,iBAAsD;CAClE,KAAK;CACL,QAAQ;AACT;;AAGA,MAAa,kBAAwD;CACpE,KAAK;CAC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