@geekmidas/cli 10.0.0-alpha.186 → 10.0.0-alpha.188
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-BwHw28fJ.mjs → LegacyStateStore-iI2LW48g.mjs} +2 -2
- package/dist/{LegacyStateStore-BwHw28fJ.mjs.map → LegacyStateStore-iI2LW48g.mjs.map} +1 -1
- package/dist/{LegacyStateStore-LpTY3S7z.cjs → LegacyStateStore-kFahq3hz.cjs} +2 -2
- package/dist/{LegacyStateStore-LpTY3S7z.cjs.map → LegacyStateStore-kFahq3hz.cjs.map} +1 -1
- package/dist/{LocalStateStore-DsdNLm0_.mjs → LocalStateStore-CHKz7oSH.mjs} +2 -2
- package/dist/{LocalStateStore-DsdNLm0_.mjs.map → LocalStateStore-CHKz7oSH.mjs.map} +1 -1
- package/dist/{LocalStateStore-Dpn9kBuK.cjs → LocalStateStore-COvGAS9D.cjs} +2 -2
- package/dist/{LocalStateStore-Dpn9kBuK.cjs.map → LocalStateStore-COvGAS9D.cjs.map} +1 -1
- package/dist/{S3StateStore-Bk_EIWLU.cjs → S3StateStore-CWgPnzYs.cjs} +4 -4
- package/dist/{S3StateStore-Bk_EIWLU.cjs.map → S3StateStore-CWgPnzYs.cjs.map} +1 -1
- package/dist/{S3StateStore-BIpCLzpk.mjs → S3StateStore-Dp36QWGq.mjs} +4 -4
- package/dist/{S3StateStore-BIpCLzpk.mjs.map → S3StateStore-Dp36QWGq.mjs.map} +1 -1
- package/dist/{SSMStateStore-PiZxPXeX.mjs → SSMStateStore-BXJaNkAw.mjs} +2 -2
- package/dist/{SSMStateStore-PiZxPXeX.mjs.map → SSMStateStore-BXJaNkAw.mjs.map} +1 -1
- package/dist/{SSMStateStore-A1bgCF1P.cjs → SSMStateStore-Cfk-we0n.cjs} +2 -2
- package/dist/{SSMStateStore-A1bgCF1P.cjs.map → SSMStateStore-Cfk-we0n.cjs.map} +1 -1
- package/dist/{add-sU71e0Lp.cjs → add-BpQvfbl1.cjs} +3 -3
- package/dist/{add-sU71e0Lp.cjs.map → add-BpQvfbl1.cjs.map} +1 -1
- package/dist/{add-BBhzFpQ7.mjs → add-DryeFO6A.mjs} +3 -3
- package/dist/{add-BBhzFpQ7.mjs.map → add-DryeFO6A.mjs.map} +1 -1
- package/dist/{bundler-BM6lq-36.cjs → bundler-8aBbCVsY.cjs} +6 -6
- package/dist/{bundler-BM6lq-36.cjs.map → bundler-8aBbCVsY.cjs.map} +1 -1
- package/dist/{bundler-QKbRwztS.mjs → bundler-CUBfNgPZ.mjs} +6 -6
- package/dist/{bundler-QKbRwztS.mjs.map → bundler-CUBfNgPZ.mjs.map} +1 -1
- package/dist/{cli-VCAfR-se.mjs → cli-Cj4_6-c_.mjs} +4 -4
- package/dist/{cli-VCAfR-se.mjs.map → cli-Cj4_6-c_.mjs.map} +1 -1
- package/dist/{cli-D_iytris.cjs → cli-DZEgeNYA.cjs} +4 -4
- package/dist/{cli-D_iytris.cjs.map → cli-DZEgeNYA.cjs.map} +1 -1
- package/dist/{compose-D3zc8QN1.cjs → compose-B50nt3WV.cjs} +5 -5
- package/dist/{compose-D3zc8QN1.cjs.map → compose-B50nt3WV.cjs.map} +1 -1
- package/dist/{compose-CX2BF3LG.mjs → compose-C_vg6GOx.mjs} +5 -5
- package/dist/{compose-CX2BF3LG.mjs.map → compose-C_vg6GOx.mjs.map} +1 -1
- package/dist/{config-CTrfNKYd.d.mts → config-DpqIrrRJ.d.mts} +12 -3
- package/dist/config-DpqIrrRJ.d.mts.map +1 -0
- package/dist/{config-D9g_nYIu.d.cts → config-KFyPSS0R.d.cts} +12 -3
- package/dist/config-KFyPSS0R.d.cts.map +1 -0
- package/dist/config.cjs +15 -10
- package/dist/config.cjs.map +1 -1
- package/dist/config.d.cts +1 -1
- package/dist/config.d.mts +1 -1
- package/dist/config.mjs +15 -10
- package/dist/config.mjs.map +1 -1
- package/dist/{credentials-BMdpNO8R.mjs → credentials-B3lji5Yq.mjs} +6 -5
- package/dist/credentials-B3lji5Yq.mjs.map +1 -0
- package/dist/{credentials-BQ1khM28.cjs → credentials-BIP-iRPn.cjs} +3 -3
- package/dist/{credentials-BQ1khM28.cjs.map → credentials-BIP-iRPn.cjs.map} +1 -1
- package/dist/{credentials-Ci8nKFw4.mjs → credentials-CcEXccxO.mjs} +3 -3
- package/dist/{credentials-Ci8nKFw4.mjs.map → credentials-CcEXccxO.mjs.map} +1 -1
- package/dist/{credentials-C3uaZ80e.cjs → credentials-muaDESyw.cjs} +5 -4
- package/dist/credentials-muaDESyw.cjs.map +1 -0
- package/dist/{dbTunnel-DqtSAdQK.mjs → dbTunnel-BXmuGU8b.mjs} +5 -5
- package/dist/{dbTunnel-DqtSAdQK.mjs.map → dbTunnel-BXmuGU8b.mjs.map} +1 -1
- package/dist/{dbTunnel-D000s0YK.cjs → dbTunnel-BfStDMkg.cjs} +5 -5
- package/dist/{dbTunnel-D000s0YK.cjs.map → dbTunnel-BfStDMkg.cjs.map} +1 -1
- package/dist/deploy/public.cjs +9 -9
- package/dist/deploy/public.d.cts +1 -1
- package/dist/deploy/public.d.mts +1 -1
- package/dist/deploy/public.mjs +9 -9
- package/dist/{deploy-DwtM6VSz.mjs → deploy-BKWc0NFs.mjs} +9 -9
- package/dist/{deploy-DwtM6VSz.mjs.map → deploy-BKWc0NFs.mjs.map} +1 -1
- package/dist/{deploy-DRH6q_2r.cjs → deploy-SRe6K6f2.cjs} +9 -9
- package/dist/{deploy-DRH6q_2r.cjs.map → deploy-SRe6K6f2.cjs.map} +1 -1
- package/dist/{destroy-ChTJ_oUq.cjs → destroy-cDWGXdvz.cjs} +7 -7
- package/dist/{destroy-ChTJ_oUq.cjs.map → destroy-cDWGXdvz.cjs.map} +1 -1
- package/dist/{destroy-C6QwLj3b.mjs → destroy-igN-bUYa.mjs} +7 -7
- package/dist/{destroy-C6QwLj3b.mjs.map → destroy-igN-bUYa.mjs.map} +1 -1
- package/dist/{dokploy-jeO7mz1R.cjs → dokploy-BSDyt4OK.cjs} +2 -2
- package/dist/{dokploy-jeO7mz1R.cjs.map → dokploy-BSDyt4OK.cjs.map} +1 -1
- package/dist/{dokploy-Dm8-eHtx.mjs → dokploy-DlgTAdSK.mjs} +2 -2
- package/dist/{dokploy-Dm8-eHtx.mjs.map → dokploy-DlgTAdSK.mjs.map} +1 -1
- package/dist/{eas-BAitvB5R.cjs → eas-2DGYQ0Qf.cjs} +2 -2
- package/dist/{eas-BAitvB5R.cjs.map → eas-2DGYQ0Qf.cjs.map} +1 -1
- package/dist/{eas-CXYo8hos.mjs → eas-DMg91c_V.mjs} +2 -2
- package/dist/{eas-CXYo8hos.mjs.map → eas-DMg91c_V.mjs.map} +1 -1
- package/dist/{encryption-B7IlQ6VO.mjs → encryption-4tw7AQve.mjs} +2 -2
- package/dist/{encryption-B7IlQ6VO.mjs.map → encryption-4tw7AQve.mjs.map} +1 -1
- package/dist/{encryption-OPCsewWc.cjs → encryption-CS5tEnE1.cjs} +2 -2
- package/dist/{encryption-OPCsewWc.cjs.map → encryption-CS5tEnE1.cjs.map} +1 -1
- package/dist/{engine-a6K99WIl.mjs → engine-4nWsBOM9.mjs} +6 -6
- package/dist/{engine-a6K99WIl.mjs.map → engine-4nWsBOM9.mjs.map} +1 -1
- package/dist/{engine-BSnhQLaB.cjs → engine-DBuoGHhE.cjs} +6 -6
- package/dist/{engine-BSnhQLaB.cjs.map → engine-DBuoGHhE.cjs.map} +1 -1
- package/dist/{github-D4hThtnt.mjs → github-CBexMKt6.mjs} +6 -6
- package/dist/{github-D4hThtnt.mjs.map → github-CBexMKt6.mjs.map} +1 -1
- package/dist/{github-C3gUSbLn.cjs → github-DVmVvYif.cjs} +6 -6
- package/dist/{github-C3gUSbLn.cjs.map → github-DVmVvYif.cjs.map} +1 -1
- package/dist/{googlePlay-C5Q7Zov3.cjs → googlePlay-C3Bn_DCj.cjs} +4 -4
- package/dist/{googlePlay-C5Q7Zov3.cjs.map → googlePlay-C3Bn_DCj.cjs.map} +1 -1
- package/dist/{googlePlay-DIS9PeFB.mjs → googlePlay-jTL8R6Q8.mjs} +4 -4
- package/dist/{googlePlay-DIS9PeFB.mjs.map → googlePlay-jTL8R6Q8.mjs.map} +1 -1
- package/dist/index.cjs +60 -60
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +60 -60
- package/dist/index.mjs.map +1 -1
- package/dist/{local-CMA_7b0_.mjs → local-BejxzczT.mjs} +2 -2
- package/dist/{local-CMA_7b0_.mjs.map → local-BejxzczT.mjs.map} +1 -1
- package/dist/{local-B5R1WWEO.cjs → local-PWkIhiU0.cjs} +2 -2
- package/dist/{local-B5R1WWEO.cjs.map → local-PWkIhiU0.cjs.map} +1 -1
- package/dist/{migrate-BhnCtwMX.mjs → migrate-Bl8oaz7u.mjs} +2 -2
- package/dist/{migrate-BhnCtwMX.mjs.map → migrate-Bl8oaz7u.mjs.map} +1 -1
- package/dist/{migrate-B0041tRF.cjs → migrate-ChKFKdH1.cjs} +4 -4
- package/dist/{migrate-B0041tRF.cjs.map → migrate-ChKFKdH1.cjs.map} +1 -1
- package/dist/{migrate-168wMF5m.mjs → migrate-DpnMqHxD.mjs} +4 -4
- package/dist/{migrate-168wMF5m.mjs.map → migrate-DpnMqHxD.mjs.map} +1 -1
- package/dist/{migrate-BZxh_zU5.cjs → migrate-Dxcfcm3A.cjs} +2 -2
- package/dist/{migrate-BZxh_zU5.cjs.map → migrate-Dxcfcm3A.cjs.map} +1 -1
- package/dist/{projectBucket-hF0-tlq9.mjs → projectBucket-BeCDyZQX.mjs} +2 -2
- package/dist/{projectBucket-hF0-tlq9.mjs.map → projectBucket-BeCDyZQX.mjs.map} +1 -1
- package/dist/{projectBucket-DEBaYEbi.cjs → projectBucket-D4AqCGVr.cjs} +2 -2
- package/dist/{projectBucket-DEBaYEbi.cjs.map → projectBucket-D4AqCGVr.cjs.map} +1 -1
- package/dist/{publish-_lVOoWCy.mjs → publish-CXqI2-U3.mjs} +2 -2
- package/dist/{publish-_lVOoWCy.mjs.map → publish-CXqI2-U3.mjs.map} +1 -1
- package/dist/{publish-B-ffSuAX.cjs → publish-e2lsR2Jq.cjs} +2 -2
- package/dist/{publish-B-ffSuAX.cjs.map → publish-e2lsR2Jq.cjs.map} +1 -1
- package/dist/{resolve-UK4b26dm.mjs → resolve-BMmiH24Y.mjs} +4 -4
- package/dist/{resolve-UK4b26dm.mjs.map → resolve-BMmiH24Y.mjs.map} +1 -1
- package/dist/{resolve-Cs38fbaX.cjs → resolve-BgjyMQZy.cjs} +4 -4
- package/dist/{resolve-Cs38fbaX.cjs.map → resolve-BgjyMQZy.cjs.map} +1 -1
- package/dist/{rollback-B0eg3M0J.mjs → rollback-BpJonwn6.mjs} +6 -6
- package/dist/{rollback-B0eg3M0J.mjs.map → rollback-BpJonwn6.mjs.map} +1 -1
- package/dist/{rollback-DByniS9X.cjs → rollback-Cf1JpbwJ.cjs} +6 -6
- package/dist/{rollback-DByniS9X.cjs.map → rollback-Cf1JpbwJ.cjs.map} +1 -1
- package/dist/{s3-B-IJWFJA.mjs → s3-CRShyAj_.mjs} +2 -2
- package/dist/{s3-B-IJWFJA.mjs.map → s3-CRShyAj_.mjs.map} +1 -1
- package/dist/{s3-4rmPI6wv.cjs → s3-P47E4YMA.cjs} +2 -2
- package/dist/{s3-4rmPI6wv.cjs.map → s3-P47E4YMA.cjs.map} +1 -1
- package/dist/{serverSetup-Cok75j21.mjs → serverSetup-gRotzelq.mjs} +6 -6
- package/dist/{serverSetup-Cok75j21.mjs.map → serverSetup-gRotzelq.mjs.map} +1 -1
- package/dist/{serverSetup-EY5vppoS.cjs → serverSetup-rJUXJgY4.cjs} +6 -6
- package/dist/{serverSetup-EY5vppoS.cjs.map → serverSetup-rJUXJgY4.cjs.map} +1 -1
- package/dist/{sniffer-CcLTONfm.cjs → sniffer-BQOt66oy.cjs} +6 -6
- package/dist/{sniffer-CcLTONfm.cjs.map → sniffer-BQOt66oy.cjs.map} +1 -1
- package/dist/{sniffer-DIyYcOXJ.mjs → sniffer-D82SAjc_.mjs} +6 -6
- package/dist/{sniffer-DIyYcOXJ.mjs.map → sniffer-D82SAjc_.mjs.map} +1 -1
- package/dist/{snsSubscriptions-Bore7t-W.cjs → snsSubscriptions-Ci62xcrq.cjs} +2 -2
- package/dist/{snsSubscriptions-Bore7t-W.cjs.map → snsSubscriptions-Ci62xcrq.cjs.map} +1 -1
- package/dist/{snsSubscriptions-CYEVD7ml.mjs → snsSubscriptions-D-1y_R8M.mjs} +2 -2
- package/dist/{snsSubscriptions-CYEVD7ml.mjs.map → snsSubscriptions-D-1y_R8M.mjs.map} +1 -1
- package/dist/{sst-Bsu5O1Lt.cjs → sst-BBNnVnl2.cjs} +5 -5
- package/dist/{sst-Bsu5O1Lt.cjs.map → sst-BBNnVnl2.cjs.map} +1 -1
- package/dist/{sst-DBH707Na.mjs → sst-CbJS1d--.mjs} +5 -5
- package/dist/{sst-DBH707Na.mjs.map → sst-CbJS1d--.mjs.map} +1 -1
- package/dist/{stack-DU2SunuO.mjs → stack-BXyv__ZA.mjs} +41 -19
- package/dist/stack-BXyv__ZA.mjs.map +1 -0
- package/dist/{stack-CwSx-6ea.cjs → stack-DmZPFXyz.cjs} +40 -18
- package/dist/stack-DmZPFXyz.cjs.map +1 -0
- package/dist/{stage-BgD-kKY3.cjs → stage-CvUrBgxq.cjs} +4 -4
- package/dist/{stage-BgD-kKY3.cjs.map → stage-CvUrBgxq.cjs.map} +1 -1
- package/dist/{stage-BGyx0OjL.mjs → stage-xkuXOSsr.mjs} +4 -4
- package/dist/{stage-BGyx0OjL.mjs.map → stage-xkuXOSsr.mjs.map} +1 -1
- package/dist/target/public.cjs +1 -1
- package/dist/target/public.mjs +1 -1
- package/dist/{terminal-GyXHsRAl.cjs → terminal-BFUESry5.cjs} +2 -2
- package/dist/{terminal-GyXHsRAl.cjs.map → terminal-BFUESry5.cjs.map} +1 -1
- package/dist/{terminal-BlJ90AIM.mjs → terminal-iOb1b-eG.mjs} +2 -2
- package/dist/{terminal-BlJ90AIM.mjs.map → terminal-iOb1b-eG.mjs.map} +1 -1
- package/package.json +16 -16
- package/dist/config-CTrfNKYd.d.mts.map +0 -1
- package/dist/config-D9g_nYIu.d.cts.map +0 -1
- package/dist/credentials-BMdpNO8R.mjs.map +0 -1
- package/dist/credentials-C3uaZ80e.cjs.map +0 -1
- package/dist/stack-CwSx-6ea.cjs.map +0 -1
- package/dist/stack-DU2SunuO.mjs.map +0 -1
|
@@ -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-
|
|
3
|
+
import { t as MissingCredential } from "./credentials-CcEXccxO.mjs";
|
|
4
|
+
import { Yn as CommandFailed, a as deployedInboxEnv } from "./stack-BXyv__ZA.mjs";
|
|
5
5
|
import { ot as appKey } from "./workspace-CdiCMRap.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-B3lji5Yq.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-BejxzczT.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-CbJS1d--.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sst-DBH707Na.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,W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AAE,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-CbJS1d--.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,Y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,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, X as gkmHome, a as eventsBackendFor, i as cacheBackendFor, o as providerOf, r as storedCredentials, t as MissingCredential, v as externalsManifestName } from "./credentials-
|
|
3
|
+
import { A as deployIdentity, H as getHostingerToken, L as stageTag, M as imageRef, X as gkmHome, a as eventsBackendFor, i as cacheBackendFor, o as providerOf, r as storedCredentials, t as MissingCredential, v as externalsManifestName } from "./credentials-CcEXccxO.mjs";
|
|
4
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-CdiCMRap.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-
|
|
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-B3lji5Yq.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";
|
|
@@ -950,12 +950,21 @@ function credentialOf(options) {
|
|
|
950
950
|
* stored URL naming an old port is the drift resolution replaces. A command
|
|
951
951
|
* whose stage says a value by hand (a deployed stack's) leaves that key out
|
|
952
952
|
* of `resolved`.
|
|
953
|
+
*
|
|
954
|
+
* But for a frontend's stage (`PUBLIC_STAGE_KEYS`), which is a name rather
|
|
955
|
+
* than an address: a stored one is how the stage told its bundle what it is
|
|
956
|
+
* called, and it wins here as it wins in an image build.
|
|
953
957
|
*/
|
|
954
958
|
function stageEnv(stored, resolved) {
|
|
955
|
-
|
|
959
|
+
const env = {
|
|
956
960
|
...stored,
|
|
957
961
|
...resolved
|
|
958
962
|
};
|
|
963
|
+
for (const key of PUBLIC_STAGE_KEYS) {
|
|
964
|
+
const value = stored[key];
|
|
965
|
+
if (value !== void 0) env[key] = value;
|
|
966
|
+
}
|
|
967
|
+
return env;
|
|
959
968
|
}
|
|
960
969
|
/**
|
|
961
970
|
* The token a stack's own services prove themselves with at its edge
|
|
@@ -1076,6 +1085,7 @@ function publicEnv(plan, resolved, addresses = {}) {
|
|
|
1076
1085
|
const origins = imageOrigins(resource.imageOrigins.sources, (key) => resolved[key]);
|
|
1077
1086
|
if (origins) env[resource.imageOrigins.key] = origins;
|
|
1078
1087
|
}
|
|
1088
|
+
if (resource.stageKey && resolved[resource.envKey]) env[resource.stageKey] = plan.stage;
|
|
1079
1089
|
}
|
|
1080
1090
|
return env;
|
|
1081
1091
|
}
|
|
@@ -2542,13 +2552,16 @@ var SiteBuildValueUnresolved = class extends GkmError {
|
|
|
2542
2552
|
* variant's public prefix (`NEXT_PUBLIC_APP_STORE_URL` on a `next` site) was
|
|
2543
2553
|
* declared public by whoever named it, so it is passed. Anything else is
|
|
2544
2554
|
* not: a secret without the prefix never reaches a site's build.
|
|
2555
|
+
* - **The stage it is built for**, under the prefix (`NEXT_PUBLIC_STAGE`):
|
|
2556
|
+
* what a bundle gates production-only code on, as a process reads `STAGE`.
|
|
2557
|
+
* A stage secret of that name wins, unlike every other derived value.
|
|
2545
2558
|
*
|
|
2546
2559
|
* A value the stage resolves to nothing is left out rather than passed empty
|
|
2547
2560
|
* — except, with `requireFileOrigins`, where its pages load files from.
|
|
2548
2561
|
* A derived value wins over a stage secret of the same name: the site's
|
|
2549
2562
|
* addresses are the construct's, not a copy someone set.
|
|
2550
2563
|
*/
|
|
2551
|
-
function publicBuildValues(site, manifest, resolve, secrets, options
|
|
2564
|
+
function publicBuildValues(site, manifest, resolve, secrets, options) {
|
|
2552
2565
|
const args = {};
|
|
2553
2566
|
const own = providedKeyFor(site.id, site.kind, site.kind === "site" ? "url" : "scheme");
|
|
2554
2567
|
const ownValue = resolve(own);
|
|
@@ -2559,20 +2572,20 @@ function publicBuildValues(site, manifest, resolve, secrets, options = {}) {
|
|
|
2559
2572
|
if (value) args[key] = value;
|
|
2560
2573
|
}
|
|
2561
2574
|
const prefix = PUBLIC_PREFIX[site.variant];
|
|
2562
|
-
const
|
|
2563
|
-
if (required) for (const value of publicValues(site, manifest)) {
|
|
2575
|
+
if (options.requireFileOrigins) for (const value of publicValues(site, manifest)) {
|
|
2564
2576
|
if (value.kind === "file-server" && value.role === "url") {
|
|
2565
|
-
if (!resolve(value.key)) throw new SiteBuildValueUnresolved(site.id, value.key,
|
|
2577
|
+
if (!resolve(value.key)) throw new SiteBuildValueUnresolved(site.id, value.key, options.stage);
|
|
2566
2578
|
}
|
|
2567
2579
|
if (value.kind === "objects" && value.role === "signedOrigin") {
|
|
2568
2580
|
const connection = providedKeyFor(value.id, "objects", "connectionString");
|
|
2569
|
-
if (!resolve(value.key) && !resolve(connection)) throw new SiteBuildValueUnresolved(site.id, value.key,
|
|
2581
|
+
if (!resolve(value.key) && !resolve(connection)) throw new SiteBuildValueUnresolved(site.id, value.key, options.stage, connection);
|
|
2570
2582
|
}
|
|
2571
2583
|
}
|
|
2572
2584
|
const images = imageOriginsFor(site, manifest);
|
|
2573
2585
|
const origins = images && imageOrigins(images.sources, (source) => resolve(source) ?? derived[source]);
|
|
2574
2586
|
if (images && origins) args[images.key] = origins;
|
|
2575
2587
|
for (const [key, value] of Object.entries(secrets)) if (key.startsWith(prefix) && args[key] === void 0 && value) args[key] = value;
|
|
2588
|
+
args[publicStageKey(site)] ??= options.stage;
|
|
2576
2589
|
return args;
|
|
2577
2590
|
}
|
|
2578
2591
|
/**
|
|
@@ -5745,10 +5758,10 @@ function localPlan(workspace, manifest, fakes = {}, credentialFakes = {}) {
|
|
|
5745
5758
|
* addresses a *browser* can open, since that is where the bundle runs — the
|
|
5746
5759
|
* host's port for each app, never a name on the compose network.
|
|
5747
5760
|
*/
|
|
5748
|
-
function sitePublicArgs(manifest, appName, env) {
|
|
5761
|
+
function sitePublicArgs(manifest, appName, env, stage) {
|
|
5749
5762
|
const declaration = Object.entries(manifest).find(([id, d]) => d.kind === "site" && appKey(id) === appName)?.[1];
|
|
5750
5763
|
if (declaration?.kind !== "site") return {};
|
|
5751
|
-
return publicBuildValues(declaration, manifest, (key) => env[key], {});
|
|
5764
|
+
return publicBuildValues(declaration, manifest, (key) => env[key], {}, { stage });
|
|
5752
5765
|
}
|
|
5753
5766
|
/**
|
|
5754
5767
|
* Every key a plan resolves, with each container addressed by its service
|
|
@@ -5854,6 +5867,7 @@ function appEnvKeys(manifest, appName) {
|
|
|
5854
5867
|
for (const { key } of publicValues(declaration, manifest)) keys.add(key);
|
|
5855
5868
|
const images = imageOriginsFor(declaration, manifest);
|
|
5856
5869
|
if (images) keys.add(images.key);
|
|
5870
|
+
keys.add(publicStageKey(declaration));
|
|
5857
5871
|
}
|
|
5858
5872
|
return keys;
|
|
5859
5873
|
}
|
|
@@ -6065,7 +6079,7 @@ function appServices(workspace, manifest, containers, credentials, fakes = {}, c
|
|
|
6065
6079
|
});
|
|
6066
6080
|
const ports = [`${app.port}:${app.port}`];
|
|
6067
6081
|
if (app.type === "web") {
|
|
6068
|
-
const args = sitePublicArgs(manifest, name, browser);
|
|
6082
|
+
const args = sitePublicArgs(manifest, name, browser, plan.stage);
|
|
6069
6083
|
services[key] = {
|
|
6070
6084
|
image: `${key}:\${TAG:-latest}`,
|
|
6071
6085
|
build: {
|
|
@@ -7999,7 +8013,8 @@ function siteDockerfile(appName, app, options) {
|
|
|
7999
8013
|
const publicUrlArgs = options.publicUrlArgs ?? (declared?.kind === "site" && options.manifest ? [
|
|
8000
8014
|
providedKeyFor(declared.id, declared.kind, "url"),
|
|
8001
8015
|
...Object.keys(publicEnvFor(declared, options.manifest)),
|
|
8002
|
-
...[imageOriginsFor(declared, options.manifest)?.key].filter((key) => key !== void 0)
|
|
8016
|
+
...[imageOriginsFor(declared, options.manifest)?.key].filter((key) => key !== void 0),
|
|
8017
|
+
publicStageKey(declared)
|
|
8003
8018
|
] : getPublicUrlArgNames(app));
|
|
8004
8019
|
const webOpts = {
|
|
8005
8020
|
...options.image,
|
|
@@ -9841,7 +9856,10 @@ function composeStack(input) {
|
|
|
9841
9856
|
for (const app of apps) {
|
|
9842
9857
|
const site = manifest[app.id];
|
|
9843
9858
|
if (site?.kind === "site") {
|
|
9844
|
-
const args = publicBuildValues(site, manifest, (key) => valueFor(app, key, owners.get(key)) ?? plannedOrigins.get(key), custom,
|
|
9859
|
+
const args = publicBuildValues(site, manifest, (key) => valueFor(app, key, owners.get(key)) ?? plannedOrigins.get(key), custom, {
|
|
9860
|
+
stage,
|
|
9861
|
+
requireFileOrigins: !local && app.build !== void 0
|
|
9862
|
+
});
|
|
9845
9863
|
if (app.prerender && input.prerenderRun) args[PRERENDER_RUN_ARG] = input.prerenderRun;
|
|
9846
9864
|
Object.assign(args, nextBuildValues(site, stageTag(input.images.tag, stage), custom));
|
|
9847
9865
|
if (app.build && Object.keys(args).length > 0) app.build.args = args;
|
|
@@ -9875,7 +9893,7 @@ function composeStack(input) {
|
|
|
9875
9893
|
mobileApps.push({
|
|
9876
9894
|
name: app.name,
|
|
9877
9895
|
id: app.id,
|
|
9878
|
-
values: publicBuildValues(declaration, manifest, (key) => valueFor(app, key, owners.get(key)) ?? plannedOrigins.get(key), custom)
|
|
9896
|
+
values: publicBuildValues(declaration, manifest, (key) => valueFor(app, key, owners.get(key)) ?? plannedOrigins.get(key), custom, { stage })
|
|
9879
9897
|
});
|
|
9880
9898
|
}
|
|
9881
9899
|
for (const worker of input.buildOnly ? [] : workers) {
|
|
@@ -10308,7 +10326,9 @@ function recordedSubscriptions(worker, push, recorded = {}) {
|
|
|
10308
10326
|
* A wildcard site on a deployed stage with nowhere to get a certificate for
|
|
10309
10327
|
* its tenants' hosts from. Let's Encrypt issues a wildcard certificate only
|
|
10310
10328
|
* over the DNS challenge, so the stage either brings its own or gives the
|
|
10311
|
-
* proxy a way to get one.
|
|
10329
|
+
* proxy a way to get one. On the stack's own Caddy that is a certificate per
|
|
10330
|
+
* host on demand, and only there is the site's `hosts` route required: the
|
|
10331
|
+
* one place the rule lives.
|
|
10312
10332
|
*/
|
|
10313
10333
|
var WildcardSiteCertificateMissing = class extends GkmError {
|
|
10314
10334
|
site;
|
|
@@ -10316,7 +10336,7 @@ var WildcardSiteCertificateMissing = class extends GkmError {
|
|
|
10316
10336
|
proxy;
|
|
10317
10337
|
domain;
|
|
10318
10338
|
constructor(site, stage, proxy, domain) {
|
|
10319
|
-
super(proxy === "traefik" ? `'${site}' answers on every subdomain of ${domain}, and '${stage}' has no certificate for them. Set deploy.compose.tls for '${stage}' to a *.${domain} certificate, or manage ${domain} with dns: { '<root domain>': { provider: ${Object.keys(ACME_DNS_CHALLENGES).map((p) => `'${p}'`).join(" | ")} } } so the shared edge gets one over the DNS challenge.` : `'${site}' answers on every subdomain of ${domain}, and '${stage}' has no certificate for them. Set deploy.compose.tls for '${stage}' to a *.${domain} certificate, or
|
|
10339
|
+
super(proxy === "traefik" ? `'${site}' answers on every subdomain of ${domain}, and '${stage}' has no certificate for them. Set deploy.compose.tls for '${stage}' to a *.${domain} certificate, or manage ${domain} with dns: { '<root domain>': { provider: ${Object.keys(ACME_DNS_CHALLENGES).map((p) => `'${p}'`).join(" | ")} } } so the shared edge gets one over the DNS challenge.` : `'${site}' answers on every subdomain of ${domain}, and '${stage}' has no certificate for them. Set deploy.compose.tls for '${stage}' to a *.${domain} certificate, or let Caddy get one per tenant on demand by giving the site \`hosts\` — \`hosts: { surface: api, path: '/tenants/hosts' }\`, a GET route answering 200 for a tenant. On-demand certificates need it: Caddy asks it before issuing one, so no request can make it get certificates for hosts that are no tenant.`);
|
|
10320
10340
|
this.site = site;
|
|
10321
10341
|
this.stage = stage;
|
|
10322
10342
|
this.proxy = proxy;
|
|
@@ -10330,7 +10350,9 @@ var WildcardSiteCertificateMissing = class extends GkmError {
|
|
|
10330
10350
|
* first; then, on the shared Traefik edge, a `*.<domain>` one over the DNS
|
|
10331
10351
|
* challenge when a provider the edge can answer it through manages the
|
|
10332
10352
|
* domain (`ACME_DNS_CHALLENGES`); on the stack's own Caddy, one
|
|
10333
|
-
* per host on demand, asked of the site's `hosts` route.
|
|
10353
|
+
* per host on demand, asked of the site's `hosts` route. That last is the
|
|
10354
|
+
* only certificate that needs `hosts`: behind a wildcard one every label but
|
|
10355
|
+
* the protected ones reaches the site, and the app answers an unknown tenant.
|
|
10334
10356
|
*
|
|
10335
10357
|
* @throws {WildcardSiteCertificateMissing} when neither applies
|
|
10336
10358
|
*/
|
|
@@ -10741,4 +10763,4 @@ function withLogsPort(stack, port) {
|
|
|
10741
10763
|
//#endregion
|
|
10742
10764
|
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 };
|
|
10743
10765
|
|
|
10744
|
-
//# sourceMappingURL=stack-
|
|
10766
|
+
//# sourceMappingURL=stack-BXyv__ZA.mjs.map
|