@geekmidas/cli 10.0.0-alpha.187 → 10.0.0-alpha.189
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{LegacyStateStore-BYJwVE8_.mjs → LegacyStateStore-BI0-sXct.mjs} +2 -2
- package/dist/{LegacyStateStore-BYJwVE8_.mjs.map → LegacyStateStore-BI0-sXct.mjs.map} +1 -1
- package/dist/{LegacyStateStore-B3kv1Dlb.cjs → LegacyStateStore-DSl-Kjhn.cjs} +2 -2
- package/dist/{LegacyStateStore-B3kv1Dlb.cjs.map → LegacyStateStore-DSl-Kjhn.cjs.map} +1 -1
- package/dist/{LocalStateStore-CIT6SyRe.mjs → LocalStateStore-CKoytnSh.mjs} +2 -2
- package/dist/{LocalStateStore-CIT6SyRe.mjs.map → LocalStateStore-CKoytnSh.mjs.map} +1 -1
- package/dist/{LocalStateStore-D7QcuAVb.cjs → LocalStateStore-DlXihNk5.cjs} +2 -2
- package/dist/{LocalStateStore-D7QcuAVb.cjs.map → LocalStateStore-DlXihNk5.cjs.map} +1 -1
- package/dist/{S3StateStore-BufODsIW.mjs → S3StateStore-BWiLJgjA.mjs} +4 -4
- package/dist/{S3StateStore-BufODsIW.mjs.map → S3StateStore-BWiLJgjA.mjs.map} +1 -1
- package/dist/{S3StateStore-DenzHSZI.cjs → S3StateStore-DAQh1WJ_.cjs} +4 -4
- package/dist/{S3StateStore-DenzHSZI.cjs.map → S3StateStore-DAQh1WJ_.cjs.map} +1 -1
- package/dist/{SSMStateStore-BcsFXUE4.cjs → SSMStateStore-CwpsKiqW.cjs} +2 -2
- package/dist/{SSMStateStore-BcsFXUE4.cjs.map → SSMStateStore-CwpsKiqW.cjs.map} +1 -1
- package/dist/{SSMStateStore-DK8GsGGP.mjs → SSMStateStore-Dtjc3Tcy.mjs} +2 -2
- package/dist/{SSMStateStore-DK8GsGGP.mjs.map → SSMStateStore-Dtjc3Tcy.mjs.map} +1 -1
- package/dist/{add-Bp-Rr-CO.mjs → add-CgR8OZmf.mjs} +4 -4
- package/dist/{add-Bp-Rr-CO.mjs.map → add-CgR8OZmf.mjs.map} +1 -1
- package/dist/{add-BWr0-iEz.cjs → add-DgoqWfHX.cjs} +4 -4
- package/dist/{add-BWr0-iEz.cjs.map → add-DgoqWfHX.cjs.map} +1 -1
- package/dist/{bundler-aW-QiGWN.mjs → bundler-B0GTqknw.mjs} +6 -6
- package/dist/{bundler-aW-QiGWN.mjs.map → bundler-B0GTqknw.mjs.map} +1 -1
- package/dist/{bundler-Cox-23P6.cjs → bundler-ZNjpx5xS.cjs} +6 -6
- package/dist/{bundler-Cox-23P6.cjs.map → bundler-ZNjpx5xS.cjs.map} +1 -1
- package/dist/{cli-Crhs1fmo.cjs → cli-DqEhTw8n.cjs} +4 -4
- package/dist/{cli-Crhs1fmo.cjs.map → cli-DqEhTw8n.cjs.map} +1 -1
- package/dist/{cli-BsiXqFrT.mjs → cli-bjBjd1zg.mjs} +4 -4
- package/dist/{cli-BsiXqFrT.mjs.map → cli-bjBjd1zg.mjs.map} +1 -1
- package/dist/{clientTelemetry-Bzc4KXz5.d.mts → clientTelemetry-C3GsvvLK.d.cts} +2 -2
- package/dist/clientTelemetry-C3GsvvLK.d.cts.map +1 -0
- package/dist/{clientTelemetry-N8NAguGI.d.cts → clientTelemetry-Dcp0jgkV.d.mts} +2 -2
- package/dist/clientTelemetry-Dcp0jgkV.d.mts.map +1 -0
- package/dist/{compose-BcL1Swdp.mjs → compose-BE2Fi1Bs.mjs} +186 -33
- package/dist/compose-BE2Fi1Bs.mjs.map +1 -0
- package/dist/{compose-BiQ6kNhM.cjs → compose-QHm47c8E.cjs} +197 -32
- package/dist/compose-QHm47c8E.cjs.map +1 -0
- package/dist/{config-KFyPSS0R.d.cts → config-B_pfl-ZN.d.cts} +3 -3
- package/dist/{config-DpqIrrRJ.d.mts.map → config-B_pfl-ZN.d.cts.map} +1 -1
- package/dist/{config-DpqIrrRJ.d.mts → config-CDulXPTe.d.mts} +3 -3
- package/dist/{config-KFyPSS0R.d.cts.map → config-CDulXPTe.d.mts.map} +1 -1
- package/dist/config.cjs +1 -1
- package/dist/config.d.cts +3 -3
- package/dist/config.d.mts +3 -3
- package/dist/config.mjs +1 -1
- package/dist/{credentials-CJyYk-m9.cjs → credentials--QL1R8mL.cjs} +40 -5
- package/dist/credentials--QL1R8mL.cjs.map +1 -0
- package/dist/{credentials-N_yElkgc.mjs → credentials-0Kmo6GAw.mjs} +7 -6
- package/dist/credentials-0Kmo6GAw.mjs.map +1 -0
- package/dist/{credentials-8EmlMGSU.mjs → credentials-CRgp0huX.mjs} +29 -6
- package/dist/credentials-CRgp0huX.mjs.map +1 -0
- package/dist/{credentials-BsgMQm1V.cjs → credentials-No8csre7.cjs} +6 -5
- package/dist/credentials-No8csre7.cjs.map +1 -0
- package/dist/{dbTunnel-CZ-6PUzq.cjs → dbTunnel-CEHBYvbM.cjs} +5 -5
- package/dist/{dbTunnel-CZ-6PUzq.cjs.map → dbTunnel-CEHBYvbM.cjs.map} +1 -1
- package/dist/{dbTunnel-Bmj9fmXv.mjs → dbTunnel-DOiMt-yL.mjs} +5 -5
- package/dist/{dbTunnel-Bmj9fmXv.mjs.map → dbTunnel-DOiMt-yL.mjs.map} +1 -1
- package/dist/deploy/public.cjs +10 -10
- package/dist/deploy/public.d.cts +5 -5
- package/dist/deploy/public.d.mts +5 -5
- package/dist/deploy/public.mjs +10 -10
- package/dist/{deploy-DokDmyUV.mjs → deploy-KdBFBME1.mjs} +12 -11
- package/dist/deploy-KdBFBME1.mjs.map +1 -0
- package/dist/{deploy-DtO1rC_U.cjs → deploy-Pkvk9jIL.cjs} +12 -11
- package/dist/deploy-Pkvk9jIL.cjs.map +1 -0
- package/dist/{destroy-BwKhuhFd.mjs → destroy-CFc0rdP4.mjs} +10 -9
- package/dist/{destroy-BwKhuhFd.mjs.map → destroy-CFc0rdP4.mjs.map} +1 -1
- package/dist/{destroy-BKZY6QLy.cjs → destroy-oqNna46x.cjs} +10 -9
- package/dist/{destroy-BKZY6QLy.cjs.map → destroy-oqNna46x.cjs.map} +1 -1
- package/dist/{dokploy-Clnb-dRK.mjs → dokploy-BkwTpeNU.mjs} +2 -2
- package/dist/{dokploy-Clnb-dRK.mjs.map → dokploy-BkwTpeNU.mjs.map} +1 -1
- package/dist/{dokploy-BJEAhFPx.cjs → dokploy-CxEzce91.cjs} +2 -2
- package/dist/{dokploy-BJEAhFPx.cjs.map → dokploy-CxEzce91.cjs.map} +1 -1
- package/dist/{eas-PwJTBvEv.cjs → eas-DbDHF2WZ.cjs} +3 -3
- package/dist/{eas-PwJTBvEv.cjs.map → eas-DbDHF2WZ.cjs.map} +1 -1
- package/dist/{eas-RRLe1Ykb.mjs → eas-vzSPhv0B.mjs} +3 -3
- package/dist/{eas-RRLe1Ykb.mjs.map → eas-vzSPhv0B.mjs.map} +1 -1
- package/dist/{encryption-C0Obifb1.cjs → encryption-4xb0WByC.cjs} +3 -3
- package/dist/{encryption-C0Obifb1.cjs.map → encryption-4xb0WByC.cjs.map} +1 -1
- package/dist/{encryption-DsiFDtEs.mjs → encryption-BJirKe8H.mjs} +3 -3
- package/dist/{encryption-DsiFDtEs.mjs.map → encryption-BJirKe8H.mjs.map} +1 -1
- package/dist/{engine-C0gShT3p.mjs → engine-Blw0271a.mjs} +7 -7
- package/dist/{engine-C0gShT3p.mjs.map → engine-Blw0271a.mjs.map} +1 -1
- package/dist/{engine-DVDe8Hx_.cjs → engine-C-tyF0OQ.cjs} +7 -7
- package/dist/{engine-DVDe8Hx_.cjs.map → engine-C-tyF0OQ.cjs.map} +1 -1
- package/dist/{github-B0Al5cId.cjs → github-Aydv6vu5.cjs} +7 -7
- package/dist/{github-B0Al5cId.cjs.map → github-Aydv6vu5.cjs.map} +1 -1
- package/dist/{github-o9OKgpAz.mjs → github-C_h3NRr7.mjs} +7 -7
- package/dist/{github-o9OKgpAz.mjs.map → github-C_h3NRr7.mjs.map} +1 -1
- package/dist/{googlePlay-CgEgbCVa.mjs → googlePlay-B7AYn6Pc.mjs} +4 -4
- package/dist/{googlePlay-CgEgbCVa.mjs.map → googlePlay-B7AYn6Pc.mjs.map} +1 -1
- package/dist/{googlePlay-INjqj3Sc.cjs → googlePlay-DpJTysGZ.cjs} +4 -4
- package/dist/{googlePlay-INjqj3Sc.cjs.map → googlePlay-DpJTysGZ.cjs.map} +1 -1
- package/dist/{iam-DloEBLXZ.mjs → iam-CE1QQeEQ.mjs} +2 -2
- package/dist/{iam-DloEBLXZ.mjs.map → iam-CE1QQeEQ.mjs.map} +1 -1
- package/dist/{iam-SxPKYCI_.cjs → iam-DlPqLzjO.cjs} +2 -2
- package/dist/{iam-SxPKYCI_.cjs.map → iam-DlPqLzjO.cjs.map} +1 -1
- package/dist/{index-BThTZV8T.d.mts → index-CBl51bCQ.d.cts} +2 -2
- package/dist/{index-BThTZV8T.d.mts.map → index-CBl51bCQ.d.cts.map} +1 -1
- package/dist/{index-Cgd-ouyI.d.cts → index-Dqp1lLjF.d.mts} +2 -2
- package/dist/{index-Cgd-ouyI.d.cts.map → index-Dqp1lLjF.d.mts.map} +1 -1
- package/dist/index.cjs +126 -72
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +126 -72
- package/dist/index.mjs.map +1 -1
- package/dist/{local-BiM__VCH.cjs → local-BEM8UVsa.cjs} +2 -2
- package/dist/{local-BiM__VCH.cjs.map → local-BEM8UVsa.cjs.map} +1 -1
- package/dist/{local-Cnbc8rQp.mjs → local-ZaXGH2eP.mjs} +2 -2
- package/dist/{local-Cnbc8rQp.mjs.map → local-ZaXGH2eP.mjs.map} +1 -1
- package/dist/{migrate-dgTtl7hO.mjs → migrate-BuReWK8R.mjs} +5 -5
- package/dist/{migrate-dgTtl7hO.mjs.map → migrate-BuReWK8R.mjs.map} +1 -1
- package/dist/{migrate-DgONWHqx.mjs → migrate-CkeIl9YW.mjs} +3 -3
- package/dist/{migrate-DgONWHqx.mjs.map → migrate-CkeIl9YW.mjs.map} +1 -1
- package/dist/{migrate-BIuREfyX.cjs → migrate-Cq4s3V1M.cjs} +3 -3
- package/dist/{migrate-BIuREfyX.cjs.map → migrate-Cq4s3V1M.cjs.map} +1 -1
- package/dist/{migrate-DMePGfDk.cjs → migrate-DTMYWQn6.cjs} +5 -5
- package/dist/{migrate-DMePGfDk.cjs.map → migrate-DTMYWQn6.cjs.map} +1 -1
- package/dist/openapi.cjs +1 -1
- package/dist/openapi.d.cts +2 -2
- package/dist/openapi.d.mts +2 -2
- package/dist/openapi.mjs +1 -1
- package/dist/{projectBucket-DS8YAcjG.mjs → projectBucket-BaZfu9b6.mjs} +2 -2
- package/dist/{projectBucket-DS8YAcjG.mjs.map → projectBucket-BaZfu9b6.mjs.map} +1 -1
- package/dist/{projectBucket-D33fcuVv.cjs → projectBucket-CBzCpLML.cjs} +2 -2
- package/dist/{projectBucket-D33fcuVv.cjs.map → projectBucket-CBzCpLML.cjs.map} +1 -1
- package/dist/{publish-DTESp-zL.cjs → publish-CLYnKn-k.cjs} +2 -2
- package/dist/{publish-DTESp-zL.cjs.map → publish-CLYnKn-k.cjs.map} +1 -1
- package/dist/{publish-DayqXMgK.mjs → publish-UxavszCu.mjs} +2 -2
- package/dist/{publish-DayqXMgK.mjs.map → publish-UxavszCu.mjs.map} +1 -1
- package/dist/reconcile/public.d.cts +1 -1
- package/dist/reconcile/public.d.mts +1 -1
- package/dist/{resolve-CFrS9f8t.mjs → resolve-Bk9a9BVj.mjs} +4 -4
- package/dist/{resolve-CFrS9f8t.mjs.map → resolve-Bk9a9BVj.mjs.map} +1 -1
- package/dist/{resolve-smEj5R9u.cjs → resolve-CeeNr_ex.cjs} +4 -4
- package/dist/{resolve-smEj5R9u.cjs.map → resolve-CeeNr_ex.cjs.map} +1 -1
- package/dist/{rollback-Di2aDQd8.cjs → rollback-D6AdPlie.cjs} +7 -7
- package/dist/{rollback-Di2aDQd8.cjs.map → rollback-D6AdPlie.cjs.map} +1 -1
- package/dist/{rollback-Nh0ECNZP.mjs → rollback-DyMVhn7L.mjs} +7 -7
- package/dist/{rollback-Nh0ECNZP.mjs.map → rollback-DyMVhn7L.mjs.map} +1 -1
- package/dist/{runtime-Ct41f0tN.d.mts → runtime-DFG1CAWA.d.mts} +2 -2
- package/dist/{runtime-BtoiRP5G.d.cts.map → runtime-DFG1CAWA.d.mts.map} +1 -1
- package/dist/{runtime-BtoiRP5G.d.cts → runtime-DjhB4Oxn.d.cts} +2 -2
- package/dist/{runtime-Ct41f0tN.d.mts.map → runtime-DjhB4Oxn.d.cts.map} +1 -1
- package/dist/{s3-NJ6g9LT4.mjs → s3-B9UimcQe.mjs} +3 -3
- package/dist/{s3-NJ6g9LT4.mjs.map → s3-B9UimcQe.mjs.map} +1 -1
- package/dist/{s3-w4NEUmAb.cjs → s3-FbPmbPft.cjs} +3 -3
- package/dist/{s3-w4NEUmAb.cjs.map → s3-FbPmbPft.cjs.map} +1 -1
- package/dist/{serverSetup-C7M3XUzI.mjs → serverSetup-BH7_Zt0N.mjs} +7 -7
- package/dist/{serverSetup-C7M3XUzI.mjs.map → serverSetup-BH7_Zt0N.mjs.map} +1 -1
- package/dist/{serverSetup-QLq-WZ-0.cjs → serverSetup-CeFkPTVz.cjs} +7 -7
- package/dist/{serverSetup-QLq-WZ-0.cjs.map → serverSetup-CeFkPTVz.cjs.map} +1 -1
- package/dist/{sniffer-Cg5jF0Ks.mjs → sniffer-8TlRbqb0.mjs} +7 -7
- package/dist/{sniffer-Cg5jF0Ks.mjs.map → sniffer-8TlRbqb0.mjs.map} +1 -1
- package/dist/{sniffer-DaDiVZV2.cjs → sniffer-B83jVMSA.cjs} +7 -7
- package/dist/{sniffer-DaDiVZV2.cjs.map → sniffer-B83jVMSA.cjs.map} +1 -1
- package/dist/{snsSubscriptions-5EWtnPvE.cjs → snsSubscriptions-B7uEpoJ2.cjs} +12 -6
- package/dist/snsSubscriptions-B7uEpoJ2.cjs.map +1 -0
- package/dist/{snsSubscriptions-Ct4_v2HZ.mjs → snsSubscriptions-BQcD_3UK.mjs} +12 -6
- package/dist/snsSubscriptions-BQcD_3UK.mjs.map +1 -0
- package/dist/{sst-BlXVHMle.cjs → sst-D0t-8yEl.cjs} +6 -6
- package/dist/{sst-BlXVHMle.cjs.map → sst-D0t-8yEl.cjs.map} +1 -1
- package/dist/{sst-DD9MlGXY.mjs → sst-w90IUOX_.mjs} +6 -6
- package/dist/{sst-DD9MlGXY.mjs.map → sst-w90IUOX_.mjs.map} +1 -1
- package/dist/{stack-DWsG_ZL-.mjs → stack-B5-pHmtX.mjs} +64 -28
- package/dist/stack-B5-pHmtX.mjs.map +1 -0
- package/dist/{stack-dyeQ8u3c.cjs → stack-CBgOAZDP.cjs} +63 -27
- package/dist/stack-CBgOAZDP.cjs.map +1 -0
- package/dist/{stage-QJk7pMSh.mjs → stage-C6ogkiRu.mjs} +5 -5
- package/dist/{stage-QJk7pMSh.mjs.map → stage-C6ogkiRu.mjs.map} +1 -1
- package/dist/{stage-Dkd13Ije.cjs → stage-EnQ76HLW.cjs} +5 -5
- package/dist/{stage-Dkd13Ije.cjs.map → stage-EnQ76HLW.cjs.map} +1 -1
- package/dist/{stages-Dk6Lv7DY.cjs → stages-C8HQ9ozh.cjs} +2 -2
- package/dist/{stages-Dk6Lv7DY.cjs.map → stages-C8HQ9ozh.cjs.map} +1 -1
- package/dist/{stages-DFvE7iEO.mjs → stages-DnN6lwL4.mjs} +2 -2
- package/dist/{stages-DFvE7iEO.mjs.map → stages-DnN6lwL4.mjs.map} +1 -1
- package/dist/target/public.cjs +1 -1
- package/dist/target/public.d.cts +2 -2
- package/dist/target/public.d.mts +2 -2
- package/dist/target/public.mjs +1 -1
- package/dist/{terminal-ByYXHXDB.mjs → terminal-Cb58S1Yx.mjs} +2 -2
- package/dist/{terminal-ByYXHXDB.mjs.map → terminal-Cb58S1Yx.mjs.map} +1 -1
- package/dist/{terminal-CsRESfL9.cjs → terminal-D9abUcq9.cjs} +2 -2
- package/dist/{terminal-CsRESfL9.cjs.map → terminal-D9abUcq9.cjs.map} +1 -1
- package/dist/{types-CJTKWLkK.d.mts → types-B-ohhDwy.d.mts} +13 -1
- package/dist/types-B-ohhDwy.d.mts.map +1 -0
- package/dist/{types-BVDaaLas.d.cts → types-BAqI--_q.d.cts} +13 -1
- package/dist/types-BAqI--_q.d.cts.map +1 -0
- package/dist/workspace/index.cjs +1 -1
- package/dist/workspace/index.d.cts +2 -2
- package/dist/workspace/index.d.mts +2 -2
- package/dist/workspace/index.mjs +1 -1
- package/dist/{workspace-CdiCMRap.mjs → workspace-BSGUH2DO.mjs} +5 -3
- package/dist/workspace-BSGUH2DO.mjs.map +1 -0
- package/dist/{workspace-CTspddnJ.cjs → workspace-K403npiD.cjs} +5 -3
- package/dist/workspace-K403npiD.cjs.map +1 -0
- package/package.json +16 -16
- package/dist/clientTelemetry-Bzc4KXz5.d.mts.map +0 -1
- package/dist/clientTelemetry-N8NAguGI.d.cts.map +0 -1
- package/dist/compose-BcL1Swdp.mjs.map +0 -1
- package/dist/compose-BiQ6kNhM.cjs.map +0 -1
- package/dist/credentials-8EmlMGSU.mjs.map +0 -1
- package/dist/credentials-BsgMQm1V.cjs.map +0 -1
- package/dist/credentials-CJyYk-m9.cjs.map +0 -1
- package/dist/credentials-N_yElkgc.mjs.map +0 -1
- package/dist/deploy-DokDmyUV.mjs.map +0 -1
- package/dist/deploy-DtO1rC_U.cjs.map +0 -1
- package/dist/snsSubscriptions-5EWtnPvE.cjs.map +0 -1
- package/dist/snsSubscriptions-Ct4_v2HZ.mjs.map +0 -1
- package/dist/stack-DWsG_ZL-.mjs.map +0 -1
- package/dist/stack-dyeQ8u3c.cjs.map +0 -1
- package/dist/types-BVDaaLas.d.cts.map +0 -1
- package/dist/types-CJTKWLkK.d.mts.map +0 -1
- package/dist/workspace-CTspddnJ.cjs.map +0 -1
- package/dist/workspace-CdiCMRap.mjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sst-BlXVHMle.cjs","names":["GkmError","join","GkmError","rm","existsSync","readFile","kebabCase","GkmError","appKey","CommandFailed","deployedInboxEnv","hasNextSite","NEXT_DEPLOYMENT_ID_KEY","defineTarget","existsSync","join","MissingCredential","activeSandbox","LocalSandbox","detectPackageManager"],"sources":["../src/target/sst/health.ts","../src/target/sst/outputs.ts","../src/target/sst/index.ts"],"sourcesContent":["/**\n * Whether a released surface answers.\n *\n * The paths are the ones the local stack's healthchecks use\n * (`reconcile/apps.ts`): an API's `/health`, a site's `/`. A surface is\n * asked a few times, because a fresh deploy can take a moment to answer — a\n * Lambda's first start, a distribution still settling — and healthy means a\n * 2xx, after redirects.\n */\n\nimport { GkmError } from '../../errors';\nimport type { TargetEvent } from '../types';\n\nexport interface HealthCheckOptions {\n\t/** How many times a surface is asked before it counts as down. */\n\tattempts: number;\n\t/** The wait between two attempts. */\n\tdelayMs: number;\n\t/** How long one request may take. */\n\ttimeoutMs: number;\n\tsignal: AbortSignal;\n\temit: (event: TargetEvent) => void;\n}\n\n/** Surfaces that never answered healthy. */\nexport class SurfacesUnhealthy extends GkmError {\n\tconstructor(\n\t\treadonly stage: string,\n\t\t/** Each surface that failed, with the last thing it answered. */\n\t\treadonly surfaces: readonly {\n\t\t\tapp: string;\n\t\t\turl: string;\n\t\t\tstatus?: number;\n\t\t\terror?: string;\n\t\t}[],\n\t) {\n\t\tconst lines = surfaces.map(\n\t\t\t({ app, url, status, error }) =>\n\t\t\t\t` - ${app}: ${url} → ${status ?? error ?? 'no answer'}`,\n\t\t);\n\t\tsuper(\n\t\t\t`The \"${stage}\" stage was deployed, but ${surfaces.length === 1 ? 'a surface does' : 'surfaces do'} not answer healthy:\\n${lines.join('\\n')}\\nCheck its logs in CloudWatch, fix it, and deploy again.`,\n\t\t);\n\t\tthis.name = 'SurfacesUnhealthy';\n\t}\n}\n\n/** `path` under `base`, keeping any path `base` already has. */\nexport function healthUrl(base: string, path: string): string {\n\tconst root = base.endsWith('/') ? base : `${base}/`;\n\treturn new URL(path.replace(/^\\//, ''), root).toString();\n}\n\n/**\n * Ask `url` until it answers 2xx or the attempts run out, emitting\n * `health.checked` for each. Resolves with the last answer.\n */\nexport async function checkHealth(\n\tapp: string,\n\turl: string,\n\toptions: HealthCheckOptions,\n): Promise<{ healthy: boolean; status?: number; error?: string }> {\n\tlet last: { healthy: boolean; status?: number; error?: string } = {\n\t\thealthy: false,\n\t};\n\tfor (let attempt = 1; attempt <= options.attempts; attempt++) {\n\t\toptions.signal.throwIfAborted();\n\t\ttry {\n\t\t\tconst response = await fetch(url, {\n\t\t\t\tredirect: 'follow',\n\t\t\t\tsignal: AbortSignal.any([\n\t\t\t\t\toptions.signal,\n\t\t\t\t\tAbortSignal.timeout(options.timeoutMs),\n\t\t\t\t]),\n\t\t\t});\n\t\t\t// Drained, so the connection is not held open by an unread body.\n\t\t\tawait response.arrayBuffer().catch(() => undefined);\n\t\t\tlast = { healthy: response.ok, status: response.status };\n\t\t} catch (error) {\n\t\t\t// The run being stopped is not the surface being down.\n\t\t\toptions.signal.throwIfAborted();\n\t\t\tlast = {\n\t\t\t\thealthy: false,\n\t\t\t\terror: error instanceof Error ? error.message : String(error),\n\t\t\t};\n\t\t}\n\t\toptions.emit({\n\t\t\ttype: 'health.checked',\n\t\t\tapp,\n\t\t\turl,\n\t\t\thealthy: last.healthy,\n\t\t\t...(last.status !== undefined ? { status: last.status } : {}),\n\t\t\tattempt,\n\t\t});\n\t\tif (last.healthy) return last;\n\t\tif (attempt < options.attempts) await wait(options.delayMs, options.signal);\n\t}\n\treturn last;\n}\n\nfunction wait(ms: number, signal: AbortSignal): Promise<void> {\n\tif (ms <= 0) return Promise.resolve();\n\treturn new Promise((resolve, reject) => {\n\t\tconst timer = setTimeout(() => {\n\t\t\tsignal.removeEventListener('abort', stop);\n\t\t\tresolve();\n\t\t}, ms);\n\t\tconst stop = () => {\n\t\t\tclearTimeout(timer);\n\t\t\treject(signal.reason);\n\t\t};\n\t\tsignal.addEventListener('abort', stop, { once: true });\n\t});\n}\n","/**\n * The surface URLs an `sst deploy` reports.\n *\n * SST writes whatever `run()` in `sst.config.ts` returns to\n * `.sst/outputs.json` after every successful deploy — `{\"Api\": \"https://…\"}`.\n * What `run()` returns is the project's to write, so this reads it leniently:\n * nested objects are walked, anything that is not an http(s) URL is ignored,\n * and an output names a surface by its id in any casing, with or without a\n * `Url` suffix (`Api`, `api`, `ApiUrl`, `API_URL`, `Api.url`).\n */\n\nimport { existsSync } from 'node:fs';\nimport { readFile, rm } from 'node:fs/promises';\nimport { join } from 'node:path';\nimport { kebabCase } from '@geekmidas/manifest';\nimport { GkmError } from '../../errors';\n\n/** Where SST leaves the last successful deploy's outputs, under the project. */\nexport const SST_OUTPUTS_FILE = join('.sst', 'outputs.json');\n\n/** `.sst/outputs.json` is there, and is not JSON. */\nexport class SstOutputsUnreadable extends GkmError {\n\tconstructor(\n\t\treadonly path: string,\n\t\treadonly reason: string,\n\t) {\n\t\tsuper(\n\t\t\t`Could not read SST's outputs at ${path}: ${reason}. It is rewritten by every successful \\`sst deploy\\`; delete it and deploy again.`,\n\t\t);\n\t\tthis.name = 'SstOutputsUnreadable';\n\t}\n}\n\n/**\n * Remove what an earlier deploy wrote, so the outputs read after this one\n * are this one's — not another stage's, deployed from the same checkout.\n */\nexport async function clearOutputs(cwd: string): Promise<void> {\n\tawait rm(join(cwd, SST_OUTPUTS_FILE), { force: true });\n}\n\n/** The deploy's outputs, or `{}` when it wrote none. */\nexport async function readOutputs(cwd: string): Promise<unknown> {\n\tconst path = join(cwd, SST_OUTPUTS_FILE);\n\tif (!existsSync(path)) return {};\n\ttry {\n\t\treturn JSON.parse(await readFile(path, 'utf8'));\n\t} catch (error) {\n\t\tthrow new SstOutputsUnreadable(\n\t\t\tpath,\n\t\t\terror instanceof Error ? error.message : String(error),\n\t\t);\n\t}\n}\n\n/** Every http(s) URL in `outputs`, by its key path: `['Api', 'url']`. */\nfunction urlsIn(\n\tvalue: unknown,\n\tpath: string[] = [],\n\tfound: { path: string[]; url: string }[] = [],\n): { path: string[]; url: string }[] {\n\tif (typeof value === 'string') {\n\t\tif (isHttpUrl(value)) found.push({ path, url: value });\n\t} else if (value && typeof value === 'object' && !Array.isArray(value)) {\n\t\tfor (const [key, child] of Object.entries(value)) {\n\t\t\turlsIn(child, [...path, key], found);\n\t\t}\n\t}\n\treturn found;\n}\n\nfunction isHttpUrl(value: string): boolean {\n\ttry {\n\t\tconst { protocol } = new URL(value);\n\t\treturn protocol === 'http:' || protocol === 'https:';\n\t} catch {\n\t\treturn false;\n\t}\n}\n\n/**\n * The app an output's key path names, kebab-cased as app keys are: its last\n * segment, without a `url` suffix — or its parent's, when the last segment\n * is only `url`. Exact names are tried first, so an app called `api-url`\n * still finds `ApiUrl`.\n */\nfunction namesOf(path: string[]): string[] {\n\tconst names: string[] = [];\n\tfor (const segment of [...path].reverse()) {\n\t\tconst name = kebabCase(segment);\n\t\tnames.push(name);\n\t\tconst bare = name.replace(/-?url$/, '');\n\t\tif (bare) {\n\t\t\tnames.push(bare);\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn names;\n}\n\n/**\n * Each app's URL from the outputs, for the apps given. An app no output\n * names is left out.\n */\nexport function surfaceUrls(\n\toutputs: unknown,\n\tapps: readonly string[],\n): Record<string, string> {\n\tconst found = urlsIn(outputs);\n\tconst urls: Record<string, string> = {};\n\tfor (const app of apps) {\n\t\t// An exact name beats a stripped one, wherever each is in the file.\n\t\tconst exact = found.find(({ path }) => namesOf(path)[0] === app);\n\t\tconst loose = found.find(({ path }) => namesOf(path).includes(app));\n\t\tconst match = exact ?? loose;\n\t\tif (match) urls[app] = match.url;\n\t}\n\treturn urls;\n}\n","/**\n * The built-in `sst` target: `gkm build` writes the manifest, `sst deploy`\n * provisions it, and the surfaces SST reports are health-checked.\n *\n * `@geekmidas/cloud` is unchanged by it: `sst.config.ts` still reads\n * `.gkm/manifest/aws.ts` and `fromManifest` still makes every resource. What\n * the target adds is the run around the two commands — the lock, the events,\n * verification, and credentials kept where they belong.\n *\n * Both commands run in the sandbox: the build executes the project's code,\n * and so does `sst deploy`, which evaluates `sst.config.ts`. Only the second\n * needs AWS, so the AWS credential goes into that one command's environment\n * and nowhere else — not the build's, not the process the deploy runs in.\n * What `sst deploy` needs beyond them, the sandbox already passes: `PATH`\n * for node and the package manager, and `HOME`, under which SST keeps its\n * toolchain (`~/.config/sst`: bun, pulumi and its plugins) and the AWS SDK\n * finds `~/.aws` for a profile. Its state — the Pulumi backend and the\n * passphrase — is in the stage's own account, reached with that credential.\n */\n\nimport { existsSync } from 'node:fs';\nimport { join } from 'node:path';\nimport type { ConstructManifest } from '@geekmidas/manifest';\nimport { deployedInboxEnv } from '../../compose/stack';\nimport {\n\ttype AwsCredential,\n\tMissingCredential,\n} from '../../deploy/credentials';\nimport { hasNextSite, NEXT_DEPLOYMENT_ID_KEY } from '../../deploy/nextRelease';\nimport type { DeployResult } from '../../deploy/types';\nimport { GkmError } from '../../errors';\nimport { detectPackageManager, type PackageManager } from '../../init/utils';\nimport { CommandFailed } from '../../run';\nimport { LocalSandbox } from '../../sandbox/local';\nimport { activeSandbox, type Sandbox } from '../../sandbox/sandbox';\nimport { appKey } from '../../workspace/derive';\nimport { defineTarget } from '../define';\nimport type { DeployPhaseContext, DeployTarget } from '../types';\nimport { checkHealth, healthUrl, SurfacesUnhealthy } from './health';\nimport { clearOutputs, readOutputs, surfaceUrls } from './outputs';\n\nexport { SurfacesUnhealthy } from './health';\nexport { SST_OUTPUTS_FILE, SstOutputsUnreadable } from './outputs';\n\n/** A cold build of every handler and site. */\nconst BUILD_TIMEOUT_MS = 30 * 60_000;\n/**\n * A first deploy creates CloudFront distributions and, with a database, a\n * VPC and an RDS instance — each of which alone can take a quarter of an hour.\n */\nconst DEPLOY_TIMEOUT_MS = 90 * 60_000;\n\n/** The workspace has no `sst.config.ts` for `sst deploy` to run. */\nexport class SstConfigNotFound extends GkmError {\n\tconstructor(readonly cwd: string) {\n\t\tsuper(\n\t\t\t`No sst.config.ts in ${cwd}. The sst target runs \\`sst deploy\\` at the workspace root: scaffold one with \\`gkm init --deploy sst\\` and copy its sst.config.ts, or deploy through another target with --target.`,\n\t\t);\n\t\tthis.name = 'SstConfigNotFound';\n\t}\n}\n\n/** What the phases hand on. */\nexport interface SstRun {\n\tsandbox: Sandbox;\n\tpm: PackageManager;\n\taws: AwsCredential;\n\t/** The apps SST deploys this run: `ctx.apps` without the skipped. */\n\tapps: string[];\n\t/** Each app's URL, from the deploy's outputs. */\n\turls: Record<string, string>;\n}\n\nexport interface SstTargetOptions {\n\t/** How often, and how patiently, `verify` asks each surface. */\n\thealth?: { attempts?: number; delayMs?: number; timeoutMs?: number };\n}\n\n/**\n * The project's own copy of `bin`, through its package manager — never one\n * `npx` would download, which would be code nobody installed.\n */\nexport function projectCommand(\n\tpm: PackageManager,\n\tbin: string,\n\targs: readonly string[],\n): [command: string, args: string[]] {\n\tswitch (pm) {\n\t\tcase 'pnpm':\n\t\t\treturn ['pnpm', ['exec', bin, ...args]];\n\t\tcase 'yarn':\n\t\t\treturn ['yarn', [bin, ...args]];\n\t\tcase 'bun':\n\t\t\treturn ['bunx', [bin, ...args]];\n\t\tcase 'npm':\n\t\t\treturn ['npx', ['--no-install', bin, ...args]];\n\t}\n}\n\n/**\n * The variables `credential` is to the AWS SDK and to SST.\n *\n * A profile is passed alone: given keys too, every SDK would take the keys.\n */\nexport function awsEnv(credential: AwsCredential): Record<string, string> {\n\tconst region: Record<string, string> = credential.region\n\t\t? { AWS_REGION: credential.region, AWS_DEFAULT_REGION: credential.region }\n\t\t: {};\n\tif ('profile' in credential) {\n\t\treturn { AWS_PROFILE: credential.profile, ...region };\n\t}\n\treturn {\n\t\tAWS_ACCESS_KEY_ID: credential.accessKeyId,\n\t\tAWS_SECRET_ACCESS_KEY: credential.secretAccessKey,\n\t\t...(credential.sessionToken\n\t\t\t? { AWS_SESSION_TOKEN: credential.sessionToken }\n\t\t\t: {}),\n\t\t...region,\n\t};\n}\n\n/**\n * `env` without any `AWS_*`, so a host sandbox that passes some cannot put\n * a second account beside the one the credential names.\n */\nfunction withoutAws(\n\tenv: Readonly<Record<string, string>>,\n): Record<string, string> {\n\treturn Object.fromEntries(\n\t\tObject.entries(env).filter(([name]) => !name.startsWith('AWS_')),\n\t);\n}\n\n/** Each app's kind in the manifest, by app key: `rest-api` or `site`. */\nfunction kindsOf(manifest: ConstructManifest): Map<string, string> {\n\treturn new Map(\n\t\tObject.entries(manifest).map(([id, declaration]) => [\n\t\t\tappKey(id),\n\t\t\tdeclaration.kind,\n\t\t]),\n\t);\n}\n\nasync function exec(\n\tctx: DeployPhaseContext<unknown>,\n\trun: SstRun,\n\t[command, args]: [string, string[]],\n\toptions: { env: Record<string, string>; timeoutMs: number },\n): Promise<void> {\n\tconst result = await run.sandbox.exec(command, args, {\n\t\tcwd: ctx.cwd,\n\t\tenv: options.env,\n\t\ttimeoutMs: options.timeoutMs,\n\t\toutput: ctx.childOutput,\n\t\tsignal: ctx.signal,\n\t});\n\tif (result.exitCode !== 0) {\n\t\tthrow new CommandFailed(\n\t\t\tcommand,\n\t\t\targs,\n\t\t\tresult.exitCode,\n\t\t\tresult.signal as NodeJS.Signals | null,\n\t\t);\n\t}\n}\n\n/**\n * What SST reads for each inbox, by key: the stage's domain, and what the\n * inbox's provider made — its bucket's URL and its topic's string — from the\n * stage's secrets, read by the same rule as on compose. SST provisions none\n * of it; `fromManifest` references the topic and links the inbox's values.\n */\nexport async function inboxEnv(\n\tctx: DeployPhaseContext<unknown>,\n): Promise<Record<string, string>> {\n\tif (!Object.values(ctx.manifest).some((d) => d.kind === 'inbox')) return {};\n\tconst stored = await ctx.secrets.read();\n\tconst domain = ctx.workspace.domains?.[ctx.stage];\n\tconst env = deployedInboxEnv(ctx.manifest, {\n\t\treader: 'sst deploy',\n\t\tstage: ctx.stage,\n\t\tdomain,\n\t\tsecrets: stored?.custom ?? {},\n\t});\n\t// The URLs carry the provider's access key; the domain is public.\n\tfor (const value of Object.values(env)) {\n\t\tif (value !== domain) ctx.secrets.mask(value);\n\t}\n\treturn env;\n}\n\n/**\n * What `sst deploy` hands each Next site's build, which SST runs with its\n * own environment: the deploy's tag as `NEXT_DEPLOYMENT_ID`. A site on AWS is\n * Next's static export — no server, so no server actions and no key — whose\n * assets are tagged with the release it was built for. Nothing where the\n * stage has no Next site.\n */\nexport function nextReleaseEnv(\n\tctx: Pick<DeployPhaseContext<unknown>, 'manifest' | 'tag'>,\n): Record<string, string> {\n\treturn hasNextSite(ctx.manifest) ? { [NEXT_DEPLOYMENT_ID_KEY]: ctx.tag } : {};\n}\n\n/** The `sst` target, with its health checks tuned — for tests and hosts. */\nexport function createSstTarget(\n\toptions: SstTargetOptions = {},\n): DeployTarget<undefined, SstRun> {\n\tconst health = {\n\t\tattempts: options.health?.attempts ?? 6,\n\t\tdelayMs: options.health?.delayMs ?? 5_000,\n\t\ttimeoutMs: options.health?.timeoutMs ?? 10_000,\n\t};\n\n\treturn defineTarget<undefined, SstRun>({\n\t\tname: 'sst',\n\t\truntime: 'aws',\n\t\t// SST keeps no previous release to return to; migrations run in the\n\t\t// stack, as `fromManifest` provisions the database; and nothing here\n\t\t// builds an image.\n\t\tcapabilities: { rollback: false, migrations: 'target', images: false },\n\t\tcredentials: ['aws'],\n\n\t\tasync validate(ctx) {\n\t\t\tif (!existsSync(join(ctx.cwd, 'sst.config.ts'))) {\n\t\t\t\tthrow new SstConfigNotFound(ctx.cwd);\n\t\t\t}\n\n\t\t\tconst aws = await ctx.credentials.get(\n\t\t\t\t{ kind: 'aws', stage: ctx.stage },\n\t\t\t\t{ signal: ctx.signal },\n\t\t\t);\n\t\t\tif (!aws) throw new MissingCredential('aws', ctx.stage);\n\t\t\tif (!('profile' in aws)) {\n\t\t\t\tctx.secrets.mask(aws.secretAccessKey);\n\t\t\t\tif (aws.sessionToken) ctx.secrets.mask(aws.sessionToken);\n\t\t\t}\n\n\t\t\t// A mobile app ships through its own store's toolchain.\n\t\t\tfor (const app of ctx.apps) {\n\t\t\t\tif (ctx.workspace.apps[app]?.type === 'mobile') {\n\t\t\t\t\tctx.skip(app, 'mobile apps deploy through their own toolchain');\n\t\t\t\t}\n\t\t\t}\n\t\t\tconst skipped = new Set(ctx.skipped.map(({ app }) => app));\n\t\t\tconst apps = ctx.apps.filter((app) => !skipped.has(app));\n\n\t\t\tctx.logger.info(\n\t\t\t\t`\\n🚀 Deploying \"${ctx.workspace.name}\" to the \"${ctx.stage}\" stage with SST`,\n\t\t\t);\n\t\t\tctx.logger.info(\n\t\t\t\t` AWS: ${'profile' in aws ? `profile \"${aws.profile}\"` : 'access keys'}`,\n\t\t\t);\n\t\t\t// `sst deploy` takes the whole stack: there is no deploying one app.\n\t\t\tconst deployable = Object.values(ctx.workspace.apps).filter(\n\t\t\t\t(app) => app.type !== 'mobile',\n\t\t\t).length;\n\t\t\tif (apps.length < deployable) {\n\t\t\t\tctx.logger.warn(\n\t\t\t\t\t` sst deploy deploys every construct of the stage, not only ${apps.join(', ')}.`,\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tsandbox: activeSandbox() ?? new LocalSandbox({ root: ctx.cwd }),\n\t\t\t\tpm: detectPackageManager(ctx.cwd),\n\t\t\t\taws,\n\t\t\t\tapps,\n\t\t\t\turls: {},\n\t\t\t};\n\t\t},\n\n\t\tasync plan(ctx, run) {\n\t\t\tconst kinds = kindsOf(ctx.manifest);\n\t\t\tfor (const app of run.apps) {\n\t\t\t\tctx.emit({\n\t\t\t\t\ttype: 'resource.planned',\n\t\t\t\t\tkey: `application:${app}`,\n\t\t\t\t\tresourceType: kinds.get(app) ?? 'application',\n\t\t\t\t\taction: 'ensure',\n\t\t\t\t});\n\t\t\t}\n\t\t\tconst [build, buildArgs] = buildCommand(ctx, run);\n\t\t\tconst [deploy, deployArgs] = deployCommand(ctx, run);\n\t\t\tctx.logger.info(` Would run: ${[build, ...buildArgs].join(' ')}`);\n\t\t\tctx.logger.info(` Would run: ${[deploy, ...deployArgs].join(' ')}`);\n\t\t},\n\n\t\tasync build(ctx, run) {\n\t\t\tctx.logger.info('\\n📦 Building the manifest SST deploys');\n\t\t\t// No credential: the build runs the project's code and needs none.\n\t\t\tawait exec(ctx, run, buildCommand(ctx, run), {\n\t\t\t\tenv: { ...run.sandbox.env },\n\t\t\t\ttimeoutMs: BUILD_TIMEOUT_MS,\n\t\t\t});\n\t\t},\n\n\t\tasync release(ctx, run) {\n\t\t\tctx.logger.info(`\\n☁️ sst deploy --stage ${ctx.stage}`);\n\t\t\tawait clearOutputs(ctx.cwd);\n\t\t\tawait exec(ctx, run, deployCommand(ctx, run), {\n\t\t\t\tenv: {\n\t\t\t\t\t...withoutAws(run.sandbox.env),\n\t\t\t\t\t...(await inboxEnv(ctx)),\n\t\t\t\t\t...nextReleaseEnv(ctx),\n\t\t\t\t\t...awsEnv(run.aws),\n\t\t\t\t},\n\t\t\t\ttimeoutMs: DEPLOY_TIMEOUT_MS,\n\t\t\t});\n\n\t\t\trun.urls = surfaceUrls(await readOutputs(ctx.cwd), run.apps);\n\t\t\tfor (const app of run.apps) {\n\t\t\t\tctx.emit({\n\t\t\t\t\ttype: 'app.deployed',\n\t\t\t\t\tapp,\n\t\t\t\t\tapplicationId: ctx.name(app),\n\t\t\t\t\t// SST builds no image a registry holds.\n\t\t\t\t\timageRef: '',\n\t\t\t\t\turl: run.urls[app] ?? '',\n\t\t\t\t});\n\t\t\t}\n\t\t},\n\n\t\tasync verify(ctx, run) {\n\t\t\tconst unhealthy: SurfacesUnhealthy['surfaces'][number][] = [];\n\t\t\tconst kinds = kindsOf(ctx.manifest);\n\n\t\t\tfor (const app of run.apps) {\n\t\t\t\tconst path = healthPath(kinds.get(app), ctx.workspace.apps[app]?.type);\n\t\t\t\tif (!path) {\n\t\t\t\t\tctx.logger.info(\n\t\t\t\t\t\t` ${app}: API Gateway holds its sockets and has no HTTP path to ask, so it was not checked.`,\n\t\t\t\t\t);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tconst base = run.urls[app];\n\t\t\t\tif (!base) {\n\t\t\t\t\tctx.logger.warn(\n\t\t\t\t\t\t` ⚠ No URL for ${app} in SST's outputs, so it was not checked. Return it from run() in sst.config.ts — { ${app}: <its url> } — to have it checked.`,\n\t\t\t\t\t);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tconst url = healthUrl(base, path);\n\t\t\t\tconst answer = await checkHealth(app, url, {\n\t\t\t\t\t...health,\n\t\t\t\t\tsignal: ctx.signal,\n\t\t\t\t\temit: ctx.emit,\n\t\t\t\t});\n\t\t\t\tif (answer.healthy) {\n\t\t\t\t\tctx.logger.info(` ✓ ${app}: ${url}`);\n\t\t\t\t} else {\n\t\t\t\t\tunhealthy.push({\n\t\t\t\t\t\tapp,\n\t\t\t\t\t\turl,\n\t\t\t\t\t\t...(answer.status !== undefined ? { status: answer.status } : {}),\n\t\t\t\t\t\t...(answer.error ? { error: answer.error } : {}),\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (unhealthy.length > 0) {\n\t\t\t\tthrow new SurfacesUnhealthy(ctx.stage, unhealthy);\n\t\t\t}\n\t\t},\n\n\t\tresult(ctx, run): DeployResult {\n\t\t\treturn {\n\t\t\t\tapps: run.apps.map((appName) => ({\n\t\t\t\t\tappName,\n\t\t\t\t\ttype: ctx.workspace.apps[appName]?.type ?? 'backend',\n\t\t\t\t\tsuccess: true,\n\t\t\t\t\t...(run.urls[appName] ? { url: run.urls[appName] } : {}),\n\t\t\t\t})),\n\t\t\t\tprojectId: '',\n\t\t\t\tenvironmentId: '',\n\t\t\t\tsuccessCount: ctx.dryRun ? 0 : run.apps.length,\n\t\t\t\tfailedCount: 0,\n\t\t\t\tstage: ctx.stage,\n\t\t\t\tidentity: ctx.identity.key,\n\t\t\t\ttag: ctx.tag,\n\t\t\t\tdryRun: ctx.dryRun,\n\t\t\t\tskipped: [...ctx.skipped],\n\t\t\t\turls: { ...run.urls },\n\t\t\t\tchanges: [],\n\t\t\t};\n\t\t},\n\t});\n}\n\nfunction buildCommand(\n\tctx: DeployPhaseContext<unknown>,\n\trun: SstRun,\n): [string, string[]] {\n\treturn projectCommand(run.pm, 'gkm', [\n\t\t'build',\n\t\t'--provider',\n\t\t'aws',\n\t\t'--stage',\n\t\tctx.stage,\n\t]);\n}\n\nfunction deployCommand(\n\tctx: DeployPhaseContext<unknown>,\n\trun: SstRun,\n): [string, string[]] {\n\treturn projectCommand(run.pm, 'sst', ['deploy', '--stage', ctx.stage]);\n}\n\n/**\n * The path a released app is asked on: a backend's `/health`, a site's `/`.\n * A WebSocket surface has none on AWS — API Gateway answers its handshake,\n * and its routes are Lambdas behind it — so it is not asked.\n */\nexport function healthPath(\n\tkind: string | undefined,\n\tappType: string | undefined,\n): string | undefined {\n\tif (kind === 'websocket-api') return undefined;\n\t// A surface — a `rest-api` — is the backend app it derives.\n\treturn appType === 'backend' ? '/health' : '/';\n}\n\nexport const sstTarget = createSstTarget();\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAyBA,IAAa,oBAAb,cAAuCA,eAAAA,SAAS;CAErC;CAEA;CAHV,YACC,OAEA,UAMC;EACD,MAAM,QAAQ,SAAS,KACrB,EAAE,KAAK,KAAK,QAAQ,YACpB,OAAO,IAAI,IAAI,IAAI,KAAK,UAAU,SAAS,aAC7C;EACA,MACC,QAAQ,MAAM,4BAA4B,SAAS,WAAW,IAAI,mBAAmB,cAAc,wBAAwB,MAAM,KAAK,IAAI,EAAE,0DAC7I;EAfS,KAAA,QAAA;EAEA,KAAA,WAAA;EAcT,KAAK,OAAO;CACb;AACD;;AAGA,SAAgB,UAAU,MAAc,MAAsB;CAC7D,MAAM,OAAO,KAAK,SAAS,GAAG,IAAI,OAAO,GAAG,KAAK;CACjD,OAAO,IAAI,IAAI,KAAK,QAAQ,OAAO,EAAE,GAAG,IAAI,CAAC,CAAC,SAAS;AACxD;;;;;AAMA,eAAsB,YACrB,KACA,KACA,SACiE;CACjE,IAAI,OAA8D,EACjE,SAAS,MACV;CACA,KAAK,IAAI,UAAU,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O,QAAQ,EAAE,OAAO,OAAO,MAAM,IAAI,CAAC;IAC/C,CAAC;GAEH;GAEA,IAAI,UAAU,SAAS,GACtB,MAAM,IAAI,kBAAkB,IAAI,OAAO,SAAS;EAElD;EAEA,OAAO,KAAK,KAAmB;GAC9B,OAAO;IACN,MAAM,IAAI,KAAK,KAAK,aAAa;KAChC;KACA,MAAM,IAAI,UAAU,KAAK,QAAQ,EAAE,QAAQ;KAC3C,SAAS;KACT,GAAI,IAAI,KAAK,WAAW,EAAE,KAAK,IAAI,KAAK,SAAS,IAAI,CAAC;IACvD,EAAE;IACF,WAAW;IACX,eAAe;IACf,cAAc,IAAI,SAAS,IAAI,IAAI,KAAK;IACxC,aAAa;IACb,OAAO,IAAI;IACX,UAAU,IAAI,SAAS;IACvB,KAAK,IAAI;IACT,QAAQ,IAAI;IACZ,SAAS,CAAC,GAAG,IAAI,OAAO;IACxB,MAAM,EAAE,GAAG,IAAI,KAAK;IACpB,SAAS,CAAC;GACX;EACD;CACD,CAAC;AACF;AAEA,SAAS,aACR,KACA,KACqB;CACrB,OAAO,eAAe,IAAI,IAAI,OAAO;EACpC;EACA;EACA;EACA;EACA,IAAI;CACL,CAAC;AACF;AAEA,SAAS,cACR,KACA,KACqB;CACrB,OAAO,eAAe,IAAI,IAAI,OAAO;EAAC;EAAU;EAAW,IAAI;CAAK,CAAC;AACtE;;;;;;AAOA,SAAgB,WACf,MACA,SACqB;CACrB,IAAI,SAAS,iBAAiB,OAAO,KAAA;CAErC,OAAO,YAAY,YAAY,YAAY;AAC5C;AAEA,MAAa,YAAY,gBAAgB"}
|
|
1
|
+
{"version":3,"file":"sst-D0t-8yEl.cjs","names":["GkmError","join","GkmError","rm","existsSync","readFile","kebabCase","GkmError","appKey","CommandFailed","deployedInboxEnv","hasNextSite","NEXT_DEPLOYMENT_ID_KEY","defineTarget","existsSync","join","MissingCredential","activeSandbox","LocalSandbox","detectPackageManager"],"sources":["../src/target/sst/health.ts","../src/target/sst/outputs.ts","../src/target/sst/index.ts"],"sourcesContent":["/**\n * Whether a released surface answers.\n *\n * The paths are the ones the local stack's healthchecks use\n * (`reconcile/apps.ts`): an API's `/health`, a site's `/`. A surface is\n * asked a few times, because a fresh deploy can take a moment to answer — a\n * Lambda's first start, a distribution still settling — and healthy means a\n * 2xx, after redirects.\n */\n\nimport { GkmError } from '../../errors';\nimport type { TargetEvent } from '../types';\n\nexport interface HealthCheckOptions {\n\t/** How many times a surface is asked before it counts as down. */\n\tattempts: number;\n\t/** The wait between two attempts. */\n\tdelayMs: number;\n\t/** How long one request may take. */\n\ttimeoutMs: number;\n\tsignal: AbortSignal;\n\temit: (event: TargetEvent) => void;\n}\n\n/** Surfaces that never answered healthy. */\nexport class SurfacesUnhealthy extends GkmError {\n\tconstructor(\n\t\treadonly stage: string,\n\t\t/** Each surface that failed, with the last thing it answered. */\n\t\treadonly surfaces: readonly {\n\t\t\tapp: string;\n\t\t\turl: string;\n\t\t\tstatus?: number;\n\t\t\terror?: string;\n\t\t}[],\n\t) {\n\t\tconst lines = surfaces.map(\n\t\t\t({ app, url, status, error }) =>\n\t\t\t\t` - ${app}: ${url} → ${status ?? error ?? 'no answer'}`,\n\t\t);\n\t\tsuper(\n\t\t\t`The \"${stage}\" stage was deployed, but ${surfaces.length === 1 ? 'a surface does' : 'surfaces do'} not answer healthy:\\n${lines.join('\\n')}\\nCheck its logs in CloudWatch, fix it, and deploy again.`,\n\t\t);\n\t\tthis.name = 'SurfacesUnhealthy';\n\t}\n}\n\n/** `path` under `base`, keeping any path `base` already has. */\nexport function healthUrl(base: string, path: string): string {\n\tconst root = base.endsWith('/') ? base : `${base}/`;\n\treturn new URL(path.replace(/^\\//, ''), root).toString();\n}\n\n/**\n * Ask `url` until it answers 2xx or the attempts run out, emitting\n * `health.checked` for each. Resolves with the last answer.\n */\nexport async function checkHealth(\n\tapp: string,\n\turl: string,\n\toptions: HealthCheckOptions,\n): Promise<{ healthy: boolean; status?: number; error?: string }> {\n\tlet last: { healthy: boolean; status?: number; error?: string } = {\n\t\thealthy: false,\n\t};\n\tfor (let attempt = 1; attempt <= options.attempts; attempt++) {\n\t\toptions.signal.throwIfAborted();\n\t\ttry {\n\t\t\tconst response = await fetch(url, {\n\t\t\t\tredirect: 'follow',\n\t\t\t\tsignal: AbortSignal.any([\n\t\t\t\t\toptions.signal,\n\t\t\t\t\tAbortSignal.timeout(options.timeoutMs),\n\t\t\t\t]),\n\t\t\t});\n\t\t\t// Drained, so the connection is not held open by an unread body.\n\t\t\tawait response.arrayBuffer().catch(() => undefined);\n\t\t\tlast = { healthy: response.ok, status: response.status };\n\t\t} catch (error) {\n\t\t\t// The run being stopped is not the surface being down.\n\t\t\toptions.signal.throwIfAborted();\n\t\t\tlast = {\n\t\t\t\thealthy: false,\n\t\t\t\terror: error instanceof Error ? error.message : String(error),\n\t\t\t};\n\t\t}\n\t\toptions.emit({\n\t\t\ttype: 'health.checked',\n\t\t\tapp,\n\t\t\turl,\n\t\t\thealthy: last.healthy,\n\t\t\t...(last.status !== undefined ? { status: last.status } : {}),\n\t\t\tattempt,\n\t\t});\n\t\tif (last.healthy) return last;\n\t\tif (attempt < options.attempts) await wait(options.delayMs, options.signal);\n\t}\n\treturn last;\n}\n\nfunction wait(ms: number, signal: AbortSignal): Promise<void> {\n\tif (ms <= 0) return Promise.resolve();\n\treturn new Promise((resolve, reject) => {\n\t\tconst timer = setTimeout(() => {\n\t\t\tsignal.removeEventListener('abort', stop);\n\t\t\tresolve();\n\t\t}, ms);\n\t\tconst stop = () => {\n\t\t\tclearTimeout(timer);\n\t\t\treject(signal.reason);\n\t\t};\n\t\tsignal.addEventListener('abort', stop, { once: true });\n\t});\n}\n","/**\n * The surface URLs an `sst deploy` reports.\n *\n * SST writes whatever `run()` in `sst.config.ts` returns to\n * `.sst/outputs.json` after every successful deploy — `{\"Api\": \"https://…\"}`.\n * What `run()` returns is the project's to write, so this reads it leniently:\n * nested objects are walked, anything that is not an http(s) URL is ignored,\n * and an output names a surface by its id in any casing, with or without a\n * `Url` suffix (`Api`, `api`, `ApiUrl`, `API_URL`, `Api.url`).\n */\n\nimport { existsSync } from 'node:fs';\nimport { readFile, rm } from 'node:fs/promises';\nimport { join } from 'node:path';\nimport { kebabCase } from '@geekmidas/manifest';\nimport { GkmError } from '../../errors';\n\n/** Where SST leaves the last successful deploy's outputs, under the project. */\nexport const SST_OUTPUTS_FILE = join('.sst', 'outputs.json');\n\n/** `.sst/outputs.json` is there, and is not JSON. */\nexport class SstOutputsUnreadable extends GkmError {\n\tconstructor(\n\t\treadonly path: string,\n\t\treadonly reason: string,\n\t) {\n\t\tsuper(\n\t\t\t`Could not read SST's outputs at ${path}: ${reason}. It is rewritten by every successful \\`sst deploy\\`; delete it and deploy again.`,\n\t\t);\n\t\tthis.name = 'SstOutputsUnreadable';\n\t}\n}\n\n/**\n * Remove what an earlier deploy wrote, so the outputs read after this one\n * are this one's — not another stage's, deployed from the same checkout.\n */\nexport async function clearOutputs(cwd: string): Promise<void> {\n\tawait rm(join(cwd, SST_OUTPUTS_FILE), { force: true });\n}\n\n/** The deploy's outputs, or `{}` when it wrote none. */\nexport async function readOutputs(cwd: string): Promise<unknown> {\n\tconst path = join(cwd, SST_OUTPUTS_FILE);\n\tif (!existsSync(path)) return {};\n\ttry {\n\t\treturn JSON.parse(await readFile(path, 'utf8'));\n\t} catch (error) {\n\t\tthrow new SstOutputsUnreadable(\n\t\t\tpath,\n\t\t\terror instanceof Error ? error.message : String(error),\n\t\t);\n\t}\n}\n\n/** Every http(s) URL in `outputs`, by its key path: `['Api', 'url']`. */\nfunction urlsIn(\n\tvalue: unknown,\n\tpath: string[] = [],\n\tfound: { path: string[]; url: string }[] = [],\n): { path: string[]; url: string }[] {\n\tif (typeof value === 'string') {\n\t\tif (isHttpUrl(value)) found.push({ path, url: value });\n\t} else if (value && typeof value === 'object' && !Array.isArray(value)) {\n\t\tfor (const [key, child] of Object.entries(value)) {\n\t\t\turlsIn(child, [...path, key], found);\n\t\t}\n\t}\n\treturn found;\n}\n\nfunction isHttpUrl(value: string): boolean {\n\ttry {\n\t\tconst { protocol } = new URL(value);\n\t\treturn protocol === 'http:' || protocol === 'https:';\n\t} catch {\n\t\treturn false;\n\t}\n}\n\n/**\n * The app an output's key path names, kebab-cased as app keys are: its last\n * segment, without a `url` suffix — or its parent's, when the last segment\n * is only `url`. Exact names are tried first, so an app called `api-url`\n * still finds `ApiUrl`.\n */\nfunction namesOf(path: string[]): string[] {\n\tconst names: string[] = [];\n\tfor (const segment of [...path].reverse()) {\n\t\tconst name = kebabCase(segment);\n\t\tnames.push(name);\n\t\tconst bare = name.replace(/-?url$/, '');\n\t\tif (bare) {\n\t\t\tnames.push(bare);\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn names;\n}\n\n/**\n * Each app's URL from the outputs, for the apps given. An app no output\n * names is left out.\n */\nexport function surfaceUrls(\n\toutputs: unknown,\n\tapps: readonly string[],\n): Record<string, string> {\n\tconst found = urlsIn(outputs);\n\tconst urls: Record<string, string> = {};\n\tfor (const app of apps) {\n\t\t// An exact name beats a stripped one, wherever each is in the file.\n\t\tconst exact = found.find(({ path }) => namesOf(path)[0] === app);\n\t\tconst loose = found.find(({ path }) => namesOf(path).includes(app));\n\t\tconst match = exact ?? loose;\n\t\tif (match) urls[app] = match.url;\n\t}\n\treturn urls;\n}\n","/**\n * The built-in `sst` target: `gkm build` writes the manifest, `sst deploy`\n * provisions it, and the surfaces SST reports are health-checked.\n *\n * `@geekmidas/cloud` is unchanged by it: `sst.config.ts` still reads\n * `.gkm/manifest/aws.ts` and `fromManifest` still makes every resource. What\n * the target adds is the run around the two commands — the lock, the events,\n * verification, and credentials kept where they belong.\n *\n * Both commands run in the sandbox: the build executes the project's code,\n * and so does `sst deploy`, which evaluates `sst.config.ts`. Only the second\n * needs AWS, so the AWS credential goes into that one command's environment\n * and nowhere else — not the build's, not the process the deploy runs in.\n * What `sst deploy` needs beyond them, the sandbox already passes: `PATH`\n * for node and the package manager, and `HOME`, under which SST keeps its\n * toolchain (`~/.config/sst`: bun, pulumi and its plugins) and the AWS SDK\n * finds `~/.aws` for a profile. Its state — the Pulumi backend and the\n * passphrase — is in the stage's own account, reached with that credential.\n */\n\nimport { existsSync } from 'node:fs';\nimport { join } from 'node:path';\nimport type { ConstructManifest } from '@geekmidas/manifest';\nimport { deployedInboxEnv } from '../../compose/stack';\nimport {\n\ttype AwsCredential,\n\tMissingCredential,\n} from '../../deploy/credentials';\nimport { hasNextSite, NEXT_DEPLOYMENT_ID_KEY } from '../../deploy/nextRelease';\nimport type { DeployResult } from '../../deploy/types';\nimport { GkmError } from '../../errors';\nimport { detectPackageManager, type PackageManager } from '../../init/utils';\nimport { CommandFailed } from '../../run';\nimport { LocalSandbox } from '../../sandbox/local';\nimport { activeSandbox, type Sandbox } from '../../sandbox/sandbox';\nimport { appKey } from '../../workspace/derive';\nimport { defineTarget } from '../define';\nimport type { DeployPhaseContext, DeployTarget } from '../types';\nimport { checkHealth, healthUrl, SurfacesUnhealthy } from './health';\nimport { clearOutputs, readOutputs, surfaceUrls } from './outputs';\n\nexport { SurfacesUnhealthy } from './health';\nexport { SST_OUTPUTS_FILE, SstOutputsUnreadable } from './outputs';\n\n/** A cold build of every handler and site. */\nconst BUILD_TIMEOUT_MS = 30 * 60_000;\n/**\n * A first deploy creates CloudFront distributions and, with a database, a\n * VPC and an RDS instance — each of which alone can take a quarter of an hour.\n */\nconst DEPLOY_TIMEOUT_MS = 90 * 60_000;\n\n/** The workspace has no `sst.config.ts` for `sst deploy` to run. */\nexport class SstConfigNotFound extends GkmError {\n\tconstructor(readonly cwd: string) {\n\t\tsuper(\n\t\t\t`No sst.config.ts in ${cwd}. The sst target runs \\`sst deploy\\` at the workspace root: scaffold one with \\`gkm init --deploy sst\\` and copy its sst.config.ts, or deploy through another target with --target.`,\n\t\t);\n\t\tthis.name = 'SstConfigNotFound';\n\t}\n}\n\n/** What the phases hand on. */\nexport interface SstRun {\n\tsandbox: Sandbox;\n\tpm: PackageManager;\n\taws: AwsCredential;\n\t/** The apps SST deploys this run: `ctx.apps` without the skipped. */\n\tapps: string[];\n\t/** Each app's URL, from the deploy's outputs. */\n\turls: Record<string, string>;\n}\n\nexport interface SstTargetOptions {\n\t/** How often, and how patiently, `verify` asks each surface. */\n\thealth?: { attempts?: number; delayMs?: number; timeoutMs?: number };\n}\n\n/**\n * The project's own copy of `bin`, through its package manager — never one\n * `npx` would download, which would be code nobody installed.\n */\nexport function projectCommand(\n\tpm: PackageManager,\n\tbin: string,\n\targs: readonly string[],\n): [command: string, args: string[]] {\n\tswitch (pm) {\n\t\tcase 'pnpm':\n\t\t\treturn ['pnpm', ['exec', bin, ...args]];\n\t\tcase 'yarn':\n\t\t\treturn ['yarn', [bin, ...args]];\n\t\tcase 'bun':\n\t\t\treturn ['bunx', [bin, ...args]];\n\t\tcase 'npm':\n\t\t\treturn ['npx', ['--no-install', bin, ...args]];\n\t}\n}\n\n/**\n * The variables `credential` is to the AWS SDK and to SST.\n *\n * A profile is passed alone: given keys too, every SDK would take the keys.\n */\nexport function awsEnv(credential: AwsCredential): Record<string, string> {\n\tconst region: Record<string, string> = credential.region\n\t\t? { AWS_REGION: credential.region, AWS_DEFAULT_REGION: credential.region }\n\t\t: {};\n\tif ('profile' in credential) {\n\t\treturn { AWS_PROFILE: credential.profile, ...region };\n\t}\n\treturn {\n\t\tAWS_ACCESS_KEY_ID: credential.accessKeyId,\n\t\tAWS_SECRET_ACCESS_KEY: credential.secretAccessKey,\n\t\t...(credential.sessionToken\n\t\t\t? { AWS_SESSION_TOKEN: credential.sessionToken }\n\t\t\t: {}),\n\t\t...region,\n\t};\n}\n\n/**\n * `env` without any `AWS_*`, so a host sandbox that passes some cannot put\n * a second account beside the one the credential names.\n */\nfunction withoutAws(\n\tenv: Readonly<Record<string, string>>,\n): Record<string, string> {\n\treturn Object.fromEntries(\n\t\tObject.entries(env).filter(([name]) => !name.startsWith('AWS_')),\n\t);\n}\n\n/** Each app's kind in the manifest, by app key: `rest-api` or `site`. */\nfunction kindsOf(manifest: ConstructManifest): Map<string, string> {\n\treturn new Map(\n\t\tObject.entries(manifest).map(([id, declaration]) => [\n\t\t\tappKey(id),\n\t\t\tdeclaration.kind,\n\t\t]),\n\t);\n}\n\nasync function exec(\n\tctx: DeployPhaseContext<unknown>,\n\trun: SstRun,\n\t[command, args]: [string, string[]],\n\toptions: { env: Record<string, string>; timeoutMs: number },\n): Promise<void> {\n\tconst result = await run.sandbox.exec(command, args, {\n\t\tcwd: ctx.cwd,\n\t\tenv: options.env,\n\t\ttimeoutMs: options.timeoutMs,\n\t\toutput: ctx.childOutput,\n\t\tsignal: ctx.signal,\n\t});\n\tif (result.exitCode !== 0) {\n\t\tthrow new CommandFailed(\n\t\t\tcommand,\n\t\t\targs,\n\t\t\tresult.exitCode,\n\t\t\tresult.signal as NodeJS.Signals | null,\n\t\t);\n\t}\n}\n\n/**\n * What SST reads for each inbox, by key: the stage's domain, and what the\n * inbox's provider made — its bucket's URL and its topic's string — from the\n * stage's secrets, read by the same rule as on compose. SST provisions none\n * of it; `fromManifest` references the topic and links the inbox's values.\n */\nexport async function inboxEnv(\n\tctx: DeployPhaseContext<unknown>,\n): Promise<Record<string, string>> {\n\tif (!Object.values(ctx.manifest).some((d) => d.kind === 'inbox')) return {};\n\tconst stored = await ctx.secrets.read();\n\tconst domain = ctx.workspace.domains?.[ctx.stage];\n\tconst env = deployedInboxEnv(ctx.manifest, {\n\t\treader: 'sst deploy',\n\t\tstage: ctx.stage,\n\t\tdomain,\n\t\tsecrets: stored?.custom ?? {},\n\t});\n\t// The URLs carry the provider's access key; the domain is public.\n\tfor (const value of Object.values(env)) {\n\t\tif (value !== domain) ctx.secrets.mask(value);\n\t}\n\treturn env;\n}\n\n/**\n * What `sst deploy` hands each Next site's build, which SST runs with its\n * own environment: the deploy's tag as `NEXT_DEPLOYMENT_ID`. A site on AWS is\n * Next's static export — no server, so no server actions and no key — whose\n * assets are tagged with the release it was built for. Nothing where the\n * stage has no Next site.\n */\nexport function nextReleaseEnv(\n\tctx: Pick<DeployPhaseContext<unknown>, 'manifest' | 'tag'>,\n): Record<string, string> {\n\treturn hasNextSite(ctx.manifest) ? { [NEXT_DEPLOYMENT_ID_KEY]: ctx.tag } : {};\n}\n\n/** The `sst` target, with its health checks tuned — for tests and hosts. */\nexport function createSstTarget(\n\toptions: SstTargetOptions = {},\n): DeployTarget<undefined, SstRun> {\n\tconst health = {\n\t\tattempts: options.health?.attempts ?? 6,\n\t\tdelayMs: options.health?.delayMs ?? 5_000,\n\t\ttimeoutMs: options.health?.timeoutMs ?? 10_000,\n\t};\n\n\treturn defineTarget<undefined, SstRun>({\n\t\tname: 'sst',\n\t\truntime: 'aws',\n\t\t// SST keeps no previous release to return to; migrations run in the\n\t\t// stack, as `fromManifest` provisions the database; and nothing here\n\t\t// builds an image.\n\t\tcapabilities: { rollback: false, migrations: 'target', images: false },\n\t\tcredentials: ['aws'],\n\n\t\tasync validate(ctx) {\n\t\t\tif (!existsSync(join(ctx.cwd, 'sst.config.ts'))) {\n\t\t\t\tthrow new SstConfigNotFound(ctx.cwd);\n\t\t\t}\n\n\t\t\tconst aws = await ctx.credentials.get(\n\t\t\t\t{ kind: 'aws', stage: ctx.stage },\n\t\t\t\t{ signal: ctx.signal },\n\t\t\t);\n\t\t\tif (!aws) throw new MissingCredential('aws', ctx.stage);\n\t\t\tif (!('profile' in aws)) {\n\t\t\t\tctx.secrets.mask(aws.secretAccessKey);\n\t\t\t\tif (aws.sessionToken) ctx.secrets.mask(aws.sessionToken);\n\t\t\t}\n\n\t\t\t// A mobile app ships through its own store's toolchain.\n\t\t\tfor (const app of ctx.apps) {\n\t\t\t\tif (ctx.workspace.apps[app]?.type === 'mobile') {\n\t\t\t\t\tctx.skip(app, 'mobile apps deploy through their own toolchain');\n\t\t\t\t}\n\t\t\t}\n\t\t\tconst skipped = new Set(ctx.skipped.map(({ app }) => app));\n\t\t\tconst apps = ctx.apps.filter((app) => !skipped.has(app));\n\n\t\t\tctx.logger.info(\n\t\t\t\t`\\n🚀 Deploying \"${ctx.workspace.name}\" to the \"${ctx.stage}\" stage with SST`,\n\t\t\t);\n\t\t\tctx.logger.info(\n\t\t\t\t` AWS: ${'profile' in aws ? `profile \"${aws.profile}\"` : 'access keys'}`,\n\t\t\t);\n\t\t\t// `sst deploy` takes the whole stack: there is no deploying one app.\n\t\t\tconst deployable = Object.values(ctx.workspace.apps).filter(\n\t\t\t\t(app) => app.type !== 'mobile',\n\t\t\t).length;\n\t\t\tif (apps.length < deployable) {\n\t\t\t\tctx.logger.warn(\n\t\t\t\t\t` sst deploy deploys every construct of the stage, not only ${apps.join(', ')}.`,\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tsandbox: activeSandbox() ?? new LocalSandbox({ root: ctx.cwd }),\n\t\t\t\tpm: detectPackageManager(ctx.cwd),\n\t\t\t\taws,\n\t\t\t\tapps,\n\t\t\t\turls: {},\n\t\t\t};\n\t\t},\n\n\t\tasync plan(ctx, run) {\n\t\t\tconst kinds = kindsOf(ctx.manifest);\n\t\t\tfor (const app of run.apps) {\n\t\t\t\tctx.emit({\n\t\t\t\t\ttype: 'resource.planned',\n\t\t\t\t\tkey: `application:${app}`,\n\t\t\t\t\tresourceType: kinds.get(app) ?? 'application',\n\t\t\t\t\taction: 'ensure',\n\t\t\t\t});\n\t\t\t}\n\t\t\tconst [build, buildArgs] = buildCommand(ctx, run);\n\t\t\tconst [deploy, deployArgs] = deployCommand(ctx, run);\n\t\t\tctx.logger.info(` Would run: ${[build, ...buildArgs].join(' ')}`);\n\t\t\tctx.logger.info(` Would run: ${[deploy, ...deployArgs].join(' ')}`);\n\t\t},\n\n\t\tasync build(ctx, run) {\n\t\t\tctx.logger.info('\\n📦 Building the manifest SST deploys');\n\t\t\t// No credential: the build runs the project's code and needs none.\n\t\t\tawait exec(ctx, run, buildCommand(ctx, run), {\n\t\t\t\tenv: { ...run.sandbox.env },\n\t\t\t\ttimeoutMs: BUILD_TIMEOUT_MS,\n\t\t\t});\n\t\t},\n\n\t\tasync release(ctx, run) {\n\t\t\tctx.logger.info(`\\n☁️ sst deploy --stage ${ctx.stage}`);\n\t\t\tawait clearOutputs(ctx.cwd);\n\t\t\tawait exec(ctx, run, deployCommand(ctx, run), {\n\t\t\t\tenv: {\n\t\t\t\t\t...withoutAws(run.sandbox.env),\n\t\t\t\t\t...(await inboxEnv(ctx)),\n\t\t\t\t\t...nextReleaseEnv(ctx),\n\t\t\t\t\t...awsEnv(run.aws),\n\t\t\t\t},\n\t\t\t\ttimeoutMs: DEPLOY_TIMEOUT_MS,\n\t\t\t});\n\n\t\t\trun.urls = surfaceUrls(await readOutputs(ctx.cwd), run.apps);\n\t\t\tfor (const app of run.apps) {\n\t\t\t\tctx.emit({\n\t\t\t\t\ttype: 'app.deployed',\n\t\t\t\t\tapp,\n\t\t\t\t\tapplicationId: ctx.name(app),\n\t\t\t\t\t// SST builds no image a registry holds.\n\t\t\t\t\timageRef: '',\n\t\t\t\t\turl: run.urls[app] ?? '',\n\t\t\t\t});\n\t\t\t}\n\t\t},\n\n\t\tasync verify(ctx, run) {\n\t\t\tconst unhealthy: SurfacesUnhealthy['surfaces'][number][] = [];\n\t\t\tconst kinds = kindsOf(ctx.manifest);\n\n\t\t\tfor (const app of run.apps) {\n\t\t\t\tconst path = healthPath(kinds.get(app), ctx.workspace.apps[app]?.type);\n\t\t\t\tif (!path) {\n\t\t\t\t\tctx.logger.info(\n\t\t\t\t\t\t` ${app}: API Gateway holds its sockets and has no HTTP path to ask, so it was not checked.`,\n\t\t\t\t\t);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tconst base = run.urls[app];\n\t\t\t\tif (!base) {\n\t\t\t\t\tctx.logger.warn(\n\t\t\t\t\t\t` ⚠ No URL for ${app} in SST's outputs, so it was not checked. Return it from run() in sst.config.ts — { ${app}: <its url> } — to have it checked.`,\n\t\t\t\t\t);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tconst url = healthUrl(base, path);\n\t\t\t\tconst answer = await checkHealth(app, url, {\n\t\t\t\t\t...health,\n\t\t\t\t\tsignal: ctx.signal,\n\t\t\t\t\temit: ctx.emit,\n\t\t\t\t});\n\t\t\t\tif (answer.healthy) {\n\t\t\t\t\tctx.logger.info(` ✓ ${app}: ${url}`);\n\t\t\t\t} else {\n\t\t\t\t\tunhealthy.push({\n\t\t\t\t\t\tapp,\n\t\t\t\t\t\turl,\n\t\t\t\t\t\t...(answer.status !== undefined ? { status: answer.status } : {}),\n\t\t\t\t\t\t...(answer.error ? { error: answer.error } : {}),\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (unhealthy.length > 0) {\n\t\t\t\tthrow new SurfacesUnhealthy(ctx.stage, unhealthy);\n\t\t\t}\n\t\t},\n\n\t\tresult(ctx, run): DeployResult {\n\t\t\treturn {\n\t\t\t\tapps: run.apps.map((appName) => ({\n\t\t\t\t\tappName,\n\t\t\t\t\ttype: ctx.workspace.apps[appName]?.type ?? 'backend',\n\t\t\t\t\tsuccess: true,\n\t\t\t\t\t...(run.urls[appName] ? { url: run.urls[appName] } : {}),\n\t\t\t\t})),\n\t\t\t\tprojectId: '',\n\t\t\t\tenvironmentId: '',\n\t\t\t\tsuccessCount: ctx.dryRun ? 0 : run.apps.length,\n\t\t\t\tfailedCount: 0,\n\t\t\t\tstage: ctx.stage,\n\t\t\t\tidentity: ctx.identity.key,\n\t\t\t\ttag: ctx.tag,\n\t\t\t\tdryRun: ctx.dryRun,\n\t\t\t\tskipped: [...ctx.skipped],\n\t\t\t\turls: { ...run.urls },\n\t\t\t\tchanges: [],\n\t\t\t};\n\t\t},\n\t});\n}\n\nfunction buildCommand(\n\tctx: DeployPhaseContext<unknown>,\n\trun: SstRun,\n): [string, string[]] {\n\treturn projectCommand(run.pm, 'gkm', [\n\t\t'build',\n\t\t'--provider',\n\t\t'aws',\n\t\t'--stage',\n\t\tctx.stage,\n\t]);\n}\n\nfunction deployCommand(\n\tctx: DeployPhaseContext<unknown>,\n\trun: SstRun,\n): [string, string[]] {\n\treturn projectCommand(run.pm, 'sst', ['deploy', '--stage', ctx.stage]);\n}\n\n/**\n * The path a released app is asked on: a backend's `/health`, a site's `/`.\n * A WebSocket surface has none on AWS — API Gateway answers its handshake,\n * and its routes are Lambdas behind it — so it is not asked.\n */\nexport function healthPath(\n\tkind: string | undefined,\n\tappType: string | undefined,\n): string | undefined {\n\tif (kind === 'websocket-api') return undefined;\n\t// A surface — a `rest-api` — is the backend app it derives.\n\treturn appType === 'backend' ? '/health' : '/';\n}\n\nexport const sstTarget = createSstTarget();\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAyBA,IAAa,oBAAb,cAAuCA,eAAAA,SAAS;CAErC;CAEA;CAHV,YACC,OAEA,UAMC;EACD,MAAM,QAAQ,SAAS,KACrB,EAAE,KAAK,KAAK,QAAQ,YACpB,OAAO,IAAI,IAAI,IAAI,KAAK,UAAU,SAAS,aAC7C;EACA,MACC,QAAQ,MAAM,4BAA4B,SAAS,WAAW,IAAI,mBAAmB,cAAc,wBAAwB,MAAM,KAAK,IAAI,EAAE,0DAC7I;EAfS,KAAA,QAAA;EAEA,KAAA,WAAA;EAcT,KAAK,OAAO;CACb;AACD;;AAGA,SAAgB,UAAU,MAAc,MAAsB;CAC7D,MAAM,OAAO,KAAK,SAAS,GAAG,IAAI,OAAO,GAAG,KAAK;CACjD,OAAO,IAAI,IAAI,KAAK,QAAQ,OAAO,EAAE,GAAG,IAAI,CAAC,CAAC,SAAS;AACxD;;;;;AAMA,eAAsB,YACrB,KACA,KACA,SACiE;CACjE,IAAI,OAA8D,EACjE,SAAS,MACV;CACA,KAAK,IAAI,UAAU,GAAG,WAAW,QAAQ,UAAU,WAAW;EAC7D,QAAQ,OAAO,eAAe;EAC9B,IAAI;GACH,MAAM,WAAW,MAAM,MAAM,KAAK;IACjC,UAAU;IACV,QAAQ,YAAY,IAAI,CACvB,QAAQ,QACR,YAAY,QAAQ,QAAQ,SA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MAAM,IAAI,KAAK,KAAK,aAAa;KAChC;KACA,MAAM,IAAI,UAAU,KAAK,QAAQ,EAAE,QAAQ;KAC3C,SAAS;KACT,GAAI,IAAI,KAAK,WAAW,EAAE,KAAK,IAAI,KAAK,SAAS,IAAI,CAAC;IACvD,EAAE;IACF,WAAW;IACX,eAAe;IACf,cAAc,IAAI,SAAS,IAAI,IAAI,KAAK;IACxC,aAAa;IACb,OAAO,IAAI;IACX,UAAU,IAAI,SAAS;IACvB,KAAK,IAAI;IACT,QAAQ,IAAI;IACZ,SAAS,CAAC,GAAG,IAAI,OAAO;IACxB,MAAM,EAAE,GAAG,IAAI,KAAK;IACpB,SAAS,CAAC;GACX;EACD;CACD,CAAC;AACF;AAEA,SAAS,aACR,KACA,KACqB;CACrB,OAAO,eAAe,IAAI,IAAI,OAAO;EACpC;EACA;EACA;EACA;EACA,IAAI;CACL,CAAC;AACF;AAEA,SAAS,cACR,KACA,KACqB;CACrB,OAAO,eAAe,IAAI,IAAI,OAAO;EAAC;EAAU;EAAW,IAAI;CAAK,CAAC;AACtE;;;;;;AAOA,SAAgB,WACf,MACA,SACqB;CACrB,IAAI,SAAS,iBAAiB,OAAO,KAAA;CAErC,OAAO,YAAY,YAAY,YAAY;AAC5C;AAEA,MAAa,YAAY,gBAAgB"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-BhDjJH2R.mjs";
|
|
2
2
|
import { t as GkmError } from "./errors-C9uIyIDt.mjs";
|
|
3
|
-
import { t as MissingCredential } from "./credentials-
|
|
4
|
-
import { Yn as CommandFailed, a as deployedInboxEnv } from "./stack-
|
|
5
|
-
import { ot as appKey } from "./workspace-
|
|
3
|
+
import { t as MissingCredential } from "./credentials-CRgp0huX.mjs";
|
|
4
|
+
import { Yn as CommandFailed, a as deployedInboxEnv } from "./stack-B5-pHmtX.mjs";
|
|
5
|
+
import { ot as appKey } from "./workspace-BSGUH2DO.mjs";
|
|
6
6
|
import { t as defineTarget } from "./define-BfrNaY82.mjs";
|
|
7
|
-
import { v as NEXT_DEPLOYMENT_ID_KEY, y as hasNextSite } from "./credentials-
|
|
7
|
+
import { v as NEXT_DEPLOYMENT_ID_KEY, y as hasNextSite } from "./credentials-0Kmo6GAw.mjs";
|
|
8
8
|
import { m as activeSandbox } from "./discover-Dfmn6HQ7.mjs";
|
|
9
|
-
import { t as LocalSandbox } from "./local-
|
|
9
|
+
import { t as LocalSandbox } from "./local-ZaXGH2eP.mjs";
|
|
10
10
|
import { n as detectPackageManager } from "./utils-CdKxD8Lt.mjs";
|
|
11
11
|
import { join } from "node:path";
|
|
12
12
|
import { existsSync } from "node:fs";
|
|
@@ -488,4 +488,4 @@ const sstTarget = createSstTarget();
|
|
|
488
488
|
//#endregion
|
|
489
489
|
export { SurfacesUnhealthy as i, sst_exports as n, SstOutputsUnreadable as r, SstConfigNotFound as t };
|
|
490
490
|
|
|
491
|
-
//# sourceMappingURL=sst-
|
|
491
|
+
//# sourceMappingURL=sst-w90IUOX_.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sst-DD9MlGXY.mjs","names":[],"sources":["../src/target/sst/health.ts","../src/target/sst/outputs.ts","../src/target/sst/index.ts"],"sourcesContent":["/**\n * Whether a released surface answers.\n *\n * The paths are the ones the local stack's healthchecks use\n * (`reconcile/apps.ts`): an API's `/health`, a site's `/`. A surface is\n * asked a few times, because a fresh deploy can take a moment to answer — a\n * Lambda's first start, a distribution still settling — and healthy means a\n * 2xx, after redirects.\n */\n\nimport { GkmError } from '../../errors';\nimport type { TargetEvent } from '../types';\n\nexport interface HealthCheckOptions {\n\t/** How many times a surface is asked before it counts as down. */\n\tattempts: number;\n\t/** The wait between two attempts. */\n\tdelayMs: number;\n\t/** How long one request may take. */\n\ttimeoutMs: number;\n\tsignal: AbortSignal;\n\temit: (event: TargetEvent) => void;\n}\n\n/** Surfaces that never answered healthy. */\nexport class SurfacesUnhealthy extends GkmError {\n\tconstructor(\n\t\treadonly stage: string,\n\t\t/** Each surface that failed, with the last thing it answered. */\n\t\treadonly surfaces: readonly {\n\t\t\tapp: string;\n\t\t\turl: string;\n\t\t\tstatus?: number;\n\t\t\terror?: string;\n\t\t}[],\n\t) {\n\t\tconst lines = surfaces.map(\n\t\t\t({ app, url, status, error }) =>\n\t\t\t\t` - ${app}: ${url} → ${status ?? error ?? 'no answer'}`,\n\t\t);\n\t\tsuper(\n\t\t\t`The \"${stage}\" stage was deployed, but ${surfaces.length === 1 ? 'a surface does' : 'surfaces do'} not answer healthy:\\n${lines.join('\\n')}\\nCheck its logs in CloudWatch, fix it, and deploy again.`,\n\t\t);\n\t\tthis.name = 'SurfacesUnhealthy';\n\t}\n}\n\n/** `path` under `base`, keeping any path `base` already has. */\nexport function healthUrl(base: string, path: string): string {\n\tconst root = base.endsWith('/') ? base : `${base}/`;\n\treturn new URL(path.replace(/^\\//, ''), root).toString();\n}\n\n/**\n * Ask `url` until it answers 2xx or the attempts run out, emitting\n * `health.checked` for each. Resolves with the last answer.\n */\nexport async function checkHealth(\n\tapp: string,\n\turl: string,\n\toptions: HealthCheckOptions,\n): Promise<{ healthy: boolean; status?: number; error?: string }> {\n\tlet last: { healthy: boolean; status?: number; error?: string } = {\n\t\thealthy: false,\n\t};\n\tfor (let attempt = 1; attempt <= options.attempts; attempt++) {\n\t\toptions.signal.throwIfAborted();\n\t\ttry {\n\t\t\tconst response = await fetch(url, {\n\t\t\t\tredirect: 'follow',\n\t\t\t\tsignal: AbortSignal.any([\n\t\t\t\t\toptions.signal,\n\t\t\t\t\tAbortSignal.timeout(options.timeoutMs),\n\t\t\t\t]),\n\t\t\t});\n\t\t\t// Drained, so the connection is not held open by an unread body.\n\t\t\tawait response.arrayBuffer().catch(() => undefined);\n\t\t\tlast = { healthy: response.ok, status: response.status };\n\t\t} catch (error) {\n\t\t\t// The run being stopped is not the surface being down.\n\t\t\toptions.signal.throwIfAborted();\n\t\t\tlast = {\n\t\t\t\thealthy: false,\n\t\t\t\terror: error instanceof Error ? error.message : String(error),\n\t\t\t};\n\t\t}\n\t\toptions.emit({\n\t\t\ttype: 'health.checked',\n\t\t\tapp,\n\t\t\turl,\n\t\t\thealthy: last.healthy,\n\t\t\t...(last.status !== undefined ? { status: last.status } : {}),\n\t\t\tattempt,\n\t\t});\n\t\tif (last.healthy) return last;\n\t\tif (attempt < options.attempts) await wait(options.delayMs, options.signal);\n\t}\n\treturn last;\n}\n\nfunction wait(ms: number, signal: AbortSignal): Promise<void> {\n\tif (ms <= 0) return Promise.resolve();\n\treturn new Promise((resolve, reject) => {\n\t\tconst timer = setTimeout(() => {\n\t\t\tsignal.removeEventListener('abort', stop);\n\t\t\tresolve();\n\t\t}, ms);\n\t\tconst stop = () => {\n\t\t\tclearTimeout(timer);\n\t\t\treject(signal.reason);\n\t\t};\n\t\tsignal.addEventListener('abort', stop, { once: true });\n\t});\n}\n","/**\n * The surface URLs an `sst deploy` reports.\n *\n * SST writes whatever `run()` in `sst.config.ts` returns to\n * `.sst/outputs.json` after every successful deploy — `{\"Api\": \"https://…\"}`.\n * What `run()` returns is the project's to write, so this reads it leniently:\n * nested objects are walked, anything that is not an http(s) URL is ignored,\n * and an output names a surface by its id in any casing, with or without a\n * `Url` suffix (`Api`, `api`, `ApiUrl`, `API_URL`, `Api.url`).\n */\n\nimport { existsSync } from 'node:fs';\nimport { readFile, rm } from 'node:fs/promises';\nimport { join } from 'node:path';\nimport { kebabCase } from '@geekmidas/manifest';\nimport { GkmError } from '../../errors';\n\n/** Where SST leaves the last successful deploy's outputs, under the project. */\nexport const SST_OUTPUTS_FILE = join('.sst', 'outputs.json');\n\n/** `.sst/outputs.json` is there, and is not JSON. */\nexport class SstOutputsUnreadable extends GkmError {\n\tconstructor(\n\t\treadonly path: string,\n\t\treadonly reason: string,\n\t) {\n\t\tsuper(\n\t\t\t`Could not read SST's outputs at ${path}: ${reason}. It is rewritten by every successful \\`sst deploy\\`; delete it and deploy again.`,\n\t\t);\n\t\tthis.name = 'SstOutputsUnreadable';\n\t}\n}\n\n/**\n * Remove what an earlier deploy wrote, so the outputs read after this one\n * are this one's — not another stage's, deployed from the same checkout.\n */\nexport async function clearOutputs(cwd: string): Promise<void> {\n\tawait rm(join(cwd, SST_OUTPUTS_FILE), { force: true });\n}\n\n/** The deploy's outputs, or `{}` when it wrote none. */\nexport async function readOutputs(cwd: string): Promise<unknown> {\n\tconst path = join(cwd, SST_OUTPUTS_FILE);\n\tif (!existsSync(path)) return {};\n\ttry {\n\t\treturn JSON.parse(await readFile(path, 'utf8'));\n\t} catch (error) {\n\t\tthrow new SstOutputsUnreadable(\n\t\t\tpath,\n\t\t\terror instanceof Error ? error.message : String(error),\n\t\t);\n\t}\n}\n\n/** Every http(s) URL in `outputs`, by its key path: `['Api', 'url']`. */\nfunction urlsIn(\n\tvalue: unknown,\n\tpath: string[] = [],\n\tfound: { path: string[]; url: string }[] = [],\n): { path: string[]; url: string }[] {\n\tif (typeof value === 'string') {\n\t\tif (isHttpUrl(value)) found.push({ path, url: value });\n\t} else if (value && typeof value === 'object' && !Array.isArray(value)) {\n\t\tfor (const [key, child] of Object.entries(value)) {\n\t\t\turlsIn(child, [...path, key], found);\n\t\t}\n\t}\n\treturn found;\n}\n\nfunction isHttpUrl(value: string): boolean {\n\ttry {\n\t\tconst { protocol } = new URL(value);\n\t\treturn protocol === 'http:' || protocol === 'https:';\n\t} catch {\n\t\treturn false;\n\t}\n}\n\n/**\n * The app an output's key path names, kebab-cased as app keys are: its last\n * segment, without a `url` suffix — or its parent's, when the last segment\n * is only `url`. Exact names are tried first, so an app called `api-url`\n * still finds `ApiUrl`.\n */\nfunction namesOf(path: string[]): string[] {\n\tconst names: string[] = [];\n\tfor (const segment of [...path].reverse()) {\n\t\tconst name = kebabCase(segment);\n\t\tnames.push(name);\n\t\tconst bare = name.replace(/-?url$/, '');\n\t\tif (bare) {\n\t\t\tnames.push(bare);\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn names;\n}\n\n/**\n * Each app's URL from the outputs, for the apps given. An app no output\n * names is left out.\n */\nexport function surfaceUrls(\n\toutputs: unknown,\n\tapps: readonly string[],\n): Record<string, string> {\n\tconst found = urlsIn(outputs);\n\tconst urls: Record<string, string> = {};\n\tfor (const app of apps) {\n\t\t// An exact name beats a stripped one, wherever each is in the file.\n\t\tconst exact = found.find(({ path }) => namesOf(path)[0] === app);\n\t\tconst loose = found.find(({ path }) => namesOf(path).includes(app));\n\t\tconst match = exact ?? loose;\n\t\tif (match) urls[app] = match.url;\n\t}\n\treturn urls;\n}\n","/**\n * The built-in `sst` target: `gkm build` writes the manifest, `sst deploy`\n * provisions it, and the surfaces SST reports are health-checked.\n *\n * `@geekmidas/cloud` is unchanged by it: `sst.config.ts` still reads\n * `.gkm/manifest/aws.ts` and `fromManifest` still makes every resource. What\n * the target adds is the run around the two commands — the lock, the events,\n * verification, and credentials kept where they belong.\n *\n * Both commands run in the sandbox: the build executes the project's code,\n * and so does `sst deploy`, which evaluates `sst.config.ts`. Only the second\n * needs AWS, so the AWS credential goes into that one command's environment\n * and nowhere else — not the build's, not the process the deploy runs in.\n * What `sst deploy` needs beyond them, the sandbox already passes: `PATH`\n * for node and the package manager, and `HOME`, under which SST keeps its\n * toolchain (`~/.config/sst`: bun, pulumi and its plugins) and the AWS SDK\n * finds `~/.aws` for a profile. Its state — the Pulumi backend and the\n * passphrase — is in the stage's own account, reached with that credential.\n */\n\nimport { existsSync } from 'node:fs';\nimport { join } from 'node:path';\nimport type { ConstructManifest } from '@geekmidas/manifest';\nimport { deployedInboxEnv } from '../../compose/stack';\nimport {\n\ttype AwsCredential,\n\tMissingCredential,\n} from '../../deploy/credentials';\nimport { hasNextSite, NEXT_DEPLOYMENT_ID_KEY } from '../../deploy/nextRelease';\nimport type { DeployResult } from '../../deploy/types';\nimport { GkmError } from '../../errors';\nimport { detectPackageManager, type PackageManager } from '../../init/utils';\nimport { CommandFailed } from '../../run';\nimport { LocalSandbox } from '../../sandbox/local';\nimport { activeSandbox, type Sandbox } from '../../sandbox/sandbox';\nimport { appKey } from '../../workspace/derive';\nimport { defineTarget } from '../define';\nimport type { DeployPhaseContext, DeployTarget } from '../types';\nimport { checkHealth, healthUrl, SurfacesUnhealthy } from './health';\nimport { clearOutputs, readOutputs, surfaceUrls } from './outputs';\n\nexport { SurfacesUnhealthy } from './health';\nexport { SST_OUTPUTS_FILE, SstOutputsUnreadable } from './outputs';\n\n/** A cold build of every handler and site. */\nconst BUILD_TIMEOUT_MS = 30 * 60_000;\n/**\n * A first deploy creates CloudFront distributions and, with a database, a\n * VPC and an RDS instance — each of which alone can take a quarter of an hour.\n */\nconst DEPLOY_TIMEOUT_MS = 90 * 60_000;\n\n/** The workspace has no `sst.config.ts` for `sst deploy` to run. */\nexport class SstConfigNotFound extends GkmError {\n\tconstructor(readonly cwd: string) {\n\t\tsuper(\n\t\t\t`No sst.config.ts in ${cwd}. The sst target runs \\`sst deploy\\` at the workspace root: scaffold one with \\`gkm init --deploy sst\\` and copy its sst.config.ts, or deploy through another target with --target.`,\n\t\t);\n\t\tthis.name = 'SstConfigNotFound';\n\t}\n}\n\n/** What the phases hand on. */\nexport interface SstRun {\n\tsandbox: Sandbox;\n\tpm: PackageManager;\n\taws: AwsCredential;\n\t/** The apps SST deploys this run: `ctx.apps` without the skipped. */\n\tapps: string[];\n\t/** Each app's URL, from the deploy's outputs. */\n\turls: Record<string, string>;\n}\n\nexport interface SstTargetOptions {\n\t/** How often, and how patiently, `verify` asks each surface. */\n\thealth?: { attempts?: number; delayMs?: number; timeoutMs?: number };\n}\n\n/**\n * The project's own copy of `bin`, through its package manager — never one\n * `npx` would download, which would be code nobody installed.\n */\nexport function projectCommand(\n\tpm: PackageManager,\n\tbin: string,\n\targs: readonly string[],\n): [command: string, args: string[]] {\n\tswitch (pm) {\n\t\tcase 'pnpm':\n\t\t\treturn ['pnpm', ['exec', bin, ...args]];\n\t\tcase 'yarn':\n\t\t\treturn ['yarn', [bin, ...args]];\n\t\tcase 'bun':\n\t\t\treturn ['bunx', [bin, ...args]];\n\t\tcase 'npm':\n\t\t\treturn ['npx', ['--no-install', bin, ...args]];\n\t}\n}\n\n/**\n * The variables `credential` is to the AWS SDK and to SST.\n *\n * A profile is passed alone: given keys too, every SDK would take the keys.\n */\nexport function awsEnv(credential: AwsCredential): Record<string, string> {\n\tconst region: Record<string, string> = credential.region\n\t\t? { AWS_REGION: credential.region, AWS_DEFAULT_REGION: credential.region }\n\t\t: {};\n\tif ('profile' in credential) {\n\t\treturn { AWS_PROFILE: credential.profile, ...region };\n\t}\n\treturn {\n\t\tAWS_ACCESS_KEY_ID: credential.accessKeyId,\n\t\tAWS_SECRET_ACCESS_KEY: credential.secretAccessKey,\n\t\t...(credential.sessionToken\n\t\t\t? { AWS_SESSION_TOKEN: credential.sessionToken }\n\t\t\t: {}),\n\t\t...region,\n\t};\n}\n\n/**\n * `env` without any `AWS_*`, so a host sandbox that passes some cannot put\n * a second account beside the one the credential names.\n */\nfunction withoutAws(\n\tenv: Readonly<Record<string, string>>,\n): Record<string, string> {\n\treturn Object.fromEntries(\n\t\tObject.entries(env).filter(([name]) => !name.startsWith('AWS_')),\n\t);\n}\n\n/** Each app's kind in the manifest, by app key: `rest-api` or `site`. */\nfunction kindsOf(manifest: ConstructManifest): Map<string, string> {\n\treturn new Map(\n\t\tObject.entries(manifest).map(([id, declaration]) => [\n\t\t\tappKey(id),\n\t\t\tdeclaration.kind,\n\t\t]),\n\t);\n}\n\nasync function exec(\n\tctx: DeployPhaseContext<unknown>,\n\trun: SstRun,\n\t[command, args]: [string, string[]],\n\toptions: { env: Record<string, string>; timeoutMs: number },\n): Promise<void> {\n\tconst result = await run.sandbox.exec(command, args, {\n\t\tcwd: ctx.cwd,\n\t\tenv: options.env,\n\t\ttimeoutMs: options.timeoutMs,\n\t\toutput: ctx.childOutput,\n\t\tsignal: ctx.signal,\n\t});\n\tif (result.exitCode !== 0) {\n\t\tthrow new CommandFailed(\n\t\t\tcommand,\n\t\t\targs,\n\t\t\tresult.exitCode,\n\t\t\tresult.signal as NodeJS.Signals | null,\n\t\t);\n\t}\n}\n\n/**\n * What SST reads for each inbox, by key: the stage's domain, and what the\n * inbox's provider made — its bucket's URL and its topic's string — from the\n * stage's secrets, read by the same rule as on compose. SST provisions none\n * of it; `fromManifest` references the topic and links the inbox's values.\n */\nexport async function inboxEnv(\n\tctx: DeployPhaseContext<unknown>,\n): Promise<Record<string, string>> {\n\tif (!Object.values(ctx.manifest).some((d) => d.kind === 'inbox')) return {};\n\tconst stored = await ctx.secrets.read();\n\tconst domain = ctx.workspace.domains?.[ctx.stage];\n\tconst env = deployedInboxEnv(ctx.manifest, {\n\t\treader: 'sst deploy',\n\t\tstage: ctx.stage,\n\t\tdomain,\n\t\tsecrets: stored?.custom ?? {},\n\t});\n\t// The URLs carry the provider's access key; the domain is public.\n\tfor (const value of Object.values(env)) {\n\t\tif (value !== domain) ctx.secrets.mask(value);\n\t}\n\treturn env;\n}\n\n/**\n * What `sst deploy` hands each Next site's build, which SST runs with its\n * own environment: the deploy's tag as `NEXT_DEPLOYMENT_ID`. A site on AWS is\n * Next's static export — no server, so no server actions and no key — whose\n * assets are tagged with the release it was built for. Nothing where the\n * stage has no Next site.\n */\nexport function nextReleaseEnv(\n\tctx: Pick<DeployPhaseContext<unknown>, 'manifest' | 'tag'>,\n): Record<string, string> {\n\treturn hasNextSite(ctx.manifest) ? { [NEXT_DEPLOYMENT_ID_KEY]: ctx.tag } : {};\n}\n\n/** The `sst` target, with its health checks tuned — for tests and hosts. */\nexport function createSstTarget(\n\toptions: SstTargetOptions = {},\n): DeployTarget<undefined, SstRun> {\n\tconst health = {\n\t\tattempts: options.health?.attempts ?? 6,\n\t\tdelayMs: options.health?.delayMs ?? 5_000,\n\t\ttimeoutMs: options.health?.timeoutMs ?? 10_000,\n\t};\n\n\treturn defineTarget<undefined, SstRun>({\n\t\tname: 'sst',\n\t\truntime: 'aws',\n\t\t// SST keeps no previous release to return to; migrations run in the\n\t\t// stack, as `fromManifest` provisions the database; and nothing here\n\t\t// builds an image.\n\t\tcapabilities: { rollback: false, migrations: 'target', images: false },\n\t\tcredentials: ['aws'],\n\n\t\tasync validate(ctx) {\n\t\t\tif (!existsSync(join(ctx.cwd, 'sst.config.ts'))) {\n\t\t\t\tthrow new SstConfigNotFound(ctx.cwd);\n\t\t\t}\n\n\t\t\tconst aws = await ctx.credentials.get(\n\t\t\t\t{ kind: 'aws', stage: ctx.stage },\n\t\t\t\t{ signal: ctx.signal },\n\t\t\t);\n\t\t\tif (!aws) throw new MissingCredential('aws', ctx.stage);\n\t\t\tif (!('profile' in aws)) {\n\t\t\t\tctx.secrets.mask(aws.secretAccessKey);\n\t\t\t\tif (aws.sessionToken) ctx.secrets.mask(aws.sessionToken);\n\t\t\t}\n\n\t\t\t// A mobile app ships through its own store's toolchain.\n\t\t\tfor (const app of ctx.apps) {\n\t\t\t\tif (ctx.workspace.apps[app]?.type === 'mobile') {\n\t\t\t\t\tctx.skip(app, 'mobile apps deploy through their own toolchain');\n\t\t\t\t}\n\t\t\t}\n\t\t\tconst skipped = new Set(ctx.skipped.map(({ app }) => app));\n\t\t\tconst apps = ctx.apps.filter((app) => !skipped.has(app));\n\n\t\t\tctx.logger.info(\n\t\t\t\t`\\n🚀 Deploying \"${ctx.workspace.name}\" to the \"${ctx.stage}\" stage with SST`,\n\t\t\t);\n\t\t\tctx.logger.info(\n\t\t\t\t` AWS: ${'profile' in aws ? `profile \"${aws.profile}\"` : 'access keys'}`,\n\t\t\t);\n\t\t\t// `sst deploy` takes the whole stack: there is no deploying one app.\n\t\t\tconst deployable = Object.values(ctx.workspace.apps).filter(\n\t\t\t\t(app) => app.type !== 'mobile',\n\t\t\t).length;\n\t\t\tif (apps.length < deployable) {\n\t\t\t\tctx.logger.warn(\n\t\t\t\t\t` sst deploy deploys every construct of the stage, not only ${apps.join(', ')}.`,\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tsandbox: activeSandbox() ?? new LocalSandbox({ root: ctx.cwd }),\n\t\t\t\tpm: detectPackageManager(ctx.cwd),\n\t\t\t\taws,\n\t\t\t\tapps,\n\t\t\t\turls: {},\n\t\t\t};\n\t\t},\n\n\t\tasync plan(ctx, run) {\n\t\t\tconst kinds = kindsOf(ctx.manifest);\n\t\t\tfor (const app of run.apps) {\n\t\t\t\tctx.emit({\n\t\t\t\t\ttype: 'resource.planned',\n\t\t\t\t\tkey: `application:${app}`,\n\t\t\t\t\tresourceType: kinds.get(app) ?? 'application',\n\t\t\t\t\taction: 'ensure',\n\t\t\t\t});\n\t\t\t}\n\t\t\tconst [build, buildArgs] = buildCommand(ctx, run);\n\t\t\tconst [deploy, deployArgs] = deployCommand(ctx, run);\n\t\t\tctx.logger.info(` Would run: ${[build, ...buildArgs].join(' ')}`);\n\t\t\tctx.logger.info(` Would run: ${[deploy, ...deployArgs].join(' ')}`);\n\t\t},\n\n\t\tasync build(ctx, run) {\n\t\t\tctx.logger.info('\\n📦 Building the manifest SST deploys');\n\t\t\t// No credential: the build runs the project's code and needs none.\n\t\t\tawait exec(ctx, run, buildCommand(ctx, run), {\n\t\t\t\tenv: { ...run.sandbox.env },\n\t\t\t\ttimeoutMs: BUILD_TIMEOUT_MS,\n\t\t\t});\n\t\t},\n\n\t\tasync release(ctx, run) {\n\t\t\tctx.logger.info(`\\n☁️ sst deploy --stage ${ctx.stage}`);\n\t\t\tawait clearOutputs(ctx.cwd);\n\t\t\tawait exec(ctx, run, deployCommand(ctx, run), {\n\t\t\t\tenv: {\n\t\t\t\t\t...withoutAws(run.sandbox.env),\n\t\t\t\t\t...(await inboxEnv(ctx)),\n\t\t\t\t\t...nextReleaseEnv(ctx),\n\t\t\t\t\t...awsEnv(run.aws),\n\t\t\t\t},\n\t\t\t\ttimeoutMs: DEPLOY_TIMEOUT_MS,\n\t\t\t});\n\n\t\t\trun.urls = surfaceUrls(await readOutputs(ctx.cwd), run.apps);\n\t\t\tfor (const app of run.apps) {\n\t\t\t\tctx.emit({\n\t\t\t\t\ttype: 'app.deployed',\n\t\t\t\t\tapp,\n\t\t\t\t\tapplicationId: ctx.name(app),\n\t\t\t\t\t// SST builds no image a registry holds.\n\t\t\t\t\timageRef: '',\n\t\t\t\t\turl: run.urls[app] ?? '',\n\t\t\t\t});\n\t\t\t}\n\t\t},\n\n\t\tasync verify(ctx, run) {\n\t\t\tconst unhealthy: SurfacesUnhealthy['surfaces'][number][] = [];\n\t\t\tconst kinds = kindsOf(ctx.manifest);\n\n\t\t\tfor (const app of run.apps) {\n\t\t\t\tconst path = healthPath(kinds.get(app), ctx.workspace.apps[app]?.type);\n\t\t\t\tif (!path) {\n\t\t\t\t\tctx.logger.info(\n\t\t\t\t\t\t` ${app}: API Gateway holds its sockets and has no HTTP path to ask, so it was not checked.`,\n\t\t\t\t\t);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tconst base = run.urls[app];\n\t\t\t\tif (!base) {\n\t\t\t\t\tctx.logger.warn(\n\t\t\t\t\t\t` ⚠ No URL for ${app} in SST's outputs, so it was not checked. Return it from run() in sst.config.ts — { ${app}: <its url> } — to have it checked.`,\n\t\t\t\t\t);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tconst url = healthUrl(base, path);\n\t\t\t\tconst answer = await checkHealth(app, url, {\n\t\t\t\t\t...health,\n\t\t\t\t\tsignal: ctx.signal,\n\t\t\t\t\temit: ctx.emit,\n\t\t\t\t});\n\t\t\t\tif (answer.healthy) {\n\t\t\t\t\tctx.logger.info(` ✓ ${app}: ${url}`);\n\t\t\t\t} else {\n\t\t\t\t\tunhealthy.push({\n\t\t\t\t\t\tapp,\n\t\t\t\t\t\turl,\n\t\t\t\t\t\t...(answer.status !== undefined ? { status: answer.status } : {}),\n\t\t\t\t\t\t...(answer.error ? { error: answer.error } : {}),\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (unhealthy.length > 0) {\n\t\t\t\tthrow new SurfacesUnhealthy(ctx.stage, unhealthy);\n\t\t\t}\n\t\t},\n\n\t\tresult(ctx, run): DeployResult {\n\t\t\treturn {\n\t\t\t\tapps: run.apps.map((appName) => ({\n\t\t\t\t\tappName,\n\t\t\t\t\ttype: ctx.workspace.apps[appName]?.type ?? 'backend',\n\t\t\t\t\tsuccess: true,\n\t\t\t\t\t...(run.urls[appName] ? { url: run.urls[appName] } : {}),\n\t\t\t\t})),\n\t\t\t\tprojectId: '',\n\t\t\t\tenvironmentId: '',\n\t\t\t\tsuccessCount: ctx.dryRun ? 0 : run.apps.length,\n\t\t\t\tfailedCount: 0,\n\t\t\t\tstage: ctx.stage,\n\t\t\t\tidentity: ctx.identity.key,\n\t\t\t\ttag: ctx.tag,\n\t\t\t\tdryRun: ctx.dryRun,\n\t\t\t\tskipped: [...ctx.skipped],\n\t\t\t\turls: { ...run.urls },\n\t\t\t\tchanges: [],\n\t\t\t};\n\t\t},\n\t});\n}\n\nfunction buildCommand(\n\tctx: DeployPhaseContext<unknown>,\n\trun: SstRun,\n): [string, string[]] {\n\treturn projectCommand(run.pm, 'gkm', [\n\t\t'build',\n\t\t'--provider',\n\t\t'aws',\n\t\t'--stage',\n\t\tctx.stage,\n\t]);\n}\n\nfunction deployCommand(\n\tctx: DeployPhaseContext<unknown>,\n\trun: SstRun,\n): [string, string[]] {\n\treturn projectCommand(run.pm, 'sst', ['deploy', '--stage', ctx.stage]);\n}\n\n/**\n * The path a released app is asked on: a backend's `/health`, a site's `/`.\n * A WebSocket surface has none on AWS — API Gateway answers its handshake,\n * and its routes are Lambdas behind it — so it is not asked.\n */\nexport function healthPath(\n\tkind: string | undefined,\n\tappType: string | undefined,\n): string | undefined {\n\tif (kind === 'websocket-api') return undefined;\n\t// A surface — a `rest-api` — is the backend app it derives.\n\treturn appType === 'backend' ? '/health' : '/';\n}\n\nexport const sstTarget = createSstTarget();\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAyBA,IAAa,oBAAb,cAAuC,SAAS;CAErC;CAEA;CAHV,YACC,OAEA,UA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,gBAAgB"}
|
|
1
|
+
{"version":3,"file":"sst-w90IUOX_.mjs","names":[],"sources":["../src/target/sst/health.ts","../src/target/sst/outputs.ts","../src/target/sst/index.ts"],"sourcesContent":["/**\n * Whether a released surface answers.\n *\n * The paths are the ones the local stack's healthchecks use\n * (`reconcile/apps.ts`): an API's `/health`, a site's `/`. A surface is\n * asked a few times, because a fresh deploy can take a moment to answer — a\n * Lambda's first start, a distribution still settling — and healthy means a\n * 2xx, after redirects.\n */\n\nimport { GkmError } from '../../errors';\nimport type { TargetEvent } from '../types';\n\nexport interface HealthCheckOptions {\n\t/** How many times a surface is asked before it counts as down. */\n\tattempts: number;\n\t/** The wait between two attempts. */\n\tdelayMs: number;\n\t/** How long one request may take. */\n\ttimeoutMs: number;\n\tsignal: AbortSignal;\n\temit: (event: TargetEvent) => void;\n}\n\n/** Surfaces that never answered healthy. */\nexport class SurfacesUnhealthy extends GkmError {\n\tconstructor(\n\t\treadonly stage: string,\n\t\t/** Each surface that failed, with the last thing it answered. */\n\t\treadonly surfaces: readonly {\n\t\t\tapp: string;\n\t\t\turl: string;\n\t\t\tstatus?: number;\n\t\t\terror?: string;\n\t\t}[],\n\t) {\n\t\tconst lines = surfaces.map(\n\t\t\t({ app, url, status, error }) =>\n\t\t\t\t` - ${app}: ${url} → ${status ?? error ?? 'no answer'}`,\n\t\t);\n\t\tsuper(\n\t\t\t`The \"${stage}\" stage was deployed, but ${surfaces.length === 1 ? 'a surface does' : 'surfaces do'} not answer healthy:\\n${lines.join('\\n')}\\nCheck its logs in CloudWatch, fix it, and deploy again.`,\n\t\t);\n\t\tthis.name = 'SurfacesUnhealthy';\n\t}\n}\n\n/** `path` under `base`, keeping any path `base` already has. */\nexport function healthUrl(base: string, path: string): string {\n\tconst root = base.endsWith('/') ? base : `${base}/`;\n\treturn new URL(path.replace(/^\\//, ''), root).toString();\n}\n\n/**\n * Ask `url` until it answers 2xx or the attempts run out, emitting\n * `health.checked` for each. Resolves with the last answer.\n */\nexport async function checkHealth(\n\tapp: string,\n\turl: string,\n\toptions: HealthCheckOptions,\n): Promise<{ healthy: boolean; status?: number; error?: string }> {\n\tlet last: { healthy: boolean; status?: number; error?: string } = {\n\t\thealthy: false,\n\t};\n\tfor (let attempt = 1; attempt <= options.attempts; attempt++) {\n\t\toptions.signal.throwIfAborted();\n\t\ttry {\n\t\t\tconst response = await fetch(url, {\n\t\t\t\tredirect: 'follow',\n\t\t\t\tsignal: AbortSignal.any([\n\t\t\t\t\toptions.signal,\n\t\t\t\t\tAbortSignal.timeout(options.timeoutMs),\n\t\t\t\t]),\n\t\t\t});\n\t\t\t// Drained, so the connection is not held open by an unread body.\n\t\t\tawait response.arrayBuffer().catch(() => undefined);\n\t\t\tlast = { healthy: response.ok, status: response.status };\n\t\t} catch (error) {\n\t\t\t// The run being stopped is not the surface being down.\n\t\t\toptions.signal.throwIfAborted();\n\t\t\tlast = {\n\t\t\t\thealthy: false,\n\t\t\t\terror: error instanceof Error ? error.message : String(error),\n\t\t\t};\n\t\t}\n\t\toptions.emit({\n\t\t\ttype: 'health.checked',\n\t\t\tapp,\n\t\t\turl,\n\t\t\thealthy: last.healthy,\n\t\t\t...(last.status !== undefined ? { status: last.status } : {}),\n\t\t\tattempt,\n\t\t});\n\t\tif (last.healthy) return last;\n\t\tif (attempt < options.attempts) await wait(options.delayMs, options.signal);\n\t}\n\treturn last;\n}\n\nfunction wait(ms: number, signal: AbortSignal): Promise<void> {\n\tif (ms <= 0) return Promise.resolve();\n\treturn new Promise((resolve, reject) => {\n\t\tconst timer = setTimeout(() => {\n\t\t\tsignal.removeEventListener('abort', stop);\n\t\t\tresolve();\n\t\t}, ms);\n\t\tconst stop = () => {\n\t\t\tclearTimeout(timer);\n\t\t\treject(signal.reason);\n\t\t};\n\t\tsignal.addEventListener('abort', stop, { once: true });\n\t});\n}\n","/**\n * The surface URLs an `sst deploy` reports.\n *\n * SST writes whatever `run()` in `sst.config.ts` returns to\n * `.sst/outputs.json` after every successful deploy — `{\"Api\": \"https://…\"}`.\n * What `run()` returns is the project's to write, so this reads it leniently:\n * nested objects are walked, anything that is not an http(s) URL is ignored,\n * and an output names a surface by its id in any casing, with or without a\n * `Url` suffix (`Api`, `api`, `ApiUrl`, `API_URL`, `Api.url`).\n */\n\nimport { existsSync } from 'node:fs';\nimport { readFile, rm } from 'node:fs/promises';\nimport { join } from 'node:path';\nimport { kebabCase } from '@geekmidas/manifest';\nimport { GkmError } from '../../errors';\n\n/** Where SST leaves the last successful deploy's outputs, under the project. */\nexport const SST_OUTPUTS_FILE = join('.sst', 'outputs.json');\n\n/** `.sst/outputs.json` is there, and is not JSON. */\nexport class SstOutputsUnreadable extends GkmError {\n\tconstructor(\n\t\treadonly path: string,\n\t\treadonly reason: string,\n\t) {\n\t\tsuper(\n\t\t\t`Could not read SST's outputs at ${path}: ${reason}. It is rewritten by every successful \\`sst deploy\\`; delete it and deploy again.`,\n\t\t);\n\t\tthis.name = 'SstOutputsUnreadable';\n\t}\n}\n\n/**\n * Remove what an earlier deploy wrote, so the outputs read after this one\n * are this one's — not another stage's, deployed from the same checkout.\n */\nexport async function clearOutputs(cwd: string): Promise<void> {\n\tawait rm(join(cwd, SST_OUTPUTS_FILE), { force: true });\n}\n\n/** The deploy's outputs, or `{}` when it wrote none. */\nexport async function readOutputs(cwd: string): Promise<unknown> {\n\tconst path = join(cwd, SST_OUTPUTS_FILE);\n\tif (!existsSync(path)) return {};\n\ttry {\n\t\treturn JSON.parse(await readFile(path, 'utf8'));\n\t} catch (error) {\n\t\tthrow new SstOutputsUnreadable(\n\t\t\tpath,\n\t\t\terror instanceof Error ? error.message : String(error),\n\t\t);\n\t}\n}\n\n/** Every http(s) URL in `outputs`, by its key path: `['Api', 'url']`. */\nfunction urlsIn(\n\tvalue: unknown,\n\tpath: string[] = [],\n\tfound: { path: string[]; url: string }[] = [],\n): { path: string[]; url: string }[] {\n\tif (typeof value === 'string') {\n\t\tif (isHttpUrl(value)) found.push({ path, url: value });\n\t} else if (value && typeof value === 'object' && !Array.isArray(value)) {\n\t\tfor (const [key, child] of Object.entries(value)) {\n\t\t\turlsIn(child, [...path, key], found);\n\t\t}\n\t}\n\treturn found;\n}\n\nfunction isHttpUrl(value: string): boolean {\n\ttry {\n\t\tconst { protocol } = new URL(value);\n\t\treturn protocol === 'http:' || protocol === 'https:';\n\t} catch {\n\t\treturn false;\n\t}\n}\n\n/**\n * The app an output's key path names, kebab-cased as app keys are: its last\n * segment, without a `url` suffix — or its parent's, when the last segment\n * is only `url`. Exact names are tried first, so an app called `api-url`\n * still finds `ApiUrl`.\n */\nfunction namesOf(path: string[]): string[] {\n\tconst names: string[] = [];\n\tfor (const segment of [...path].reverse()) {\n\t\tconst name = kebabCase(segment);\n\t\tnames.push(name);\n\t\tconst bare = name.replace(/-?url$/, '');\n\t\tif (bare) {\n\t\t\tnames.push(bare);\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn names;\n}\n\n/**\n * Each app's URL from the outputs, for the apps given. An app no output\n * names is left out.\n */\nexport function surfaceUrls(\n\toutputs: unknown,\n\tapps: readonly string[],\n): Record<string, string> {\n\tconst found = urlsIn(outputs);\n\tconst urls: Record<string, string> = {};\n\tfor (const app of apps) {\n\t\t// An exact name beats a stripped one, wherever each is in the file.\n\t\tconst exact = found.find(({ path }) => namesOf(path)[0] === app);\n\t\tconst loose = found.find(({ path }) => namesOf(path).includes(app));\n\t\tconst match = exact ?? loose;\n\t\tif (match) urls[app] = match.url;\n\t}\n\treturn urls;\n}\n","/**\n * The built-in `sst` target: `gkm build` writes the manifest, `sst deploy`\n * provisions it, and the surfaces SST reports are health-checked.\n *\n * `@geekmidas/cloud` is unchanged by it: `sst.config.ts` still reads\n * `.gkm/manifest/aws.ts` and `fromManifest` still makes every resource. What\n * the target adds is the run around the two commands — the lock, the events,\n * verification, and credentials kept where they belong.\n *\n * Both commands run in the sandbox: the build executes the project's code,\n * and so does `sst deploy`, which evaluates `sst.config.ts`. Only the second\n * needs AWS, so the AWS credential goes into that one command's environment\n * and nowhere else — not the build's, not the process the deploy runs in.\n * What `sst deploy` needs beyond them, the sandbox already passes: `PATH`\n * for node and the package manager, and `HOME`, under which SST keeps its\n * toolchain (`~/.config/sst`: bun, pulumi and its plugins) and the AWS SDK\n * finds `~/.aws` for a profile. Its state — the Pulumi backend and the\n * passphrase — is in the stage's own account, reached with that credential.\n */\n\nimport { existsSync } from 'node:fs';\nimport { join } from 'node:path';\nimport type { ConstructManifest } from '@geekmidas/manifest';\nimport { deployedInboxEnv } from '../../compose/stack';\nimport {\n\ttype AwsCredential,\n\tMissingCredential,\n} from '../../deploy/credentials';\nimport { hasNextSite, NEXT_DEPLOYMENT_ID_KEY } from '../../deploy/nextRelease';\nimport type { DeployResult } from '../../deploy/types';\nimport { GkmError } from '../../errors';\nimport { detectPackageManager, type PackageManager } from '../../init/utils';\nimport { CommandFailed } from '../../run';\nimport { LocalSandbox } from '../../sandbox/local';\nimport { activeSandbox, type Sandbox } from '../../sandbox/sandbox';\nimport { appKey } from '../../workspace/derive';\nimport { defineTarget } from '../define';\nimport type { DeployPhaseContext, DeployTarget } from '../types';\nimport { checkHealth, healthUrl, SurfacesUnhealthy } from './health';\nimport { clearOutputs, readOutputs, surfaceUrls } from './outputs';\n\nexport { SurfacesUnhealthy } from './health';\nexport { SST_OUTPUTS_FILE, SstOutputsUnreadable } from './outputs';\n\n/** A cold build of every handler and site. */\nconst BUILD_TIMEOUT_MS = 30 * 60_000;\n/**\n * A first deploy creates CloudFront distributions and, with a database, a\n * VPC and an RDS instance — each of which alone can take a quarter of an hour.\n */\nconst DEPLOY_TIMEOUT_MS = 90 * 60_000;\n\n/** The workspace has no `sst.config.ts` for `sst deploy` to run. */\nexport class SstConfigNotFound extends GkmError {\n\tconstructor(readonly cwd: string) {\n\t\tsuper(\n\t\t\t`No sst.config.ts in ${cwd}. The sst target runs \\`sst deploy\\` at the workspace root: scaffold one with \\`gkm init --deploy sst\\` and copy its sst.config.ts, or deploy through another target with --target.`,\n\t\t);\n\t\tthis.name = 'SstConfigNotFound';\n\t}\n}\n\n/** What the phases hand on. */\nexport interface SstRun {\n\tsandbox: Sandbox;\n\tpm: PackageManager;\n\taws: AwsCredential;\n\t/** The apps SST deploys this run: `ctx.apps` without the skipped. */\n\tapps: string[];\n\t/** Each app's URL, from the deploy's outputs. */\n\turls: Record<string, string>;\n}\n\nexport interface SstTargetOptions {\n\t/** How often, and how patiently, `verify` asks each surface. */\n\thealth?: { attempts?: number; delayMs?: number; timeoutMs?: number };\n}\n\n/**\n * The project's own copy of `bin`, through its package manager — never one\n * `npx` would download, which would be code nobody installed.\n */\nexport function projectCommand(\n\tpm: PackageManager,\n\tbin: string,\n\targs: readonly string[],\n): [command: string, args: string[]] {\n\tswitch (pm) {\n\t\tcase 'pnpm':\n\t\t\treturn ['pnpm', ['exec', bin, ...args]];\n\t\tcase 'yarn':\n\t\t\treturn ['yarn', [bin, ...args]];\n\t\tcase 'bun':\n\t\t\treturn ['bunx', [bin, ...args]];\n\t\tcase 'npm':\n\t\t\treturn ['npx', ['--no-install', bin, ...args]];\n\t}\n}\n\n/**\n * The variables `credential` is to the AWS SDK and to SST.\n *\n * A profile is passed alone: given keys too, every SDK would take the keys.\n */\nexport function awsEnv(credential: AwsCredential): Record<string, string> {\n\tconst region: Record<string, string> = credential.region\n\t\t? { AWS_REGION: credential.region, AWS_DEFAULT_REGION: credential.region }\n\t\t: {};\n\tif ('profile' in credential) {\n\t\treturn { AWS_PROFILE: credential.profile, ...region };\n\t}\n\treturn {\n\t\tAWS_ACCESS_KEY_ID: credential.accessKeyId,\n\t\tAWS_SECRET_ACCESS_KEY: credential.secretAccessKey,\n\t\t...(credential.sessionToken\n\t\t\t? { AWS_SESSION_TOKEN: credential.sessionToken }\n\t\t\t: {}),\n\t\t...region,\n\t};\n}\n\n/**\n * `env` without any `AWS_*`, so a host sandbox that passes some cannot put\n * a second account beside the one the credential names.\n */\nfunction withoutAws(\n\tenv: Readonly<Record<string, string>>,\n): Record<string, string> {\n\treturn Object.fromEntries(\n\t\tObject.entries(env).filter(([name]) => !name.startsWith('AWS_')),\n\t);\n}\n\n/** Each app's kind in the manifest, by app key: `rest-api` or `site`. */\nfunction kindsOf(manifest: ConstructManifest): Map<string, string> {\n\treturn new Map(\n\t\tObject.entries(manifest).map(([id, declaration]) => [\n\t\t\tappKey(id),\n\t\t\tdeclaration.kind,\n\t\t]),\n\t);\n}\n\nasync function exec(\n\tctx: DeployPhaseContext<unknown>,\n\trun: SstRun,\n\t[command, args]: [string, string[]],\n\toptions: { env: Record<string, string>; timeoutMs: number },\n): Promise<void> {\n\tconst result = await run.sandbox.exec(command, args, {\n\t\tcwd: ctx.cwd,\n\t\tenv: options.env,\n\t\ttimeoutMs: options.timeoutMs,\n\t\toutput: ctx.childOutput,\n\t\tsignal: ctx.signal,\n\t});\n\tif (result.exitCode !== 0) {\n\t\tthrow new CommandFailed(\n\t\t\tcommand,\n\t\t\targs,\n\t\t\tresult.exitCode,\n\t\t\tresult.signal as NodeJS.Signals | null,\n\t\t);\n\t}\n}\n\n/**\n * What SST reads for each inbox, by key: the stage's domain, and what the\n * inbox's provider made — its bucket's URL and its topic's string — from the\n * stage's secrets, read by the same rule as on compose. SST provisions none\n * of it; `fromManifest` references the topic and links the inbox's values.\n */\nexport async function inboxEnv(\n\tctx: DeployPhaseContext<unknown>,\n): Promise<Record<string, string>> {\n\tif (!Object.values(ctx.manifest).some((d) => d.kind === 'inbox')) return {};\n\tconst stored = await ctx.secrets.read();\n\tconst domain = ctx.workspace.domains?.[ctx.stage];\n\tconst env = deployedInboxEnv(ctx.manifest, {\n\t\treader: 'sst deploy',\n\t\tstage: ctx.stage,\n\t\tdomain,\n\t\tsecrets: stored?.custom ?? {},\n\t});\n\t// The URLs carry the provider's access key; the domain is public.\n\tfor (const value of Object.values(env)) {\n\t\tif (value !== domain) ctx.secrets.mask(value);\n\t}\n\treturn env;\n}\n\n/**\n * What `sst deploy` hands each Next site's build, which SST runs with its\n * own environment: the deploy's tag as `NEXT_DEPLOYMENT_ID`. A site on AWS is\n * Next's static export — no server, so no server actions and no key — whose\n * assets are tagged with the release it was built for. Nothing where the\n * stage has no Next site.\n */\nexport function nextReleaseEnv(\n\tctx: Pick<DeployPhaseContext<unknown>, 'manifest' | 'tag'>,\n): Record<string, string> {\n\treturn hasNextSite(ctx.manifest) ? { [NEXT_DEPLOYMENT_ID_KEY]: ctx.tag } : {};\n}\n\n/** The `sst` target, with its health checks tuned — for tests and hosts. */\nexport function createSstTarget(\n\toptions: SstTargetOptions = {},\n): DeployTarget<undefined, SstRun> {\n\tconst health = {\n\t\tattempts: options.health?.attempts ?? 6,\n\t\tdelayMs: options.health?.delayMs ?? 5_000,\n\t\ttimeoutMs: options.health?.timeoutMs ?? 10_000,\n\t};\n\n\treturn defineTarget<undefined, SstRun>({\n\t\tname: 'sst',\n\t\truntime: 'aws',\n\t\t// SST keeps no previous release to return to; migrations run in the\n\t\t// stack, as `fromManifest` provisions the database; and nothing here\n\t\t// builds an image.\n\t\tcapabilities: { rollback: false, migrations: 'target', images: false },\n\t\tcredentials: ['aws'],\n\n\t\tasync validate(ctx) {\n\t\t\tif (!existsSync(join(ctx.cwd, 'sst.config.ts'))) {\n\t\t\t\tthrow new SstConfigNotFound(ctx.cwd);\n\t\t\t}\n\n\t\t\tconst aws = await ctx.credentials.get(\n\t\t\t\t{ kind: 'aws', stage: ctx.stage },\n\t\t\t\t{ signal: ctx.signal },\n\t\t\t);\n\t\t\tif (!aws) throw new MissingCredential('aws', ctx.stage);\n\t\t\tif (!('profile' in aws)) {\n\t\t\t\tctx.secrets.mask(aws.secretAccessKey);\n\t\t\t\tif (aws.sessionToken) ctx.secrets.mask(aws.sessionToken);\n\t\t\t}\n\n\t\t\t// A mobile app ships through its own store's toolchain.\n\t\t\tfor (const app of ctx.apps) {\n\t\t\t\tif (ctx.workspace.apps[app]?.type === 'mobile') {\n\t\t\t\t\tctx.skip(app, 'mobile apps deploy through their own toolchain');\n\t\t\t\t}\n\t\t\t}\n\t\t\tconst skipped = new Set(ctx.skipped.map(({ app }) => app));\n\t\t\tconst apps = ctx.apps.filter((app) => !skipped.has(app));\n\n\t\t\tctx.logger.info(\n\t\t\t\t`\\n🚀 Deploying \"${ctx.workspace.name}\" to the \"${ctx.stage}\" stage with SST`,\n\t\t\t);\n\t\t\tctx.logger.info(\n\t\t\t\t` AWS: ${'profile' in aws ? `profile \"${aws.profile}\"` : 'access keys'}`,\n\t\t\t);\n\t\t\t// `sst deploy` takes the whole stack: there is no deploying one app.\n\t\t\tconst deployable = Object.values(ctx.workspace.apps).filter(\n\t\t\t\t(app) => app.type !== 'mobile',\n\t\t\t).length;\n\t\t\tif (apps.length < deployable) {\n\t\t\t\tctx.logger.warn(\n\t\t\t\t\t` sst deploy deploys every construct of the stage, not only ${apps.join(', ')}.`,\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tsandbox: activeSandbox() ?? new LocalSandbox({ root: ctx.cwd }),\n\t\t\t\tpm: detectPackageManager(ctx.cwd),\n\t\t\t\taws,\n\t\t\t\tapps,\n\t\t\t\turls: {},\n\t\t\t};\n\t\t},\n\n\t\tasync plan(ctx, run) {\n\t\t\tconst kinds = kindsOf(ctx.manifest);\n\t\t\tfor (const app of run.apps) {\n\t\t\t\tctx.emit({\n\t\t\t\t\ttype: 'resource.planned',\n\t\t\t\t\tkey: `application:${app}`,\n\t\t\t\t\tresourceType: kinds.get(app) ?? 'application',\n\t\t\t\t\taction: 'ensure',\n\t\t\t\t});\n\t\t\t}\n\t\t\tconst [build, buildArgs] = buildCommand(ctx, run);\n\t\t\tconst [deploy, deployArgs] = deployCommand(ctx, run);\n\t\t\tctx.logger.info(` Would run: ${[build, ...buildArgs].join(' ')}`);\n\t\t\tctx.logger.info(` Would run: ${[deploy, ...deployArgs].join(' ')}`);\n\t\t},\n\n\t\tasync build(ctx, run) {\n\t\t\tctx.logger.info('\\n📦 Building the manifest SST deploys');\n\t\t\t// No credential: the build runs the project's code and needs none.\n\t\t\tawait exec(ctx, run, buildCommand(ctx, run), {\n\t\t\t\tenv: { ...run.sandbox.env },\n\t\t\t\ttimeoutMs: BUILD_TIMEOUT_MS,\n\t\t\t});\n\t\t},\n\n\t\tasync release(ctx, run) {\n\t\t\tctx.logger.info(`\\n☁️ sst deploy --stage ${ctx.stage}`);\n\t\t\tawait clearOutputs(ctx.cwd);\n\t\t\tawait exec(ctx, run, deployCommand(ctx, run), {\n\t\t\t\tenv: {\n\t\t\t\t\t...withoutAws(run.sandbox.env),\n\t\t\t\t\t...(await inboxEnv(ctx)),\n\t\t\t\t\t...nextReleaseEnv(ctx),\n\t\t\t\t\t...awsEnv(run.aws),\n\t\t\t\t},\n\t\t\t\ttimeoutMs: DEPLOY_TIMEOUT_MS,\n\t\t\t});\n\n\t\t\trun.urls = surfaceUrls(await readOutputs(ctx.cwd), run.apps);\n\t\t\tfor (const app of run.apps) {\n\t\t\t\tctx.emit({\n\t\t\t\t\ttype: 'app.deployed',\n\t\t\t\t\tapp,\n\t\t\t\t\tapplicationId: ctx.name(app),\n\t\t\t\t\t// SST builds no image a registry holds.\n\t\t\t\t\timageRef: '',\n\t\t\t\t\turl: run.urls[app] ?? '',\n\t\t\t\t});\n\t\t\t}\n\t\t},\n\n\t\tasync verify(ctx, run) {\n\t\t\tconst unhealthy: SurfacesUnhealthy['surfaces'][number][] = [];\n\t\t\tconst kinds = kindsOf(ctx.manifest);\n\n\t\t\tfor (const app of run.apps) {\n\t\t\t\tconst path = healthPath(kinds.get(app), ctx.workspace.apps[app]?.type);\n\t\t\t\tif (!path) {\n\t\t\t\t\tctx.logger.info(\n\t\t\t\t\t\t` ${app}: API Gateway holds its sockets and has no HTTP path to ask, so it was not checked.`,\n\t\t\t\t\t);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tconst base = run.urls[app];\n\t\t\t\tif (!base) {\n\t\t\t\t\tctx.logger.warn(\n\t\t\t\t\t\t` ⚠ No URL for ${app} in SST's outputs, so it was not checked. Return it from run() in sst.config.ts — { ${app}: <its url> } — to have it checked.`,\n\t\t\t\t\t);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tconst url = healthUrl(base, path);\n\t\t\t\tconst answer = await checkHealth(app, url, {\n\t\t\t\t\t...health,\n\t\t\t\t\tsignal: ctx.signal,\n\t\t\t\t\temit: ctx.emit,\n\t\t\t\t});\n\t\t\t\tif (answer.healthy) {\n\t\t\t\t\tctx.logger.info(` ✓ ${app}: ${url}`);\n\t\t\t\t} else {\n\t\t\t\t\tunhealthy.push({\n\t\t\t\t\t\tapp,\n\t\t\t\t\t\turl,\n\t\t\t\t\t\t...(answer.status !== undefined ? { status: answer.status } : {}),\n\t\t\t\t\t\t...(answer.error ? { error: answer.error } : {}),\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (unhealthy.length > 0) {\n\t\t\t\tthrow new SurfacesUnhealthy(ctx.stage, unhealthy);\n\t\t\t}\n\t\t},\n\n\t\tresult(ctx, run): DeployResult {\n\t\t\treturn {\n\t\t\t\tapps: run.apps.map((appName) => ({\n\t\t\t\t\tappName,\n\t\t\t\t\ttype: ctx.workspace.apps[appName]?.type ?? 'backend',\n\t\t\t\t\tsuccess: true,\n\t\t\t\t\t...(run.urls[appName] ? { url: run.urls[appName] } : {}),\n\t\t\t\t})),\n\t\t\t\tprojectId: '',\n\t\t\t\tenvironmentId: '',\n\t\t\t\tsuccessCount: ctx.dryRun ? 0 : run.apps.length,\n\t\t\t\tfailedCount: 0,\n\t\t\t\tstage: ctx.stage,\n\t\t\t\tidentity: ctx.identity.key,\n\t\t\t\ttag: ctx.tag,\n\t\t\t\tdryRun: ctx.dryRun,\n\t\t\t\tskipped: [...ctx.skipped],\n\t\t\t\turls: { ...run.urls },\n\t\t\t\tchanges: [],\n\t\t\t};\n\t\t},\n\t});\n}\n\nfunction buildCommand(\n\tctx: DeployPhaseContext<unknown>,\n\trun: SstRun,\n): [string, string[]] {\n\treturn projectCommand(run.pm, 'gkm', [\n\t\t'build',\n\t\t'--provider',\n\t\t'aws',\n\t\t'--stage',\n\t\tctx.stage,\n\t]);\n}\n\nfunction deployCommand(\n\tctx: DeployPhaseContext<unknown>,\n\trun: SstRun,\n): [string, string[]] {\n\treturn projectCommand(run.pm, 'sst', ['deploy', '--stage', ctx.stage]);\n}\n\n/**\n * The path a released app is asked on: a backend's `/health`, a site's `/`.\n * A WebSocket surface has none on AWS — API Gateway answers its handshake,\n * and its routes are Lambdas behind it — so it is not asked.\n */\nexport function healthPath(\n\tkind: string | undefined,\n\tappType: string | undefined,\n): string | undefined {\n\tif (kind === 'websocket-api') return undefined;\n\t// A surface — a `rest-api` — is the backend app it derives.\n\treturn appType === 'backend' ? '/health' : '/';\n}\n\nexport const sstTarget = createSstTarget();\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAyBA,IAAa,oBAAb,cAAuC,SAAS;CAErC;CAEA;CAHV,YACC,OAEA,UAMC;EACD,MAAM,QAAQ,SAAS,KACrB,EAAE,KAAK,KAAK,QAAQ,YACpB,OAAO,IAAI,IAAI,IAAI,KAAK,UAAU,SAAS,aAC7C;EACA,MACC,QAAQ,MAAM,4BAA4B,SAAS,WAAW,IAAI,mBAAmB,cAAc,wBAAwB,MAAM,KAAK,IAAI,EAAE,0DAC7I;EAfS,KAAA,QAAA;EAEA,KAAA,WAAA;EAcT,KAAK,OAAO;CACb;AACD;;AAGA,SAAgB,UAAU,MAAc,MAAsB;CAC7D,MAAM,OAAO,KAAK,SAAS,GAAG,IAAI,OAAO,GAAG,KAAK;CACjD,OAAO,IAAI,IAAI,KAAK,QAAQ,OAAO,EAAE,GAAG,IAAI,CAAC,CAAC,SAAS;AACxD;;;;;AAMA,eAAsB,YACrB,KACA,KACA,SACiE;CACjE,IAAI,OAA8D,EACjE,SAAS,MACV;CACA,KAAK,IAAI,UAAU,GAAG,WAAW,QAAQ,UAAU,WAAW;EAC7D,QAAQ,OAAO,eAAe;EAC9B,IAAI;GACH,MAAM,WAAW,M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Ac,IAAI,SAAS,IAAI,IAAI,KAAK;IACxC,aAAa;IACb,OAAO,IAAI;IACX,UAAU,IAAI,SAAS;IACvB,KAAK,IAAI;IACT,QAAQ,IAAI;IACZ,SAAS,CAAC,GAAG,IAAI,OAAO;IACxB,MAAM,EAAE,GAAG,IAAI,KAAK;IACpB,SAAS,CAAC;GACX;EACD;CACD,CAAC;AACF;AAEA,SAAS,aACR,KACA,KACqB;CACrB,OAAO,eAAe,IAAI,IAAI,OAAO;EACpC;EACA;EACA;EACA;EACA,IAAI;CACL,CAAC;AACF;AAEA,SAAS,cACR,KACA,KACqB;CACrB,OAAO,eAAe,IAAI,IAAI,OAAO;EAAC;EAAU;EAAW,IAAI;CAAK,CAAC;AACtE;;;;;;AAOA,SAAgB,WACf,MACA,SACqB;CACrB,IAAI,SAAS,iBAAiB,OAAO,KAAA;CAErC,OAAO,YAAY,YAAY,YAAY;AAC5C;AAEA,MAAa,YAAY,gBAAgB"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-BhDjJH2R.mjs";
|
|
2
2
|
import { t as GkmError } from "./errors-C9uIyIDt.mjs";
|
|
3
|
-
import { A as deployIdentity, H as getHostingerToken, L as stageTag, M as imageRef,
|
|
4
|
-
import { B as LOGS_PORT, Ft as SERVER_IPV4_KEY, H as provisioningOf, I as otlpTelemetryEnv, It as SERVER_IPV6_KEY, L as resolveStageTelemetry, Ot as certificateFor, Pt as checkStageBackups, Rt as isReservedStageKey, U as stageProvider, _ as PUBLIC_ENV_PREFIXES, a as allConstructGlobs, dt as fileServerLabel, ht as servesOnCdn, j as TEST_STAGE, kt as proxyFor, mt as s3Region, nt as bucketName, ot as appKey, ut as fileServerHost, z as telemetryEnv } from "./workspace-
|
|
5
|
-
import { $ as minioNotificationRule, A as POSTGRES_MOUNT, At as NoDomainForStage, B as hostsFor, C as REDIS_SERVICE, D as stackRedis, Dt as otlpHeaders, Et as logsService, F as TELEMETRY_CONTAINER, G as scopeTelemetryEnv, H as PROCESSORS_DEV_PREFIX, I as planFor, K as siteClientTelemetry, M as declaredPostgresImage, Mt as isMainFrontendApp, N as toYaml, Nt as resolveHost, Ot as stackLogs, P as PgBossNeedsDatabase, Q as NOTIFICATION_RULE_PREFIX, R as LOCAL_TLD, S as REDIS_PASSWORD_KEY, T as redisService, Tt as logsPorts, U as appTelemetry, V as localRoutes, W as isTelemetryKey, X as usesTelemetry, Y as telemetryOf, Z as HOST_GATEWAY, _ as NEXT_ACTIONS_KEY, at as emulatorEndpoint, b as nextBuildValues, bt as LOGS_PASSWORD_KEY, ct as DEFAULT_IMAGES, d as loadLocalCredentials, dt as portKeys, et as minioWebhookEnv, f as postgresRoleSlug, ft as portsOf, gt as volumeOf, h as saveLocalCredentials, ht as serviceAddresses, it as EMULATOR_REGION, j as composeFor, jt as getPublicUrlArgNames, k as CLUSTER_DATABASE, l as savePortState, mt as primaryPortKey, nt as watchedBuckets, o as loadPortState, ot as emulatorQueueUrl, p as postgresSuperuser, pt as postgresImage, q as stackTelemetry, rt as EMULATOR_ACCESS_KEY_ID, st as emulatorTopicArn, tt as objectsWebhookToken, u as LOCAL_RABBITMQ_USER, v as NEXT_DEPLOYMENT_ID_KEY, vt as LOGS_EMAIL_KEY, w as STACK_CACHE, wt as logsOnPort, x as nextRuntimeValues, xt as LOGS_SERVICE, yt as LOGS_ORG, z as hostFor$1 } from "./credentials-
|
|
3
|
+
import { A as deployIdentity, H as getHostingerToken, L as stageTag, M as imageRef, Q as gkmHome, a as eventsBackendFor, i as cacheBackendFor, o as providerOf, r as storedCredentials, t as MissingCredential, v as externalsManifestName } from "./credentials-CRgp0huX.mjs";
|
|
4
|
+
import { B as LOGS_PORT, Ft as SERVER_IPV4_KEY, H as provisioningOf, I as otlpTelemetryEnv, It as SERVER_IPV6_KEY, L as resolveStageTelemetry, Ot as certificateFor, Pt as checkStageBackups, Rt as isReservedStageKey, U as stageProvider, _ as PUBLIC_ENV_PREFIXES, a as allConstructGlobs, dt as fileServerLabel, ht as servesOnCdn, j as TEST_STAGE, kt as proxyFor, mt as s3Region, nt as bucketName, ot as appKey, ut as fileServerHost, z as telemetryEnv } from "./workspace-BSGUH2DO.mjs";
|
|
5
|
+
import { $ as minioNotificationRule, A as POSTGRES_MOUNT, At as NoDomainForStage, B as hostsFor, C as REDIS_SERVICE, D as stackRedis, Dt as otlpHeaders, Et as logsService, F as TELEMETRY_CONTAINER, G as scopeTelemetryEnv, H as PROCESSORS_DEV_PREFIX, I as planFor, K as siteClientTelemetry, M as declaredPostgresImage, Mt as isMainFrontendApp, N as toYaml, Nt as resolveHost, Ot as stackLogs, P as PgBossNeedsDatabase, Q as NOTIFICATION_RULE_PREFIX, R as LOCAL_TLD, S as REDIS_PASSWORD_KEY, T as redisService, Tt as logsPorts, U as appTelemetry, V as localRoutes, W as isTelemetryKey, X as usesTelemetry, Y as telemetryOf, Z as HOST_GATEWAY, _ as NEXT_ACTIONS_KEY, at as emulatorEndpoint, b as nextBuildValues, bt as LOGS_PASSWORD_KEY, ct as DEFAULT_IMAGES, d as loadLocalCredentials, dt as portKeys, et as minioWebhookEnv, f as postgresRoleSlug, ft as portsOf, gt as volumeOf, h as saveLocalCredentials, ht as serviceAddresses, it as EMULATOR_REGION, j as composeFor, jt as getPublicUrlArgNames, k as CLUSTER_DATABASE, l as savePortState, mt as primaryPortKey, nt as watchedBuckets, o as loadPortState, ot as emulatorQueueUrl, p as postgresSuperuser, pt as postgresImage, q as stackTelemetry, rt as EMULATOR_ACCESS_KEY_ID, st as emulatorTopicArn, tt as objectsWebhookToken, u as LOCAL_RABBITMQ_USER, v as NEXT_DEPLOYMENT_ID_KEY, vt as LOGS_EMAIL_KEY, w as STACK_CACHE, wt as logsOnPort, x as nextRuntimeValues, xt as LOGS_SERVICE, yt as LOGS_ORG, z as hostFor$1 } from "./credentials-0Kmo6GAw.mjs";
|
|
6
6
|
import { a as handlerEventsBackends, c as publishesToApiGateway, d as DEFAULT_EVENTS, l as readsObjects, n as driversFor, r as driversOf, s as opensKmsKeys, t as cacheBackendsIn } from "./drivers-BQRb3KsL.mjs";
|
|
7
7
|
import { a as SNS_SUBSCRIPTIONS_KEY, c as INBOX_RELAY_TOKEN_KEY, d as inboxWebhookUrl, i as readFakes, l as inboxRelayToken, o as objectsRoute, r as readCredentialFakes, s as subscriberRoute, t as SubscriberGenerator, u as inboxRelayWorker } from "./SubscriberGenerator-Cfoz8uTY.mjs";
|
|
8
8
|
import { a as startTelemetryCode, n as runtimeFor, s as writeTelemetryModule, u as telemetryArgs } from "./EndpointGenerator-CBKH87_b.mjs";
|
|
@@ -20,7 +20,7 @@ import { ensureLocalAuthority, ensureLocalCertificate, localAuthorityPaths, loca
|
|
|
20
20
|
import { CADDY_TLS_DIR, clientIpRule, edgeCaddyfile } from "@geekmidas/edge/proxy/caddy";
|
|
21
21
|
import { ACME_DNS_CHALLENGES, ACME_DNS_SECRET_KEYS, EDGE_AWS_CREDENTIALS, EDGE_CERTS_DIR, EDGE_DYNAMIC_DIR, EDGE_NETWORK, EDGE_PROJECT, EDGE_SERVICE, claimsOverlap, edgeAlias, edgeCertificatePaths, edgeComposeFile, edgeDnsSecretPath, isAcmeDnsProvider, readEdgeClaims, traefikDynamicFile, traefikStaticFile } from "@geekmidas/edge/proxy/traefik";
|
|
22
22
|
import { EDGE_LIMITS, NOFILE, routeHosts, upstreamAddress } from "@geekmidas/edge/routes";
|
|
23
|
-
import { DEFAULT_POSTGRES_VERSION, EDGE_TOKEN_KEY, PUBLIC_PREFIX, TELEMETRY_KEYS, WILDCARD_SUBDOMAIN, cacheTable, canonicalId, cookieDomain, dependenciesOf, dependentsOf, drawSecret, environmentCase, externalApiUrl, imageOrigins, imageOriginsFor, isPublicDeclaration, isWildcardSite, kebabCase, mobileOrigins, providedKeyFor, provisionOrder, publicEnvFor, publicValues, reachesServerHalf, schemeBase, senderAddress, wildcardDomainOf } from "@geekmidas/manifest";
|
|
23
|
+
import { DEFAULT_POSTGRES_VERSION, EDGE_TOKEN_KEY, PUBLIC_PREFIX, PUBLIC_STAGE_KEYS, TELEMETRY_KEYS, WILDCARD_SUBDOMAIN, cacheTable, canonicalId, cookieDomain, dependenciesOf, dependentsOf, drawSecret, environmentCase, externalApiUrl, imageOrigins, imageOriginsFor, isPublicDeclaration, isWildcardSite, kebabCase, mobileOrigins, providedKeyFor, provisionOrder, publicEnvFor, publicStageKey, publicValues, reachesServerHalf, schemeBase, senderAddress, wildcardDomainOf } from "@geekmidas/manifest";
|
|
24
24
|
import { fileURLToPath } from "node:url";
|
|
25
25
|
import * as s3Url from "@geekmidas/storage/s3-url";
|
|
26
26
|
import { formatKeyring } from "@geekmidas/constructs/encryption";
|
|
@@ -420,6 +420,18 @@ const dockerCompose = {
|
|
|
420
420
|
if (code !== 0) return void 0;
|
|
421
421
|
return stdout.trim().split("\n")[0] || void 0;
|
|
422
422
|
},
|
|
423
|
+
async logs(stack, service, lines) {
|
|
424
|
+
const env = engineEnv(stack);
|
|
425
|
+
const { stdout, stderr } = await capture("docker", compose(stack, [
|
|
426
|
+
"logs",
|
|
427
|
+
"--no-color",
|
|
428
|
+
"--no-log-prefix",
|
|
429
|
+
"--tail",
|
|
430
|
+
String(lines),
|
|
431
|
+
service
|
|
432
|
+
]), env ? { env } : {});
|
|
433
|
+
return `${stdout}${stderr}`.trimEnd();
|
|
434
|
+
},
|
|
423
435
|
async push(stack, ref) {
|
|
424
436
|
const output = await runOutput("docker", ["push", ref], {
|
|
425
437
|
cwd: stack.cwd,
|
|
@@ -950,12 +962,21 @@ function credentialOf(options) {
|
|
|
950
962
|
* stored URL naming an old port is the drift resolution replaces. A command
|
|
951
963
|
* whose stage says a value by hand (a deployed stack's) leaves that key out
|
|
952
964
|
* of `resolved`.
|
|
965
|
+
*
|
|
966
|
+
* But for a frontend's stage (`PUBLIC_STAGE_KEYS`), which is a name rather
|
|
967
|
+
* than an address: a stored one is how the stage told its bundle what it is
|
|
968
|
+
* called, and it wins here as it wins in an image build.
|
|
953
969
|
*/
|
|
954
970
|
function stageEnv(stored, resolved) {
|
|
955
|
-
|
|
971
|
+
const env = {
|
|
956
972
|
...stored,
|
|
957
973
|
...resolved
|
|
958
974
|
};
|
|
975
|
+
for (const key of PUBLIC_STAGE_KEYS) {
|
|
976
|
+
const value = stored[key];
|
|
977
|
+
if (value !== void 0) env[key] = value;
|
|
978
|
+
}
|
|
979
|
+
return env;
|
|
959
980
|
}
|
|
960
981
|
/**
|
|
961
982
|
* The token a stack's own services prove themselves with at its edge
|
|
@@ -1076,6 +1097,7 @@ function publicEnv(plan, resolved, addresses = {}) {
|
|
|
1076
1097
|
const origins = imageOrigins(resource.imageOrigins.sources, (key) => resolved[key]);
|
|
1077
1098
|
if (origins) env[resource.imageOrigins.key] = origins;
|
|
1078
1099
|
}
|
|
1100
|
+
if (resource.stageKey && resolved[resource.envKey]) env[resource.stageKey] = plan.stage;
|
|
1079
1101
|
}
|
|
1080
1102
|
return env;
|
|
1081
1103
|
}
|
|
@@ -2542,13 +2564,16 @@ var SiteBuildValueUnresolved = class extends GkmError {
|
|
|
2542
2564
|
* variant's public prefix (`NEXT_PUBLIC_APP_STORE_URL` on a `next` site) was
|
|
2543
2565
|
* declared public by whoever named it, so it is passed. Anything else is
|
|
2544
2566
|
* not: a secret without the prefix never reaches a site's build.
|
|
2567
|
+
* - **The stage it is built for**, under the prefix (`NEXT_PUBLIC_STAGE`):
|
|
2568
|
+
* what a bundle gates production-only code on, as a process reads `STAGE`.
|
|
2569
|
+
* A stage secret of that name wins, unlike every other derived value.
|
|
2545
2570
|
*
|
|
2546
2571
|
* A value the stage resolves to nothing is left out rather than passed empty
|
|
2547
2572
|
* — except, with `requireFileOrigins`, where its pages load files from.
|
|
2548
2573
|
* A derived value wins over a stage secret of the same name: the site's
|
|
2549
2574
|
* addresses are the construct's, not a copy someone set.
|
|
2550
2575
|
*/
|
|
2551
|
-
function publicBuildValues(site, manifest, resolve, secrets, options
|
|
2576
|
+
function publicBuildValues(site, manifest, resolve, secrets, options) {
|
|
2552
2577
|
const args = {};
|
|
2553
2578
|
const own = providedKeyFor(site.id, site.kind, site.kind === "site" ? "url" : "scheme");
|
|
2554
2579
|
const ownValue = resolve(own);
|
|
@@ -2559,20 +2584,20 @@ function publicBuildValues(site, manifest, resolve, secrets, options = {}) {
|
|
|
2559
2584
|
if (value) args[key] = value;
|
|
2560
2585
|
}
|
|
2561
2586
|
const prefix = PUBLIC_PREFIX[site.variant];
|
|
2562
|
-
const
|
|
2563
|
-
if (required) for (const value of publicValues(site, manifest)) {
|
|
2587
|
+
if (options.requireFileOrigins) for (const value of publicValues(site, manifest)) {
|
|
2564
2588
|
if (value.kind === "file-server" && value.role === "url") {
|
|
2565
|
-
if (!resolve(value.key)) throw new SiteBuildValueUnresolved(site.id, value.key,
|
|
2589
|
+
if (!resolve(value.key)) throw new SiteBuildValueUnresolved(site.id, value.key, options.stage);
|
|
2566
2590
|
}
|
|
2567
2591
|
if (value.kind === "objects" && value.role === "signedOrigin") {
|
|
2568
2592
|
const connection = providedKeyFor(value.id, "objects", "connectionString");
|
|
2569
|
-
if (!resolve(value.key) && !resolve(connection)) throw new SiteBuildValueUnresolved(site.id, value.key,
|
|
2593
|
+
if (!resolve(value.key) && !resolve(connection)) throw new SiteBuildValueUnresolved(site.id, value.key, options.stage, connection);
|
|
2570
2594
|
}
|
|
2571
2595
|
}
|
|
2572
2596
|
const images = imageOriginsFor(site, manifest);
|
|
2573
2597
|
const origins = images && imageOrigins(images.sources, (source) => resolve(source) ?? derived[source]);
|
|
2574
2598
|
if (images && origins) args[images.key] = origins;
|
|
2575
2599
|
for (const [key, value] of Object.entries(secrets)) if (key.startsWith(prefix) && args[key] === void 0 && value) args[key] = value;
|
|
2600
|
+
args[publicStageKey(site)] ??= options.stage;
|
|
2576
2601
|
return args;
|
|
2577
2602
|
}
|
|
2578
2603
|
/**
|
|
@@ -5745,10 +5770,10 @@ function localPlan(workspace, manifest, fakes = {}, credentialFakes = {}) {
|
|
|
5745
5770
|
* addresses a *browser* can open, since that is where the bundle runs — the
|
|
5746
5771
|
* host's port for each app, never a name on the compose network.
|
|
5747
5772
|
*/
|
|
5748
|
-
function sitePublicArgs(manifest, appName, env) {
|
|
5773
|
+
function sitePublicArgs(manifest, appName, env, stage) {
|
|
5749
5774
|
const declaration = Object.entries(manifest).find(([id, d]) => d.kind === "site" && appKey(id) === appName)?.[1];
|
|
5750
5775
|
if (declaration?.kind !== "site") return {};
|
|
5751
|
-
return publicBuildValues(declaration, manifest, (key) => env[key], {});
|
|
5776
|
+
return publicBuildValues(declaration, manifest, (key) => env[key], {}, { stage });
|
|
5752
5777
|
}
|
|
5753
5778
|
/**
|
|
5754
5779
|
* Every key a plan resolves, with each container addressed by its service
|
|
@@ -5854,6 +5879,7 @@ function appEnvKeys(manifest, appName) {
|
|
|
5854
5879
|
for (const { key } of publicValues(declaration, manifest)) keys.add(key);
|
|
5855
5880
|
const images = imageOriginsFor(declaration, manifest);
|
|
5856
5881
|
if (images) keys.add(images.key);
|
|
5882
|
+
keys.add(publicStageKey(declaration));
|
|
5857
5883
|
}
|
|
5858
5884
|
return keys;
|
|
5859
5885
|
}
|
|
@@ -6065,7 +6091,7 @@ function appServices(workspace, manifest, containers, credentials, fakes = {}, c
|
|
|
6065
6091
|
});
|
|
6066
6092
|
const ports = [`${app.port}:${app.port}`];
|
|
6067
6093
|
if (app.type === "web") {
|
|
6068
|
-
const args = sitePublicArgs(manifest, name, browser);
|
|
6094
|
+
const args = sitePublicArgs(manifest, name, browser, plan.stage);
|
|
6069
6095
|
services[key] = {
|
|
6070
6096
|
image: `${key}:\${TAG:-latest}`,
|
|
6071
6097
|
build: {
|
|
@@ -7999,7 +8025,8 @@ function siteDockerfile(appName, app, options) {
|
|
|
7999
8025
|
const publicUrlArgs = options.publicUrlArgs ?? (declared?.kind === "site" && options.manifest ? [
|
|
8000
8026
|
providedKeyFor(declared.id, declared.kind, "url"),
|
|
8001
8027
|
...Object.keys(publicEnvFor(declared, options.manifest)),
|
|
8002
|
-
...[imageOriginsFor(declared, options.manifest)?.key].filter((key) => key !== void 0)
|
|
8028
|
+
...[imageOriginsFor(declared, options.manifest)?.key].filter((key) => key !== void 0),
|
|
8029
|
+
publicStageKey(declared)
|
|
8003
8030
|
] : getPublicUrlArgNames(app));
|
|
8004
8031
|
const webOpts = {
|
|
8005
8032
|
...options.image,
|
|
@@ -8436,6 +8463,7 @@ function setPostgresBackupId(state, backupId) {
|
|
|
8436
8463
|
* - 'hostinger': HostingerProvider
|
|
8437
8464
|
* - 'route53': Route53Provider
|
|
8438
8465
|
* - 'godaddy': GoDaddyProvider
|
|
8466
|
+
* - 'cloudflare': CloudflareProvider
|
|
8439
8467
|
* - 'manual': Returns null (user handles DNS)
|
|
8440
8468
|
* - Custom: Use provided DnsProvider implementation
|
|
8441
8469
|
*/
|
|
@@ -8476,23 +8504,28 @@ async function createDnsProvider(options) {
|
|
|
8476
8504
|
}
|
|
8477
8505
|
});
|
|
8478
8506
|
}
|
|
8479
|
-
if (provider === "cloudflare")
|
|
8507
|
+
if (provider === "cloudflare") {
|
|
8508
|
+
const { CloudflareProvider } = await import("@geekmidas/edge/dns/cloudflare");
|
|
8509
|
+
const from = options.cloudflareFrom ?? {};
|
|
8510
|
+
return new CloudflareProvider({
|
|
8511
|
+
...options.cloudflareBaseUrl ? { baseUrl: options.cloudflareBaseUrl } : {},
|
|
8512
|
+
credential: async () => {
|
|
8513
|
+
const found = options.cloudflare ?? await storedCredentials({
|
|
8514
|
+
env: from.env ?? process.env,
|
|
8515
|
+
...from.home ? { home: from.home } : {}
|
|
8516
|
+
}).get({ kind: "cloudflare" });
|
|
8517
|
+
if (!found) throw new MissingCredential("cloudflare", void 0);
|
|
8518
|
+
return found;
|
|
8519
|
+
}
|
|
8520
|
+
});
|
|
8521
|
+
}
|
|
8480
8522
|
throw new DnsProviderUnknown(config);
|
|
8481
8523
|
}
|
|
8482
|
-
/** A DNS provider gkm names and does not have yet. */
|
|
8483
|
-
var DnsProviderNotImplemented = class extends Error {
|
|
8484
|
-
provider;
|
|
8485
|
-
constructor(provider) {
|
|
8486
|
-
super(`The ${provider} DNS provider is not implemented yet. Use 'route53', 'godaddy', 'hostinger' or 'manual' for this domain in dns, or pass your own DnsProvider object.`);
|
|
8487
|
-
this.provider = provider;
|
|
8488
|
-
this.name = "DnsProviderNotImplemented";
|
|
8489
|
-
}
|
|
8490
|
-
};
|
|
8491
8524
|
/** A `provider:` that is none of the built-ins, nor a DnsProvider object. */
|
|
8492
8525
|
var DnsProviderUnknown = class extends GkmError {
|
|
8493
8526
|
config;
|
|
8494
8527
|
constructor(config) {
|
|
8495
|
-
super(`Unknown DNS provider: ${JSON.stringify(config)}. dns takes 'route53', 'godaddy', 'hostinger', 'manual', or an object implementing DnsProvider.`);
|
|
8528
|
+
super(`Unknown DNS provider: ${JSON.stringify(config)}. dns takes 'route53', 'godaddy', 'hostinger', 'cloudflare', 'manual', or an object implementing DnsProvider.`);
|
|
8496
8529
|
this.config = config;
|
|
8497
8530
|
this.name = "DnsProviderUnknown";
|
|
8498
8531
|
}
|
|
@@ -9841,7 +9874,10 @@ function composeStack(input) {
|
|
|
9841
9874
|
for (const app of apps) {
|
|
9842
9875
|
const site = manifest[app.id];
|
|
9843
9876
|
if (site?.kind === "site") {
|
|
9844
|
-
const args = publicBuildValues(site, manifest, (key) => valueFor(app, key, owners.get(key)) ?? plannedOrigins.get(key), custom,
|
|
9877
|
+
const args = publicBuildValues(site, manifest, (key) => valueFor(app, key, owners.get(key)) ?? plannedOrigins.get(key), custom, {
|
|
9878
|
+
stage,
|
|
9879
|
+
requireFileOrigins: !local && app.build !== void 0
|
|
9880
|
+
});
|
|
9845
9881
|
if (app.prerender && input.prerenderRun) args[PRERENDER_RUN_ARG] = input.prerenderRun;
|
|
9846
9882
|
Object.assign(args, nextBuildValues(site, stageTag(input.images.tag, stage), custom));
|
|
9847
9883
|
if (app.build && Object.keys(args).length > 0) app.build.args = args;
|
|
@@ -9875,7 +9911,7 @@ function composeStack(input) {
|
|
|
9875
9911
|
mobileApps.push({
|
|
9876
9912
|
name: app.name,
|
|
9877
9913
|
id: app.id,
|
|
9878
|
-
values: publicBuildValues(declaration, manifest, (key) => valueFor(app, key, owners.get(key)) ?? plannedOrigins.get(key), custom)
|
|
9914
|
+
values: publicBuildValues(declaration, manifest, (key) => valueFor(app, key, owners.get(key)) ?? plannedOrigins.get(key), custom, { stage })
|
|
9879
9915
|
});
|
|
9880
9916
|
}
|
|
9881
9917
|
for (const worker of input.buildOnly ? [] : workers) {
|
|
@@ -10745,4 +10781,4 @@ function withLogsPort(stack, port) {
|
|
|
10745
10781
|
//#endregion
|
|
10746
10782
|
export { ProcessorGenerator as $, runOutput as $n, imageLayout as $t, recordRollback as A, envFor as An, backendsOf as At, provisionCommand as B, pitrPrefix as Bn, assertEdgeHostsFree as Bt, createDnsProvider as C, applyNotifications as Cn, appProcess as Ct, getBackupState as D, postgresStatements as Dn, processorEnvKeys as Dt, createEmptyState as E, postgresDatabaseNames as En, processEnv as Et, awsClientConfig as F, backupDatabases as Fn, forgetState as Ft, dockerCommand as G, ContainersNotStopped as Gn, removeEdgeRoutes as Gt, PROVIDER_KINDS as H, stageBackups as Hn, edgePorts as Ht, awsEndpoint as I, backupExpiries as In, LEGACY_LOCAL_LOGIN as It, WorkerGenerator as J, projectVolume as Jn, PROCESSOR_ORIGIN_SECRET_ENV as Jt, ensureDockerignore as K, dockerCompose as Kn, writeEdgeRoutes as Kt, awsProvisioningCredentials as L, backupFile as Ln, ensurePostgresLogin as Lt, setBackupState as M, stageEnv as Mn, derivedContainers as Mt, setGeneratedSecret as N, BASE_BACKUPS_FOLDER as Nn, reconcileWorkspace as Nt, getGeneratedSecret as O, quoteIdentifier as On, workerEnvKeys as Ot, setPostgresBackupId as P, WAL_FOLDER as Pn, workspace_exports as Pt, CronGenerator as Q, run$1 as Qn, fromBuildRoot as Qt, StageProviderDisabled as R, backupsPrefix as Rn, bucketClient as Rt, verifyDnsRecords as S, applyLifecycles as Sn, appEnvKeys as St, createComposeState as T, applyPostgres as Tn, dockerfileOf as Tt, DockerBuildFailed as U, deploysWithCompose as Un, edgeRef as Ut, stageProviderNotes as V, runTime as Vn, assertEdgePorts as Vt, DockerPushFailed as W, ContainersNotStarted as Wn, ensureEdge as Wt, workerEntryDir as X, CommandTimedOut as Xn, originSecretKey as Xt, workerBundleName as Y, CommandFailed as Yn, newOriginSecret as Yt, QueueGenerator as Z, DEFAULT_TIMEOUT_MS as Zn, processorOriginHost as Zt, ensureEdgeDnsSecrets as _, RUNNER_PATH as _n, devServicesUsed as _t, deployedInboxEnv as a, imageBuildCredentials as an, handlerDriversFor as at, normalizeDnsConfig as b, walgEnv as bn, requiredStageKeys as bt, replicaNames as c, siteOfflineHosts as cn, servedBy as ct, withCaddyConfigs as d, workerUnits as dn, AllowDevServicesTakesNoValue as dt, PROCESSOR_PORT as en, processorBundleName as et, withLogsPort as f, BACKUPS_SERVICE as fn, DEV_SERVICES as ft, ensureEdgeAcmeKey as g, PitrKeyMissing as gn, assertDevServicesFlag as gt, acmeDnsZone as h, POSTGRES_SERVICE as hn, STORAGE_KEY_PAIR as ht, composeStack as i, nextPrerenderManifest as in, sharedDirectoryTree as it, setApplicationId as j, isDatabase as jn, constructGlobs as jt, recordRelease as k, mergeLifecycle as kn, FAKE_ENV as kt, stackDir as l, isUnder as ln, surfaceAt as lt, acmeDnsSecrets as m, PITR_KEY as mn, ExternalServicesNotConfigured as mt, LOOPBACK_SERVICES as n, detectPackageManager as nn, processorInfo as nt, derivedCredentials as o, isImageBuild as on, ownersContext as ot, assertSitePasswords as p, BACKUPS_URL_KEY as pn, DevServicesNeedServerTarget as pt, workerDockerfileOf as q, projectNetwork as qn, ORIGIN_VERIFY_HEADER as qt, composeProject as r, findBuildRoot as rn, appOutputDir as rt, envFile as s, OFFLINE_BUILD_ADDRESS as sn, reachedBy as st, LOG_ROTATION as t, WORKER_PORT as tn, processorEntryDir as tt, stackPlan as u, processorUnits as un, validateImageRef as ut, extractSubdomain as v, backupsRoleStatements as vn, externalServices as vt, asDokployState as w, applyPolicies as wn, apps_exports as wt, orchestrateDns as x, applyBuckets as xn, stageServiceDeclarations as xt, findRootDomain as y, newPitrKey as yn, reportDevServices as yt, assertStageProvidersEnabled as z, intoDatabase as zn, pgClient as zt };
|
|
10747
10783
|
|
|
10748
|
-
//# sourceMappingURL=stack-
|
|
10784
|
+
//# sourceMappingURL=stack-B5-pHmtX.mjs.map
|